[−][src]Struct elasticsearch::Elasticsearch
Root client for top level APIs
Implementations
impl Elasticsearch
[src]
pub fn new(transport: Transport) -> Self
[src]
Creates a new instance of the root client
pub fn transport(&self) -> &Transport
[src]
Gets the transport of the client
pub async fn send<'_, '_, '_, B, Q: ?Sized>(
&'_ self,
method: Method,
path: &'_ str,
headers: HeaderMap,
query_string: Option<&'_ Q>,
body: Option<B>
) -> Result<Response, Error> where
B: Body,
Q: Serialize,
[src]
&'_ self,
method: Method,
path: &'_ str,
headers: HeaderMap,
query_string: Option<&'_ Q>,
body: Option<B>
) -> Result<Response, Error> where
B: Body,
Q: Serialize,
Creates an asynchronous request that can be awaited
Accepts the HTTP method and relative path to an API, and optional query string and body.
impl Elasticsearch
[src]
pub fn async_search(&self) -> AsyncSearch
[src]
Creates a namespace client for AsyncSearch APIs
impl Elasticsearch
[src]
impl Elasticsearch
[src]
impl Elasticsearch
[src]
impl Elasticsearch
[src]
impl Elasticsearch
[src]
impl Elasticsearch
[src]
impl Elasticsearch
[src]
impl Elasticsearch
[src]
impl Elasticsearch
[src]
impl Elasticsearch
[src]
impl Elasticsearch
[src]
impl Elasticsearch
[src]
impl Elasticsearch
[src]
impl Elasticsearch
[src]
impl Elasticsearch
[src]
impl Elasticsearch
[src]
impl Elasticsearch
[src]
impl Elasticsearch
[src]
impl Elasticsearch
[src]
impl Elasticsearch
[src]
impl Elasticsearch
[src]
impl Elasticsearch
[src]
pub fn bulk<'a, 'b>(&'a self, parts: BulkParts<'b>) -> Bulk<'a, 'b, ()>
[src]
Allows to perform multiple index/update/delete operations in a single request.
pub fn clear_scroll<'a, 'b>(
&'a self,
parts: ClearScrollParts<'b>
) -> ClearScroll<'a, 'b, ()>
[src]
&'a self,
parts: ClearScrollParts<'b>
) -> ClearScroll<'a, 'b, ()>
Explicitly clears the search context for a scroll.
pub fn count<'a, 'b>(&'a self, parts: CountParts<'b>) -> Count<'a, 'b, ()>
[src]
Returns number of documents matching a query.
pub fn create<'a, 'b>(&'a self, parts: CreateParts<'b>) -> Create<'a, 'b, ()>
[src]
Creates a new document in the index.
Returns a 409 response when a document with a same ID already exists in the index.
pub fn delete<'a, 'b>(&'a self, parts: DeleteParts<'b>) -> Delete<'a, 'b>
[src]
Removes a document from the index.
pub fn delete_by_query<'a, 'b>(
&'a self,
parts: DeleteByQueryParts<'b>
) -> DeleteByQuery<'a, 'b, ()>
[src]
&'a self,
parts: DeleteByQueryParts<'b>
) -> DeleteByQuery<'a, 'b, ()>
Deletes documents matching the provided query.
pub fn delete_by_query_rethrottle<'a, 'b>(
&'a self,
parts: DeleteByQueryRethrottleParts<'b>
) -> DeleteByQueryRethrottle<'a, 'b, ()>
[src]
&'a self,
parts: DeleteByQueryRethrottleParts<'b>
) -> DeleteByQueryRethrottle<'a, 'b, ()>
Delete By Query Rethrottle API
Changes the number of requests per second for a particular Delete By Query operation.
pub fn delete_script<'a, 'b>(
&'a self,
parts: DeleteScriptParts<'b>
) -> DeleteScript<'a, 'b>
[src]
&'a self,
parts: DeleteScriptParts<'b>
) -> DeleteScript<'a, 'b>
Deletes a script.
pub fn exists<'a, 'b>(&'a self, parts: ExistsParts<'b>) -> Exists<'a, 'b>
[src]
Returns information about whether a document exists in an index.
pub fn exists_source<'a, 'b>(
&'a self,
parts: ExistsSourceParts<'b>
) -> ExistsSource<'a, 'b>
[src]
&'a self,
parts: ExistsSourceParts<'b>
) -> ExistsSource<'a, 'b>
Returns information about whether a document source exists in an index.
pub fn explain<'a, 'b>(&'a self, parts: ExplainParts<'b>) -> Explain<'a, 'b, ()>
[src]
Returns information about why a specific matches (or doesn't match) a query.
pub fn field_caps<'a, 'b>(
&'a self,
parts: FieldCapsParts<'b>
) -> FieldCaps<'a, 'b, ()>
[src]
&'a self,
parts: FieldCapsParts<'b>
) -> FieldCaps<'a, 'b, ()>
Returns the information about the capabilities of fields among multiple indices.
pub fn get<'a, 'b>(&'a self, parts: GetParts<'b>) -> Get<'a, 'b>
[src]
Returns a document.
pub fn get_script<'a, 'b>(
&'a self,
parts: GetScriptParts<'b>
) -> GetScript<'a, 'b>
[src]
&'a self,
parts: GetScriptParts<'b>
) -> GetScript<'a, 'b>
Returns a script.
pub fn get_source<'a, 'b>(
&'a self,
parts: GetSourceParts<'b>
) -> GetSource<'a, 'b>
[src]
&'a self,
parts: GetSourceParts<'b>
) -> GetSource<'a, 'b>
Returns the source of a document.
pub fn index<'a, 'b>(&'a self, parts: IndexParts<'b>) -> Index<'a, 'b, ()>
[src]
Creates or updates a document in an index.
pub fn info<'a, 'b>(&'a self) -> Info<'a, 'b>
[src]
Returns basic information about the cluster.
pub fn mget<'a, 'b>(&'a self, parts: MgetParts<'b>) -> Mget<'a, 'b, ()>
[src]
Allows to get multiple documents in one request.
pub fn msearch<'a, 'b>(&'a self, parts: MsearchParts<'b>) -> Msearch<'a, 'b, ()>
[src]
Allows to execute several search operations in one request.
pub fn msearch_template<'a, 'b>(
&'a self,
parts: MsearchTemplateParts<'b>
) -> MsearchTemplate<'a, 'b, ()>
[src]
&'a self,
parts: MsearchTemplateParts<'b>
) -> MsearchTemplate<'a, 'b, ()>
Allows to execute several search template operations in one request.
pub fn mtermvectors<'a, 'b>(
&'a self,
parts: MtermvectorsParts<'b>
) -> Mtermvectors<'a, 'b, ()>
[src]
&'a self,
parts: MtermvectorsParts<'b>
) -> Mtermvectors<'a, 'b, ()>
Returns multiple termvectors in one request.
pub fn ping<'a, 'b>(&'a self) -> Ping<'a, 'b>
[src]
Returns whether the cluster is running.
pub fn put_script<'a, 'b>(
&'a self,
parts: PutScriptParts<'b>
) -> PutScript<'a, 'b, ()>
[src]
&'a self,
parts: PutScriptParts<'b>
) -> PutScript<'a, 'b, ()>
Creates or updates a script.
pub fn reindex<'a, 'b>(&'a self) -> Reindex<'a, 'b, ()>
[src]
Allows to copy documents from one index to another, optionally filtering the source documents by a query, changing the destination index settings, or fetching the documents from a remote cluster.
pub fn reindex_rethrottle<'a, 'b>(
&'a self,
parts: ReindexRethrottleParts<'b>
) -> ReindexRethrottle<'a, 'b, ()>
[src]
&'a self,
parts: ReindexRethrottleParts<'b>
) -> ReindexRethrottle<'a, 'b, ()>
Changes the number of requests per second for a particular Reindex operation.
pub fn render_search_template<'a, 'b>(
&'a self,
parts: RenderSearchTemplateParts<'b>
) -> RenderSearchTemplate<'a, 'b, ()>
[src]
&'a self,
parts: RenderSearchTemplateParts<'b>
) -> RenderSearchTemplate<'a, 'b, ()>
Allows to use the Mustache language to pre-render a search definition.
pub fn scroll<'a, 'b>(&'a self, parts: ScrollParts<'b>) -> Scroll<'a, 'b, ()>
[src]
Allows to retrieve a large numbers of results from a single search request.
Examples
To initiate a scroll, make search API call with a specified scroll
timeout,
then fetch the next set of hits using the _scroll_id
returned in
the response. Once no more hits are returned, clear the scroll.
let client = Elasticsearch::default(); fn print_hits(hits: &[Value]) { for hit in hits { println!( "id: '{}', source: '{}', score: '{}'", hit["_id"].as_str().unwrap(), hit["_source"], hit["_score"].as_f64().unwrap() ); } } let scroll = "1m"; let mut response = client .search(SearchParts::Index(&["tweets"])) .scroll(scroll) .body(json!({ "query": { "match": { "body": { "query": "Elasticsearch rust", "operator": "AND" } } } })) .send() .await?; let mut response_body = response.json::<Value>().await?; let mut scroll_id = response_body["_scroll_id"].as_str().unwrap(); let mut hits = response_body["hits"]["hits"].as_array().unwrap(); print_hits(hits); while hits.len() > 0 { response = client .scroll(ScrollParts::None) .body(json!({ "scroll": scroll, "scroll_id": scroll_id })) .send() .await?; response_body = response.json::<Value>().await?; scroll_id = response_body["_scroll_id"].as_str().unwrap(); hits = response_body["hits"]["hits"].as_array().unwrap(); print_hits(hits); } response = client .clear_scroll(ClearScrollParts::None) .body(json!({ "scroll_id": scroll_id })) .send() .await?;
pub fn search<'a, 'b>(&'a self, parts: SearchParts<'b>) -> Search<'a, 'b, ()>
[src]
Returns results matching a query.
pub fn search_shards<'a, 'b>(
&'a self,
parts: SearchShardsParts<'b>
) -> SearchShards<'a, 'b, ()>
[src]
&'a self,
parts: SearchShardsParts<'b>
) -> SearchShards<'a, 'b, ()>
Returns information about the indices and shards that a search request would be executed against.
pub fn search_template<'a, 'b>(
&'a self,
parts: SearchTemplateParts<'b>
) -> SearchTemplate<'a, 'b, ()>
[src]
&'a self,
parts: SearchTemplateParts<'b>
) -> SearchTemplate<'a, 'b, ()>
Allows to use the Mustache language to pre-render a search definition.
pub fn termvectors<'a, 'b>(
&'a self,
parts: TermvectorsParts<'b>
) -> Termvectors<'a, 'b, ()>
[src]
&'a self,
parts: TermvectorsParts<'b>
) -> Termvectors<'a, 'b, ()>
Returns information and statistics about terms in the fields of a particular document.
pub fn update<'a, 'b>(&'a self, parts: UpdateParts<'b>) -> Update<'a, 'b, ()>
[src]
Updates a document with a script or partial document.
pub fn update_by_query<'a, 'b>(
&'a self,
parts: UpdateByQueryParts<'b>
) -> UpdateByQuery<'a, 'b, ()>
[src]
&'a self,
parts: UpdateByQueryParts<'b>
) -> UpdateByQuery<'a, 'b, ()>
Performs an update on every document in the index without changing the source, for example to pick up a mapping change.
pub fn update_by_query_rethrottle<'a, 'b>(
&'a self,
parts: UpdateByQueryRethrottleParts<'b>
) -> UpdateByQueryRethrottle<'a, 'b, ()>
[src]
&'a self,
parts: UpdateByQueryRethrottleParts<'b>
) -> UpdateByQueryRethrottle<'a, 'b, ()>
Update By Query Rethrottle API
Changes the number of requests per second for a particular Update By Query operation.
Trait Implementations
impl Clone for Elasticsearch
[src]
fn clone(&self) -> Elasticsearch
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Debug for Elasticsearch
[src]
impl Default for Elasticsearch
[src]
fn default() -> Elasticsearch
[src]
Auto Trait Implementations
impl !RefUnwindSafe for Elasticsearch
impl Send for Elasticsearch
impl Sync for Elasticsearch
impl Unpin for Elasticsearch
impl !UnwindSafe for Elasticsearch
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> DynClone for T where
T: Clone,
[src]
T: Clone,
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,