pub struct OpenSearchVectorStoreBuilder { /* private fields */ }Expand description
Builds an OpenSearchVectorStore with optional auto-index-creation.
§Example
use daimon_plugin_opensearch::{OpenSearchVectorStoreBuilder, SpaceType, Engine};
let store = OpenSearchVectorStoreBuilder::new("http://localhost:9200", 1536)
.index("embeddings")
.space_type(SpaceType::CosineSimilarity)
.engine(Engine::Lucene)
.hnsw_m(16)
.hnsw_ef_construction(256)
.auto_create_index(true)
.build()
.await?;Implementations§
Source§impl OpenSearchVectorStoreBuilder
impl OpenSearchVectorStoreBuilder
Sourcepub fn new(url: impl Into<String>, dimensions: usize) -> Self
pub fn new(url: impl Into<String>, dimensions: usize) -> Self
Creates a new builder.
url: OpenSearch cluster URL (e.g."http://localhost:9200")dimensions: the fixed vector dimension count (must match your embedding model)
Sourcepub fn index(self, index: impl Into<String>) -> Self
pub fn index(self, index: impl Into<String>) -> Self
Sets the index name. Default: "daimon_vectors".
Sourcepub fn space_type(self, space_type: SpaceType) -> Self
pub fn space_type(self, space_type: SpaceType) -> Self
Sets the k-NN space type (distance metric). Default: SpaceType::CosineSimilarity.
Sourcepub fn engine(self, engine: Engine) -> Self
pub fn engine(self, engine: Engine) -> Self
Sets the k-NN engine. Default: Engine::Lucene.
Sourcepub fn auto_create_index(self, enabled: bool) -> Self
pub fn auto_create_index(self, enabled: bool) -> Self
Enables or disables automatic index creation on first use.
Default: true.
When disabled, use the JSON from crate::index_settings to create
the index manually.
Sourcepub fn hnsw_m(self, m: usize) -> Self
pub fn hnsw_m(self, m: usize) -> Self
Sets the HNSW m parameter (max connections per layer).
None uses the engine default.
Sourcepub fn hnsw_ef_construction(self, ef: usize) -> Self
pub fn hnsw_ef_construction(self, ef: usize) -> Self
Sets the HNSW ef_construction parameter (build-time search width).
None uses the engine default.
Sourcepub async fn build_with_client(
self,
client: OpenSearch,
) -> Result<OpenSearchVectorStore>
pub async fn build_with_client( self, client: OpenSearch, ) -> Result<OpenSearchVectorStore>
Builds an OpenSearchVectorStore from a pre-existing OpenSearch client.
Use this when you need custom transport configuration (e.g. AWS SigV4, custom certificates, connection pool tuning).
Sourcepub async fn build(self) -> Result<OpenSearchVectorStore>
pub async fn build(self) -> Result<OpenSearchVectorStore>
Builds the OpenSearchVectorStore, optionally creating the index.
Auto Trait Implementations§
impl Freeze for OpenSearchVectorStoreBuilder
impl RefUnwindSafe for OpenSearchVectorStoreBuilder
impl Send for OpenSearchVectorStoreBuilder
impl Sync for OpenSearchVectorStoreBuilder
impl Unpin for OpenSearchVectorStoreBuilder
impl UnsafeUnpin for OpenSearchVectorStoreBuilder
impl UnwindSafe for OpenSearchVectorStoreBuilder
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more