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.