aditjind_crate/
indices.rs

1/*
2 * Licensed to Elasticsearch B.V. under one or more contributor
3 * license agreements. See the NOTICE file distributed with
4 * this work for additional information regarding copyright
5 * ownership. Elasticsearch B.V. licenses this file to you under
6 * the Apache License, Version 2.0 (the "License"); you may
7 * not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
9 *
10 *	http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing,
13 * software distributed under the License is distributed on an
14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 * KIND, either express or implied.  See the License for the
16 * specific language governing permissions and limitations
17 * under the License.
18 */
19
20// -----------------------------------------------
21// This file is generated, Please do not edit it manually.
22// Run the following in the root of the repo to regenerate:
23//
24// cargo make generate-api
25// -----------------------------------------------
26
27//! Index APIs
28//!
29//! Manage individual indices, index settings, aliases, mappings, and index templates.
30
31#![allow(unused_imports)]
32use crate::{
33    client::OpenSearch,
34    error::Error,
35    http::{
36        headers::{HeaderMap, HeaderName, HeaderValue, ACCEPT, CONTENT_TYPE},
37        request::{Body, JsonBody, NdBody, PARTS_ENCODED},
38        response::Response,
39        transport::Transport,
40        Method,
41    },
42    params::*,
43};
44use percent_encoding::percent_encode;
45use serde::Serialize;
46use std::{borrow::Cow, time::Duration};
47#[derive(Debug, Clone, PartialEq)]
48#[doc = "API parts for the Indices Add Block API"]
49pub enum IndicesAddBlockParts<'b> {
50    #[doc = "Index and Block"]
51    IndexBlock(&'b [&'b str], &'b str),
52}
53impl<'b> IndicesAddBlockParts<'b> {
54    #[doc = "Builds a relative URL path to the Indices Add Block API"]
55    pub fn url(self) -> Cow<'static, str> {
56        match self {
57            IndicesAddBlockParts::IndexBlock(ref index, ref block) => {
58                let index_str = index.join(",");
59                let encoded_index: Cow<str> =
60                    percent_encode(index_str.as_bytes(), PARTS_ENCODED).into();
61                let encoded_block: Cow<str> =
62                    percent_encode(block.as_bytes(), PARTS_ENCODED).into();
63                let mut p =
64                    String::with_capacity(9usize + encoded_index.len() + encoded_block.len());
65                p.push_str("/");
66                p.push_str(encoded_index.as_ref());
67                p.push_str("/_block/");
68                p.push_str(encoded_block.as_ref());
69                p.into()
70            }
71        }
72    }
73}
74#[doc = "Builder for the [Indices Add Block API](https://opensearch.org/docs/)\n\nAdds a block to an index."]
75#[derive(Clone, Debug)]
76pub struct IndicesAddBlock<'a, 'b, B> {
77    transport: &'a Transport,
78    parts: IndicesAddBlockParts<'b>,
79    allow_no_indices: Option<bool>,
80    body: Option<B>,
81    error_trace: Option<bool>,
82    expand_wildcards: Option<&'b [ExpandWildcards]>,
83    filter_path: Option<&'b [&'b str]>,
84    headers: HeaderMap,
85    human: Option<bool>,
86    ignore_unavailable: Option<bool>,
87    master_timeout: Option<&'b str>,
88    pretty: Option<bool>,
89    request_timeout: Option<Duration>,
90    source: Option<&'b str>,
91    timeout: Option<&'b str>,
92}
93impl<'a, 'b, B> IndicesAddBlock<'a, 'b, B>
94where
95    B: Body,
96{
97    #[doc = "Creates a new instance of [IndicesAddBlock] with the specified API parts"]
98    pub fn new(transport: &'a Transport, parts: IndicesAddBlockParts<'b>) -> Self {
99        let headers = HeaderMap::new();
100        IndicesAddBlock {
101            transport,
102            parts,
103            headers,
104            allow_no_indices: None,
105            body: None,
106            error_trace: None,
107            expand_wildcards: None,
108            filter_path: None,
109            human: None,
110            ignore_unavailable: None,
111            master_timeout: None,
112            pretty: None,
113            request_timeout: None,
114            source: None,
115            timeout: None,
116        }
117    }
118    #[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)"]
119    pub fn allow_no_indices(mut self, allow_no_indices: bool) -> Self {
120        self.allow_no_indices = Some(allow_no_indices);
121        self
122    }
123    #[doc = "The body for the API call"]
124    pub fn body<T>(self, body: T) -> IndicesAddBlock<'a, 'b, JsonBody<T>>
125    where
126        T: Serialize,
127    {
128        IndicesAddBlock {
129            transport: self.transport,
130            parts: self.parts,
131            body: Some(body.into()),
132            allow_no_indices: self.allow_no_indices,
133            error_trace: self.error_trace,
134            expand_wildcards: self.expand_wildcards,
135            filter_path: self.filter_path,
136            headers: self.headers,
137            human: self.human,
138            ignore_unavailable: self.ignore_unavailable,
139            master_timeout: self.master_timeout,
140            pretty: self.pretty,
141            request_timeout: self.request_timeout,
142            source: self.source,
143            timeout: self.timeout,
144        }
145    }
146    #[doc = "Include the stack trace of returned errors."]
147    pub fn error_trace(mut self, error_trace: bool) -> Self {
148        self.error_trace = Some(error_trace);
149        self
150    }
151    #[doc = "Whether to expand wildcard expression to concrete indices that are open, closed or both."]
152    pub fn expand_wildcards(mut self, expand_wildcards: &'b [ExpandWildcards]) -> Self {
153        self.expand_wildcards = Some(expand_wildcards);
154        self
155    }
156    #[doc = "A comma-separated list of filters used to reduce the response."]
157    pub fn filter_path(mut self, filter_path: &'b [&'b str]) -> Self {
158        self.filter_path = Some(filter_path);
159        self
160    }
161    #[doc = "Adds a HTTP header"]
162    pub fn header(mut self, key: HeaderName, value: HeaderValue) -> Self {
163        self.headers.insert(key, value);
164        self
165    }
166    #[doc = "Return human readable values for statistics."]
167    pub fn human(mut self, human: bool) -> Self {
168        self.human = Some(human);
169        self
170    }
171    #[doc = "Whether specified concrete indices should be ignored when unavailable (missing or closed)"]
172    pub fn ignore_unavailable(mut self, ignore_unavailable: bool) -> Self {
173        self.ignore_unavailable = Some(ignore_unavailable);
174        self
175    }
176    #[doc = "Specify timeout for connection to master"]
177    pub fn master_timeout(mut self, master_timeout: &'b str) -> Self {
178        self.master_timeout = Some(master_timeout);
179        self
180    }
181    #[doc = "Pretty format the returned JSON response."]
182    pub fn pretty(mut self, pretty: bool) -> Self {
183        self.pretty = Some(pretty);
184        self
185    }
186    #[doc = "Sets a request timeout for this API call.\n\nThe timeout is applied from when the request starts connecting until the response body has finished."]
187    pub fn request_timeout(mut self, timeout: Duration) -> Self {
188        self.request_timeout = Some(timeout);
189        self
190    }
191    #[doc = "The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests."]
192    pub fn source(mut self, source: &'b str) -> Self {
193        self.source = Some(source);
194        self
195    }
196    #[doc = "Explicit operation timeout"]
197    pub fn timeout(mut self, timeout: &'b str) -> Self {
198        self.timeout = Some(timeout);
199        self
200    }
201    #[doc = "Creates an asynchronous call to the Indices Add Block API that can be awaited"]
202    pub async fn send(self) -> Result<Response, Error> {
203        let path = self.parts.url();
204        let method = Method::Put;
205        let headers = self.headers;
206        let timeout = self.request_timeout;
207        let query_string = {
208            #[serde_with::skip_serializing_none]
209            #[derive(Serialize)]
210            struct QueryParams<'b> {
211                allow_no_indices: Option<bool>,
212                error_trace: Option<bool>,
213                #[serde(serialize_with = "crate::client::serialize_coll_qs")]
214                expand_wildcards: Option<&'b [ExpandWildcards]>,
215                #[serde(serialize_with = "crate::client::serialize_coll_qs")]
216                filter_path: Option<&'b [&'b str]>,
217                human: Option<bool>,
218                ignore_unavailable: Option<bool>,
219                master_timeout: Option<&'b str>,
220                pretty: Option<bool>,
221                source: Option<&'b str>,
222                timeout: Option<&'b str>,
223            }
224            let query_params = QueryParams {
225                allow_no_indices: self.allow_no_indices,
226                error_trace: self.error_trace,
227                expand_wildcards: self.expand_wildcards,
228                filter_path: self.filter_path,
229                human: self.human,
230                ignore_unavailable: self.ignore_unavailable,
231                master_timeout: self.master_timeout,
232                pretty: self.pretty,
233                source: self.source,
234                timeout: self.timeout,
235            };
236            Some(query_params)
237        };
238        let body = self.body;
239        let response = self
240            .transport
241            .send(method, &path, headers, query_string.as_ref(), body, timeout)
242            .await?;
243        Ok(response)
244    }
245}
246#[derive(Debug, Clone, PartialEq)]
247#[doc = "API parts for the Indices Analyze API"]
248pub enum IndicesAnalyzeParts<'b> {
249    #[doc = "No parts"]
250    None,
251    #[doc = "Index"]
252    Index(&'b str),
253}
254impl<'b> IndicesAnalyzeParts<'b> {
255    #[doc = "Builds a relative URL path to the Indices Analyze API"]
256    pub fn url(self) -> Cow<'static, str> {
257        match self {
258            IndicesAnalyzeParts::None => "/_analyze".into(),
259            IndicesAnalyzeParts::Index(ref index) => {
260                let encoded_index: Cow<str> =
261                    percent_encode(index.as_bytes(), PARTS_ENCODED).into();
262                let mut p = String::with_capacity(10usize + encoded_index.len());
263                p.push_str("/");
264                p.push_str(encoded_index.as_ref());
265                p.push_str("/_analyze");
266                p.into()
267            }
268        }
269    }
270}
271#[doc = "Builder for the [Indices Analyze API](https://opensearch.org/docs/)\n\nPerforms the analysis process on a text and return the tokens breakdown of the text."]
272#[derive(Clone, Debug)]
273pub struct IndicesAnalyze<'a, 'b, B> {
274    transport: &'a Transport,
275    parts: IndicesAnalyzeParts<'b>,
276    body: Option<B>,
277    error_trace: Option<bool>,
278    filter_path: Option<&'b [&'b str]>,
279    headers: HeaderMap,
280    human: Option<bool>,
281    index: Option<&'b str>,
282    pretty: Option<bool>,
283    request_timeout: Option<Duration>,
284    source: Option<&'b str>,
285}
286impl<'a, 'b, B> IndicesAnalyze<'a, 'b, B>
287where
288    B: Body,
289{
290    #[doc = "Creates a new instance of [IndicesAnalyze] with the specified API parts"]
291    pub fn new(transport: &'a Transport, parts: IndicesAnalyzeParts<'b>) -> Self {
292        let headers = HeaderMap::new();
293        IndicesAnalyze {
294            transport,
295            parts,
296            headers,
297            body: None,
298            error_trace: None,
299            filter_path: None,
300            human: None,
301            index: None,
302            pretty: None,
303            request_timeout: None,
304            source: None,
305        }
306    }
307    #[doc = "The body for the API call"]
308    pub fn body<T>(self, body: T) -> IndicesAnalyze<'a, 'b, JsonBody<T>>
309    where
310        T: Serialize,
311    {
312        IndicesAnalyze {
313            transport: self.transport,
314            parts: self.parts,
315            body: Some(body.into()),
316            error_trace: self.error_trace,
317            filter_path: self.filter_path,
318            headers: self.headers,
319            human: self.human,
320            index: self.index,
321            pretty: self.pretty,
322            request_timeout: self.request_timeout,
323            source: self.source,
324        }
325    }
326    #[doc = "Include the stack trace of returned errors."]
327    pub fn error_trace(mut self, error_trace: bool) -> Self {
328        self.error_trace = Some(error_trace);
329        self
330    }
331    #[doc = "A comma-separated list of filters used to reduce the response."]
332    pub fn filter_path(mut self, filter_path: &'b [&'b str]) -> Self {
333        self.filter_path = Some(filter_path);
334        self
335    }
336    #[doc = "Adds a HTTP header"]
337    pub fn header(mut self, key: HeaderName, value: HeaderValue) -> Self {
338        self.headers.insert(key, value);
339        self
340    }
341    #[doc = "Return human readable values for statistics."]
342    pub fn human(mut self, human: bool) -> Self {
343        self.human = Some(human);
344        self
345    }
346    #[doc = "The name of the index to scope the operation"]
347    pub fn index(mut self, index: &'b str) -> Self {
348        self.index = Some(index);
349        self
350    }
351    #[doc = "Pretty format the returned JSON response."]
352    pub fn pretty(mut self, pretty: bool) -> Self {
353        self.pretty = Some(pretty);
354        self
355    }
356    #[doc = "Sets a request timeout for this API call.\n\nThe timeout is applied from when the request starts connecting until the response body has finished."]
357    pub fn request_timeout(mut self, timeout: Duration) -> Self {
358        self.request_timeout = Some(timeout);
359        self
360    }
361    #[doc = "The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests."]
362    pub fn source(mut self, source: &'b str) -> Self {
363        self.source = Some(source);
364        self
365    }
366    #[doc = "Creates an asynchronous call to the Indices Analyze API that can be awaited"]
367    pub async fn send(self) -> Result<Response, Error> {
368        let path = self.parts.url();
369        let method = match self.body {
370            Some(_) => Method::Post,
371            None => Method::Get,
372        };
373        let headers = self.headers;
374        let timeout = self.request_timeout;
375        let query_string = {
376            #[serde_with::skip_serializing_none]
377            #[derive(Serialize)]
378            struct QueryParams<'b> {
379                error_trace: Option<bool>,
380                #[serde(serialize_with = "crate::client::serialize_coll_qs")]
381                filter_path: Option<&'b [&'b str]>,
382                human: Option<bool>,
383                index: Option<&'b str>,
384                pretty: Option<bool>,
385                source: Option<&'b str>,
386            }
387            let query_params = QueryParams {
388                error_trace: self.error_trace,
389                filter_path: self.filter_path,
390                human: self.human,
391                index: self.index,
392                pretty: self.pretty,
393                source: self.source,
394            };
395            Some(query_params)
396        };
397        let body = self.body;
398        let response = self
399            .transport
400            .send(method, &path, headers, query_string.as_ref(), body, timeout)
401            .await?;
402        Ok(response)
403    }
404}
405#[derive(Debug, Clone, PartialEq)]
406#[doc = "API parts for the Indices Clear Cache API"]
407pub enum IndicesClearCacheParts<'b> {
408    #[doc = "No parts"]
409    None,
410    #[doc = "Index"]
411    Index(&'b [&'b str]),
412}
413impl<'b> IndicesClearCacheParts<'b> {
414    #[doc = "Builds a relative URL path to the Indices Clear Cache API"]
415    pub fn url(self) -> Cow<'static, str> {
416        match self {
417            IndicesClearCacheParts::None => "/_cache/clear".into(),
418            IndicesClearCacheParts::Index(ref index) => {
419                let index_str = index.join(",");
420                let encoded_index: Cow<str> =
421                    percent_encode(index_str.as_bytes(), PARTS_ENCODED).into();
422                let mut p = String::with_capacity(14usize + encoded_index.len());
423                p.push_str("/");
424                p.push_str(encoded_index.as_ref());
425                p.push_str("/_cache/clear");
426                p.into()
427            }
428        }
429    }
430}
431#[doc = "Builder for the [Indices Clear Cache API](https://opensearch.org/docs/)\n\nClears all or specific caches for one or more indices."]
432#[derive(Clone, Debug)]
433pub struct IndicesClearCache<'a, 'b, B> {
434    transport: &'a Transport,
435    parts: IndicesClearCacheParts<'b>,
436    allow_no_indices: Option<bool>,
437    body: Option<B>,
438    error_trace: Option<bool>,
439    expand_wildcards: Option<&'b [ExpandWildcards]>,
440    fielddata: Option<bool>,
441    fields: Option<&'b [&'b str]>,
442    filter_path: Option<&'b [&'b str]>,
443    headers: HeaderMap,
444    human: Option<bool>,
445    ignore_unavailable: Option<bool>,
446    index: Option<&'b [&'b str]>,
447    pretty: Option<bool>,
448    query: Option<bool>,
449    request: Option<bool>,
450    request_timeout: Option<Duration>,
451    source: Option<&'b str>,
452}
453impl<'a, 'b, B> IndicesClearCache<'a, 'b, B>
454where
455    B: Body,
456{
457    #[doc = "Creates a new instance of [IndicesClearCache] with the specified API parts"]
458    pub fn new(transport: &'a Transport, parts: IndicesClearCacheParts<'b>) -> Self {
459        let headers = HeaderMap::new();
460        IndicesClearCache {
461            transport,
462            parts,
463            headers,
464            allow_no_indices: None,
465            body: None,
466            error_trace: None,
467            expand_wildcards: None,
468            fielddata: None,
469            fields: None,
470            filter_path: None,
471            human: None,
472            ignore_unavailable: None,
473            index: None,
474            pretty: None,
475            query: None,
476            request: None,
477            request_timeout: None,
478            source: None,
479        }
480    }
481    #[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)"]
482    pub fn allow_no_indices(mut self, allow_no_indices: bool) -> Self {
483        self.allow_no_indices = Some(allow_no_indices);
484        self
485    }
486    #[doc = "The body for the API call"]
487    pub fn body<T>(self, body: T) -> IndicesClearCache<'a, 'b, JsonBody<T>>
488    where
489        T: Serialize,
490    {
491        IndicesClearCache {
492            transport: self.transport,
493            parts: self.parts,
494            body: Some(body.into()),
495            allow_no_indices: self.allow_no_indices,
496            error_trace: self.error_trace,
497            expand_wildcards: self.expand_wildcards,
498            fielddata: self.fielddata,
499            fields: self.fields,
500            filter_path: self.filter_path,
501            headers: self.headers,
502            human: self.human,
503            ignore_unavailable: self.ignore_unavailable,
504            index: self.index,
505            pretty: self.pretty,
506            query: self.query,
507            request: self.request,
508            request_timeout: self.request_timeout,
509            source: self.source,
510        }
511    }
512    #[doc = "Include the stack trace of returned errors."]
513    pub fn error_trace(mut self, error_trace: bool) -> Self {
514        self.error_trace = Some(error_trace);
515        self
516    }
517    #[doc = "Whether to expand wildcard expression to concrete indices that are open, closed or both."]
518    pub fn expand_wildcards(mut self, expand_wildcards: &'b [ExpandWildcards]) -> Self {
519        self.expand_wildcards = Some(expand_wildcards);
520        self
521    }
522    #[doc = "Clear field data"]
523    pub fn fielddata(mut self, fielddata: bool) -> Self {
524        self.fielddata = Some(fielddata);
525        self
526    }
527    #[doc = "A comma-separated list of fields to clear when using the `fielddata` parameter (default: all)"]
528    pub fn fields(mut self, fields: &'b [&'b str]) -> Self {
529        self.fields = Some(fields);
530        self
531    }
532    #[doc = "A comma-separated list of filters used to reduce the response."]
533    pub fn filter_path(mut self, filter_path: &'b [&'b str]) -> Self {
534        self.filter_path = Some(filter_path);
535        self
536    }
537    #[doc = "Adds a HTTP header"]
538    pub fn header(mut self, key: HeaderName, value: HeaderValue) -> Self {
539        self.headers.insert(key, value);
540        self
541    }
542    #[doc = "Return human readable values for statistics."]
543    pub fn human(mut self, human: bool) -> Self {
544        self.human = Some(human);
545        self
546    }
547    #[doc = "Whether specified concrete indices should be ignored when unavailable (missing or closed)"]
548    pub fn ignore_unavailable(mut self, ignore_unavailable: bool) -> Self {
549        self.ignore_unavailable = Some(ignore_unavailable);
550        self
551    }
552    #[doc = "A comma-separated list of index name to limit the operation"]
553    pub fn index(mut self, index: &'b [&'b str]) -> Self {
554        self.index = Some(index);
555        self
556    }
557    #[doc = "Pretty format the returned JSON response."]
558    pub fn pretty(mut self, pretty: bool) -> Self {
559        self.pretty = Some(pretty);
560        self
561    }
562    #[doc = "Clear query caches"]
563    pub fn query(mut self, query: bool) -> Self {
564        self.query = Some(query);
565        self
566    }
567    #[doc = "Clear request cache"]
568    pub fn request(mut self, request: bool) -> Self {
569        self.request = Some(request);
570        self
571    }
572    #[doc = "Sets a request timeout for this API call.\n\nThe timeout is applied from when the request starts connecting until the response body has finished."]
573    pub fn request_timeout(mut self, timeout: Duration) -> Self {
574        self.request_timeout = Some(timeout);
575        self
576    }
577    #[doc = "The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests."]
578    pub fn source(mut self, source: &'b str) -> Self {
579        self.source = Some(source);
580        self
581    }
582    #[doc = "Creates an asynchronous call to the Indices Clear Cache API that can be awaited"]
583    pub async fn send(self) -> Result<Response, Error> {
584        let path = self.parts.url();
585        let method = Method::Post;
586        let headers = self.headers;
587        let timeout = self.request_timeout;
588        let query_string = {
589            #[serde_with::skip_serializing_none]
590            #[derive(Serialize)]
591            struct QueryParams<'b> {
592                allow_no_indices: Option<bool>,
593                error_trace: Option<bool>,
594                #[serde(serialize_with = "crate::client::serialize_coll_qs")]
595                expand_wildcards: Option<&'b [ExpandWildcards]>,
596                fielddata: Option<bool>,
597                #[serde(serialize_with = "crate::client::serialize_coll_qs")]
598                fields: Option<&'b [&'b str]>,
599                #[serde(serialize_with = "crate::client::serialize_coll_qs")]
600                filter_path: Option<&'b [&'b str]>,
601                human: Option<bool>,
602                ignore_unavailable: Option<bool>,
603                #[serde(serialize_with = "crate::client::serialize_coll_qs")]
604                index: Option<&'b [&'b str]>,
605                pretty: Option<bool>,
606                query: Option<bool>,
607                request: Option<bool>,
608                source: Option<&'b str>,
609            }
610            let query_params = QueryParams {
611                allow_no_indices: self.allow_no_indices,
612                error_trace: self.error_trace,
613                expand_wildcards: self.expand_wildcards,
614                fielddata: self.fielddata,
615                fields: self.fields,
616                filter_path: self.filter_path,
617                human: self.human,
618                ignore_unavailable: self.ignore_unavailable,
619                index: self.index,
620                pretty: self.pretty,
621                query: self.query,
622                request: self.request,
623                source: self.source,
624            };
625            Some(query_params)
626        };
627        let body = self.body;
628        let response = self
629            .transport
630            .send(method, &path, headers, query_string.as_ref(), body, timeout)
631            .await?;
632        Ok(response)
633    }
634}
635#[derive(Debug, Clone, PartialEq)]
636#[doc = "API parts for the Indices Clone API"]
637pub enum IndicesCloneParts<'b> {
638    #[doc = "Index and Target"]
639    IndexTarget(&'b str, &'b str),
640}
641impl<'b> IndicesCloneParts<'b> {
642    #[doc = "Builds a relative URL path to the Indices Clone API"]
643    pub fn url(self) -> Cow<'static, str> {
644        match self {
645            IndicesCloneParts::IndexTarget(ref index, ref target) => {
646                let encoded_index: Cow<str> =
647                    percent_encode(index.as_bytes(), PARTS_ENCODED).into();
648                let encoded_target: Cow<str> =
649                    percent_encode(target.as_bytes(), PARTS_ENCODED).into();
650                let mut p =
651                    String::with_capacity(9usize + encoded_index.len() + encoded_target.len());
652                p.push_str("/");
653                p.push_str(encoded_index.as_ref());
654                p.push_str("/_clone/");
655                p.push_str(encoded_target.as_ref());
656                p.into()
657            }
658        }
659    }
660}
661#[doc = "Builder for the [Indices Clone API](https://opensearch.org/docs/)\n\nClones an index"]
662#[derive(Clone, Debug)]
663pub struct IndicesClone<'a, 'b, B> {
664    transport: &'a Transport,
665    parts: IndicesCloneParts<'b>,
666    body: Option<B>,
667    error_trace: Option<bool>,
668    filter_path: Option<&'b [&'b str]>,
669    headers: HeaderMap,
670    human: Option<bool>,
671    master_timeout: Option<&'b str>,
672    pretty: Option<bool>,
673    request_timeout: Option<Duration>,
674    source: Option<&'b str>,
675    timeout: Option<&'b str>,
676    wait_for_active_shards: Option<&'b str>,
677}
678impl<'a, 'b, B> IndicesClone<'a, 'b, B>
679where
680    B: Body,
681{
682    #[doc = "Creates a new instance of [IndicesClone] with the specified API parts"]
683    pub fn new(transport: &'a Transport, parts: IndicesCloneParts<'b>) -> Self {
684        let headers = HeaderMap::new();
685        IndicesClone {
686            transport,
687            parts,
688            headers,
689            body: None,
690            error_trace: None,
691            filter_path: None,
692            human: None,
693            master_timeout: None,
694            pretty: None,
695            request_timeout: None,
696            source: None,
697            timeout: None,
698            wait_for_active_shards: None,
699        }
700    }
701    #[doc = "The body for the API call"]
702    pub fn body<T>(self, body: T) -> IndicesClone<'a, 'b, JsonBody<T>>
703    where
704        T: Serialize,
705    {
706        IndicesClone {
707            transport: self.transport,
708            parts: self.parts,
709            body: Some(body.into()),
710            error_trace: self.error_trace,
711            filter_path: self.filter_path,
712            headers: self.headers,
713            human: self.human,
714            master_timeout: self.master_timeout,
715            pretty: self.pretty,
716            request_timeout: self.request_timeout,
717            source: self.source,
718            timeout: self.timeout,
719            wait_for_active_shards: self.wait_for_active_shards,
720        }
721    }
722    #[doc = "Include the stack trace of returned errors."]
723    pub fn error_trace(mut self, error_trace: bool) -> Self {
724        self.error_trace = Some(error_trace);
725        self
726    }
727    #[doc = "A comma-separated list of filters used to reduce the response."]
728    pub fn filter_path(mut self, filter_path: &'b [&'b str]) -> Self {
729        self.filter_path = Some(filter_path);
730        self
731    }
732    #[doc = "Adds a HTTP header"]
733    pub fn header(mut self, key: HeaderName, value: HeaderValue) -> Self {
734        self.headers.insert(key, value);
735        self
736    }
737    #[doc = "Return human readable values for statistics."]
738    pub fn human(mut self, human: bool) -> Self {
739        self.human = Some(human);
740        self
741    }
742    #[doc = "Specify timeout for connection to master"]
743    pub fn master_timeout(mut self, master_timeout: &'b str) -> Self {
744        self.master_timeout = Some(master_timeout);
745        self
746    }
747    #[doc = "Pretty format the returned JSON response."]
748    pub fn pretty(mut self, pretty: bool) -> Self {
749        self.pretty = Some(pretty);
750        self
751    }
752    #[doc = "Sets a request timeout for this API call.\n\nThe timeout is applied from when the request starts connecting until the response body has finished."]
753    pub fn request_timeout(mut self, timeout: Duration) -> Self {
754        self.request_timeout = Some(timeout);
755        self
756    }
757    #[doc = "The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests."]
758    pub fn source(mut self, source: &'b str) -> Self {
759        self.source = Some(source);
760        self
761    }
762    #[doc = "Explicit operation timeout"]
763    pub fn timeout(mut self, timeout: &'b str) -> Self {
764        self.timeout = Some(timeout);
765        self
766    }
767    #[doc = "Set the number of active shards to wait for on the cloned index before the operation returns."]
768    pub fn wait_for_active_shards(mut self, wait_for_active_shards: &'b str) -> Self {
769        self.wait_for_active_shards = Some(wait_for_active_shards);
770        self
771    }
772    #[doc = "Creates an asynchronous call to the Indices Clone API that can be awaited"]
773    pub async fn send(self) -> Result<Response, Error> {
774        let path = self.parts.url();
775        let method = Method::Post;
776        let headers = self.headers;
777        let timeout = self.request_timeout;
778        let query_string = {
779            #[serde_with::skip_serializing_none]
780            #[derive(Serialize)]
781            struct QueryParams<'b> {
782                error_trace: Option<bool>,
783                #[serde(serialize_with = "crate::client::serialize_coll_qs")]
784                filter_path: Option<&'b [&'b str]>,
785                human: Option<bool>,
786                master_timeout: Option<&'b str>,
787                pretty: Option<bool>,
788                source: Option<&'b str>,
789                timeout: Option<&'b str>,
790                wait_for_active_shards: Option<&'b str>,
791            }
792            let query_params = QueryParams {
793                error_trace: self.error_trace,
794                filter_path: self.filter_path,
795                human: self.human,
796                master_timeout: self.master_timeout,
797                pretty: self.pretty,
798                source: self.source,
799                timeout: self.timeout,
800                wait_for_active_shards: self.wait_for_active_shards,
801            };
802            Some(query_params)
803        };
804        let body = self.body;
805        let response = self
806            .transport
807            .send(method, &path, headers, query_string.as_ref(), body, timeout)
808            .await?;
809        Ok(response)
810    }
811}
812#[derive(Debug, Clone, PartialEq)]
813#[doc = "API parts for the Indices Close API"]
814pub enum IndicesCloseParts<'b> {
815    #[doc = "Index"]
816    Index(&'b [&'b str]),
817}
818impl<'b> IndicesCloseParts<'b> {
819    #[doc = "Builds a relative URL path to the Indices Close API"]
820    pub fn url(self) -> Cow<'static, str> {
821        match self {
822            IndicesCloseParts::Index(ref index) => {
823                let index_str = index.join(",");
824                let encoded_index: Cow<str> =
825                    percent_encode(index_str.as_bytes(), PARTS_ENCODED).into();
826                let mut p = String::with_capacity(8usize + encoded_index.len());
827                p.push_str("/");
828                p.push_str(encoded_index.as_ref());
829                p.push_str("/_close");
830                p.into()
831            }
832        }
833    }
834}
835#[doc = "Builder for the [Indices Close API](https://opensearch.org/docs/)\n\nCloses an index."]
836#[derive(Clone, Debug)]
837pub struct IndicesClose<'a, 'b, B> {
838    transport: &'a Transport,
839    parts: IndicesCloseParts<'b>,
840    allow_no_indices: Option<bool>,
841    body: Option<B>,
842    error_trace: Option<bool>,
843    expand_wildcards: Option<&'b [ExpandWildcards]>,
844    filter_path: Option<&'b [&'b str]>,
845    headers: HeaderMap,
846    human: Option<bool>,
847    ignore_unavailable: Option<bool>,
848    master_timeout: Option<&'b str>,
849    pretty: Option<bool>,
850    request_timeout: Option<Duration>,
851    source: Option<&'b str>,
852    timeout: Option<&'b str>,
853    wait_for_active_shards: Option<&'b str>,
854}
855impl<'a, 'b, B> IndicesClose<'a, 'b, B>
856where
857    B: Body,
858{
859    #[doc = "Creates a new instance of [IndicesClose] with the specified API parts"]
860    pub fn new(transport: &'a Transport, parts: IndicesCloseParts<'b>) -> Self {
861        let headers = HeaderMap::new();
862        IndicesClose {
863            transport,
864            parts,
865            headers,
866            allow_no_indices: None,
867            body: None,
868            error_trace: None,
869            expand_wildcards: None,
870            filter_path: None,
871            human: None,
872            ignore_unavailable: None,
873            master_timeout: None,
874            pretty: None,
875            request_timeout: None,
876            source: None,
877            timeout: None,
878            wait_for_active_shards: None,
879        }
880    }
881    #[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)"]
882    pub fn allow_no_indices(mut self, allow_no_indices: bool) -> Self {
883        self.allow_no_indices = Some(allow_no_indices);
884        self
885    }
886    #[doc = "The body for the API call"]
887    pub fn body<T>(self, body: T) -> IndicesClose<'a, 'b, JsonBody<T>>
888    where
889        T: Serialize,
890    {
891        IndicesClose {
892            transport: self.transport,
893            parts: self.parts,
894            body: Some(body.into()),
895            allow_no_indices: self.allow_no_indices,
896            error_trace: self.error_trace,
897            expand_wildcards: self.expand_wildcards,
898            filter_path: self.filter_path,
899            headers: self.headers,
900            human: self.human,
901            ignore_unavailable: self.ignore_unavailable,
902            master_timeout: self.master_timeout,
903            pretty: self.pretty,
904            request_timeout: self.request_timeout,
905            source: self.source,
906            timeout: self.timeout,
907            wait_for_active_shards: self.wait_for_active_shards,
908        }
909    }
910    #[doc = "Include the stack trace of returned errors."]
911    pub fn error_trace(mut self, error_trace: bool) -> Self {
912        self.error_trace = Some(error_trace);
913        self
914    }
915    #[doc = "Whether to expand wildcard expression to concrete indices that are open, closed or both."]
916    pub fn expand_wildcards(mut self, expand_wildcards: &'b [ExpandWildcards]) -> Self {
917        self.expand_wildcards = Some(expand_wildcards);
918        self
919    }
920    #[doc = "A comma-separated list of filters used to reduce the response."]
921    pub fn filter_path(mut self, filter_path: &'b [&'b str]) -> Self {
922        self.filter_path = Some(filter_path);
923        self
924    }
925    #[doc = "Adds a HTTP header"]
926    pub fn header(mut self, key: HeaderName, value: HeaderValue) -> Self {
927        self.headers.insert(key, value);
928        self
929    }
930    #[doc = "Return human readable values for statistics."]
931    pub fn human(mut self, human: bool) -> Self {
932        self.human = Some(human);
933        self
934    }
935    #[doc = "Whether specified concrete indices should be ignored when unavailable (missing or closed)"]
936    pub fn ignore_unavailable(mut self, ignore_unavailable: bool) -> Self {
937        self.ignore_unavailable = Some(ignore_unavailable);
938        self
939    }
940    #[doc = "Specify timeout for connection to master"]
941    pub fn master_timeout(mut self, master_timeout: &'b str) -> Self {
942        self.master_timeout = Some(master_timeout);
943        self
944    }
945    #[doc = "Pretty format the returned JSON response."]
946    pub fn pretty(mut self, pretty: bool) -> Self {
947        self.pretty = Some(pretty);
948        self
949    }
950    #[doc = "Sets a request timeout for this API call.\n\nThe timeout is applied from when the request starts connecting until the response body has finished."]
951    pub fn request_timeout(mut self, timeout: Duration) -> Self {
952        self.request_timeout = Some(timeout);
953        self
954    }
955    #[doc = "The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests."]
956    pub fn source(mut self, source: &'b str) -> Self {
957        self.source = Some(source);
958        self
959    }
960    #[doc = "Explicit operation timeout"]
961    pub fn timeout(mut self, timeout: &'b str) -> Self {
962        self.timeout = Some(timeout);
963        self
964    }
965    #[doc = "Sets the number of active shards to wait for before the operation returns. Set to `index-setting` to wait according to the index setting `index.write.wait_for_active_shards`, or `all` to wait for all shards, or an integer. Defaults to `0`."]
966    pub fn wait_for_active_shards(mut self, wait_for_active_shards: &'b str) -> Self {
967        self.wait_for_active_shards = Some(wait_for_active_shards);
968        self
969    }
970    #[doc = "Creates an asynchronous call to the Indices Close API that can be awaited"]
971    pub async fn send(self) -> Result<Response, Error> {
972        let path = self.parts.url();
973        let method = Method::Post;
974        let headers = self.headers;
975        let timeout = self.request_timeout;
976        let query_string = {
977            #[serde_with::skip_serializing_none]
978            #[derive(Serialize)]
979            struct QueryParams<'b> {
980                allow_no_indices: Option<bool>,
981                error_trace: Option<bool>,
982                #[serde(serialize_with = "crate::client::serialize_coll_qs")]
983                expand_wildcards: Option<&'b [ExpandWildcards]>,
984                #[serde(serialize_with = "crate::client::serialize_coll_qs")]
985                filter_path: Option<&'b [&'b str]>,
986                human: Option<bool>,
987                ignore_unavailable: Option<bool>,
988                master_timeout: Option<&'b str>,
989                pretty: Option<bool>,
990                source: Option<&'b str>,
991                timeout: Option<&'b str>,
992                wait_for_active_shards: Option<&'b str>,
993            }
994            let query_params = QueryParams {
995                allow_no_indices: self.allow_no_indices,
996                error_trace: self.error_trace,
997                expand_wildcards: self.expand_wildcards,
998                filter_path: self.filter_path,
999                human: self.human,
1000                ignore_unavailable: self.ignore_unavailable,
1001                master_timeout: self.master_timeout,
1002                pretty: self.pretty,
1003                source: self.source,
1004                timeout: self.timeout,
1005                wait_for_active_shards: self.wait_for_active_shards,
1006            };
1007            Some(query_params)
1008        };
1009        let body = self.body;
1010        let response = self
1011            .transport
1012            .send(method, &path, headers, query_string.as_ref(), body, timeout)
1013            .await?;
1014        Ok(response)
1015    }
1016}
1017#[derive(Debug, Clone, PartialEq)]
1018#[doc = "API parts for the Indices Create API"]
1019pub enum IndicesCreateParts<'b> {
1020    #[doc = "Index"]
1021    Index(&'b str),
1022}
1023impl<'b> IndicesCreateParts<'b> {
1024    #[doc = "Builds a relative URL path to the Indices Create API"]
1025    pub fn url(self) -> Cow<'static, str> {
1026        match self {
1027            IndicesCreateParts::Index(ref index) => {
1028                let encoded_index: Cow<str> =
1029                    percent_encode(index.as_bytes(), PARTS_ENCODED).into();
1030                let mut p = String::with_capacity(1usize + encoded_index.len());
1031                p.push_str("/");
1032                p.push_str(encoded_index.as_ref());
1033                p.into()
1034            }
1035        }
1036    }
1037}
1038#[doc = "Builder for the [Indices Create API](https://opensearch.org/docs/)\n\nCreates an index with optional settings and mappings."]
1039#[derive(Clone, Debug)]
1040pub struct IndicesCreate<'a, 'b, B> {
1041    transport: &'a Transport,
1042    parts: IndicesCreateParts<'b>,
1043    body: Option<B>,
1044    error_trace: Option<bool>,
1045    filter_path: Option<&'b [&'b str]>,
1046    headers: HeaderMap,
1047    human: Option<bool>,
1048    include_type_name: Option<bool>,
1049    master_timeout: Option<&'b str>,
1050    pretty: Option<bool>,
1051    request_timeout: Option<Duration>,
1052    source: Option<&'b str>,
1053    timeout: Option<&'b str>,
1054    wait_for_active_shards: Option<&'b str>,
1055}
1056impl<'a, 'b, B> IndicesCreate<'a, 'b, B>
1057where
1058    B: Body,
1059{
1060    #[doc = "Creates a new instance of [IndicesCreate] with the specified API parts"]
1061    pub fn new(transport: &'a Transport, parts: IndicesCreateParts<'b>) -> Self {
1062        let headers = HeaderMap::new();
1063        IndicesCreate {
1064            transport,
1065            parts,
1066            headers,
1067            body: None,
1068            error_trace: None,
1069            filter_path: None,
1070            human: None,
1071            include_type_name: None,
1072            master_timeout: None,
1073            pretty: None,
1074            request_timeout: None,
1075            source: None,
1076            timeout: None,
1077            wait_for_active_shards: None,
1078        }
1079    }
1080    #[doc = "The body for the API call"]
1081    pub fn body<T>(self, body: T) -> IndicesCreate<'a, 'b, JsonBody<T>>
1082    where
1083        T: Serialize,
1084    {
1085        IndicesCreate {
1086            transport: self.transport,
1087            parts: self.parts,
1088            body: Some(body.into()),
1089            error_trace: self.error_trace,
1090            filter_path: self.filter_path,
1091            headers: self.headers,
1092            human: self.human,
1093            include_type_name: self.include_type_name,
1094            master_timeout: self.master_timeout,
1095            pretty: self.pretty,
1096            request_timeout: self.request_timeout,
1097            source: self.source,
1098            timeout: self.timeout,
1099            wait_for_active_shards: self.wait_for_active_shards,
1100        }
1101    }
1102    #[doc = "Include the stack trace of returned errors."]
1103    pub fn error_trace(mut self, error_trace: bool) -> Self {
1104        self.error_trace = Some(error_trace);
1105        self
1106    }
1107    #[doc = "A comma-separated list of filters used to reduce the response."]
1108    pub fn filter_path(mut self, filter_path: &'b [&'b str]) -> Self {
1109        self.filter_path = Some(filter_path);
1110        self
1111    }
1112    #[doc = "Adds a HTTP header"]
1113    pub fn header(mut self, key: HeaderName, value: HeaderValue) -> Self {
1114        self.headers.insert(key, value);
1115        self
1116    }
1117    #[doc = "Return human readable values for statistics."]
1118    pub fn human(mut self, human: bool) -> Self {
1119        self.human = Some(human);
1120        self
1121    }
1122    #[doc = "Whether a type should be expected in the body of the mappings."]
1123    pub fn include_type_name(mut self, include_type_name: bool) -> Self {
1124        self.include_type_name = Some(include_type_name);
1125        self
1126    }
1127    #[doc = "Specify timeout for connection to master"]
1128    pub fn master_timeout(mut self, master_timeout: &'b str) -> Self {
1129        self.master_timeout = Some(master_timeout);
1130        self
1131    }
1132    #[doc = "Pretty format the returned JSON response."]
1133    pub fn pretty(mut self, pretty: bool) -> Self {
1134        self.pretty = Some(pretty);
1135        self
1136    }
1137    #[doc = "Sets a request timeout for this API call.\n\nThe timeout is applied from when the request starts connecting until the response body has finished."]
1138    pub fn request_timeout(mut self, timeout: Duration) -> Self {
1139        self.request_timeout = Some(timeout);
1140        self
1141    }
1142    #[doc = "The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests."]
1143    pub fn source(mut self, source: &'b str) -> Self {
1144        self.source = Some(source);
1145        self
1146    }
1147    #[doc = "Explicit operation timeout"]
1148    pub fn timeout(mut self, timeout: &'b str) -> Self {
1149        self.timeout = Some(timeout);
1150        self
1151    }
1152    #[doc = "Set the number of active shards to wait for before the operation returns."]
1153    pub fn wait_for_active_shards(mut self, wait_for_active_shards: &'b str) -> Self {
1154        self.wait_for_active_shards = Some(wait_for_active_shards);
1155        self
1156    }
1157    #[doc = "Creates an asynchronous call to the Indices Create API that can be awaited"]
1158    pub async fn send(self) -> Result<Response, Error> {
1159        let path = self.parts.url();
1160        let method = Method::Put;
1161        let headers = self.headers;
1162        let timeout = self.request_timeout;
1163        let query_string = {
1164            #[serde_with::skip_serializing_none]
1165            #[derive(Serialize)]
1166            struct QueryParams<'b> {
1167                error_trace: Option<bool>,
1168                #[serde(serialize_with = "crate::client::serialize_coll_qs")]
1169                filter_path: Option<&'b [&'b str]>,
1170                human: Option<bool>,
1171                include_type_name: Option<bool>,
1172                master_timeout: Option<&'b str>,
1173                pretty: Option<bool>,
1174                source: Option<&'b str>,
1175                timeout: Option<&'b str>,
1176                wait_for_active_shards: Option<&'b str>,
1177            }
1178            let query_params = QueryParams {
1179                error_trace: self.error_trace,
1180                filter_path: self.filter_path,
1181                human: self.human,
1182                include_type_name: self.include_type_name,
1183                master_timeout: self.master_timeout,
1184                pretty: self.pretty,
1185                source: self.source,
1186                timeout: self.timeout,
1187                wait_for_active_shards: self.wait_for_active_shards,
1188            };
1189            Some(query_params)
1190        };
1191        let body = self.body;
1192        let response = self
1193            .transport
1194            .send(method, &path, headers, query_string.as_ref(), body, timeout)
1195            .await?;
1196        Ok(response)
1197    }
1198}
1199#[derive(Debug, Clone, PartialEq)]
1200#[doc = "API parts for the Indices Delete API"]
1201pub enum IndicesDeleteParts<'b> {
1202    #[doc = "Index"]
1203    Index(&'b [&'b str]),
1204}
1205impl<'b> IndicesDeleteParts<'b> {
1206    #[doc = "Builds a relative URL path to the Indices Delete API"]
1207    pub fn url(self) -> Cow<'static, str> {
1208        match self {
1209            IndicesDeleteParts::Index(ref index) => {
1210                let index_str = index.join(",");
1211                let encoded_index: Cow<str> =
1212                    percent_encode(index_str.as_bytes(), PARTS_ENCODED).into();
1213                let mut p = String::with_capacity(1usize + encoded_index.len());
1214                p.push_str("/");
1215                p.push_str(encoded_index.as_ref());
1216                p.into()
1217            }
1218        }
1219    }
1220}
1221#[doc = "Builder for the [Indices Delete API](https://opensearch.org/docs/)\n\nDeletes an index."]
1222#[derive(Clone, Debug)]
1223pub struct IndicesDelete<'a, 'b> {
1224    transport: &'a Transport,
1225    parts: IndicesDeleteParts<'b>,
1226    allow_no_indices: Option<bool>,
1227    error_trace: Option<bool>,
1228    expand_wildcards: Option<&'b [ExpandWildcards]>,
1229    filter_path: Option<&'b [&'b str]>,
1230    headers: HeaderMap,
1231    human: Option<bool>,
1232    ignore_unavailable: Option<bool>,
1233    master_timeout: Option<&'b str>,
1234    pretty: Option<bool>,
1235    request_timeout: Option<Duration>,
1236    source: Option<&'b str>,
1237    timeout: Option<&'b str>,
1238}
1239impl<'a, 'b> IndicesDelete<'a, 'b> {
1240    #[doc = "Creates a new instance of [IndicesDelete] with the specified API parts"]
1241    pub fn new(transport: &'a Transport, parts: IndicesDeleteParts<'b>) -> Self {
1242        let headers = HeaderMap::new();
1243        IndicesDelete {
1244            transport,
1245            parts,
1246            headers,
1247            allow_no_indices: None,
1248            error_trace: None,
1249            expand_wildcards: None,
1250            filter_path: None,
1251            human: None,
1252            ignore_unavailable: None,
1253            master_timeout: None,
1254            pretty: None,
1255            request_timeout: None,
1256            source: None,
1257            timeout: None,
1258        }
1259    }
1260    #[doc = "Ignore if a wildcard expression resolves to no concrete indices (default: false)"]
1261    pub fn allow_no_indices(mut self, allow_no_indices: bool) -> Self {
1262        self.allow_no_indices = Some(allow_no_indices);
1263        self
1264    }
1265    #[doc = "Include the stack trace of returned errors."]
1266    pub fn error_trace(mut self, error_trace: bool) -> Self {
1267        self.error_trace = Some(error_trace);
1268        self
1269    }
1270    #[doc = "Whether wildcard expressions should get expanded to open or closed indices (default: open)"]
1271    pub fn expand_wildcards(mut self, expand_wildcards: &'b [ExpandWildcards]) -> Self {
1272        self.expand_wildcards = Some(expand_wildcards);
1273        self
1274    }
1275    #[doc = "A comma-separated list of filters used to reduce the response."]
1276    pub fn filter_path(mut self, filter_path: &'b [&'b str]) -> Self {
1277        self.filter_path = Some(filter_path);
1278        self
1279    }
1280    #[doc = "Adds a HTTP header"]
1281    pub fn header(mut self, key: HeaderName, value: HeaderValue) -> Self {
1282        self.headers.insert(key, value);
1283        self
1284    }
1285    #[doc = "Return human readable values for statistics."]
1286    pub fn human(mut self, human: bool) -> Self {
1287        self.human = Some(human);
1288        self
1289    }
1290    #[doc = "Ignore unavailable indexes (default: false)"]
1291    pub fn ignore_unavailable(mut self, ignore_unavailable: bool) -> Self {
1292        self.ignore_unavailable = Some(ignore_unavailable);
1293        self
1294    }
1295    #[doc = "Specify timeout for connection to master"]
1296    pub fn master_timeout(mut self, master_timeout: &'b str) -> Self {
1297        self.master_timeout = Some(master_timeout);
1298        self
1299    }
1300    #[doc = "Pretty format the returned JSON response."]
1301    pub fn pretty(mut self, pretty: bool) -> Self {
1302        self.pretty = Some(pretty);
1303        self
1304    }
1305    #[doc = "Sets a request timeout for this API call.\n\nThe timeout is applied from when the request starts connecting until the response body has finished."]
1306    pub fn request_timeout(mut self, timeout: Duration) -> Self {
1307        self.request_timeout = Some(timeout);
1308        self
1309    }
1310    #[doc = "The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests."]
1311    pub fn source(mut self, source: &'b str) -> Self {
1312        self.source = Some(source);
1313        self
1314    }
1315    #[doc = "Explicit operation timeout"]
1316    pub fn timeout(mut self, timeout: &'b str) -> Self {
1317        self.timeout = Some(timeout);
1318        self
1319    }
1320    #[doc = "Creates an asynchronous call to the Indices Delete API that can be awaited"]
1321    pub async fn send(self) -> Result<Response, Error> {
1322        let path = self.parts.url();
1323        let method = Method::Delete;
1324        let headers = self.headers;
1325        let timeout = self.request_timeout;
1326        let query_string = {
1327            #[serde_with::skip_serializing_none]
1328            #[derive(Serialize)]
1329            struct QueryParams<'b> {
1330                allow_no_indices: Option<bool>,
1331                error_trace: Option<bool>,
1332                #[serde(serialize_with = "crate::client::serialize_coll_qs")]
1333                expand_wildcards: Option<&'b [ExpandWildcards]>,
1334                #[serde(serialize_with = "crate::client::serialize_coll_qs")]
1335                filter_path: Option<&'b [&'b str]>,
1336                human: Option<bool>,
1337                ignore_unavailable: Option<bool>,
1338                master_timeout: Option<&'b str>,
1339                pretty: Option<bool>,
1340                source: Option<&'b str>,
1341                timeout: Option<&'b str>,
1342            }
1343            let query_params = QueryParams {
1344                allow_no_indices: self.allow_no_indices,
1345                error_trace: self.error_trace,
1346                expand_wildcards: self.expand_wildcards,
1347                filter_path: self.filter_path,
1348                human: self.human,
1349                ignore_unavailable: self.ignore_unavailable,
1350                master_timeout: self.master_timeout,
1351                pretty: self.pretty,
1352                source: self.source,
1353                timeout: self.timeout,
1354            };
1355            Some(query_params)
1356        };
1357        let body = Option::<()>::None;
1358        let response = self
1359            .transport
1360            .send(method, &path, headers, query_string.as_ref(), body, timeout)
1361            .await?;
1362        Ok(response)
1363    }
1364}
1365#[derive(Debug, Clone, PartialEq)]
1366#[doc = "API parts for the Indices Delete Alias API"]
1367pub enum IndicesDeleteAliasParts<'b> {
1368    #[doc = "Index and Name"]
1369    IndexName(&'b [&'b str], &'b [&'b str]),
1370}
1371impl<'b> IndicesDeleteAliasParts<'b> {
1372    #[doc = "Builds a relative URL path to the Indices Delete Alias API"]
1373    pub fn url(self) -> Cow<'static, str> {
1374        match self {
1375            IndicesDeleteAliasParts::IndexName(ref index, ref name) => {
1376                let index_str = index.join(",");
1377                let name_str = name.join(",");
1378                let encoded_index: Cow<str> =
1379                    percent_encode(index_str.as_bytes(), PARTS_ENCODED).into();
1380                let encoded_name: Cow<str> =
1381                    percent_encode(name_str.as_bytes(), PARTS_ENCODED).into();
1382                let mut p =
1383                    String::with_capacity(9usize + encoded_index.len() + encoded_name.len());
1384                p.push_str("/");
1385                p.push_str(encoded_index.as_ref());
1386                p.push_str("/_alias/");
1387                p.push_str(encoded_name.as_ref());
1388                p.into()
1389            }
1390        }
1391    }
1392}
1393#[doc = "Builder for the [Indices Delete Alias API](https://opensearch.org/docs/)\n\nDeletes an alias."]
1394#[derive(Clone, Debug)]
1395pub struct IndicesDeleteAlias<'a, 'b> {
1396    transport: &'a Transport,
1397    parts: IndicesDeleteAliasParts<'b>,
1398    error_trace: Option<bool>,
1399    filter_path: Option<&'b [&'b str]>,
1400    headers: HeaderMap,
1401    human: Option<bool>,
1402    master_timeout: Option<&'b str>,
1403    pretty: Option<bool>,
1404    request_timeout: Option<Duration>,
1405    source: Option<&'b str>,
1406    timeout: Option<&'b str>,
1407}
1408impl<'a, 'b> IndicesDeleteAlias<'a, 'b> {
1409    #[doc = "Creates a new instance of [IndicesDeleteAlias] with the specified API parts"]
1410    pub fn new(transport: &'a Transport, parts: IndicesDeleteAliasParts<'b>) -> Self {
1411        let headers = HeaderMap::new();
1412        IndicesDeleteAlias {
1413            transport,
1414            parts,
1415            headers,
1416            error_trace: None,
1417            filter_path: None,
1418            human: None,
1419            master_timeout: None,
1420            pretty: None,
1421            request_timeout: None,
1422            source: None,
1423            timeout: None,
1424        }
1425    }
1426    #[doc = "Include the stack trace of returned errors."]
1427    pub fn error_trace(mut self, error_trace: bool) -> Self {
1428        self.error_trace = Some(error_trace);
1429        self
1430    }
1431    #[doc = "A comma-separated list of filters used to reduce the response."]
1432    pub fn filter_path(mut self, filter_path: &'b [&'b str]) -> Self {
1433        self.filter_path = Some(filter_path);
1434        self
1435    }
1436    #[doc = "Adds a HTTP header"]
1437    pub fn header(mut self, key: HeaderName, value: HeaderValue) -> Self {
1438        self.headers.insert(key, value);
1439        self
1440    }
1441    #[doc = "Return human readable values for statistics."]
1442    pub fn human(mut self, human: bool) -> Self {
1443        self.human = Some(human);
1444        self
1445    }
1446    #[doc = "Specify timeout for connection to master"]
1447    pub fn master_timeout(mut self, master_timeout: &'b str) -> Self {
1448        self.master_timeout = Some(master_timeout);
1449        self
1450    }
1451    #[doc = "Pretty format the returned JSON response."]
1452    pub fn pretty(mut self, pretty: bool) -> Self {
1453        self.pretty = Some(pretty);
1454        self
1455    }
1456    #[doc = "Sets a request timeout for this API call.\n\nThe timeout is applied from when the request starts connecting until the response body has finished."]
1457    pub fn request_timeout(mut self, timeout: Duration) -> Self {
1458        self.request_timeout = Some(timeout);
1459        self
1460    }
1461    #[doc = "The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests."]
1462    pub fn source(mut self, source: &'b str) -> Self {
1463        self.source = Some(source);
1464        self
1465    }
1466    #[doc = "Explicit timestamp for the document"]
1467    pub fn timeout(mut self, timeout: &'b str) -> Self {
1468        self.timeout = Some(timeout);
1469        self
1470    }
1471    #[doc = "Creates an asynchronous call to the Indices Delete Alias API that can be awaited"]
1472    pub async fn send(self) -> Result<Response, Error> {
1473        let path = self.parts.url();
1474        let method = Method::Delete;
1475        let headers = self.headers;
1476        let timeout = self.request_timeout;
1477        let query_string = {
1478            #[serde_with::skip_serializing_none]
1479            #[derive(Serialize)]
1480            struct QueryParams<'b> {
1481                error_trace: Option<bool>,
1482                #[serde(serialize_with = "crate::client::serialize_coll_qs")]
1483                filter_path: Option<&'b [&'b str]>,
1484                human: Option<bool>,
1485                master_timeout: Option<&'b str>,
1486                pretty: Option<bool>,
1487                source: Option<&'b str>,
1488                timeout: Option<&'b str>,
1489            }
1490            let query_params = QueryParams {
1491                error_trace: self.error_trace,
1492                filter_path: self.filter_path,
1493                human: self.human,
1494                master_timeout: self.master_timeout,
1495                pretty: self.pretty,
1496                source: self.source,
1497                timeout: self.timeout,
1498            };
1499            Some(query_params)
1500        };
1501        let body = Option::<()>::None;
1502        let response = self
1503            .transport
1504            .send(method, &path, headers, query_string.as_ref(), body, timeout)
1505            .await?;
1506        Ok(response)
1507    }
1508}
1509#[derive(Debug, Clone, PartialEq)]
1510#[doc = "API parts for the Indices Delete Data Stream API"]
1511pub enum IndicesDeleteDataStreamParts<'b> {
1512    #[doc = "Name"]
1513    Name(&'b [&'b str]),
1514}
1515impl<'b> IndicesDeleteDataStreamParts<'b> {
1516    #[doc = "Builds a relative URL path to the Indices Delete Data Stream API"]
1517    pub fn url(self) -> Cow<'static, str> {
1518        match self {
1519            IndicesDeleteDataStreamParts::Name(ref name) => {
1520                let name_str = name.join(",");
1521                let encoded_name: Cow<str> =
1522                    percent_encode(name_str.as_bytes(), PARTS_ENCODED).into();
1523                let mut p = String::with_capacity(14usize + encoded_name.len());
1524                p.push_str("/_data_stream/");
1525                p.push_str(encoded_name.as_ref());
1526                p.into()
1527            }
1528        }
1529    }
1530}
1531#[doc = "Builder for the [Indices Delete Data Stream API](https://opensearch.org/docs/)\n\nDeletes a data stream."]
1532#[derive(Clone, Debug)]
1533pub struct IndicesDeleteDataStream<'a, 'b> {
1534    transport: &'a Transport,
1535    parts: IndicesDeleteDataStreamParts<'b>,
1536    error_trace: Option<bool>,
1537    expand_wildcards: Option<&'b [ExpandWildcards]>,
1538    filter_path: Option<&'b [&'b str]>,
1539    headers: HeaderMap,
1540    human: Option<bool>,
1541    pretty: Option<bool>,
1542    request_timeout: Option<Duration>,
1543    source: Option<&'b str>,
1544}
1545impl<'a, 'b> IndicesDeleteDataStream<'a, 'b> {
1546    #[doc = "Creates a new instance of [IndicesDeleteDataStream] with the specified API parts"]
1547    pub fn new(transport: &'a Transport, parts: IndicesDeleteDataStreamParts<'b>) -> Self {
1548        let headers = HeaderMap::new();
1549        IndicesDeleteDataStream {
1550            transport,
1551            parts,
1552            headers,
1553            error_trace: None,
1554            expand_wildcards: None,
1555            filter_path: None,
1556            human: None,
1557            pretty: None,
1558            request_timeout: None,
1559            source: None,
1560        }
1561    }
1562    #[doc = "Include the stack trace of returned errors."]
1563    pub fn error_trace(mut self, error_trace: bool) -> Self {
1564        self.error_trace = Some(error_trace);
1565        self
1566    }
1567    #[doc = "Whether wildcard expressions should get expanded to open or closed indices (default: open)"]
1568    pub fn expand_wildcards(mut self, expand_wildcards: &'b [ExpandWildcards]) -> Self {
1569        self.expand_wildcards = Some(expand_wildcards);
1570        self
1571    }
1572    #[doc = "A comma-separated list of filters used to reduce the response."]
1573    pub fn filter_path(mut self, filter_path: &'b [&'b str]) -> Self {
1574        self.filter_path = Some(filter_path);
1575        self
1576    }
1577    #[doc = "Adds a HTTP header"]
1578    pub fn header(mut self, key: HeaderName, value: HeaderValue) -> Self {
1579        self.headers.insert(key, value);
1580        self
1581    }
1582    #[doc = "Return human readable values for statistics."]
1583    pub fn human(mut self, human: bool) -> Self {
1584        self.human = Some(human);
1585        self
1586    }
1587    #[doc = "Pretty format the returned JSON response."]
1588    pub fn pretty(mut self, pretty: bool) -> Self {
1589        self.pretty = Some(pretty);
1590        self
1591    }
1592    #[doc = "Sets a request timeout for this API call.\n\nThe timeout is applied from when the request starts connecting until the response body has finished."]
1593    pub fn request_timeout(mut self, timeout: Duration) -> Self {
1594        self.request_timeout = Some(timeout);
1595        self
1596    }
1597    #[doc = "The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests."]
1598    pub fn source(mut self, source: &'b str) -> Self {
1599        self.source = Some(source);
1600        self
1601    }
1602    #[doc = "Creates an asynchronous call to the Indices Delete Data Stream API that can be awaited"]
1603    pub async fn send(self) -> Result<Response, Error> {
1604        let path = self.parts.url();
1605        let method = Method::Delete;
1606        let headers = self.headers;
1607        let timeout = self.request_timeout;
1608        let query_string = {
1609            #[serde_with::skip_serializing_none]
1610            #[derive(Serialize)]
1611            struct QueryParams<'b> {
1612                error_trace: Option<bool>,
1613                #[serde(serialize_with = "crate::client::serialize_coll_qs")]
1614                expand_wildcards: Option<&'b [ExpandWildcards]>,
1615                #[serde(serialize_with = "crate::client::serialize_coll_qs")]
1616                filter_path: Option<&'b [&'b str]>,
1617                human: Option<bool>,
1618                pretty: Option<bool>,
1619                source: Option<&'b str>,
1620            }
1621            let query_params = QueryParams {
1622                error_trace: self.error_trace,
1623                expand_wildcards: self.expand_wildcards,
1624                filter_path: self.filter_path,
1625                human: self.human,
1626                pretty: self.pretty,
1627                source: self.source,
1628            };
1629            Some(query_params)
1630        };
1631        let body = Option::<()>::None;
1632        let response = self
1633            .transport
1634            .send(method, &path, headers, query_string.as_ref(), body, timeout)
1635            .await?;
1636        Ok(response)
1637    }
1638}
1639#[derive(Debug, Clone, PartialEq)]
1640#[doc = "API parts for the Indices Delete Index Template API"]
1641pub enum IndicesDeleteIndexTemplateParts<'b> {
1642    #[doc = "Name"]
1643    Name(&'b str),
1644}
1645impl<'b> IndicesDeleteIndexTemplateParts<'b> {
1646    #[doc = "Builds a relative URL path to the Indices Delete Index Template API"]
1647    pub fn url(self) -> Cow<'static, str> {
1648        match self {
1649            IndicesDeleteIndexTemplateParts::Name(ref name) => {
1650                let encoded_name: Cow<str> = percent_encode(name.as_bytes(), PARTS_ENCODED).into();
1651                let mut p = String::with_capacity(17usize + encoded_name.len());
1652                p.push_str("/_index_template/");
1653                p.push_str(encoded_name.as_ref());
1654                p.into()
1655            }
1656        }
1657    }
1658}
1659#[doc = "Builder for the [Indices Delete Index Template API](https://opensearch.org/docs/)\n\nDeletes an index template."]
1660#[derive(Clone, Debug)]
1661pub struct IndicesDeleteIndexTemplate<'a, 'b> {
1662    transport: &'a Transport,
1663    parts: IndicesDeleteIndexTemplateParts<'b>,
1664    error_trace: Option<bool>,
1665    filter_path: Option<&'b [&'b str]>,
1666    headers: HeaderMap,
1667    human: Option<bool>,
1668    master_timeout: Option<&'b str>,
1669    pretty: Option<bool>,
1670    request_timeout: Option<Duration>,
1671    source: Option<&'b str>,
1672    timeout: Option<&'b str>,
1673}
1674impl<'a, 'b> IndicesDeleteIndexTemplate<'a, 'b> {
1675    #[doc = "Creates a new instance of [IndicesDeleteIndexTemplate] with the specified API parts"]
1676    pub fn new(transport: &'a Transport, parts: IndicesDeleteIndexTemplateParts<'b>) -> Self {
1677        let headers = HeaderMap::new();
1678        IndicesDeleteIndexTemplate {
1679            transport,
1680            parts,
1681            headers,
1682            error_trace: None,
1683            filter_path: None,
1684            human: None,
1685            master_timeout: None,
1686            pretty: None,
1687            request_timeout: None,
1688            source: None,
1689            timeout: None,
1690        }
1691    }
1692    #[doc = "Include the stack trace of returned errors."]
1693    pub fn error_trace(mut self, error_trace: bool) -> Self {
1694        self.error_trace = Some(error_trace);
1695        self
1696    }
1697    #[doc = "A comma-separated list of filters used to reduce the response."]
1698    pub fn filter_path(mut self, filter_path: &'b [&'b str]) -> Self {
1699        self.filter_path = Some(filter_path);
1700        self
1701    }
1702    #[doc = "Adds a HTTP header"]
1703    pub fn header(mut self, key: HeaderName, value: HeaderValue) -> Self {
1704        self.headers.insert(key, value);
1705        self
1706    }
1707    #[doc = "Return human readable values for statistics."]
1708    pub fn human(mut self, human: bool) -> Self {
1709        self.human = Some(human);
1710        self
1711    }
1712    #[doc = "Specify timeout for connection to master"]
1713    pub fn master_timeout(mut self, master_timeout: &'b str) -> Self {
1714        self.master_timeout = Some(master_timeout);
1715        self
1716    }
1717    #[doc = "Pretty format the returned JSON response."]
1718    pub fn pretty(mut self, pretty: bool) -> Self {
1719        self.pretty = Some(pretty);
1720        self
1721    }
1722    #[doc = "Sets a request timeout for this API call.\n\nThe timeout is applied from when the request starts connecting until the response body has finished."]
1723    pub fn request_timeout(mut self, timeout: Duration) -> Self {
1724        self.request_timeout = Some(timeout);
1725        self
1726    }
1727    #[doc = "The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests."]
1728    pub fn source(mut self, source: &'b str) -> Self {
1729        self.source = Some(source);
1730        self
1731    }
1732    #[doc = "Explicit operation timeout"]
1733    pub fn timeout(mut self, timeout: &'b str) -> Self {
1734        self.timeout = Some(timeout);
1735        self
1736    }
1737    #[doc = "Creates an asynchronous call to the Indices Delete Index Template API that can be awaited"]
1738    pub async fn send(self) -> Result<Response, Error> {
1739        let path = self.parts.url();
1740        let method = Method::Delete;
1741        let headers = self.headers;
1742        let timeout = self.request_timeout;
1743        let query_string = {
1744            #[serde_with::skip_serializing_none]
1745            #[derive(Serialize)]
1746            struct QueryParams<'b> {
1747                error_trace: Option<bool>,
1748                #[serde(serialize_with = "crate::client::serialize_coll_qs")]
1749                filter_path: Option<&'b [&'b str]>,
1750                human: Option<bool>,
1751                master_timeout: Option<&'b str>,
1752                pretty: Option<bool>,
1753                source: Option<&'b str>,
1754                timeout: Option<&'b str>,
1755            }
1756            let query_params = QueryParams {
1757                error_trace: self.error_trace,
1758                filter_path: self.filter_path,
1759                human: self.human,
1760                master_timeout: self.master_timeout,
1761                pretty: self.pretty,
1762                source: self.source,
1763                timeout: self.timeout,
1764            };
1765            Some(query_params)
1766        };
1767        let body = Option::<()>::None;
1768        let response = self
1769            .transport
1770            .send(method, &path, headers, query_string.as_ref(), body, timeout)
1771            .await?;
1772        Ok(response)
1773    }
1774}
1775#[derive(Debug, Clone, PartialEq)]
1776#[doc = "API parts for the Indices Delete Template API"]
1777pub enum IndicesDeleteTemplateParts<'b> {
1778    #[doc = "Name"]
1779    Name(&'b str),
1780}
1781impl<'b> IndicesDeleteTemplateParts<'b> {
1782    #[doc = "Builds a relative URL path to the Indices Delete Template API"]
1783    pub fn url(self) -> Cow<'static, str> {
1784        match self {
1785            IndicesDeleteTemplateParts::Name(ref name) => {
1786                let encoded_name: Cow<str> = percent_encode(name.as_bytes(), PARTS_ENCODED).into();
1787                let mut p = String::with_capacity(11usize + encoded_name.len());
1788                p.push_str("/_template/");
1789                p.push_str(encoded_name.as_ref());
1790                p.into()
1791            }
1792        }
1793    }
1794}
1795#[doc = "Builder for the [Indices Delete Template API](https://opensearch.org/docs/)\n\nDeletes an index template."]
1796#[derive(Clone, Debug)]
1797pub struct IndicesDeleteTemplate<'a, 'b> {
1798    transport: &'a Transport,
1799    parts: IndicesDeleteTemplateParts<'b>,
1800    error_trace: Option<bool>,
1801    filter_path: Option<&'b [&'b str]>,
1802    headers: HeaderMap,
1803    human: Option<bool>,
1804    master_timeout: Option<&'b str>,
1805    pretty: Option<bool>,
1806    request_timeout: Option<Duration>,
1807    source: Option<&'b str>,
1808    timeout: Option<&'b str>,
1809}
1810impl<'a, 'b> IndicesDeleteTemplate<'a, 'b> {
1811    #[doc = "Creates a new instance of [IndicesDeleteTemplate] with the specified API parts"]
1812    pub fn new(transport: &'a Transport, parts: IndicesDeleteTemplateParts<'b>) -> Self {
1813        let headers = HeaderMap::new();
1814        IndicesDeleteTemplate {
1815            transport,
1816            parts,
1817            headers,
1818            error_trace: None,
1819            filter_path: None,
1820            human: None,
1821            master_timeout: None,
1822            pretty: None,
1823            request_timeout: None,
1824            source: None,
1825            timeout: None,
1826        }
1827    }
1828    #[doc = "Include the stack trace of returned errors."]
1829    pub fn error_trace(mut self, error_trace: bool) -> Self {
1830        self.error_trace = Some(error_trace);
1831        self
1832    }
1833    #[doc = "A comma-separated list of filters used to reduce the response."]
1834    pub fn filter_path(mut self, filter_path: &'b [&'b str]) -> Self {
1835        self.filter_path = Some(filter_path);
1836        self
1837    }
1838    #[doc = "Adds a HTTP header"]
1839    pub fn header(mut self, key: HeaderName, value: HeaderValue) -> Self {
1840        self.headers.insert(key, value);
1841        self
1842    }
1843    #[doc = "Return human readable values for statistics."]
1844    pub fn human(mut self, human: bool) -> Self {
1845        self.human = Some(human);
1846        self
1847    }
1848    #[doc = "Specify timeout for connection to master"]
1849    pub fn master_timeout(mut self, master_timeout: &'b str) -> Self {
1850        self.master_timeout = Some(master_timeout);
1851        self
1852    }
1853    #[doc = "Pretty format the returned JSON response."]
1854    pub fn pretty(mut self, pretty: bool) -> Self {
1855        self.pretty = Some(pretty);
1856        self
1857    }
1858    #[doc = "Sets a request timeout for this API call.\n\nThe timeout is applied from when the request starts connecting until the response body has finished."]
1859    pub fn request_timeout(mut self, timeout: Duration) -> Self {
1860        self.request_timeout = Some(timeout);
1861        self
1862    }
1863    #[doc = "The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests."]
1864    pub fn source(mut self, source: &'b str) -> Self {
1865        self.source = Some(source);
1866        self
1867    }
1868    #[doc = "Explicit operation timeout"]
1869    pub fn timeout(mut self, timeout: &'b str) -> Self {
1870        self.timeout = Some(timeout);
1871        self
1872    }
1873    #[doc = "Creates an asynchronous call to the Indices Delete Template API that can be awaited"]
1874    pub async fn send(self) -> Result<Response, Error> {
1875        let path = self.parts.url();
1876        let method = Method::Delete;
1877        let headers = self.headers;
1878        let timeout = self.request_timeout;
1879        let query_string = {
1880            #[serde_with::skip_serializing_none]
1881            #[derive(Serialize)]
1882            struct QueryParams<'b> {
1883                error_trace: Option<bool>,
1884                #[serde(serialize_with = "crate::client::serialize_coll_qs")]
1885                filter_path: Option<&'b [&'b str]>,
1886                human: Option<bool>,
1887                master_timeout: Option<&'b str>,
1888                pretty: Option<bool>,
1889                source: Option<&'b str>,
1890                timeout: Option<&'b str>,
1891            }
1892            let query_params = QueryParams {
1893                error_trace: self.error_trace,
1894                filter_path: self.filter_path,
1895                human: self.human,
1896                master_timeout: self.master_timeout,
1897                pretty: self.pretty,
1898                source: self.source,
1899                timeout: self.timeout,
1900            };
1901            Some(query_params)
1902        };
1903        let body = Option::<()>::None;
1904        let response = self
1905            .transport
1906            .send(method, &path, headers, query_string.as_ref(), body, timeout)
1907            .await?;
1908        Ok(response)
1909    }
1910}
1911#[derive(Debug, Clone, PartialEq)]
1912#[doc = "API parts for the Indices Exists API"]
1913pub enum IndicesExistsParts<'b> {
1914    #[doc = "Index"]
1915    Index(&'b [&'b str]),
1916}
1917impl<'b> IndicesExistsParts<'b> {
1918    #[doc = "Builds a relative URL path to the Indices Exists API"]
1919    pub fn url(self) -> Cow<'static, str> {
1920        match self {
1921            IndicesExistsParts::Index(ref index) => {
1922                let index_str = index.join(",");
1923                let encoded_index: Cow<str> =
1924                    percent_encode(index_str.as_bytes(), PARTS_ENCODED).into();
1925                let mut p = String::with_capacity(1usize + encoded_index.len());
1926                p.push_str("/");
1927                p.push_str(encoded_index.as_ref());
1928                p.into()
1929            }
1930        }
1931    }
1932}
1933#[doc = "Builder for the [Indices Exists API](https://opensearch.org/docs/)\n\nReturns information about whether a particular index exists."]
1934#[derive(Clone, Debug)]
1935pub struct IndicesExists<'a, 'b> {
1936    transport: &'a Transport,
1937    parts: IndicesExistsParts<'b>,
1938    allow_no_indices: Option<bool>,
1939    error_trace: Option<bool>,
1940    expand_wildcards: Option<&'b [ExpandWildcards]>,
1941    filter_path: Option<&'b [&'b str]>,
1942    flat_settings: Option<bool>,
1943    headers: HeaderMap,
1944    human: Option<bool>,
1945    ignore_unavailable: Option<bool>,
1946    include_defaults: Option<bool>,
1947    local: Option<bool>,
1948    pretty: Option<bool>,
1949    request_timeout: Option<Duration>,
1950    source: Option<&'b str>,
1951}
1952impl<'a, 'b> IndicesExists<'a, 'b> {
1953    #[doc = "Creates a new instance of [IndicesExists] with the specified API parts"]
1954    pub fn new(transport: &'a Transport, parts: IndicesExistsParts<'b>) -> Self {
1955        let headers = HeaderMap::new();
1956        IndicesExists {
1957            transport,
1958            parts,
1959            headers,
1960            allow_no_indices: None,
1961            error_trace: None,
1962            expand_wildcards: None,
1963            filter_path: None,
1964            flat_settings: None,
1965            human: None,
1966            ignore_unavailable: None,
1967            include_defaults: None,
1968            local: None,
1969            pretty: None,
1970            request_timeout: None,
1971            source: None,
1972        }
1973    }
1974    #[doc = "Ignore if a wildcard expression resolves to no concrete indices (default: false)"]
1975    pub fn allow_no_indices(mut self, allow_no_indices: bool) -> Self {
1976        self.allow_no_indices = Some(allow_no_indices);
1977        self
1978    }
1979    #[doc = "Include the stack trace of returned errors."]
1980    pub fn error_trace(mut self, error_trace: bool) -> Self {
1981        self.error_trace = Some(error_trace);
1982        self
1983    }
1984    #[doc = "Whether wildcard expressions should get expanded to open or closed indices (default: open)"]
1985    pub fn expand_wildcards(mut self, expand_wildcards: &'b [ExpandWildcards]) -> Self {
1986        self.expand_wildcards = Some(expand_wildcards);
1987        self
1988    }
1989    #[doc = "A comma-separated list of filters used to reduce the response."]
1990    pub fn filter_path(mut self, filter_path: &'b [&'b str]) -> Self {
1991        self.filter_path = Some(filter_path);
1992        self
1993    }
1994    #[doc = "Return settings in flat format (default: false)"]
1995    pub fn flat_settings(mut self, flat_settings: bool) -> Self {
1996        self.flat_settings = Some(flat_settings);
1997        self
1998    }
1999    #[doc = "Adds a HTTP header"]
2000    pub fn header(mut self, key: HeaderName, value: HeaderValue) -> Self {
2001        self.headers.insert(key, value);
2002        self
2003    }
2004    #[doc = "Return human readable values for statistics."]
2005    pub fn human(mut self, human: bool) -> Self {
2006        self.human = Some(human);
2007        self
2008    }
2009    #[doc = "Ignore unavailable indexes (default: false)"]
2010    pub fn ignore_unavailable(mut self, ignore_unavailable: bool) -> Self {
2011        self.ignore_unavailable = Some(ignore_unavailable);
2012        self
2013    }
2014    #[doc = "Whether to return all default setting for each of the indices."]
2015    pub fn include_defaults(mut self, include_defaults: bool) -> Self {
2016        self.include_defaults = Some(include_defaults);
2017        self
2018    }
2019    #[doc = "Return local information, do not retrieve the state from master node (default: false)"]
2020    pub fn local(mut self, local: bool) -> Self {
2021        self.local = Some(local);
2022        self
2023    }
2024    #[doc = "Pretty format the returned JSON response."]
2025    pub fn pretty(mut self, pretty: bool) -> Self {
2026        self.pretty = Some(pretty);
2027        self
2028    }
2029    #[doc = "Sets a request timeout for this API call.\n\nThe timeout is applied from when the request starts connecting until the response body has finished."]
2030    pub fn request_timeout(mut self, timeout: Duration) -> Self {
2031        self.request_timeout = Some(timeout);
2032        self
2033    }
2034    #[doc = "The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests."]
2035    pub fn source(mut self, source: &'b str) -> Self {
2036        self.source = Some(source);
2037        self
2038    }
2039    #[doc = "Creates an asynchronous call to the Indices Exists API that can be awaited"]
2040    pub async fn send(self) -> Result<Response, Error> {
2041        let path = self.parts.url();
2042        let method = Method::Head;
2043        let headers = self.headers;
2044        let timeout = self.request_timeout;
2045        let query_string = {
2046            #[serde_with::skip_serializing_none]
2047            #[derive(Serialize)]
2048            struct QueryParams<'b> {
2049                allow_no_indices: Option<bool>,
2050                error_trace: Option<bool>,
2051                #[serde(serialize_with = "crate::client::serialize_coll_qs")]
2052                expand_wildcards: Option<&'b [ExpandWildcards]>,
2053                #[serde(serialize_with = "crate::client::serialize_coll_qs")]
2054                filter_path: Option<&'b [&'b str]>,
2055                flat_settings: Option<bool>,
2056                human: Option<bool>,
2057                ignore_unavailable: Option<bool>,
2058                include_defaults: Option<bool>,
2059                local: Option<bool>,
2060                pretty: Option<bool>,
2061                source: Option<&'b str>,
2062            }
2063            let query_params = QueryParams {
2064                allow_no_indices: self.allow_no_indices,
2065                error_trace: self.error_trace,
2066                expand_wildcards: self.expand_wildcards,
2067                filter_path: self.filter_path,
2068                flat_settings: self.flat_settings,
2069                human: self.human,
2070                ignore_unavailable: self.ignore_unavailable,
2071                include_defaults: self.include_defaults,
2072                local: self.local,
2073                pretty: self.pretty,
2074                source: self.source,
2075            };
2076            Some(query_params)
2077        };
2078        let body = Option::<()>::None;
2079        let response = self
2080            .transport
2081            .send(method, &path, headers, query_string.as_ref(), body, timeout)
2082            .await?;
2083        Ok(response)
2084    }
2085}
2086#[derive(Debug, Clone, PartialEq)]
2087#[doc = "API parts for the Indices Exists Alias API"]
2088pub enum IndicesExistsAliasParts<'b> {
2089    #[doc = "Name"]
2090    Name(&'b [&'b str]),
2091    #[doc = "Index and Name"]
2092    IndexName(&'b [&'b str], &'b [&'b str]),
2093}
2094impl<'b> IndicesExistsAliasParts<'b> {
2095    #[doc = "Builds a relative URL path to the Indices Exists Alias API"]
2096    pub fn url(self) -> Cow<'static, str> {
2097        match self {
2098            IndicesExistsAliasParts::Name(ref name) => {
2099                let name_str = name.join(",");
2100                let encoded_name: Cow<str> =
2101                    percent_encode(name_str.as_bytes(), PARTS_ENCODED).into();
2102                let mut p = String::with_capacity(8usize + encoded_name.len());
2103                p.push_str("/_alias/");
2104                p.push_str(encoded_name.as_ref());
2105                p.into()
2106            }
2107            IndicesExistsAliasParts::IndexName(ref index, ref name) => {
2108                let index_str = index.join(",");
2109                let name_str = name.join(",");
2110                let encoded_index: Cow<str> =
2111                    percent_encode(index_str.as_bytes(), PARTS_ENCODED).into();
2112                let encoded_name: Cow<str> =
2113                    percent_encode(name_str.as_bytes(), PARTS_ENCODED).into();
2114                let mut p =
2115                    String::with_capacity(9usize + encoded_index.len() + encoded_name.len());
2116                p.push_str("/");
2117                p.push_str(encoded_index.as_ref());
2118                p.push_str("/_alias/");
2119                p.push_str(encoded_name.as_ref());
2120                p.into()
2121            }
2122        }
2123    }
2124}
2125#[doc = "Builder for the [Indices Exists Alias API](https://opensearch.org/docs/)\n\nReturns information about whether a particular alias exists."]
2126#[derive(Clone, Debug)]
2127pub struct IndicesExistsAlias<'a, 'b> {
2128    transport: &'a Transport,
2129    parts: IndicesExistsAliasParts<'b>,
2130    allow_no_indices: Option<bool>,
2131    error_trace: Option<bool>,
2132    expand_wildcards: Option<&'b [ExpandWildcards]>,
2133    filter_path: Option<&'b [&'b str]>,
2134    headers: HeaderMap,
2135    human: Option<bool>,
2136    ignore_unavailable: Option<bool>,
2137    local: Option<bool>,
2138    pretty: Option<bool>,
2139    request_timeout: Option<Duration>,
2140    source: Option<&'b str>,
2141}
2142impl<'a, 'b> IndicesExistsAlias<'a, 'b> {
2143    #[doc = "Creates a new instance of [IndicesExistsAlias] with the specified API parts"]
2144    pub fn new(transport: &'a Transport, parts: IndicesExistsAliasParts<'b>) -> Self {
2145        let headers = HeaderMap::new();
2146        IndicesExistsAlias {
2147            transport,
2148            parts,
2149            headers,
2150            allow_no_indices: None,
2151            error_trace: None,
2152            expand_wildcards: None,
2153            filter_path: None,
2154            human: None,
2155            ignore_unavailable: None,
2156            local: None,
2157            pretty: None,
2158            request_timeout: None,
2159            source: None,
2160        }
2161    }
2162    #[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)"]
2163    pub fn allow_no_indices(mut self, allow_no_indices: bool) -> Self {
2164        self.allow_no_indices = Some(allow_no_indices);
2165        self
2166    }
2167    #[doc = "Include the stack trace of returned errors."]
2168    pub fn error_trace(mut self, error_trace: bool) -> Self {
2169        self.error_trace = Some(error_trace);
2170        self
2171    }
2172    #[doc = "Whether to expand wildcard expression to concrete indices that are open, closed or both."]
2173    pub fn expand_wildcards(mut self, expand_wildcards: &'b [ExpandWildcards]) -> Self {
2174        self.expand_wildcards = Some(expand_wildcards);
2175        self
2176    }
2177    #[doc = "A comma-separated list of filters used to reduce the response."]
2178    pub fn filter_path(mut self, filter_path: &'b [&'b str]) -> Self {
2179        self.filter_path = Some(filter_path);
2180        self
2181    }
2182    #[doc = "Adds a HTTP header"]
2183    pub fn header(mut self, key: HeaderName, value: HeaderValue) -> Self {
2184        self.headers.insert(key, value);
2185        self
2186    }
2187    #[doc = "Return human readable values for statistics."]
2188    pub fn human(mut self, human: bool) -> Self {
2189        self.human = Some(human);
2190        self
2191    }
2192    #[doc = "Whether specified concrete indices should be ignored when unavailable (missing or closed)"]
2193    pub fn ignore_unavailable(mut self, ignore_unavailable: bool) -> Self {
2194        self.ignore_unavailable = Some(ignore_unavailable);
2195        self
2196    }
2197    #[doc = "Return local information, do not retrieve the state from master node (default: false)"]
2198    pub fn local(mut self, local: bool) -> Self {
2199        self.local = Some(local);
2200        self
2201    }
2202    #[doc = "Pretty format the returned JSON response."]
2203    pub fn pretty(mut self, pretty: bool) -> Self {
2204        self.pretty = Some(pretty);
2205        self
2206    }
2207    #[doc = "Sets a request timeout for this API call.\n\nThe timeout is applied from when the request starts connecting until the response body has finished."]
2208    pub fn request_timeout(mut self, timeout: Duration) -> Self {
2209        self.request_timeout = Some(timeout);
2210        self
2211    }
2212    #[doc = "The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests."]
2213    pub fn source(mut self, source: &'b str) -> Self {
2214        self.source = Some(source);
2215        self
2216    }
2217    #[doc = "Creates an asynchronous call to the Indices Exists Alias API that can be awaited"]
2218    pub async fn send(self) -> Result<Response, Error> {
2219        let path = self.parts.url();
2220        let method = Method::Head;
2221        let headers = self.headers;
2222        let timeout = self.request_timeout;
2223        let query_string = {
2224            #[serde_with::skip_serializing_none]
2225            #[derive(Serialize)]
2226            struct QueryParams<'b> {
2227                allow_no_indices: Option<bool>,
2228                error_trace: Option<bool>,
2229                #[serde(serialize_with = "crate::client::serialize_coll_qs")]
2230                expand_wildcards: Option<&'b [ExpandWildcards]>,
2231                #[serde(serialize_with = "crate::client::serialize_coll_qs")]
2232                filter_path: Option<&'b [&'b str]>,
2233                human: Option<bool>,
2234                ignore_unavailable: Option<bool>,
2235                local: Option<bool>,
2236                pretty: Option<bool>,
2237                source: Option<&'b str>,
2238            }
2239            let query_params = QueryParams {
2240                allow_no_indices: self.allow_no_indices,
2241                error_trace: self.error_trace,
2242                expand_wildcards: self.expand_wildcards,
2243                filter_path: self.filter_path,
2244                human: self.human,
2245                ignore_unavailable: self.ignore_unavailable,
2246                local: self.local,
2247                pretty: self.pretty,
2248                source: self.source,
2249            };
2250            Some(query_params)
2251        };
2252        let body = Option::<()>::None;
2253        let response = self
2254            .transport
2255            .send(method, &path, headers, query_string.as_ref(), body, timeout)
2256            .await?;
2257        Ok(response)
2258    }
2259}
2260#[derive(Debug, Clone, PartialEq)]
2261#[doc = "API parts for the Indices Exists Index Template API"]
2262pub enum IndicesExistsIndexTemplateParts<'b> {
2263    #[doc = "Name"]
2264    Name(&'b str),
2265}
2266impl<'b> IndicesExistsIndexTemplateParts<'b> {
2267    #[doc = "Builds a relative URL path to the Indices Exists Index Template API"]
2268    pub fn url(self) -> Cow<'static, str> {
2269        match self {
2270            IndicesExistsIndexTemplateParts::Name(ref name) => {
2271                let encoded_name: Cow<str> = percent_encode(name.as_bytes(), PARTS_ENCODED).into();
2272                let mut p = String::with_capacity(17usize + encoded_name.len());
2273                p.push_str("/_index_template/");
2274                p.push_str(encoded_name.as_ref());
2275                p.into()
2276            }
2277        }
2278    }
2279}
2280#[doc = "Builder for the [Indices Exists Index Template API](https://opensearch.org/docs/)\n\nReturns information about whether a particular index template exists."]
2281#[derive(Clone, Debug)]
2282pub struct IndicesExistsIndexTemplate<'a, 'b> {
2283    transport: &'a Transport,
2284    parts: IndicesExistsIndexTemplateParts<'b>,
2285    error_trace: Option<bool>,
2286    filter_path: Option<&'b [&'b str]>,
2287    flat_settings: Option<bool>,
2288    headers: HeaderMap,
2289    human: Option<bool>,
2290    local: Option<bool>,
2291    master_timeout: Option<&'b str>,
2292    pretty: Option<bool>,
2293    request_timeout: Option<Duration>,
2294    source: Option<&'b str>,
2295}
2296impl<'a, 'b> IndicesExistsIndexTemplate<'a, 'b> {
2297    #[doc = "Creates a new instance of [IndicesExistsIndexTemplate] with the specified API parts"]
2298    pub fn new(transport: &'a Transport, parts: IndicesExistsIndexTemplateParts<'b>) -> Self {
2299        let headers = HeaderMap::new();
2300        IndicesExistsIndexTemplate {
2301            transport,
2302            parts,
2303            headers,
2304            error_trace: None,
2305            filter_path: None,
2306            flat_settings: None,
2307            human: None,
2308            local: None,
2309            master_timeout: None,
2310            pretty: None,
2311            request_timeout: None,
2312            source: None,
2313        }
2314    }
2315    #[doc = "Include the stack trace of returned errors."]
2316    pub fn error_trace(mut self, error_trace: bool) -> Self {
2317        self.error_trace = Some(error_trace);
2318        self
2319    }
2320    #[doc = "A comma-separated list of filters used to reduce the response."]
2321    pub fn filter_path(mut self, filter_path: &'b [&'b str]) -> Self {
2322        self.filter_path = Some(filter_path);
2323        self
2324    }
2325    #[doc = "Return settings in flat format (default: false)"]
2326    pub fn flat_settings(mut self, flat_settings: bool) -> Self {
2327        self.flat_settings = Some(flat_settings);
2328        self
2329    }
2330    #[doc = "Adds a HTTP header"]
2331    pub fn header(mut self, key: HeaderName, value: HeaderValue) -> Self {
2332        self.headers.insert(key, value);
2333        self
2334    }
2335    #[doc = "Return human readable values for statistics."]
2336    pub fn human(mut self, human: bool) -> Self {
2337        self.human = Some(human);
2338        self
2339    }
2340    #[doc = "Return local information, do not retrieve the state from master node (default: false)"]
2341    pub fn local(mut self, local: bool) -> Self {
2342        self.local = Some(local);
2343        self
2344    }
2345    #[doc = "Explicit operation timeout for connection to master node"]
2346    pub fn master_timeout(mut self, master_timeout: &'b str) -> Self {
2347        self.master_timeout = Some(master_timeout);
2348        self
2349    }
2350    #[doc = "Pretty format the returned JSON response."]
2351    pub fn pretty(mut self, pretty: bool) -> Self {
2352        self.pretty = Some(pretty);
2353        self
2354    }
2355    #[doc = "Sets a request timeout for this API call.\n\nThe timeout is applied from when the request starts connecting until the response body has finished."]
2356    pub fn request_timeout(mut self, timeout: Duration) -> Self {
2357        self.request_timeout = Some(timeout);
2358        self
2359    }
2360    #[doc = "The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests."]
2361    pub fn source(mut self, source: &'b str) -> Self {
2362        self.source = Some(source);
2363        self
2364    }
2365    #[doc = "Creates an asynchronous call to the Indices Exists Index Template API that can be awaited"]
2366    pub async fn send(self) -> Result<Response, Error> {
2367        let path = self.parts.url();
2368        let method = Method::Head;
2369        let headers = self.headers;
2370        let timeout = self.request_timeout;
2371        let query_string = {
2372            #[serde_with::skip_serializing_none]
2373            #[derive(Serialize)]
2374            struct QueryParams<'b> {
2375                error_trace: Option<bool>,
2376                #[serde(serialize_with = "crate::client::serialize_coll_qs")]
2377                filter_path: Option<&'b [&'b str]>,
2378                flat_settings: Option<bool>,
2379                human: Option<bool>,
2380                local: Option<bool>,
2381                master_timeout: Option<&'b str>,
2382                pretty: Option<bool>,
2383                source: Option<&'b str>,
2384            }
2385            let query_params = QueryParams {
2386                error_trace: self.error_trace,
2387                filter_path: self.filter_path,
2388                flat_settings: self.flat_settings,
2389                human: self.human,
2390                local: self.local,
2391                master_timeout: self.master_timeout,
2392                pretty: self.pretty,
2393                source: self.source,
2394            };
2395            Some(query_params)
2396        };
2397        let body = Option::<()>::None;
2398        let response = self
2399            .transport
2400            .send(method, &path, headers, query_string.as_ref(), body, timeout)
2401            .await?;
2402        Ok(response)
2403    }
2404}
2405#[derive(Debug, Clone, PartialEq)]
2406#[doc = "API parts for the Indices Exists Template API"]
2407pub enum IndicesExistsTemplateParts<'b> {
2408    #[doc = "Name"]
2409    Name(&'b [&'b str]),
2410}
2411impl<'b> IndicesExistsTemplateParts<'b> {
2412    #[doc = "Builds a relative URL path to the Indices Exists Template API"]
2413    pub fn url(self) -> Cow<'static, str> {
2414        match self {
2415            IndicesExistsTemplateParts::Name(ref name) => {
2416                let name_str = name.join(",");
2417                let encoded_name: Cow<str> =
2418                    percent_encode(name_str.as_bytes(), PARTS_ENCODED).into();
2419                let mut p = String::with_capacity(11usize + encoded_name.len());
2420                p.push_str("/_template/");
2421                p.push_str(encoded_name.as_ref());
2422                p.into()
2423            }
2424        }
2425    }
2426}
2427#[doc = "Builder for the [Indices Exists Template API](https://opensearch.org/docs/)\n\nReturns information about whether a particular index template exists."]
2428#[derive(Clone, Debug)]
2429pub struct IndicesExistsTemplate<'a, 'b> {
2430    transport: &'a Transport,
2431    parts: IndicesExistsTemplateParts<'b>,
2432    error_trace: Option<bool>,
2433    filter_path: Option<&'b [&'b str]>,
2434    flat_settings: Option<bool>,
2435    headers: HeaderMap,
2436    human: Option<bool>,
2437    local: Option<bool>,
2438    master_timeout: Option<&'b str>,
2439    pretty: Option<bool>,
2440    request_timeout: Option<Duration>,
2441    source: Option<&'b str>,
2442}
2443impl<'a, 'b> IndicesExistsTemplate<'a, 'b> {
2444    #[doc = "Creates a new instance of [IndicesExistsTemplate] with the specified API parts"]
2445    pub fn new(transport: &'a Transport, parts: IndicesExistsTemplateParts<'b>) -> Self {
2446        let headers = HeaderMap::new();
2447        IndicesExistsTemplate {
2448            transport,
2449            parts,
2450            headers,
2451            error_trace: None,
2452            filter_path: None,
2453            flat_settings: None,
2454            human: None,
2455            local: None,
2456            master_timeout: None,
2457            pretty: None,
2458            request_timeout: None,
2459            source: None,
2460        }
2461    }
2462    #[doc = "Include the stack trace of returned errors."]
2463    pub fn error_trace(mut self, error_trace: bool) -> Self {
2464        self.error_trace = Some(error_trace);
2465        self
2466    }
2467    #[doc = "A comma-separated list of filters used to reduce the response."]
2468    pub fn filter_path(mut self, filter_path: &'b [&'b str]) -> Self {
2469        self.filter_path = Some(filter_path);
2470        self
2471    }
2472    #[doc = "Return settings in flat format (default: false)"]
2473    pub fn flat_settings(mut self, flat_settings: bool) -> Self {
2474        self.flat_settings = Some(flat_settings);
2475        self
2476    }
2477    #[doc = "Adds a HTTP header"]
2478    pub fn header(mut self, key: HeaderName, value: HeaderValue) -> Self {
2479        self.headers.insert(key, value);
2480        self
2481    }
2482    #[doc = "Return human readable values for statistics."]
2483    pub fn human(mut self, human: bool) -> Self {
2484        self.human = Some(human);
2485        self
2486    }
2487    #[doc = "Return local information, do not retrieve the state from master node (default: false)"]
2488    pub fn local(mut self, local: bool) -> Self {
2489        self.local = Some(local);
2490        self
2491    }
2492    #[doc = "Explicit operation timeout for connection to master node"]
2493    pub fn master_timeout(mut self, master_timeout: &'b str) -> Self {
2494        self.master_timeout = Some(master_timeout);
2495        self
2496    }
2497    #[doc = "Pretty format the returned JSON response."]
2498    pub fn pretty(mut self, pretty: bool) -> Self {
2499        self.pretty = Some(pretty);
2500        self
2501    }
2502    #[doc = "Sets a request timeout for this API call.\n\nThe timeout is applied from when the request starts connecting until the response body has finished."]
2503    pub fn request_timeout(mut self, timeout: Duration) -> Self {
2504        self.request_timeout = Some(timeout);
2505        self
2506    }
2507    #[doc = "The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests."]
2508    pub fn source(mut self, source: &'b str) -> Self {
2509        self.source = Some(source);
2510        self
2511    }
2512    #[doc = "Creates an asynchronous call to the Indices Exists Template API that can be awaited"]
2513    pub async fn send(self) -> Result<Response, Error> {
2514        let path = self.parts.url();
2515        let method = Method::Head;
2516        let headers = self.headers;
2517        let timeout = self.request_timeout;
2518        let query_string = {
2519            #[serde_with::skip_serializing_none]
2520            #[derive(Serialize)]
2521            struct QueryParams<'b> {
2522                error_trace: Option<bool>,
2523                #[serde(serialize_with = "crate::client::serialize_coll_qs")]
2524                filter_path: Option<&'b [&'b str]>,
2525                flat_settings: Option<bool>,
2526                human: Option<bool>,
2527                local: Option<bool>,
2528                master_timeout: Option<&'b str>,
2529                pretty: Option<bool>,
2530                source: Option<&'b str>,
2531            }
2532            let query_params = QueryParams {
2533                error_trace: self.error_trace,
2534                filter_path: self.filter_path,
2535                flat_settings: self.flat_settings,
2536                human: self.human,
2537                local: self.local,
2538                master_timeout: self.master_timeout,
2539                pretty: self.pretty,
2540                source: self.source,
2541            };
2542            Some(query_params)
2543        };
2544        let body = Option::<()>::None;
2545        let response = self
2546            .transport
2547            .send(method, &path, headers, query_string.as_ref(), body, timeout)
2548            .await?;
2549        Ok(response)
2550    }
2551}
2552#[derive(Debug, Clone, PartialEq)]
2553#[doc = "API parts for the Indices Exists Type API"]
2554pub enum IndicesExistsTypeParts<'b> {
2555    #[doc = "Index and Type"]
2556    IndexType(&'b [&'b str], &'b [&'b str]),
2557}
2558impl<'b> IndicesExistsTypeParts<'b> {
2559    #[doc = "Builds a relative URL path to the Indices Exists Type API"]
2560    pub fn url(self) -> Cow<'static, str> {
2561        match self {
2562            IndicesExistsTypeParts::IndexType(ref index, ref ty) => {
2563                let index_str = index.join(",");
2564                let ty_str = ty.join(",");
2565                let encoded_index: Cow<str> =
2566                    percent_encode(index_str.as_bytes(), PARTS_ENCODED).into();
2567                let encoded_ty: Cow<str> = percent_encode(ty_str.as_bytes(), PARTS_ENCODED).into();
2568                let mut p = String::with_capacity(11usize + encoded_index.len() + encoded_ty.len());
2569                p.push_str("/");
2570                p.push_str(encoded_index.as_ref());
2571                p.push_str("/_mapping/");
2572                p.push_str(encoded_ty.as_ref());
2573                p.into()
2574            }
2575        }
2576    }
2577}
2578#[doc = "Builder for the [Indices Exists Type API](https://opensearch.org/docs/)\n\nReturns information about whether a particular document type exists. (DEPRECATED)"]
2579#[derive(Clone, Debug)]
2580pub struct IndicesExistsType<'a, 'b> {
2581    transport: &'a Transport,
2582    parts: IndicesExistsTypeParts<'b>,
2583    allow_no_indices: Option<bool>,
2584    error_trace: Option<bool>,
2585    expand_wildcards: Option<&'b [ExpandWildcards]>,
2586    filter_path: Option<&'b [&'b str]>,
2587    headers: HeaderMap,
2588    human: Option<bool>,
2589    ignore_unavailable: Option<bool>,
2590    local: Option<bool>,
2591    pretty: Option<bool>,
2592    request_timeout: Option<Duration>,
2593    source: Option<&'b str>,
2594}
2595impl<'a, 'b> IndicesExistsType<'a, 'b> {
2596    #[doc = "Creates a new instance of [IndicesExistsType] with the specified API parts"]
2597    pub fn new(transport: &'a Transport, parts: IndicesExistsTypeParts<'b>) -> Self {
2598        let headers = HeaderMap::new();
2599        IndicesExistsType {
2600            transport,
2601            parts,
2602            headers,
2603            allow_no_indices: None,
2604            error_trace: None,
2605            expand_wildcards: None,
2606            filter_path: None,
2607            human: None,
2608            ignore_unavailable: None,
2609            local: None,
2610            pretty: None,
2611            request_timeout: None,
2612            source: None,
2613        }
2614    }
2615    #[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)"]
2616    pub fn allow_no_indices(mut self, allow_no_indices: bool) -> Self {
2617        self.allow_no_indices = Some(allow_no_indices);
2618        self
2619    }
2620    #[doc = "Include the stack trace of returned errors."]
2621    pub fn error_trace(mut self, error_trace: bool) -> Self {
2622        self.error_trace = Some(error_trace);
2623        self
2624    }
2625    #[doc = "Whether to expand wildcard expression to concrete indices that are open, closed or both."]
2626    pub fn expand_wildcards(mut self, expand_wildcards: &'b [ExpandWildcards]) -> Self {
2627        self.expand_wildcards = Some(expand_wildcards);
2628        self
2629    }
2630    #[doc = "A comma-separated list of filters used to reduce the response."]
2631    pub fn filter_path(mut self, filter_path: &'b [&'b str]) -> Self {
2632        self.filter_path = Some(filter_path);
2633        self
2634    }
2635    #[doc = "Adds a HTTP header"]
2636    pub fn header(mut self, key: HeaderName, value: HeaderValue) -> Self {
2637        self.headers.insert(key, value);
2638        self
2639    }
2640    #[doc = "Return human readable values for statistics."]
2641    pub fn human(mut self, human: bool) -> Self {
2642        self.human = Some(human);
2643        self
2644    }
2645    #[doc = "Whether specified concrete indices should be ignored when unavailable (missing or closed)"]
2646    pub fn ignore_unavailable(mut self, ignore_unavailable: bool) -> Self {
2647        self.ignore_unavailable = Some(ignore_unavailable);
2648        self
2649    }
2650    #[doc = "Return local information, do not retrieve the state from master node (default: false)"]
2651    pub fn local(mut self, local: bool) -> Self {
2652        self.local = Some(local);
2653        self
2654    }
2655    #[doc = "Pretty format the returned JSON response."]
2656    pub fn pretty(mut self, pretty: bool) -> Self {
2657        self.pretty = Some(pretty);
2658        self
2659    }
2660    #[doc = "Sets a request timeout for this API call.\n\nThe timeout is applied from when the request starts connecting until the response body has finished."]
2661    pub fn request_timeout(mut self, timeout: Duration) -> Self {
2662        self.request_timeout = Some(timeout);
2663        self
2664    }
2665    #[doc = "The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests."]
2666    pub fn source(mut self, source: &'b str) -> Self {
2667        self.source = Some(source);
2668        self
2669    }
2670    #[doc = "Creates an asynchronous call to the Indices Exists Type API that can be awaited"]
2671    pub async fn send(self) -> Result<Response, Error> {
2672        let path = self.parts.url();
2673        let method = Method::Head;
2674        let headers = self.headers;
2675        let timeout = self.request_timeout;
2676        let query_string = {
2677            #[serde_with::skip_serializing_none]
2678            #[derive(Serialize)]
2679            struct QueryParams<'b> {
2680                allow_no_indices: Option<bool>,
2681                error_trace: Option<bool>,
2682                #[serde(serialize_with = "crate::client::serialize_coll_qs")]
2683                expand_wildcards: Option<&'b [ExpandWildcards]>,
2684                #[serde(serialize_with = "crate::client::serialize_coll_qs")]
2685                filter_path: Option<&'b [&'b str]>,
2686                human: Option<bool>,
2687                ignore_unavailable: Option<bool>,
2688                local: Option<bool>,
2689                pretty: Option<bool>,
2690                source: Option<&'b str>,
2691            }
2692            let query_params = QueryParams {
2693                allow_no_indices: self.allow_no_indices,
2694                error_trace: self.error_trace,
2695                expand_wildcards: self.expand_wildcards,
2696                filter_path: self.filter_path,
2697                human: self.human,
2698                ignore_unavailable: self.ignore_unavailable,
2699                local: self.local,
2700                pretty: self.pretty,
2701                source: self.source,
2702            };
2703            Some(query_params)
2704        };
2705        let body = Option::<()>::None;
2706        let response = self
2707            .transport
2708            .send(method, &path, headers, query_string.as_ref(), body, timeout)
2709            .await?;
2710        Ok(response)
2711    }
2712}
2713#[derive(Debug, Clone, PartialEq)]
2714#[doc = "API parts for the Indices Flush API"]
2715pub enum IndicesFlushParts<'b> {
2716    #[doc = "No parts"]
2717    None,
2718    #[doc = "Index"]
2719    Index(&'b [&'b str]),
2720}
2721impl<'b> IndicesFlushParts<'b> {
2722    #[doc = "Builds a relative URL path to the Indices Flush API"]
2723    pub fn url(self) -> Cow<'static, str> {
2724        match self {
2725            IndicesFlushParts::None => "/_flush".into(),
2726            IndicesFlushParts::Index(ref index) => {
2727                let index_str = index.join(",");
2728                let encoded_index: Cow<str> =
2729                    percent_encode(index_str.as_bytes(), PARTS_ENCODED).into();
2730                let mut p = String::with_capacity(8usize + encoded_index.len());
2731                p.push_str("/");
2732                p.push_str(encoded_index.as_ref());
2733                p.push_str("/_flush");
2734                p.into()
2735            }
2736        }
2737    }
2738}
2739#[doc = "Builder for the [Indices Flush API](https://opensearch.org/docs/)\n\nPerforms the flush operation on one or more indices."]
2740#[derive(Clone, Debug)]
2741pub struct IndicesFlush<'a, 'b, B> {
2742    transport: &'a Transport,
2743    parts: IndicesFlushParts<'b>,
2744    allow_no_indices: Option<bool>,
2745    body: Option<B>,
2746    error_trace: Option<bool>,
2747    expand_wildcards: Option<&'b [ExpandWildcards]>,
2748    filter_path: Option<&'b [&'b str]>,
2749    force: Option<bool>,
2750    headers: HeaderMap,
2751    human: Option<bool>,
2752    ignore_unavailable: Option<bool>,
2753    pretty: Option<bool>,
2754    request_timeout: Option<Duration>,
2755    source: Option<&'b str>,
2756    wait_if_ongoing: Option<bool>,
2757}
2758impl<'a, 'b, B> IndicesFlush<'a, 'b, B>
2759where
2760    B: Body,
2761{
2762    #[doc = "Creates a new instance of [IndicesFlush] with the specified API parts"]
2763    pub fn new(transport: &'a Transport, parts: IndicesFlushParts<'b>) -> Self {
2764        let headers = HeaderMap::new();
2765        IndicesFlush {
2766            transport,
2767            parts,
2768            headers,
2769            allow_no_indices: None,
2770            body: None,
2771            error_trace: None,
2772            expand_wildcards: None,
2773            filter_path: None,
2774            force: None,
2775            human: None,
2776            ignore_unavailable: None,
2777            pretty: None,
2778            request_timeout: None,
2779            source: None,
2780            wait_if_ongoing: None,
2781        }
2782    }
2783    #[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)"]
2784    pub fn allow_no_indices(mut self, allow_no_indices: bool) -> Self {
2785        self.allow_no_indices = Some(allow_no_indices);
2786        self
2787    }
2788    #[doc = "The body for the API call"]
2789    pub fn body<T>(self, body: T) -> IndicesFlush<'a, 'b, JsonBody<T>>
2790    where
2791        T: Serialize,
2792    {
2793        IndicesFlush {
2794            transport: self.transport,
2795            parts: self.parts,
2796            body: Some(body.into()),
2797            allow_no_indices: self.allow_no_indices,
2798            error_trace: self.error_trace,
2799            expand_wildcards: self.expand_wildcards,
2800            filter_path: self.filter_path,
2801            force: self.force,
2802            headers: self.headers,
2803            human: self.human,
2804            ignore_unavailable: self.ignore_unavailable,
2805            pretty: self.pretty,
2806            request_timeout: self.request_timeout,
2807            source: self.source,
2808            wait_if_ongoing: self.wait_if_ongoing,
2809        }
2810    }
2811    #[doc = "Include the stack trace of returned errors."]
2812    pub fn error_trace(mut self, error_trace: bool) -> Self {
2813        self.error_trace = Some(error_trace);
2814        self
2815    }
2816    #[doc = "Whether to expand wildcard expression to concrete indices that are open, closed or both."]
2817    pub fn expand_wildcards(mut self, expand_wildcards: &'b [ExpandWildcards]) -> Self {
2818        self.expand_wildcards = Some(expand_wildcards);
2819        self
2820    }
2821    #[doc = "A comma-separated list of filters used to reduce the response."]
2822    pub fn filter_path(mut self, filter_path: &'b [&'b str]) -> Self {
2823        self.filter_path = Some(filter_path);
2824        self
2825    }
2826    #[doc = "Whether a flush should be forced even if it is not necessarily needed ie. if no changes will be committed to the index. This is useful if transaction log IDs should be incremented even if no uncommitted changes are present. (This setting can be considered as internal)"]
2827    pub fn force(mut self, force: bool) -> Self {
2828        self.force = Some(force);
2829        self
2830    }
2831    #[doc = "Adds a HTTP header"]
2832    pub fn header(mut self, key: HeaderName, value: HeaderValue) -> Self {
2833        self.headers.insert(key, value);
2834        self
2835    }
2836    #[doc = "Return human readable values for statistics."]
2837    pub fn human(mut self, human: bool) -> Self {
2838        self.human = Some(human);
2839        self
2840    }
2841    #[doc = "Whether specified concrete indices should be ignored when unavailable (missing or closed)"]
2842    pub fn ignore_unavailable(mut self, ignore_unavailable: bool) -> Self {
2843        self.ignore_unavailable = Some(ignore_unavailable);
2844        self
2845    }
2846    #[doc = "Pretty format the returned JSON response."]
2847    pub fn pretty(mut self, pretty: bool) -> Self {
2848        self.pretty = Some(pretty);
2849        self
2850    }
2851    #[doc = "Sets a request timeout for this API call.\n\nThe timeout is applied from when the request starts connecting until the response body has finished."]
2852    pub fn request_timeout(mut self, timeout: Duration) -> Self {
2853        self.request_timeout = Some(timeout);
2854        self
2855    }
2856    #[doc = "The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests."]
2857    pub fn source(mut self, source: &'b str) -> Self {
2858        self.source = Some(source);
2859        self
2860    }
2861    #[doc = "If set to true the flush operation will block until the flush can be executed if another flush operation is already executing. The default is true. If set to false the flush will be skipped iff if another flush operation is already running."]
2862    pub fn wait_if_ongoing(mut self, wait_if_ongoing: bool) -> Self {
2863        self.wait_if_ongoing = Some(wait_if_ongoing);
2864        self
2865    }
2866    #[doc = "Creates an asynchronous call to the Indices Flush API that can be awaited"]
2867    pub async fn send(self) -> Result<Response, Error> {
2868        let path = self.parts.url();
2869        let method = match self.body {
2870            Some(_) => Method::Post,
2871            None => Method::Get,
2872        };
2873        let headers = self.headers;
2874        let timeout = self.request_timeout;
2875        let query_string = {
2876            #[serde_with::skip_serializing_none]
2877            #[derive(Serialize)]
2878            struct QueryParams<'b> {
2879                allow_no_indices: Option<bool>,
2880                error_trace: Option<bool>,
2881                #[serde(serialize_with = "crate::client::serialize_coll_qs")]
2882                expand_wildcards: Option<&'b [ExpandWildcards]>,
2883                #[serde(serialize_with = "crate::client::serialize_coll_qs")]
2884                filter_path: Option<&'b [&'b str]>,
2885                force: Option<bool>,
2886                human: Option<bool>,
2887                ignore_unavailable: Option<bool>,
2888                pretty: Option<bool>,
2889                source: Option<&'b str>,
2890                wait_if_ongoing: Option<bool>,
2891            }
2892            let query_params = QueryParams {
2893                allow_no_indices: self.allow_no_indices,
2894                error_trace: self.error_trace,
2895                expand_wildcards: self.expand_wildcards,
2896                filter_path: self.filter_path,
2897                force: self.force,
2898                human: self.human,
2899                ignore_unavailable: self.ignore_unavailable,
2900                pretty: self.pretty,
2901                source: self.source,
2902                wait_if_ongoing: self.wait_if_ongoing,
2903            };
2904            Some(query_params)
2905        };
2906        let body = self.body;
2907        let response = self
2908            .transport
2909            .send(method, &path, headers, query_string.as_ref(), body, timeout)
2910            .await?;
2911        Ok(response)
2912    }
2913}
2914#[derive(Debug, Clone, PartialEq)]
2915#[doc = "API parts for the Indices Flush Synced API"]
2916pub enum IndicesFlushSyncedParts<'b> {
2917    #[doc = "No parts"]
2918    None,
2919    #[doc = "Index"]
2920    Index(&'b [&'b str]),
2921}
2922impl<'b> IndicesFlushSyncedParts<'b> {
2923    #[doc = "Builds a relative URL path to the Indices Flush Synced API"]
2924    pub fn url(self) -> Cow<'static, str> {
2925        match self {
2926            IndicesFlushSyncedParts::None => "/_flush/synced".into(),
2927            IndicesFlushSyncedParts::Index(ref index) => {
2928                let index_str = index.join(",");
2929                let encoded_index: Cow<str> =
2930                    percent_encode(index_str.as_bytes(), PARTS_ENCODED).into();
2931                let mut p = String::with_capacity(15usize + encoded_index.len());
2932                p.push_str("/");
2933                p.push_str(encoded_index.as_ref());
2934                p.push_str("/_flush/synced");
2935                p.into()
2936            }
2937        }
2938    }
2939}
2940#[doc = "Builder for the [Indices Flush Synced API](https://opensearch.org/docs/)\n\nPerforms a synced flush operation on one or more indices. Synced flush is deprecated and will be removed in 8.0. Use flush instead"]
2941#[derive(Clone, Debug)]
2942pub struct IndicesFlushSynced<'a, 'b, B> {
2943    transport: &'a Transport,
2944    parts: IndicesFlushSyncedParts<'b>,
2945    allow_no_indices: Option<bool>,
2946    body: Option<B>,
2947    error_trace: Option<bool>,
2948    expand_wildcards: Option<&'b [ExpandWildcards]>,
2949    filter_path: Option<&'b [&'b str]>,
2950    headers: HeaderMap,
2951    human: Option<bool>,
2952    ignore_unavailable: Option<bool>,
2953    pretty: Option<bool>,
2954    request_timeout: Option<Duration>,
2955    source: Option<&'b str>,
2956}
2957impl<'a, 'b, B> IndicesFlushSynced<'a, 'b, B>
2958where
2959    B: Body,
2960{
2961    #[doc = "Creates a new instance of [IndicesFlushSynced] with the specified API parts"]
2962    pub fn new(transport: &'a Transport, parts: IndicesFlushSyncedParts<'b>) -> Self {
2963        let headers = HeaderMap::new();
2964        IndicesFlushSynced {
2965            transport,
2966            parts,
2967            headers,
2968            allow_no_indices: None,
2969            body: None,
2970            error_trace: None,
2971            expand_wildcards: None,
2972            filter_path: None,
2973            human: None,
2974            ignore_unavailable: None,
2975            pretty: None,
2976            request_timeout: None,
2977            source: None,
2978        }
2979    }
2980    #[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)"]
2981    pub fn allow_no_indices(mut self, allow_no_indices: bool) -> Self {
2982        self.allow_no_indices = Some(allow_no_indices);
2983        self
2984    }
2985    #[doc = "The body for the API call"]
2986    pub fn body<T>(self, body: T) -> IndicesFlushSynced<'a, 'b, JsonBody<T>>
2987    where
2988        T: Serialize,
2989    {
2990        IndicesFlushSynced {
2991            transport: self.transport,
2992            parts: self.parts,
2993            body: Some(body.into()),
2994            allow_no_indices: self.allow_no_indices,
2995            error_trace: self.error_trace,
2996            expand_wildcards: self.expand_wildcards,
2997            filter_path: self.filter_path,
2998            headers: self.headers,
2999            human: self.human,
3000            ignore_unavailable: self.ignore_unavailable,
3001            pretty: self.pretty,
3002            request_timeout: self.request_timeout,
3003            source: self.source,
3004        }
3005    }
3006    #[doc = "Include the stack trace of returned errors."]
3007    pub fn error_trace(mut self, error_trace: bool) -> Self {
3008        self.error_trace = Some(error_trace);
3009        self
3010    }
3011    #[doc = "Whether to expand wildcard expression to concrete indices that are open, closed or both."]
3012    pub fn expand_wildcards(mut self, expand_wildcards: &'b [ExpandWildcards]) -> Self {
3013        self.expand_wildcards = Some(expand_wildcards);
3014        self
3015    }
3016    #[doc = "A comma-separated list of filters used to reduce the response."]
3017    pub fn filter_path(mut self, filter_path: &'b [&'b str]) -> Self {
3018        self.filter_path = Some(filter_path);
3019        self
3020    }
3021    #[doc = "Adds a HTTP header"]
3022    pub fn header(mut self, key: HeaderName, value: HeaderValue) -> Self {
3023        self.headers.insert(key, value);
3024        self
3025    }
3026    #[doc = "Return human readable values for statistics."]
3027    pub fn human(mut self, human: bool) -> Self {
3028        self.human = Some(human);
3029        self
3030    }
3031    #[doc = "Whether specified concrete indices should be ignored when unavailable (missing or closed)"]
3032    pub fn ignore_unavailable(mut self, ignore_unavailable: bool) -> Self {
3033        self.ignore_unavailable = Some(ignore_unavailable);
3034        self
3035    }
3036    #[doc = "Pretty format the returned JSON response."]
3037    pub fn pretty(mut self, pretty: bool) -> Self {
3038        self.pretty = Some(pretty);
3039        self
3040    }
3041    #[doc = "Sets a request timeout for this API call.\n\nThe timeout is applied from when the request starts connecting until the response body has finished."]
3042    pub fn request_timeout(mut self, timeout: Duration) -> Self {
3043        self.request_timeout = Some(timeout);
3044        self
3045    }
3046    #[doc = "The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests."]
3047    pub fn source(mut self, source: &'b str) -> Self {
3048        self.source = Some(source);
3049        self
3050    }
3051    #[doc = "Creates an asynchronous call to the Indices Flush Synced API that can be awaited"]
3052    pub async fn send(self) -> Result<Response, Error> {
3053        let path = self.parts.url();
3054        let method = match self.body {
3055            Some(_) => Method::Post,
3056            None => Method::Get,
3057        };
3058        let headers = self.headers;
3059        let timeout = self.request_timeout;
3060        let query_string = {
3061            #[serde_with::skip_serializing_none]
3062            #[derive(Serialize)]
3063            struct QueryParams<'b> {
3064                allow_no_indices: Option<bool>,
3065                error_trace: Option<bool>,
3066                #[serde(serialize_with = "crate::client::serialize_coll_qs")]
3067                expand_wildcards: Option<&'b [ExpandWildcards]>,
3068                #[serde(serialize_with = "crate::client::serialize_coll_qs")]
3069                filter_path: Option<&'b [&'b str]>,
3070                human: Option<bool>,
3071                ignore_unavailable: Option<bool>,
3072                pretty: Option<bool>,
3073                source: Option<&'b str>,
3074            }
3075            let query_params = QueryParams {
3076                allow_no_indices: self.allow_no_indices,
3077                error_trace: self.error_trace,
3078                expand_wildcards: self.expand_wildcards,
3079                filter_path: self.filter_path,
3080                human: self.human,
3081                ignore_unavailable: self.ignore_unavailable,
3082                pretty: self.pretty,
3083                source: self.source,
3084            };
3085            Some(query_params)
3086        };
3087        let body = self.body;
3088        let response = self
3089            .transport
3090            .send(method, &path, headers, query_string.as_ref(), body, timeout)
3091            .await?;
3092        Ok(response)
3093    }
3094}
3095#[derive(Debug, Clone, PartialEq)]
3096#[doc = "API parts for the Indices Forcemerge API"]
3097pub enum IndicesForcemergeParts<'b> {
3098    #[doc = "No parts"]
3099    None,
3100    #[doc = "Index"]
3101    Index(&'b [&'b str]),
3102}
3103impl<'b> IndicesForcemergeParts<'b> {
3104    #[doc = "Builds a relative URL path to the Indices Forcemerge API"]
3105    pub fn url(self) -> Cow<'static, str> {
3106        match self {
3107            IndicesForcemergeParts::None => "/_forcemerge".into(),
3108            IndicesForcemergeParts::Index(ref index) => {
3109                let index_str = index.join(",");
3110                let encoded_index: Cow<str> =
3111                    percent_encode(index_str.as_bytes(), PARTS_ENCODED).into();
3112                let mut p = String::with_capacity(13usize + encoded_index.len());
3113                p.push_str("/");
3114                p.push_str(encoded_index.as_ref());
3115                p.push_str("/_forcemerge");
3116                p.into()
3117            }
3118        }
3119    }
3120}
3121#[doc = "Builder for the [Indices Forcemerge API](https://opensearch.org/docs/)\n\nPerforms the force merge operation on one or more indices."]
3122#[derive(Clone, Debug)]
3123pub struct IndicesForcemerge<'a, 'b, B> {
3124    transport: &'a Transport,
3125    parts: IndicesForcemergeParts<'b>,
3126    allow_no_indices: Option<bool>,
3127    body: Option<B>,
3128    error_trace: Option<bool>,
3129    expand_wildcards: Option<&'b [ExpandWildcards]>,
3130    filter_path: Option<&'b [&'b str]>,
3131    flush: Option<bool>,
3132    headers: HeaderMap,
3133    human: Option<bool>,
3134    ignore_unavailable: Option<bool>,
3135    max_num_segments: Option<i64>,
3136    only_expunge_deletes: Option<bool>,
3137    pretty: Option<bool>,
3138    request_timeout: Option<Duration>,
3139    source: Option<&'b str>,
3140}
3141impl<'a, 'b, B> IndicesForcemerge<'a, 'b, B>
3142where
3143    B: Body,
3144{
3145    #[doc = "Creates a new instance of [IndicesForcemerge] with the specified API parts"]
3146    pub fn new(transport: &'a Transport, parts: IndicesForcemergeParts<'b>) -> Self {
3147        let headers = HeaderMap::new();
3148        IndicesForcemerge {
3149            transport,
3150            parts,
3151            headers,
3152            allow_no_indices: None,
3153            body: None,
3154            error_trace: None,
3155            expand_wildcards: None,
3156            filter_path: None,
3157            flush: None,
3158            human: None,
3159            ignore_unavailable: None,
3160            max_num_segments: None,
3161            only_expunge_deletes: None,
3162            pretty: None,
3163            request_timeout: None,
3164            source: None,
3165        }
3166    }
3167    #[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)"]
3168    pub fn allow_no_indices(mut self, allow_no_indices: bool) -> Self {
3169        self.allow_no_indices = Some(allow_no_indices);
3170        self
3171    }
3172    #[doc = "The body for the API call"]
3173    pub fn body<T>(self, body: T) -> IndicesForcemerge<'a, 'b, JsonBody<T>>
3174    where
3175        T: Serialize,
3176    {
3177        IndicesForcemerge {
3178            transport: self.transport,
3179            parts: self.parts,
3180            body: Some(body.into()),
3181            allow_no_indices: self.allow_no_indices,
3182            error_trace: self.error_trace,
3183            expand_wildcards: self.expand_wildcards,
3184            filter_path: self.filter_path,
3185            flush: self.flush,
3186            headers: self.headers,
3187            human: self.human,
3188            ignore_unavailable: self.ignore_unavailable,
3189            max_num_segments: self.max_num_segments,
3190            only_expunge_deletes: self.only_expunge_deletes,
3191            pretty: self.pretty,
3192            request_timeout: self.request_timeout,
3193            source: self.source,
3194        }
3195    }
3196    #[doc = "Include the stack trace of returned errors."]
3197    pub fn error_trace(mut self, error_trace: bool) -> Self {
3198        self.error_trace = Some(error_trace);
3199        self
3200    }
3201    #[doc = "Whether to expand wildcard expression to concrete indices that are open, closed or both."]
3202    pub fn expand_wildcards(mut self, expand_wildcards: &'b [ExpandWildcards]) -> Self {
3203        self.expand_wildcards = Some(expand_wildcards);
3204        self
3205    }
3206    #[doc = "A comma-separated list of filters used to reduce the response."]
3207    pub fn filter_path(mut self, filter_path: &'b [&'b str]) -> Self {
3208        self.filter_path = Some(filter_path);
3209        self
3210    }
3211    #[doc = "Specify whether the index should be flushed after performing the operation (default: true)"]
3212    pub fn flush(mut self, flush: bool) -> Self {
3213        self.flush = Some(flush);
3214        self
3215    }
3216    #[doc = "Adds a HTTP header"]
3217    pub fn header(mut self, key: HeaderName, value: HeaderValue) -> Self {
3218        self.headers.insert(key, value);
3219        self
3220    }
3221    #[doc = "Return human readable values for statistics."]
3222    pub fn human(mut self, human: bool) -> Self {
3223        self.human = Some(human);
3224        self
3225    }
3226    #[doc = "Whether specified concrete indices should be ignored when unavailable (missing or closed)"]
3227    pub fn ignore_unavailable(mut self, ignore_unavailable: bool) -> Self {
3228        self.ignore_unavailable = Some(ignore_unavailable);
3229        self
3230    }
3231    #[doc = "The number of segments the index should be merged into (default: dynamic)"]
3232    pub fn max_num_segments(mut self, max_num_segments: i64) -> Self {
3233        self.max_num_segments = Some(max_num_segments);
3234        self
3235    }
3236    #[doc = "Specify whether the operation should only expunge deleted documents"]
3237    pub fn only_expunge_deletes(mut self, only_expunge_deletes: bool) -> Self {
3238        self.only_expunge_deletes = Some(only_expunge_deletes);
3239        self
3240    }
3241    #[doc = "Pretty format the returned JSON response."]
3242    pub fn pretty(mut self, pretty: bool) -> Self {
3243        self.pretty = Some(pretty);
3244        self
3245    }
3246    #[doc = "Sets a request timeout for this API call.\n\nThe timeout is applied from when the request starts connecting until the response body has finished."]
3247    pub fn request_timeout(mut self, timeout: Duration) -> Self {
3248        self.request_timeout = Some(timeout);
3249        self
3250    }
3251    #[doc = "The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests."]
3252    pub fn source(mut self, source: &'b str) -> Self {
3253        self.source = Some(source);
3254        self
3255    }
3256    #[doc = "Creates an asynchronous call to the Indices Forcemerge API that can be awaited"]
3257    pub async fn send(self) -> Result<Response, Error> {
3258        let path = self.parts.url();
3259        let method = Method::Post;
3260        let headers = self.headers;
3261        let timeout = self.request_timeout;
3262        let query_string = {
3263            #[serde_with::skip_serializing_none]
3264            #[derive(Serialize)]
3265            struct QueryParams<'b> {
3266                allow_no_indices: Option<bool>,
3267                error_trace: Option<bool>,
3268                #[serde(serialize_with = "crate::client::serialize_coll_qs")]
3269                expand_wildcards: Option<&'b [ExpandWildcards]>,
3270                #[serde(serialize_with = "crate::client::serialize_coll_qs")]
3271                filter_path: Option<&'b [&'b str]>,
3272                flush: Option<bool>,
3273                human: Option<bool>,
3274                ignore_unavailable: Option<bool>,
3275                max_num_segments: Option<i64>,
3276                only_expunge_deletes: Option<bool>,
3277                pretty: Option<bool>,
3278                source: Option<&'b str>,
3279            }
3280            let query_params = QueryParams {
3281                allow_no_indices: self.allow_no_indices,
3282                error_trace: self.error_trace,
3283                expand_wildcards: self.expand_wildcards,
3284                filter_path: self.filter_path,
3285                flush: self.flush,
3286                human: self.human,
3287                ignore_unavailable: self.ignore_unavailable,
3288                max_num_segments: self.max_num_segments,
3289                only_expunge_deletes: self.only_expunge_deletes,
3290                pretty: self.pretty,
3291                source: self.source,
3292            };
3293            Some(query_params)
3294        };
3295        let body = self.body;
3296        let response = self
3297            .transport
3298            .send(method, &path, headers, query_string.as_ref(), body, timeout)
3299            .await?;
3300        Ok(response)
3301    }
3302}
3303#[derive(Debug, Clone, PartialEq)]
3304#[doc = "API parts for the Indices Get API"]
3305pub enum IndicesGetParts<'b> {
3306    #[doc = "Index"]
3307    Index(&'b [&'b str]),
3308}
3309impl<'b> IndicesGetParts<'b> {
3310    #[doc = "Builds a relative URL path to the Indices Get API"]
3311    pub fn url(self) -> Cow<'static, str> {
3312        match self {
3313            IndicesGetParts::Index(ref index) => {
3314                let index_str = index.join(",");
3315                let encoded_index: Cow<str> =
3316                    percent_encode(index_str.as_bytes(), PARTS_ENCODED).into();
3317                let mut p = String::with_capacity(1usize + encoded_index.len());
3318                p.push_str("/");
3319                p.push_str(encoded_index.as_ref());
3320                p.into()
3321            }
3322        }
3323    }
3324}
3325#[doc = "Builder for the [Indices Get API](https://opensearch.org/docs/)\n\nReturns information about one or more indices."]
3326#[derive(Clone, Debug)]
3327pub struct IndicesGet<'a, 'b> {
3328    transport: &'a Transport,
3329    parts: IndicesGetParts<'b>,
3330    allow_no_indices: Option<bool>,
3331    error_trace: Option<bool>,
3332    expand_wildcards: Option<&'b [ExpandWildcards]>,
3333    filter_path: Option<&'b [&'b str]>,
3334    flat_settings: Option<bool>,
3335    headers: HeaderMap,
3336    human: Option<bool>,
3337    ignore_unavailable: Option<bool>,
3338    include_defaults: Option<bool>,
3339    include_type_name: Option<bool>,
3340    local: Option<bool>,
3341    master_timeout: Option<&'b str>,
3342    pretty: Option<bool>,
3343    request_timeout: Option<Duration>,
3344    source: Option<&'b str>,
3345}
3346impl<'a, 'b> IndicesGet<'a, 'b> {
3347    #[doc = "Creates a new instance of [IndicesGet] with the specified API parts"]
3348    pub fn new(transport: &'a Transport, parts: IndicesGetParts<'b>) -> Self {
3349        let headers = HeaderMap::new();
3350        IndicesGet {
3351            transport,
3352            parts,
3353            headers,
3354            allow_no_indices: None,
3355            error_trace: None,
3356            expand_wildcards: None,
3357            filter_path: None,
3358            flat_settings: None,
3359            human: None,
3360            ignore_unavailable: None,
3361            include_defaults: None,
3362            include_type_name: None,
3363            local: None,
3364            master_timeout: None,
3365            pretty: None,
3366            request_timeout: None,
3367            source: None,
3368        }
3369    }
3370    #[doc = "Ignore if a wildcard expression resolves to no concrete indices (default: false)"]
3371    pub fn allow_no_indices(mut self, allow_no_indices: bool) -> Self {
3372        self.allow_no_indices = Some(allow_no_indices);
3373        self
3374    }
3375    #[doc = "Include the stack trace of returned errors."]
3376    pub fn error_trace(mut self, error_trace: bool) -> Self {
3377        self.error_trace = Some(error_trace);
3378        self
3379    }
3380    #[doc = "Whether wildcard expressions should get expanded to open or closed indices (default: open)"]
3381    pub fn expand_wildcards(mut self, expand_wildcards: &'b [ExpandWildcards]) -> Self {
3382        self.expand_wildcards = Some(expand_wildcards);
3383        self
3384    }
3385    #[doc = "A comma-separated list of filters used to reduce the response."]
3386    pub fn filter_path(mut self, filter_path: &'b [&'b str]) -> Self {
3387        self.filter_path = Some(filter_path);
3388        self
3389    }
3390    #[doc = "Return settings in flat format (default: false)"]
3391    pub fn flat_settings(mut self, flat_settings: bool) -> Self {
3392        self.flat_settings = Some(flat_settings);
3393        self
3394    }
3395    #[doc = "Adds a HTTP header"]
3396    pub fn header(mut self, key: HeaderName, value: HeaderValue) -> Self {
3397        self.headers.insert(key, value);
3398        self
3399    }
3400    #[doc = "Return human readable values for statistics."]
3401    pub fn human(mut self, human: bool) -> Self {
3402        self.human = Some(human);
3403        self
3404    }
3405    #[doc = "Ignore unavailable indexes (default: false)"]
3406    pub fn ignore_unavailable(mut self, ignore_unavailable: bool) -> Self {
3407        self.ignore_unavailable = Some(ignore_unavailable);
3408        self
3409    }
3410    #[doc = "Whether to return all default setting for each of the indices."]
3411    pub fn include_defaults(mut self, include_defaults: bool) -> Self {
3412        self.include_defaults = Some(include_defaults);
3413        self
3414    }
3415    #[doc = "Whether to add the type name to the response (default: false)"]
3416    pub fn include_type_name(mut self, include_type_name: bool) -> Self {
3417        self.include_type_name = Some(include_type_name);
3418        self
3419    }
3420    #[doc = "Return local information, do not retrieve the state from master node (default: false)"]
3421    pub fn local(mut self, local: bool) -> Self {
3422        self.local = Some(local);
3423        self
3424    }
3425    #[doc = "Specify timeout for connection to master"]
3426    pub fn master_timeout(mut self, master_timeout: &'b str) -> Self {
3427        self.master_timeout = Some(master_timeout);
3428        self
3429    }
3430    #[doc = "Pretty format the returned JSON response."]
3431    pub fn pretty(mut self, pretty: bool) -> Self {
3432        self.pretty = Some(pretty);
3433        self
3434    }
3435    #[doc = "Sets a request timeout for this API call.\n\nThe timeout is applied from when the request starts connecting until the response body has finished."]
3436    pub fn request_timeout(mut self, timeout: Duration) -> Self {
3437        self.request_timeout = Some(timeout);
3438        self
3439    }
3440    #[doc = "The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests."]
3441    pub fn source(mut self, source: &'b str) -> Self {
3442        self.source = Some(source);
3443        self
3444    }
3445    #[doc = "Creates an asynchronous call to the Indices Get API that can be awaited"]
3446    pub async fn send(self) -> Result<Response, Error> {
3447        let path = self.parts.url();
3448        let method = Method::Get;
3449        let headers = self.headers;
3450        let timeout = self.request_timeout;
3451        let query_string = {
3452            #[serde_with::skip_serializing_none]
3453            #[derive(Serialize)]
3454            struct QueryParams<'b> {
3455                allow_no_indices: Option<bool>,
3456                error_trace: Option<bool>,
3457                #[serde(serialize_with = "crate::client::serialize_coll_qs")]
3458                expand_wildcards: Option<&'b [ExpandWildcards]>,
3459                #[serde(serialize_with = "crate::client::serialize_coll_qs")]
3460                filter_path: Option<&'b [&'b str]>,
3461                flat_settings: Option<bool>,
3462                human: Option<bool>,
3463                ignore_unavailable: Option<bool>,
3464                include_defaults: Option<bool>,
3465                include_type_name: Option<bool>,
3466                local: Option<bool>,
3467                master_timeout: Option<&'b str>,
3468                pretty: Option<bool>,
3469                source: Option<&'b str>,
3470            }
3471            let query_params = QueryParams {
3472                allow_no_indices: self.allow_no_indices,
3473                error_trace: self.error_trace,
3474                expand_wildcards: self.expand_wildcards,
3475                filter_path: self.filter_path,
3476                flat_settings: self.flat_settings,
3477                human: self.human,
3478                ignore_unavailable: self.ignore_unavailable,
3479                include_defaults: self.include_defaults,
3480                include_type_name: self.include_type_name,
3481                local: self.local,
3482                master_timeout: self.master_timeout,
3483                pretty: self.pretty,
3484                source: self.source,
3485            };
3486            Some(query_params)
3487        };
3488        let body = Option::<()>::None;
3489        let response = self
3490            .transport
3491            .send(method, &path, headers, query_string.as_ref(), body, timeout)
3492            .await?;
3493        Ok(response)
3494    }
3495}
3496#[derive(Debug, Clone, PartialEq)]
3497#[doc = "API parts for the Indices Get Alias API"]
3498pub enum IndicesGetAliasParts<'b> {
3499    #[doc = "No parts"]
3500    None,
3501    #[doc = "Name"]
3502    Name(&'b [&'b str]),
3503    #[doc = "Index and Name"]
3504    IndexName(&'b [&'b str], &'b [&'b str]),
3505    #[doc = "Index"]
3506    Index(&'b [&'b str]),
3507}
3508impl<'b> IndicesGetAliasParts<'b> {
3509    #[doc = "Builds a relative URL path to the Indices Get Alias API"]
3510    pub fn url(self) -> Cow<'static, str> {
3511        match self {
3512            IndicesGetAliasParts::None => "/_alias".into(),
3513            IndicesGetAliasParts::Name(ref name) => {
3514                let name_str = name.join(",");
3515                let encoded_name: Cow<str> =
3516                    percent_encode(name_str.as_bytes(), PARTS_ENCODED).into();
3517                let mut p = String::with_capacity(8usize + encoded_name.len());
3518                p.push_str("/_alias/");
3519                p.push_str(encoded_name.as_ref());
3520                p.into()
3521            }
3522            IndicesGetAliasParts::IndexName(ref index, ref name) => {
3523                let index_str = index.join(",");
3524                let name_str = name.join(",");
3525                let encoded_index: Cow<str> =
3526                    percent_encode(index_str.as_bytes(), PARTS_ENCODED).into();
3527                let encoded_name: Cow<str> =
3528                    percent_encode(name_str.as_bytes(), PARTS_ENCODED).into();
3529                let mut p =
3530                    String::with_capacity(9usize + encoded_index.len() + encoded_name.len());
3531                p.push_str("/");
3532                p.push_str(encoded_index.as_ref());
3533                p.push_str("/_alias/");
3534                p.push_str(encoded_name.as_ref());
3535                p.into()
3536            }
3537            IndicesGetAliasParts::Index(ref index) => {
3538                let index_str = index.join(",");
3539                let encoded_index: Cow<str> =
3540                    percent_encode(index_str.as_bytes(), PARTS_ENCODED).into();
3541                let mut p = String::with_capacity(8usize + encoded_index.len());
3542                p.push_str("/");
3543                p.push_str(encoded_index.as_ref());
3544                p.push_str("/_alias");
3545                p.into()
3546            }
3547        }
3548    }
3549}
3550#[doc = "Builder for the [Indices Get Alias API](https://opensearch.org/docs/)\n\nReturns an alias."]
3551#[derive(Clone, Debug)]
3552pub struct IndicesGetAlias<'a, 'b> {
3553    transport: &'a Transport,
3554    parts: IndicesGetAliasParts<'b>,
3555    allow_no_indices: Option<bool>,
3556    error_trace: Option<bool>,
3557    expand_wildcards: Option<&'b [ExpandWildcards]>,
3558    filter_path: Option<&'b [&'b str]>,
3559    headers: HeaderMap,
3560    human: Option<bool>,
3561    ignore_unavailable: Option<bool>,
3562    local: Option<bool>,
3563    pretty: Option<bool>,
3564    request_timeout: Option<Duration>,
3565    source: Option<&'b str>,
3566}
3567impl<'a, 'b> IndicesGetAlias<'a, 'b> {
3568    #[doc = "Creates a new instance of [IndicesGetAlias] with the specified API parts"]
3569    pub fn new(transport: &'a Transport, parts: IndicesGetAliasParts<'b>) -> Self {
3570        let headers = HeaderMap::new();
3571        IndicesGetAlias {
3572            transport,
3573            parts,
3574            headers,
3575            allow_no_indices: None,
3576            error_trace: None,
3577            expand_wildcards: None,
3578            filter_path: None,
3579            human: None,
3580            ignore_unavailable: None,
3581            local: None,
3582            pretty: None,
3583            request_timeout: None,
3584            source: None,
3585        }
3586    }
3587    #[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)"]
3588    pub fn allow_no_indices(mut self, allow_no_indices: bool) -> Self {
3589        self.allow_no_indices = Some(allow_no_indices);
3590        self
3591    }
3592    #[doc = "Include the stack trace of returned errors."]
3593    pub fn error_trace(mut self, error_trace: bool) -> Self {
3594        self.error_trace = Some(error_trace);
3595        self
3596    }
3597    #[doc = "Whether to expand wildcard expression to concrete indices that are open, closed or both."]
3598    pub fn expand_wildcards(mut self, expand_wildcards: &'b [ExpandWildcards]) -> Self {
3599        self.expand_wildcards = Some(expand_wildcards);
3600        self
3601    }
3602    #[doc = "A comma-separated list of filters used to reduce the response."]
3603    pub fn filter_path(mut self, filter_path: &'b [&'b str]) -> Self {
3604        self.filter_path = Some(filter_path);
3605        self
3606    }
3607    #[doc = "Adds a HTTP header"]
3608    pub fn header(mut self, key: HeaderName, value: HeaderValue) -> Self {
3609        self.headers.insert(key, value);
3610        self
3611    }
3612    #[doc = "Return human readable values for statistics."]
3613    pub fn human(mut self, human: bool) -> Self {
3614        self.human = Some(human);
3615        self
3616    }
3617    #[doc = "Whether specified concrete indices should be ignored when unavailable (missing or closed)"]
3618    pub fn ignore_unavailable(mut self, ignore_unavailable: bool) -> Self {
3619        self.ignore_unavailable = Some(ignore_unavailable);
3620        self
3621    }
3622    #[doc = "Return local information, do not retrieve the state from master node (default: false)"]
3623    pub fn local(mut self, local: bool) -> Self {
3624        self.local = Some(local);
3625        self
3626    }
3627    #[doc = "Pretty format the returned JSON response."]
3628    pub fn pretty(mut self, pretty: bool) -> Self {
3629        self.pretty = Some(pretty);
3630        self
3631    }
3632    #[doc = "Sets a request timeout for this API call.\n\nThe timeout is applied from when the request starts connecting until the response body has finished."]
3633    pub fn request_timeout(mut self, timeout: Duration) -> Self {
3634        self.request_timeout = Some(timeout);
3635        self
3636    }
3637    #[doc = "The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests."]
3638    pub fn source(mut self, source: &'b str) -> Self {
3639        self.source = Some(source);
3640        self
3641    }
3642    #[doc = "Creates an asynchronous call to the Indices Get Alias API that can be awaited"]
3643    pub async fn send(self) -> Result<Response, Error> {
3644        let path = self.parts.url();
3645        let method = Method::Get;
3646        let headers = self.headers;
3647        let timeout = self.request_timeout;
3648        let query_string = {
3649            #[serde_with::skip_serializing_none]
3650            #[derive(Serialize)]
3651            struct QueryParams<'b> {
3652                allow_no_indices: Option<bool>,
3653                error_trace: Option<bool>,
3654                #[serde(serialize_with = "crate::client::serialize_coll_qs")]
3655                expand_wildcards: Option<&'b [ExpandWildcards]>,
3656                #[serde(serialize_with = "crate::client::serialize_coll_qs")]
3657                filter_path: Option<&'b [&'b str]>,
3658                human: Option<bool>,
3659                ignore_unavailable: Option<bool>,
3660                local: Option<bool>,
3661                pretty: Option<bool>,
3662                source: Option<&'b str>,
3663            }
3664            let query_params = QueryParams {
3665                allow_no_indices: self.allow_no_indices,
3666                error_trace: self.error_trace,
3667                expand_wildcards: self.expand_wildcards,
3668                filter_path: self.filter_path,
3669                human: self.human,
3670                ignore_unavailable: self.ignore_unavailable,
3671                local: self.local,
3672                pretty: self.pretty,
3673                source: self.source,
3674            };
3675            Some(query_params)
3676        };
3677        let body = Option::<()>::None;
3678        let response = self
3679            .transport
3680            .send(method, &path, headers, query_string.as_ref(), body, timeout)
3681            .await?;
3682        Ok(response)
3683    }
3684}
3685#[derive(Debug, Clone, PartialEq)]
3686#[doc = "API parts for the Indices Get Field Mapping API"]
3687pub enum IndicesGetFieldMappingParts<'b> {
3688    #[doc = "Fields"]
3689    Fields(&'b [&'b str]),
3690    #[doc = "Index and Fields"]
3691    IndexFields(&'b [&'b str], &'b [&'b str]),
3692    #[doc = "Type and Fields"]
3693    TypeFields(&'b [&'b str], &'b [&'b str]),
3694    #[doc = "Index, Type and Fields"]
3695    IndexTypeFields(&'b [&'b str], &'b [&'b str], &'b [&'b str]),
3696}
3697impl<'b> IndicesGetFieldMappingParts<'b> {
3698    #[doc = "Builds a relative URL path to the Indices Get Field Mapping API"]
3699    pub fn url(self) -> Cow<'static, str> {
3700        match self {
3701            IndicesGetFieldMappingParts::Fields(ref fields) => {
3702                let fields_str = fields.join(",");
3703                let encoded_fields: Cow<str> =
3704                    percent_encode(fields_str.as_bytes(), PARTS_ENCODED).into();
3705                let mut p = String::with_capacity(16usize + encoded_fields.len());
3706                p.push_str("/_mapping/field/");
3707                p.push_str(encoded_fields.as_ref());
3708                p.into()
3709            }
3710            IndicesGetFieldMappingParts::IndexFields(ref index, ref fields) => {
3711                let index_str = index.join(",");
3712                let fields_str = fields.join(",");
3713                let encoded_index: Cow<str> =
3714                    percent_encode(index_str.as_bytes(), PARTS_ENCODED).into();
3715                let encoded_fields: Cow<str> =
3716                    percent_encode(fields_str.as_bytes(), PARTS_ENCODED).into();
3717                let mut p =
3718                    String::with_capacity(17usize + encoded_index.len() + encoded_fields.len());
3719                p.push_str("/");
3720                p.push_str(encoded_index.as_ref());
3721                p.push_str("/_mapping/field/");
3722                p.push_str(encoded_fields.as_ref());
3723                p.into()
3724            }
3725            IndicesGetFieldMappingParts::TypeFields(ref ty, ref fields) => {
3726                let ty_str = ty.join(",");
3727                let fields_str = fields.join(",");
3728                let encoded_ty: Cow<str> = percent_encode(ty_str.as_bytes(), PARTS_ENCODED).into();
3729                let encoded_fields: Cow<str> =
3730                    percent_encode(fields_str.as_bytes(), PARTS_ENCODED).into();
3731                let mut p =
3732                    String::with_capacity(17usize + encoded_ty.len() + encoded_fields.len());
3733                p.push_str("/_mapping/");
3734                p.push_str(encoded_ty.as_ref());
3735                p.push_str("/field/");
3736                p.push_str(encoded_fields.as_ref());
3737                p.into()
3738            }
3739            IndicesGetFieldMappingParts::IndexTypeFields(ref index, ref ty, ref fields) => {
3740                let index_str = index.join(",");
3741                let ty_str = ty.join(",");
3742                let fields_str = fields.join(",");
3743                let encoded_index: Cow<str> =
3744                    percent_encode(index_str.as_bytes(), PARTS_ENCODED).into();
3745                let encoded_ty: Cow<str> = percent_encode(ty_str.as_bytes(), PARTS_ENCODED).into();
3746                let encoded_fields: Cow<str> =
3747                    percent_encode(fields_str.as_bytes(), PARTS_ENCODED).into();
3748                let mut p = String::with_capacity(
3749                    18usize + encoded_index.len() + encoded_ty.len() + encoded_fields.len(),
3750                );
3751                p.push_str("/");
3752                p.push_str(encoded_index.as_ref());
3753                p.push_str("/_mapping/");
3754                p.push_str(encoded_ty.as_ref());
3755                p.push_str("/field/");
3756                p.push_str(encoded_fields.as_ref());
3757                p.into()
3758            }
3759        }
3760    }
3761}
3762#[doc = "Builder for the [Indices Get Field Mapping API](https://opensearch.org/docs/)\n\nReturns mapping for one or more fields."]
3763#[derive(Clone, Debug)]
3764pub struct IndicesGetFieldMapping<'a, 'b> {
3765    transport: &'a Transport,
3766    parts: IndicesGetFieldMappingParts<'b>,
3767    allow_no_indices: Option<bool>,
3768    error_trace: Option<bool>,
3769    expand_wildcards: Option<&'b [ExpandWildcards]>,
3770    filter_path: Option<&'b [&'b str]>,
3771    headers: HeaderMap,
3772    human: Option<bool>,
3773    ignore_unavailable: Option<bool>,
3774    include_defaults: Option<bool>,
3775    include_type_name: Option<bool>,
3776    local: Option<bool>,
3777    pretty: Option<bool>,
3778    request_timeout: Option<Duration>,
3779    source: Option<&'b str>,
3780}
3781impl<'a, 'b> IndicesGetFieldMapping<'a, 'b> {
3782    #[doc = "Creates a new instance of [IndicesGetFieldMapping] with the specified API parts"]
3783    pub fn new(transport: &'a Transport, parts: IndicesGetFieldMappingParts<'b>) -> Self {
3784        let headers = HeaderMap::new();
3785        IndicesGetFieldMapping {
3786            transport,
3787            parts,
3788            headers,
3789            allow_no_indices: None,
3790            error_trace: None,
3791            expand_wildcards: None,
3792            filter_path: None,
3793            human: None,
3794            ignore_unavailable: None,
3795            include_defaults: None,
3796            include_type_name: None,
3797            local: None,
3798            pretty: None,
3799            request_timeout: None,
3800            source: None,
3801        }
3802    }
3803    #[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)"]
3804    pub fn allow_no_indices(mut self, allow_no_indices: bool) -> Self {
3805        self.allow_no_indices = Some(allow_no_indices);
3806        self
3807    }
3808    #[doc = "Include the stack trace of returned errors."]
3809    pub fn error_trace(mut self, error_trace: bool) -> Self {
3810        self.error_trace = Some(error_trace);
3811        self
3812    }
3813    #[doc = "Whether to expand wildcard expression to concrete indices that are open, closed or both."]
3814    pub fn expand_wildcards(mut self, expand_wildcards: &'b [ExpandWildcards]) -> Self {
3815        self.expand_wildcards = Some(expand_wildcards);
3816        self
3817    }
3818    #[doc = "A comma-separated list of filters used to reduce the response."]
3819    pub fn filter_path(mut self, filter_path: &'b [&'b str]) -> Self {
3820        self.filter_path = Some(filter_path);
3821        self
3822    }
3823    #[doc = "Adds a HTTP header"]
3824    pub fn header(mut self, key: HeaderName, value: HeaderValue) -> Self {
3825        self.headers.insert(key, value);
3826        self
3827    }
3828    #[doc = "Return human readable values for statistics."]
3829    pub fn human(mut self, human: bool) -> Self {
3830        self.human = Some(human);
3831        self
3832    }
3833    #[doc = "Whether specified concrete indices should be ignored when unavailable (missing or closed)"]
3834    pub fn ignore_unavailable(mut self, ignore_unavailable: bool) -> Self {
3835        self.ignore_unavailable = Some(ignore_unavailable);
3836        self
3837    }
3838    #[doc = "Whether the default mapping values should be returned as well"]
3839    pub fn include_defaults(mut self, include_defaults: bool) -> Self {
3840        self.include_defaults = Some(include_defaults);
3841        self
3842    }
3843    #[doc = "Whether a type should be returned in the body of the mappings."]
3844    pub fn include_type_name(mut self, include_type_name: bool) -> Self {
3845        self.include_type_name = Some(include_type_name);
3846        self
3847    }
3848    #[doc = "Return local information, do not retrieve the state from master node (default: false)"]
3849    pub fn local(mut self, local: bool) -> Self {
3850        self.local = Some(local);
3851        self
3852    }
3853    #[doc = "Pretty format the returned JSON response."]
3854    pub fn pretty(mut self, pretty: bool) -> Self {
3855        self.pretty = Some(pretty);
3856        self
3857    }
3858    #[doc = "Sets a request timeout for this API call.\n\nThe timeout is applied from when the request starts connecting until the response body has finished."]
3859    pub fn request_timeout(mut self, timeout: Duration) -> Self {
3860        self.request_timeout = Some(timeout);
3861        self
3862    }
3863    #[doc = "The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests."]
3864    pub fn source(mut self, source: &'b str) -> Self {
3865        self.source = Some(source);
3866        self
3867    }
3868    #[doc = "Creates an asynchronous call to the Indices Get Field Mapping API that can be awaited"]
3869    pub async fn send(self) -> Result<Response, Error> {
3870        let path = self.parts.url();
3871        let method = Method::Get;
3872        let headers = self.headers;
3873        let timeout = self.request_timeout;
3874        let query_string = {
3875            #[serde_with::skip_serializing_none]
3876            #[derive(Serialize)]
3877            struct QueryParams<'b> {
3878                allow_no_indices: Option<bool>,
3879                error_trace: Option<bool>,
3880                #[serde(serialize_with = "crate::client::serialize_coll_qs")]
3881                expand_wildcards: Option<&'b [ExpandWildcards]>,
3882                #[serde(serialize_with = "crate::client::serialize_coll_qs")]
3883                filter_path: Option<&'b [&'b str]>,
3884                human: Option<bool>,
3885                ignore_unavailable: Option<bool>,
3886                include_defaults: Option<bool>,
3887                include_type_name: Option<bool>,
3888                local: Option<bool>,
3889                pretty: Option<bool>,
3890                source: Option<&'b str>,
3891            }
3892            let query_params = QueryParams {
3893                allow_no_indices: self.allow_no_indices,
3894                error_trace: self.error_trace,
3895                expand_wildcards: self.expand_wildcards,
3896                filter_path: self.filter_path,
3897                human: self.human,
3898                ignore_unavailable: self.ignore_unavailable,
3899                include_defaults: self.include_defaults,
3900                include_type_name: self.include_type_name,
3901                local: self.local,
3902                pretty: self.pretty,
3903                source: self.source,
3904            };
3905            Some(query_params)
3906        };
3907        let body = Option::<()>::None;
3908        let response = self
3909            .transport
3910            .send(method, &path, headers, query_string.as_ref(), body, timeout)
3911            .await?;
3912        Ok(response)
3913    }
3914}
3915#[derive(Debug, Clone, PartialEq)]
3916#[doc = "API parts for the Indices Get Index Template API"]
3917pub enum IndicesGetIndexTemplateParts<'b> {
3918    #[doc = "No parts"]
3919    None,
3920    #[doc = "Name"]
3921    Name(&'b [&'b str]),
3922}
3923impl<'b> IndicesGetIndexTemplateParts<'b> {
3924    #[doc = "Builds a relative URL path to the Indices Get Index Template API"]
3925    pub fn url(self) -> Cow<'static, str> {
3926        match self {
3927            IndicesGetIndexTemplateParts::None => "/_index_template".into(),
3928            IndicesGetIndexTemplateParts::Name(ref name) => {
3929                let name_str = name.join(",");
3930                let encoded_name: Cow<str> =
3931                    percent_encode(name_str.as_bytes(), PARTS_ENCODED).into();
3932                let mut p = String::with_capacity(17usize + encoded_name.len());
3933                p.push_str("/_index_template/");
3934                p.push_str(encoded_name.as_ref());
3935                p.into()
3936            }
3937        }
3938    }
3939}
3940#[doc = "Builder for the [Indices Get Index Template API](https://opensearch.org/docs/)\n\nReturns an index template."]
3941#[derive(Clone, Debug)]
3942pub struct IndicesGetIndexTemplate<'a, 'b> {
3943    transport: &'a Transport,
3944    parts: IndicesGetIndexTemplateParts<'b>,
3945    error_trace: Option<bool>,
3946    filter_path: Option<&'b [&'b str]>,
3947    flat_settings: Option<bool>,
3948    headers: HeaderMap,
3949    human: Option<bool>,
3950    local: Option<bool>,
3951    master_timeout: Option<&'b str>,
3952    pretty: Option<bool>,
3953    request_timeout: Option<Duration>,
3954    source: Option<&'b str>,
3955}
3956impl<'a, 'b> IndicesGetIndexTemplate<'a, 'b> {
3957    #[doc = "Creates a new instance of [IndicesGetIndexTemplate] with the specified API parts"]
3958    pub fn new(transport: &'a Transport, parts: IndicesGetIndexTemplateParts<'b>) -> Self {
3959        let headers = HeaderMap::new();
3960        IndicesGetIndexTemplate {
3961            transport,
3962            parts,
3963            headers,
3964            error_trace: None,
3965            filter_path: None,
3966            flat_settings: None,
3967            human: None,
3968            local: None,
3969            master_timeout: None,
3970            pretty: None,
3971            request_timeout: None,
3972            source: None,
3973        }
3974    }
3975    #[doc = "Include the stack trace of returned errors."]
3976    pub fn error_trace(mut self, error_trace: bool) -> Self {
3977        self.error_trace = Some(error_trace);
3978        self
3979    }
3980    #[doc = "A comma-separated list of filters used to reduce the response."]
3981    pub fn filter_path(mut self, filter_path: &'b [&'b str]) -> Self {
3982        self.filter_path = Some(filter_path);
3983        self
3984    }
3985    #[doc = "Return settings in flat format (default: false)"]
3986    pub fn flat_settings(mut self, flat_settings: bool) -> Self {
3987        self.flat_settings = Some(flat_settings);
3988        self
3989    }
3990    #[doc = "Adds a HTTP header"]
3991    pub fn header(mut self, key: HeaderName, value: HeaderValue) -> Self {
3992        self.headers.insert(key, value);
3993        self
3994    }
3995    #[doc = "Return human readable values for statistics."]
3996    pub fn human(mut self, human: bool) -> Self {
3997        self.human = Some(human);
3998        self
3999    }
4000    #[doc = "Return local information, do not retrieve the state from master node (default: false)"]
4001    pub fn local(mut self, local: bool) -> Self {
4002        self.local = Some(local);
4003        self
4004    }
4005    #[doc = "Explicit operation timeout for connection to master node"]
4006    pub fn master_timeout(mut self, master_timeout: &'b str) -> Self {
4007        self.master_timeout = Some(master_timeout);
4008        self
4009    }
4010    #[doc = "Pretty format the returned JSON response."]
4011    pub fn pretty(mut self, pretty: bool) -> Self {
4012        self.pretty = Some(pretty);
4013        self
4014    }
4015    #[doc = "Sets a request timeout for this API call.\n\nThe timeout is applied from when the request starts connecting until the response body has finished."]
4016    pub fn request_timeout(mut self, timeout: Duration) -> Self {
4017        self.request_timeout = Some(timeout);
4018        self
4019    }
4020    #[doc = "The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests."]
4021    pub fn source(mut self, source: &'b str) -> Self {
4022        self.source = Some(source);
4023        self
4024    }
4025    #[doc = "Creates an asynchronous call to the Indices Get Index Template API that can be awaited"]
4026    pub async fn send(self) -> Result<Response, Error> {
4027        let path = self.parts.url();
4028        let method = Method::Get;
4029        let headers = self.headers;
4030        let timeout = self.request_timeout;
4031        let query_string = {
4032            #[serde_with::skip_serializing_none]
4033            #[derive(Serialize)]
4034            struct QueryParams<'b> {
4035                error_trace: Option<bool>,
4036                #[serde(serialize_with = "crate::client::serialize_coll_qs")]
4037                filter_path: Option<&'b [&'b str]>,
4038                flat_settings: Option<bool>,
4039                human: Option<bool>,
4040                local: Option<bool>,
4041                master_timeout: Option<&'b str>,
4042                pretty: Option<bool>,
4043                source: Option<&'b str>,
4044            }
4045            let query_params = QueryParams {
4046                error_trace: self.error_trace,
4047                filter_path: self.filter_path,
4048                flat_settings: self.flat_settings,
4049                human: self.human,
4050                local: self.local,
4051                master_timeout: self.master_timeout,
4052                pretty: self.pretty,
4053                source: self.source,
4054            };
4055            Some(query_params)
4056        };
4057        let body = Option::<()>::None;
4058        let response = self
4059            .transport
4060            .send(method, &path, headers, query_string.as_ref(), body, timeout)
4061            .await?;
4062        Ok(response)
4063    }
4064}
4065#[derive(Debug, Clone, PartialEq)]
4066#[doc = "API parts for the Indices Get Mapping API"]
4067pub enum IndicesGetMappingParts<'b> {
4068    #[doc = "No parts"]
4069    None,
4070    #[doc = "Index"]
4071    Index(&'b [&'b str]),
4072    #[doc = "Type"]
4073    Type(&'b [&'b str]),
4074    #[doc = "Index and Type"]
4075    IndexType(&'b [&'b str], &'b [&'b str]),
4076}
4077impl<'b> IndicesGetMappingParts<'b> {
4078    #[doc = "Builds a relative URL path to the Indices Get Mapping API"]
4079    pub fn url(self) -> Cow<'static, str> {
4080        match self {
4081            IndicesGetMappingParts::None => "/_mapping".into(),
4082            IndicesGetMappingParts::Index(ref index) => {
4083                let index_str = index.join(",");
4084                let encoded_index: Cow<str> =
4085                    percent_encode(index_str.as_bytes(), PARTS_ENCODED).into();
4086                let mut p = String::with_capacity(10usize + encoded_index.len());
4087                p.push_str("/");
4088                p.push_str(encoded_index.as_ref());
4089                p.push_str("/_mapping");
4090                p.into()
4091            }
4092            IndicesGetMappingParts::Type(ref ty) => {
4093                let ty_str = ty.join(",");
4094                let encoded_ty: Cow<str> = percent_encode(ty_str.as_bytes(), PARTS_ENCODED).into();
4095                let mut p = String::with_capacity(10usize + encoded_ty.len());
4096                p.push_str("/_mapping/");
4097                p.push_str(encoded_ty.as_ref());
4098                p.into()
4099            }
4100            IndicesGetMappingParts::IndexType(ref index, ref ty) => {
4101                let index_str = index.join(",");
4102                let ty_str = ty.join(",");
4103                let encoded_index: Cow<str> =
4104                    percent_encode(index_str.as_bytes(), PARTS_ENCODED).into();
4105                let encoded_ty: Cow<str> = percent_encode(ty_str.as_bytes(), PARTS_ENCODED).into();
4106                let mut p = String::with_capacity(11usize + encoded_index.len() + encoded_ty.len());
4107                p.push_str("/");
4108                p.push_str(encoded_index.as_ref());
4109                p.push_str("/_mapping/");
4110                p.push_str(encoded_ty.as_ref());
4111                p.into()
4112            }
4113        }
4114    }
4115}
4116#[doc = "Builder for the [Indices Get Mapping API](https://opensearch.org/docs/)\n\nReturns mappings for one or more indices."]
4117#[derive(Clone, Debug)]
4118pub struct IndicesGetMapping<'a, 'b> {
4119    transport: &'a Transport,
4120    parts: IndicesGetMappingParts<'b>,
4121    allow_no_indices: Option<bool>,
4122    error_trace: Option<bool>,
4123    expand_wildcards: Option<&'b [ExpandWildcards]>,
4124    filter_path: Option<&'b [&'b str]>,
4125    headers: HeaderMap,
4126    human: Option<bool>,
4127    ignore_unavailable: Option<bool>,
4128    include_type_name: Option<bool>,
4129    local: Option<bool>,
4130    master_timeout: Option<&'b str>,
4131    pretty: Option<bool>,
4132    request_timeout: Option<Duration>,
4133    source: Option<&'b str>,
4134}
4135impl<'a, 'b> IndicesGetMapping<'a, 'b> {
4136    #[doc = "Creates a new instance of [IndicesGetMapping] with the specified API parts"]
4137    pub fn new(transport: &'a Transport, parts: IndicesGetMappingParts<'b>) -> Self {
4138        let headers = HeaderMap::new();
4139        IndicesGetMapping {
4140            transport,
4141            parts,
4142            headers,
4143            allow_no_indices: None,
4144            error_trace: None,
4145            expand_wildcards: None,
4146            filter_path: None,
4147            human: None,
4148            ignore_unavailable: None,
4149            include_type_name: None,
4150            local: None,
4151            master_timeout: None,
4152            pretty: None,
4153            request_timeout: None,
4154            source: None,
4155        }
4156    }
4157    #[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)"]
4158    pub fn allow_no_indices(mut self, allow_no_indices: bool) -> Self {
4159        self.allow_no_indices = Some(allow_no_indices);
4160        self
4161    }
4162    #[doc = "Include the stack trace of returned errors."]
4163    pub fn error_trace(mut self, error_trace: bool) -> Self {
4164        self.error_trace = Some(error_trace);
4165        self
4166    }
4167    #[doc = "Whether to expand wildcard expression to concrete indices that are open, closed or both."]
4168    pub fn expand_wildcards(mut self, expand_wildcards: &'b [ExpandWildcards]) -> Self {
4169        self.expand_wildcards = Some(expand_wildcards);
4170        self
4171    }
4172    #[doc = "A comma-separated list of filters used to reduce the response."]
4173    pub fn filter_path(mut self, filter_path: &'b [&'b str]) -> Self {
4174        self.filter_path = Some(filter_path);
4175        self
4176    }
4177    #[doc = "Adds a HTTP header"]
4178    pub fn header(mut self, key: HeaderName, value: HeaderValue) -> Self {
4179        self.headers.insert(key, value);
4180        self
4181    }
4182    #[doc = "Return human readable values for statistics."]
4183    pub fn human(mut self, human: bool) -> Self {
4184        self.human = Some(human);
4185        self
4186    }
4187    #[doc = "Whether specified concrete indices should be ignored when unavailable (missing or closed)"]
4188    pub fn ignore_unavailable(mut self, ignore_unavailable: bool) -> Self {
4189        self.ignore_unavailable = Some(ignore_unavailable);
4190        self
4191    }
4192    #[doc = "Whether to add the type name to the response (default: false)"]
4193    pub fn include_type_name(mut self, include_type_name: bool) -> Self {
4194        self.include_type_name = Some(include_type_name);
4195        self
4196    }
4197    #[doc = "Return local information, do not retrieve the state from master node (default: false)"]
4198    pub fn local(mut self, local: bool) -> Self {
4199        self.local = Some(local);
4200        self
4201    }
4202    #[doc = "Specify timeout for connection to master"]
4203    pub fn master_timeout(mut self, master_timeout: &'b str) -> Self {
4204        self.master_timeout = Some(master_timeout);
4205        self
4206    }
4207    #[doc = "Pretty format the returned JSON response."]
4208    pub fn pretty(mut self, pretty: bool) -> Self {
4209        self.pretty = Some(pretty);
4210        self
4211    }
4212    #[doc = "Sets a request timeout for this API call.\n\nThe timeout is applied from when the request starts connecting until the response body has finished."]
4213    pub fn request_timeout(mut self, timeout: Duration) -> Self {
4214        self.request_timeout = Some(timeout);
4215        self
4216    }
4217    #[doc = "The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests."]
4218    pub fn source(mut self, source: &'b str) -> Self {
4219        self.source = Some(source);
4220        self
4221    }
4222    #[doc = "Creates an asynchronous call to the Indices Get Mapping API that can be awaited"]
4223    pub async fn send(self) -> Result<Response, Error> {
4224        let path = self.parts.url();
4225        let method = Method::Get;
4226        let headers = self.headers;
4227        let timeout = self.request_timeout;
4228        let query_string = {
4229            #[serde_with::skip_serializing_none]
4230            #[derive(Serialize)]
4231            struct QueryParams<'b> {
4232                allow_no_indices: Option<bool>,
4233                error_trace: Option<bool>,
4234                #[serde(serialize_with = "crate::client::serialize_coll_qs")]
4235                expand_wildcards: Option<&'b [ExpandWildcards]>,
4236                #[serde(serialize_with = "crate::client::serialize_coll_qs")]
4237                filter_path: Option<&'b [&'b str]>,
4238                human: Option<bool>,
4239                ignore_unavailable: Option<bool>,
4240                include_type_name: Option<bool>,
4241                local: Option<bool>,
4242                master_timeout: Option<&'b str>,
4243                pretty: Option<bool>,
4244                source: Option<&'b str>,
4245            }
4246            let query_params = QueryParams {
4247                allow_no_indices: self.allow_no_indices,
4248                error_trace: self.error_trace,
4249                expand_wildcards: self.expand_wildcards,
4250                filter_path: self.filter_path,
4251                human: self.human,
4252                ignore_unavailable: self.ignore_unavailable,
4253                include_type_name: self.include_type_name,
4254                local: self.local,
4255                master_timeout: self.master_timeout,
4256                pretty: self.pretty,
4257                source: self.source,
4258            };
4259            Some(query_params)
4260        };
4261        let body = Option::<()>::None;
4262        let response = self
4263            .transport
4264            .send(method, &path, headers, query_string.as_ref(), body, timeout)
4265            .await?;
4266        Ok(response)
4267    }
4268}
4269#[derive(Debug, Clone, PartialEq)]
4270#[doc = "API parts for the Indices Get Settings API"]
4271pub enum IndicesGetSettingsParts<'b> {
4272    #[doc = "No parts"]
4273    None,
4274    #[doc = "Index"]
4275    Index(&'b [&'b str]),
4276    #[doc = "Index and Name"]
4277    IndexName(&'b [&'b str], &'b [&'b str]),
4278    #[doc = "Name"]
4279    Name(&'b [&'b str]),
4280}
4281impl<'b> IndicesGetSettingsParts<'b> {
4282    #[doc = "Builds a relative URL path to the Indices Get Settings API"]
4283    pub fn url(self) -> Cow<'static, str> {
4284        match self {
4285            IndicesGetSettingsParts::None => "/_settings".into(),
4286            IndicesGetSettingsParts::Index(ref index) => {
4287                let index_str = index.join(",");
4288                let encoded_index: Cow<str> =
4289                    percent_encode(index_str.as_bytes(), PARTS_ENCODED).into();
4290                let mut p = String::with_capacity(11usize + encoded_index.len());
4291                p.push_str("/");
4292                p.push_str(encoded_index.as_ref());
4293                p.push_str("/_settings");
4294                p.into()
4295            }
4296            IndicesGetSettingsParts::IndexName(ref index, ref name) => {
4297                let index_str = index.join(",");
4298                let name_str = name.join(",");
4299                let encoded_index: Cow<str> =
4300                    percent_encode(index_str.as_bytes(), PARTS_ENCODED).into();
4301                let encoded_name: Cow<str> =
4302                    percent_encode(name_str.as_bytes(), PARTS_ENCODED).into();
4303                let mut p =
4304                    String::with_capacity(12usize + encoded_index.len() + encoded_name.len());
4305                p.push_str("/");
4306                p.push_str(encoded_index.as_ref());
4307                p.push_str("/_settings/");
4308                p.push_str(encoded_name.as_ref());
4309                p.into()
4310            }
4311            IndicesGetSettingsParts::Name(ref name) => {
4312                let name_str = name.join(",");
4313                let encoded_name: Cow<str> =
4314                    percent_encode(name_str.as_bytes(), PARTS_ENCODED).into();
4315                let mut p = String::with_capacity(11usize + encoded_name.len());
4316                p.push_str("/_settings/");
4317                p.push_str(encoded_name.as_ref());
4318                p.into()
4319            }
4320        }
4321    }
4322}
4323#[doc = "Builder for the [Indices Get Settings API](https://opensearch.org/docs/)\n\nReturns settings for one or more indices."]
4324#[derive(Clone, Debug)]
4325pub struct IndicesGetSettings<'a, 'b> {
4326    transport: &'a Transport,
4327    parts: IndicesGetSettingsParts<'b>,
4328    allow_no_indices: Option<bool>,
4329    error_trace: Option<bool>,
4330    expand_wildcards: Option<&'b [ExpandWildcards]>,
4331    filter_path: Option<&'b [&'b str]>,
4332    flat_settings: Option<bool>,
4333    headers: HeaderMap,
4334    human: Option<bool>,
4335    ignore_unavailable: Option<bool>,
4336    include_defaults: Option<bool>,
4337    local: Option<bool>,
4338    master_timeout: Option<&'b str>,
4339    pretty: Option<bool>,
4340    request_timeout: Option<Duration>,
4341    source: Option<&'b str>,
4342}
4343impl<'a, 'b> IndicesGetSettings<'a, 'b> {
4344    #[doc = "Creates a new instance of [IndicesGetSettings] with the specified API parts"]
4345    pub fn new(transport: &'a Transport, parts: IndicesGetSettingsParts<'b>) -> Self {
4346        let headers = HeaderMap::new();
4347        IndicesGetSettings {
4348            transport,
4349            parts,
4350            headers,
4351            allow_no_indices: None,
4352            error_trace: None,
4353            expand_wildcards: None,
4354            filter_path: None,
4355            flat_settings: None,
4356            human: None,
4357            ignore_unavailable: None,
4358            include_defaults: None,
4359            local: None,
4360            master_timeout: None,
4361            pretty: None,
4362            request_timeout: None,
4363            source: None,
4364        }
4365    }
4366    #[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)"]
4367    pub fn allow_no_indices(mut self, allow_no_indices: bool) -> Self {
4368        self.allow_no_indices = Some(allow_no_indices);
4369        self
4370    }
4371    #[doc = "Include the stack trace of returned errors."]
4372    pub fn error_trace(mut self, error_trace: bool) -> Self {
4373        self.error_trace = Some(error_trace);
4374        self
4375    }
4376    #[doc = "Whether to expand wildcard expression to concrete indices that are open, closed or both."]
4377    pub fn expand_wildcards(mut self, expand_wildcards: &'b [ExpandWildcards]) -> Self {
4378        self.expand_wildcards = Some(expand_wildcards);
4379        self
4380    }
4381    #[doc = "A comma-separated list of filters used to reduce the response."]
4382    pub fn filter_path(mut self, filter_path: &'b [&'b str]) -> Self {
4383        self.filter_path = Some(filter_path);
4384        self
4385    }
4386    #[doc = "Return settings in flat format (default: false)"]
4387    pub fn flat_settings(mut self, flat_settings: bool) -> Self {
4388        self.flat_settings = Some(flat_settings);
4389        self
4390    }
4391    #[doc = "Adds a HTTP header"]
4392    pub fn header(mut self, key: HeaderName, value: HeaderValue) -> Self {
4393        self.headers.insert(key, value);
4394        self
4395    }
4396    #[doc = "Return human readable values for statistics."]
4397    pub fn human(mut self, human: bool) -> Self {
4398        self.human = Some(human);
4399        self
4400    }
4401    #[doc = "Whether specified concrete indices should be ignored when unavailable (missing or closed)"]
4402    pub fn ignore_unavailable(mut self, ignore_unavailable: bool) -> Self {
4403        self.ignore_unavailable = Some(ignore_unavailable);
4404        self
4405    }
4406    #[doc = "Whether to return all default setting for each of the indices."]
4407    pub fn include_defaults(mut self, include_defaults: bool) -> Self {
4408        self.include_defaults = Some(include_defaults);
4409        self
4410    }
4411    #[doc = "Return local information, do not retrieve the state from master node (default: false)"]
4412    pub fn local(mut self, local: bool) -> Self {
4413        self.local = Some(local);
4414        self
4415    }
4416    #[doc = "Specify timeout for connection to master"]
4417    pub fn master_timeout(mut self, master_timeout: &'b str) -> Self {
4418        self.master_timeout = Some(master_timeout);
4419        self
4420    }
4421    #[doc = "Pretty format the returned JSON response."]
4422    pub fn pretty(mut self, pretty: bool) -> Self {
4423        self.pretty = Some(pretty);
4424        self
4425    }
4426    #[doc = "Sets a request timeout for this API call.\n\nThe timeout is applied from when the request starts connecting until the response body has finished."]
4427    pub fn request_timeout(mut self, timeout: Duration) -> Self {
4428        self.request_timeout = Some(timeout);
4429        self
4430    }
4431    #[doc = "The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests."]
4432    pub fn source(mut self, source: &'b str) -> Self {
4433        self.source = Some(source);
4434        self
4435    }
4436    #[doc = "Creates an asynchronous call to the Indices Get Settings API that can be awaited"]
4437    pub async fn send(self) -> Result<Response, Error> {
4438        let path = self.parts.url();
4439        let method = Method::Get;
4440        let headers = self.headers;
4441        let timeout = self.request_timeout;
4442        let query_string = {
4443            #[serde_with::skip_serializing_none]
4444            #[derive(Serialize)]
4445            struct QueryParams<'b> {
4446                allow_no_indices: Option<bool>,
4447                error_trace: Option<bool>,
4448                #[serde(serialize_with = "crate::client::serialize_coll_qs")]
4449                expand_wildcards: Option<&'b [ExpandWildcards]>,
4450                #[serde(serialize_with = "crate::client::serialize_coll_qs")]
4451                filter_path: Option<&'b [&'b str]>,
4452                flat_settings: Option<bool>,
4453                human: Option<bool>,
4454                ignore_unavailable: Option<bool>,
4455                include_defaults: Option<bool>,
4456                local: Option<bool>,
4457                master_timeout: Option<&'b str>,
4458                pretty: Option<bool>,
4459                source: Option<&'b str>,
4460            }
4461            let query_params = QueryParams {
4462                allow_no_indices: self.allow_no_indices,
4463                error_trace: self.error_trace,
4464                expand_wildcards: self.expand_wildcards,
4465                filter_path: self.filter_path,
4466                flat_settings: self.flat_settings,
4467                human: self.human,
4468                ignore_unavailable: self.ignore_unavailable,
4469                include_defaults: self.include_defaults,
4470                local: self.local,
4471                master_timeout: self.master_timeout,
4472                pretty: self.pretty,
4473                source: self.source,
4474            };
4475            Some(query_params)
4476        };
4477        let body = Option::<()>::None;
4478        let response = self
4479            .transport
4480            .send(method, &path, headers, query_string.as_ref(), body, timeout)
4481            .await?;
4482        Ok(response)
4483    }
4484}
4485#[derive(Debug, Clone, PartialEq)]
4486#[doc = "API parts for the Indices Get Template API"]
4487pub enum IndicesGetTemplateParts<'b> {
4488    #[doc = "No parts"]
4489    None,
4490    #[doc = "Name"]
4491    Name(&'b [&'b str]),
4492}
4493impl<'b> IndicesGetTemplateParts<'b> {
4494    #[doc = "Builds a relative URL path to the Indices Get Template API"]
4495    pub fn url(self) -> Cow<'static, str> {
4496        match self {
4497            IndicesGetTemplateParts::None => "/_template".into(),
4498            IndicesGetTemplateParts::Name(ref name) => {
4499                let name_str = name.join(",");
4500                let encoded_name: Cow<str> =
4501                    percent_encode(name_str.as_bytes(), PARTS_ENCODED).into();
4502                let mut p = String::with_capacity(11usize + encoded_name.len());
4503                p.push_str("/_template/");
4504                p.push_str(encoded_name.as_ref());
4505                p.into()
4506            }
4507        }
4508    }
4509}
4510#[doc = "Builder for the [Indices Get Template API](https://opensearch.org/docs/)\n\nReturns an index template."]
4511#[derive(Clone, Debug)]
4512pub struct IndicesGetTemplate<'a, 'b> {
4513    transport: &'a Transport,
4514    parts: IndicesGetTemplateParts<'b>,
4515    error_trace: Option<bool>,
4516    filter_path: Option<&'b [&'b str]>,
4517    flat_settings: Option<bool>,
4518    headers: HeaderMap,
4519    human: Option<bool>,
4520    include_type_name: Option<bool>,
4521    local: Option<bool>,
4522    master_timeout: Option<&'b str>,
4523    pretty: Option<bool>,
4524    request_timeout: Option<Duration>,
4525    source: Option<&'b str>,
4526}
4527impl<'a, 'b> IndicesGetTemplate<'a, 'b> {
4528    #[doc = "Creates a new instance of [IndicesGetTemplate] with the specified API parts"]
4529    pub fn new(transport: &'a Transport, parts: IndicesGetTemplateParts<'b>) -> Self {
4530        let headers = HeaderMap::new();
4531        IndicesGetTemplate {
4532            transport,
4533            parts,
4534            headers,
4535            error_trace: None,
4536            filter_path: None,
4537            flat_settings: None,
4538            human: None,
4539            include_type_name: None,
4540            local: None,
4541            master_timeout: None,
4542            pretty: None,
4543            request_timeout: None,
4544            source: None,
4545        }
4546    }
4547    #[doc = "Include the stack trace of returned errors."]
4548    pub fn error_trace(mut self, error_trace: bool) -> Self {
4549        self.error_trace = Some(error_trace);
4550        self
4551    }
4552    #[doc = "A comma-separated list of filters used to reduce the response."]
4553    pub fn filter_path(mut self, filter_path: &'b [&'b str]) -> Self {
4554        self.filter_path = Some(filter_path);
4555        self
4556    }
4557    #[doc = "Return settings in flat format (default: false)"]
4558    pub fn flat_settings(mut self, flat_settings: bool) -> Self {
4559        self.flat_settings = Some(flat_settings);
4560        self
4561    }
4562    #[doc = "Adds a HTTP header"]
4563    pub fn header(mut self, key: HeaderName, value: HeaderValue) -> Self {
4564        self.headers.insert(key, value);
4565        self
4566    }
4567    #[doc = "Return human readable values for statistics."]
4568    pub fn human(mut self, human: bool) -> Self {
4569        self.human = Some(human);
4570        self
4571    }
4572    #[doc = "Whether a type should be returned in the body of the mappings."]
4573    pub fn include_type_name(mut self, include_type_name: bool) -> Self {
4574        self.include_type_name = Some(include_type_name);
4575        self
4576    }
4577    #[doc = "Return local information, do not retrieve the state from master node (default: false)"]
4578    pub fn local(mut self, local: bool) -> Self {
4579        self.local = Some(local);
4580        self
4581    }
4582    #[doc = "Explicit operation timeout for connection to master node"]
4583    pub fn master_timeout(mut self, master_timeout: &'b str) -> Self {
4584        self.master_timeout = Some(master_timeout);
4585        self
4586    }
4587    #[doc = "Pretty format the returned JSON response."]
4588    pub fn pretty(mut self, pretty: bool) -> Self {
4589        self.pretty = Some(pretty);
4590        self
4591    }
4592    #[doc = "Sets a request timeout for this API call.\n\nThe timeout is applied from when the request starts connecting until the response body has finished."]
4593    pub fn request_timeout(mut self, timeout: Duration) -> Self {
4594        self.request_timeout = Some(timeout);
4595        self
4596    }
4597    #[doc = "The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests."]
4598    pub fn source(mut self, source: &'b str) -> Self {
4599        self.source = Some(source);
4600        self
4601    }
4602    #[doc = "Creates an asynchronous call to the Indices Get Template API that can be awaited"]
4603    pub async fn send(self) -> Result<Response, Error> {
4604        let path = self.parts.url();
4605        let method = Method::Get;
4606        let headers = self.headers;
4607        let timeout = self.request_timeout;
4608        let query_string = {
4609            #[serde_with::skip_serializing_none]
4610            #[derive(Serialize)]
4611            struct QueryParams<'b> {
4612                error_trace: Option<bool>,
4613                #[serde(serialize_with = "crate::client::serialize_coll_qs")]
4614                filter_path: Option<&'b [&'b str]>,
4615                flat_settings: Option<bool>,
4616                human: Option<bool>,
4617                include_type_name: Option<bool>,
4618                local: Option<bool>,
4619                master_timeout: Option<&'b str>,
4620                pretty: Option<bool>,
4621                source: Option<&'b str>,
4622            }
4623            let query_params = QueryParams {
4624                error_trace: self.error_trace,
4625                filter_path: self.filter_path,
4626                flat_settings: self.flat_settings,
4627                human: self.human,
4628                include_type_name: self.include_type_name,
4629                local: self.local,
4630                master_timeout: self.master_timeout,
4631                pretty: self.pretty,
4632                source: self.source,
4633            };
4634            Some(query_params)
4635        };
4636        let body = Option::<()>::None;
4637        let response = self
4638            .transport
4639            .send(method, &path, headers, query_string.as_ref(), body, timeout)
4640            .await?;
4641        Ok(response)
4642    }
4643}
4644#[derive(Debug, Clone, PartialEq)]
4645#[doc = "API parts for the Indices Get Upgrade API"]
4646pub enum IndicesGetUpgradeParts<'b> {
4647    #[doc = "No parts"]
4648    None,
4649    #[doc = "Index"]
4650    Index(&'b [&'b str]),
4651}
4652impl<'b> IndicesGetUpgradeParts<'b> {
4653    #[doc = "Builds a relative URL path to the Indices Get Upgrade API"]
4654    pub fn url(self) -> Cow<'static, str> {
4655        match self {
4656            IndicesGetUpgradeParts::None => "/_upgrade".into(),
4657            IndicesGetUpgradeParts::Index(ref index) => {
4658                let index_str = index.join(",");
4659                let encoded_index: Cow<str> =
4660                    percent_encode(index_str.as_bytes(), PARTS_ENCODED).into();
4661                let mut p = String::with_capacity(10usize + encoded_index.len());
4662                p.push_str("/");
4663                p.push_str(encoded_index.as_ref());
4664                p.push_str("/_upgrade");
4665                p.into()
4666            }
4667        }
4668    }
4669}
4670#[doc = "Builder for the [Indices Get Upgrade API](https://opensearch.org/docs/)\n\nDEPRECATED Returns a progress status of current upgrade."]
4671#[derive(Clone, Debug)]
4672pub struct IndicesGetUpgrade<'a, 'b> {
4673    transport: &'a Transport,
4674    parts: IndicesGetUpgradeParts<'b>,
4675    allow_no_indices: Option<bool>,
4676    error_trace: Option<bool>,
4677    expand_wildcards: Option<&'b [ExpandWildcards]>,
4678    filter_path: Option<&'b [&'b str]>,
4679    headers: HeaderMap,
4680    human: Option<bool>,
4681    ignore_unavailable: Option<bool>,
4682    pretty: Option<bool>,
4683    request_timeout: Option<Duration>,
4684    source: Option<&'b str>,
4685}
4686impl<'a, 'b> IndicesGetUpgrade<'a, 'b> {
4687    #[doc = "Creates a new instance of [IndicesGetUpgrade] with the specified API parts"]
4688    pub fn new(transport: &'a Transport, parts: IndicesGetUpgradeParts<'b>) -> Self {
4689        let headers = HeaderMap::new();
4690        IndicesGetUpgrade {
4691            transport,
4692            parts,
4693            headers,
4694            allow_no_indices: None,
4695            error_trace: None,
4696            expand_wildcards: None,
4697            filter_path: None,
4698            human: None,
4699            ignore_unavailable: None,
4700            pretty: None,
4701            request_timeout: None,
4702            source: None,
4703        }
4704    }
4705    #[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)"]
4706    pub fn allow_no_indices(mut self, allow_no_indices: bool) -> Self {
4707        self.allow_no_indices = Some(allow_no_indices);
4708        self
4709    }
4710    #[doc = "Include the stack trace of returned errors."]
4711    pub fn error_trace(mut self, error_trace: bool) -> Self {
4712        self.error_trace = Some(error_trace);
4713        self
4714    }
4715    #[doc = "Whether to expand wildcard expression to concrete indices that are open, closed or both."]
4716    pub fn expand_wildcards(mut self, expand_wildcards: &'b [ExpandWildcards]) -> Self {
4717        self.expand_wildcards = Some(expand_wildcards);
4718        self
4719    }
4720    #[doc = "A comma-separated list of filters used to reduce the response."]
4721    pub fn filter_path(mut self, filter_path: &'b [&'b str]) -> Self {
4722        self.filter_path = Some(filter_path);
4723        self
4724    }
4725    #[doc = "Adds a HTTP header"]
4726    pub fn header(mut self, key: HeaderName, value: HeaderValue) -> Self {
4727        self.headers.insert(key, value);
4728        self
4729    }
4730    #[doc = "Return human readable values for statistics."]
4731    pub fn human(mut self, human: bool) -> Self {
4732        self.human = Some(human);
4733        self
4734    }
4735    #[doc = "Whether specified concrete indices should be ignored when unavailable (missing or closed)"]
4736    pub fn ignore_unavailable(mut self, ignore_unavailable: bool) -> Self {
4737        self.ignore_unavailable = Some(ignore_unavailable);
4738        self
4739    }
4740    #[doc = "Pretty format the returned JSON response."]
4741    pub fn pretty(mut self, pretty: bool) -> Self {
4742        self.pretty = Some(pretty);
4743        self
4744    }
4745    #[doc = "Sets a request timeout for this API call.\n\nThe timeout is applied from when the request starts connecting until the response body has finished."]
4746    pub fn request_timeout(mut self, timeout: Duration) -> Self {
4747        self.request_timeout = Some(timeout);
4748        self
4749    }
4750    #[doc = "The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests."]
4751    pub fn source(mut self, source: &'b str) -> Self {
4752        self.source = Some(source);
4753        self
4754    }
4755    #[doc = "Creates an asynchronous call to the Indices Get Upgrade API that can be awaited"]
4756    pub async fn send(self) -> Result<Response, Error> {
4757        let path = self.parts.url();
4758        let method = Method::Get;
4759        let headers = self.headers;
4760        let timeout = self.request_timeout;
4761        let query_string = {
4762            #[serde_with::skip_serializing_none]
4763            #[derive(Serialize)]
4764            struct QueryParams<'b> {
4765                allow_no_indices: Option<bool>,
4766                error_trace: Option<bool>,
4767                #[serde(serialize_with = "crate::client::serialize_coll_qs")]
4768                expand_wildcards: Option<&'b [ExpandWildcards]>,
4769                #[serde(serialize_with = "crate::client::serialize_coll_qs")]
4770                filter_path: Option<&'b [&'b str]>,
4771                human: Option<bool>,
4772                ignore_unavailable: Option<bool>,
4773                pretty: Option<bool>,
4774                source: Option<&'b str>,
4775            }
4776            let query_params = QueryParams {
4777                allow_no_indices: self.allow_no_indices,
4778                error_trace: self.error_trace,
4779                expand_wildcards: self.expand_wildcards,
4780                filter_path: self.filter_path,
4781                human: self.human,
4782                ignore_unavailable: self.ignore_unavailable,
4783                pretty: self.pretty,
4784                source: self.source,
4785            };
4786            Some(query_params)
4787        };
4788        let body = Option::<()>::None;
4789        let response = self
4790            .transport
4791            .send(method, &path, headers, query_string.as_ref(), body, timeout)
4792            .await?;
4793        Ok(response)
4794    }
4795}
4796#[derive(Debug, Clone, PartialEq)]
4797#[doc = "API parts for the Indices Migrate To Data Stream API"]
4798pub enum IndicesMigrateToDataStreamParts<'b> {
4799    #[doc = "Name"]
4800    Name(&'b str),
4801}
4802impl<'b> IndicesMigrateToDataStreamParts<'b> {
4803    #[doc = "Builds a relative URL path to the Indices Migrate To Data Stream API"]
4804    pub fn url(self) -> Cow<'static, str> {
4805        match self {
4806            IndicesMigrateToDataStreamParts::Name(ref name) => {
4807                let encoded_name: Cow<str> = percent_encode(name.as_bytes(), PARTS_ENCODED).into();
4808                let mut p = String::with_capacity(23usize + encoded_name.len());
4809                p.push_str("/_data_stream/_migrate/");
4810                p.push_str(encoded_name.as_ref());
4811                p.into()
4812            }
4813        }
4814    }
4815}
4816#[doc = "Builder for the [Indices Migrate To Data Stream API](https://opensearch.org/docs/)\n\nMigrates an alias to a data stream"]
4817#[derive(Clone, Debug)]
4818pub struct IndicesMigrateToDataStream<'a, 'b, B> {
4819    transport: &'a Transport,
4820    parts: IndicesMigrateToDataStreamParts<'b>,
4821    body: Option<B>,
4822    error_trace: Option<bool>,
4823    filter_path: Option<&'b [&'b str]>,
4824    headers: HeaderMap,
4825    human: Option<bool>,
4826    pretty: Option<bool>,
4827    request_timeout: Option<Duration>,
4828    source: Option<&'b str>,
4829}
4830impl<'a, 'b, B> IndicesMigrateToDataStream<'a, 'b, B>
4831where
4832    B: Body,
4833{
4834    #[doc = "Creates a new instance of [IndicesMigrateToDataStream] with the specified API parts"]
4835    pub fn new(transport: &'a Transport, parts: IndicesMigrateToDataStreamParts<'b>) -> Self {
4836        let headers = HeaderMap::new();
4837        IndicesMigrateToDataStream {
4838            transport,
4839            parts,
4840            headers,
4841            body: None,
4842            error_trace: None,
4843            filter_path: None,
4844            human: None,
4845            pretty: None,
4846            request_timeout: None,
4847            source: None,
4848        }
4849    }
4850    #[doc = "The body for the API call"]
4851    pub fn body<T>(self, body: T) -> IndicesMigrateToDataStream<'a, 'b, JsonBody<T>>
4852    where
4853        T: Serialize,
4854    {
4855        IndicesMigrateToDataStream {
4856            transport: self.transport,
4857            parts: self.parts,
4858            body: Some(body.into()),
4859            error_trace: self.error_trace,
4860            filter_path: self.filter_path,
4861            headers: self.headers,
4862            human: self.human,
4863            pretty: self.pretty,
4864            request_timeout: self.request_timeout,
4865            source: self.source,
4866        }
4867    }
4868    #[doc = "Include the stack trace of returned errors."]
4869    pub fn error_trace(mut self, error_trace: bool) -> Self {
4870        self.error_trace = Some(error_trace);
4871        self
4872    }
4873    #[doc = "A comma-separated list of filters used to reduce the response."]
4874    pub fn filter_path(mut self, filter_path: &'b [&'b str]) -> Self {
4875        self.filter_path = Some(filter_path);
4876        self
4877    }
4878    #[doc = "Adds a HTTP header"]
4879    pub fn header(mut self, key: HeaderName, value: HeaderValue) -> Self {
4880        self.headers.insert(key, value);
4881        self
4882    }
4883    #[doc = "Return human readable values for statistics."]
4884    pub fn human(mut self, human: bool) -> Self {
4885        self.human = Some(human);
4886        self
4887    }
4888    #[doc = "Pretty format the returned JSON response."]
4889    pub fn pretty(mut self, pretty: bool) -> Self {
4890        self.pretty = Some(pretty);
4891        self
4892    }
4893    #[doc = "Sets a request timeout for this API call.\n\nThe timeout is applied from when the request starts connecting until the response body has finished."]
4894    pub fn request_timeout(mut self, timeout: Duration) -> Self {
4895        self.request_timeout = Some(timeout);
4896        self
4897    }
4898    #[doc = "The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests."]
4899    pub fn source(mut self, source: &'b str) -> Self {
4900        self.source = Some(source);
4901        self
4902    }
4903    #[doc = "Creates an asynchronous call to the Indices Migrate To Data Stream API that can be awaited"]
4904    pub async fn send(self) -> Result<Response, Error> {
4905        let path = self.parts.url();
4906        let method = Method::Post;
4907        let headers = self.headers;
4908        let timeout = self.request_timeout;
4909        let query_string = {
4910            #[serde_with::skip_serializing_none]
4911            #[derive(Serialize)]
4912            struct QueryParams<'b> {
4913                error_trace: Option<bool>,
4914                #[serde(serialize_with = "crate::client::serialize_coll_qs")]
4915                filter_path: Option<&'b [&'b str]>,
4916                human: Option<bool>,
4917                pretty: Option<bool>,
4918                source: Option<&'b str>,
4919            }
4920            let query_params = QueryParams {
4921                error_trace: self.error_trace,
4922                filter_path: self.filter_path,
4923                human: self.human,
4924                pretty: self.pretty,
4925                source: self.source,
4926            };
4927            Some(query_params)
4928        };
4929        let body = self.body;
4930        let response = self
4931            .transport
4932            .send(method, &path, headers, query_string.as_ref(), body, timeout)
4933            .await?;
4934        Ok(response)
4935    }
4936}
4937#[derive(Debug, Clone, PartialEq)]
4938#[doc = "API parts for the Indices Open API"]
4939pub enum IndicesOpenParts<'b> {
4940    #[doc = "Index"]
4941    Index(&'b [&'b str]),
4942}
4943impl<'b> IndicesOpenParts<'b> {
4944    #[doc = "Builds a relative URL path to the Indices Open API"]
4945    pub fn url(self) -> Cow<'static, str> {
4946        match self {
4947            IndicesOpenParts::Index(ref index) => {
4948                let index_str = index.join(",");
4949                let encoded_index: Cow<str> =
4950                    percent_encode(index_str.as_bytes(), PARTS_ENCODED).into();
4951                let mut p = String::with_capacity(7usize + encoded_index.len());
4952                p.push_str("/");
4953                p.push_str(encoded_index.as_ref());
4954                p.push_str("/_open");
4955                p.into()
4956            }
4957        }
4958    }
4959}
4960#[doc = "Builder for the [Indices Open API](https://opensearch.org/docs/)\n\nOpens an index."]
4961#[derive(Clone, Debug)]
4962pub struct IndicesOpen<'a, 'b, B> {
4963    transport: &'a Transport,
4964    parts: IndicesOpenParts<'b>,
4965    allow_no_indices: Option<bool>,
4966    body: Option<B>,
4967    error_trace: Option<bool>,
4968    expand_wildcards: Option<&'b [ExpandWildcards]>,
4969    filter_path: Option<&'b [&'b str]>,
4970    headers: HeaderMap,
4971    human: Option<bool>,
4972    ignore_unavailable: Option<bool>,
4973    master_timeout: Option<&'b str>,
4974    pretty: Option<bool>,
4975    request_timeout: Option<Duration>,
4976    source: Option<&'b str>,
4977    timeout: Option<&'b str>,
4978    wait_for_active_shards: Option<&'b str>,
4979}
4980impl<'a, 'b, B> IndicesOpen<'a, 'b, B>
4981where
4982    B: Body,
4983{
4984    #[doc = "Creates a new instance of [IndicesOpen] with the specified API parts"]
4985    pub fn new(transport: &'a Transport, parts: IndicesOpenParts<'b>) -> Self {
4986        let headers = HeaderMap::new();
4987        IndicesOpen {
4988            transport,
4989            parts,
4990            headers,
4991            allow_no_indices: None,
4992            body: None,
4993            error_trace: None,
4994            expand_wildcards: None,
4995            filter_path: None,
4996            human: None,
4997            ignore_unavailable: None,
4998            master_timeout: None,
4999            pretty: None,
5000            request_timeout: None,
5001            source: None,
5002            timeout: None,
5003            wait_for_active_shards: None,
5004        }
5005    }
5006    #[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)"]
5007    pub fn allow_no_indices(mut self, allow_no_indices: bool) -> Self {
5008        self.allow_no_indices = Some(allow_no_indices);
5009        self
5010    }
5011    #[doc = "The body for the API call"]
5012    pub fn body<T>(self, body: T) -> IndicesOpen<'a, 'b, JsonBody<T>>
5013    where
5014        T: Serialize,
5015    {
5016        IndicesOpen {
5017            transport: self.transport,
5018            parts: self.parts,
5019            body: Some(body.into()),
5020            allow_no_indices: self.allow_no_indices,
5021            error_trace: self.error_trace,
5022            expand_wildcards: self.expand_wildcards,
5023            filter_path: self.filter_path,
5024            headers: self.headers,
5025            human: self.human,
5026            ignore_unavailable: self.ignore_unavailable,
5027            master_timeout: self.master_timeout,
5028            pretty: self.pretty,
5029            request_timeout: self.request_timeout,
5030            source: self.source,
5031            timeout: self.timeout,
5032            wait_for_active_shards: self.wait_for_active_shards,
5033        }
5034    }
5035    #[doc = "Include the stack trace of returned errors."]
5036    pub fn error_trace(mut self, error_trace: bool) -> Self {
5037        self.error_trace = Some(error_trace);
5038        self
5039    }
5040    #[doc = "Whether to expand wildcard expression to concrete indices that are open, closed or both."]
5041    pub fn expand_wildcards(mut self, expand_wildcards: &'b [ExpandWildcards]) -> Self {
5042        self.expand_wildcards = Some(expand_wildcards);
5043        self
5044    }
5045    #[doc = "A comma-separated list of filters used to reduce the response."]
5046    pub fn filter_path(mut self, filter_path: &'b [&'b str]) -> Self {
5047        self.filter_path = Some(filter_path);
5048        self
5049    }
5050    #[doc = "Adds a HTTP header"]
5051    pub fn header(mut self, key: HeaderName, value: HeaderValue) -> Self {
5052        self.headers.insert(key, value);
5053        self
5054    }
5055    #[doc = "Return human readable values for statistics."]
5056    pub fn human(mut self, human: bool) -> Self {
5057        self.human = Some(human);
5058        self
5059    }
5060    #[doc = "Whether specified concrete indices should be ignored when unavailable (missing or closed)"]
5061    pub fn ignore_unavailable(mut self, ignore_unavailable: bool) -> Self {
5062        self.ignore_unavailable = Some(ignore_unavailable);
5063        self
5064    }
5065    #[doc = "Specify timeout for connection to master"]
5066    pub fn master_timeout(mut self, master_timeout: &'b str) -> Self {
5067        self.master_timeout = Some(master_timeout);
5068        self
5069    }
5070    #[doc = "Pretty format the returned JSON response."]
5071    pub fn pretty(mut self, pretty: bool) -> Self {
5072        self.pretty = Some(pretty);
5073        self
5074    }
5075    #[doc = "Sets a request timeout for this API call.\n\nThe timeout is applied from when the request starts connecting until the response body has finished."]
5076    pub fn request_timeout(mut self, timeout: Duration) -> Self {
5077        self.request_timeout = Some(timeout);
5078        self
5079    }
5080    #[doc = "The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests."]
5081    pub fn source(mut self, source: &'b str) -> Self {
5082        self.source = Some(source);
5083        self
5084    }
5085    #[doc = "Explicit operation timeout"]
5086    pub fn timeout(mut self, timeout: &'b str) -> Self {
5087        self.timeout = Some(timeout);
5088        self
5089    }
5090    #[doc = "Sets the number of active shards to wait for before the operation returns."]
5091    pub fn wait_for_active_shards(mut self, wait_for_active_shards: &'b str) -> Self {
5092        self.wait_for_active_shards = Some(wait_for_active_shards);
5093        self
5094    }
5095    #[doc = "Creates an asynchronous call to the Indices Open API that can be awaited"]
5096    pub async fn send(self) -> Result<Response, Error> {
5097        let path = self.parts.url();
5098        let method = Method::Post;
5099        let headers = self.headers;
5100        let timeout = self.request_timeout;
5101        let query_string = {
5102            #[serde_with::skip_serializing_none]
5103            #[derive(Serialize)]
5104            struct QueryParams<'b> {
5105                allow_no_indices: Option<bool>,
5106                error_trace: Option<bool>,
5107                #[serde(serialize_with = "crate::client::serialize_coll_qs")]
5108                expand_wildcards: Option<&'b [ExpandWildcards]>,
5109                #[serde(serialize_with = "crate::client::serialize_coll_qs")]
5110                filter_path: Option<&'b [&'b str]>,
5111                human: Option<bool>,
5112                ignore_unavailable: Option<bool>,
5113                master_timeout: Option<&'b str>,
5114                pretty: Option<bool>,
5115                source: Option<&'b str>,
5116                timeout: Option<&'b str>,
5117                wait_for_active_shards: Option<&'b str>,
5118            }
5119            let query_params = QueryParams {
5120                allow_no_indices: self.allow_no_indices,
5121                error_trace: self.error_trace,
5122                expand_wildcards: self.expand_wildcards,
5123                filter_path: self.filter_path,
5124                human: self.human,
5125                ignore_unavailable: self.ignore_unavailable,
5126                master_timeout: self.master_timeout,
5127                pretty: self.pretty,
5128                source: self.source,
5129                timeout: self.timeout,
5130                wait_for_active_shards: self.wait_for_active_shards,
5131            };
5132            Some(query_params)
5133        };
5134        let body = self.body;
5135        let response = self
5136            .transport
5137            .send(method, &path, headers, query_string.as_ref(), body, timeout)
5138            .await?;
5139        Ok(response)
5140    }
5141}
5142#[derive(Debug, Clone, PartialEq)]
5143#[doc = "API parts for the Indices Promote Data Stream API"]
5144pub enum IndicesPromoteDataStreamParts<'b> {
5145    #[doc = "Name"]
5146    Name(&'b str),
5147}
5148impl<'b> IndicesPromoteDataStreamParts<'b> {
5149    #[doc = "Builds a relative URL path to the Indices Promote Data Stream API"]
5150    pub fn url(self) -> Cow<'static, str> {
5151        match self {
5152            IndicesPromoteDataStreamParts::Name(ref name) => {
5153                let encoded_name: Cow<str> = percent_encode(name.as_bytes(), PARTS_ENCODED).into();
5154                let mut p = String::with_capacity(23usize + encoded_name.len());
5155                p.push_str("/_data_stream/_promote/");
5156                p.push_str(encoded_name.as_ref());
5157                p.into()
5158            }
5159        }
5160    }
5161}
5162#[doc = "Builder for the [Indices Promote Data Stream API](https://opensearch.org/docs/)\n\nPromotes a data stream from a replicated data stream managed by CCR to a regular data stream"]
5163#[derive(Clone, Debug)]
5164pub struct IndicesPromoteDataStream<'a, 'b, B> {
5165    transport: &'a Transport,
5166    parts: IndicesPromoteDataStreamParts<'b>,
5167    body: Option<B>,
5168    error_trace: Option<bool>,
5169    filter_path: Option<&'b [&'b str]>,
5170    headers: HeaderMap,
5171    human: Option<bool>,
5172    pretty: Option<bool>,
5173    request_timeout: Option<Duration>,
5174    source: Option<&'b str>,
5175}
5176impl<'a, 'b, B> IndicesPromoteDataStream<'a, 'b, B>
5177where
5178    B: Body,
5179{
5180    #[doc = "Creates a new instance of [IndicesPromoteDataStream] with the specified API parts"]
5181    pub fn new(transport: &'a Transport, parts: IndicesPromoteDataStreamParts<'b>) -> Self {
5182        let headers = HeaderMap::new();
5183        IndicesPromoteDataStream {
5184            transport,
5185            parts,
5186            headers,
5187            body: None,
5188            error_trace: None,
5189            filter_path: None,
5190            human: None,
5191            pretty: None,
5192            request_timeout: None,
5193            source: None,
5194        }
5195    }
5196    #[doc = "The body for the API call"]
5197    pub fn body<T>(self, body: T) -> IndicesPromoteDataStream<'a, 'b, JsonBody<T>>
5198    where
5199        T: Serialize,
5200    {
5201        IndicesPromoteDataStream {
5202            transport: self.transport,
5203            parts: self.parts,
5204            body: Some(body.into()),
5205            error_trace: self.error_trace,
5206            filter_path: self.filter_path,
5207            headers: self.headers,
5208            human: self.human,
5209            pretty: self.pretty,
5210            request_timeout: self.request_timeout,
5211            source: self.source,
5212        }
5213    }
5214    #[doc = "Include the stack trace of returned errors."]
5215    pub fn error_trace(mut self, error_trace: bool) -> Self {
5216        self.error_trace = Some(error_trace);
5217        self
5218    }
5219    #[doc = "A comma-separated list of filters used to reduce the response."]
5220    pub fn filter_path(mut self, filter_path: &'b [&'b str]) -> Self {
5221        self.filter_path = Some(filter_path);
5222        self
5223    }
5224    #[doc = "Adds a HTTP header"]
5225    pub fn header(mut self, key: HeaderName, value: HeaderValue) -> Self {
5226        self.headers.insert(key, value);
5227        self
5228    }
5229    #[doc = "Return human readable values for statistics."]
5230    pub fn human(mut self, human: bool) -> Self {
5231        self.human = Some(human);
5232        self
5233    }
5234    #[doc = "Pretty format the returned JSON response."]
5235    pub fn pretty(mut self, pretty: bool) -> Self {
5236        self.pretty = Some(pretty);
5237        self
5238    }
5239    #[doc = "Sets a request timeout for this API call.\n\nThe timeout is applied from when the request starts connecting until the response body has finished."]
5240    pub fn request_timeout(mut self, timeout: Duration) -> Self {
5241        self.request_timeout = Some(timeout);
5242        self
5243    }
5244    #[doc = "The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests."]
5245    pub fn source(mut self, source: &'b str) -> Self {
5246        self.source = Some(source);
5247        self
5248    }
5249    #[doc = "Creates an asynchronous call to the Indices Promote Data Stream API that can be awaited"]
5250    pub async fn send(self) -> Result<Response, Error> {
5251        let path = self.parts.url();
5252        let method = Method::Post;
5253        let headers = self.headers;
5254        let timeout = self.request_timeout;
5255        let query_string = {
5256            #[serde_with::skip_serializing_none]
5257            #[derive(Serialize)]
5258            struct QueryParams<'b> {
5259                error_trace: Option<bool>,
5260                #[serde(serialize_with = "crate::client::serialize_coll_qs")]
5261                filter_path: Option<&'b [&'b str]>,
5262                human: Option<bool>,
5263                pretty: Option<bool>,
5264                source: Option<&'b str>,
5265            }
5266            let query_params = QueryParams {
5267                error_trace: self.error_trace,
5268                filter_path: self.filter_path,
5269                human: self.human,
5270                pretty: self.pretty,
5271                source: self.source,
5272            };
5273            Some(query_params)
5274        };
5275        let body = self.body;
5276        let response = self
5277            .transport
5278            .send(method, &path, headers, query_string.as_ref(), body, timeout)
5279            .await?;
5280        Ok(response)
5281    }
5282}
5283#[derive(Debug, Clone, PartialEq)]
5284#[doc = "API parts for the Indices Put Alias API"]
5285pub enum IndicesPutAliasParts<'b> {
5286    #[doc = "Index and Name"]
5287    IndexName(&'b [&'b str], &'b str),
5288}
5289impl<'b> IndicesPutAliasParts<'b> {
5290    #[doc = "Builds a relative URL path to the Indices Put Alias API"]
5291    pub fn url(self) -> Cow<'static, str> {
5292        match self {
5293            IndicesPutAliasParts::IndexName(ref index, ref name) => {
5294                let index_str = index.join(",");
5295                let encoded_index: Cow<str> =
5296                    percent_encode(index_str.as_bytes(), PARTS_ENCODED).into();
5297                let encoded_name: Cow<str> = percent_encode(name.as_bytes(), PARTS_ENCODED).into();
5298                let mut p =
5299                    String::with_capacity(9usize + encoded_index.len() + encoded_name.len());
5300                p.push_str("/");
5301                p.push_str(encoded_index.as_ref());
5302                p.push_str("/_alias/");
5303                p.push_str(encoded_name.as_ref());
5304                p.into()
5305            }
5306        }
5307    }
5308}
5309#[doc = "Builder for the [Indices Put Alias API](https://opensearch.org/docs/)\n\nCreates or updates an alias."]
5310#[derive(Clone, Debug)]
5311pub struct IndicesPutAlias<'a, 'b, B> {
5312    transport: &'a Transport,
5313    parts: IndicesPutAliasParts<'b>,
5314    body: Option<B>,
5315    error_trace: Option<bool>,
5316    filter_path: Option<&'b [&'b str]>,
5317    headers: HeaderMap,
5318    human: Option<bool>,
5319    master_timeout: Option<&'b str>,
5320    pretty: Option<bool>,
5321    request_timeout: Option<Duration>,
5322    source: Option<&'b str>,
5323    timeout: Option<&'b str>,
5324}
5325impl<'a, 'b, B> IndicesPutAlias<'a, 'b, B>
5326where
5327    B: Body,
5328{
5329    #[doc = "Creates a new instance of [IndicesPutAlias] with the specified API parts"]
5330    pub fn new(transport: &'a Transport, parts: IndicesPutAliasParts<'b>) -> Self {
5331        let headers = HeaderMap::new();
5332        IndicesPutAlias {
5333            transport,
5334            parts,
5335            headers,
5336            body: None,
5337            error_trace: None,
5338            filter_path: None,
5339            human: None,
5340            master_timeout: None,
5341            pretty: None,
5342            request_timeout: None,
5343            source: None,
5344            timeout: None,
5345        }
5346    }
5347    #[doc = "The body for the API call"]
5348    pub fn body<T>(self, body: T) -> IndicesPutAlias<'a, 'b, JsonBody<T>>
5349    where
5350        T: Serialize,
5351    {
5352        IndicesPutAlias {
5353            transport: self.transport,
5354            parts: self.parts,
5355            body: Some(body.into()),
5356            error_trace: self.error_trace,
5357            filter_path: self.filter_path,
5358            headers: self.headers,
5359            human: self.human,
5360            master_timeout: self.master_timeout,
5361            pretty: self.pretty,
5362            request_timeout: self.request_timeout,
5363            source: self.source,
5364            timeout: self.timeout,
5365        }
5366    }
5367    #[doc = "Include the stack trace of returned errors."]
5368    pub fn error_trace(mut self, error_trace: bool) -> Self {
5369        self.error_trace = Some(error_trace);
5370        self
5371    }
5372    #[doc = "A comma-separated list of filters used to reduce the response."]
5373    pub fn filter_path(mut self, filter_path: &'b [&'b str]) -> Self {
5374        self.filter_path = Some(filter_path);
5375        self
5376    }
5377    #[doc = "Adds a HTTP header"]
5378    pub fn header(mut self, key: HeaderName, value: HeaderValue) -> Self {
5379        self.headers.insert(key, value);
5380        self
5381    }
5382    #[doc = "Return human readable values for statistics."]
5383    pub fn human(mut self, human: bool) -> Self {
5384        self.human = Some(human);
5385        self
5386    }
5387    #[doc = "Specify timeout for connection to master"]
5388    pub fn master_timeout(mut self, master_timeout: &'b str) -> Self {
5389        self.master_timeout = Some(master_timeout);
5390        self
5391    }
5392    #[doc = "Pretty format the returned JSON response."]
5393    pub fn pretty(mut self, pretty: bool) -> Self {
5394        self.pretty = Some(pretty);
5395        self
5396    }
5397    #[doc = "Sets a request timeout for this API call.\n\nThe timeout is applied from when the request starts connecting until the response body has finished."]
5398    pub fn request_timeout(mut self, timeout: Duration) -> Self {
5399        self.request_timeout = Some(timeout);
5400        self
5401    }
5402    #[doc = "The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests."]
5403    pub fn source(mut self, source: &'b str) -> Self {
5404        self.source = Some(source);
5405        self
5406    }
5407    #[doc = "Explicit timestamp for the document"]
5408    pub fn timeout(mut self, timeout: &'b str) -> Self {
5409        self.timeout = Some(timeout);
5410        self
5411    }
5412    #[doc = "Creates an asynchronous call to the Indices Put Alias API that can be awaited"]
5413    pub async fn send(self) -> Result<Response, Error> {
5414        let path = self.parts.url();
5415        let method = Method::Put;
5416        let headers = self.headers;
5417        let timeout = self.request_timeout;
5418        let query_string = {
5419            #[serde_with::skip_serializing_none]
5420            #[derive(Serialize)]
5421            struct QueryParams<'b> {
5422                error_trace: Option<bool>,
5423                #[serde(serialize_with = "crate::client::serialize_coll_qs")]
5424                filter_path: Option<&'b [&'b str]>,
5425                human: Option<bool>,
5426                master_timeout: Option<&'b str>,
5427                pretty: Option<bool>,
5428                source: Option<&'b str>,
5429                timeout: Option<&'b str>,
5430            }
5431            let query_params = QueryParams {
5432                error_trace: self.error_trace,
5433                filter_path: self.filter_path,
5434                human: self.human,
5435                master_timeout: self.master_timeout,
5436                pretty: self.pretty,
5437                source: self.source,
5438                timeout: self.timeout,
5439            };
5440            Some(query_params)
5441        };
5442        let body = self.body;
5443        let response = self
5444            .transport
5445            .send(method, &path, headers, query_string.as_ref(), body, timeout)
5446            .await?;
5447        Ok(response)
5448    }
5449}
5450#[derive(Debug, Clone, PartialEq)]
5451#[doc = "API parts for the Indices Put Index Template API"]
5452pub enum IndicesPutIndexTemplateParts<'b> {
5453    #[doc = "Name"]
5454    Name(&'b str),
5455}
5456impl<'b> IndicesPutIndexTemplateParts<'b> {
5457    #[doc = "Builds a relative URL path to the Indices Put Index Template API"]
5458    pub fn url(self) -> Cow<'static, str> {
5459        match self {
5460            IndicesPutIndexTemplateParts::Name(ref name) => {
5461                let encoded_name: Cow<str> = percent_encode(name.as_bytes(), PARTS_ENCODED).into();
5462                let mut p = String::with_capacity(17usize + encoded_name.len());
5463                p.push_str("/_index_template/");
5464                p.push_str(encoded_name.as_ref());
5465                p.into()
5466            }
5467        }
5468    }
5469}
5470#[doc = "Builder for the [Indices Put Index Template API](https://opensearch.org/docs/)\n\nCreates or updates an index template."]
5471#[derive(Clone, Debug)]
5472pub struct IndicesPutIndexTemplate<'a, 'b, B> {
5473    transport: &'a Transport,
5474    parts: IndicesPutIndexTemplateParts<'b>,
5475    body: Option<B>,
5476    cause: Option<&'b str>,
5477    create: Option<bool>,
5478    error_trace: Option<bool>,
5479    filter_path: Option<&'b [&'b str]>,
5480    headers: HeaderMap,
5481    human: Option<bool>,
5482    master_timeout: Option<&'b str>,
5483    pretty: Option<bool>,
5484    request_timeout: Option<Duration>,
5485    source: Option<&'b str>,
5486}
5487impl<'a, 'b, B> IndicesPutIndexTemplate<'a, 'b, B>
5488where
5489    B: Body,
5490{
5491    #[doc = "Creates a new instance of [IndicesPutIndexTemplate] with the specified API parts"]
5492    pub fn new(transport: &'a Transport, parts: IndicesPutIndexTemplateParts<'b>) -> Self {
5493        let headers = HeaderMap::new();
5494        IndicesPutIndexTemplate {
5495            transport,
5496            parts,
5497            headers,
5498            body: None,
5499            cause: None,
5500            create: None,
5501            error_trace: None,
5502            filter_path: None,
5503            human: None,
5504            master_timeout: None,
5505            pretty: None,
5506            request_timeout: None,
5507            source: None,
5508        }
5509    }
5510    #[doc = "The body for the API call"]
5511    pub fn body<T>(self, body: T) -> IndicesPutIndexTemplate<'a, 'b, JsonBody<T>>
5512    where
5513        T: Serialize,
5514    {
5515        IndicesPutIndexTemplate {
5516            transport: self.transport,
5517            parts: self.parts,
5518            body: Some(body.into()),
5519            cause: self.cause,
5520            create: self.create,
5521            error_trace: self.error_trace,
5522            filter_path: self.filter_path,
5523            headers: self.headers,
5524            human: self.human,
5525            master_timeout: self.master_timeout,
5526            pretty: self.pretty,
5527            request_timeout: self.request_timeout,
5528            source: self.source,
5529        }
5530    }
5531    #[doc = "User defined reason for creating/updating the index template"]
5532    pub fn cause(mut self, cause: &'b str) -> Self {
5533        self.cause = Some(cause);
5534        self
5535    }
5536    #[doc = "Whether the index template should only be added if new or can also replace an existing one"]
5537    pub fn create(mut self, create: bool) -> Self {
5538        self.create = Some(create);
5539        self
5540    }
5541    #[doc = "Include the stack trace of returned errors."]
5542    pub fn error_trace(mut self, error_trace: bool) -> Self {
5543        self.error_trace = Some(error_trace);
5544        self
5545    }
5546    #[doc = "A comma-separated list of filters used to reduce the response."]
5547    pub fn filter_path(mut self, filter_path: &'b [&'b str]) -> Self {
5548        self.filter_path = Some(filter_path);
5549        self
5550    }
5551    #[doc = "Adds a HTTP header"]
5552    pub fn header(mut self, key: HeaderName, value: HeaderValue) -> Self {
5553        self.headers.insert(key, value);
5554        self
5555    }
5556    #[doc = "Return human readable values for statistics."]
5557    pub fn human(mut self, human: bool) -> Self {
5558        self.human = Some(human);
5559        self
5560    }
5561    #[doc = "Specify timeout for connection to master"]
5562    pub fn master_timeout(mut self, master_timeout: &'b str) -> Self {
5563        self.master_timeout = Some(master_timeout);
5564        self
5565    }
5566    #[doc = "Pretty format the returned JSON response."]
5567    pub fn pretty(mut self, pretty: bool) -> Self {
5568        self.pretty = Some(pretty);
5569        self
5570    }
5571    #[doc = "Sets a request timeout for this API call.\n\nThe timeout is applied from when the request starts connecting until the response body has finished."]
5572    pub fn request_timeout(mut self, timeout: Duration) -> Self {
5573        self.request_timeout = Some(timeout);
5574        self
5575    }
5576    #[doc = "The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests."]
5577    pub fn source(mut self, source: &'b str) -> Self {
5578        self.source = Some(source);
5579        self
5580    }
5581    #[doc = "Creates an asynchronous call to the Indices Put Index Template API that can be awaited"]
5582    pub async fn send(self) -> Result<Response, Error> {
5583        let path = self.parts.url();
5584        let method = Method::Put;
5585        let headers = self.headers;
5586        let timeout = self.request_timeout;
5587        let query_string = {
5588            #[serde_with::skip_serializing_none]
5589            #[derive(Serialize)]
5590            struct QueryParams<'b> {
5591                cause: Option<&'b str>,
5592                create: Option<bool>,
5593                error_trace: Option<bool>,
5594                #[serde(serialize_with = "crate::client::serialize_coll_qs")]
5595                filter_path: Option<&'b [&'b str]>,
5596                human: Option<bool>,
5597                master_timeout: Option<&'b str>,
5598                pretty: Option<bool>,
5599                source: Option<&'b str>,
5600            }
5601            let query_params = QueryParams {
5602                cause: self.cause,
5603                create: self.create,
5604                error_trace: self.error_trace,
5605                filter_path: self.filter_path,
5606                human: self.human,
5607                master_timeout: self.master_timeout,
5608                pretty: self.pretty,
5609                source: self.source,
5610            };
5611            Some(query_params)
5612        };
5613        let body = self.body;
5614        let response = self
5615            .transport
5616            .send(method, &path, headers, query_string.as_ref(), body, timeout)
5617            .await?;
5618        Ok(response)
5619    }
5620}
5621#[derive(Debug, Clone, PartialEq)]
5622#[doc = "API parts for the Indices Put Mapping API"]
5623pub enum IndicesPutMappingParts<'b> {
5624    #[doc = "Index"]
5625    Index(&'b [&'b str]),
5626    #[doc = "Index and Type"]
5627    IndexType(&'b [&'b str], &'b str),
5628    #[doc = "Type"]
5629    Type(&'b str),
5630}
5631impl<'b> IndicesPutMappingParts<'b> {
5632    #[doc = "Builds a relative URL path to the Indices Put Mapping API"]
5633    pub fn url(self) -> Cow<'static, str> {
5634        match self {
5635            IndicesPutMappingParts::Index(ref index) => {
5636                let index_str = index.join(",");
5637                let encoded_index: Cow<str> =
5638                    percent_encode(index_str.as_bytes(), PARTS_ENCODED).into();
5639                let mut p = String::with_capacity(10usize + encoded_index.len());
5640                p.push_str("/");
5641                p.push_str(encoded_index.as_ref());
5642                p.push_str("/_mapping");
5643                p.into()
5644            }
5645            IndicesPutMappingParts::IndexType(ref index, ref ty) => {
5646                let index_str = index.join(",");
5647                let encoded_index: Cow<str> =
5648                    percent_encode(index_str.as_bytes(), PARTS_ENCODED).into();
5649                let encoded_ty: Cow<str> = percent_encode(ty.as_bytes(), PARTS_ENCODED).into();
5650                let mut p = String::with_capacity(11usize + encoded_index.len() + encoded_ty.len());
5651                p.push_str("/");
5652                p.push_str(encoded_index.as_ref());
5653                p.push_str("/");
5654                p.push_str(encoded_ty.as_ref());
5655                p.push_str("/_mapping");
5656                p.into()
5657            }
5658            IndicesPutMappingParts::Type(ref ty) => {
5659                let encoded_ty: Cow<str> = percent_encode(ty.as_bytes(), PARTS_ENCODED).into();
5660                let mut p = String::with_capacity(11usize + encoded_ty.len());
5661                p.push_str("/_mappings/");
5662                p.push_str(encoded_ty.as_ref());
5663                p.into()
5664            }
5665        }
5666    }
5667}
5668#[doc = "Builder for the [Indices Put Mapping API](https://opensearch.org/docs/)\n\nUpdates the index mappings."]
5669#[derive(Clone, Debug)]
5670pub struct IndicesPutMapping<'a, 'b, B> {
5671    transport: &'a Transport,
5672    parts: IndicesPutMappingParts<'b>,
5673    allow_no_indices: Option<bool>,
5674    body: Option<B>,
5675    error_trace: Option<bool>,
5676    expand_wildcards: Option<&'b [ExpandWildcards]>,
5677    filter_path: Option<&'b [&'b str]>,
5678    headers: HeaderMap,
5679    human: Option<bool>,
5680    ignore_unavailable: Option<bool>,
5681    include_type_name: Option<bool>,
5682    master_timeout: Option<&'b str>,
5683    pretty: Option<bool>,
5684    request_timeout: Option<Duration>,
5685    source: Option<&'b str>,
5686    timeout: Option<&'b str>,
5687    write_index_only: Option<bool>,
5688}
5689impl<'a, 'b, B> IndicesPutMapping<'a, 'b, B>
5690where
5691    B: Body,
5692{
5693    #[doc = "Creates a new instance of [IndicesPutMapping] with the specified API parts"]
5694    pub fn new(transport: &'a Transport, parts: IndicesPutMappingParts<'b>) -> Self {
5695        let headers = HeaderMap::new();
5696        IndicesPutMapping {
5697            transport,
5698            parts,
5699            headers,
5700            allow_no_indices: None,
5701            body: None,
5702            error_trace: None,
5703            expand_wildcards: None,
5704            filter_path: None,
5705            human: None,
5706            ignore_unavailable: None,
5707            include_type_name: None,
5708            master_timeout: None,
5709            pretty: None,
5710            request_timeout: None,
5711            source: None,
5712            timeout: None,
5713            write_index_only: None,
5714        }
5715    }
5716    #[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)"]
5717    pub fn allow_no_indices(mut self, allow_no_indices: bool) -> Self {
5718        self.allow_no_indices = Some(allow_no_indices);
5719        self
5720    }
5721    #[doc = "The body for the API call"]
5722    pub fn body<T>(self, body: T) -> IndicesPutMapping<'a, 'b, JsonBody<T>>
5723    where
5724        T: Serialize,
5725    {
5726        IndicesPutMapping {
5727            transport: self.transport,
5728            parts: self.parts,
5729            body: Some(body.into()),
5730            allow_no_indices: self.allow_no_indices,
5731            error_trace: self.error_trace,
5732            expand_wildcards: self.expand_wildcards,
5733            filter_path: self.filter_path,
5734            headers: self.headers,
5735            human: self.human,
5736            ignore_unavailable: self.ignore_unavailable,
5737            include_type_name: self.include_type_name,
5738            master_timeout: self.master_timeout,
5739            pretty: self.pretty,
5740            request_timeout: self.request_timeout,
5741            source: self.source,
5742            timeout: self.timeout,
5743            write_index_only: self.write_index_only,
5744        }
5745    }
5746    #[doc = "Include the stack trace of returned errors."]
5747    pub fn error_trace(mut self, error_trace: bool) -> Self {
5748        self.error_trace = Some(error_trace);
5749        self
5750    }
5751    #[doc = "Whether to expand wildcard expression to concrete indices that are open, closed or both."]
5752    pub fn expand_wildcards(mut self, expand_wildcards: &'b [ExpandWildcards]) -> Self {
5753        self.expand_wildcards = Some(expand_wildcards);
5754        self
5755    }
5756    #[doc = "A comma-separated list of filters used to reduce the response."]
5757    pub fn filter_path(mut self, filter_path: &'b [&'b str]) -> Self {
5758        self.filter_path = Some(filter_path);
5759        self
5760    }
5761    #[doc = "Adds a HTTP header"]
5762    pub fn header(mut self, key: HeaderName, value: HeaderValue) -> Self {
5763        self.headers.insert(key, value);
5764        self
5765    }
5766    #[doc = "Return human readable values for statistics."]
5767    pub fn human(mut self, human: bool) -> Self {
5768        self.human = Some(human);
5769        self
5770    }
5771    #[doc = "Whether specified concrete indices should be ignored when unavailable (missing or closed)"]
5772    pub fn ignore_unavailable(mut self, ignore_unavailable: bool) -> Self {
5773        self.ignore_unavailable = Some(ignore_unavailable);
5774        self
5775    }
5776    #[doc = "Whether a type should be expected in the body of the mappings."]
5777    pub fn include_type_name(mut self, include_type_name: bool) -> Self {
5778        self.include_type_name = Some(include_type_name);
5779        self
5780    }
5781    #[doc = "Specify timeout for connection to master"]
5782    pub fn master_timeout(mut self, master_timeout: &'b str) -> Self {
5783        self.master_timeout = Some(master_timeout);
5784        self
5785    }
5786    #[doc = "Pretty format the returned JSON response."]
5787    pub fn pretty(mut self, pretty: bool) -> Self {
5788        self.pretty = Some(pretty);
5789        self
5790    }
5791    #[doc = "Sets a request timeout for this API call.\n\nThe timeout is applied from when the request starts connecting until the response body has finished."]
5792    pub fn request_timeout(mut self, timeout: Duration) -> Self {
5793        self.request_timeout = Some(timeout);
5794        self
5795    }
5796    #[doc = "The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests."]
5797    pub fn source(mut self, source: &'b str) -> Self {
5798        self.source = Some(source);
5799        self
5800    }
5801    #[doc = "Explicit operation timeout"]
5802    pub fn timeout(mut self, timeout: &'b str) -> Self {
5803        self.timeout = Some(timeout);
5804        self
5805    }
5806    #[doc = "When true, applies mappings only to the write index of an alias or data stream"]
5807    pub fn write_index_only(mut self, write_index_only: bool) -> Self {
5808        self.write_index_only = Some(write_index_only);
5809        self
5810    }
5811    #[doc = "Creates an asynchronous call to the Indices Put Mapping API that can be awaited"]
5812    pub async fn send(self) -> Result<Response, Error> {
5813        let path = self.parts.url();
5814        let method = Method::Put;
5815        let headers = self.headers;
5816        let timeout = self.request_timeout;
5817        let query_string = {
5818            #[serde_with::skip_serializing_none]
5819            #[derive(Serialize)]
5820            struct QueryParams<'b> {
5821                allow_no_indices: Option<bool>,
5822                error_trace: Option<bool>,
5823                #[serde(serialize_with = "crate::client::serialize_coll_qs")]
5824                expand_wildcards: Option<&'b [ExpandWildcards]>,
5825                #[serde(serialize_with = "crate::client::serialize_coll_qs")]
5826                filter_path: Option<&'b [&'b str]>,
5827                human: Option<bool>,
5828                ignore_unavailable: Option<bool>,
5829                include_type_name: Option<bool>,
5830                master_timeout: Option<&'b str>,
5831                pretty: Option<bool>,
5832                source: Option<&'b str>,
5833                timeout: Option<&'b str>,
5834                write_index_only: Option<bool>,
5835            }
5836            let query_params = QueryParams {
5837                allow_no_indices: self.allow_no_indices,
5838                error_trace: self.error_trace,
5839                expand_wildcards: self.expand_wildcards,
5840                filter_path: self.filter_path,
5841                human: self.human,
5842                ignore_unavailable: self.ignore_unavailable,
5843                include_type_name: self.include_type_name,
5844                master_timeout: self.master_timeout,
5845                pretty: self.pretty,
5846                source: self.source,
5847                timeout: self.timeout,
5848                write_index_only: self.write_index_only,
5849            };
5850            Some(query_params)
5851        };
5852        let body = self.body;
5853        let response = self
5854            .transport
5855            .send(method, &path, headers, query_string.as_ref(), body, timeout)
5856            .await?;
5857        Ok(response)
5858    }
5859}
5860#[derive(Debug, Clone, PartialEq)]
5861#[doc = "API parts for the Indices Put Settings API"]
5862pub enum IndicesPutSettingsParts<'b> {
5863    #[doc = "No parts"]
5864    None,
5865    #[doc = "Index"]
5866    Index(&'b [&'b str]),
5867}
5868impl<'b> IndicesPutSettingsParts<'b> {
5869    #[doc = "Builds a relative URL path to the Indices Put Settings API"]
5870    pub fn url(self) -> Cow<'static, str> {
5871        match self {
5872            IndicesPutSettingsParts::None => "/_settings".into(),
5873            IndicesPutSettingsParts::Index(ref index) => {
5874                let index_str = index.join(",");
5875                let encoded_index: Cow<str> =
5876                    percent_encode(index_str.as_bytes(), PARTS_ENCODED).into();
5877                let mut p = String::with_capacity(11usize + encoded_index.len());
5878                p.push_str("/");
5879                p.push_str(encoded_index.as_ref());
5880                p.push_str("/_settings");
5881                p.into()
5882            }
5883        }
5884    }
5885}
5886#[doc = "Builder for the [Indices Put Settings API](https://opensearch.org/docs/)\n\nUpdates the index settings."]
5887#[derive(Clone, Debug)]
5888pub struct IndicesPutSettings<'a, 'b, B> {
5889    transport: &'a Transport,
5890    parts: IndicesPutSettingsParts<'b>,
5891    allow_no_indices: Option<bool>,
5892    body: Option<B>,
5893    error_trace: Option<bool>,
5894    expand_wildcards: Option<&'b [ExpandWildcards]>,
5895    filter_path: Option<&'b [&'b str]>,
5896    flat_settings: Option<bool>,
5897    headers: HeaderMap,
5898    human: Option<bool>,
5899    ignore_unavailable: Option<bool>,
5900    master_timeout: Option<&'b str>,
5901    preserve_existing: Option<bool>,
5902    pretty: Option<bool>,
5903    request_timeout: Option<Duration>,
5904    source: Option<&'b str>,
5905    timeout: Option<&'b str>,
5906}
5907impl<'a, 'b, B> IndicesPutSettings<'a, 'b, B>
5908where
5909    B: Body,
5910{
5911    #[doc = "Creates a new instance of [IndicesPutSettings] with the specified API parts"]
5912    pub fn new(transport: &'a Transport, parts: IndicesPutSettingsParts<'b>) -> Self {
5913        let headers = HeaderMap::new();
5914        IndicesPutSettings {
5915            transport,
5916            parts,
5917            headers,
5918            allow_no_indices: None,
5919            body: None,
5920            error_trace: None,
5921            expand_wildcards: None,
5922            filter_path: None,
5923            flat_settings: None,
5924            human: None,
5925            ignore_unavailable: None,
5926            master_timeout: None,
5927            preserve_existing: None,
5928            pretty: None,
5929            request_timeout: None,
5930            source: None,
5931            timeout: None,
5932        }
5933    }
5934    #[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)"]
5935    pub fn allow_no_indices(mut self, allow_no_indices: bool) -> Self {
5936        self.allow_no_indices = Some(allow_no_indices);
5937        self
5938    }
5939    #[doc = "The body for the API call"]
5940    pub fn body<T>(self, body: T) -> IndicesPutSettings<'a, 'b, JsonBody<T>>
5941    where
5942        T: Serialize,
5943    {
5944        IndicesPutSettings {
5945            transport: self.transport,
5946            parts: self.parts,
5947            body: Some(body.into()),
5948            allow_no_indices: self.allow_no_indices,
5949            error_trace: self.error_trace,
5950            expand_wildcards: self.expand_wildcards,
5951            filter_path: self.filter_path,
5952            flat_settings: self.flat_settings,
5953            headers: self.headers,
5954            human: self.human,
5955            ignore_unavailable: self.ignore_unavailable,
5956            master_timeout: self.master_timeout,
5957            preserve_existing: self.preserve_existing,
5958            pretty: self.pretty,
5959            request_timeout: self.request_timeout,
5960            source: self.source,
5961            timeout: self.timeout,
5962        }
5963    }
5964    #[doc = "Include the stack trace of returned errors."]
5965    pub fn error_trace(mut self, error_trace: bool) -> Self {
5966        self.error_trace = Some(error_trace);
5967        self
5968    }
5969    #[doc = "Whether to expand wildcard expression to concrete indices that are open, closed or both."]
5970    pub fn expand_wildcards(mut self, expand_wildcards: &'b [ExpandWildcards]) -> Self {
5971        self.expand_wildcards = Some(expand_wildcards);
5972        self
5973    }
5974    #[doc = "A comma-separated list of filters used to reduce the response."]
5975    pub fn filter_path(mut self, filter_path: &'b [&'b str]) -> Self {
5976        self.filter_path = Some(filter_path);
5977        self
5978    }
5979    #[doc = "Return settings in flat format (default: false)"]
5980    pub fn flat_settings(mut self, flat_settings: bool) -> Self {
5981        self.flat_settings = Some(flat_settings);
5982        self
5983    }
5984    #[doc = "Adds a HTTP header"]
5985    pub fn header(mut self, key: HeaderName, value: HeaderValue) -> Self {
5986        self.headers.insert(key, value);
5987        self
5988    }
5989    #[doc = "Return human readable values for statistics."]
5990    pub fn human(mut self, human: bool) -> Self {
5991        self.human = Some(human);
5992        self
5993    }
5994    #[doc = "Whether specified concrete indices should be ignored when unavailable (missing or closed)"]
5995    pub fn ignore_unavailable(mut self, ignore_unavailable: bool) -> Self {
5996        self.ignore_unavailable = Some(ignore_unavailable);
5997        self
5998    }
5999    #[doc = "Specify timeout for connection to master"]
6000    pub fn master_timeout(mut self, master_timeout: &'b str) -> Self {
6001        self.master_timeout = Some(master_timeout);
6002        self
6003    }
6004    #[doc = "Whether to update existing settings. If set to `true` existing settings on an index remain unchanged, the default is `false`"]
6005    pub fn preserve_existing(mut self, preserve_existing: bool) -> Self {
6006        self.preserve_existing = Some(preserve_existing);
6007        self
6008    }
6009    #[doc = "Pretty format the returned JSON response."]
6010    pub fn pretty(mut self, pretty: bool) -> Self {
6011        self.pretty = Some(pretty);
6012        self
6013    }
6014    #[doc = "Sets a request timeout for this API call.\n\nThe timeout is applied from when the request starts connecting until the response body has finished."]
6015    pub fn request_timeout(mut self, timeout: Duration) -> Self {
6016        self.request_timeout = Some(timeout);
6017        self
6018    }
6019    #[doc = "The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests."]
6020    pub fn source(mut self, source: &'b str) -> Self {
6021        self.source = Some(source);
6022        self
6023    }
6024    #[doc = "Explicit operation timeout"]
6025    pub fn timeout(mut self, timeout: &'b str) -> Self {
6026        self.timeout = Some(timeout);
6027        self
6028    }
6029    #[doc = "Creates an asynchronous call to the Indices Put Settings API that can be awaited"]
6030    pub async fn send(self) -> Result<Response, Error> {
6031        let path = self.parts.url();
6032        let method = Method::Put;
6033        let headers = self.headers;
6034        let timeout = self.request_timeout;
6035        let query_string = {
6036            #[serde_with::skip_serializing_none]
6037            #[derive(Serialize)]
6038            struct QueryParams<'b> {
6039                allow_no_indices: Option<bool>,
6040                error_trace: Option<bool>,
6041                #[serde(serialize_with = "crate::client::serialize_coll_qs")]
6042                expand_wildcards: Option<&'b [ExpandWildcards]>,
6043                #[serde(serialize_with = "crate::client::serialize_coll_qs")]
6044                filter_path: Option<&'b [&'b str]>,
6045                flat_settings: Option<bool>,
6046                human: Option<bool>,
6047                ignore_unavailable: Option<bool>,
6048                master_timeout: Option<&'b str>,
6049                preserve_existing: Option<bool>,
6050                pretty: Option<bool>,
6051                source: Option<&'b str>,
6052                timeout: Option<&'b str>,
6053            }
6054            let query_params = QueryParams {
6055                allow_no_indices: self.allow_no_indices,
6056                error_trace: self.error_trace,
6057                expand_wildcards: self.expand_wildcards,
6058                filter_path: self.filter_path,
6059                flat_settings: self.flat_settings,
6060                human: self.human,
6061                ignore_unavailable: self.ignore_unavailable,
6062                master_timeout: self.master_timeout,
6063                preserve_existing: self.preserve_existing,
6064                pretty: self.pretty,
6065                source: self.source,
6066                timeout: self.timeout,
6067            };
6068            Some(query_params)
6069        };
6070        let body = self.body;
6071        let response = self
6072            .transport
6073            .send(method, &path, headers, query_string.as_ref(), body, timeout)
6074            .await?;
6075        Ok(response)
6076    }
6077}
6078#[derive(Debug, Clone, PartialEq)]
6079#[doc = "API parts for the Indices Put Template API"]
6080pub enum IndicesPutTemplateParts<'b> {
6081    #[doc = "Name"]
6082    Name(&'b str),
6083}
6084impl<'b> IndicesPutTemplateParts<'b> {
6085    #[doc = "Builds a relative URL path to the Indices Put Template API"]
6086    pub fn url(self) -> Cow<'static, str> {
6087        match self {
6088            IndicesPutTemplateParts::Name(ref name) => {
6089                let encoded_name: Cow<str> = percent_encode(name.as_bytes(), PARTS_ENCODED).into();
6090                let mut p = String::with_capacity(11usize + encoded_name.len());
6091                p.push_str("/_template/");
6092                p.push_str(encoded_name.as_ref());
6093                p.into()
6094            }
6095        }
6096    }
6097}
6098#[doc = "Builder for the [Indices Put Template API](https://opensearch.org/docs/)\n\nCreates or updates an index template."]
6099#[derive(Clone, Debug)]
6100pub struct IndicesPutTemplate<'a, 'b, B> {
6101    transport: &'a Transport,
6102    parts: IndicesPutTemplateParts<'b>,
6103    body: Option<B>,
6104    create: Option<bool>,
6105    error_trace: Option<bool>,
6106    filter_path: Option<&'b [&'b str]>,
6107    headers: HeaderMap,
6108    human: Option<bool>,
6109    include_type_name: Option<bool>,
6110    master_timeout: Option<&'b str>,
6111    order: Option<i64>,
6112    pretty: Option<bool>,
6113    request_timeout: Option<Duration>,
6114    source: Option<&'b str>,
6115}
6116impl<'a, 'b, B> IndicesPutTemplate<'a, 'b, B>
6117where
6118    B: Body,
6119{
6120    #[doc = "Creates a new instance of [IndicesPutTemplate] with the specified API parts"]
6121    pub fn new(transport: &'a Transport, parts: IndicesPutTemplateParts<'b>) -> Self {
6122        let headers = HeaderMap::new();
6123        IndicesPutTemplate {
6124            transport,
6125            parts,
6126            headers,
6127            body: None,
6128            create: None,
6129            error_trace: None,
6130            filter_path: None,
6131            human: None,
6132            include_type_name: None,
6133            master_timeout: None,
6134            order: None,
6135            pretty: None,
6136            request_timeout: None,
6137            source: None,
6138        }
6139    }
6140    #[doc = "The body for the API call"]
6141    pub fn body<T>(self, body: T) -> IndicesPutTemplate<'a, 'b, JsonBody<T>>
6142    where
6143        T: Serialize,
6144    {
6145        IndicesPutTemplate {
6146            transport: self.transport,
6147            parts: self.parts,
6148            body: Some(body.into()),
6149            create: self.create,
6150            error_trace: self.error_trace,
6151            filter_path: self.filter_path,
6152            headers: self.headers,
6153            human: self.human,
6154            include_type_name: self.include_type_name,
6155            master_timeout: self.master_timeout,
6156            order: self.order,
6157            pretty: self.pretty,
6158            request_timeout: self.request_timeout,
6159            source: self.source,
6160        }
6161    }
6162    #[doc = "Whether the index template should only be added if new or can also replace an existing one"]
6163    pub fn create(mut self, create: bool) -> Self {
6164        self.create = Some(create);
6165        self
6166    }
6167    #[doc = "Include the stack trace of returned errors."]
6168    pub fn error_trace(mut self, error_trace: bool) -> Self {
6169        self.error_trace = Some(error_trace);
6170        self
6171    }
6172    #[doc = "A comma-separated list of filters used to reduce the response."]
6173    pub fn filter_path(mut self, filter_path: &'b [&'b str]) -> Self {
6174        self.filter_path = Some(filter_path);
6175        self
6176    }
6177    #[doc = "Adds a HTTP header"]
6178    pub fn header(mut self, key: HeaderName, value: HeaderValue) -> Self {
6179        self.headers.insert(key, value);
6180        self
6181    }
6182    #[doc = "Return human readable values for statistics."]
6183    pub fn human(mut self, human: bool) -> Self {
6184        self.human = Some(human);
6185        self
6186    }
6187    #[doc = "Whether a type should be returned in the body of the mappings."]
6188    pub fn include_type_name(mut self, include_type_name: bool) -> Self {
6189        self.include_type_name = Some(include_type_name);
6190        self
6191    }
6192    #[doc = "Specify timeout for connection to master"]
6193    pub fn master_timeout(mut self, master_timeout: &'b str) -> Self {
6194        self.master_timeout = Some(master_timeout);
6195        self
6196    }
6197    #[doc = "The order for this template when merging multiple matching ones (higher numbers are merged later, overriding the lower numbers)"]
6198    pub fn order(mut self, order: i64) -> Self {
6199        self.order = Some(order);
6200        self
6201    }
6202    #[doc = "Pretty format the returned JSON response."]
6203    pub fn pretty(mut self, pretty: bool) -> Self {
6204        self.pretty = Some(pretty);
6205        self
6206    }
6207    #[doc = "Sets a request timeout for this API call.\n\nThe timeout is applied from when the request starts connecting until the response body has finished."]
6208    pub fn request_timeout(mut self, timeout: Duration) -> Self {
6209        self.request_timeout = Some(timeout);
6210        self
6211    }
6212    #[doc = "The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests."]
6213    pub fn source(mut self, source: &'b str) -> Self {
6214        self.source = Some(source);
6215        self
6216    }
6217    #[doc = "Creates an asynchronous call to the Indices Put Template API that can be awaited"]
6218    pub async fn send(self) -> Result<Response, Error> {
6219        let path = self.parts.url();
6220        let method = Method::Put;
6221        let headers = self.headers;
6222        let timeout = self.request_timeout;
6223        let query_string = {
6224            #[serde_with::skip_serializing_none]
6225            #[derive(Serialize)]
6226            struct QueryParams<'b> {
6227                create: Option<bool>,
6228                error_trace: Option<bool>,
6229                #[serde(serialize_with = "crate::client::serialize_coll_qs")]
6230                filter_path: Option<&'b [&'b str]>,
6231                human: Option<bool>,
6232                include_type_name: Option<bool>,
6233                master_timeout: Option<&'b str>,
6234                order: Option<i64>,
6235                pretty: Option<bool>,
6236                source: Option<&'b str>,
6237            }
6238            let query_params = QueryParams {
6239                create: self.create,
6240                error_trace: self.error_trace,
6241                filter_path: self.filter_path,
6242                human: self.human,
6243                include_type_name: self.include_type_name,
6244                master_timeout: self.master_timeout,
6245                order: self.order,
6246                pretty: self.pretty,
6247                source: self.source,
6248            };
6249            Some(query_params)
6250        };
6251        let body = self.body;
6252        let response = self
6253            .transport
6254            .send(method, &path, headers, query_string.as_ref(), body, timeout)
6255            .await?;
6256        Ok(response)
6257    }
6258}
6259#[derive(Debug, Clone, PartialEq)]
6260#[doc = "API parts for the Indices Recovery API"]
6261pub enum IndicesRecoveryParts<'b> {
6262    #[doc = "No parts"]
6263    None,
6264    #[doc = "Index"]
6265    Index(&'b [&'b str]),
6266}
6267impl<'b> IndicesRecoveryParts<'b> {
6268    #[doc = "Builds a relative URL path to the Indices Recovery API"]
6269    pub fn url(self) -> Cow<'static, str> {
6270        match self {
6271            IndicesRecoveryParts::None => "/_recovery".into(),
6272            IndicesRecoveryParts::Index(ref index) => {
6273                let index_str = index.join(",");
6274                let encoded_index: Cow<str> =
6275                    percent_encode(index_str.as_bytes(), PARTS_ENCODED).into();
6276                let mut p = String::with_capacity(11usize + encoded_index.len());
6277                p.push_str("/");
6278                p.push_str(encoded_index.as_ref());
6279                p.push_str("/_recovery");
6280                p.into()
6281            }
6282        }
6283    }
6284}
6285#[doc = "Builder for the [Indices Recovery API](https://opensearch.org/docs/)\n\nReturns information about ongoing index shard recoveries."]
6286#[derive(Clone, Debug)]
6287pub struct IndicesRecovery<'a, 'b> {
6288    transport: &'a Transport,
6289    parts: IndicesRecoveryParts<'b>,
6290    active_only: Option<bool>,
6291    detailed: Option<bool>,
6292    error_trace: Option<bool>,
6293    filter_path: Option<&'b [&'b str]>,
6294    headers: HeaderMap,
6295    human: Option<bool>,
6296    pretty: Option<bool>,
6297    request_timeout: Option<Duration>,
6298    source: Option<&'b str>,
6299}
6300impl<'a, 'b> IndicesRecovery<'a, 'b> {
6301    #[doc = "Creates a new instance of [IndicesRecovery] with the specified API parts"]
6302    pub fn new(transport: &'a Transport, parts: IndicesRecoveryParts<'b>) -> Self {
6303        let headers = HeaderMap::new();
6304        IndicesRecovery {
6305            transport,
6306            parts,
6307            headers,
6308            active_only: None,
6309            detailed: None,
6310            error_trace: None,
6311            filter_path: None,
6312            human: None,
6313            pretty: None,
6314            request_timeout: None,
6315            source: None,
6316        }
6317    }
6318    #[doc = "Display only those recoveries that are currently on-going"]
6319    pub fn active_only(mut self, active_only: bool) -> Self {
6320        self.active_only = Some(active_only);
6321        self
6322    }
6323    #[doc = "Whether to display detailed information about shard recovery"]
6324    pub fn detailed(mut self, detailed: bool) -> Self {
6325        self.detailed = Some(detailed);
6326        self
6327    }
6328    #[doc = "Include the stack trace of returned errors."]
6329    pub fn error_trace(mut self, error_trace: bool) -> Self {
6330        self.error_trace = Some(error_trace);
6331        self
6332    }
6333    #[doc = "A comma-separated list of filters used to reduce the response."]
6334    pub fn filter_path(mut self, filter_path: &'b [&'b str]) -> Self {
6335        self.filter_path = Some(filter_path);
6336        self
6337    }
6338    #[doc = "Adds a HTTP header"]
6339    pub fn header(mut self, key: HeaderName, value: HeaderValue) -> Self {
6340        self.headers.insert(key, value);
6341        self
6342    }
6343    #[doc = "Return human readable values for statistics."]
6344    pub fn human(mut self, human: bool) -> Self {
6345        self.human = Some(human);
6346        self
6347    }
6348    #[doc = "Pretty format the returned JSON response."]
6349    pub fn pretty(mut self, pretty: bool) -> Self {
6350        self.pretty = Some(pretty);
6351        self
6352    }
6353    #[doc = "Sets a request timeout for this API call.\n\nThe timeout is applied from when the request starts connecting until the response body has finished."]
6354    pub fn request_timeout(mut self, timeout: Duration) -> Self {
6355        self.request_timeout = Some(timeout);
6356        self
6357    }
6358    #[doc = "The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests."]
6359    pub fn source(mut self, source: &'b str) -> Self {
6360        self.source = Some(source);
6361        self
6362    }
6363    #[doc = "Creates an asynchronous call to the Indices Recovery API that can be awaited"]
6364    pub async fn send(self) -> Result<Response, Error> {
6365        let path = self.parts.url();
6366        let method = Method::Get;
6367        let headers = self.headers;
6368        let timeout = self.request_timeout;
6369        let query_string = {
6370            #[serde_with::skip_serializing_none]
6371            #[derive(Serialize)]
6372            struct QueryParams<'b> {
6373                active_only: Option<bool>,
6374                detailed: Option<bool>,
6375                error_trace: Option<bool>,
6376                #[serde(serialize_with = "crate::client::serialize_coll_qs")]
6377                filter_path: Option<&'b [&'b str]>,
6378                human: Option<bool>,
6379                pretty: Option<bool>,
6380                source: Option<&'b str>,
6381            }
6382            let query_params = QueryParams {
6383                active_only: self.active_only,
6384                detailed: self.detailed,
6385                error_trace: self.error_trace,
6386                filter_path: self.filter_path,
6387                human: self.human,
6388                pretty: self.pretty,
6389                source: self.source,
6390            };
6391            Some(query_params)
6392        };
6393        let body = Option::<()>::None;
6394        let response = self
6395            .transport
6396            .send(method, &path, headers, query_string.as_ref(), body, timeout)
6397            .await?;
6398        Ok(response)
6399    }
6400}
6401#[derive(Debug, Clone, PartialEq)]
6402#[doc = "API parts for the Indices Refresh API"]
6403pub enum IndicesRefreshParts<'b> {
6404    #[doc = "No parts"]
6405    None,
6406    #[doc = "Index"]
6407    Index(&'b [&'b str]),
6408}
6409impl<'b> IndicesRefreshParts<'b> {
6410    #[doc = "Builds a relative URL path to the Indices Refresh API"]
6411    pub fn url(self) -> Cow<'static, str> {
6412        match self {
6413            IndicesRefreshParts::None => "/_refresh".into(),
6414            IndicesRefreshParts::Index(ref index) => {
6415                let index_str = index.join(",");
6416                let encoded_index: Cow<str> =
6417                    percent_encode(index_str.as_bytes(), PARTS_ENCODED).into();
6418                let mut p = String::with_capacity(10usize + encoded_index.len());
6419                p.push_str("/");
6420                p.push_str(encoded_index.as_ref());
6421                p.push_str("/_refresh");
6422                p.into()
6423            }
6424        }
6425    }
6426}
6427#[doc = "Builder for the [Indices Refresh API](https://opensearch.org/docs/)\n\nPerforms the refresh operation in one or more indices."]
6428#[derive(Clone, Debug)]
6429pub struct IndicesRefresh<'a, 'b, B> {
6430    transport: &'a Transport,
6431    parts: IndicesRefreshParts<'b>,
6432    allow_no_indices: Option<bool>,
6433    body: Option<B>,
6434    error_trace: Option<bool>,
6435    expand_wildcards: Option<&'b [ExpandWildcards]>,
6436    filter_path: Option<&'b [&'b str]>,
6437    headers: HeaderMap,
6438    human: Option<bool>,
6439    ignore_unavailable: Option<bool>,
6440    pretty: Option<bool>,
6441    request_timeout: Option<Duration>,
6442    source: Option<&'b str>,
6443}
6444impl<'a, 'b, B> IndicesRefresh<'a, 'b, B>
6445where
6446    B: Body,
6447{
6448    #[doc = "Creates a new instance of [IndicesRefresh] with the specified API parts"]
6449    pub fn new(transport: &'a Transport, parts: IndicesRefreshParts<'b>) -> Self {
6450        let headers = HeaderMap::new();
6451        IndicesRefresh {
6452            transport,
6453            parts,
6454            headers,
6455            allow_no_indices: None,
6456            body: None,
6457            error_trace: None,
6458            expand_wildcards: None,
6459            filter_path: None,
6460            human: None,
6461            ignore_unavailable: None,
6462            pretty: None,
6463            request_timeout: None,
6464            source: None,
6465        }
6466    }
6467    #[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)"]
6468    pub fn allow_no_indices(mut self, allow_no_indices: bool) -> Self {
6469        self.allow_no_indices = Some(allow_no_indices);
6470        self
6471    }
6472    #[doc = "The body for the API call"]
6473    pub fn body<T>(self, body: T) -> IndicesRefresh<'a, 'b, JsonBody<T>>
6474    where
6475        T: Serialize,
6476    {
6477        IndicesRefresh {
6478            transport: self.transport,
6479            parts: self.parts,
6480            body: Some(body.into()),
6481            allow_no_indices: self.allow_no_indices,
6482            error_trace: self.error_trace,
6483            expand_wildcards: self.expand_wildcards,
6484            filter_path: self.filter_path,
6485            headers: self.headers,
6486            human: self.human,
6487            ignore_unavailable: self.ignore_unavailable,
6488            pretty: self.pretty,
6489            request_timeout: self.request_timeout,
6490            source: self.source,
6491        }
6492    }
6493    #[doc = "Include the stack trace of returned errors."]
6494    pub fn error_trace(mut self, error_trace: bool) -> Self {
6495        self.error_trace = Some(error_trace);
6496        self
6497    }
6498    #[doc = "Whether to expand wildcard expression to concrete indices that are open, closed or both."]
6499    pub fn expand_wildcards(mut self, expand_wildcards: &'b [ExpandWildcards]) -> Self {
6500        self.expand_wildcards = Some(expand_wildcards);
6501        self
6502    }
6503    #[doc = "A comma-separated list of filters used to reduce the response."]
6504    pub fn filter_path(mut self, filter_path: &'b [&'b str]) -> Self {
6505        self.filter_path = Some(filter_path);
6506        self
6507    }
6508    #[doc = "Adds a HTTP header"]
6509    pub fn header(mut self, key: HeaderName, value: HeaderValue) -> Self {
6510        self.headers.insert(key, value);
6511        self
6512    }
6513    #[doc = "Return human readable values for statistics."]
6514    pub fn human(mut self, human: bool) -> Self {
6515        self.human = Some(human);
6516        self
6517    }
6518    #[doc = "Whether specified concrete indices should be ignored when unavailable (missing or closed)"]
6519    pub fn ignore_unavailable(mut self, ignore_unavailable: bool) -> Self {
6520        self.ignore_unavailable = Some(ignore_unavailable);
6521        self
6522    }
6523    #[doc = "Pretty format the returned JSON response."]
6524    pub fn pretty(mut self, pretty: bool) -> Self {
6525        self.pretty = Some(pretty);
6526        self
6527    }
6528    #[doc = "Sets a request timeout for this API call.\n\nThe timeout is applied from when the request starts connecting until the response body has finished."]
6529    pub fn request_timeout(mut self, timeout: Duration) -> Self {
6530        self.request_timeout = Some(timeout);
6531        self
6532    }
6533    #[doc = "The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests."]
6534    pub fn source(mut self, source: &'b str) -> Self {
6535        self.source = Some(source);
6536        self
6537    }
6538    #[doc = "Creates an asynchronous call to the Indices Refresh API that can be awaited"]
6539    pub async fn send(self) -> Result<Response, Error> {
6540        let path = self.parts.url();
6541        let method = match self.body {
6542            Some(_) => Method::Post,
6543            None => Method::Get,
6544        };
6545        let headers = self.headers;
6546        let timeout = self.request_timeout;
6547        let query_string = {
6548            #[serde_with::skip_serializing_none]
6549            #[derive(Serialize)]
6550            struct QueryParams<'b> {
6551                allow_no_indices: Option<bool>,
6552                error_trace: Option<bool>,
6553                #[serde(serialize_with = "crate::client::serialize_coll_qs")]
6554                expand_wildcards: Option<&'b [ExpandWildcards]>,
6555                #[serde(serialize_with = "crate::client::serialize_coll_qs")]
6556                filter_path: Option<&'b [&'b str]>,
6557                human: Option<bool>,
6558                ignore_unavailable: Option<bool>,
6559                pretty: Option<bool>,
6560                source: Option<&'b str>,
6561            }
6562            let query_params = QueryParams {
6563                allow_no_indices: self.allow_no_indices,
6564                error_trace: self.error_trace,
6565                expand_wildcards: self.expand_wildcards,
6566                filter_path: self.filter_path,
6567                human: self.human,
6568                ignore_unavailable: self.ignore_unavailable,
6569                pretty: self.pretty,
6570                source: self.source,
6571            };
6572            Some(query_params)
6573        };
6574        let body = self.body;
6575        let response = self
6576            .transport
6577            .send(method, &path, headers, query_string.as_ref(), body, timeout)
6578            .await?;
6579        Ok(response)
6580    }
6581}
6582#[derive(Debug, Clone, PartialEq)]
6583#[doc = "API parts for the Indices Reload Search Analyzers API"]
6584pub enum IndicesReloadSearchAnalyzersParts<'b> {
6585    #[doc = "Index"]
6586    Index(&'b [&'b str]),
6587}
6588impl<'b> IndicesReloadSearchAnalyzersParts<'b> {
6589    #[doc = "Builds a relative URL path to the Indices Reload Search Analyzers API"]
6590    pub fn url(self) -> Cow<'static, str> {
6591        match self {
6592            IndicesReloadSearchAnalyzersParts::Index(ref index) => {
6593                let index_str = index.join(",");
6594                let encoded_index: Cow<str> =
6595                    percent_encode(index_str.as_bytes(), PARTS_ENCODED).into();
6596                let mut p = String::with_capacity(26usize + encoded_index.len());
6597                p.push_str("/");
6598                p.push_str(encoded_index.as_ref());
6599                p.push_str("/_reload_search_analyzers");
6600                p.into()
6601            }
6602        }
6603    }
6604}
6605#[doc = "Builder for the [Indices Reload Search Analyzers API](https://opensearch.org/docs/)\n\nReloads an index's search analyzers and their resources."]
6606#[derive(Clone, Debug)]
6607pub struct IndicesReloadSearchAnalyzers<'a, 'b, B> {
6608    transport: &'a Transport,
6609    parts: IndicesReloadSearchAnalyzersParts<'b>,
6610    allow_no_indices: Option<bool>,
6611    body: Option<B>,
6612    error_trace: Option<bool>,
6613    expand_wildcards: Option<&'b [ExpandWildcards]>,
6614    filter_path: Option<&'b [&'b str]>,
6615    headers: HeaderMap,
6616    human: Option<bool>,
6617    ignore_unavailable: Option<bool>,
6618    pretty: Option<bool>,
6619    request_timeout: Option<Duration>,
6620    source: Option<&'b str>,
6621}
6622impl<'a, 'b, B> IndicesReloadSearchAnalyzers<'a, 'b, B>
6623where
6624    B: Body,
6625{
6626    #[doc = "Creates a new instance of [IndicesReloadSearchAnalyzers] with the specified API parts"]
6627    pub fn new(transport: &'a Transport, parts: IndicesReloadSearchAnalyzersParts<'b>) -> Self {
6628        let headers = HeaderMap::new();
6629        IndicesReloadSearchAnalyzers {
6630            transport,
6631            parts,
6632            headers,
6633            allow_no_indices: None,
6634            body: None,
6635            error_trace: None,
6636            expand_wildcards: None,
6637            filter_path: None,
6638            human: None,
6639            ignore_unavailable: None,
6640            pretty: None,
6641            request_timeout: None,
6642            source: None,
6643        }
6644    }
6645    #[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)"]
6646    pub fn allow_no_indices(mut self, allow_no_indices: bool) -> Self {
6647        self.allow_no_indices = Some(allow_no_indices);
6648        self
6649    }
6650    #[doc = "The body for the API call"]
6651    pub fn body<T>(self, body: T) -> IndicesReloadSearchAnalyzers<'a, 'b, JsonBody<T>>
6652    where
6653        T: Serialize,
6654    {
6655        IndicesReloadSearchAnalyzers {
6656            transport: self.transport,
6657            parts: self.parts,
6658            body: Some(body.into()),
6659            allow_no_indices: self.allow_no_indices,
6660            error_trace: self.error_trace,
6661            expand_wildcards: self.expand_wildcards,
6662            filter_path: self.filter_path,
6663            headers: self.headers,
6664            human: self.human,
6665            ignore_unavailable: self.ignore_unavailable,
6666            pretty: self.pretty,
6667            request_timeout: self.request_timeout,
6668            source: self.source,
6669        }
6670    }
6671    #[doc = "Include the stack trace of returned errors."]
6672    pub fn error_trace(mut self, error_trace: bool) -> Self {
6673        self.error_trace = Some(error_trace);
6674        self
6675    }
6676    #[doc = "Whether to expand wildcard expression to concrete indices that are open, closed or both."]
6677    pub fn expand_wildcards(mut self, expand_wildcards: &'b [ExpandWildcards]) -> Self {
6678        self.expand_wildcards = Some(expand_wildcards);
6679        self
6680    }
6681    #[doc = "A comma-separated list of filters used to reduce the response."]
6682    pub fn filter_path(mut self, filter_path: &'b [&'b str]) -> Self {
6683        self.filter_path = Some(filter_path);
6684        self
6685    }
6686    #[doc = "Adds a HTTP header"]
6687    pub fn header(mut self, key: HeaderName, value: HeaderValue) -> Self {
6688        self.headers.insert(key, value);
6689        self
6690    }
6691    #[doc = "Return human readable values for statistics."]
6692    pub fn human(mut self, human: bool) -> Self {
6693        self.human = Some(human);
6694        self
6695    }
6696    #[doc = "Whether specified concrete indices should be ignored when unavailable (missing or closed)"]
6697    pub fn ignore_unavailable(mut self, ignore_unavailable: bool) -> Self {
6698        self.ignore_unavailable = Some(ignore_unavailable);
6699        self
6700    }
6701    #[doc = "Pretty format the returned JSON response."]
6702    pub fn pretty(mut self, pretty: bool) -> Self {
6703        self.pretty = Some(pretty);
6704        self
6705    }
6706    #[doc = "Sets a request timeout for this API call.\n\nThe timeout is applied from when the request starts connecting until the response body has finished."]
6707    pub fn request_timeout(mut self, timeout: Duration) -> Self {
6708        self.request_timeout = Some(timeout);
6709        self
6710    }
6711    #[doc = "The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests."]
6712    pub fn source(mut self, source: &'b str) -> Self {
6713        self.source = Some(source);
6714        self
6715    }
6716    #[doc = "Creates an asynchronous call to the Indices Reload Search Analyzers API that can be awaited"]
6717    pub async fn send(self) -> Result<Response, Error> {
6718        let path = self.parts.url();
6719        let method = match self.body {
6720            Some(_) => Method::Post,
6721            None => Method::Get,
6722        };
6723        let headers = self.headers;
6724        let timeout = self.request_timeout;
6725        let query_string = {
6726            #[serde_with::skip_serializing_none]
6727            #[derive(Serialize)]
6728            struct QueryParams<'b> {
6729                allow_no_indices: Option<bool>,
6730                error_trace: Option<bool>,
6731                #[serde(serialize_with = "crate::client::serialize_coll_qs")]
6732                expand_wildcards: Option<&'b [ExpandWildcards]>,
6733                #[serde(serialize_with = "crate::client::serialize_coll_qs")]
6734                filter_path: Option<&'b [&'b str]>,
6735                human: Option<bool>,
6736                ignore_unavailable: Option<bool>,
6737                pretty: Option<bool>,
6738                source: Option<&'b str>,
6739            }
6740            let query_params = QueryParams {
6741                allow_no_indices: self.allow_no_indices,
6742                error_trace: self.error_trace,
6743                expand_wildcards: self.expand_wildcards,
6744                filter_path: self.filter_path,
6745                human: self.human,
6746                ignore_unavailable: self.ignore_unavailable,
6747                pretty: self.pretty,
6748                source: self.source,
6749            };
6750            Some(query_params)
6751        };
6752        let body = self.body;
6753        let response = self
6754            .transport
6755            .send(method, &path, headers, query_string.as_ref(), body, timeout)
6756            .await?;
6757        Ok(response)
6758    }
6759}
6760#[cfg(feature = "experimental-apis")]
6761#[derive(Debug, Clone, PartialEq)]
6762#[doc = "API parts for the Indices Resolve Index API"]
6763pub enum IndicesResolveIndexParts<'b> {
6764    #[doc = "Name"]
6765    Name(&'b [&'b str]),
6766}
6767#[cfg(feature = "experimental-apis")]
6768impl<'b> IndicesResolveIndexParts<'b> {
6769    #[doc = "Builds a relative URL path to the Indices Resolve Index API"]
6770    pub fn url(self) -> Cow<'static, str> {
6771        match self {
6772            IndicesResolveIndexParts::Name(ref name) => {
6773                let name_str = name.join(",");
6774                let encoded_name: Cow<str> =
6775                    percent_encode(name_str.as_bytes(), PARTS_ENCODED).into();
6776                let mut p = String::with_capacity(16usize + encoded_name.len());
6777                p.push_str("/_resolve/index/");
6778                p.push_str(encoded_name.as_ref());
6779                p.into()
6780            }
6781        }
6782    }
6783}
6784#[doc = "Builder for the [Indices Resolve Index API](https://opensearch.org/docs/)\n\nReturns information about any matching indices, aliases, and data streams"]
6785#[doc = "&nbsp;\n# Optional, experimental\nThis requires the `experimental-apis` feature. Can have breaking changes in future\nversions or might even be removed entirely.\n        "]
6786#[cfg(feature = "experimental-apis")]
6787#[derive(Clone, Debug)]
6788pub struct IndicesResolveIndex<'a, 'b> {
6789    transport: &'a Transport,
6790    parts: IndicesResolveIndexParts<'b>,
6791    error_trace: Option<bool>,
6792    expand_wildcards: Option<&'b [ExpandWildcards]>,
6793    filter_path: Option<&'b [&'b str]>,
6794    headers: HeaderMap,
6795    human: Option<bool>,
6796    pretty: Option<bool>,
6797    request_timeout: Option<Duration>,
6798    source: Option<&'b str>,
6799}
6800#[cfg(feature = "experimental-apis")]
6801impl<'a, 'b> IndicesResolveIndex<'a, 'b> {
6802    #[doc = "Creates a new instance of [IndicesResolveIndex] with the specified API parts"]
6803    pub fn new(transport: &'a Transport, parts: IndicesResolveIndexParts<'b>) -> Self {
6804        let headers = HeaderMap::new();
6805        IndicesResolveIndex {
6806            transport,
6807            parts,
6808            headers,
6809            error_trace: None,
6810            expand_wildcards: None,
6811            filter_path: None,
6812            human: None,
6813            pretty: None,
6814            request_timeout: None,
6815            source: None,
6816        }
6817    }
6818    #[doc = "Include the stack trace of returned errors."]
6819    pub fn error_trace(mut self, error_trace: bool) -> Self {
6820        self.error_trace = Some(error_trace);
6821        self
6822    }
6823    #[doc = "Whether wildcard expressions should get expanded to open or closed indices (default: open)"]
6824    pub fn expand_wildcards(mut self, expand_wildcards: &'b [ExpandWildcards]) -> Self {
6825        self.expand_wildcards = Some(expand_wildcards);
6826        self
6827    }
6828    #[doc = "A comma-separated list of filters used to reduce the response."]
6829    pub fn filter_path(mut self, filter_path: &'b [&'b str]) -> Self {
6830        self.filter_path = Some(filter_path);
6831        self
6832    }
6833    #[doc = "Adds a HTTP header"]
6834    pub fn header(mut self, key: HeaderName, value: HeaderValue) -> Self {
6835        self.headers.insert(key, value);
6836        self
6837    }
6838    #[doc = "Return human readable values for statistics."]
6839    pub fn human(mut self, human: bool) -> Self {
6840        self.human = Some(human);
6841        self
6842    }
6843    #[doc = "Pretty format the returned JSON response."]
6844    pub fn pretty(mut self, pretty: bool) -> Self {
6845        self.pretty = Some(pretty);
6846        self
6847    }
6848    #[doc = "Sets a request timeout for this API call.\n\nThe timeout is applied from when the request starts connecting until the response body has finished."]
6849    pub fn request_timeout(mut self, timeout: Duration) -> Self {
6850        self.request_timeout = Some(timeout);
6851        self
6852    }
6853    #[doc = "The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests."]
6854    pub fn source(mut self, source: &'b str) -> Self {
6855        self.source = Some(source);
6856        self
6857    }
6858    #[doc = "Creates an asynchronous call to the Indices Resolve Index API that can be awaited"]
6859    pub async fn send(self) -> Result<Response, Error> {
6860        let path = self.parts.url();
6861        let method = Method::Get;
6862        let headers = self.headers;
6863        let timeout = self.request_timeout;
6864        let query_string = {
6865            #[serde_with::skip_serializing_none]
6866            #[derive(Serialize)]
6867            struct QueryParams<'b> {
6868                error_trace: Option<bool>,
6869                #[serde(serialize_with = "crate::client::serialize_coll_qs")]
6870                expand_wildcards: Option<&'b [ExpandWildcards]>,
6871                #[serde(serialize_with = "crate::client::serialize_coll_qs")]
6872                filter_path: Option<&'b [&'b str]>,
6873                human: Option<bool>,
6874                pretty: Option<bool>,
6875                source: Option<&'b str>,
6876            }
6877            let query_params = QueryParams {
6878                error_trace: self.error_trace,
6879                expand_wildcards: self.expand_wildcards,
6880                filter_path: self.filter_path,
6881                human: self.human,
6882                pretty: self.pretty,
6883                source: self.source,
6884            };
6885            Some(query_params)
6886        };
6887        let body = Option::<()>::None;
6888        let response = self
6889            .transport
6890            .send(method, &path, headers, query_string.as_ref(), body, timeout)
6891            .await?;
6892        Ok(response)
6893    }
6894}
6895#[derive(Debug, Clone, PartialEq)]
6896#[doc = "API parts for the Indices Rollover API"]
6897pub enum IndicesRolloverParts<'b> {
6898    #[doc = "Alias"]
6899    Alias(&'b str),
6900    #[doc = "Alias and NewIndex"]
6901    AliasNewIndex(&'b str, &'b str),
6902}
6903impl<'b> IndicesRolloverParts<'b> {
6904    #[doc = "Builds a relative URL path to the Indices Rollover API"]
6905    pub fn url(self) -> Cow<'static, str> {
6906        match self {
6907            IndicesRolloverParts::Alias(ref alias) => {
6908                let encoded_alias: Cow<str> =
6909                    percent_encode(alias.as_bytes(), PARTS_ENCODED).into();
6910                let mut p = String::with_capacity(11usize + encoded_alias.len());
6911                p.push_str("/");
6912                p.push_str(encoded_alias.as_ref());
6913                p.push_str("/_rollover");
6914                p.into()
6915            }
6916            IndicesRolloverParts::AliasNewIndex(ref alias, ref new_index) => {
6917                let encoded_alias: Cow<str> =
6918                    percent_encode(alias.as_bytes(), PARTS_ENCODED).into();
6919                let encoded_new_index: Cow<str> =
6920                    percent_encode(new_index.as_bytes(), PARTS_ENCODED).into();
6921                let mut p =
6922                    String::with_capacity(12usize + encoded_alias.len() + encoded_new_index.len());
6923                p.push_str("/");
6924                p.push_str(encoded_alias.as_ref());
6925                p.push_str("/_rollover/");
6926                p.push_str(encoded_new_index.as_ref());
6927                p.into()
6928            }
6929        }
6930    }
6931}
6932#[doc = "Builder for the [Indices Rollover API](https://opensearch.org/docs/)\n\nUpdates an alias to point to a new index when the existing index\nis considered to be too large or too old."]
6933#[derive(Clone, Debug)]
6934pub struct IndicesRollover<'a, 'b, B> {
6935    transport: &'a Transport,
6936    parts: IndicesRolloverParts<'b>,
6937    body: Option<B>,
6938    dry_run: Option<bool>,
6939    error_trace: Option<bool>,
6940    filter_path: Option<&'b [&'b str]>,
6941    headers: HeaderMap,
6942    human: Option<bool>,
6943    include_type_name: Option<bool>,
6944    master_timeout: Option<&'b str>,
6945    pretty: Option<bool>,
6946    request_timeout: Option<Duration>,
6947    source: Option<&'b str>,
6948    timeout: Option<&'b str>,
6949    wait_for_active_shards: Option<&'b str>,
6950}
6951impl<'a, 'b, B> IndicesRollover<'a, 'b, B>
6952where
6953    B: Body,
6954{
6955    #[doc = "Creates a new instance of [IndicesRollover] with the specified API parts"]
6956    pub fn new(transport: &'a Transport, parts: IndicesRolloverParts<'b>) -> Self {
6957        let headers = HeaderMap::new();
6958        IndicesRollover {
6959            transport,
6960            parts,
6961            headers,
6962            body: None,
6963            dry_run: None,
6964            error_trace: None,
6965            filter_path: None,
6966            human: None,
6967            include_type_name: None,
6968            master_timeout: None,
6969            pretty: None,
6970            request_timeout: None,
6971            source: None,
6972            timeout: None,
6973            wait_for_active_shards: None,
6974        }
6975    }
6976    #[doc = "The body for the API call"]
6977    pub fn body<T>(self, body: T) -> IndicesRollover<'a, 'b, JsonBody<T>>
6978    where
6979        T: Serialize,
6980    {
6981        IndicesRollover {
6982            transport: self.transport,
6983            parts: self.parts,
6984            body: Some(body.into()),
6985            dry_run: self.dry_run,
6986            error_trace: self.error_trace,
6987            filter_path: self.filter_path,
6988            headers: self.headers,
6989            human: self.human,
6990            include_type_name: self.include_type_name,
6991            master_timeout: self.master_timeout,
6992            pretty: self.pretty,
6993            request_timeout: self.request_timeout,
6994            source: self.source,
6995            timeout: self.timeout,
6996            wait_for_active_shards: self.wait_for_active_shards,
6997        }
6998    }
6999    #[doc = "If set to true the rollover action will only be validated but not actually performed even if a condition matches. The default is false"]
7000    pub fn dry_run(mut self, dry_run: bool) -> Self {
7001        self.dry_run = Some(dry_run);
7002        self
7003    }
7004    #[doc = "Include the stack trace of returned errors."]
7005    pub fn error_trace(mut self, error_trace: bool) -> Self {
7006        self.error_trace = Some(error_trace);
7007        self
7008    }
7009    #[doc = "A comma-separated list of filters used to reduce the response."]
7010    pub fn filter_path(mut self, filter_path: &'b [&'b str]) -> Self {
7011        self.filter_path = Some(filter_path);
7012        self
7013    }
7014    #[doc = "Adds a HTTP header"]
7015    pub fn header(mut self, key: HeaderName, value: HeaderValue) -> Self {
7016        self.headers.insert(key, value);
7017        self
7018    }
7019    #[doc = "Return human readable values for statistics."]
7020    pub fn human(mut self, human: bool) -> Self {
7021        self.human = Some(human);
7022        self
7023    }
7024    #[doc = "Whether a type should be included in the body of the mappings."]
7025    pub fn include_type_name(mut self, include_type_name: bool) -> Self {
7026        self.include_type_name = Some(include_type_name);
7027        self
7028    }
7029    #[doc = "Specify timeout for connection to master"]
7030    pub fn master_timeout(mut self, master_timeout: &'b str) -> Self {
7031        self.master_timeout = Some(master_timeout);
7032        self
7033    }
7034    #[doc = "Pretty format the returned JSON response."]
7035    pub fn pretty(mut self, pretty: bool) -> Self {
7036        self.pretty = Some(pretty);
7037        self
7038    }
7039    #[doc = "Sets a request timeout for this API call.\n\nThe timeout is applied from when the request starts connecting until the response body has finished."]
7040    pub fn request_timeout(mut self, timeout: Duration) -> Self {
7041        self.request_timeout = Some(timeout);
7042        self
7043    }
7044    #[doc = "The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests."]
7045    pub fn source(mut self, source: &'b str) -> Self {
7046        self.source = Some(source);
7047        self
7048    }
7049    #[doc = "Explicit operation timeout"]
7050    pub fn timeout(mut self, timeout: &'b str) -> Self {
7051        self.timeout = Some(timeout);
7052        self
7053    }
7054    #[doc = "Set the number of active shards to wait for on the newly created rollover index before the operation returns."]
7055    pub fn wait_for_active_shards(mut self, wait_for_active_shards: &'b str) -> Self {
7056        self.wait_for_active_shards = Some(wait_for_active_shards);
7057        self
7058    }
7059    #[doc = "Creates an asynchronous call to the Indices Rollover API that can be awaited"]
7060    pub async fn send(self) -> Result<Response, Error> {
7061        let path = self.parts.url();
7062        let method = Method::Post;
7063        let headers = self.headers;
7064        let timeout = self.request_timeout;
7065        let query_string = {
7066            #[serde_with::skip_serializing_none]
7067            #[derive(Serialize)]
7068            struct QueryParams<'b> {
7069                dry_run: Option<bool>,
7070                error_trace: Option<bool>,
7071                #[serde(serialize_with = "crate::client::serialize_coll_qs")]
7072                filter_path: Option<&'b [&'b str]>,
7073                human: Option<bool>,
7074                include_type_name: Option<bool>,
7075                master_timeout: Option<&'b str>,
7076                pretty: Option<bool>,
7077                source: Option<&'b str>,
7078                timeout: Option<&'b str>,
7079                wait_for_active_shards: Option<&'b str>,
7080            }
7081            let query_params = QueryParams {
7082                dry_run: self.dry_run,
7083                error_trace: self.error_trace,
7084                filter_path: self.filter_path,
7085                human: self.human,
7086                include_type_name: self.include_type_name,
7087                master_timeout: self.master_timeout,
7088                pretty: self.pretty,
7089                source: self.source,
7090                timeout: self.timeout,
7091                wait_for_active_shards: self.wait_for_active_shards,
7092            };
7093            Some(query_params)
7094        };
7095        let body = self.body;
7096        let response = self
7097            .transport
7098            .send(method, &path, headers, query_string.as_ref(), body, timeout)
7099            .await?;
7100        Ok(response)
7101    }
7102}
7103#[derive(Debug, Clone, PartialEq)]
7104#[doc = "API parts for the Indices Segments API"]
7105pub enum IndicesSegmentsParts<'b> {
7106    #[doc = "No parts"]
7107    None,
7108    #[doc = "Index"]
7109    Index(&'b [&'b str]),
7110}
7111impl<'b> IndicesSegmentsParts<'b> {
7112    #[doc = "Builds a relative URL path to the Indices Segments API"]
7113    pub fn url(self) -> Cow<'static, str> {
7114        match self {
7115            IndicesSegmentsParts::None => "/_segments".into(),
7116            IndicesSegmentsParts::Index(ref index) => {
7117                let index_str = index.join(",");
7118                let encoded_index: Cow<str> =
7119                    percent_encode(index_str.as_bytes(), PARTS_ENCODED).into();
7120                let mut p = String::with_capacity(11usize + encoded_index.len());
7121                p.push_str("/");
7122                p.push_str(encoded_index.as_ref());
7123                p.push_str("/_segments");
7124                p.into()
7125            }
7126        }
7127    }
7128}
7129#[doc = "Builder for the [Indices Segments API](https://opensearch.org/docs/)\n\nProvides low-level information about segments in a Lucene index."]
7130#[derive(Clone, Debug)]
7131pub struct IndicesSegments<'a, 'b> {
7132    transport: &'a Transport,
7133    parts: IndicesSegmentsParts<'b>,
7134    allow_no_indices: Option<bool>,
7135    error_trace: Option<bool>,
7136    expand_wildcards: Option<&'b [ExpandWildcards]>,
7137    filter_path: Option<&'b [&'b str]>,
7138    headers: HeaderMap,
7139    human: Option<bool>,
7140    ignore_unavailable: Option<bool>,
7141    pretty: Option<bool>,
7142    request_timeout: Option<Duration>,
7143    source: Option<&'b str>,
7144    verbose: Option<bool>,
7145}
7146impl<'a, 'b> IndicesSegments<'a, 'b> {
7147    #[doc = "Creates a new instance of [IndicesSegments] with the specified API parts"]
7148    pub fn new(transport: &'a Transport, parts: IndicesSegmentsParts<'b>) -> Self {
7149        let headers = HeaderMap::new();
7150        IndicesSegments {
7151            transport,
7152            parts,
7153            headers,
7154            allow_no_indices: None,
7155            error_trace: None,
7156            expand_wildcards: None,
7157            filter_path: None,
7158            human: None,
7159            ignore_unavailable: None,
7160            pretty: None,
7161            request_timeout: None,
7162            source: None,
7163            verbose: None,
7164        }
7165    }
7166    #[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)"]
7167    pub fn allow_no_indices(mut self, allow_no_indices: bool) -> Self {
7168        self.allow_no_indices = Some(allow_no_indices);
7169        self
7170    }
7171    #[doc = "Include the stack trace of returned errors."]
7172    pub fn error_trace(mut self, error_trace: bool) -> Self {
7173        self.error_trace = Some(error_trace);
7174        self
7175    }
7176    #[doc = "Whether to expand wildcard expression to concrete indices that are open, closed or both."]
7177    pub fn expand_wildcards(mut self, expand_wildcards: &'b [ExpandWildcards]) -> Self {
7178        self.expand_wildcards = Some(expand_wildcards);
7179        self
7180    }
7181    #[doc = "A comma-separated list of filters used to reduce the response."]
7182    pub fn filter_path(mut self, filter_path: &'b [&'b str]) -> Self {
7183        self.filter_path = Some(filter_path);
7184        self
7185    }
7186    #[doc = "Adds a HTTP header"]
7187    pub fn header(mut self, key: HeaderName, value: HeaderValue) -> Self {
7188        self.headers.insert(key, value);
7189        self
7190    }
7191    #[doc = "Return human readable values for statistics."]
7192    pub fn human(mut self, human: bool) -> Self {
7193        self.human = Some(human);
7194        self
7195    }
7196    #[doc = "Whether specified concrete indices should be ignored when unavailable (missing or closed)"]
7197    pub fn ignore_unavailable(mut self, ignore_unavailable: bool) -> Self {
7198        self.ignore_unavailable = Some(ignore_unavailable);
7199        self
7200    }
7201    #[doc = "Pretty format the returned JSON response."]
7202    pub fn pretty(mut self, pretty: bool) -> Self {
7203        self.pretty = Some(pretty);
7204        self
7205    }
7206    #[doc = "Sets a request timeout for this API call.\n\nThe timeout is applied from when the request starts connecting until the response body has finished."]
7207    pub fn request_timeout(mut self, timeout: Duration) -> Self {
7208        self.request_timeout = Some(timeout);
7209        self
7210    }
7211    #[doc = "The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests."]
7212    pub fn source(mut self, source: &'b str) -> Self {
7213        self.source = Some(source);
7214        self
7215    }
7216    #[doc = "Includes detailed memory usage by Lucene."]
7217    pub fn verbose(mut self, verbose: bool) -> Self {
7218        self.verbose = Some(verbose);
7219        self
7220    }
7221    #[doc = "Creates an asynchronous call to the Indices Segments API that can be awaited"]
7222    pub async fn send(self) -> Result<Response, Error> {
7223        let path = self.parts.url();
7224        let method = Method::Get;
7225        let headers = self.headers;
7226        let timeout = self.request_timeout;
7227        let query_string = {
7228            #[serde_with::skip_serializing_none]
7229            #[derive(Serialize)]
7230            struct QueryParams<'b> {
7231                allow_no_indices: Option<bool>,
7232                error_trace: Option<bool>,
7233                #[serde(serialize_with = "crate::client::serialize_coll_qs")]
7234                expand_wildcards: Option<&'b [ExpandWildcards]>,
7235                #[serde(serialize_with = "crate::client::serialize_coll_qs")]
7236                filter_path: Option<&'b [&'b str]>,
7237                human: Option<bool>,
7238                ignore_unavailable: Option<bool>,
7239                pretty: Option<bool>,
7240                source: Option<&'b str>,
7241                verbose: Option<bool>,
7242            }
7243            let query_params = QueryParams {
7244                allow_no_indices: self.allow_no_indices,
7245                error_trace: self.error_trace,
7246                expand_wildcards: self.expand_wildcards,
7247                filter_path: self.filter_path,
7248                human: self.human,
7249                ignore_unavailable: self.ignore_unavailable,
7250                pretty: self.pretty,
7251                source: self.source,
7252                verbose: self.verbose,
7253            };
7254            Some(query_params)
7255        };
7256        let body = Option::<()>::None;
7257        let response = self
7258            .transport
7259            .send(method, &path, headers, query_string.as_ref(), body, timeout)
7260            .await?;
7261        Ok(response)
7262    }
7263}
7264#[derive(Debug, Clone, PartialEq)]
7265#[doc = "API parts for the Indices Shard Stores API"]
7266pub enum IndicesShardStoresParts<'b> {
7267    #[doc = "No parts"]
7268    None,
7269    #[doc = "Index"]
7270    Index(&'b [&'b str]),
7271}
7272impl<'b> IndicesShardStoresParts<'b> {
7273    #[doc = "Builds a relative URL path to the Indices Shard Stores API"]
7274    pub fn url(self) -> Cow<'static, str> {
7275        match self {
7276            IndicesShardStoresParts::None => "/_shard_stores".into(),
7277            IndicesShardStoresParts::Index(ref index) => {
7278                let index_str = index.join(",");
7279                let encoded_index: Cow<str> =
7280                    percent_encode(index_str.as_bytes(), PARTS_ENCODED).into();
7281                let mut p = String::with_capacity(15usize + encoded_index.len());
7282                p.push_str("/");
7283                p.push_str(encoded_index.as_ref());
7284                p.push_str("/_shard_stores");
7285                p.into()
7286            }
7287        }
7288    }
7289}
7290#[doc = "Builder for the [Indices Shard Stores API](https://opensearch.org/docs/)\n\nProvides store information for shard copies of indices."]
7291#[derive(Clone, Debug)]
7292pub struct IndicesShardStores<'a, 'b> {
7293    transport: &'a Transport,
7294    parts: IndicesShardStoresParts<'b>,
7295    allow_no_indices: Option<bool>,
7296    error_trace: Option<bool>,
7297    expand_wildcards: Option<&'b [ExpandWildcards]>,
7298    filter_path: Option<&'b [&'b str]>,
7299    headers: HeaderMap,
7300    human: Option<bool>,
7301    ignore_unavailable: Option<bool>,
7302    pretty: Option<bool>,
7303    request_timeout: Option<Duration>,
7304    source: Option<&'b str>,
7305    status: Option<&'b [&'b str]>,
7306}
7307impl<'a, 'b> IndicesShardStores<'a, 'b> {
7308    #[doc = "Creates a new instance of [IndicesShardStores] with the specified API parts"]
7309    pub fn new(transport: &'a Transport, parts: IndicesShardStoresParts<'b>) -> Self {
7310        let headers = HeaderMap::new();
7311        IndicesShardStores {
7312            transport,
7313            parts,
7314            headers,
7315            allow_no_indices: None,
7316            error_trace: None,
7317            expand_wildcards: None,
7318            filter_path: None,
7319            human: None,
7320            ignore_unavailable: None,
7321            pretty: None,
7322            request_timeout: None,
7323            source: None,
7324            status: None,
7325        }
7326    }
7327    #[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)"]
7328    pub fn allow_no_indices(mut self, allow_no_indices: bool) -> Self {
7329        self.allow_no_indices = Some(allow_no_indices);
7330        self
7331    }
7332    #[doc = "Include the stack trace of returned errors."]
7333    pub fn error_trace(mut self, error_trace: bool) -> Self {
7334        self.error_trace = Some(error_trace);
7335        self
7336    }
7337    #[doc = "Whether to expand wildcard expression to concrete indices that are open, closed or both."]
7338    pub fn expand_wildcards(mut self, expand_wildcards: &'b [ExpandWildcards]) -> Self {
7339        self.expand_wildcards = Some(expand_wildcards);
7340        self
7341    }
7342    #[doc = "A comma-separated list of filters used to reduce the response."]
7343    pub fn filter_path(mut self, filter_path: &'b [&'b str]) -> Self {
7344        self.filter_path = Some(filter_path);
7345        self
7346    }
7347    #[doc = "Adds a HTTP header"]
7348    pub fn header(mut self, key: HeaderName, value: HeaderValue) -> Self {
7349        self.headers.insert(key, value);
7350        self
7351    }
7352    #[doc = "Return human readable values for statistics."]
7353    pub fn human(mut self, human: bool) -> Self {
7354        self.human = Some(human);
7355        self
7356    }
7357    #[doc = "Whether specified concrete indices should be ignored when unavailable (missing or closed)"]
7358    pub fn ignore_unavailable(mut self, ignore_unavailable: bool) -> Self {
7359        self.ignore_unavailable = Some(ignore_unavailable);
7360        self
7361    }
7362    #[doc = "Pretty format the returned JSON response."]
7363    pub fn pretty(mut self, pretty: bool) -> Self {
7364        self.pretty = Some(pretty);
7365        self
7366    }
7367    #[doc = "Sets a request timeout for this API call.\n\nThe timeout is applied from when the request starts connecting until the response body has finished."]
7368    pub fn request_timeout(mut self, timeout: Duration) -> Self {
7369        self.request_timeout = Some(timeout);
7370        self
7371    }
7372    #[doc = "The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests."]
7373    pub fn source(mut self, source: &'b str) -> Self {
7374        self.source = Some(source);
7375        self
7376    }
7377    #[doc = "A comma-separated list of statuses used to filter on shards to get store information for"]
7378    pub fn status(mut self, status: &'b [&'b str]) -> Self {
7379        self.status = Some(status);
7380        self
7381    }
7382    #[doc = "Creates an asynchronous call to the Indices Shard Stores API that can be awaited"]
7383    pub async fn send(self) -> Result<Response, Error> {
7384        let path = self.parts.url();
7385        let method = Method::Get;
7386        let headers = self.headers;
7387        let timeout = self.request_timeout;
7388        let query_string = {
7389            #[serde_with::skip_serializing_none]
7390            #[derive(Serialize)]
7391            struct QueryParams<'b> {
7392                allow_no_indices: Option<bool>,
7393                error_trace: Option<bool>,
7394                #[serde(serialize_with = "crate::client::serialize_coll_qs")]
7395                expand_wildcards: Option<&'b [ExpandWildcards]>,
7396                #[serde(serialize_with = "crate::client::serialize_coll_qs")]
7397                filter_path: Option<&'b [&'b str]>,
7398                human: Option<bool>,
7399                ignore_unavailable: Option<bool>,
7400                pretty: Option<bool>,
7401                source: Option<&'b str>,
7402                #[serde(serialize_with = "crate::client::serialize_coll_qs")]
7403                status: Option<&'b [&'b str]>,
7404            }
7405            let query_params = QueryParams {
7406                allow_no_indices: self.allow_no_indices,
7407                error_trace: self.error_trace,
7408                expand_wildcards: self.expand_wildcards,
7409                filter_path: self.filter_path,
7410                human: self.human,
7411                ignore_unavailable: self.ignore_unavailable,
7412                pretty: self.pretty,
7413                source: self.source,
7414                status: self.status,
7415            };
7416            Some(query_params)
7417        };
7418        let body = Option::<()>::None;
7419        let response = self
7420            .transport
7421            .send(method, &path, headers, query_string.as_ref(), body, timeout)
7422            .await?;
7423        Ok(response)
7424    }
7425}
7426#[derive(Debug, Clone, PartialEq)]
7427#[doc = "API parts for the Indices Shrink API"]
7428pub enum IndicesShrinkParts<'b> {
7429    #[doc = "Index and Target"]
7430    IndexTarget(&'b str, &'b str),
7431}
7432impl<'b> IndicesShrinkParts<'b> {
7433    #[doc = "Builds a relative URL path to the Indices Shrink API"]
7434    pub fn url(self) -> Cow<'static, str> {
7435        match self {
7436            IndicesShrinkParts::IndexTarget(ref index, ref target) => {
7437                let encoded_index: Cow<str> =
7438                    percent_encode(index.as_bytes(), PARTS_ENCODED).into();
7439                let encoded_target: Cow<str> =
7440                    percent_encode(target.as_bytes(), PARTS_ENCODED).into();
7441                let mut p =
7442                    String::with_capacity(10usize + encoded_index.len() + encoded_target.len());
7443                p.push_str("/");
7444                p.push_str(encoded_index.as_ref());
7445                p.push_str("/_shrink/");
7446                p.push_str(encoded_target.as_ref());
7447                p.into()
7448            }
7449        }
7450    }
7451}
7452#[doc = "Builder for the [Indices Shrink API](https://opensearch.org/docs/)\n\nAllow to shrink an existing index into a new index with fewer primary shards."]
7453#[derive(Clone, Debug)]
7454pub struct IndicesShrink<'a, 'b, B> {
7455    transport: &'a Transport,
7456    parts: IndicesShrinkParts<'b>,
7457    body: Option<B>,
7458    copy_settings: Option<bool>,
7459    error_trace: Option<bool>,
7460    filter_path: Option<&'b [&'b str]>,
7461    headers: HeaderMap,
7462    human: Option<bool>,
7463    master_timeout: Option<&'b str>,
7464    pretty: Option<bool>,
7465    request_timeout: Option<Duration>,
7466    source: Option<&'b str>,
7467    timeout: Option<&'b str>,
7468    wait_for_active_shards: Option<&'b str>,
7469}
7470impl<'a, 'b, B> IndicesShrink<'a, 'b, B>
7471where
7472    B: Body,
7473{
7474    #[doc = "Creates a new instance of [IndicesShrink] with the specified API parts"]
7475    pub fn new(transport: &'a Transport, parts: IndicesShrinkParts<'b>) -> Self {
7476        let headers = HeaderMap::new();
7477        IndicesShrink {
7478            transport,
7479            parts,
7480            headers,
7481            body: None,
7482            copy_settings: None,
7483            error_trace: None,
7484            filter_path: None,
7485            human: None,
7486            master_timeout: None,
7487            pretty: None,
7488            request_timeout: None,
7489            source: None,
7490            timeout: None,
7491            wait_for_active_shards: None,
7492        }
7493    }
7494    #[doc = "The body for the API call"]
7495    pub fn body<T>(self, body: T) -> IndicesShrink<'a, 'b, JsonBody<T>>
7496    where
7497        T: Serialize,
7498    {
7499        IndicesShrink {
7500            transport: self.transport,
7501            parts: self.parts,
7502            body: Some(body.into()),
7503            copy_settings: self.copy_settings,
7504            error_trace: self.error_trace,
7505            filter_path: self.filter_path,
7506            headers: self.headers,
7507            human: self.human,
7508            master_timeout: self.master_timeout,
7509            pretty: self.pretty,
7510            request_timeout: self.request_timeout,
7511            source: self.source,
7512            timeout: self.timeout,
7513            wait_for_active_shards: self.wait_for_active_shards,
7514        }
7515    }
7516    #[doc = "whether or not to copy settings from the source index (defaults to false)"]
7517    pub fn copy_settings(mut self, copy_settings: bool) -> Self {
7518        self.copy_settings = Some(copy_settings);
7519        self
7520    }
7521    #[doc = "Include the stack trace of returned errors."]
7522    pub fn error_trace(mut self, error_trace: bool) -> Self {
7523        self.error_trace = Some(error_trace);
7524        self
7525    }
7526    #[doc = "A comma-separated list of filters used to reduce the response."]
7527    pub fn filter_path(mut self, filter_path: &'b [&'b str]) -> Self {
7528        self.filter_path = Some(filter_path);
7529        self
7530    }
7531    #[doc = "Adds a HTTP header"]
7532    pub fn header(mut self, key: HeaderName, value: HeaderValue) -> Self {
7533        self.headers.insert(key, value);
7534        self
7535    }
7536    #[doc = "Return human readable values for statistics."]
7537    pub fn human(mut self, human: bool) -> Self {
7538        self.human = Some(human);
7539        self
7540    }
7541    #[doc = "Specify timeout for connection to master"]
7542    pub fn master_timeout(mut self, master_timeout: &'b str) -> Self {
7543        self.master_timeout = Some(master_timeout);
7544        self
7545    }
7546    #[doc = "Pretty format the returned JSON response."]
7547    pub fn pretty(mut self, pretty: bool) -> Self {
7548        self.pretty = Some(pretty);
7549        self
7550    }
7551    #[doc = "Sets a request timeout for this API call.\n\nThe timeout is applied from when the request starts connecting until the response body has finished."]
7552    pub fn request_timeout(mut self, timeout: Duration) -> Self {
7553        self.request_timeout = Some(timeout);
7554        self
7555    }
7556    #[doc = "The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests."]
7557    pub fn source(mut self, source: &'b str) -> Self {
7558        self.source = Some(source);
7559        self
7560    }
7561    #[doc = "Explicit operation timeout"]
7562    pub fn timeout(mut self, timeout: &'b str) -> Self {
7563        self.timeout = Some(timeout);
7564        self
7565    }
7566    #[doc = "Set the number of active shards to wait for on the shrunken index before the operation returns."]
7567    pub fn wait_for_active_shards(mut self, wait_for_active_shards: &'b str) -> Self {
7568        self.wait_for_active_shards = Some(wait_for_active_shards);
7569        self
7570    }
7571    #[doc = "Creates an asynchronous call to the Indices Shrink API that can be awaited"]
7572    pub async fn send(self) -> Result<Response, Error> {
7573        let path = self.parts.url();
7574        let method = Method::Post;
7575        let headers = self.headers;
7576        let timeout = self.request_timeout;
7577        let query_string = {
7578            #[serde_with::skip_serializing_none]
7579            #[derive(Serialize)]
7580            struct QueryParams<'b> {
7581                copy_settings: Option<bool>,
7582                error_trace: Option<bool>,
7583                #[serde(serialize_with = "crate::client::serialize_coll_qs")]
7584                filter_path: Option<&'b [&'b str]>,
7585                human: Option<bool>,
7586                master_timeout: Option<&'b str>,
7587                pretty: Option<bool>,
7588                source: Option<&'b str>,
7589                timeout: Option<&'b str>,
7590                wait_for_active_shards: Option<&'b str>,
7591            }
7592            let query_params = QueryParams {
7593                copy_settings: self.copy_settings,
7594                error_trace: self.error_trace,
7595                filter_path: self.filter_path,
7596                human: self.human,
7597                master_timeout: self.master_timeout,
7598                pretty: self.pretty,
7599                source: self.source,
7600                timeout: self.timeout,
7601                wait_for_active_shards: self.wait_for_active_shards,
7602            };
7603            Some(query_params)
7604        };
7605        let body = self.body;
7606        let response = self
7607            .transport
7608            .send(method, &path, headers, query_string.as_ref(), body, timeout)
7609            .await?;
7610        Ok(response)
7611    }
7612}
7613#[derive(Debug, Clone, PartialEq)]
7614#[doc = "API parts for the Indices Simulate Index Template API"]
7615pub enum IndicesSimulateIndexTemplateParts<'b> {
7616    #[doc = "Name"]
7617    Name(&'b str),
7618}
7619impl<'b> IndicesSimulateIndexTemplateParts<'b> {
7620    #[doc = "Builds a relative URL path to the Indices Simulate Index Template API"]
7621    pub fn url(self) -> Cow<'static, str> {
7622        match self {
7623            IndicesSimulateIndexTemplateParts::Name(ref name) => {
7624                let encoded_name: Cow<str> = percent_encode(name.as_bytes(), PARTS_ENCODED).into();
7625                let mut p = String::with_capacity(33usize + encoded_name.len());
7626                p.push_str("/_index_template/_simulate_index/");
7627                p.push_str(encoded_name.as_ref());
7628                p.into()
7629            }
7630        }
7631    }
7632}
7633#[doc = "Builder for the [Indices Simulate Index Template API](https://opensearch.org/docs/)\n\nSimulate matching the given index name against the index templates in the system"]
7634#[derive(Clone, Debug)]
7635pub struct IndicesSimulateIndexTemplate<'a, 'b, B> {
7636    transport: &'a Transport,
7637    parts: IndicesSimulateIndexTemplateParts<'b>,
7638    body: Option<B>,
7639    cause: Option<&'b str>,
7640    create: Option<bool>,
7641    error_trace: Option<bool>,
7642    filter_path: Option<&'b [&'b str]>,
7643    headers: HeaderMap,
7644    human: Option<bool>,
7645    master_timeout: Option<&'b str>,
7646    pretty: Option<bool>,
7647    request_timeout: Option<Duration>,
7648    source: Option<&'b str>,
7649}
7650impl<'a, 'b, B> IndicesSimulateIndexTemplate<'a, 'b, B>
7651where
7652    B: Body,
7653{
7654    #[doc = "Creates a new instance of [IndicesSimulateIndexTemplate] with the specified API parts"]
7655    pub fn new(transport: &'a Transport, parts: IndicesSimulateIndexTemplateParts<'b>) -> Self {
7656        let headers = HeaderMap::new();
7657        IndicesSimulateIndexTemplate {
7658            transport,
7659            parts,
7660            headers,
7661            body: None,
7662            cause: None,
7663            create: None,
7664            error_trace: None,
7665            filter_path: None,
7666            human: None,
7667            master_timeout: None,
7668            pretty: None,
7669            request_timeout: None,
7670            source: None,
7671        }
7672    }
7673    #[doc = "The body for the API call"]
7674    pub fn body<T>(self, body: T) -> IndicesSimulateIndexTemplate<'a, 'b, JsonBody<T>>
7675    where
7676        T: Serialize,
7677    {
7678        IndicesSimulateIndexTemplate {
7679            transport: self.transport,
7680            parts: self.parts,
7681            body: Some(body.into()),
7682            cause: self.cause,
7683            create: self.create,
7684            error_trace: self.error_trace,
7685            filter_path: self.filter_path,
7686            headers: self.headers,
7687            human: self.human,
7688            master_timeout: self.master_timeout,
7689            pretty: self.pretty,
7690            request_timeout: self.request_timeout,
7691            source: self.source,
7692        }
7693    }
7694    #[doc = "User defined reason for dry-run creating the new template for simulation purposes"]
7695    pub fn cause(mut self, cause: &'b str) -> Self {
7696        self.cause = Some(cause);
7697        self
7698    }
7699    #[doc = "Whether the index template we optionally defined in the body should only be dry-run added if new or can also replace an existing one"]
7700    pub fn create(mut self, create: bool) -> Self {
7701        self.create = Some(create);
7702        self
7703    }
7704    #[doc = "Include the stack trace of returned errors."]
7705    pub fn error_trace(mut self, error_trace: bool) -> Self {
7706        self.error_trace = Some(error_trace);
7707        self
7708    }
7709    #[doc = "A comma-separated list of filters used to reduce the response."]
7710    pub fn filter_path(mut self, filter_path: &'b [&'b str]) -> Self {
7711        self.filter_path = Some(filter_path);
7712        self
7713    }
7714    #[doc = "Adds a HTTP header"]
7715    pub fn header(mut self, key: HeaderName, value: HeaderValue) -> Self {
7716        self.headers.insert(key, value);
7717        self
7718    }
7719    #[doc = "Return human readable values for statistics."]
7720    pub fn human(mut self, human: bool) -> Self {
7721        self.human = Some(human);
7722        self
7723    }
7724    #[doc = "Specify timeout for connection to master"]
7725    pub fn master_timeout(mut self, master_timeout: &'b str) -> Self {
7726        self.master_timeout = Some(master_timeout);
7727        self
7728    }
7729    #[doc = "Pretty format the returned JSON response."]
7730    pub fn pretty(mut self, pretty: bool) -> Self {
7731        self.pretty = Some(pretty);
7732        self
7733    }
7734    #[doc = "Sets a request timeout for this API call.\n\nThe timeout is applied from when the request starts connecting until the response body has finished."]
7735    pub fn request_timeout(mut self, timeout: Duration) -> Self {
7736        self.request_timeout = Some(timeout);
7737        self
7738    }
7739    #[doc = "The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests."]
7740    pub fn source(mut self, source: &'b str) -> Self {
7741        self.source = Some(source);
7742        self
7743    }
7744    #[doc = "Creates an asynchronous call to the Indices Simulate Index Template API that can be awaited"]
7745    pub async fn send(self) -> Result<Response, Error> {
7746        let path = self.parts.url();
7747        let method = Method::Post;
7748        let headers = self.headers;
7749        let timeout = self.request_timeout;
7750        let query_string = {
7751            #[serde_with::skip_serializing_none]
7752            #[derive(Serialize)]
7753            struct QueryParams<'b> {
7754                cause: Option<&'b str>,
7755                create: Option<bool>,
7756                error_trace: Option<bool>,
7757                #[serde(serialize_with = "crate::client::serialize_coll_qs")]
7758                filter_path: Option<&'b [&'b str]>,
7759                human: Option<bool>,
7760                master_timeout: Option<&'b str>,
7761                pretty: Option<bool>,
7762                source: Option<&'b str>,
7763            }
7764            let query_params = QueryParams {
7765                cause: self.cause,
7766                create: self.create,
7767                error_trace: self.error_trace,
7768                filter_path: self.filter_path,
7769                human: self.human,
7770                master_timeout: self.master_timeout,
7771                pretty: self.pretty,
7772                source: self.source,
7773            };
7774            Some(query_params)
7775        };
7776        let body = self.body;
7777        let response = self
7778            .transport
7779            .send(method, &path, headers, query_string.as_ref(), body, timeout)
7780            .await?;
7781        Ok(response)
7782    }
7783}
7784#[derive(Debug, Clone, PartialEq)]
7785#[doc = "API parts for the Indices Simulate Template API"]
7786pub enum IndicesSimulateTemplateParts<'b> {
7787    #[doc = "No parts"]
7788    None,
7789    #[doc = "Name"]
7790    Name(&'b str),
7791}
7792impl<'b> IndicesSimulateTemplateParts<'b> {
7793    #[doc = "Builds a relative URL path to the Indices Simulate Template API"]
7794    pub fn url(self) -> Cow<'static, str> {
7795        match self {
7796            IndicesSimulateTemplateParts::None => "/_index_template/_simulate".into(),
7797            IndicesSimulateTemplateParts::Name(ref name) => {
7798                let encoded_name: Cow<str> = percent_encode(name.as_bytes(), PARTS_ENCODED).into();
7799                let mut p = String::with_capacity(27usize + encoded_name.len());
7800                p.push_str("/_index_template/_simulate/");
7801                p.push_str(encoded_name.as_ref());
7802                p.into()
7803            }
7804        }
7805    }
7806}
7807#[doc = "Builder for the [Indices Simulate Template API](https://opensearch.org/docs/)\n\nSimulate resolving the given template name or body"]
7808#[derive(Clone, Debug)]
7809pub struct IndicesSimulateTemplate<'a, 'b, B> {
7810    transport: &'a Transport,
7811    parts: IndicesSimulateTemplateParts<'b>,
7812    body: Option<B>,
7813    cause: Option<&'b str>,
7814    create: Option<bool>,
7815    error_trace: Option<bool>,
7816    filter_path: Option<&'b [&'b str]>,
7817    headers: HeaderMap,
7818    human: Option<bool>,
7819    master_timeout: Option<&'b str>,
7820    pretty: Option<bool>,
7821    request_timeout: Option<Duration>,
7822    source: Option<&'b str>,
7823}
7824impl<'a, 'b, B> IndicesSimulateTemplate<'a, 'b, B>
7825where
7826    B: Body,
7827{
7828    #[doc = "Creates a new instance of [IndicesSimulateTemplate] with the specified API parts"]
7829    pub fn new(transport: &'a Transport, parts: IndicesSimulateTemplateParts<'b>) -> Self {
7830        let headers = HeaderMap::new();
7831        IndicesSimulateTemplate {
7832            transport,
7833            parts,
7834            headers,
7835            body: None,
7836            cause: None,
7837            create: None,
7838            error_trace: None,
7839            filter_path: None,
7840            human: None,
7841            master_timeout: None,
7842            pretty: None,
7843            request_timeout: None,
7844            source: None,
7845        }
7846    }
7847    #[doc = "The body for the API call"]
7848    pub fn body<T>(self, body: T) -> IndicesSimulateTemplate<'a, 'b, JsonBody<T>>
7849    where
7850        T: Serialize,
7851    {
7852        IndicesSimulateTemplate {
7853            transport: self.transport,
7854            parts: self.parts,
7855            body: Some(body.into()),
7856            cause: self.cause,
7857            create: self.create,
7858            error_trace: self.error_trace,
7859            filter_path: self.filter_path,
7860            headers: self.headers,
7861            human: self.human,
7862            master_timeout: self.master_timeout,
7863            pretty: self.pretty,
7864            request_timeout: self.request_timeout,
7865            source: self.source,
7866        }
7867    }
7868    #[doc = "User defined reason for dry-run creating the new template for simulation purposes"]
7869    pub fn cause(mut self, cause: &'b str) -> Self {
7870        self.cause = Some(cause);
7871        self
7872    }
7873    #[doc = "Whether the index template we optionally defined in the body should only be dry-run added if new or can also replace an existing one"]
7874    pub fn create(mut self, create: bool) -> Self {
7875        self.create = Some(create);
7876        self
7877    }
7878    #[doc = "Include the stack trace of returned errors."]
7879    pub fn error_trace(mut self, error_trace: bool) -> Self {
7880        self.error_trace = Some(error_trace);
7881        self
7882    }
7883    #[doc = "A comma-separated list of filters used to reduce the response."]
7884    pub fn filter_path(mut self, filter_path: &'b [&'b str]) -> Self {
7885        self.filter_path = Some(filter_path);
7886        self
7887    }
7888    #[doc = "Adds a HTTP header"]
7889    pub fn header(mut self, key: HeaderName, value: HeaderValue) -> Self {
7890        self.headers.insert(key, value);
7891        self
7892    }
7893    #[doc = "Return human readable values for statistics."]
7894    pub fn human(mut self, human: bool) -> Self {
7895        self.human = Some(human);
7896        self
7897    }
7898    #[doc = "Specify timeout for connection to master"]
7899    pub fn master_timeout(mut self, master_timeout: &'b str) -> Self {
7900        self.master_timeout = Some(master_timeout);
7901        self
7902    }
7903    #[doc = "Pretty format the returned JSON response."]
7904    pub fn pretty(mut self, pretty: bool) -> Self {
7905        self.pretty = Some(pretty);
7906        self
7907    }
7908    #[doc = "Sets a request timeout for this API call.\n\nThe timeout is applied from when the request starts connecting until the response body has finished."]
7909    pub fn request_timeout(mut self, timeout: Duration) -> Self {
7910        self.request_timeout = Some(timeout);
7911        self
7912    }
7913    #[doc = "The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests."]
7914    pub fn source(mut self, source: &'b str) -> Self {
7915        self.source = Some(source);
7916        self
7917    }
7918    #[doc = "Creates an asynchronous call to the Indices Simulate Template API that can be awaited"]
7919    pub async fn send(self) -> Result<Response, Error> {
7920        let path = self.parts.url();
7921        let method = Method::Post;
7922        let headers = self.headers;
7923        let timeout = self.request_timeout;
7924        let query_string = {
7925            #[serde_with::skip_serializing_none]
7926            #[derive(Serialize)]
7927            struct QueryParams<'b> {
7928                cause: Option<&'b str>,
7929                create: Option<bool>,
7930                error_trace: Option<bool>,
7931                #[serde(serialize_with = "crate::client::serialize_coll_qs")]
7932                filter_path: Option<&'b [&'b str]>,
7933                human: Option<bool>,
7934                master_timeout: Option<&'b str>,
7935                pretty: Option<bool>,
7936                source: Option<&'b str>,
7937            }
7938            let query_params = QueryParams {
7939                cause: self.cause,
7940                create: self.create,
7941                error_trace: self.error_trace,
7942                filter_path: self.filter_path,
7943                human: self.human,
7944                master_timeout: self.master_timeout,
7945                pretty: self.pretty,
7946                source: self.source,
7947            };
7948            Some(query_params)
7949        };
7950        let body = self.body;
7951        let response = self
7952            .transport
7953            .send(method, &path, headers, query_string.as_ref(), body, timeout)
7954            .await?;
7955        Ok(response)
7956    }
7957}
7958#[derive(Debug, Clone, PartialEq)]
7959#[doc = "API parts for the Indices Split API"]
7960pub enum IndicesSplitParts<'b> {
7961    #[doc = "Index and Target"]
7962    IndexTarget(&'b str, &'b str),
7963}
7964impl<'b> IndicesSplitParts<'b> {
7965    #[doc = "Builds a relative URL path to the Indices Split API"]
7966    pub fn url(self) -> Cow<'static, str> {
7967        match self {
7968            IndicesSplitParts::IndexTarget(ref index, ref target) => {
7969                let encoded_index: Cow<str> =
7970                    percent_encode(index.as_bytes(), PARTS_ENCODED).into();
7971                let encoded_target: Cow<str> =
7972                    percent_encode(target.as_bytes(), PARTS_ENCODED).into();
7973                let mut p =
7974                    String::with_capacity(9usize + encoded_index.len() + encoded_target.len());
7975                p.push_str("/");
7976                p.push_str(encoded_index.as_ref());
7977                p.push_str("/_split/");
7978                p.push_str(encoded_target.as_ref());
7979                p.into()
7980            }
7981        }
7982    }
7983}
7984#[doc = "Builder for the [Indices Split API](https://opensearch.org/docs/)\n\nAllows you to split an existing index into a new index with more primary shards."]
7985#[derive(Clone, Debug)]
7986pub struct IndicesSplit<'a, 'b, B> {
7987    transport: &'a Transport,
7988    parts: IndicesSplitParts<'b>,
7989    body: Option<B>,
7990    copy_settings: Option<bool>,
7991    error_trace: Option<bool>,
7992    filter_path: Option<&'b [&'b str]>,
7993    headers: HeaderMap,
7994    human: Option<bool>,
7995    master_timeout: Option<&'b str>,
7996    pretty: Option<bool>,
7997    request_timeout: Option<Duration>,
7998    source: Option<&'b str>,
7999    timeout: Option<&'b str>,
8000    wait_for_active_shards: Option<&'b str>,
8001}
8002impl<'a, 'b, B> IndicesSplit<'a, 'b, B>
8003where
8004    B: Body,
8005{
8006    #[doc = "Creates a new instance of [IndicesSplit] with the specified API parts"]
8007    pub fn new(transport: &'a Transport, parts: IndicesSplitParts<'b>) -> Self {
8008        let headers = HeaderMap::new();
8009        IndicesSplit {
8010            transport,
8011            parts,
8012            headers,
8013            body: None,
8014            copy_settings: None,
8015            error_trace: None,
8016            filter_path: None,
8017            human: None,
8018            master_timeout: None,
8019            pretty: None,
8020            request_timeout: None,
8021            source: None,
8022            timeout: None,
8023            wait_for_active_shards: None,
8024        }
8025    }
8026    #[doc = "The body for the API call"]
8027    pub fn body<T>(self, body: T) -> IndicesSplit<'a, 'b, JsonBody<T>>
8028    where
8029        T: Serialize,
8030    {
8031        IndicesSplit {
8032            transport: self.transport,
8033            parts: self.parts,
8034            body: Some(body.into()),
8035            copy_settings: self.copy_settings,
8036            error_trace: self.error_trace,
8037            filter_path: self.filter_path,
8038            headers: self.headers,
8039            human: self.human,
8040            master_timeout: self.master_timeout,
8041            pretty: self.pretty,
8042            request_timeout: self.request_timeout,
8043            source: self.source,
8044            timeout: self.timeout,
8045            wait_for_active_shards: self.wait_for_active_shards,
8046        }
8047    }
8048    #[doc = "whether or not to copy settings from the source index (defaults to false)"]
8049    pub fn copy_settings(mut self, copy_settings: bool) -> Self {
8050        self.copy_settings = Some(copy_settings);
8051        self
8052    }
8053    #[doc = "Include the stack trace of returned errors."]
8054    pub fn error_trace(mut self, error_trace: bool) -> Self {
8055        self.error_trace = Some(error_trace);
8056        self
8057    }
8058    #[doc = "A comma-separated list of filters used to reduce the response."]
8059    pub fn filter_path(mut self, filter_path: &'b [&'b str]) -> Self {
8060        self.filter_path = Some(filter_path);
8061        self
8062    }
8063    #[doc = "Adds a HTTP header"]
8064    pub fn header(mut self, key: HeaderName, value: HeaderValue) -> Self {
8065        self.headers.insert(key, value);
8066        self
8067    }
8068    #[doc = "Return human readable values for statistics."]
8069    pub fn human(mut self, human: bool) -> Self {
8070        self.human = Some(human);
8071        self
8072    }
8073    #[doc = "Specify timeout for connection to master"]
8074    pub fn master_timeout(mut self, master_timeout: &'b str) -> Self {
8075        self.master_timeout = Some(master_timeout);
8076        self
8077    }
8078    #[doc = "Pretty format the returned JSON response."]
8079    pub fn pretty(mut self, pretty: bool) -> Self {
8080        self.pretty = Some(pretty);
8081        self
8082    }
8083    #[doc = "Sets a request timeout for this API call.\n\nThe timeout is applied from when the request starts connecting until the response body has finished."]
8084    pub fn request_timeout(mut self, timeout: Duration) -> Self {
8085        self.request_timeout = Some(timeout);
8086        self
8087    }
8088    #[doc = "The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests."]
8089    pub fn source(mut self, source: &'b str) -> Self {
8090        self.source = Some(source);
8091        self
8092    }
8093    #[doc = "Explicit operation timeout"]
8094    pub fn timeout(mut self, timeout: &'b str) -> Self {
8095        self.timeout = Some(timeout);
8096        self
8097    }
8098    #[doc = "Set the number of active shards to wait for on the shrunken index before the operation returns."]
8099    pub fn wait_for_active_shards(mut self, wait_for_active_shards: &'b str) -> Self {
8100        self.wait_for_active_shards = Some(wait_for_active_shards);
8101        self
8102    }
8103    #[doc = "Creates an asynchronous call to the Indices Split API that can be awaited"]
8104    pub async fn send(self) -> Result<Response, Error> {
8105        let path = self.parts.url();
8106        let method = Method::Post;
8107        let headers = self.headers;
8108        let timeout = self.request_timeout;
8109        let query_string = {
8110            #[serde_with::skip_serializing_none]
8111            #[derive(Serialize)]
8112            struct QueryParams<'b> {
8113                copy_settings: Option<bool>,
8114                error_trace: Option<bool>,
8115                #[serde(serialize_with = "crate::client::serialize_coll_qs")]
8116                filter_path: Option<&'b [&'b str]>,
8117                human: Option<bool>,
8118                master_timeout: Option<&'b str>,
8119                pretty: Option<bool>,
8120                source: Option<&'b str>,
8121                timeout: Option<&'b str>,
8122                wait_for_active_shards: Option<&'b str>,
8123            }
8124            let query_params = QueryParams {
8125                copy_settings: self.copy_settings,
8126                error_trace: self.error_trace,
8127                filter_path: self.filter_path,
8128                human: self.human,
8129                master_timeout: self.master_timeout,
8130                pretty: self.pretty,
8131                source: self.source,
8132                timeout: self.timeout,
8133                wait_for_active_shards: self.wait_for_active_shards,
8134            };
8135            Some(query_params)
8136        };
8137        let body = self.body;
8138        let response = self
8139            .transport
8140            .send(method, &path, headers, query_string.as_ref(), body, timeout)
8141            .await?;
8142        Ok(response)
8143    }
8144}
8145#[derive(Debug, Clone, PartialEq)]
8146#[doc = "API parts for the Indices Stats API"]
8147pub enum IndicesStatsParts<'b> {
8148    #[doc = "No parts"]
8149    None,
8150    #[doc = "Metric"]
8151    Metric(&'b [&'b str]),
8152    #[doc = "Index"]
8153    Index(&'b [&'b str]),
8154    #[doc = "Index and Metric"]
8155    IndexMetric(&'b [&'b str], &'b [&'b str]),
8156}
8157impl<'b> IndicesStatsParts<'b> {
8158    #[doc = "Builds a relative URL path to the Indices Stats API"]
8159    pub fn url(self) -> Cow<'static, str> {
8160        match self {
8161            IndicesStatsParts::None => "/_stats".into(),
8162            IndicesStatsParts::Metric(ref metric) => {
8163                let metric_str = metric.join(",");
8164                let encoded_metric: Cow<str> =
8165                    percent_encode(metric_str.as_bytes(), PARTS_ENCODED).into();
8166                let mut p = String::with_capacity(8usize + encoded_metric.len());
8167                p.push_str("/_stats/");
8168                p.push_str(encoded_metric.as_ref());
8169                p.into()
8170            }
8171            IndicesStatsParts::Index(ref index) => {
8172                let index_str = index.join(",");
8173                let encoded_index: Cow<str> =
8174                    percent_encode(index_str.as_bytes(), PARTS_ENCODED).into();
8175                let mut p = String::with_capacity(8usize + encoded_index.len());
8176                p.push_str("/");
8177                p.push_str(encoded_index.as_ref());
8178                p.push_str("/_stats");
8179                p.into()
8180            }
8181            IndicesStatsParts::IndexMetric(ref index, ref metric) => {
8182                let index_str = index.join(",");
8183                let metric_str = metric.join(",");
8184                let encoded_index: Cow<str> =
8185                    percent_encode(index_str.as_bytes(), PARTS_ENCODED).into();
8186                let encoded_metric: Cow<str> =
8187                    percent_encode(metric_str.as_bytes(), PARTS_ENCODED).into();
8188                let mut p =
8189                    String::with_capacity(9usize + encoded_index.len() + encoded_metric.len());
8190                p.push_str("/");
8191                p.push_str(encoded_index.as_ref());
8192                p.push_str("/_stats/");
8193                p.push_str(encoded_metric.as_ref());
8194                p.into()
8195            }
8196        }
8197    }
8198}
8199#[doc = "Builder for the [Indices Stats API](https://opensearch.org/docs/)\n\nProvides statistics on operations happening in an index."]
8200#[derive(Clone, Debug)]
8201pub struct IndicesStats<'a, 'b> {
8202    transport: &'a Transport,
8203    parts: IndicesStatsParts<'b>,
8204    completion_fields: Option<&'b [&'b str]>,
8205    error_trace: Option<bool>,
8206    expand_wildcards: Option<&'b [ExpandWildcards]>,
8207    fielddata_fields: Option<&'b [&'b str]>,
8208    fields: Option<&'b [&'b str]>,
8209    filter_path: Option<&'b [&'b str]>,
8210    forbid_closed_indices: Option<bool>,
8211    groups: Option<&'b [&'b str]>,
8212    headers: HeaderMap,
8213    human: Option<bool>,
8214    include_segment_file_sizes: Option<bool>,
8215    include_unloaded_segments: Option<bool>,
8216    level: Option<Level>,
8217    pretty: Option<bool>,
8218    request_timeout: Option<Duration>,
8219    source: Option<&'b str>,
8220    types: Option<&'b [&'b str]>,
8221}
8222impl<'a, 'b> IndicesStats<'a, 'b> {
8223    #[doc = "Creates a new instance of [IndicesStats] with the specified API parts"]
8224    pub fn new(transport: &'a Transport, parts: IndicesStatsParts<'b>) -> Self {
8225        let headers = HeaderMap::new();
8226        IndicesStats {
8227            transport,
8228            parts,
8229            headers,
8230            completion_fields: None,
8231            error_trace: None,
8232            expand_wildcards: None,
8233            fielddata_fields: None,
8234            fields: None,
8235            filter_path: None,
8236            forbid_closed_indices: None,
8237            groups: None,
8238            human: None,
8239            include_segment_file_sizes: None,
8240            include_unloaded_segments: None,
8241            level: None,
8242            pretty: None,
8243            request_timeout: None,
8244            source: None,
8245            types: None,
8246        }
8247    }
8248    #[doc = "A comma-separated list of fields for `fielddata` and `suggest` index metric (supports wildcards)"]
8249    pub fn completion_fields(mut self, completion_fields: &'b [&'b str]) -> Self {
8250        self.completion_fields = Some(completion_fields);
8251        self
8252    }
8253    #[doc = "Include the stack trace of returned errors."]
8254    pub fn error_trace(mut self, error_trace: bool) -> Self {
8255        self.error_trace = Some(error_trace);
8256        self
8257    }
8258    #[doc = "Whether to expand wildcard expression to concrete indices that are open, closed or both."]
8259    pub fn expand_wildcards(mut self, expand_wildcards: &'b [ExpandWildcards]) -> Self {
8260        self.expand_wildcards = Some(expand_wildcards);
8261        self
8262    }
8263    #[doc = "A comma-separated list of fields for `fielddata` index metric (supports wildcards)"]
8264    pub fn fielddata_fields(mut self, fielddata_fields: &'b [&'b str]) -> Self {
8265        self.fielddata_fields = Some(fielddata_fields);
8266        self
8267    }
8268    #[doc = "A comma-separated list of fields for `fielddata` and `completion` index metric (supports wildcards)"]
8269    pub fn fields(mut self, fields: &'b [&'b str]) -> Self {
8270        self.fields = Some(fields);
8271        self
8272    }
8273    #[doc = "A comma-separated list of filters used to reduce the response."]
8274    pub fn filter_path(mut self, filter_path: &'b [&'b str]) -> Self {
8275        self.filter_path = Some(filter_path);
8276        self
8277    }
8278    #[doc = "If set to false stats will also collected from closed indices if explicitly specified or if expand_wildcards expands to closed indices"]
8279    pub fn forbid_closed_indices(mut self, forbid_closed_indices: bool) -> Self {
8280        self.forbid_closed_indices = Some(forbid_closed_indices);
8281        self
8282    }
8283    #[doc = "A comma-separated list of search groups for `search` index metric"]
8284    pub fn groups(mut self, groups: &'b [&'b str]) -> Self {
8285        self.groups = Some(groups);
8286        self
8287    }
8288    #[doc = "Adds a HTTP header"]
8289    pub fn header(mut self, key: HeaderName, value: HeaderValue) -> Self {
8290        self.headers.insert(key, value);
8291        self
8292    }
8293    #[doc = "Return human readable values for statistics."]
8294    pub fn human(mut self, human: bool) -> Self {
8295        self.human = Some(human);
8296        self
8297    }
8298    #[doc = "Whether to report the aggregated disk usage of each one of the Lucene index files (only applies if segment stats are requested)"]
8299    pub fn include_segment_file_sizes(mut self, include_segment_file_sizes: bool) -> Self {
8300        self.include_segment_file_sizes = Some(include_segment_file_sizes);
8301        self
8302    }
8303    #[doc = "If set to true segment stats will include stats for segments that are not currently loaded into memory"]
8304    pub fn include_unloaded_segments(mut self, include_unloaded_segments: bool) -> Self {
8305        self.include_unloaded_segments = Some(include_unloaded_segments);
8306        self
8307    }
8308    #[doc = "Return stats aggregated at cluster, index or shard level"]
8309    pub fn level(mut self, level: Level) -> Self {
8310        self.level = Some(level);
8311        self
8312    }
8313    #[doc = "Pretty format the returned JSON response."]
8314    pub fn pretty(mut self, pretty: bool) -> Self {
8315        self.pretty = Some(pretty);
8316        self
8317    }
8318    #[doc = "Sets a request timeout for this API call.\n\nThe timeout is applied from when the request starts connecting until the response body has finished."]
8319    pub fn request_timeout(mut self, timeout: Duration) -> Self {
8320        self.request_timeout = Some(timeout);
8321        self
8322    }
8323    #[doc = "The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests."]
8324    pub fn source(mut self, source: &'b str) -> Self {
8325        self.source = Some(source);
8326        self
8327    }
8328    #[doc = "A comma-separated list of document types for the `indexing` index metric"]
8329    pub fn types(mut self, types: &'b [&'b str]) -> Self {
8330        self.types = Some(types);
8331        self
8332    }
8333    #[doc = "Creates an asynchronous call to the Indices Stats API that can be awaited"]
8334    pub async fn send(self) -> Result<Response, Error> {
8335        let path = self.parts.url();
8336        let method = Method::Get;
8337        let headers = self.headers;
8338        let timeout = self.request_timeout;
8339        let query_string = {
8340            #[serde_with::skip_serializing_none]
8341            #[derive(Serialize)]
8342            struct QueryParams<'b> {
8343                #[serde(serialize_with = "crate::client::serialize_coll_qs")]
8344                completion_fields: Option<&'b [&'b str]>,
8345                error_trace: Option<bool>,
8346                #[serde(serialize_with = "crate::client::serialize_coll_qs")]
8347                expand_wildcards: Option<&'b [ExpandWildcards]>,
8348                #[serde(serialize_with = "crate::client::serialize_coll_qs")]
8349                fielddata_fields: Option<&'b [&'b str]>,
8350                #[serde(serialize_with = "crate::client::serialize_coll_qs")]
8351                fields: Option<&'b [&'b str]>,
8352                #[serde(serialize_with = "crate::client::serialize_coll_qs")]
8353                filter_path: Option<&'b [&'b str]>,
8354                forbid_closed_indices: Option<bool>,
8355                #[serde(serialize_with = "crate::client::serialize_coll_qs")]
8356                groups: Option<&'b [&'b str]>,
8357                human: Option<bool>,
8358                include_segment_file_sizes: Option<bool>,
8359                include_unloaded_segments: Option<bool>,
8360                level: Option<Level>,
8361                pretty: Option<bool>,
8362                source: Option<&'b str>,
8363                #[serde(serialize_with = "crate::client::serialize_coll_qs")]
8364                types: Option<&'b [&'b str]>,
8365            }
8366            let query_params = QueryParams {
8367                completion_fields: self.completion_fields,
8368                error_trace: self.error_trace,
8369                expand_wildcards: self.expand_wildcards,
8370                fielddata_fields: self.fielddata_fields,
8371                fields: self.fields,
8372                filter_path: self.filter_path,
8373                forbid_closed_indices: self.forbid_closed_indices,
8374                groups: self.groups,
8375                human: self.human,
8376                include_segment_file_sizes: self.include_segment_file_sizes,
8377                include_unloaded_segments: self.include_unloaded_segments,
8378                level: self.level,
8379                pretty: self.pretty,
8380                source: self.source,
8381                types: self.types,
8382            };
8383            Some(query_params)
8384        };
8385        let body = Option::<()>::None;
8386        let response = self
8387            .transport
8388            .send(method, &path, headers, query_string.as_ref(), body, timeout)
8389            .await?;
8390        Ok(response)
8391    }
8392}
8393#[derive(Debug, Clone, PartialEq)]
8394#[doc = "API parts for the Indices Unfreeze API"]
8395pub enum IndicesUnfreezeParts<'b> {
8396    #[doc = "Index"]
8397    Index(&'b str),
8398}
8399impl<'b> IndicesUnfreezeParts<'b> {
8400    #[doc = "Builds a relative URL path to the Indices Unfreeze API"]
8401    pub fn url(self) -> Cow<'static, str> {
8402        match self {
8403            IndicesUnfreezeParts::Index(ref index) => {
8404                let encoded_index: Cow<str> =
8405                    percent_encode(index.as_bytes(), PARTS_ENCODED).into();
8406                let mut p = String::with_capacity(11usize + encoded_index.len());
8407                p.push_str("/");
8408                p.push_str(encoded_index.as_ref());
8409                p.push_str("/_unfreeze");
8410                p.into()
8411            }
8412        }
8413    }
8414}
8415#[doc = "Builder for the [Indices Unfreeze API](https://opensearch.org/docs/)\n\nUnfreezes an index. When a frozen index is unfrozen, the index goes through the normal recovery process and becomes writeable again."]
8416#[derive(Clone, Debug)]
8417pub struct IndicesUnfreeze<'a, 'b, B> {
8418    transport: &'a Transport,
8419    parts: IndicesUnfreezeParts<'b>,
8420    allow_no_indices: Option<bool>,
8421    body: Option<B>,
8422    error_trace: Option<bool>,
8423    expand_wildcards: Option<&'b [ExpandWildcards]>,
8424    filter_path: Option<&'b [&'b str]>,
8425    headers: HeaderMap,
8426    human: Option<bool>,
8427    ignore_unavailable: Option<bool>,
8428    master_timeout: Option<&'b str>,
8429    pretty: Option<bool>,
8430    request_timeout: Option<Duration>,
8431    source: Option<&'b str>,
8432    timeout: Option<&'b str>,
8433    wait_for_active_shards: Option<&'b str>,
8434}
8435impl<'a, 'b, B> IndicesUnfreeze<'a, 'b, B>
8436where
8437    B: Body,
8438{
8439    #[doc = "Creates a new instance of [IndicesUnfreeze] with the specified API parts"]
8440    pub fn new(transport: &'a Transport, parts: IndicesUnfreezeParts<'b>) -> Self {
8441        let headers = HeaderMap::new();
8442        IndicesUnfreeze {
8443            transport,
8444            parts,
8445            headers,
8446            allow_no_indices: None,
8447            body: None,
8448            error_trace: None,
8449            expand_wildcards: None,
8450            filter_path: None,
8451            human: None,
8452            ignore_unavailable: None,
8453            master_timeout: None,
8454            pretty: None,
8455            request_timeout: None,
8456            source: None,
8457            timeout: None,
8458            wait_for_active_shards: None,
8459        }
8460    }
8461    #[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)"]
8462    pub fn allow_no_indices(mut self, allow_no_indices: bool) -> Self {
8463        self.allow_no_indices = Some(allow_no_indices);
8464        self
8465    }
8466    #[doc = "The body for the API call"]
8467    pub fn body<T>(self, body: T) -> IndicesUnfreeze<'a, 'b, JsonBody<T>>
8468    where
8469        T: Serialize,
8470    {
8471        IndicesUnfreeze {
8472            transport: self.transport,
8473            parts: self.parts,
8474            body: Some(body.into()),
8475            allow_no_indices: self.allow_no_indices,
8476            error_trace: self.error_trace,
8477            expand_wildcards: self.expand_wildcards,
8478            filter_path: self.filter_path,
8479            headers: self.headers,
8480            human: self.human,
8481            ignore_unavailable: self.ignore_unavailable,
8482            master_timeout: self.master_timeout,
8483            pretty: self.pretty,
8484            request_timeout: self.request_timeout,
8485            source: self.source,
8486            timeout: self.timeout,
8487            wait_for_active_shards: self.wait_for_active_shards,
8488        }
8489    }
8490    #[doc = "Include the stack trace of returned errors."]
8491    pub fn error_trace(mut self, error_trace: bool) -> Self {
8492        self.error_trace = Some(error_trace);
8493        self
8494    }
8495    #[doc = "Whether to expand wildcard expression to concrete indices that are open, closed or both."]
8496    pub fn expand_wildcards(mut self, expand_wildcards: &'b [ExpandWildcards]) -> Self {
8497        self.expand_wildcards = Some(expand_wildcards);
8498        self
8499    }
8500    #[doc = "A comma-separated list of filters used to reduce the response."]
8501    pub fn filter_path(mut self, filter_path: &'b [&'b str]) -> Self {
8502        self.filter_path = Some(filter_path);
8503        self
8504    }
8505    #[doc = "Adds a HTTP header"]
8506    pub fn header(mut self, key: HeaderName, value: HeaderValue) -> Self {
8507        self.headers.insert(key, value);
8508        self
8509    }
8510    #[doc = "Return human readable values for statistics."]
8511    pub fn human(mut self, human: bool) -> Self {
8512        self.human = Some(human);
8513        self
8514    }
8515    #[doc = "Whether specified concrete indices should be ignored when unavailable (missing or closed)"]
8516    pub fn ignore_unavailable(mut self, ignore_unavailable: bool) -> Self {
8517        self.ignore_unavailable = Some(ignore_unavailable);
8518        self
8519    }
8520    #[doc = "Specify timeout for connection to master"]
8521    pub fn master_timeout(mut self, master_timeout: &'b str) -> Self {
8522        self.master_timeout = Some(master_timeout);
8523        self
8524    }
8525    #[doc = "Pretty format the returned JSON response."]
8526    pub fn pretty(mut self, pretty: bool) -> Self {
8527        self.pretty = Some(pretty);
8528        self
8529    }
8530    #[doc = "Sets a request timeout for this API call.\n\nThe timeout is applied from when the request starts connecting until the response body has finished."]
8531    pub fn request_timeout(mut self, timeout: Duration) -> Self {
8532        self.request_timeout = Some(timeout);
8533        self
8534    }
8535    #[doc = "The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests."]
8536    pub fn source(mut self, source: &'b str) -> Self {
8537        self.source = Some(source);
8538        self
8539    }
8540    #[doc = "Explicit operation timeout"]
8541    pub fn timeout(mut self, timeout: &'b str) -> Self {
8542        self.timeout = Some(timeout);
8543        self
8544    }
8545    #[doc = "Sets the number of active shards to wait for before the operation returns."]
8546    pub fn wait_for_active_shards(mut self, wait_for_active_shards: &'b str) -> Self {
8547        self.wait_for_active_shards = Some(wait_for_active_shards);
8548        self
8549    }
8550    #[doc = "Creates an asynchronous call to the Indices Unfreeze API that can be awaited"]
8551    pub async fn send(self) -> Result<Response, Error> {
8552        let path = self.parts.url();
8553        let method = Method::Post;
8554        let headers = self.headers;
8555        let timeout = self.request_timeout;
8556        let query_string = {
8557            #[serde_with::skip_serializing_none]
8558            #[derive(Serialize)]
8559            struct QueryParams<'b> {
8560                allow_no_indices: Option<bool>,
8561                error_trace: Option<bool>,
8562                #[serde(serialize_with = "crate::client::serialize_coll_qs")]
8563                expand_wildcards: Option<&'b [ExpandWildcards]>,
8564                #[serde(serialize_with = "crate::client::serialize_coll_qs")]
8565                filter_path: Option<&'b [&'b str]>,
8566                human: Option<bool>,
8567                ignore_unavailable: Option<bool>,
8568                master_timeout: Option<&'b str>,
8569                pretty: Option<bool>,
8570                source: Option<&'b str>,
8571                timeout: Option<&'b str>,
8572                wait_for_active_shards: Option<&'b str>,
8573            }
8574            let query_params = QueryParams {
8575                allow_no_indices: self.allow_no_indices,
8576                error_trace: self.error_trace,
8577                expand_wildcards: self.expand_wildcards,
8578                filter_path: self.filter_path,
8579                human: self.human,
8580                ignore_unavailable: self.ignore_unavailable,
8581                master_timeout: self.master_timeout,
8582                pretty: self.pretty,
8583                source: self.source,
8584                timeout: self.timeout,
8585                wait_for_active_shards: self.wait_for_active_shards,
8586            };
8587            Some(query_params)
8588        };
8589        let body = self.body;
8590        let response = self
8591            .transport
8592            .send(method, &path, headers, query_string.as_ref(), body, timeout)
8593            .await?;
8594        Ok(response)
8595    }
8596}
8597#[derive(Debug, Clone, PartialEq)]
8598#[doc = "API parts for the Indices Update Aliases API"]
8599pub enum IndicesUpdateAliasesParts {
8600    #[doc = "No parts"]
8601    None,
8602}
8603impl IndicesUpdateAliasesParts {
8604    #[doc = "Builds a relative URL path to the Indices Update Aliases API"]
8605    pub fn url(self) -> Cow<'static, str> {
8606        match self {
8607            IndicesUpdateAliasesParts::None => "/_aliases".into(),
8608        }
8609    }
8610}
8611#[doc = "Builder for the [Indices Update Aliases API](https://opensearch.org/docs/)\n\nUpdates index aliases."]
8612#[derive(Clone, Debug)]
8613pub struct IndicesUpdateAliases<'a, 'b, B> {
8614    transport: &'a Transport,
8615    parts: IndicesUpdateAliasesParts,
8616    body: Option<B>,
8617    error_trace: Option<bool>,
8618    filter_path: Option<&'b [&'b str]>,
8619    headers: HeaderMap,
8620    human: Option<bool>,
8621    master_timeout: Option<&'b str>,
8622    pretty: Option<bool>,
8623    request_timeout: Option<Duration>,
8624    source: Option<&'b str>,
8625    timeout: Option<&'b str>,
8626}
8627impl<'a, 'b, B> IndicesUpdateAliases<'a, 'b, B>
8628where
8629    B: Body,
8630{
8631    #[doc = "Creates a new instance of [IndicesUpdateAliases]"]
8632    pub fn new(transport: &'a Transport) -> Self {
8633        let headers = HeaderMap::new();
8634        IndicesUpdateAliases {
8635            transport,
8636            parts: IndicesUpdateAliasesParts::None,
8637            headers,
8638            body: None,
8639            error_trace: None,
8640            filter_path: None,
8641            human: None,
8642            master_timeout: None,
8643            pretty: None,
8644            request_timeout: None,
8645            source: None,
8646            timeout: None,
8647        }
8648    }
8649    #[doc = "The body for the API call"]
8650    pub fn body<T>(self, body: T) -> IndicesUpdateAliases<'a, 'b, JsonBody<T>>
8651    where
8652        T: Serialize,
8653    {
8654        IndicesUpdateAliases {
8655            transport: self.transport,
8656            parts: self.parts,
8657            body: Some(body.into()),
8658            error_trace: self.error_trace,
8659            filter_path: self.filter_path,
8660            headers: self.headers,
8661            human: self.human,
8662            master_timeout: self.master_timeout,
8663            pretty: self.pretty,
8664            request_timeout: self.request_timeout,
8665            source: self.source,
8666            timeout: self.timeout,
8667        }
8668    }
8669    #[doc = "Include the stack trace of returned errors."]
8670    pub fn error_trace(mut self, error_trace: bool) -> Self {
8671        self.error_trace = Some(error_trace);
8672        self
8673    }
8674    #[doc = "A comma-separated list of filters used to reduce the response."]
8675    pub fn filter_path(mut self, filter_path: &'b [&'b str]) -> Self {
8676        self.filter_path = Some(filter_path);
8677        self
8678    }
8679    #[doc = "Adds a HTTP header"]
8680    pub fn header(mut self, key: HeaderName, value: HeaderValue) -> Self {
8681        self.headers.insert(key, value);
8682        self
8683    }
8684    #[doc = "Return human readable values for statistics."]
8685    pub fn human(mut self, human: bool) -> Self {
8686        self.human = Some(human);
8687        self
8688    }
8689    #[doc = "Specify timeout for connection to master"]
8690    pub fn master_timeout(mut self, master_timeout: &'b str) -> Self {
8691        self.master_timeout = Some(master_timeout);
8692        self
8693    }
8694    #[doc = "Pretty format the returned JSON response."]
8695    pub fn pretty(mut self, pretty: bool) -> Self {
8696        self.pretty = Some(pretty);
8697        self
8698    }
8699    #[doc = "Sets a request timeout for this API call.\n\nThe timeout is applied from when the request starts connecting until the response body has finished."]
8700    pub fn request_timeout(mut self, timeout: Duration) -> Self {
8701        self.request_timeout = Some(timeout);
8702        self
8703    }
8704    #[doc = "The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests."]
8705    pub fn source(mut self, source: &'b str) -> Self {
8706        self.source = Some(source);
8707        self
8708    }
8709    #[doc = "Request timeout"]
8710    pub fn timeout(mut self, timeout: &'b str) -> Self {
8711        self.timeout = Some(timeout);
8712        self
8713    }
8714    #[doc = "Creates an asynchronous call to the Indices Update Aliases API that can be awaited"]
8715    pub async fn send(self) -> Result<Response, Error> {
8716        let path = self.parts.url();
8717        let method = Method::Post;
8718        let headers = self.headers;
8719        let timeout = self.request_timeout;
8720        let query_string = {
8721            #[serde_with::skip_serializing_none]
8722            #[derive(Serialize)]
8723            struct QueryParams<'b> {
8724                error_trace: Option<bool>,
8725                #[serde(serialize_with = "crate::client::serialize_coll_qs")]
8726                filter_path: Option<&'b [&'b str]>,
8727                human: Option<bool>,
8728                master_timeout: Option<&'b str>,
8729                pretty: Option<bool>,
8730                source: Option<&'b str>,
8731                timeout: Option<&'b str>,
8732            }
8733            let query_params = QueryParams {
8734                error_trace: self.error_trace,
8735                filter_path: self.filter_path,
8736                human: self.human,
8737                master_timeout: self.master_timeout,
8738                pretty: self.pretty,
8739                source: self.source,
8740                timeout: self.timeout,
8741            };
8742            Some(query_params)
8743        };
8744        let body = self.body;
8745        let response = self
8746            .transport
8747            .send(method, &path, headers, query_string.as_ref(), body, timeout)
8748            .await?;
8749        Ok(response)
8750    }
8751}
8752#[derive(Debug, Clone, PartialEq)]
8753#[doc = "API parts for the Indices Upgrade API"]
8754pub enum IndicesUpgradeParts<'b> {
8755    #[doc = "No parts"]
8756    None,
8757    #[doc = "Index"]
8758    Index(&'b [&'b str]),
8759}
8760impl<'b> IndicesUpgradeParts<'b> {
8761    #[doc = "Builds a relative URL path to the Indices Upgrade API"]
8762    pub fn url(self) -> Cow<'static, str> {
8763        match self {
8764            IndicesUpgradeParts::None => "/_upgrade".into(),
8765            IndicesUpgradeParts::Index(ref index) => {
8766                let index_str = index.join(",");
8767                let encoded_index: Cow<str> =
8768                    percent_encode(index_str.as_bytes(), PARTS_ENCODED).into();
8769                let mut p = String::with_capacity(10usize + encoded_index.len());
8770                p.push_str("/");
8771                p.push_str(encoded_index.as_ref());
8772                p.push_str("/_upgrade");
8773                p.into()
8774            }
8775        }
8776    }
8777}
8778#[doc = "Builder for the [Indices Upgrade API](https://opensearch.org/docs/)\n\nDEPRECATED Upgrades to the current version of Lucene."]
8779#[derive(Clone, Debug)]
8780pub struct IndicesUpgrade<'a, 'b, B> {
8781    transport: &'a Transport,
8782    parts: IndicesUpgradeParts<'b>,
8783    allow_no_indices: Option<bool>,
8784    body: Option<B>,
8785    error_trace: Option<bool>,
8786    expand_wildcards: Option<&'b [ExpandWildcards]>,
8787    filter_path: Option<&'b [&'b str]>,
8788    headers: HeaderMap,
8789    human: Option<bool>,
8790    ignore_unavailable: Option<bool>,
8791    only_ancient_segments: Option<bool>,
8792    pretty: Option<bool>,
8793    request_timeout: Option<Duration>,
8794    source: Option<&'b str>,
8795    wait_for_completion: Option<bool>,
8796}
8797impl<'a, 'b, B> IndicesUpgrade<'a, 'b, B>
8798where
8799    B: Body,
8800{
8801    #[doc = "Creates a new instance of [IndicesUpgrade] with the specified API parts"]
8802    pub fn new(transport: &'a Transport, parts: IndicesUpgradeParts<'b>) -> Self {
8803        let headers = HeaderMap::new();
8804        IndicesUpgrade {
8805            transport,
8806            parts,
8807            headers,
8808            allow_no_indices: None,
8809            body: None,
8810            error_trace: None,
8811            expand_wildcards: None,
8812            filter_path: None,
8813            human: None,
8814            ignore_unavailable: None,
8815            only_ancient_segments: None,
8816            pretty: None,
8817            request_timeout: None,
8818            source: None,
8819            wait_for_completion: None,
8820        }
8821    }
8822    #[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)"]
8823    pub fn allow_no_indices(mut self, allow_no_indices: bool) -> Self {
8824        self.allow_no_indices = Some(allow_no_indices);
8825        self
8826    }
8827    #[doc = "The body for the API call"]
8828    pub fn body<T>(self, body: T) -> IndicesUpgrade<'a, 'b, JsonBody<T>>
8829    where
8830        T: Serialize,
8831    {
8832        IndicesUpgrade {
8833            transport: self.transport,
8834            parts: self.parts,
8835            body: Some(body.into()),
8836            allow_no_indices: self.allow_no_indices,
8837            error_trace: self.error_trace,
8838            expand_wildcards: self.expand_wildcards,
8839            filter_path: self.filter_path,
8840            headers: self.headers,
8841            human: self.human,
8842            ignore_unavailable: self.ignore_unavailable,
8843            only_ancient_segments: self.only_ancient_segments,
8844            pretty: self.pretty,
8845            request_timeout: self.request_timeout,
8846            source: self.source,
8847            wait_for_completion: self.wait_for_completion,
8848        }
8849    }
8850    #[doc = "Include the stack trace of returned errors."]
8851    pub fn error_trace(mut self, error_trace: bool) -> Self {
8852        self.error_trace = Some(error_trace);
8853        self
8854    }
8855    #[doc = "Whether to expand wildcard expression to concrete indices that are open, closed or both."]
8856    pub fn expand_wildcards(mut self, expand_wildcards: &'b [ExpandWildcards]) -> Self {
8857        self.expand_wildcards = Some(expand_wildcards);
8858        self
8859    }
8860    #[doc = "A comma-separated list of filters used to reduce the response."]
8861    pub fn filter_path(mut self, filter_path: &'b [&'b str]) -> Self {
8862        self.filter_path = Some(filter_path);
8863        self
8864    }
8865    #[doc = "Adds a HTTP header"]
8866    pub fn header(mut self, key: HeaderName, value: HeaderValue) -> Self {
8867        self.headers.insert(key, value);
8868        self
8869    }
8870    #[doc = "Return human readable values for statistics."]
8871    pub fn human(mut self, human: bool) -> Self {
8872        self.human = Some(human);
8873        self
8874    }
8875    #[doc = "Whether specified concrete indices should be ignored when unavailable (missing or closed)"]
8876    pub fn ignore_unavailable(mut self, ignore_unavailable: bool) -> Self {
8877        self.ignore_unavailable = Some(ignore_unavailable);
8878        self
8879    }
8880    #[doc = "If true, only ancient (an older Lucene major release) segments will be upgraded"]
8881    pub fn only_ancient_segments(mut self, only_ancient_segments: bool) -> Self {
8882        self.only_ancient_segments = Some(only_ancient_segments);
8883        self
8884    }
8885    #[doc = "Pretty format the returned JSON response."]
8886    pub fn pretty(mut self, pretty: bool) -> Self {
8887        self.pretty = Some(pretty);
8888        self
8889    }
8890    #[doc = "Sets a request timeout for this API call.\n\nThe timeout is applied from when the request starts connecting until the response body has finished."]
8891    pub fn request_timeout(mut self, timeout: Duration) -> Self {
8892        self.request_timeout = Some(timeout);
8893        self
8894    }
8895    #[doc = "The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests."]
8896    pub fn source(mut self, source: &'b str) -> Self {
8897        self.source = Some(source);
8898        self
8899    }
8900    #[doc = "Specify whether the request should block until the all segments are upgraded (default: false)"]
8901    pub fn wait_for_completion(mut self, wait_for_completion: bool) -> Self {
8902        self.wait_for_completion = Some(wait_for_completion);
8903        self
8904    }
8905    #[doc = "Creates an asynchronous call to the Indices Upgrade API that can be awaited"]
8906    pub async fn send(self) -> Result<Response, Error> {
8907        let path = self.parts.url();
8908        let method = Method::Post;
8909        let headers = self.headers;
8910        let timeout = self.request_timeout;
8911        let query_string = {
8912            #[serde_with::skip_serializing_none]
8913            #[derive(Serialize)]
8914            struct QueryParams<'b> {
8915                allow_no_indices: Option<bool>,
8916                error_trace: Option<bool>,
8917                #[serde(serialize_with = "crate::client::serialize_coll_qs")]
8918                expand_wildcards: Option<&'b [ExpandWildcards]>,
8919                #[serde(serialize_with = "crate::client::serialize_coll_qs")]
8920                filter_path: Option<&'b [&'b str]>,
8921                human: Option<bool>,
8922                ignore_unavailable: Option<bool>,
8923                only_ancient_segments: Option<bool>,
8924                pretty: Option<bool>,
8925                source: Option<&'b str>,
8926                wait_for_completion: Option<bool>,
8927            }
8928            let query_params = QueryParams {
8929                allow_no_indices: self.allow_no_indices,
8930                error_trace: self.error_trace,
8931                expand_wildcards: self.expand_wildcards,
8932                filter_path: self.filter_path,
8933                human: self.human,
8934                ignore_unavailable: self.ignore_unavailable,
8935                only_ancient_segments: self.only_ancient_segments,
8936                pretty: self.pretty,
8937                source: self.source,
8938                wait_for_completion: self.wait_for_completion,
8939            };
8940            Some(query_params)
8941        };
8942        let body = self.body;
8943        let response = self
8944            .transport
8945            .send(method, &path, headers, query_string.as_ref(), body, timeout)
8946            .await?;
8947        Ok(response)
8948    }
8949}
8950#[derive(Debug, Clone, PartialEq)]
8951#[doc = "API parts for the Indices Validate Query API"]
8952pub enum IndicesValidateQueryParts<'b> {
8953    #[doc = "No parts"]
8954    None,
8955    #[doc = "Index"]
8956    Index(&'b [&'b str]),
8957    #[doc = "Index and Type"]
8958    IndexType(&'b [&'b str], &'b [&'b str]),
8959}
8960impl<'b> IndicesValidateQueryParts<'b> {
8961    #[doc = "Builds a relative URL path to the Indices Validate Query API"]
8962    pub fn url(self) -> Cow<'static, str> {
8963        match self {
8964            IndicesValidateQueryParts::None => "/_validate/query".into(),
8965            IndicesValidateQueryParts::Index(ref index) => {
8966                let index_str = index.join(",");
8967                let encoded_index: Cow<str> =
8968                    percent_encode(index_str.as_bytes(), PARTS_ENCODED).into();
8969                let mut p = String::with_capacity(17usize + encoded_index.len());
8970                p.push_str("/");
8971                p.push_str(encoded_index.as_ref());
8972                p.push_str("/_validate/query");
8973                p.into()
8974            }
8975            IndicesValidateQueryParts::IndexType(ref index, ref ty) => {
8976                let index_str = index.join(",");
8977                let ty_str = ty.join(",");
8978                let encoded_index: Cow<str> =
8979                    percent_encode(index_str.as_bytes(), PARTS_ENCODED).into();
8980                let encoded_ty: Cow<str> = percent_encode(ty_str.as_bytes(), PARTS_ENCODED).into();
8981                let mut p = String::with_capacity(18usize + encoded_index.len() + encoded_ty.len());
8982                p.push_str("/");
8983                p.push_str(encoded_index.as_ref());
8984                p.push_str("/");
8985                p.push_str(encoded_ty.as_ref());
8986                p.push_str("/_validate/query");
8987                p.into()
8988            }
8989        }
8990    }
8991}
8992#[doc = "Builder for the [Indices Validate Query API](https://opensearch.org/docs/)\n\nAllows a user to validate a potentially expensive query without executing it."]
8993#[derive(Clone, Debug)]
8994pub struct IndicesValidateQuery<'a, 'b, B> {
8995    transport: &'a Transport,
8996    parts: IndicesValidateQueryParts<'b>,
8997    all_shards: Option<bool>,
8998    allow_no_indices: Option<bool>,
8999    analyze_wildcard: Option<bool>,
9000    analyzer: Option<&'b str>,
9001    body: Option<B>,
9002    default_operator: Option<DefaultOperator>,
9003    df: Option<&'b str>,
9004    error_trace: Option<bool>,
9005    expand_wildcards: Option<&'b [ExpandWildcards]>,
9006    explain: Option<bool>,
9007    filter_path: Option<&'b [&'b str]>,
9008    headers: HeaderMap,
9009    human: Option<bool>,
9010    ignore_unavailable: Option<bool>,
9011    lenient: Option<bool>,
9012    pretty: Option<bool>,
9013    q: Option<&'b str>,
9014    request_timeout: Option<Duration>,
9015    rewrite: Option<bool>,
9016    source: Option<&'b str>,
9017}
9018impl<'a, 'b, B> IndicesValidateQuery<'a, 'b, B>
9019where
9020    B: Body,
9021{
9022    #[doc = "Creates a new instance of [IndicesValidateQuery] with the specified API parts"]
9023    pub fn new(transport: &'a Transport, parts: IndicesValidateQueryParts<'b>) -> Self {
9024        let headers = HeaderMap::new();
9025        IndicesValidateQuery {
9026            transport,
9027            parts,
9028            headers,
9029            all_shards: None,
9030            allow_no_indices: None,
9031            analyze_wildcard: None,
9032            analyzer: None,
9033            body: None,
9034            default_operator: None,
9035            df: None,
9036            error_trace: None,
9037            expand_wildcards: None,
9038            explain: None,
9039            filter_path: None,
9040            human: None,
9041            ignore_unavailable: None,
9042            lenient: None,
9043            pretty: None,
9044            q: None,
9045            request_timeout: None,
9046            rewrite: None,
9047            source: None,
9048        }
9049    }
9050    #[doc = "Execute validation on all shards instead of one random shard per index"]
9051    pub fn all_shards(mut self, all_shards: bool) -> Self {
9052        self.all_shards = Some(all_shards);
9053        self
9054    }
9055    #[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)"]
9056    pub fn allow_no_indices(mut self, allow_no_indices: bool) -> Self {
9057        self.allow_no_indices = Some(allow_no_indices);
9058        self
9059    }
9060    #[doc = "Specify whether wildcard and prefix queries should be analyzed (default: false)"]
9061    pub fn analyze_wildcard(mut self, analyze_wildcard: bool) -> Self {
9062        self.analyze_wildcard = Some(analyze_wildcard);
9063        self
9064    }
9065    #[doc = "The analyzer to use for the query string"]
9066    pub fn analyzer(mut self, analyzer: &'b str) -> Self {
9067        self.analyzer = Some(analyzer);
9068        self
9069    }
9070    #[doc = "The body for the API call"]
9071    pub fn body<T>(self, body: T) -> IndicesValidateQuery<'a, 'b, JsonBody<T>>
9072    where
9073        T: Serialize,
9074    {
9075        IndicesValidateQuery {
9076            transport: self.transport,
9077            parts: self.parts,
9078            body: Some(body.into()),
9079            all_shards: self.all_shards,
9080            allow_no_indices: self.allow_no_indices,
9081            analyze_wildcard: self.analyze_wildcard,
9082            analyzer: self.analyzer,
9083            default_operator: self.default_operator,
9084            df: self.df,
9085            error_trace: self.error_trace,
9086            expand_wildcards: self.expand_wildcards,
9087            explain: self.explain,
9088            filter_path: self.filter_path,
9089            headers: self.headers,
9090            human: self.human,
9091            ignore_unavailable: self.ignore_unavailable,
9092            lenient: self.lenient,
9093            pretty: self.pretty,
9094            q: self.q,
9095            request_timeout: self.request_timeout,
9096            rewrite: self.rewrite,
9097            source: self.source,
9098        }
9099    }
9100    #[doc = "The default operator for query string query (AND or OR)"]
9101    pub fn default_operator(mut self, default_operator: DefaultOperator) -> Self {
9102        self.default_operator = Some(default_operator);
9103        self
9104    }
9105    #[doc = "The field to use as default where no field prefix is given in the query string"]
9106    pub fn df(mut self, df: &'b str) -> Self {
9107        self.df = Some(df);
9108        self
9109    }
9110    #[doc = "Include the stack trace of returned errors."]
9111    pub fn error_trace(mut self, error_trace: bool) -> Self {
9112        self.error_trace = Some(error_trace);
9113        self
9114    }
9115    #[doc = "Whether to expand wildcard expression to concrete indices that are open, closed or both."]
9116    pub fn expand_wildcards(mut self, expand_wildcards: &'b [ExpandWildcards]) -> Self {
9117        self.expand_wildcards = Some(expand_wildcards);
9118        self
9119    }
9120    #[doc = "Return detailed information about the error"]
9121    pub fn explain(mut self, explain: bool) -> Self {
9122        self.explain = Some(explain);
9123        self
9124    }
9125    #[doc = "A comma-separated list of filters used to reduce the response."]
9126    pub fn filter_path(mut self, filter_path: &'b [&'b str]) -> Self {
9127        self.filter_path = Some(filter_path);
9128        self
9129    }
9130    #[doc = "Adds a HTTP header"]
9131    pub fn header(mut self, key: HeaderName, value: HeaderValue) -> Self {
9132        self.headers.insert(key, value);
9133        self
9134    }
9135    #[doc = "Return human readable values for statistics."]
9136    pub fn human(mut self, human: bool) -> Self {
9137        self.human = Some(human);
9138        self
9139    }
9140    #[doc = "Whether specified concrete indices should be ignored when unavailable (missing or closed)"]
9141    pub fn ignore_unavailable(mut self, ignore_unavailable: bool) -> Self {
9142        self.ignore_unavailable = Some(ignore_unavailable);
9143        self
9144    }
9145    #[doc = "Specify whether format-based query failures (such as providing text to a numeric field) should be ignored"]
9146    pub fn lenient(mut self, lenient: bool) -> Self {
9147        self.lenient = Some(lenient);
9148        self
9149    }
9150    #[doc = "Pretty format the returned JSON response."]
9151    pub fn pretty(mut self, pretty: bool) -> Self {
9152        self.pretty = Some(pretty);
9153        self
9154    }
9155    #[doc = "Query in the Lucene query string syntax"]
9156    pub fn q(mut self, q: &'b str) -> Self {
9157        self.q = Some(q);
9158        self
9159    }
9160    #[doc = "Sets a request timeout for this API call.\n\nThe timeout is applied from when the request starts connecting until the response body has finished."]
9161    pub fn request_timeout(mut self, timeout: Duration) -> Self {
9162        self.request_timeout = Some(timeout);
9163        self
9164    }
9165    #[doc = "Provide a more detailed explanation showing the actual Lucene query that will be executed."]
9166    pub fn rewrite(mut self, rewrite: bool) -> Self {
9167        self.rewrite = Some(rewrite);
9168        self
9169    }
9170    #[doc = "The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests."]
9171    pub fn source(mut self, source: &'b str) -> Self {
9172        self.source = Some(source);
9173        self
9174    }
9175    #[doc = "Creates an asynchronous call to the Indices Validate Query API that can be awaited"]
9176    pub async fn send(self) -> Result<Response, Error> {
9177        let path = self.parts.url();
9178        let method = match self.body {
9179            Some(_) => Method::Post,
9180            None => Method::Get,
9181        };
9182        let headers = self.headers;
9183        let timeout = self.request_timeout;
9184        let query_string = {
9185            #[serde_with::skip_serializing_none]
9186            #[derive(Serialize)]
9187            struct QueryParams<'b> {
9188                all_shards: Option<bool>,
9189                allow_no_indices: Option<bool>,
9190                analyze_wildcard: Option<bool>,
9191                analyzer: Option<&'b str>,
9192                default_operator: Option<DefaultOperator>,
9193                df: Option<&'b str>,
9194                error_trace: Option<bool>,
9195                #[serde(serialize_with = "crate::client::serialize_coll_qs")]
9196                expand_wildcards: Option<&'b [ExpandWildcards]>,
9197                explain: Option<bool>,
9198                #[serde(serialize_with = "crate::client::serialize_coll_qs")]
9199                filter_path: Option<&'b [&'b str]>,
9200                human: Option<bool>,
9201                ignore_unavailable: Option<bool>,
9202                lenient: Option<bool>,
9203                pretty: Option<bool>,
9204                q: Option<&'b str>,
9205                rewrite: Option<bool>,
9206                source: Option<&'b str>,
9207            }
9208            let query_params = QueryParams {
9209                all_shards: self.all_shards,
9210                allow_no_indices: self.allow_no_indices,
9211                analyze_wildcard: self.analyze_wildcard,
9212                analyzer: self.analyzer,
9213                default_operator: self.default_operator,
9214                df: self.df,
9215                error_trace: self.error_trace,
9216                expand_wildcards: self.expand_wildcards,
9217                explain: self.explain,
9218                filter_path: self.filter_path,
9219                human: self.human,
9220                ignore_unavailable: self.ignore_unavailable,
9221                lenient: self.lenient,
9222                pretty: self.pretty,
9223                q: self.q,
9224                rewrite: self.rewrite,
9225                source: self.source,
9226            };
9227            Some(query_params)
9228        };
9229        let body = self.body;
9230        let response = self
9231            .transport
9232            .send(method, &path, headers, query_string.as_ref(), body, timeout)
9233            .await?;
9234        Ok(response)
9235    }
9236}
9237#[doc = "Namespace client for Indices APIs"]
9238pub struct Indices<'a> {
9239    transport: &'a Transport,
9240}
9241impl<'a> Indices<'a> {
9242    #[doc = "Creates a new instance of [Indices]"]
9243    pub fn new(transport: &'a Transport) -> Self {
9244        Self { transport }
9245    }
9246    pub fn transport(&self) -> &Transport {
9247        self.transport
9248    }
9249    #[doc = "[Indices Add Block API](https://opensearch.org/docs/)\n\nAdds a block to an index."]
9250    pub fn add_block<'b>(&'a self, parts: IndicesAddBlockParts<'b>) -> IndicesAddBlock<'a, 'b, ()> {
9251        IndicesAddBlock::new(self.transport(), parts)
9252    }
9253    #[doc = "[Indices Analyze API](https://opensearch.org/docs/)\n\nPerforms the analysis process on a text and return the tokens breakdown of the text."]
9254    pub fn analyze<'b>(&'a self, parts: IndicesAnalyzeParts<'b>) -> IndicesAnalyze<'a, 'b, ()> {
9255        IndicesAnalyze::new(self.transport(), parts)
9256    }
9257    #[doc = "[Indices Clear Cache API](https://opensearch.org/docs/)\n\nClears all or specific caches for one or more indices."]
9258    pub fn clear_cache<'b>(
9259        &'a self,
9260        parts: IndicesClearCacheParts<'b>,
9261    ) -> IndicesClearCache<'a, 'b, ()> {
9262        IndicesClearCache::new(self.transport(), parts)
9263    }
9264    #[doc = "[Indices Clone API](https://opensearch.org/docs/)\n\nClones an index"]
9265    pub fn clone<'b>(&'a self, parts: IndicesCloneParts<'b>) -> IndicesClone<'a, 'b, ()> {
9266        IndicesClone::new(self.transport(), parts)
9267    }
9268    #[doc = "[Indices Close API](https://opensearch.org/docs/)\n\nCloses an index."]
9269    pub fn close<'b>(&'a self, parts: IndicesCloseParts<'b>) -> IndicesClose<'a, 'b, ()> {
9270        IndicesClose::new(self.transport(), parts)
9271    }
9272    #[doc = "[Indices Create API](https://opensearch.org/docs/)\n\nCreates an index with optional settings and mappings.\n\n# Examples\n\nCreate an index with a mapping\n\n```rust,no_run\n# use opensearch::{OpenSearch, Error, indices::IndicesCreateParts};\n# use serde_json::{json, Value};\n# async fn doc() -> Result<(), Box<dyn std::error::Error>> {\nlet client = OpenSearch::default();\nlet response = client\n    .indices()\n    .create(IndicesCreateParts::Index(\"test_index\"))\n    .body(json!({\n        \"mappings\" : {\n            \"properties\" : {\n                \"field1\" : { \"type\" : \"text\" }\n            }\n        }\n    }))\n    .send()\n    .await?;\n    \n# Ok(())\n# }\n```"]
9273    pub fn create<'b>(&'a self, parts: IndicesCreateParts<'b>) -> IndicesCreate<'a, 'b, ()> {
9274        IndicesCreate::new(self.transport(), parts)
9275    }
9276    #[doc = "[Indices Delete API](https://opensearch.org/docs/)\n\nDeletes an index."]
9277    pub fn delete<'b>(&'a self, parts: IndicesDeleteParts<'b>) -> IndicesDelete<'a, 'b> {
9278        IndicesDelete::new(self.transport(), parts)
9279    }
9280    #[doc = "[Indices Delete Alias API](https://opensearch.org/docs/)\n\nDeletes an alias."]
9281    pub fn delete_alias<'b>(
9282        &'a self,
9283        parts: IndicesDeleteAliasParts<'b>,
9284    ) -> IndicesDeleteAlias<'a, 'b> {
9285        IndicesDeleteAlias::new(self.transport(), parts)
9286    }
9287    #[doc = "[Indices Delete Data Stream API](https://opensearch.org/docs/)\n\nDeletes a data stream."]
9288    pub fn delete_data_stream<'b>(
9289        &'a self,
9290        parts: IndicesDeleteDataStreamParts<'b>,
9291    ) -> IndicesDeleteDataStream<'a, 'b> {
9292        IndicesDeleteDataStream::new(self.transport(), parts)
9293    }
9294    #[doc = "[Indices Delete Index Template API](https://opensearch.org/docs/)\n\nDeletes an index template."]
9295    pub fn delete_index_template<'b>(
9296        &'a self,
9297        parts: IndicesDeleteIndexTemplateParts<'b>,
9298    ) -> IndicesDeleteIndexTemplate<'a, 'b> {
9299        IndicesDeleteIndexTemplate::new(self.transport(), parts)
9300    }
9301    #[doc = "[Indices Delete Template API](https://opensearch.org/docs/)\n\nDeletes an index template."]
9302    pub fn delete_template<'b>(
9303        &'a self,
9304        parts: IndicesDeleteTemplateParts<'b>,
9305    ) -> IndicesDeleteTemplate<'a, 'b> {
9306        IndicesDeleteTemplate::new(self.transport(), parts)
9307    }
9308    #[doc = "[Indices Exists API](https://opensearch.org/docs/)\n\nReturns information about whether a particular index exists."]
9309    pub fn exists<'b>(&'a self, parts: IndicesExistsParts<'b>) -> IndicesExists<'a, 'b> {
9310        IndicesExists::new(self.transport(), parts)
9311    }
9312    #[doc = "[Indices Exists Alias API](https://opensearch.org/docs/)\n\nReturns information about whether a particular alias exists."]
9313    pub fn exists_alias<'b>(
9314        &'a self,
9315        parts: IndicesExistsAliasParts<'b>,
9316    ) -> IndicesExistsAlias<'a, 'b> {
9317        IndicesExistsAlias::new(self.transport(), parts)
9318    }
9319    #[doc = "[Indices Exists Index Template API](https://opensearch.org/docs/)\n\nReturns information about whether a particular index template exists."]
9320    pub fn exists_index_template<'b>(
9321        &'a self,
9322        parts: IndicesExistsIndexTemplateParts<'b>,
9323    ) -> IndicesExistsIndexTemplate<'a, 'b> {
9324        IndicesExistsIndexTemplate::new(self.transport(), parts)
9325    }
9326    #[doc = "[Indices Exists Template API](https://opensearch.org/docs/)\n\nReturns information about whether a particular index template exists."]
9327    pub fn exists_template<'b>(
9328        &'a self,
9329        parts: IndicesExistsTemplateParts<'b>,
9330    ) -> IndicesExistsTemplate<'a, 'b> {
9331        IndicesExistsTemplate::new(self.transport(), parts)
9332    }
9333    #[doc = "[Indices Exists Type API](https://opensearch.org/docs/)\n\nReturns information about whether a particular document type exists. (DEPRECATED)"]
9334    pub fn exists_type<'b>(
9335        &'a self,
9336        parts: IndicesExistsTypeParts<'b>,
9337    ) -> IndicesExistsType<'a, 'b> {
9338        IndicesExistsType::new(self.transport(), parts)
9339    }
9340    #[doc = "[Indices Flush API](https://opensearch.org/docs/)\n\nPerforms the flush operation on one or more indices."]
9341    pub fn flush<'b>(&'a self, parts: IndicesFlushParts<'b>) -> IndicesFlush<'a, 'b, ()> {
9342        IndicesFlush::new(self.transport(), parts)
9343    }
9344    #[doc = "[Indices Flush Synced API](https://opensearch.org/docs/)\n\nPerforms a synced flush operation on one or more indices. Synced flush is deprecated and will be removed in 8.0. Use flush instead"]
9345    pub fn flush_synced<'b>(
9346        &'a self,
9347        parts: IndicesFlushSyncedParts<'b>,
9348    ) -> IndicesFlushSynced<'a, 'b, ()> {
9349        IndicesFlushSynced::new(self.transport(), parts)
9350    }
9351    #[doc = "[Indices Forcemerge API](https://opensearch.org/docs/)\n\nPerforms the force merge operation on one or more indices."]
9352    pub fn forcemerge<'b>(
9353        &'a self,
9354        parts: IndicesForcemergeParts<'b>,
9355    ) -> IndicesForcemerge<'a, 'b, ()> {
9356        IndicesForcemerge::new(self.transport(), parts)
9357    }
9358    #[doc = "[Indices Get API](https://opensearch.org/docs/)\n\nReturns information about one or more indices."]
9359    pub fn get<'b>(&'a self, parts: IndicesGetParts<'b>) -> IndicesGet<'a, 'b> {
9360        IndicesGet::new(self.transport(), parts)
9361    }
9362    #[doc = "[Indices Get Alias API](https://opensearch.org/docs/)\n\nReturns an alias."]
9363    pub fn get_alias<'b>(&'a self, parts: IndicesGetAliasParts<'b>) -> IndicesGetAlias<'a, 'b> {
9364        IndicesGetAlias::new(self.transport(), parts)
9365    }
9366    #[doc = "[Indices Get Field Mapping API](https://opensearch.org/docs/)\n\nReturns mapping for one or more fields."]
9367    pub fn get_field_mapping<'b>(
9368        &'a self,
9369        parts: IndicesGetFieldMappingParts<'b>,
9370    ) -> IndicesGetFieldMapping<'a, 'b> {
9371        IndicesGetFieldMapping::new(self.transport(), parts)
9372    }
9373    #[doc = "[Indices Get Index Template API](https://opensearch.org/docs/)\n\nReturns an index template."]
9374    pub fn get_index_template<'b>(
9375        &'a self,
9376        parts: IndicesGetIndexTemplateParts<'b>,
9377    ) -> IndicesGetIndexTemplate<'a, 'b> {
9378        IndicesGetIndexTemplate::new(self.transport(), parts)
9379    }
9380    #[doc = "[Indices Get Mapping API](https://opensearch.org/docs/)\n\nReturns mappings for one or more indices."]
9381    pub fn get_mapping<'b>(
9382        &'a self,
9383        parts: IndicesGetMappingParts<'b>,
9384    ) -> IndicesGetMapping<'a, 'b> {
9385        IndicesGetMapping::new(self.transport(), parts)
9386    }
9387    #[doc = "[Indices Get Settings API](https://opensearch.org/docs/)\n\nReturns settings for one or more indices."]
9388    pub fn get_settings<'b>(
9389        &'a self,
9390        parts: IndicesGetSettingsParts<'b>,
9391    ) -> IndicesGetSettings<'a, 'b> {
9392        IndicesGetSettings::new(self.transport(), parts)
9393    }
9394    #[doc = "[Indices Get Template API](https://opensearch.org/docs/)\n\nReturns an index template."]
9395    pub fn get_template<'b>(
9396        &'a self,
9397        parts: IndicesGetTemplateParts<'b>,
9398    ) -> IndicesGetTemplate<'a, 'b> {
9399        IndicesGetTemplate::new(self.transport(), parts)
9400    }
9401    #[doc = "[Indices Get Upgrade API](https://opensearch.org/docs/)\n\nDEPRECATED Returns a progress status of current upgrade."]
9402    pub fn get_upgrade<'b>(
9403        &'a self,
9404        parts: IndicesGetUpgradeParts<'b>,
9405    ) -> IndicesGetUpgrade<'a, 'b> {
9406        IndicesGetUpgrade::new(self.transport(), parts)
9407    }
9408    #[doc = "[Indices Migrate To Data Stream API](https://opensearch.org/docs/)\n\nMigrates an alias to a data stream"]
9409    pub fn migrate_to_data_stream<'b>(
9410        &'a self,
9411        parts: IndicesMigrateToDataStreamParts<'b>,
9412    ) -> IndicesMigrateToDataStream<'a, 'b, ()> {
9413        IndicesMigrateToDataStream::new(self.transport(), parts)
9414    }
9415    #[doc = "[Indices Open API](https://opensearch.org/docs/)\n\nOpens an index."]
9416    pub fn open<'b>(&'a self, parts: IndicesOpenParts<'b>) -> IndicesOpen<'a, 'b, ()> {
9417        IndicesOpen::new(self.transport(), parts)
9418    }
9419    #[doc = "[Indices Promote Data Stream API](https://opensearch.org/docs/)\n\nPromotes a data stream from a replicated data stream managed by CCR to a regular data stream"]
9420    pub fn promote_data_stream<'b>(
9421        &'a self,
9422        parts: IndicesPromoteDataStreamParts<'b>,
9423    ) -> IndicesPromoteDataStream<'a, 'b, ()> {
9424        IndicesPromoteDataStream::new(self.transport(), parts)
9425    }
9426    #[doc = "[Indices Put Alias API](https://opensearch.org/docs/)\n\nCreates or updates an alias."]
9427    pub fn put_alias<'b>(&'a self, parts: IndicesPutAliasParts<'b>) -> IndicesPutAlias<'a, 'b, ()> {
9428        IndicesPutAlias::new(self.transport(), parts)
9429    }
9430    #[doc = "[Indices Put Index Template API](https://opensearch.org/docs/)\n\nCreates or updates an index template."]
9431    pub fn put_index_template<'b>(
9432        &'a self,
9433        parts: IndicesPutIndexTemplateParts<'b>,
9434    ) -> IndicesPutIndexTemplate<'a, 'b, ()> {
9435        IndicesPutIndexTemplate::new(self.transport(), parts)
9436    }
9437    #[doc = "[Indices Put Mapping API](https://opensearch.org/docs/)\n\nUpdates the index mappings.\n\n# Examples\n\nPut a mapping into an existing index, assuming the index does not have a mapping, \nor that any properties specified do not conflict with existing properties\n\n```rust,no_run\n# use opensearch::{OpenSearch, Error, indices::IndicesPutMappingParts};\n# use serde_json::{json, Value};\n# async fn doc() -> Result<(), Box<dyn std::error::Error>> {\nlet client = OpenSearch::default();\nlet response = client\n    .indices()\n    .put_mapping(IndicesPutMappingParts::Index(&[\"test_index\"]))\n    .body(json!({\n        \"properties\" : {\n            \"field1\" : { \"type\" : \"text\" }\n        }\n    }))\n    .send()\n    .await?;\n    \n# Ok(())\n# }\n```"]
9438    pub fn put_mapping<'b>(
9439        &'a self,
9440        parts: IndicesPutMappingParts<'b>,
9441    ) -> IndicesPutMapping<'a, 'b, ()> {
9442        IndicesPutMapping::new(self.transport(), parts)
9443    }
9444    #[doc = "[Indices Put Settings API](https://opensearch.org/docs/)\n\nUpdates the index settings."]
9445    pub fn put_settings<'b>(
9446        &'a self,
9447        parts: IndicesPutSettingsParts<'b>,
9448    ) -> IndicesPutSettings<'a, 'b, ()> {
9449        IndicesPutSettings::new(self.transport(), parts)
9450    }
9451    #[doc = "[Indices Put Template API](https://opensearch.org/docs/)\n\nCreates or updates an index template."]
9452    pub fn put_template<'b>(
9453        &'a self,
9454        parts: IndicesPutTemplateParts<'b>,
9455    ) -> IndicesPutTemplate<'a, 'b, ()> {
9456        IndicesPutTemplate::new(self.transport(), parts)
9457    }
9458    #[doc = "[Indices Recovery API](https://opensearch.org/docs/)\n\nReturns information about ongoing index shard recoveries."]
9459    pub fn recovery<'b>(&'a self, parts: IndicesRecoveryParts<'b>) -> IndicesRecovery<'a, 'b> {
9460        IndicesRecovery::new(self.transport(), parts)
9461    }
9462    #[doc = "[Indices Refresh API](https://opensearch.org/docs/)\n\nPerforms the refresh operation in one or more indices."]
9463    pub fn refresh<'b>(&'a self, parts: IndicesRefreshParts<'b>) -> IndicesRefresh<'a, 'b, ()> {
9464        IndicesRefresh::new(self.transport(), parts)
9465    }
9466    #[doc = "[Indices Reload Search Analyzers API](https://opensearch.org/docs/)\n\nReloads an index's search analyzers and their resources."]
9467    pub fn reload_search_analyzers<'b>(
9468        &'a self,
9469        parts: IndicesReloadSearchAnalyzersParts<'b>,
9470    ) -> IndicesReloadSearchAnalyzers<'a, 'b, ()> {
9471        IndicesReloadSearchAnalyzers::new(self.transport(), parts)
9472    }
9473    #[doc = "[Indices Resolve Index API](https://opensearch.org/docs/)\n\nReturns information about any matching indices, aliases, and data streams"]
9474    #[doc = "&nbsp;\n# Optional, experimental\nThis requires the `experimental-apis` feature. Can have breaking changes in future\nversions or might even be removed entirely.\n        "]
9475    #[cfg(feature = "experimental-apis")]
9476    pub fn resolve_index<'b>(
9477        &'a self,
9478        parts: IndicesResolveIndexParts<'b>,
9479    ) -> IndicesResolveIndex<'a, 'b> {
9480        IndicesResolveIndex::new(self.transport(), parts)
9481    }
9482    #[doc = "[Indices Rollover API](https://opensearch.org/docs/)\n\nUpdates an alias to point to a new index when the existing index\nis considered to be too large or too old."]
9483    pub fn rollover<'b>(&'a self, parts: IndicesRolloverParts<'b>) -> IndicesRollover<'a, 'b, ()> {
9484        IndicesRollover::new(self.transport(), parts)
9485    }
9486    #[doc = "[Indices Segments API](https://opensearch.org/docs/)\n\nProvides low-level information about segments in a Lucene index."]
9487    pub fn segments<'b>(&'a self, parts: IndicesSegmentsParts<'b>) -> IndicesSegments<'a, 'b> {
9488        IndicesSegments::new(self.transport(), parts)
9489    }
9490    #[doc = "[Indices Shard Stores API](https://opensearch.org/docs/)\n\nProvides store information for shard copies of indices."]
9491    pub fn shard_stores<'b>(
9492        &'a self,
9493        parts: IndicesShardStoresParts<'b>,
9494    ) -> IndicesShardStores<'a, 'b> {
9495        IndicesShardStores::new(self.transport(), parts)
9496    }
9497    #[doc = "[Indices Shrink API](https://opensearch.org/docs/)\n\nAllow to shrink an existing index into a new index with fewer primary shards."]
9498    pub fn shrink<'b>(&'a self, parts: IndicesShrinkParts<'b>) -> IndicesShrink<'a, 'b, ()> {
9499        IndicesShrink::new(self.transport(), parts)
9500    }
9501    #[doc = "[Indices Simulate Index Template API](https://opensearch.org/docs/)\n\nSimulate matching the given index name against the index templates in the system"]
9502    pub fn simulate_index_template<'b>(
9503        &'a self,
9504        parts: IndicesSimulateIndexTemplateParts<'b>,
9505    ) -> IndicesSimulateIndexTemplate<'a, 'b, ()> {
9506        IndicesSimulateIndexTemplate::new(self.transport(), parts)
9507    }
9508    #[doc = "[Indices Simulate Template API](https://opensearch.org/docs/)\n\nSimulate resolving the given template name or body"]
9509    pub fn simulate_template<'b>(
9510        &'a self,
9511        parts: IndicesSimulateTemplateParts<'b>,
9512    ) -> IndicesSimulateTemplate<'a, 'b, ()> {
9513        IndicesSimulateTemplate::new(self.transport(), parts)
9514    }
9515    #[doc = "[Indices Split API](https://opensearch.org/docs/)\n\nAllows you to split an existing index into a new index with more primary shards."]
9516    pub fn split<'b>(&'a self, parts: IndicesSplitParts<'b>) -> IndicesSplit<'a, 'b, ()> {
9517        IndicesSplit::new(self.transport(), parts)
9518    }
9519    #[doc = "[Indices Stats API](https://opensearch.org/docs/)\n\nProvides statistics on operations happening in an index."]
9520    pub fn stats<'b>(&'a self, parts: IndicesStatsParts<'b>) -> IndicesStats<'a, 'b> {
9521        IndicesStats::new(self.transport(), parts)
9522    }
9523    #[doc = "[Indices Unfreeze API](https://opensearch.org/docs/)\n\nUnfreezes an index. When a frozen index is unfrozen, the index goes through the normal recovery process and becomes writeable again."]
9524    pub fn unfreeze<'b>(&'a self, parts: IndicesUnfreezeParts<'b>) -> IndicesUnfreeze<'a, 'b, ()> {
9525        IndicesUnfreeze::new(self.transport(), parts)
9526    }
9527    #[doc = "[Indices Update Aliases API](https://opensearch.org/docs/)\n\nUpdates index aliases."]
9528    pub fn update_aliases<'b>(&'a self) -> IndicesUpdateAliases<'a, 'b, ()> {
9529        IndicesUpdateAliases::new(self.transport())
9530    }
9531    #[doc = "[Indices Upgrade API](https://opensearch.org/docs/)\n\nDEPRECATED Upgrades to the current version of Lucene."]
9532    pub fn upgrade<'b>(&'a self, parts: IndicesUpgradeParts<'b>) -> IndicesUpgrade<'a, 'b, ()> {
9533        IndicesUpgrade::new(self.transport(), parts)
9534    }
9535    #[doc = "[Indices Validate Query API](https://opensearch.org/docs/)\n\nAllows a user to validate a potentially expensive query without executing it."]
9536    pub fn validate_query<'b>(
9537        &'a self,
9538        parts: IndicesValidateQueryParts<'b>,
9539    ) -> IndicesValidateQuery<'a, 'b, ()> {
9540        IndicesValidateQuery::new(self.transport(), parts)
9541    }
9542}
9543impl OpenSearch {
9544    #[doc = "Creates a namespace client for Indices APIs"]
9545    pub fn indices(&self) -> Indices {
9546        Indices::new(self.transport())
9547    }
9548}