pub struct Client { /* private fields */ }Expand description
The core of the ElasticSearch client, owns a HTTP connection.
Each instance of Client is reusable, but only one thread can use each one
at once. This will be enforced by the borrow-checker as most methods are
defined on &mut self.
To create a Client, the URL needs to be specified.
Each ElasticSearch API operation is defined as a method on Client. Any
compulsory parameters must be given as arguments to this method. It returns
an operation builder that can be used to add any optional parameters.
Finally send is called to submit the operation:
§Examples
use rs_es::Client;
let mut client = Client::init("http://localhost:9200");See the specific operations and their builder objects for details.
Implementations§
Source§impl Client
impl Client
Sourcepub fn analyze<'a>(&'a mut self, body: &'a str) -> AnalyzeOperation<'_, '_>
pub fn analyze<'a>(&'a mut self, body: &'a str) -> AnalyzeOperation<'_, '_>
Analyze
See: https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-analyze.html
Source§impl Client
impl Client
Sourcepub fn bulk<'a, 'b, S>(
&'a mut self,
actions: &'b [Action<S>],
) -> BulkOperation<'a, 'b, S>where
S: Serialize,
pub fn bulk<'a, 'b, S>(
&'a mut self,
actions: &'b [Action<S>],
) -> BulkOperation<'a, 'b, S>where
S: Serialize,
Bulk
See: https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-bulk.html
Source§impl Client
impl Client
Sourcepub fn delete_index<'a>(
&'a mut self,
index: &'a str,
) -> Result<GenericResult, EsError>
pub fn delete_index<'a>( &'a mut self, index: &'a str, ) -> Result<GenericResult, EsError>
Delete given index
TODO: ensure all options are supported, replace with a DeleteIndexOperation to
follow the pattern defined elsewhere.
See: https://www.elastic.co/guide/en/elasticsearch/reference/2.x/indices-delete-index.html
Source§impl Client
impl Client
Sourcepub fn get<'a>(
&'a mut self,
index: &'a str,
id: &'a str,
) -> GetOperation<'_, '_>
pub fn get<'a>( &'a mut self, index: &'a str, id: &'a str, ) -> GetOperation<'_, '_>
Implementation of the ES GET API
See: https://www.elastic.co/guide/en/elasticsearch/reference/1.x/docs-get.html
Source§impl Client
impl Client
Sourcepub fn open_index<'a>(
&'a mut self,
index: &'a str,
) -> Result<GenericResult, EsError>
pub fn open_index<'a>( &'a mut self, index: &'a str, ) -> Result<GenericResult, EsError>
Open the index, making it available.
Sourcepub fn close_index<'a>(
&'a mut self,
index: &'a str,
) -> Result<GenericResult, EsError>
pub fn close_index<'a>( &'a mut self, index: &'a str, ) -> Result<GenericResult, EsError>
Close the index, making it unavailable and modifiable.
Source§impl Client
impl Client
Sourcepub fn refresh(&mut self) -> RefreshOperation<'_, '_>
pub fn refresh(&mut self) -> RefreshOperation<'_, '_>
Refresh
See: https://www.elastic.co/guide/en/elasticsearch/reference/1.x/indices-refresh.html
Source§impl Client
impl Client
Sourcepub fn count_uri(&mut self) -> CountURIOperation<'_, '_>
pub fn count_uri(&mut self) -> CountURIOperation<'_, '_>
Count via the query parameter
See: https://www.elastic.co/guide/en/elasticsearch/reference/1.x/search-uri-request.html
Sourcepub fn count_query(&mut self) -> CountQueryOperation<'_, '_>
pub fn count_query(&mut self) -> CountQueryOperation<'_, '_>
Count via the query DSL
See: https://www.elastic.co/guide/en/elasticsearch/reference/1.x/search-request-body.html
Source§impl Client
impl Client
Sourcepub fn search_uri(&mut self) -> SearchURIOperation<'_, '_>
pub fn search_uri(&mut self) -> SearchURIOperation<'_, '_>
Search via the query parameter
See: https://www.elastic.co/guide/en/elasticsearch/reference/1.x/search-uri-request.html
Sourcepub fn search_query(&mut self) -> SearchQueryOperation<'_, '_>
pub fn search_query(&mut self) -> SearchQueryOperation<'_, '_>
Search via the query DSL
See: https://www.elastic.co/guide/en/elasticsearch/reference/1.x/search-request-body.html
Source§impl Client
impl Client
Sourcepub fn version(&mut self) -> VersionOperation<'_>
pub fn version(&mut self) -> VersionOperation<'_>
Calls the base ES path, returning the version number
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Client
impl !RefUnwindSafe for Client
impl Send for Client
impl Sync for Client
impl Unpin for Client
impl !UnwindSafe for Client
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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