Skip to main content

OpenSearchVectorStoreBuilder

Struct OpenSearchVectorStoreBuilder 

Source
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

Source

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)
Source

pub fn index(self, index: impl Into<String>) -> Self

Sets the index name. Default: "daimon_vectors".

Source

pub fn space_type(self, space_type: SpaceType) -> Self

Sets the k-NN space type (distance metric). Default: SpaceType::CosineSimilarity.

Source

pub fn engine(self, engine: Engine) -> Self

Sets the k-NN engine. Default: Engine::Lucene.

Source

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.

Source

pub fn hnsw_m(self, m: usize) -> Self

Sets the HNSW m parameter (max connections per layer). None uses the engine default.

Source

pub fn hnsw_ef_construction(self, ef: usize) -> Self

Sets the HNSW ef_construction parameter (build-time search width). None uses the engine default.

Source

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).

Source

pub async fn build(self) -> Result<OpenSearchVectorStore>

Builds the OpenSearchVectorStore, optionally creating the index.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more