#[allow(unused_imports)]
use crate::{
client::Elasticsearch,
error::Error,
http::{
headers::{HeaderMap, HeaderName, HeaderValue},
request::{Body, JsonBody, NdBody},
response::Response,
Method,
},
params::*,
};
use serde::Serialize;
use serde_with;
use std::borrow::Cow;
#[derive(Debug, Clone, PartialEq)]
#[doc = "API parts for the Cluster Allocation Explain API"]
pub enum ClusterAllocationExplainParts {
#[doc = "No parts"]
None,
}
impl ClusterAllocationExplainParts {
#[doc = "Builds a relative URL path to the Cluster Allocation Explain API"]
pub fn url(self) -> Cow<'static, str> {
match self {
ClusterAllocationExplainParts::None => "/_cluster/allocation/explain".into(),
}
}
}
#[derive(Clone, Debug)]
#[doc = "Builder for the [Cluster Allocation Explain API](https://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-allocation-explain.html). Provides explanations for shard allocations in the cluster."]
pub struct ClusterAllocationExplain<'a, 'b, B> {
client: &'a Elasticsearch,
parts: ClusterAllocationExplainParts,
body: Option<B>,
error_trace: Option<bool>,
filter_path: Option<&'b [&'b str]>,
headers: HeaderMap,
human: Option<bool>,
include_disk_info: Option<bool>,
include_yes_decisions: Option<bool>,
pretty: Option<bool>,
source: Option<&'b str>,
}
impl<'a, 'b, B> ClusterAllocationExplain<'a, 'b, B>
where
B: Body,
{
#[doc = "Creates a new instance of [ClusterAllocationExplain]"]
pub fn new(client: &'a Elasticsearch) -> Self {
ClusterAllocationExplain {
client,
parts: ClusterAllocationExplainParts::None,
headers: HeaderMap::new(),
body: None,
error_trace: None,
filter_path: None,
human: None,
include_disk_info: None,
include_yes_decisions: None,
pretty: None,
source: None,
}
}
#[doc = "The body for the API call"]
pub fn body<T>(self, body: T) -> ClusterAllocationExplain<'a, 'b, JsonBody<T>>
where
T: Serialize,
{
ClusterAllocationExplain {
client: self.client,
parts: self.parts,
body: Some(body.into()),
error_trace: self.error_trace,
filter_path: self.filter_path,
headers: self.headers,
human: self.human,
include_disk_info: self.include_disk_info,
include_yes_decisions: self.include_yes_decisions,
pretty: self.pretty,
source: self.source,
}
}
#[doc = "Include the stack trace of returned errors."]
pub fn error_trace(mut self, error_trace: bool) -> Self {
self.error_trace = Some(error_trace);
self
}
#[doc = "A comma-separated list of filters used to reduce the response."]
pub fn filter_path(mut self, filter_path: &'b [&'b str]) -> Self {
self.filter_path = Some(filter_path);
self
}
#[doc = "Adds a HTTP header"]
pub fn header(mut self, key: HeaderName, value: HeaderValue) -> Self {
self.headers.insert(key, value);
self
}
#[doc = "Return human readable values for statistics."]
pub fn human(mut self, human: bool) -> Self {
self.human = Some(human);
self
}
#[doc = "Return information about disk usage and shard sizes (default: false)"]
pub fn include_disk_info(mut self, include_disk_info: bool) -> Self {
self.include_disk_info = Some(include_disk_info);
self
}
#[doc = "Return 'YES' decisions in explanation (default: false)"]
pub fn include_yes_decisions(mut self, include_yes_decisions: bool) -> Self {
self.include_yes_decisions = Some(include_yes_decisions);
self
}
#[doc = "Pretty format the returned JSON response."]
pub fn pretty(mut self, pretty: bool) -> Self {
self.pretty = Some(pretty);
self
}
#[doc = "The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests."]
pub fn source(mut self, source: &'b str) -> Self {
self.source = Some(source);
self
}
#[doc = "Creates an asynchronous call to the Cluster Allocation Explain API that can be awaited"]
pub async fn send(self) -> Result<Response, Error> {
let path = self.parts.url();
let method = match self.body {
Some(_) => Method::Post,
None => Method::Get,
};
let headers = self.headers;
let query_string = {
#[serde_with::skip_serializing_none]
#[derive(Serialize)]
struct QueryParams<'b> {
#[serde(rename = "error_trace")]
error_trace: Option<bool>,
#[serde(
rename = "filter_path",
serialize_with = "crate::client::serialize_coll_qs"
)]
filter_path: Option<&'b [&'b str]>,
#[serde(rename = "human")]
human: Option<bool>,
#[serde(rename = "include_disk_info")]
include_disk_info: Option<bool>,
#[serde(rename = "include_yes_decisions")]
include_yes_decisions: Option<bool>,
#[serde(rename = "pretty")]
pretty: Option<bool>,
#[serde(rename = "source")]
source: Option<&'b str>,
}
let query_params = QueryParams {
error_trace: self.error_trace,
filter_path: self.filter_path,
human: self.human,
include_disk_info: self.include_disk_info,
include_yes_decisions: self.include_yes_decisions,
pretty: self.pretty,
source: self.source,
};
Some(query_params)
};
let body = self.body;
let response = self
.client
.send(method, &path, headers, query_string.as_ref(), body)
.await?;
Ok(response)
}
}
#[derive(Debug, Clone, PartialEq)]
#[doc = "API parts for the Cluster Get Settings API"]
pub enum ClusterGetSettingsParts {
#[doc = "No parts"]
None,
}
impl ClusterGetSettingsParts {
#[doc = "Builds a relative URL path to the Cluster Get Settings API"]
pub fn url(self) -> Cow<'static, str> {
match self {
ClusterGetSettingsParts::None => "/_cluster/settings".into(),
}
}
}
#[derive(Clone, Debug)]
#[doc = "Builder for the [Cluster Get Settings API](https://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-update-settings.html). Returns cluster settings."]
pub struct ClusterGetSettings<'a, 'b> {
client: &'a Elasticsearch,
parts: ClusterGetSettingsParts,
error_trace: Option<bool>,
filter_path: Option<&'b [&'b str]>,
flat_settings: Option<bool>,
headers: HeaderMap,
human: Option<bool>,
include_defaults: Option<bool>,
master_timeout: Option<&'b str>,
pretty: Option<bool>,
source: Option<&'b str>,
timeout: Option<&'b str>,
}
impl<'a, 'b> ClusterGetSettings<'a, 'b> {
#[doc = "Creates a new instance of [ClusterGetSettings]"]
pub fn new(client: &'a Elasticsearch) -> Self {
ClusterGetSettings {
client,
parts: ClusterGetSettingsParts::None,
headers: HeaderMap::new(),
error_trace: None,
filter_path: None,
flat_settings: None,
human: None,
include_defaults: None,
master_timeout: None,
pretty: None,
source: None,
timeout: None,
}
}
#[doc = "Include the stack trace of returned errors."]
pub fn error_trace(mut self, error_trace: bool) -> Self {
self.error_trace = Some(error_trace);
self
}
#[doc = "A comma-separated list of filters used to reduce the response."]
pub fn filter_path(mut self, filter_path: &'b [&'b str]) -> Self {
self.filter_path = Some(filter_path);
self
}
#[doc = "Return settings in flat format (default: false)"]
pub fn flat_settings(mut self, flat_settings: bool) -> Self {
self.flat_settings = Some(flat_settings);
self
}
#[doc = "Adds a HTTP header"]
pub fn header(mut self, key: HeaderName, value: HeaderValue) -> Self {
self.headers.insert(key, value);
self
}
#[doc = "Return human readable values for statistics."]
pub fn human(mut self, human: bool) -> Self {
self.human = Some(human);
self
}
#[doc = "Whether to return all default clusters setting."]
pub fn include_defaults(mut self, include_defaults: bool) -> Self {
self.include_defaults = Some(include_defaults);
self
}
#[doc = "Explicit operation timeout for connection to master node"]
pub fn master_timeout(mut self, master_timeout: &'b str) -> Self {
self.master_timeout = Some(master_timeout);
self
}
#[doc = "Pretty format the returned JSON response."]
pub fn pretty(mut self, pretty: bool) -> Self {
self.pretty = Some(pretty);
self
}
#[doc = "The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests."]
pub fn source(mut self, source: &'b str) -> Self {
self.source = Some(source);
self
}
#[doc = "Explicit operation timeout"]
pub fn timeout(mut self, timeout: &'b str) -> Self {
self.timeout = Some(timeout);
self
}
#[doc = "Creates an asynchronous call to the Cluster Get Settings API that can be awaited"]
pub async fn send(self) -> Result<Response, Error> {
let path = self.parts.url();
let method = Method::Get;
let headers = self.headers;
let query_string = {
#[serde_with::skip_serializing_none]
#[derive(Serialize)]
struct QueryParams<'b> {
#[serde(rename = "error_trace")]
error_trace: Option<bool>,
#[serde(
rename = "filter_path",
serialize_with = "crate::client::serialize_coll_qs"
)]
filter_path: Option<&'b [&'b str]>,
#[serde(rename = "flat_settings")]
flat_settings: Option<bool>,
#[serde(rename = "human")]
human: Option<bool>,
#[serde(rename = "include_defaults")]
include_defaults: Option<bool>,
#[serde(rename = "master_timeout")]
master_timeout: Option<&'b str>,
#[serde(rename = "pretty")]
pretty: Option<bool>,
#[serde(rename = "source")]
source: Option<&'b str>,
#[serde(rename = "timeout")]
timeout: Option<&'b str>,
}
let query_params = QueryParams {
error_trace: self.error_trace,
filter_path: self.filter_path,
flat_settings: self.flat_settings,
human: self.human,
include_defaults: self.include_defaults,
master_timeout: self.master_timeout,
pretty: self.pretty,
source: self.source,
timeout: self.timeout,
};
Some(query_params)
};
let body = Option::<()>::None;
let response = self
.client
.send(method, &path, headers, query_string.as_ref(), body)
.await?;
Ok(response)
}
}
#[derive(Debug, Clone, PartialEq)]
#[doc = "API parts for the Cluster Health API"]
pub enum ClusterHealthParts<'b> {
#[doc = "No parts"]
None,
#[doc = "Index"]
Index(&'b [&'b str]),
}
impl<'b> ClusterHealthParts<'b> {
#[doc = "Builds a relative URL path to the Cluster Health API"]
pub fn url(self) -> Cow<'static, str> {
match self {
ClusterHealthParts::None => "/_cluster/health".into(),
ClusterHealthParts::Index(ref index) => {
let index_str = index.join(",");
let mut p = String::with_capacity(17usize + index_str.len());
p.push_str("/_cluster/health/");
p.push_str(index_str.as_ref());
p.into()
}
}
}
}
#[derive(Clone, Debug)]
#[doc = "Builder for the [Cluster Health API](https://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-health.html). Returns basic information about the health of the cluster."]
pub struct ClusterHealth<'a, 'b> {
client: &'a Elasticsearch,
parts: ClusterHealthParts<'b>,
error_trace: Option<bool>,
expand_wildcards: Option<ExpandWildcards>,
filter_path: Option<&'b [&'b str]>,
headers: HeaderMap,
human: Option<bool>,
level: Option<Level>,
local: Option<bool>,
master_timeout: Option<&'b str>,
pretty: Option<bool>,
source: Option<&'b str>,
timeout: Option<&'b str>,
wait_for_active_shards: Option<&'b str>,
wait_for_events: Option<WaitForEvents>,
wait_for_no_initializing_shards: Option<bool>,
wait_for_no_relocating_shards: Option<bool>,
wait_for_nodes: Option<&'b str>,
wait_for_status: Option<WaitForStatus>,
}
impl<'a, 'b> ClusterHealth<'a, 'b> {
#[doc = "Creates a new instance of [ClusterHealth] with the specified API parts"]
pub fn new(client: &'a Elasticsearch, parts: ClusterHealthParts<'b>) -> Self {
ClusterHealth {
client,
parts,
headers: HeaderMap::new(),
error_trace: None,
expand_wildcards: None,
filter_path: None,
human: None,
level: None,
local: None,
master_timeout: None,
pretty: None,
source: None,
timeout: None,
wait_for_active_shards: None,
wait_for_events: None,
wait_for_no_initializing_shards: None,
wait_for_no_relocating_shards: None,
wait_for_nodes: None,
wait_for_status: None,
}
}
#[doc = "Include the stack trace of returned errors."]
pub fn error_trace(mut self, error_trace: bool) -> Self {
self.error_trace = Some(error_trace);
self
}
#[doc = "Whether to expand wildcard expression to concrete indices that are open, closed or both."]
pub fn expand_wildcards(mut self, expand_wildcards: ExpandWildcards) -> Self {
self.expand_wildcards = Some(expand_wildcards);
self
}
#[doc = "A comma-separated list of filters used to reduce the response."]
pub fn filter_path(mut self, filter_path: &'b [&'b str]) -> Self {
self.filter_path = Some(filter_path);
self
}
#[doc = "Adds a HTTP header"]
pub fn header(mut self, key: HeaderName, value: HeaderValue) -> Self {
self.headers.insert(key, value);
self
}
#[doc = "Return human readable values for statistics."]
pub fn human(mut self, human: bool) -> Self {
self.human = Some(human);
self
}
#[doc = "Specify the level of detail for returned information"]
pub fn level(mut self, level: Level) -> Self {
self.level = Some(level);
self
}
#[doc = "Return local information, do not retrieve the state from master node (default: false)"]
pub fn local(mut self, local: bool) -> Self {
self.local = Some(local);
self
}
#[doc = "Explicit operation timeout for connection to master node"]
pub fn master_timeout(mut self, master_timeout: &'b str) -> Self {
self.master_timeout = Some(master_timeout);
self
}
#[doc = "Pretty format the returned JSON response."]
pub fn pretty(mut self, pretty: bool) -> Self {
self.pretty = Some(pretty);
self
}
#[doc = "The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests."]
pub fn source(mut self, source: &'b str) -> Self {
self.source = Some(source);
self
}
#[doc = "Explicit operation timeout"]
pub fn timeout(mut self, timeout: &'b str) -> Self {
self.timeout = Some(timeout);
self
}
#[doc = "Wait until the specified number of shards is active"]
pub fn wait_for_active_shards(mut self, wait_for_active_shards: &'b str) -> Self {
self.wait_for_active_shards = Some(wait_for_active_shards);
self
}
#[doc = "Wait until all currently queued events with the given priority are processed"]
pub fn wait_for_events(mut self, wait_for_events: WaitForEvents) -> Self {
self.wait_for_events = Some(wait_for_events);
self
}
#[doc = "Whether to wait until there are no initializing shards in the cluster"]
pub fn wait_for_no_initializing_shards(
mut self,
wait_for_no_initializing_shards: bool,
) -> Self {
self.wait_for_no_initializing_shards = Some(wait_for_no_initializing_shards);
self
}
#[doc = "Whether to wait until there are no relocating shards in the cluster"]
pub fn wait_for_no_relocating_shards(mut self, wait_for_no_relocating_shards: bool) -> Self {
self.wait_for_no_relocating_shards = Some(wait_for_no_relocating_shards);
self
}
#[doc = "Wait until the specified number of nodes is available"]
pub fn wait_for_nodes(mut self, wait_for_nodes: &'b str) -> Self {
self.wait_for_nodes = Some(wait_for_nodes);
self
}
#[doc = "Wait until cluster is in a specific state"]
pub fn wait_for_status(mut self, wait_for_status: WaitForStatus) -> Self {
self.wait_for_status = Some(wait_for_status);
self
}
#[doc = "Creates an asynchronous call to the Cluster Health API that can be awaited"]
pub async fn send(self) -> Result<Response, Error> {
let path = self.parts.url();
let method = Method::Get;
let headers = self.headers;
let query_string = {
#[serde_with::skip_serializing_none]
#[derive(Serialize)]
struct QueryParams<'b> {
#[serde(rename = "error_trace")]
error_trace: Option<bool>,
#[serde(rename = "expand_wildcards")]
expand_wildcards: Option<ExpandWildcards>,
#[serde(
rename = "filter_path",
serialize_with = "crate::client::serialize_coll_qs"
)]
filter_path: Option<&'b [&'b str]>,
#[serde(rename = "human")]
human: Option<bool>,
#[serde(rename = "level")]
level: Option<Level>,
#[serde(rename = "local")]
local: Option<bool>,
#[serde(rename = "master_timeout")]
master_timeout: Option<&'b str>,
#[serde(rename = "pretty")]
pretty: Option<bool>,
#[serde(rename = "source")]
source: Option<&'b str>,
#[serde(rename = "timeout")]
timeout: Option<&'b str>,
#[serde(rename = "wait_for_active_shards")]
wait_for_active_shards: Option<&'b str>,
#[serde(rename = "wait_for_events")]
wait_for_events: Option<WaitForEvents>,
#[serde(rename = "wait_for_no_initializing_shards")]
wait_for_no_initializing_shards: Option<bool>,
#[serde(rename = "wait_for_no_relocating_shards")]
wait_for_no_relocating_shards: Option<bool>,
#[serde(rename = "wait_for_nodes")]
wait_for_nodes: Option<&'b str>,
#[serde(rename = "wait_for_status")]
wait_for_status: Option<WaitForStatus>,
}
let query_params = QueryParams {
error_trace: self.error_trace,
expand_wildcards: self.expand_wildcards,
filter_path: self.filter_path,
human: self.human,
level: self.level,
local: self.local,
master_timeout: self.master_timeout,
pretty: self.pretty,
source: self.source,
timeout: self.timeout,
wait_for_active_shards: self.wait_for_active_shards,
wait_for_events: self.wait_for_events,
wait_for_no_initializing_shards: self.wait_for_no_initializing_shards,
wait_for_no_relocating_shards: self.wait_for_no_relocating_shards,
wait_for_nodes: self.wait_for_nodes,
wait_for_status: self.wait_for_status,
};
Some(query_params)
};
let body = Option::<()>::None;
let response = self
.client
.send(method, &path, headers, query_string.as_ref(), body)
.await?;
Ok(response)
}
}
#[derive(Debug, Clone, PartialEq)]
#[doc = "API parts for the Cluster Pending Tasks API"]
pub enum ClusterPendingTasksParts {
#[doc = "No parts"]
None,
}
impl ClusterPendingTasksParts {
#[doc = "Builds a relative URL path to the Cluster Pending Tasks API"]
pub fn url(self) -> Cow<'static, str> {
match self {
ClusterPendingTasksParts::None => "/_cluster/pending_tasks".into(),
}
}
}
#[derive(Clone, Debug)]
#[doc = "Builder for the [Cluster Pending Tasks API](https://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-pending.html). Returns a list of any cluster-level changes (e.g. create index, update mapping,\nallocate or fail shard) which have not yet been executed."]
pub struct ClusterPendingTasks<'a, 'b> {
client: &'a Elasticsearch,
parts: ClusterPendingTasksParts,
error_trace: Option<bool>,
filter_path: Option<&'b [&'b str]>,
headers: HeaderMap,
human: Option<bool>,
local: Option<bool>,
master_timeout: Option<&'b str>,
pretty: Option<bool>,
source: Option<&'b str>,
}
impl<'a, 'b> ClusterPendingTasks<'a, 'b> {
#[doc = "Creates a new instance of [ClusterPendingTasks]"]
pub fn new(client: &'a Elasticsearch) -> Self {
ClusterPendingTasks {
client,
parts: ClusterPendingTasksParts::None,
headers: HeaderMap::new(),
error_trace: None,
filter_path: None,
human: None,
local: None,
master_timeout: None,
pretty: None,
source: None,
}
}
#[doc = "Include the stack trace of returned errors."]
pub fn error_trace(mut self, error_trace: bool) -> Self {
self.error_trace = Some(error_trace);
self
}
#[doc = "A comma-separated list of filters used to reduce the response."]
pub fn filter_path(mut self, filter_path: &'b [&'b str]) -> Self {
self.filter_path = Some(filter_path);
self
}
#[doc = "Adds a HTTP header"]
pub fn header(mut self, key: HeaderName, value: HeaderValue) -> Self {
self.headers.insert(key, value);
self
}
#[doc = "Return human readable values for statistics."]
pub fn human(mut self, human: bool) -> Self {
self.human = Some(human);
self
}
#[doc = "Return local information, do not retrieve the state from master node (default: false)"]
pub fn local(mut self, local: bool) -> Self {
self.local = Some(local);
self
}
#[doc = "Specify timeout for connection to master"]
pub fn master_timeout(mut self, master_timeout: &'b str) -> Self {
self.master_timeout = Some(master_timeout);
self
}
#[doc = "Pretty format the returned JSON response."]
pub fn pretty(mut self, pretty: bool) -> Self {
self.pretty = Some(pretty);
self
}
#[doc = "The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests."]
pub fn source(mut self, source: &'b str) -> Self {
self.source = Some(source);
self
}
#[doc = "Creates an asynchronous call to the Cluster Pending Tasks API that can be awaited"]
pub async fn send(self) -> Result<Response, Error> {
let path = self.parts.url();
let method = Method::Get;
let headers = self.headers;
let query_string = {
#[serde_with::skip_serializing_none]
#[derive(Serialize)]
struct QueryParams<'b> {
#[serde(rename = "error_trace")]
error_trace: Option<bool>,
#[serde(
rename = "filter_path",
serialize_with = "crate::client::serialize_coll_qs"
)]
filter_path: Option<&'b [&'b str]>,
#[serde(rename = "human")]
human: Option<bool>,
#[serde(rename = "local")]
local: Option<bool>,
#[serde(rename = "master_timeout")]
master_timeout: Option<&'b str>,
#[serde(rename = "pretty")]
pretty: Option<bool>,
#[serde(rename = "source")]
source: Option<&'b str>,
}
let query_params = QueryParams {
error_trace: self.error_trace,
filter_path: self.filter_path,
human: self.human,
local: self.local,
master_timeout: self.master_timeout,
pretty: self.pretty,
source: self.source,
};
Some(query_params)
};
let body = Option::<()>::None;
let response = self
.client
.send(method, &path, headers, query_string.as_ref(), body)
.await?;
Ok(response)
}
}
#[derive(Debug, Clone, PartialEq)]
#[doc = "API parts for the Cluster Put Settings API"]
pub enum ClusterPutSettingsParts {
#[doc = "No parts"]
None,
}
impl ClusterPutSettingsParts {
#[doc = "Builds a relative URL path to the Cluster Put Settings API"]
pub fn url(self) -> Cow<'static, str> {
match self {
ClusterPutSettingsParts::None => "/_cluster/settings".into(),
}
}
}
#[derive(Clone, Debug)]
#[doc = "Builder for the [Cluster Put Settings API](https://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-update-settings.html). Updates the cluster settings."]
pub struct ClusterPutSettings<'a, 'b, B> {
client: &'a Elasticsearch,
parts: ClusterPutSettingsParts,
body: Option<B>,
error_trace: Option<bool>,
filter_path: Option<&'b [&'b str]>,
flat_settings: Option<bool>,
headers: HeaderMap,
human: Option<bool>,
master_timeout: Option<&'b str>,
pretty: Option<bool>,
source: Option<&'b str>,
timeout: Option<&'b str>,
}
impl<'a, 'b, B> ClusterPutSettings<'a, 'b, B>
where
B: Body,
{
#[doc = "Creates a new instance of [ClusterPutSettings]"]
pub fn new(client: &'a Elasticsearch) -> Self {
ClusterPutSettings {
client,
parts: ClusterPutSettingsParts::None,
headers: HeaderMap::new(),
body: None,
error_trace: None,
filter_path: None,
flat_settings: None,
human: None,
master_timeout: None,
pretty: None,
source: None,
timeout: None,
}
}
#[doc = "The body for the API call"]
pub fn body<T>(self, body: T) -> ClusterPutSettings<'a, 'b, JsonBody<T>>
where
T: Serialize,
{
ClusterPutSettings {
client: self.client,
parts: self.parts,
body: Some(body.into()),
error_trace: self.error_trace,
filter_path: self.filter_path,
flat_settings: self.flat_settings,
headers: self.headers,
human: self.human,
master_timeout: self.master_timeout,
pretty: self.pretty,
source: self.source,
timeout: self.timeout,
}
}
#[doc = "Include the stack trace of returned errors."]
pub fn error_trace(mut self, error_trace: bool) -> Self {
self.error_trace = Some(error_trace);
self
}
#[doc = "A comma-separated list of filters used to reduce the response."]
pub fn filter_path(mut self, filter_path: &'b [&'b str]) -> Self {
self.filter_path = Some(filter_path);
self
}
#[doc = "Return settings in flat format (default: false)"]
pub fn flat_settings(mut self, flat_settings: bool) -> Self {
self.flat_settings = Some(flat_settings);
self
}
#[doc = "Adds a HTTP header"]
pub fn header(mut self, key: HeaderName, value: HeaderValue) -> Self {
self.headers.insert(key, value);
self
}
#[doc = "Return human readable values for statistics."]
pub fn human(mut self, human: bool) -> Self {
self.human = Some(human);
self
}
#[doc = "Explicit operation timeout for connection to master node"]
pub fn master_timeout(mut self, master_timeout: &'b str) -> Self {
self.master_timeout = Some(master_timeout);
self
}
#[doc = "Pretty format the returned JSON response."]
pub fn pretty(mut self, pretty: bool) -> Self {
self.pretty = Some(pretty);
self
}
#[doc = "The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests."]
pub fn source(mut self, source: &'b str) -> Self {
self.source = Some(source);
self
}
#[doc = "Explicit operation timeout"]
pub fn timeout(mut self, timeout: &'b str) -> Self {
self.timeout = Some(timeout);
self
}
#[doc = "Creates an asynchronous call to the Cluster Put Settings API that can be awaited"]
pub async fn send(self) -> Result<Response, Error> {
let path = self.parts.url();
let method = Method::Put;
let headers = self.headers;
let query_string = {
#[serde_with::skip_serializing_none]
#[derive(Serialize)]
struct QueryParams<'b> {
#[serde(rename = "error_trace")]
error_trace: Option<bool>,
#[serde(
rename = "filter_path",
serialize_with = "crate::client::serialize_coll_qs"
)]
filter_path: Option<&'b [&'b str]>,
#[serde(rename = "flat_settings")]
flat_settings: Option<bool>,
#[serde(rename = "human")]
human: Option<bool>,
#[serde(rename = "master_timeout")]
master_timeout: Option<&'b str>,
#[serde(rename = "pretty")]
pretty: Option<bool>,
#[serde(rename = "source")]
source: Option<&'b str>,
#[serde(rename = "timeout")]
timeout: Option<&'b str>,
}
let query_params = QueryParams {
error_trace: self.error_trace,
filter_path: self.filter_path,
flat_settings: self.flat_settings,
human: self.human,
master_timeout: self.master_timeout,
pretty: self.pretty,
source: self.source,
timeout: self.timeout,
};
Some(query_params)
};
let body = self.body;
let response = self
.client
.send(method, &path, headers, query_string.as_ref(), body)
.await?;
Ok(response)
}
}
#[derive(Debug, Clone, PartialEq)]
#[doc = "API parts for the Cluster Remote Info API"]
pub enum ClusterRemoteInfoParts {
#[doc = "No parts"]
None,
}
impl ClusterRemoteInfoParts {
#[doc = "Builds a relative URL path to the Cluster Remote Info API"]
pub fn url(self) -> Cow<'static, str> {
match self {
ClusterRemoteInfoParts::None => "/_remote/info".into(),
}
}
}
#[derive(Clone, Debug)]
#[doc = "Builder for the [Cluster Remote Info API](https://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-remote-info.html). Returns the information about configured remote clusters."]
pub struct ClusterRemoteInfo<'a, 'b> {
client: &'a Elasticsearch,
parts: ClusterRemoteInfoParts,
error_trace: Option<bool>,
filter_path: Option<&'b [&'b str]>,
headers: HeaderMap,
human: Option<bool>,
pretty: Option<bool>,
source: Option<&'b str>,
}
impl<'a, 'b> ClusterRemoteInfo<'a, 'b> {
#[doc = "Creates a new instance of [ClusterRemoteInfo]"]
pub fn new(client: &'a Elasticsearch) -> Self {
ClusterRemoteInfo {
client,
parts: ClusterRemoteInfoParts::None,
headers: HeaderMap::new(),
error_trace: None,
filter_path: None,
human: None,
pretty: None,
source: None,
}
}
#[doc = "Include the stack trace of returned errors."]
pub fn error_trace(mut self, error_trace: bool) -> Self {
self.error_trace = Some(error_trace);
self
}
#[doc = "A comma-separated list of filters used to reduce the response."]
pub fn filter_path(mut self, filter_path: &'b [&'b str]) -> Self {
self.filter_path = Some(filter_path);
self
}
#[doc = "Adds a HTTP header"]
pub fn header(mut self, key: HeaderName, value: HeaderValue) -> Self {
self.headers.insert(key, value);
self
}
#[doc = "Return human readable values for statistics."]
pub fn human(mut self, human: bool) -> Self {
self.human = Some(human);
self
}
#[doc = "Pretty format the returned JSON response."]
pub fn pretty(mut self, pretty: bool) -> Self {
self.pretty = Some(pretty);
self
}
#[doc = "The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests."]
pub fn source(mut self, source: &'b str) -> Self {
self.source = Some(source);
self
}
#[doc = "Creates an asynchronous call to the Cluster Remote Info API that can be awaited"]
pub async fn send(self) -> Result<Response, Error> {
let path = self.parts.url();
let method = Method::Get;
let headers = self.headers;
let query_string = {
#[serde_with::skip_serializing_none]
#[derive(Serialize)]
struct QueryParams<'b> {
#[serde(rename = "error_trace")]
error_trace: Option<bool>,
#[serde(
rename = "filter_path",
serialize_with = "crate::client::serialize_coll_qs"
)]
filter_path: Option<&'b [&'b str]>,
#[serde(rename = "human")]
human: Option<bool>,
#[serde(rename = "pretty")]
pretty: Option<bool>,
#[serde(rename = "source")]
source: Option<&'b str>,
}
let query_params = QueryParams {
error_trace: self.error_trace,
filter_path: self.filter_path,
human: self.human,
pretty: self.pretty,
source: self.source,
};
Some(query_params)
};
let body = Option::<()>::None;
let response = self
.client
.send(method, &path, headers, query_string.as_ref(), body)
.await?;
Ok(response)
}
}
#[derive(Debug, Clone, PartialEq)]
#[doc = "API parts for the Cluster Reroute API"]
pub enum ClusterRerouteParts {
#[doc = "No parts"]
None,
}
impl ClusterRerouteParts {
#[doc = "Builds a relative URL path to the Cluster Reroute API"]
pub fn url(self) -> Cow<'static, str> {
match self {
ClusterRerouteParts::None => "/_cluster/reroute".into(),
}
}
}
#[derive(Clone, Debug)]
#[doc = "Builder for the [Cluster Reroute API](https://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-reroute.html). Allows to manually change the allocation of individual shards in the cluster."]
pub struct ClusterReroute<'a, 'b, B> {
client: &'a Elasticsearch,
parts: ClusterRerouteParts,
body: Option<B>,
dry_run: Option<bool>,
error_trace: Option<bool>,
explain: Option<bool>,
filter_path: Option<&'b [&'b str]>,
headers: HeaderMap,
human: Option<bool>,
master_timeout: Option<&'b str>,
metric: Option<&'b [&'b str]>,
pretty: Option<bool>,
retry_failed: Option<bool>,
source: Option<&'b str>,
timeout: Option<&'b str>,
}
impl<'a, 'b, B> ClusterReroute<'a, 'b, B>
where
B: Body,
{
#[doc = "Creates a new instance of [ClusterReroute]"]
pub fn new(client: &'a Elasticsearch) -> Self {
ClusterReroute {
client,
parts: ClusterRerouteParts::None,
headers: HeaderMap::new(),
body: None,
dry_run: None,
error_trace: None,
explain: None,
filter_path: None,
human: None,
master_timeout: None,
metric: None,
pretty: None,
retry_failed: None,
source: None,
timeout: None,
}
}
#[doc = "The body for the API call"]
pub fn body<T>(self, body: T) -> ClusterReroute<'a, 'b, JsonBody<T>>
where
T: Serialize,
{
ClusterReroute {
client: self.client,
parts: self.parts,
body: Some(body.into()),
dry_run: self.dry_run,
error_trace: self.error_trace,
explain: self.explain,
filter_path: self.filter_path,
headers: self.headers,
human: self.human,
master_timeout: self.master_timeout,
metric: self.metric,
pretty: self.pretty,
retry_failed: self.retry_failed,
source: self.source,
timeout: self.timeout,
}
}
#[doc = "Simulate the operation only and return the resulting state"]
pub fn dry_run(mut self, dry_run: bool) -> Self {
self.dry_run = Some(dry_run);
self
}
#[doc = "Include the stack trace of returned errors."]
pub fn error_trace(mut self, error_trace: bool) -> Self {
self.error_trace = Some(error_trace);
self
}
#[doc = "Return an explanation of why the commands can or cannot be executed"]
pub fn explain(mut self, explain: bool) -> Self {
self.explain = Some(explain);
self
}
#[doc = "A comma-separated list of filters used to reduce the response."]
pub fn filter_path(mut self, filter_path: &'b [&'b str]) -> Self {
self.filter_path = Some(filter_path);
self
}
#[doc = "Adds a HTTP header"]
pub fn header(mut self, key: HeaderName, value: HeaderValue) -> Self {
self.headers.insert(key, value);
self
}
#[doc = "Return human readable values for statistics."]
pub fn human(mut self, human: bool) -> Self {
self.human = Some(human);
self
}
#[doc = "Explicit operation timeout for connection to master node"]
pub fn master_timeout(mut self, master_timeout: &'b str) -> Self {
self.master_timeout = Some(master_timeout);
self
}
#[doc = "Limit the information returned to the specified metrics. Defaults to all but metadata"]
pub fn metric(mut self, metric: &'b [&'b str]) -> Self {
self.metric = Some(metric);
self
}
#[doc = "Pretty format the returned JSON response."]
pub fn pretty(mut self, pretty: bool) -> Self {
self.pretty = Some(pretty);
self
}
#[doc = "Retries allocation of shards that are blocked due to too many subsequent allocation failures"]
pub fn retry_failed(mut self, retry_failed: bool) -> Self {
self.retry_failed = Some(retry_failed);
self
}
#[doc = "The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests."]
pub fn source(mut self, source: &'b str) -> Self {
self.source = Some(source);
self
}
#[doc = "Explicit operation timeout"]
pub fn timeout(mut self, timeout: &'b str) -> Self {
self.timeout = Some(timeout);
self
}
#[doc = "Creates an asynchronous call to the Cluster Reroute API that can be awaited"]
pub async fn send(self) -> Result<Response, Error> {
let path = self.parts.url();
let method = Method::Post;
let headers = self.headers;
let query_string = {
#[serde_with::skip_serializing_none]
#[derive(Serialize)]
struct QueryParams<'b> {
#[serde(rename = "dry_run")]
dry_run: Option<bool>,
#[serde(rename = "error_trace")]
error_trace: Option<bool>,
#[serde(rename = "explain")]
explain: Option<bool>,
#[serde(
rename = "filter_path",
serialize_with = "crate::client::serialize_coll_qs"
)]
filter_path: Option<&'b [&'b str]>,
#[serde(rename = "human")]
human: Option<bool>,
#[serde(rename = "master_timeout")]
master_timeout: Option<&'b str>,
#[serde(rename = "metric", serialize_with = "crate::client::serialize_coll_qs")]
metric: Option<&'b [&'b str]>,
#[serde(rename = "pretty")]
pretty: Option<bool>,
#[serde(rename = "retry_failed")]
retry_failed: Option<bool>,
#[serde(rename = "source")]
source: Option<&'b str>,
#[serde(rename = "timeout")]
timeout: Option<&'b str>,
}
let query_params = QueryParams {
dry_run: self.dry_run,
error_trace: self.error_trace,
explain: self.explain,
filter_path: self.filter_path,
human: self.human,
master_timeout: self.master_timeout,
metric: self.metric,
pretty: self.pretty,
retry_failed: self.retry_failed,
source: self.source,
timeout: self.timeout,
};
Some(query_params)
};
let body = self.body;
let response = self
.client
.send(method, &path, headers, query_string.as_ref(), body)
.await?;
Ok(response)
}
}
#[derive(Debug, Clone, PartialEq)]
#[doc = "API parts for the Cluster State API"]
pub enum ClusterStateParts<'b> {
#[doc = "No parts"]
None,
#[doc = "Metric"]
Metric(&'b [&'b str]),
#[doc = "Metric and Index"]
MetricIndex(&'b [&'b str], &'b [&'b str]),
}
impl<'b> ClusterStateParts<'b> {
#[doc = "Builds a relative URL path to the Cluster State API"]
pub fn url(self) -> Cow<'static, str> {
match self {
ClusterStateParts::None => "/_cluster/state".into(),
ClusterStateParts::Metric(ref metric) => {
let metric_str = metric.join(",");
let mut p = String::with_capacity(16usize + metric_str.len());
p.push_str("/_cluster/state/");
p.push_str(metric_str.as_ref());
p.into()
}
ClusterStateParts::MetricIndex(ref metric, ref index) => {
let metric_str = metric.join(",");
let index_str = index.join(",");
let mut p = String::with_capacity(17usize + metric_str.len() + index_str.len());
p.push_str("/_cluster/state/");
p.push_str(metric_str.as_ref());
p.push_str("/");
p.push_str(index_str.as_ref());
p.into()
}
}
}
}
#[derive(Clone, Debug)]
#[doc = "Builder for the [Cluster State API](https://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-state.html). Returns a comprehensive information about the state of the cluster."]
pub struct ClusterState<'a, 'b> {
client: &'a Elasticsearch,
parts: ClusterStateParts<'b>,
allow_no_indices: Option<bool>,
error_trace: Option<bool>,
expand_wildcards: Option<ExpandWildcards>,
filter_path: Option<&'b [&'b str]>,
flat_settings: Option<bool>,
headers: HeaderMap,
human: Option<bool>,
ignore_unavailable: Option<bool>,
local: Option<bool>,
master_timeout: Option<&'b str>,
pretty: Option<bool>,
source: Option<&'b str>,
wait_for_metadata_version: Option<i64>,
wait_for_timeout: Option<&'b str>,
}
impl<'a, 'b> ClusterState<'a, 'b> {
#[doc = "Creates a new instance of [ClusterState] with the specified API parts"]
pub fn new(client: &'a Elasticsearch, parts: ClusterStateParts<'b>) -> Self {
ClusterState {
client,
parts,
headers: HeaderMap::new(),
allow_no_indices: None,
error_trace: None,
expand_wildcards: None,
filter_path: None,
flat_settings: None,
human: None,
ignore_unavailable: None,
local: None,
master_timeout: None,
pretty: None,
source: None,
wait_for_metadata_version: None,
wait_for_timeout: None,
}
}
#[doc = "Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified)"]
pub fn allow_no_indices(mut self, allow_no_indices: bool) -> Self {
self.allow_no_indices = Some(allow_no_indices);
self
}
#[doc = "Include the stack trace of returned errors."]
pub fn error_trace(mut self, error_trace: bool) -> Self {
self.error_trace = Some(error_trace);
self
}
#[doc = "Whether to expand wildcard expression to concrete indices that are open, closed or both."]
pub fn expand_wildcards(mut self, expand_wildcards: ExpandWildcards) -> Self {
self.expand_wildcards = Some(expand_wildcards);
self
}
#[doc = "A comma-separated list of filters used to reduce the response."]
pub fn filter_path(mut self, filter_path: &'b [&'b str]) -> Self {
self.filter_path = Some(filter_path);
self
}
#[doc = "Return settings in flat format (default: false)"]
pub fn flat_settings(mut self, flat_settings: bool) -> Self {
self.flat_settings = Some(flat_settings);
self
}
#[doc = "Adds a HTTP header"]
pub fn header(mut self, key: HeaderName, value: HeaderValue) -> Self {
self.headers.insert(key, value);
self
}
#[doc = "Return human readable values for statistics."]
pub fn human(mut self, human: bool) -> Self {
self.human = Some(human);
self
}
#[doc = "Whether specified concrete indices should be ignored when unavailable (missing or closed)"]
pub fn ignore_unavailable(mut self, ignore_unavailable: bool) -> Self {
self.ignore_unavailable = Some(ignore_unavailable);
self
}
#[doc = "Return local information, do not retrieve the state from master node (default: false)"]
pub fn local(mut self, local: bool) -> Self {
self.local = Some(local);
self
}
#[doc = "Specify timeout for connection to master"]
pub fn master_timeout(mut self, master_timeout: &'b str) -> Self {
self.master_timeout = Some(master_timeout);
self
}
#[doc = "Pretty format the returned JSON response."]
pub fn pretty(mut self, pretty: bool) -> Self {
self.pretty = Some(pretty);
self
}
#[doc = "The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests."]
pub fn source(mut self, source: &'b str) -> Self {
self.source = Some(source);
self
}
#[doc = "Wait for the metadata version to be equal or greater than the specified metadata version"]
pub fn wait_for_metadata_version(mut self, wait_for_metadata_version: i64) -> Self {
self.wait_for_metadata_version = Some(wait_for_metadata_version);
self
}
#[doc = "The maximum time to wait for wait_for_metadata_version before timing out"]
pub fn wait_for_timeout(mut self, wait_for_timeout: &'b str) -> Self {
self.wait_for_timeout = Some(wait_for_timeout);
self
}
#[doc = "Creates an asynchronous call to the Cluster State API that can be awaited"]
pub async fn send(self) -> Result<Response, Error> {
let path = self.parts.url();
let method = Method::Get;
let headers = self.headers;
let query_string = {
#[serde_with::skip_serializing_none]
#[derive(Serialize)]
struct QueryParams<'b> {
#[serde(rename = "allow_no_indices")]
allow_no_indices: Option<bool>,
#[serde(rename = "error_trace")]
error_trace: Option<bool>,
#[serde(rename = "expand_wildcards")]
expand_wildcards: Option<ExpandWildcards>,
#[serde(
rename = "filter_path",
serialize_with = "crate::client::serialize_coll_qs"
)]
filter_path: Option<&'b [&'b str]>,
#[serde(rename = "flat_settings")]
flat_settings: Option<bool>,
#[serde(rename = "human")]
human: Option<bool>,
#[serde(rename = "ignore_unavailable")]
ignore_unavailable: Option<bool>,
#[serde(rename = "local")]
local: Option<bool>,
#[serde(rename = "master_timeout")]
master_timeout: Option<&'b str>,
#[serde(rename = "pretty")]
pretty: Option<bool>,
#[serde(rename = "source")]
source: Option<&'b str>,
#[serde(rename = "wait_for_metadata_version")]
wait_for_metadata_version: Option<i64>,
#[serde(rename = "wait_for_timeout")]
wait_for_timeout: Option<&'b str>,
}
let query_params = QueryParams {
allow_no_indices: self.allow_no_indices,
error_trace: self.error_trace,
expand_wildcards: self.expand_wildcards,
filter_path: self.filter_path,
flat_settings: self.flat_settings,
human: self.human,
ignore_unavailable: self.ignore_unavailable,
local: self.local,
master_timeout: self.master_timeout,
pretty: self.pretty,
source: self.source,
wait_for_metadata_version: self.wait_for_metadata_version,
wait_for_timeout: self.wait_for_timeout,
};
Some(query_params)
};
let body = Option::<()>::None;
let response = self
.client
.send(method, &path, headers, query_string.as_ref(), body)
.await?;
Ok(response)
}
}
#[derive(Debug, Clone, PartialEq)]
#[doc = "API parts for the Cluster Stats API"]
pub enum ClusterStatsParts<'b> {
#[doc = "No parts"]
None,
#[doc = "NodeId"]
NodeId(&'b [&'b str]),
}
impl<'b> ClusterStatsParts<'b> {
#[doc = "Builds a relative URL path to the Cluster Stats API"]
pub fn url(self) -> Cow<'static, str> {
match self {
ClusterStatsParts::None => "/_cluster/stats".into(),
ClusterStatsParts::NodeId(ref node_id) => {
let node_id_str = node_id.join(",");
let mut p = String::with_capacity(22usize + node_id_str.len());
p.push_str("/_cluster/stats/nodes/");
p.push_str(node_id_str.as_ref());
p.into()
}
}
}
}
#[derive(Clone, Debug)]
#[doc = "Builder for the [Cluster Stats API](https://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-stats.html). Returns high-level overview of cluster statistics."]
pub struct ClusterStats<'a, 'b> {
client: &'a Elasticsearch,
parts: ClusterStatsParts<'b>,
error_trace: Option<bool>,
filter_path: Option<&'b [&'b str]>,
flat_settings: Option<bool>,
headers: HeaderMap,
human: Option<bool>,
pretty: Option<bool>,
source: Option<&'b str>,
timeout: Option<&'b str>,
}
impl<'a, 'b> ClusterStats<'a, 'b> {
#[doc = "Creates a new instance of [ClusterStats] with the specified API parts"]
pub fn new(client: &'a Elasticsearch, parts: ClusterStatsParts<'b>) -> Self {
ClusterStats {
client,
parts,
headers: HeaderMap::new(),
error_trace: None,
filter_path: None,
flat_settings: None,
human: None,
pretty: None,
source: None,
timeout: None,
}
}
#[doc = "Include the stack trace of returned errors."]
pub fn error_trace(mut self, error_trace: bool) -> Self {
self.error_trace = Some(error_trace);
self
}
#[doc = "A comma-separated list of filters used to reduce the response."]
pub fn filter_path(mut self, filter_path: &'b [&'b str]) -> Self {
self.filter_path = Some(filter_path);
self
}
#[doc = "Return settings in flat format (default: false)"]
pub fn flat_settings(mut self, flat_settings: bool) -> Self {
self.flat_settings = Some(flat_settings);
self
}
#[doc = "Adds a HTTP header"]
pub fn header(mut self, key: HeaderName, value: HeaderValue) -> Self {
self.headers.insert(key, value);
self
}
#[doc = "Return human readable values for statistics."]
pub fn human(mut self, human: bool) -> Self {
self.human = Some(human);
self
}
#[doc = "Pretty format the returned JSON response."]
pub fn pretty(mut self, pretty: bool) -> Self {
self.pretty = Some(pretty);
self
}
#[doc = "The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests."]
pub fn source(mut self, source: &'b str) -> Self {
self.source = Some(source);
self
}
#[doc = "Explicit operation timeout"]
pub fn timeout(mut self, timeout: &'b str) -> Self {
self.timeout = Some(timeout);
self
}
#[doc = "Creates an asynchronous call to the Cluster Stats API that can be awaited"]
pub async fn send(self) -> Result<Response, Error> {
let path = self.parts.url();
let method = Method::Get;
let headers = self.headers;
let query_string = {
#[serde_with::skip_serializing_none]
#[derive(Serialize)]
struct QueryParams<'b> {
#[serde(rename = "error_trace")]
error_trace: Option<bool>,
#[serde(
rename = "filter_path",
serialize_with = "crate::client::serialize_coll_qs"
)]
filter_path: Option<&'b [&'b str]>,
#[serde(rename = "flat_settings")]
flat_settings: Option<bool>,
#[serde(rename = "human")]
human: Option<bool>,
#[serde(rename = "pretty")]
pretty: Option<bool>,
#[serde(rename = "source")]
source: Option<&'b str>,
#[serde(rename = "timeout")]
timeout: Option<&'b str>,
}
let query_params = QueryParams {
error_trace: self.error_trace,
filter_path: self.filter_path,
flat_settings: self.flat_settings,
human: self.human,
pretty: self.pretty,
source: self.source,
timeout: self.timeout,
};
Some(query_params)
};
let body = Option::<()>::None;
let response = self
.client
.send(method, &path, headers, query_string.as_ref(), body)
.await?;
Ok(response)
}
}
#[doc = "Namespace client for Cluster APIs"]
pub struct Cluster<'a> {
client: &'a Elasticsearch,
}
impl<'a> Cluster<'a> {
#[doc = "Creates a new instance of [Cluster]"]
pub fn new(client: &'a Elasticsearch) -> Self {
Self { client }
}
#[doc = "Provides explanations for shard allocations in the cluster."]
pub fn allocation_explain<'b>(&'a self) -> ClusterAllocationExplain<'a, 'b, ()> {
ClusterAllocationExplain::new(&self.client)
}
#[doc = "Returns cluster settings."]
pub fn get_settings<'b>(&'a self) -> ClusterGetSettings<'a, 'b> {
ClusterGetSettings::new(&self.client)
}
#[doc = "Returns basic information about the health of the cluster."]
pub fn health<'b>(&'a self, parts: ClusterHealthParts<'b>) -> ClusterHealth<'a, 'b> {
ClusterHealth::new(&self.client, parts)
}
#[doc = "Returns a list of any cluster-level changes (e.g. create index, update mapping,\nallocate or fail shard) which have not yet been executed."]
pub fn pending_tasks<'b>(&'a self) -> ClusterPendingTasks<'a, 'b> {
ClusterPendingTasks::new(&self.client)
}
#[doc = "Updates the cluster settings."]
pub fn put_settings<'b>(&'a self) -> ClusterPutSettings<'a, 'b, ()> {
ClusterPutSettings::new(&self.client)
}
#[doc = "Returns the information about configured remote clusters."]
pub fn remote_info<'b>(&'a self) -> ClusterRemoteInfo<'a, 'b> {
ClusterRemoteInfo::new(&self.client)
}
#[doc = "Allows to manually change the allocation of individual shards in the cluster."]
pub fn reroute<'b>(&'a self) -> ClusterReroute<'a, 'b, ()> {
ClusterReroute::new(&self.client)
}
#[doc = "Returns a comprehensive information about the state of the cluster."]
pub fn state<'b>(&'a self, parts: ClusterStateParts<'b>) -> ClusterState<'a, 'b> {
ClusterState::new(&self.client, parts)
}
#[doc = "Returns high-level overview of cluster statistics."]
pub fn stats<'b>(&'a self, parts: ClusterStatsParts<'b>) -> ClusterStats<'a, 'b> {
ClusterStats::new(&self.client, parts)
}
}
impl Elasticsearch {
#[doc = "Creates a namespace client for Cluster APIs"]
pub fn cluster(&self) -> Cluster {
Cluster::new(&self)
}
}