pub struct OpenSearchClient { /* private fields */ }Expand description
A handle to one OpenSearch cluster.
Implementations§
Source§impl OpenSearchClient
impl OpenSearchClient
Sourcepub fn new(base_url: impl Into<String>) -> Self
pub fn new(base_url: impl Into<String>) -> Self
base_url e.g. http://localhost:9200 (a trailing slash is tolerated).
Sourcepub fn with_client(self, http: Client) -> Self
pub fn with_client(self, http: Client) -> Self
Use a preconfigured reqwest::Client (timeouts, connection limits, TLS roots, headers).
Sourcepub fn with_basic_auth(
self,
user: impl Into<String>,
password: impl Into<String>,
) -> Self
pub fn with_basic_auth( self, user: impl Into<String>, password: impl Into<String>, ) -> Self
Send HTTP basic credentials with every request (the OpenSearch security plugin’s default).
Sourcepub fn with_bearer_token(self, token: impl Into<String>) -> Self
pub fn with_bearer_token(self, token: impl Into<String>) -> Self
Send a bearer token with every request.
Sourcepub async fn search(&self, index: &str, body: &Value) -> Result<Vec<Value>>
pub async fn search(&self, index: &str, body: &Value) -> Result<Vec<Value>>
Run one _search against index and return each hit’s _source. A missing index (404)
yields an empty result rather than an error, so a table over an index that has not been
created yet simply reads as empty.
Sourcepub async fn search_page(
&self,
index: &str,
body: &Value,
keep_alive: Option<&str>,
) -> Result<SearchPage>
pub async fn search_page( &self, index: &str, body: &Value, keep_alive: Option<&str>, ) -> Result<SearchPage>
Run a _search, optionally opening a scroll cursor (keep_alive e.g. "1m") so the rest
of the result can be paged with scroll. A missing index reads as empty.
Sourcepub async fn scroll(
&self,
scroll_id: &str,
keep_alive: &str,
) -> Result<SearchPage>
pub async fn scroll( &self, scroll_id: &str, keep_alive: &str, ) -> Result<SearchPage>
Fetch the next page of an open scroll.
Sourcepub async fn clear_scroll(&self, scroll_id: &str)
pub async fn clear_scroll(&self, scroll_id: &str)
Release a scroll cursor early (best effort — the server expires it anyway).
Trait Implementations§
Source§impl Clone for OpenSearchClient
impl Clone for OpenSearchClient
Source§fn clone(&self) -> OpenSearchClient
fn clone(&self) -> OpenSearchClient
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl !RefUnwindSafe for OpenSearchClient
impl !UnwindSafe for OpenSearchClient
impl Freeze for OpenSearchClient
impl Send for OpenSearchClient
impl Sync for OpenSearchClient
impl Unpin for OpenSearchClient
impl UnsafeUnpin for OpenSearchClient
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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