opensearch_client/types/
mod.rs

1#[allow(unused_imports)]
2use std::convert::TryFrom;
3
4use serde::{Deserialize, Serialize};
5pub mod bulk;
6pub use bulk::{BulkAction, BulkError, BulkItemResponse, BulkResponse, IndexResponse, UpdateAction};
7
8///The unit in which to display byte values.
9#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)]
10pub enum Bytes {
11  #[serde(rename = "b")]
12  B,
13  #[serde(rename = "k")]
14  K,
15  #[serde(rename = "kb")]
16  Kb,
17  #[serde(rename = "m")]
18  M,
19  #[serde(rename = "mb")]
20  Mb,
21  #[serde(rename = "g")]
22  G,
23  #[serde(rename = "gb")]
24  Gb,
25  #[serde(rename = "t")]
26  T,
27  #[serde(rename = "tb")]
28  Tb,
29  #[serde(rename = "p")]
30  P,
31  #[serde(rename = "pb")]
32  Pb,
33}
34
35impl From<&Bytes> for Bytes {
36  fn from(value: &Bytes) -> Self {
37    value.clone()
38  }
39}
40
41impl ToString for Bytes {
42  fn to_string(&self) -> String {
43    match *self {
44      Self::B => "b".to_string(),
45      Self::K => "k".to_string(),
46      Self::Kb => "kb".to_string(),
47      Self::M => "m".to_string(),
48      Self::Mb => "mb".to_string(),
49      Self::G => "g".to_string(),
50      Self::Gb => "gb".to_string(),
51      Self::T => "t".to_string(),
52      Self::Tb => "tb".to_string(),
53      Self::P => "p".to_string(),
54      Self::Pb => "pb".to_string(),
55    }
56  }
57}
58
59impl std::str::FromStr for Bytes {
60  type Err = &'static str;
61
62  fn from_str(value: &str) -> Result<Self, &'static str> {
63    match value {
64      "b" => Ok(Self::B),
65      "k" => Ok(Self::K),
66      "kb" => Ok(Self::Kb),
67      "m" => Ok(Self::M),
68      "mb" => Ok(Self::Mb),
69      "g" => Ok(Self::G),
70      "gb" => Ok(Self::Gb),
71      "t" => Ok(Self::T),
72      "tb" => Ok(Self::Tb),
73      "p" => Ok(Self::P),
74      "pb" => Ok(Self::Pb),
75      _ => Err("invalid value"),
76    }
77  }
78}
79
80impl std::convert::TryFrom<&str> for Bytes {
81  type Error = &'static str;
82
83  fn try_from(value: &str) -> Result<Self, &'static str> {
84    value.parse()
85  }
86}
87
88impl std::convert::TryFrom<&String> for Bytes {
89  type Error = &'static str;
90
91  fn try_from(value: &String) -> Result<Self, &'static str> {
92    value.parse()
93  }
94}
95
96impl std::convert::TryFrom<String> for Bytes {
97  type Error = &'static str;
98
99  fn try_from(value: String) -> Result<Self, &'static str> {
100    value.parse()
101  }
102}
103
104///Comma-separated list of scroll IDs to clear if none was specified via
105/// the scroll_id parameter
106#[derive(Clone, Debug, Deserialize, Serialize)]
107pub struct ClearScrollBodyParams(pub serde_json::Map<String, serde_json::Value>);
108impl std::ops::Deref for ClearScrollBodyParams {
109  type Target = serde_json::Map<String, serde_json::Value>;
110
111  fn deref(&self) -> &serde_json::Map<String, serde_json::Value> {
112    &self.0
113  }
114}
115
116impl From<ClearScrollBodyParams> for serde_json::Map<String, serde_json::Value> {
117  fn from(value: ClearScrollBodyParams) -> Self {
118    value.0
119  }
120}
121
122impl From<&ClearScrollBodyParams> for ClearScrollBodyParams {
123  fn from(value: &ClearScrollBodyParams) -> Self {
124    value.clone()
125  }
126}
127
128impl From<serde_json::Map<String, serde_json::Value>> for ClearScrollBodyParams {
129  fn from(value: serde_json::Map<String, serde_json::Value>) -> Self {
130    Self(value)
131  }
132}
133
134///Specify the level of detail for returned information.
135#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)]
136pub enum ClusterHealthLevel {
137  #[serde(rename = "cluster")]
138  Cluster,
139  #[serde(rename = "indices")]
140  Indices,
141  #[serde(rename = "shards")]
142  Shards,
143  #[serde(rename = "awareness_attributes")]
144  AwarenessAttributes,
145}
146
147impl From<&ClusterHealthLevel> for ClusterHealthLevel {
148  fn from(value: &ClusterHealthLevel) -> Self {
149    value.clone()
150  }
151}
152
153impl ToString for ClusterHealthLevel {
154  fn to_string(&self) -> String {
155    match *self {
156      Self::Cluster => "cluster".to_string(),
157      Self::Indices => "indices".to_string(),
158      Self::Shards => "shards".to_string(),
159      Self::AwarenessAttributes => "awareness_attributes".to_string(),
160    }
161  }
162}
163
164impl std::str::FromStr for ClusterHealthLevel {
165  type Err = &'static str;
166
167  fn from_str(value: &str) -> Result<Self, &'static str> {
168    match value {
169      "cluster" => Ok(Self::Cluster),
170      "indices" => Ok(Self::Indices),
171      "shards" => Ok(Self::Shards),
172      "awareness_attributes" => Ok(Self::AwarenessAttributes),
173      _ => Err("invalid value"),
174    }
175  }
176}
177
178impl std::convert::TryFrom<&str> for ClusterHealthLevel {
179  type Error = &'static str;
180
181  fn try_from(value: &str) -> Result<Self, &'static str> {
182    value.parse()
183  }
184}
185
186impl std::convert::TryFrom<&String> for ClusterHealthLevel {
187  type Error = &'static str;
188
189  fn try_from(value: &String) -> Result<Self, &'static str> {
190    value.parse()
191  }
192}
193
194impl std::convert::TryFrom<String> for ClusterHealthLevel {
195  type Error = &'static str;
196
197  fn try_from(value: String) -> Result<Self, &'static str> {
198    value.parse()
199  }
200}
201
202///What to do when the operation encounters version conflicts?.
203#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)]
204pub enum Conflicts {
205  #[serde(rename = "abort")]
206  Abort,
207  #[serde(rename = "proceed")]
208  Proceed,
209}
210
211impl From<&Conflicts> for Conflicts {
212  fn from(value: &Conflicts) -> Self {
213    value.clone()
214  }
215}
216
217impl ToString for Conflicts {
218  fn to_string(&self) -> String {
219    match *self {
220      Self::Abort => "abort".to_string(),
221      Self::Proceed => "proceed".to_string(),
222    }
223  }
224}
225
226impl std::str::FromStr for Conflicts {
227  type Err = &'static str;
228
229  fn from_str(value: &str) -> Result<Self, &'static str> {
230    match value {
231      "abort" => Ok(Self::Abort),
232      "proceed" => Ok(Self::Proceed),
233      _ => Err("invalid value"),
234    }
235  }
236}
237
238impl std::convert::TryFrom<&str> for Conflicts {
239  type Error = &'static str;
240
241  fn try_from(value: &str) -> Result<Self, &'static str> {
242    value.parse()
243  }
244}
245
246impl std::convert::TryFrom<&String> for Conflicts {
247  type Error = &'static str;
248
249  fn try_from(value: &String) -> Result<Self, &'static str> {
250    value.parse()
251  }
252}
253
254impl std::convert::TryFrom<String> for Conflicts {
255  type Error = &'static str;
256
257  fn try_from(value: String) -> Result<Self, &'static str> {
258    value.parse()
259  }
260}
261
262#[derive(Clone, Debug, Deserialize, Serialize)]
263pub struct CountResponse {
264  #[serde(default, skip_serializing_if = "Option::is_none")]
265  pub _shards: Option<ShardStatistics>,
266  #[serde(default)]
267  pub count: u32,
268}
269
270///Query to restrict the results specified with the Query DSL (optional)
271#[derive(Clone, Debug, Deserialize, Serialize)]
272pub struct CountBodyParams(pub serde_json::Map<String, serde_json::Value>);
273impl std::ops::Deref for CountBodyParams {
274  type Target = serde_json::Map<String, serde_json::Value>;
275
276  fn deref(&self) -> &serde_json::Map<String, serde_json::Value> {
277    &self.0
278  }
279}
280
281impl From<CountBodyParams> for serde_json::Map<String, serde_json::Value> {
282  fn from(value: CountBodyParams) -> Self {
283    value.0
284  }
285}
286
287impl From<&CountBodyParams> for CountBodyParams {
288  fn from(value: &CountBodyParams) -> Self {
289    value.clone()
290  }
291}
292
293impl From<serde_json::Map<String, serde_json::Value>> for CountBodyParams {
294  fn from(value: serde_json::Map<String, serde_json::Value>) -> Self {
295    Self(value)
296  }
297}
298
299///The document
300#[derive(Clone, Debug, Deserialize, Serialize)]
301pub struct CreateBodyParams(pub serde_json::Value);
302impl std::ops::Deref for CreateBodyParams {
303  type Target = serde_json::Value;
304
305  fn deref(&self) -> &serde_json::Value {
306    &self.0
307  }
308}
309
310impl From<CreateBodyParams> for serde_json::Value {
311  fn from(value: CreateBodyParams) -> Self {
312    value.0
313  }
314}
315
316impl From<&CreateBodyParams> for CreateBodyParams {
317  fn from(value: &CreateBodyParams) -> Self {
318    value.clone()
319  }
320}
321
322impl From<serde_json::Value> for CreateBodyParams {
323  fn from(value: serde_json::Value) -> Self {
324    Self(value)
325  }
326}
327
328/// OpenSearch Id
329#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)]
330pub struct OpenSearchId(String);
331impl std::ops::Deref for OpenSearchId {
332  type Target = String;
333
334  fn deref(&self) -> &String {
335    &self.0
336  }
337}
338
339impl From<OpenSearchId> for String {
340  fn from(value: OpenSearchId) -> Self {
341    value.0
342  }
343}
344
345impl From<&OpenSearchId> for OpenSearchId {
346  fn from(value: &OpenSearchId) -> Self {
347    value.clone()
348  }
349}
350
351impl std::str::FromStr for OpenSearchId {
352  type Err = &'static str;
353
354  fn from_str(value: &str) -> Result<Self, &'static str> {
355    if regress::Regex::new("^(?!_|template|query|field|point|clear|usage|stats|hot|reload|painless).+$")
356      .unwrap()
357      .find(value)
358      .is_none()
359    {
360      return Err(
361        "doesn't match pattern \"^(?!_|template|query|field|point|clear|usage|stats|hot|reload|painless).+$\"",
362      );
363    }
364    Ok(Self(value.to_string()))
365  }
366}
367
368impl std::convert::TryFrom<&str> for OpenSearchId {
369  type Error = &'static str;
370
371  fn try_from(value: &str) -> Result<Self, &'static str> {
372    value.parse()
373  }
374}
375
376impl std::convert::TryFrom<&String> for OpenSearchId {
377  type Error = &'static str;
378
379  fn try_from(value: &String) -> Result<Self, &'static str> {
380    value.parse()
381  }
382}
383
384impl std::convert::TryFrom<String> for OpenSearchId {
385  type Error = &'static str;
386
387  fn try_from(value: String) -> Result<Self, &'static str> {
388    value.parse()
389  }
390}
391
392impl<'de> serde::Deserialize<'de> for OpenSearchId {
393  fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
394  where
395    D: serde::Deserializer<'de>, {
396    String::deserialize(deserializer)?
397      .parse()
398      .map_err(|e: &'static str| <D::Error as serde::de::Error>::custom(e.to_string()))
399  }
400}
401/// OpenSearch Name/Value
402#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)]
403pub struct OpenSearchNameValue(String);
404impl std::ops::Deref for OpenSearchNameValue {
405  type Target = String;
406
407  fn deref(&self) -> &String {
408    &self.0
409  }
410}
411
412impl From<OpenSearchNameValue> for String {
413  fn from(value: OpenSearchNameValue) -> Self {
414    value.0
415  }
416}
417
418impl From<&OpenSearchNameValue> for OpenSearchNameValue {
419  fn from(value: &OpenSearchNameValue) -> Self {
420    value.clone()
421  }
422}
423
424impl std::str::FromStr for OpenSearchNameValue {
425  type Err = &'static str;
426
427  fn from_str(value: &str) -> Result<Self, &'static str> {
428    if regress::Regex::new("^(?!_|template|query|field|point|clear|usage|stats|hot|reload|painless).+$")
429      .unwrap()
430      .find(value)
431      .is_none()
432    {
433      return Err(
434        "doesn't match pattern \"^(?!_|template|query|field|point|clear|usage|stats|hot|reload|painless).+$\"",
435      );
436    }
437    Ok(Self(value.to_string()))
438  }
439}
440
441impl std::convert::TryFrom<&str> for OpenSearchNameValue {
442  type Error = &'static str;
443
444  fn try_from(value: &str) -> Result<Self, &'static str> {
445    value.parse()
446  }
447}
448
449impl std::convert::TryFrom<&String> for OpenSearchNameValue {
450  type Error = &'static str;
451
452  fn try_from(value: &String) -> Result<Self, &'static str> {
453    value.parse()
454  }
455}
456
457impl std::convert::TryFrom<String> for OpenSearchNameValue {
458  type Error = &'static str;
459
460  fn try_from(value: String) -> Result<Self, &'static str> {
461    value.parse()
462  }
463}
464
465impl<'de> serde::Deserialize<'de> for OpenSearchNameValue {
466  fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
467  where
468    D: serde::Deserializer<'de>, {
469    String::deserialize(deserializer)?
470      .parse()
471      .map_err(|e: &'static str| <D::Error as serde::de::Error>::custom(e.to_string()))
472  }
473}
474
475/// SIngle Index Name
476#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)]
477pub struct IndexName(String);
478impl std::ops::Deref for IndexName {
479  type Target = String;
480
481  fn deref(&self) -> &String {
482    &self.0
483  }
484}
485
486impl From<IndexName> for String {
487  fn from(value: IndexName) -> Self {
488    value.0
489  }
490}
491
492impl From<&IndexName> for IndexName {
493  fn from(value: &IndexName) -> Self {
494    value.clone()
495  }
496}
497
498impl std::str::FromStr for IndexName {
499  type Err = &'static str;
500
501  fn from_str(value: &str) -> Result<Self, &'static str> {
502    if regress::Regex::new("^(?!_|template|query|field|point|clear|usage|stats|hot|reload|painless).+$")
503      .unwrap()
504      .find(value)
505      .is_none()
506    {
507      return Err(
508        "doesn't match pattern \"^(?!_|template|query|field|point|clear|usage|stats|hot|reload|painless).+$\"",
509      );
510    }
511    Ok(Self(value.to_string()))
512  }
513}
514
515impl std::convert::TryFrom<&str> for IndexName {
516  type Error = &'static str;
517
518  fn try_from(value: &str) -> Result<Self, &'static str> {
519    value.parse()
520  }
521}
522
523impl std::convert::TryFrom<&String> for IndexName {
524  type Error = &'static str;
525
526  fn try_from(value: &String) -> Result<Self, &'static str> {
527    value.parse()
528  }
529}
530
531impl std::convert::TryFrom<String> for IndexName {
532  type Error = &'static str;
533
534  fn try_from(value: String) -> Result<Self, &'static str> {
535    value.parse()
536  }
537}
538
539impl<'de> serde::Deserialize<'de> for IndexName {
540  fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
541  where
542    D: serde::Deserializer<'de>, {
543    String::deserialize(deserializer)?
544      .parse()
545      .map_err(|e: &'static str| <D::Error as serde::de::Error>::custom(e.to_string()))
546  }
547}
548
549///Comma-separated list of indices; use `_all` or empty string to perform
550/// the operation on all indices.
551#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)]
552pub struct IndexNames(String);
553impl std::ops::Deref for IndexNames {
554  type Target = String;
555
556  fn deref(&self) -> &String {
557    &self.0
558  }
559}
560
561impl From<IndexNames> for String {
562  fn from(value: IndexNames) -> Self {
563    value.0
564  }
565}
566
567impl From<&IndexNames> for IndexNames {
568  fn from(value: &IndexNames) -> Self {
569    value.clone()
570  }
571}
572
573impl std::str::FromStr for IndexNames {
574  type Err = &'static str;
575
576  fn from_str(value: &str) -> Result<Self, &'static str> {
577    if regress::Regex::new("^(?!_|template|query|field|point|clear|usage|stats|hot|reload|painless).+$")
578      .unwrap()
579      .find(value)
580      .is_none()
581    {
582      return Err(
583        "doesn't match pattern \"^(?!_|template|query|field|point|clear|usage|stats|hot|reload|painless).+$\"",
584      );
585    }
586    Ok(Self(value.to_string()))
587  }
588}
589
590impl std::convert::TryFrom<&str> for IndexNames {
591  type Error = &'static str;
592
593  fn try_from(value: &str) -> Result<Self, &'static str> {
594    value.parse()
595  }
596}
597
598impl std::convert::TryFrom<&String> for IndexNames {
599  type Error = &'static str;
600
601  fn try_from(value: &String) -> Result<Self, &'static str> {
602    value.parse()
603  }
604}
605
606impl std::convert::TryFrom<String> for IndexNames {
607  type Error = &'static str;
608
609  fn try_from(value: String) -> Result<Self, &'static str> {
610    value.parse()
611  }
612}
613
614impl<'de> serde::Deserialize<'de> for IndexNames {
615  fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
616  where
617    D: serde::Deserializer<'de>, {
618    String::deserialize(deserializer)?
619      .parse()
620      .map_err(|e: &'static str| <D::Error as serde::de::Error>::custom(e.to_string()))
621  }
622}
623
624#[derive(Clone, Debug, Deserialize, Serialize)]
625pub struct CreatePitResponseContent {
626  #[serde(default, skip_serializing_if = "Option::is_none")]
627  pub creation_time: Option<i64>,
628  #[serde(default, skip_serializing_if = "Option::is_none")]
629  pub pit_id: Option<String>,
630  #[serde(rename = "_shard", default, skip_serializing_if = "Option::is_none")]
631  pub shard: Option<ShardStatistics>,
632}
633
634impl From<&CreatePitResponseContent> for CreatePitResponseContent {
635  fn from(value: &CreatePitResponseContent) -> Self {
636    value.clone()
637  }
638}
639
640impl CreatePitResponseContent {
641  pub fn builder() -> builder::CreatePitResponseContent {
642    builder::CreatePitResponseContent::default()
643  }
644}
645
646#[derive(Clone, Debug, Deserialize, Serialize)]
647pub struct DataStream {
648  #[serde(default, skip_serializing_if = "Option::is_none")]
649  pub generation: Option<i64>,
650  #[serde(default, skip_serializing_if = "Vec::is_empty")]
651  pub indices: Vec<DataStreamIndex>,
652  #[serde(default, skip_serializing_if = "Option::is_none")]
653  pub name: Option<String>,
654  #[serde(default, skip_serializing_if = "Option::is_none")]
655  pub status: Option<DataStreamStatus>,
656  #[serde(default, skip_serializing_if = "Option::is_none")]
657  pub template: Option<String>,
658  #[serde(default, skip_serializing_if = "Option::is_none")]
659  pub timestamp_field: Option<DataStreamTimestampField>,
660}
661
662impl From<&DataStream> for DataStream {
663  fn from(value: &DataStream) -> Self {
664    value.clone()
665  }
666}
667
668impl DataStream {
669  pub fn builder() -> builder::DataStream {
670    builder::DataStream::default()
671  }
672}
673
674#[derive(Clone, Debug, Deserialize, Serialize)]
675pub struct DataStreamIndex {
676  #[serde(default, skip_serializing_if = "Option::is_none")]
677  pub index_name: Option<String>,
678  #[serde(default, skip_serializing_if = "Option::is_none")]
679  pub index_uuid: Option<String>,
680}
681
682impl From<&DataStreamIndex> for DataStreamIndex {
683  fn from(value: &DataStreamIndex) -> Self {
684    value.clone()
685  }
686}
687
688impl DataStreamIndex {
689  pub fn builder() -> builder::DataStreamIndex {
690    builder::DataStreamIndex::default()
691  }
692}
693
694#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)]
695pub enum DataStreamStatus {
696  #[serde(rename = "green")]
697  Green,
698  #[serde(rename = "yellow")]
699  Yellow,
700  #[serde(rename = "red")]
701  Red,
702}
703
704impl From<&DataStreamStatus> for DataStreamStatus {
705  fn from(value: &DataStreamStatus) -> Self {
706    value.clone()
707  }
708}
709
710impl ToString for DataStreamStatus {
711  fn to_string(&self) -> String {
712    match *self {
713      Self::Green => "green".to_string(),
714      Self::Yellow => "yellow".to_string(),
715      Self::Red => "red".to_string(),
716    }
717  }
718}
719
720impl std::str::FromStr for DataStreamStatus {
721  type Err = &'static str;
722
723  fn from_str(value: &str) -> Result<Self, &'static str> {
724    match value {
725      "green" => Ok(Self::Green),
726      "yellow" => Ok(Self::Yellow),
727      "red" => Ok(Self::Red),
728      _ => Err("invalid value"),
729    }
730  }
731}
732
733impl std::convert::TryFrom<&str> for DataStreamStatus {
734  type Error = &'static str;
735
736  fn try_from(value: &str) -> Result<Self, &'static str> {
737    value.parse()
738  }
739}
740
741impl std::convert::TryFrom<&String> for DataStreamStatus {
742  type Error = &'static str;
743
744  fn try_from(value: &String) -> Result<Self, &'static str> {
745    value.parse()
746  }
747}
748
749impl std::convert::TryFrom<String> for DataStreamStatus {
750  type Error = &'static str;
751
752  fn try_from(value: String) -> Result<Self, &'static str> {
753    value.parse()
754  }
755}
756
757#[derive(Clone, Debug, Deserialize, Serialize)]
758pub struct DataStreamTimestampField {
759  #[serde(default, skip_serializing_if = "Option::is_none")]
760  pub name: Option<String>,
761}
762
763impl From<&DataStreamTimestampField> for DataStreamTimestampField {
764  fn from(value: &DataStreamTimestampField) -> Self {
765    value.clone()
766  }
767}
768
769impl DataStreamTimestampField {
770  pub fn builder() -> builder::DataStreamTimestampField {
771    builder::DataStreamTimestampField::default()
772  }
773}
774
775///The default operator for query string query (AND or OR).
776#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)]
777pub enum DefaultOperator {
778  #[serde(rename = "AND")]
779  And,
780  #[serde(rename = "OR")]
781  Or,
782}
783
784impl From<&DefaultOperator> for DefaultOperator {
785  fn from(value: &DefaultOperator) -> Self {
786    value.clone()
787  }
788}
789
790impl ToString for DefaultOperator {
791  fn to_string(&self) -> String {
792    match *self {
793      Self::And => "AND".to_string(),
794      Self::Or => "OR".to_string(),
795    }
796  }
797}
798
799impl std::str::FromStr for DefaultOperator {
800  type Err = &'static str;
801
802  fn from_str(value: &str) -> Result<Self, &'static str> {
803    match value {
804      "AND" => Ok(Self::And),
805      "OR" => Ok(Self::Or),
806      _ => Err("invalid value"),
807    }
808  }
809}
810
811impl std::convert::TryFrom<&str> for DefaultOperator {
812  type Error = &'static str;
813
814  fn try_from(value: &str) -> Result<Self, &'static str> {
815    value.parse()
816  }
817}
818
819impl std::convert::TryFrom<&String> for DefaultOperator {
820  type Error = &'static str;
821
822  fn try_from(value: &String) -> Result<Self, &'static str> {
823    value.parse()
824  }
825}
826
827impl std::convert::TryFrom<String> for DefaultOperator {
828  type Error = &'static str;
829
830  fn try_from(value: String) -> Result<Self, &'static str> {
831    value.parse()
832  }
833}
834
835#[derive(Clone, Debug, Deserialize, Serialize)]
836pub struct DeleteAllPitsResponseContent {
837  #[serde(default, skip_serializing_if = "Vec::is_empty")]
838  pub pits: Vec<PitsDetailsDeleteAll>,
839}
840
841impl From<&DeleteAllPitsResponseContent> for DeleteAllPitsResponseContent {
842  fn from(value: &DeleteAllPitsResponseContent) -> Self {
843    value.clone()
844  }
845}
846
847impl DeleteAllPitsResponseContent {
848  pub fn builder() -> builder::DeleteAllPitsResponseContent {
849    builder::DeleteAllPitsResponseContent::default()
850  }
851}
852
853///The search definition using the Query DSL
854#[derive(Clone, Debug, Deserialize, Serialize)]
855pub struct DeleteByQueryBodyParams(pub serde_json::Map<String, serde_json::Value>);
856impl std::ops::Deref for DeleteByQueryBodyParams {
857  type Target = serde_json::Map<String, serde_json::Value>;
858
859  fn deref(&self) -> &serde_json::Map<String, serde_json::Value> {
860    &self.0
861  }
862}
863
864impl From<DeleteByQueryBodyParams> for serde_json::Map<String, serde_json::Value> {
865  fn from(value: DeleteByQueryBodyParams) -> Self {
866    value.0
867  }
868}
869
870impl From<&DeleteByQueryBodyParams> for DeleteByQueryBodyParams {
871  fn from(value: &DeleteByQueryBodyParams) -> Self {
872    value.clone()
873  }
874}
875
876impl From<serde_json::Map<String, serde_json::Value>> for DeleteByQueryBodyParams {
877  fn from(value: serde_json::Map<String, serde_json::Value>) -> Self {
878    Self(value)
879  }
880}
881
882///Specify how long a consistent view of the index should be maintained for
883/// scrolled search.
884#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)]
885pub struct DeleteByQueryScroll(String);
886impl std::ops::Deref for DeleteByQueryScroll {
887  type Target = String;
888
889  fn deref(&self) -> &String {
890    &self.0
891  }
892}
893
894impl From<DeleteByQueryScroll> for String {
895  fn from(value: DeleteByQueryScroll) -> Self {
896    value.0
897  }
898}
899
900impl From<&DeleteByQueryScroll> for DeleteByQueryScroll {
901  fn from(value: &DeleteByQueryScroll) -> Self {
902    value.clone()
903  }
904}
905
906impl std::str::FromStr for DeleteByQueryScroll {
907  type Err = &'static str;
908
909  fn from_str(value: &str) -> Result<Self, &'static str> {
910    if regress::Regex::new("^([0-9]+)(?:d|h|m|s|ms|micros|nanos)$")
911      .unwrap()
912      .find(value)
913      .is_none()
914    {
915      return Err("doesn't match pattern \"^([0-9]+)(?:d|h|m|s|ms|micros|nanos)$\"");
916    }
917    Ok(Self(value.to_string()))
918  }
919}
920
921impl std::convert::TryFrom<&str> for DeleteByQueryScroll {
922  type Error = &'static str;
923
924  fn try_from(value: &str) -> Result<Self, &'static str> {
925    value.parse()
926  }
927}
928
929impl std::convert::TryFrom<&String> for DeleteByQueryScroll {
930  type Error = &'static str;
931
932  fn try_from(value: &String) -> Result<Self, &'static str> {
933    value.parse()
934  }
935}
936
937impl std::convert::TryFrom<String> for DeleteByQueryScroll {
938  type Error = &'static str;
939
940  fn try_from(value: String) -> Result<Self, &'static str> {
941    value.parse()
942  }
943}
944
945impl<'de> serde::Deserialize<'de> for DeleteByQueryScroll {
946  fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
947  where
948    D: serde::Deserializer<'de>, {
949    String::deserialize(deserializer)?
950      .parse()
951      .map_err(|e: &'static str| <D::Error as serde::de::Error>::custom(e.to_string()))
952  }
953}
954
955#[derive(Clone, Debug, Deserialize, Serialize)]
956pub struct DeletePitBodyParams {
957  pub pit_id: Vec<String>,
958}
959
960impl From<&DeletePitBodyParams> for DeletePitBodyParams {
961  fn from(value: &DeletePitBodyParams) -> Self {
962    value.clone()
963  }
964}
965
966impl DeletePitBodyParams {
967  pub fn builder() -> builder::DeletePitBodyParams {
968    builder::DeletePitBodyParams::default()
969  }
970}
971
972#[derive(Clone, Debug, Deserialize, Serialize)]
973pub struct DeletePitResponseContent {
974  #[serde(default, skip_serializing_if = "Vec::is_empty")]
975  pub pits: Vec<DeletedPit>,
976}
977
978impl From<&DeletePitResponseContent> for DeletePitResponseContent {
979  fn from(value: &DeletePitResponseContent) -> Self {
980    value.clone()
981  }
982}
983
984impl DeletePitResponseContent {
985  pub fn builder() -> builder::DeletePitResponseContent {
986    builder::DeletePitResponseContent::default()
987  }
988}
989
990#[derive(Clone, Debug, Deserialize, Serialize)]
991pub struct DeletedPit {
992  #[serde(default, skip_serializing_if = "Option::is_none")]
993  pub pit_id: Option<String>,
994  #[serde(default, skip_serializing_if = "Option::is_none")]
995  pub successful: Option<bool>,
996}
997
998impl From<&DeletedPit> for DeletedPit {
999  fn from(value: &DeletedPit) -> Self {
1000    value.clone()
1001  }
1002}
1003
1004impl DeletedPit {
1005  pub fn builder() -> builder::DeletedPit {
1006    builder::DeletedPit::default()
1007  }
1008}
1009
1010///Whether to expand wildcard expression to concrete indices that are open,
1011/// closed or both.
1012#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)]
1013pub enum ExpandWildcards {
1014  #[serde(rename = "all")]
1015  All,
1016  #[serde(rename = "open")]
1017  Open,
1018  #[serde(rename = "closed")]
1019  Closed,
1020  #[serde(rename = "hidden")]
1021  Hidden,
1022  #[serde(rename = "none")]
1023  None,
1024}
1025
1026impl From<&ExpandWildcards> for ExpandWildcards {
1027  fn from(value: &ExpandWildcards) -> Self {
1028    value.clone()
1029  }
1030}
1031
1032impl ToString for ExpandWildcards {
1033  fn to_string(&self) -> String {
1034    match *self {
1035      Self::All => "all".to_string(),
1036      Self::Open => "open".to_string(),
1037      Self::Closed => "closed".to_string(),
1038      Self::Hidden => "hidden".to_string(),
1039      Self::None => "none".to_string(),
1040    }
1041  }
1042}
1043
1044impl std::str::FromStr for ExpandWildcards {
1045  type Err = &'static str;
1046
1047  fn from_str(value: &str) -> Result<Self, &'static str> {
1048    match value {
1049      "all" => Ok(Self::All),
1050      "open" => Ok(Self::Open),
1051      "closed" => Ok(Self::Closed),
1052      "hidden" => Ok(Self::Hidden),
1053      "none" => Ok(Self::None),
1054      _ => Err("invalid value"),
1055    }
1056  }
1057}
1058
1059impl std::convert::TryFrom<&str> for ExpandWildcards {
1060  type Error = &'static str;
1061
1062  fn try_from(value: &str) -> Result<Self, &'static str> {
1063    value.parse()
1064  }
1065}
1066
1067impl std::convert::TryFrom<&String> for ExpandWildcards {
1068  type Error = &'static str;
1069
1070  fn try_from(value: &String) -> Result<Self, &'static str> {
1071    value.parse()
1072  }
1073}
1074
1075impl std::convert::TryFrom<String> for ExpandWildcards {
1076  type Error = &'static str;
1077
1078  fn try_from(value: String) -> Result<Self, &'static str> {
1079    value.parse()
1080  }
1081}
1082
1083///The query definition using the Query DSL
1084#[derive(Clone, Debug, Deserialize, Serialize)]
1085pub struct ExplainBodyParams(pub serde_json::Map<String, serde_json::Value>);
1086impl std::ops::Deref for ExplainBodyParams {
1087  type Target = serde_json::Map<String, serde_json::Value>;
1088
1089  fn deref(&self) -> &serde_json::Map<String, serde_json::Value> {
1090    &self.0
1091  }
1092}
1093
1094impl From<ExplainBodyParams> for serde_json::Map<String, serde_json::Value> {
1095  fn from(value: ExplainBodyParams) -> Self {
1096    value.0
1097  }
1098}
1099
1100impl From<&ExplainBodyParams> for ExplainBodyParams {
1101  fn from(value: &ExplainBodyParams) -> Self {
1102    value.clone()
1103  }
1104}
1105
1106impl From<serde_json::Map<String, serde_json::Value>> for ExplainBodyParams {
1107  fn from(value: serde_json::Map<String, serde_json::Value>) -> Self {
1108    Self(value)
1109  }
1110}
1111
1112///An index filter specified with the Query DSL
1113#[derive(Clone, Debug, Deserialize, Serialize)]
1114pub struct FieldCapsBodyParams(pub serde_json::Map<String, serde_json::Value>);
1115impl std::ops::Deref for FieldCapsBodyParams {
1116  type Target = serde_json::Map<String, serde_json::Value>;
1117
1118  fn deref(&self) -> &serde_json::Map<String, serde_json::Value> {
1119    &self.0
1120  }
1121}
1122
1123impl From<FieldCapsBodyParams> for serde_json::Map<String, serde_json::Value> {
1124  fn from(value: FieldCapsBodyParams) -> Self {
1125    value.0
1126  }
1127}
1128
1129impl From<&FieldCapsBodyParams> for FieldCapsBodyParams {
1130  fn from(value: &FieldCapsBodyParams) -> Self {
1131    value.clone()
1132  }
1133}
1134
1135impl From<serde_json::Map<String, serde_json::Value>> for FieldCapsBodyParams {
1136  fn from(value: serde_json::Map<String, serde_json::Value>) -> Self {
1137    Self(value)
1138  }
1139}
1140
1141#[derive(Clone, Debug, Deserialize, Serialize)]
1142pub struct GetAllPitsResponseContent {
1143  #[serde(default, skip_serializing_if = "Vec::is_empty")]
1144  pub pits: Vec<PitDetail>,
1145}
1146
1147impl From<&GetAllPitsResponseContent> for GetAllPitsResponseContent {
1148  fn from(value: &GetAllPitsResponseContent) -> Self {
1149    value.clone()
1150  }
1151}
1152
1153impl GetAllPitsResponseContent {
1154  pub fn builder() -> builder::GetAllPitsResponseContent {
1155    builder::GetAllPitsResponseContent::default()
1156  }
1157}
1158
1159#[derive(Clone, Debug, Deserialize, Serialize)]
1160pub struct GetResponseContent<T> {
1161  #[serde(rename = "_fields", default, skip_serializing_if = "Option::is_none")]
1162  pub fields: Option<UserDefinedValueMap>,
1163  pub found: bool,
1164  #[serde(rename = "_id")]
1165  pub id: String,
1166  #[serde(rename = "_index")]
1167  pub index: String,
1168  #[serde(default, skip_serializing_if = "Option::is_none")]
1169  pub primary_term: Option<i64>,
1170  #[serde(rename = "_routing", default, skip_serializing_if = "Option::is_none")]
1171  pub routing: Option<String>,
1172  #[serde(default, skip_serializing_if = "Option::is_none")]
1173  pub seq_no: Option<i64>,
1174  #[serde(rename = "_source", default, skip_serializing_if = "Option::is_none")]
1175  pub source: Option<T>,
1176  #[serde(rename = "_type", default, skip_serializing_if = "Option::is_none")]
1177  pub type_: Option<String>,
1178  #[serde(default, skip_serializing_if = "Option::is_none")]
1179  pub version: Option<i32>,
1180}
1181
1182impl<T> From<&GetResponseContent<T>> for GetResponseContent<T> {
1183  fn from(value: &GetResponseContent<T>) -> Self {
1184    value.into()
1185  }
1186}
1187
1188impl<T> GetResponseContent<T> {
1189  pub fn builder() -> builder::GetResponseContent<T> {
1190    builder::GetResponseContent::default()
1191  }
1192}
1193
1194///Group tasks by nodes or parent/child relationships.
1195#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)]
1196pub enum GroupBy {
1197  #[serde(rename = "nodes")]
1198  Nodes,
1199  #[serde(rename = "parents")]
1200  Parents,
1201  #[serde(rename = "none")]
1202  None,
1203}
1204
1205impl From<&GroupBy> for GroupBy {
1206  fn from(value: &GroupBy) -> Self {
1207    value.clone()
1208  }
1209}
1210
1211impl ToString for GroupBy {
1212  fn to_string(&self) -> String {
1213    match *self {
1214      Self::Nodes => "nodes".to_string(),
1215      Self::Parents => "parents".to_string(),
1216      Self::None => "none".to_string(),
1217    }
1218  }
1219}
1220
1221impl std::str::FromStr for GroupBy {
1222  type Err = &'static str;
1223
1224  fn from_str(value: &str) -> Result<Self, &'static str> {
1225    match value {
1226      "nodes" => Ok(Self::Nodes),
1227      "parents" => Ok(Self::Parents),
1228      "none" => Ok(Self::None),
1229      _ => Err("invalid value"),
1230    }
1231  }
1232}
1233
1234impl std::convert::TryFrom<&str> for GroupBy {
1235  type Error = &'static str;
1236
1237  fn try_from(value: &str) -> Result<Self, &'static str> {
1238    value.parse()
1239  }
1240}
1241
1242impl std::convert::TryFrom<&String> for GroupBy {
1243  type Error = &'static str;
1244
1245  fn try_from(value: &String) -> Result<Self, &'static str> {
1246    value.parse()
1247  }
1248}
1249
1250impl std::convert::TryFrom<String> for GroupBy {
1251  type Error = &'static str;
1252
1253  fn try_from(value: String) -> Result<Self, &'static str> {
1254    value.parse()
1255  }
1256}
1257
1258///Health status ('green', 'yellow', or 'red') to filter only indices
1259/// matching the specified health status.
1260#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)]
1261pub enum Health {
1262  #[serde(rename = "green")]
1263  Green,
1264  #[serde(rename = "yellow")]
1265  Yellow,
1266  #[serde(rename = "red")]
1267  Red,
1268}
1269
1270impl From<&Health> for Health {
1271  fn from(value: &Health) -> Self {
1272    value.clone()
1273  }
1274}
1275
1276impl ToString for Health {
1277  fn to_string(&self) -> String {
1278    match *self {
1279      Self::Green => "green".to_string(),
1280      Self::Yellow => "yellow".to_string(),
1281      Self::Red => "red".to_string(),
1282    }
1283  }
1284}
1285
1286impl std::str::FromStr for Health {
1287  type Err = &'static str;
1288
1289  fn from_str(value: &str) -> Result<Self, &'static str> {
1290    match value {
1291      "green" => Ok(Self::Green),
1292      "yellow" => Ok(Self::Yellow),
1293      "red" => Ok(Self::Red),
1294      _ => Err("invalid value"),
1295    }
1296  }
1297}
1298
1299impl std::convert::TryFrom<&str> for Health {
1300  type Error = &'static str;
1301
1302  fn try_from(value: &str) -> Result<Self, &'static str> {
1303    value.parse()
1304  }
1305}
1306
1307impl std::convert::TryFrom<&String> for Health {
1308  type Error = &'static str;
1309
1310  fn try_from(value: &String) -> Result<Self, &'static str> {
1311    value.parse()
1312  }
1313}
1314
1315impl std::convert::TryFrom<String> for Health {
1316  type Error = &'static str;
1317
1318  fn try_from(value: String) -> Result<Self, &'static str> {
1319    value.parse()
1320  }
1321}
1322
1323#[derive(Clone, Debug, Deserialize, Serialize, PartialEq)]
1324pub struct Hit<T> {
1325  #[serde(default, skip_serializing_if = "Option::is_none")]
1326  pub fields: Option<serde_json::Value>,
1327  #[serde(rename = "_id", default)]
1328  pub id: String,
1329  #[serde(rename = "_index")]
1330  pub index: String,
1331  #[serde(rename = "_score", default, skip_serializing_if = "Option::is_none")]
1332  pub score: Option<f64>,
1333  #[serde(rename = "_source", default, skip_serializing_if = "Option::is_none")]
1334  pub source: Option<T>,
1335  #[serde(rename = "_type", default, skip_serializing_if = "Option::is_none")]
1336  pub type_: Option<String>,
1337  #[serde(rename = "sort", default, skip_serializing_if = "Option::is_none")]
1338  pub sort: Option<serde_json::Value>,
1339}
1340
1341impl<T> From<&Hit<T>> for Hit<T> {
1342  fn from(value: &Hit<T>) -> Self {
1343    value.into()
1344  }
1345}
1346
1347impl<T> Hit<T> {
1348  pub fn builder() -> builder::Hit<T> {
1349    builder::Hit::default()
1350  }
1351}
1352
1353#[derive(Clone, Debug, Deserialize, Serialize)]
1354pub struct HitsMetadata<T> {
1355  #[serde(default, skip_serializing_if = "Vec::is_empty")]
1356  pub hits: Vec<Hit<T>>,
1357  #[serde(default, skip_serializing_if = "Option::is_none")]
1358  pub max_score: Option<f64>,
1359  #[serde(default, skip_serializing_if = "Option::is_none")]
1360  pub total: Option<Total>,
1361}
1362
1363impl<T> From<&HitsMetadata<T>> for HitsMetadata<T> {
1364  fn from(value: &HitsMetadata<T>) -> Self {
1365    value.into()
1366  }
1367}
1368
1369impl<T> HitsMetadata<T> {
1370  pub fn builder() -> builder::HitsMetadata<T> {
1371    builder::HitsMetadata::default()
1372  }
1373}
1374
1375impl<T> Default for HitsMetadata<T> {
1376  fn default() -> Self {
1377    Self {
1378      hits: Vec::new(),
1379      max_score: None,
1380      total: None,
1381    }
1382  }
1383}
1384
1385///The document
1386#[derive(Clone, Debug, Deserialize, Serialize)]
1387pub struct IndexBodyParams(pub serde_json::Value);
1388impl std::ops::Deref for IndexBodyParams {
1389  type Target = serde_json::Value;
1390
1391  fn deref(&self) -> &serde_json::Value {
1392    &self.0
1393  }
1394}
1395
1396impl From<IndexBodyParams> for serde_json::Value {
1397  fn from(value: IndexBodyParams) -> Self {
1398    value.0
1399  }
1400}
1401
1402impl From<&IndexBodyParams> for IndexBodyParams {
1403  fn from(value: &IndexBodyParams) -> Self {
1404    value.clone()
1405  }
1406}
1407
1408impl From<serde_json::Value> for IndexBodyParams {
1409  fn from(value: serde_json::Value) -> Self {
1410    Self(value)
1411  }
1412}
1413
1414#[derive(Clone, Debug, Deserialize, Serialize)]
1415pub struct InfoResponseContent {
1416  #[serde(default, skip_serializing_if = "Option::is_none")]
1417  pub cluster_name: Option<String>,
1418  #[serde(default, skip_serializing_if = "Option::is_none")]
1419  pub cluster_uuid: Option<String>,
1420  #[serde(default, skip_serializing_if = "Option::is_none")]
1421  pub name: Option<String>,
1422  #[serde(default, skip_serializing_if = "Option::is_none")]
1423  pub tagline: Option<String>,
1424  #[serde(default, skip_serializing_if = "Option::is_none")]
1425  pub version: Option<InfoVersion>,
1426}
1427
1428impl From<&InfoResponseContent> for InfoResponseContent {
1429  fn from(value: &InfoResponseContent) -> Self {
1430    value.clone()
1431  }
1432}
1433
1434impl InfoResponseContent {
1435  pub fn builder() -> builder::InfoResponseContent {
1436    builder::InfoResponseContent::default()
1437  }
1438}
1439
1440#[derive(Clone, Debug, Deserialize, Serialize)]
1441pub struct InfoVersion {
1442  #[serde(default, skip_serializing_if = "Option::is_none")]
1443  pub build_date: Option<String>,
1444  #[serde(default, skip_serializing_if = "Option::is_none")]
1445  pub build_hash: Option<String>,
1446  #[serde(default, skip_serializing_if = "Option::is_none")]
1447  pub build_snapshot: Option<bool>,
1448  #[serde(default, skip_serializing_if = "Option::is_none")]
1449  pub build_type: Option<String>,
1450  #[serde(default, skip_serializing_if = "Option::is_none")]
1451  pub distribution: Option<String>,
1452  #[serde(default, skip_serializing_if = "Option::is_none")]
1453  pub lucene_version: Option<String>,
1454  #[serde(default, skip_serializing_if = "Option::is_none")]
1455  pub minimum_index_compatibility_version: Option<String>,
1456  #[serde(default, skip_serializing_if = "Option::is_none")]
1457  pub minimum_wire_compatibility_version: Option<String>,
1458  #[serde(default, skip_serializing_if = "Option::is_none")]
1459  pub number: Option<String>,
1460}
1461
1462impl From<&InfoVersion> for InfoVersion {
1463  fn from(value: &InfoVersion) -> Self {
1464    value.clone()
1465  }
1466}
1467
1468impl InfoVersion {
1469  pub fn builder() -> builder::InfoVersion {
1470    builder::InfoVersion::default()
1471  }
1472}
1473
1474///Document identifiers; can be either `docs` (containing full document
1475/// information) or `ids` (when index is provided in the URL.
1476#[derive(Clone, Debug, Deserialize, Serialize)]
1477pub struct MgetBodyParams(pub serde_json::Map<String, serde_json::Value>);
1478impl std::ops::Deref for MgetBodyParams {
1479  type Target = serde_json::Map<String, serde_json::Value>;
1480
1481  fn deref(&self) -> &serde_json::Map<String, serde_json::Value> {
1482    &self.0
1483  }
1484}
1485
1486impl From<MgetBodyParams> for serde_json::Map<String, serde_json::Value> {
1487  fn from(value: MgetBodyParams) -> Self {
1488    value.0
1489  }
1490}
1491
1492impl From<&MgetBodyParams> for MgetBodyParams {
1493  fn from(value: &MgetBodyParams) -> Self {
1494    value.clone()
1495  }
1496}
1497
1498impl From<serde_json::Map<String, serde_json::Value>> for MgetBodyParams {
1499  fn from(value: serde_json::Map<String, serde_json::Value>) -> Self {
1500    Self(value)
1501  }
1502}
1503
1504///The request definitions (metadata-search request definition pairs),
1505/// separated by newlines
1506#[derive(Clone, Debug, Deserialize, Serialize)]
1507pub struct MsearchBodyParams(pub serde_json::Map<String, serde_json::Value>);
1508impl std::ops::Deref for MsearchBodyParams {
1509  type Target = serde_json::Map<String, serde_json::Value>;
1510
1511  fn deref(&self) -> &serde_json::Map<String, serde_json::Value> {
1512    &self.0
1513  }
1514}
1515
1516impl From<MsearchBodyParams> for serde_json::Map<String, serde_json::Value> {
1517  fn from(value: MsearchBodyParams) -> Self {
1518    value.0
1519  }
1520}
1521
1522impl From<&MsearchBodyParams> for MsearchBodyParams {
1523  fn from(value: &MsearchBodyParams) -> Self {
1524    value.clone()
1525  }
1526}
1527
1528impl From<serde_json::Map<String, serde_json::Value>> for MsearchBodyParams {
1529  fn from(value: serde_json::Map<String, serde_json::Value>) -> Self {
1530    Self(value)
1531  }
1532}
1533
1534///The request definitions (metadata-search request definition pairs),
1535/// separated by newlines
1536#[derive(Clone, Debug, Deserialize, Serialize)]
1537pub struct MsearchTemplateBodyParams(pub serde_json::Map<String, serde_json::Value>);
1538impl std::ops::Deref for MsearchTemplateBodyParams {
1539  type Target = serde_json::Map<String, serde_json::Value>;
1540
1541  fn deref(&self) -> &serde_json::Map<String, serde_json::Value> {
1542    &self.0
1543  }
1544}
1545
1546impl From<MsearchTemplateBodyParams> for serde_json::Map<String, serde_json::Value> {
1547  fn from(value: MsearchTemplateBodyParams) -> Self {
1548    value.0
1549  }
1550}
1551
1552impl From<&MsearchTemplateBodyParams> for MsearchTemplateBodyParams {
1553  fn from(value: &MsearchTemplateBodyParams) -> Self {
1554    value.clone()
1555  }
1556}
1557
1558impl From<serde_json::Map<String, serde_json::Value>> for MsearchTemplateBodyParams {
1559  fn from(value: serde_json::Map<String, serde_json::Value>) -> Self {
1560    Self(value)
1561  }
1562}
1563
1564///Operation timeout.
1565#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)]
1566pub struct Timeout(String);
1567impl std::ops::Deref for Timeout {
1568  type Target = String;
1569
1570  fn deref(&self) -> &String {
1571    &self.0
1572  }
1573}
1574
1575impl From<Timeout> for String {
1576  fn from(value: Timeout) -> Self {
1577    value.0
1578  }
1579}
1580
1581impl From<&Timeout> for Timeout {
1582  fn from(value: &Timeout) -> Self {
1583    value.clone()
1584  }
1585}
1586
1587impl std::str::FromStr for Timeout {
1588  type Err = &'static str;
1589
1590  fn from_str(value: &str) -> Result<Self, &'static str> {
1591    if regress::Regex::new("^([0-9]+)(?:d|h|m|s|ms|micros|nanos)$")
1592      .unwrap()
1593      .find(value)
1594      .is_none()
1595    {
1596      return Err("doesn't match pattern \"^([0-9]+)(?:d|h|m|s|ms|micros|nanos)$\"");
1597    }
1598    Ok(Self(value.to_string()))
1599  }
1600}
1601
1602impl std::convert::TryFrom<&str> for Timeout {
1603  type Error = &'static str;
1604
1605  fn try_from(value: &str) -> Result<Self, &'static str> {
1606    value.parse()
1607  }
1608}
1609
1610impl std::convert::TryFrom<&String> for Timeout {
1611  type Error = &'static str;
1612
1613  fn try_from(value: &String) -> Result<Self, &'static str> {
1614    value.parse()
1615  }
1616}
1617
1618impl std::convert::TryFrom<String> for Timeout {
1619  type Error = &'static str;
1620
1621  fn try_from(value: String) -> Result<Self, &'static str> {
1622    value.parse()
1623  }
1624}
1625
1626impl<'de> serde::Deserialize<'de> for Timeout {
1627  fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
1628  where
1629    D: serde::Deserializer<'de>, {
1630    String::deserialize(deserializer)?
1631      .parse()
1632      .map_err(|e: &'static str| <D::Error as serde::de::Error>::custom(e.to_string()))
1633  }
1634}
1635
1636///Explicit operation type. Defaults to `index` for requests with an
1637/// explicit document ID, and to `create`for requests without an explicit
1638/// document ID.
1639#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)]
1640pub enum OpType {
1641  #[serde(rename = "index")]
1642  Index,
1643  #[serde(rename = "create")]
1644  Create,
1645}
1646
1647impl From<&OpType> for OpType {
1648  fn from(value: &OpType) -> Self {
1649    value.clone()
1650  }
1651}
1652
1653impl ToString for OpType {
1654  fn to_string(&self) -> String {
1655    match *self {
1656      Self::Index => "index".to_string(),
1657      Self::Create => "create".to_string(),
1658    }
1659  }
1660}
1661
1662impl std::str::FromStr for OpType {
1663  type Err = &'static str;
1664
1665  fn from_str(value: &str) -> Result<Self, &'static str> {
1666    match value {
1667      "index" => Ok(Self::Index),
1668      "create" => Ok(Self::Create),
1669      _ => Err("invalid value"),
1670    }
1671  }
1672}
1673
1674impl std::convert::TryFrom<&str> for OpType {
1675  type Error = &'static str;
1676
1677  fn try_from(value: &str) -> Result<Self, &'static str> {
1678    value.parse()
1679  }
1680}
1681
1682impl std::convert::TryFrom<&String> for OpType {
1683  type Error = &'static str;
1684
1685  fn try_from(value: &String) -> Result<Self, &'static str> {
1686    value.parse()
1687  }
1688}
1689
1690impl std::convert::TryFrom<String> for OpType {
1691  type Error = &'static str;
1692
1693  fn try_from(value: String) -> Result<Self, &'static str> {
1694    value.parse()
1695  }
1696}
1697
1698#[derive(Clone, Debug, Deserialize, Serialize)]
1699pub struct PitDetail {
1700  #[serde(default, skip_serializing_if = "Option::is_none")]
1701  pub creation_time: Option<i64>,
1702  #[serde(default, skip_serializing_if = "Option::is_none")]
1703  pub keep_alive: Option<i64>,
1704  #[serde(default, skip_serializing_if = "Option::is_none")]
1705  pub pit_id: Option<String>,
1706}
1707
1708impl From<&PitDetail> for PitDetail {
1709  fn from(value: &PitDetail) -> Self {
1710    value.clone()
1711  }
1712}
1713
1714impl PitDetail {
1715  pub fn builder() -> builder::PitDetail {
1716    builder::PitDetail::default()
1717  }
1718}
1719
1720#[derive(Clone, Debug, Deserialize, Serialize)]
1721pub struct PitsDetailsDeleteAll {
1722  #[serde(default, skip_serializing_if = "Option::is_none")]
1723  pub pit_id: Option<String>,
1724  #[serde(default, skip_serializing_if = "Option::is_none")]
1725  pub successful: Option<bool>,
1726}
1727
1728impl From<&PitsDetailsDeleteAll> for PitsDetailsDeleteAll {
1729  fn from(value: &PitsDetailsDeleteAll) -> Self {
1730    value.clone()
1731  }
1732}
1733
1734impl PitsDetailsDeleteAll {
1735  pub fn builder() -> builder::PitsDetailsDeleteAll {
1736    builder::PitsDetailsDeleteAll::default()
1737  }
1738}
1739
1740///The document
1741#[derive(Clone, Debug, Deserialize, Serialize)]
1742pub struct PutScriptBodyParams(pub serde_json::Map<String, serde_json::Value>);
1743impl std::ops::Deref for PutScriptBodyParams {
1744  type Target = serde_json::Map<String, serde_json::Value>;
1745
1746  fn deref(&self) -> &serde_json::Map<String, serde_json::Value> {
1747    &self.0
1748  }
1749}
1750
1751impl From<PutScriptBodyParams> for serde_json::Map<String, serde_json::Value> {
1752  fn from(value: PutScriptBodyParams) -> Self {
1753    value.0
1754  }
1755}
1756
1757impl From<&PutScriptBodyParams> for PutScriptBodyParams {
1758  fn from(value: &PutScriptBodyParams) -> Self {
1759    value.clone()
1760  }
1761}
1762
1763impl From<serde_json::Map<String, serde_json::Value>> for PutScriptBodyParams {
1764  fn from(value: serde_json::Map<String, serde_json::Value>) -> Self {
1765    Self(value)
1766  }
1767}
1768
1769///The ranking evaluation search definition, including search requests,
1770/// document ratings and ranking metric definition.
1771#[derive(Clone, Debug, Deserialize, Serialize)]
1772pub struct RankEvalBodyParams(pub serde_json::Map<String, serde_json::Value>);
1773impl std::ops::Deref for RankEvalBodyParams {
1774  type Target = serde_json::Map<String, serde_json::Value>;
1775
1776  fn deref(&self) -> &serde_json::Map<String, serde_json::Value> {
1777    &self.0
1778  }
1779}
1780
1781impl From<RankEvalBodyParams> for serde_json::Map<String, serde_json::Value> {
1782  fn from(value: RankEvalBodyParams) -> Self {
1783    value.0
1784  }
1785}
1786
1787impl From<&RankEvalBodyParams> for RankEvalBodyParams {
1788  fn from(value: &RankEvalBodyParams) -> Self {
1789    value.clone()
1790  }
1791}
1792
1793impl From<serde_json::Map<String, serde_json::Value>> for RankEvalBodyParams {
1794  fn from(value: serde_json::Map<String, serde_json::Value>) -> Self {
1795    Self(value)
1796  }
1797}
1798
1799///If `true` then refresh the affected shards to make this operation
1800/// visible to search, if `wait_for` then wait for a refresh to make this
1801/// operation visible to search, if `false` (the default) then do nothing
1802/// with refreshes.
1803#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)]
1804pub enum RefreshEnum {
1805  #[serde(rename = "true")]
1806  True,
1807  #[serde(rename = "false")]
1808  False,
1809  #[serde(rename = "wait_for")]
1810  WaitFor,
1811}
1812
1813impl From<&RefreshEnum> for RefreshEnum {
1814  fn from(value: &RefreshEnum) -> Self {
1815    value.clone()
1816  }
1817}
1818
1819impl ToString for RefreshEnum {
1820  fn to_string(&self) -> String {
1821    match *self {
1822      Self::True => "true".to_string(),
1823      Self::False => "false".to_string(),
1824      Self::WaitFor => "wait_for".to_string(),
1825    }
1826  }
1827}
1828
1829impl std::str::FromStr for RefreshEnum {
1830  type Err = &'static str;
1831
1832  fn from_str(value: &str) -> Result<Self, &'static str> {
1833    match value {
1834      "true" => Ok(Self::True),
1835      "false" => Ok(Self::False),
1836      "wait_for" => Ok(Self::WaitFor),
1837      _ => Err("invalid value"),
1838    }
1839  }
1840}
1841
1842impl std::convert::TryFrom<&str> for RefreshEnum {
1843  type Error = &'static str;
1844
1845  fn try_from(value: &str) -> Result<Self, &'static str> {
1846    value.parse()
1847  }
1848}
1849
1850impl std::convert::TryFrom<&String> for RefreshEnum {
1851  type Error = &'static str;
1852
1853  fn try_from(value: &String) -> Result<Self, &'static str> {
1854    value.parse()
1855  }
1856}
1857
1858impl std::convert::TryFrom<String> for RefreshEnum {
1859  type Error = &'static str;
1860
1861  fn try_from(value: String) -> Result<Self, &'static str> {
1862    value.parse()
1863  }
1864}
1865
1866///The search definition using the Query DSL and the prototype for the
1867/// index request.
1868#[derive(Clone, Debug, Deserialize, Serialize)]
1869pub struct ReindexBodyParams(pub serde_json::Map<String, serde_json::Value>);
1870impl std::ops::Deref for ReindexBodyParams {
1871  type Target = serde_json::Map<String, serde_json::Value>;
1872
1873  fn deref(&self) -> &serde_json::Map<String, serde_json::Value> {
1874    &self.0
1875  }
1876}
1877
1878impl From<ReindexBodyParams> for serde_json::Map<String, serde_json::Value> {
1879  fn from(value: ReindexBodyParams) -> Self {
1880    value.0
1881  }
1882}
1883
1884impl From<&ReindexBodyParams> for ReindexBodyParams {
1885  fn from(value: &ReindexBodyParams) -> Self {
1886    value.clone()
1887  }
1888}
1889
1890impl From<serde_json::Map<String, serde_json::Value>> for ReindexBodyParams {
1891  fn from(value: serde_json::Map<String, serde_json::Value>) -> Self {
1892    Self(value)
1893  }
1894}
1895
1896///Specify how long a consistent view of the index should be maintained for
1897/// scrolled search.
1898#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)]
1899pub struct ReindexScroll(String);
1900impl std::ops::Deref for ReindexScroll {
1901  type Target = String;
1902
1903  fn deref(&self) -> &String {
1904    &self.0
1905  }
1906}
1907
1908impl From<ReindexScroll> for String {
1909  fn from(value: ReindexScroll) -> Self {
1910    value.0
1911  }
1912}
1913
1914impl From<&ReindexScroll> for ReindexScroll {
1915  fn from(value: &ReindexScroll) -> Self {
1916    value.clone()
1917  }
1918}
1919
1920impl std::str::FromStr for ReindexScroll {
1921  type Err = &'static str;
1922
1923  fn from_str(value: &str) -> Result<Self, &'static str> {
1924    if regress::Regex::new("^([0-9]+)(?:d|h|m|s|ms|micros|nanos)$")
1925      .unwrap()
1926      .find(value)
1927      .is_none()
1928    {
1929      return Err("doesn't match pattern \"^([0-9]+)(?:d|h|m|s|ms|micros|nanos)$\"");
1930    }
1931    Ok(Self(value.to_string()))
1932  }
1933}
1934
1935impl std::convert::TryFrom<&str> for ReindexScroll {
1936  type Error = &'static str;
1937
1938  fn try_from(value: &str) -> Result<Self, &'static str> {
1939    value.parse()
1940  }
1941}
1942
1943impl std::convert::TryFrom<&String> for ReindexScroll {
1944  type Error = &'static str;
1945
1946  fn try_from(value: &String) -> Result<Self, &'static str> {
1947    value.parse()
1948  }
1949}
1950
1951impl std::convert::TryFrom<String> for ReindexScroll {
1952  type Error = &'static str;
1953
1954  fn try_from(value: String) -> Result<Self, &'static str> {
1955    value.parse()
1956  }
1957}
1958
1959impl<'de> serde::Deserialize<'de> for ReindexScroll {
1960  fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
1961  where
1962    D: serde::Deserializer<'de>, {
1963    String::deserialize(deserializer)?
1964      .parse()
1965      .map_err(|e: &'static str| <D::Error as serde::de::Error>::custom(e.to_string()))
1966  }
1967}
1968
1969///Time each individual bulk request should wait for shards that are
1970
1971#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)]
1972pub enum Relation {
1973  #[serde(rename = "eq")]
1974  Eq,
1975  #[serde(rename = "gte")]
1976  Gte,
1977}
1978
1979impl From<&Relation> for Relation {
1980  fn from(value: &Relation) -> Self {
1981    value.clone()
1982  }
1983}
1984
1985impl ToString for Relation {
1986  fn to_string(&self) -> String {
1987    match *self {
1988      Self::Eq => "eq".to_string(),
1989      Self::Gte => "gte".to_string(),
1990    }
1991  }
1992}
1993
1994impl std::str::FromStr for Relation {
1995  type Err = &'static str;
1996
1997  fn from_str(value: &str) -> Result<Self, &'static str> {
1998    match value {
1999      "eq" => Ok(Self::Eq),
2000      "gte" => Ok(Self::Gte),
2001      _ => Err("invalid value"),
2002    }
2003  }
2004}
2005
2006impl std::convert::TryFrom<&str> for Relation {
2007  type Error = &'static str;
2008
2009  fn try_from(value: &str) -> Result<Self, &'static str> {
2010    value.parse()
2011  }
2012}
2013
2014impl std::convert::TryFrom<&String> for Relation {
2015  type Error = &'static str;
2016
2017  fn try_from(value: &String) -> Result<Self, &'static str> {
2018    value.parse()
2019  }
2020}
2021
2022impl std::convert::TryFrom<String> for Relation {
2023  type Error = &'static str;
2024
2025  fn try_from(value: String) -> Result<Self, &'static str> {
2026    value.parse()
2027  }
2028}
2029
2030///The search definition template and its params
2031#[derive(Clone, Debug, Deserialize, Serialize)]
2032pub struct RenderSearchTemplateBodyParams(pub serde_json::Map<String, serde_json::Value>);
2033impl std::ops::Deref for RenderSearchTemplateBodyParams {
2034  type Target = serde_json::Map<String, serde_json::Value>;
2035
2036  fn deref(&self) -> &serde_json::Map<String, serde_json::Value> {
2037    &self.0
2038  }
2039}
2040
2041impl From<RenderSearchTemplateBodyParams> for serde_json::Map<String, serde_json::Value> {
2042  fn from(value: RenderSearchTemplateBodyParams) -> Self {
2043    value.0
2044  }
2045}
2046
2047impl From<&RenderSearchTemplateBodyParams> for RenderSearchTemplateBodyParams {
2048  fn from(value: &RenderSearchTemplateBodyParams) -> Self {
2049    value.clone()
2050  }
2051}
2052
2053impl From<serde_json::Map<String, serde_json::Value>> for RenderSearchTemplateBodyParams {
2054  fn from(value: serde_json::Map<String, serde_json::Value>) -> Self {
2055    Self(value)
2056  }
2057}
2058
2059///The type to sample.
2060#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)]
2061pub enum SampleType {
2062  #[serde(rename = "cpu")]
2063  Cpu,
2064  #[serde(rename = "wait")]
2065  Wait,
2066  #[serde(rename = "block")]
2067  Block,
2068}
2069
2070impl From<&SampleType> for SampleType {
2071  fn from(value: &SampleType) -> Self {
2072    value.clone()
2073  }
2074}
2075
2076impl ToString for SampleType {
2077  fn to_string(&self) -> String {
2078    match *self {
2079      Self::Cpu => "cpu".to_string(),
2080      Self::Wait => "wait".to_string(),
2081      Self::Block => "block".to_string(),
2082    }
2083  }
2084}
2085
2086impl std::str::FromStr for SampleType {
2087  type Err = &'static str;
2088
2089  fn from_str(value: &str) -> Result<Self, &'static str> {
2090    match value {
2091      "cpu" => Ok(Self::Cpu),
2092      "wait" => Ok(Self::Wait),
2093      "block" => Ok(Self::Block),
2094      _ => Err("invalid value"),
2095    }
2096  }
2097}
2098
2099impl std::convert::TryFrom<&str> for SampleType {
2100  type Error = &'static str;
2101
2102  fn try_from(value: &str) -> Result<Self, &'static str> {
2103    value.parse()
2104  }
2105}
2106
2107impl std::convert::TryFrom<&String> for SampleType {
2108  type Error = &'static str;
2109
2110  fn try_from(value: &String) -> Result<Self, &'static str> {
2111    value.parse()
2112  }
2113}
2114
2115impl std::convert::TryFrom<String> for SampleType {
2116  type Error = &'static str;
2117
2118  fn try_from(value: String) -> Result<Self, &'static str> {
2119    value.parse()
2120  }
2121}
2122
2123///The script to execute
2124#[derive(Clone, Debug, Deserialize, Serialize)]
2125pub struct ScriptsPainlessExecuteBodyParams(pub serde_json::Map<String, serde_json::Value>);
2126impl std::ops::Deref for ScriptsPainlessExecuteBodyParams {
2127  type Target = serde_json::Map<String, serde_json::Value>;
2128
2129  fn deref(&self) -> &serde_json::Map<String, serde_json::Value> {
2130    &self.0
2131  }
2132}
2133
2134impl From<ScriptsPainlessExecuteBodyParams> for serde_json::Map<String, serde_json::Value> {
2135  fn from(value: ScriptsPainlessExecuteBodyParams) -> Self {
2136    value.0
2137  }
2138}
2139
2140impl From<&ScriptsPainlessExecuteBodyParams> for ScriptsPainlessExecuteBodyParams {
2141  fn from(value: &ScriptsPainlessExecuteBodyParams) -> Self {
2142    value.clone()
2143  }
2144}
2145
2146impl From<serde_json::Map<String, serde_json::Value>> for ScriptsPainlessExecuteBodyParams {
2147  fn from(value: serde_json::Map<String, serde_json::Value>) -> Self {
2148    Self(value)
2149  }
2150}
2151
2152///The scroll ID if not passed by URL or query parameter.
2153#[derive(Clone, Debug, Deserialize, Serialize)]
2154pub struct ScrollBodyParams(pub serde_json::Map<String, serde_json::Value>);
2155impl std::ops::Deref for ScrollBodyParams {
2156  type Target = serde_json::Map<String, serde_json::Value>;
2157
2158  fn deref(&self) -> &serde_json::Map<String, serde_json::Value> {
2159    &self.0
2160  }
2161}
2162
2163impl From<ScrollBodyParams> for serde_json::Map<String, serde_json::Value> {
2164  fn from(value: ScrollBodyParams) -> Self {
2165    value.0
2166  }
2167}
2168
2169impl From<&ScrollBodyParams> for ScrollBodyParams {
2170  fn from(value: &ScrollBodyParams) -> Self {
2171    value.clone()
2172  }
2173}
2174
2175impl From<serde_json::Map<String, serde_json::Value>> for ScrollBodyParams {
2176  fn from(value: serde_json::Map<String, serde_json::Value>) -> Self {
2177    Self(value)
2178  }
2179}
2180
2181///Specify how long a consistent view of the index should be maintained for
2182/// scrolled search.
2183#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)]
2184pub struct ScrollGetScroll(String);
2185impl std::ops::Deref for ScrollGetScroll {
2186  type Target = String;
2187
2188  fn deref(&self) -> &String {
2189    &self.0
2190  }
2191}
2192
2193impl From<ScrollGetScroll> for String {
2194  fn from(value: ScrollGetScroll) -> Self {
2195    value.0
2196  }
2197}
2198
2199impl From<&ScrollGetScroll> for ScrollGetScroll {
2200  fn from(value: &ScrollGetScroll) -> Self {
2201    value.clone()
2202  }
2203}
2204
2205impl std::str::FromStr for ScrollGetScroll {
2206  type Err = &'static str;
2207
2208  fn from_str(value: &str) -> Result<Self, &'static str> {
2209    if regress::Regex::new("^([0-9]+)(?:d|h|m|s|ms|micros|nanos)$")
2210      .unwrap()
2211      .find(value)
2212      .is_none()
2213    {
2214      return Err("doesn't match pattern \"^([0-9]+)(?:d|h|m|s|ms|micros|nanos)$\"");
2215    }
2216    Ok(Self(value.to_string()))
2217  }
2218}
2219
2220impl std::convert::TryFrom<&str> for ScrollGetScroll {
2221  type Error = &'static str;
2222
2223  fn try_from(value: &str) -> Result<Self, &'static str> {
2224    value.parse()
2225  }
2226}
2227
2228impl std::convert::TryFrom<&String> for ScrollGetScroll {
2229  type Error = &'static str;
2230
2231  fn try_from(value: &String) -> Result<Self, &'static str> {
2232    value.parse()
2233  }
2234}
2235
2236impl std::convert::TryFrom<String> for ScrollGetScroll {
2237  type Error = &'static str;
2238
2239  fn try_from(value: String) -> Result<Self, &'static str> {
2240    value.parse()
2241  }
2242}
2243
2244impl<'de> serde::Deserialize<'de> for ScrollGetScroll {
2245  fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
2246  where
2247    D: serde::Deserializer<'de>, {
2248    String::deserialize(deserializer)?
2249      .parse()
2250      .map_err(|e: &'static str| <D::Error as serde::de::Error>::custom(e.to_string()))
2251  }
2252}
2253
2254///Specify how long a consistent view of the index should be maintained for
2255/// scrolled search.
2256#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)]
2257pub struct ScrollGetWithScrollIdScroll(String);
2258impl std::ops::Deref for ScrollGetWithScrollIdScroll {
2259  type Target = String;
2260
2261  fn deref(&self) -> &String {
2262    &self.0
2263  }
2264}
2265
2266impl From<ScrollGetWithScrollIdScroll> for String {
2267  fn from(value: ScrollGetWithScrollIdScroll) -> Self {
2268    value.0
2269  }
2270}
2271
2272impl From<&ScrollGetWithScrollIdScroll> for ScrollGetWithScrollIdScroll {
2273  fn from(value: &ScrollGetWithScrollIdScroll) -> Self {
2274    value.clone()
2275  }
2276}
2277
2278impl std::str::FromStr for ScrollGetWithScrollIdScroll {
2279  type Err = &'static str;
2280
2281  fn from_str(value: &str) -> Result<Self, &'static str> {
2282    if regress::Regex::new("^([0-9]+)(?:d|h|m|s|ms|micros|nanos)$")
2283      .unwrap()
2284      .find(value)
2285      .is_none()
2286    {
2287      return Err("doesn't match pattern \"^([0-9]+)(?:d|h|m|s|ms|micros|nanos)$\"");
2288    }
2289    Ok(Self(value.to_string()))
2290  }
2291}
2292
2293impl std::convert::TryFrom<&str> for ScrollGetWithScrollIdScroll {
2294  type Error = &'static str;
2295
2296  fn try_from(value: &str) -> Result<Self, &'static str> {
2297    value.parse()
2298  }
2299}
2300
2301impl std::convert::TryFrom<&String> for ScrollGetWithScrollIdScroll {
2302  type Error = &'static str;
2303
2304  fn try_from(value: &String) -> Result<Self, &'static str> {
2305    value.parse()
2306  }
2307}
2308
2309impl std::convert::TryFrom<String> for ScrollGetWithScrollIdScroll {
2310  type Error = &'static str;
2311
2312  fn try_from(value: String) -> Result<Self, &'static str> {
2313    value.parse()
2314  }
2315}
2316
2317impl<'de> serde::Deserialize<'de> for ScrollGetWithScrollIdScroll {
2318  fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
2319  where
2320    D: serde::Deserializer<'de>, {
2321    String::deserialize(deserializer)?
2322      .parse()
2323      .map_err(|e: &'static str| <D::Error as serde::de::Error>::custom(e.to_string()))
2324  }
2325}
2326
2327///Specify how long a consistent view of the index should be maintained for
2328/// scrolled search.
2329#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)]
2330pub struct ScrollPostScroll(String);
2331impl std::ops::Deref for ScrollPostScroll {
2332  type Target = String;
2333
2334  fn deref(&self) -> &String {
2335    &self.0
2336  }
2337}
2338
2339impl From<ScrollPostScroll> for String {
2340  fn from(value: ScrollPostScroll) -> Self {
2341    value.0
2342  }
2343}
2344
2345impl From<&ScrollPostScroll> for ScrollPostScroll {
2346  fn from(value: &ScrollPostScroll) -> Self {
2347    value.clone()
2348  }
2349}
2350
2351impl std::str::FromStr for ScrollPostScroll {
2352  type Err = &'static str;
2353
2354  fn from_str(value: &str) -> Result<Self, &'static str> {
2355    if regress::Regex::new("^([0-9]+)(?:d|h|m|s|ms|micros|nanos)$")
2356      .unwrap()
2357      .find(value)
2358      .is_none()
2359    {
2360      return Err("doesn't match pattern \"^([0-9]+)(?:d|h|m|s|ms|micros|nanos)$\"");
2361    }
2362    Ok(Self(value.to_string()))
2363  }
2364}
2365
2366impl std::convert::TryFrom<&str> for ScrollPostScroll {
2367  type Error = &'static str;
2368
2369  fn try_from(value: &str) -> Result<Self, &'static str> {
2370    value.parse()
2371  }
2372}
2373
2374impl std::convert::TryFrom<&String> for ScrollPostScroll {
2375  type Error = &'static str;
2376
2377  fn try_from(value: &String) -> Result<Self, &'static str> {
2378    value.parse()
2379  }
2380}
2381
2382impl std::convert::TryFrom<String> for ScrollPostScroll {
2383  type Error = &'static str;
2384
2385  fn try_from(value: String) -> Result<Self, &'static str> {
2386    value.parse()
2387  }
2388}
2389
2390impl<'de> serde::Deserialize<'de> for ScrollPostScroll {
2391  fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
2392  where
2393    D: serde::Deserializer<'de>, {
2394    String::deserialize(deserializer)?
2395      .parse()
2396      .map_err(|e: &'static str| <D::Error as serde::de::Error>::custom(e.to_string()))
2397  }
2398}
2399
2400///Specify how long a consistent view of the index should be maintained for
2401/// scrolled search.
2402#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)]
2403pub struct ScrollPostWithScrollIdScroll(String);
2404impl std::ops::Deref for ScrollPostWithScrollIdScroll {
2405  type Target = String;
2406
2407  fn deref(&self) -> &String {
2408    &self.0
2409  }
2410}
2411
2412impl From<ScrollPostWithScrollIdScroll> for String {
2413  fn from(value: ScrollPostWithScrollIdScroll) -> Self {
2414    value.0
2415  }
2416}
2417
2418impl From<&ScrollPostWithScrollIdScroll> for ScrollPostWithScrollIdScroll {
2419  fn from(value: &ScrollPostWithScrollIdScroll) -> Self {
2420    value.clone()
2421  }
2422}
2423
2424impl std::str::FromStr for ScrollPostWithScrollIdScroll {
2425  type Err = &'static str;
2426
2427  fn from_str(value: &str) -> Result<Self, &'static str> {
2428    if regress::Regex::new("^([0-9]+)(?:d|h|m|s|ms|micros|nanos)$")
2429      .unwrap()
2430      .find(value)
2431      .is_none()
2432    {
2433      return Err("doesn't match pattern \"^([0-9]+)(?:d|h|m|s|ms|micros|nanos)$\"");
2434    }
2435    Ok(Self(value.to_string()))
2436  }
2437}
2438
2439impl std::convert::TryFrom<&str> for ScrollPostWithScrollIdScroll {
2440  type Error = &'static str;
2441
2442  fn try_from(value: &str) -> Result<Self, &'static str> {
2443    value.parse()
2444  }
2445}
2446
2447impl std::convert::TryFrom<&String> for ScrollPostWithScrollIdScroll {
2448  type Error = &'static str;
2449
2450  fn try_from(value: &String) -> Result<Self, &'static str> {
2451    value.parse()
2452  }
2453}
2454
2455impl std::convert::TryFrom<String> for ScrollPostWithScrollIdScroll {
2456  type Error = &'static str;
2457
2458  fn try_from(value: String) -> Result<Self, &'static str> {
2459    value.parse()
2460  }
2461}
2462
2463impl<'de> serde::Deserialize<'de> for ScrollPostWithScrollIdScroll {
2464  fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
2465  where
2466    D: serde::Deserializer<'de>, {
2467    String::deserialize(deserializer)?
2468      .parse()
2469      .map_err(|e: &'static str| <D::Error as serde::de::Error>::custom(e.to_string()))
2470  }
2471}
2472
2473// ///The search definition using the Query DSL
2474// #[derive(Clone, Debug, Deserialize, Serialize)]
2475// pub struct SearchBodyParams {
2476//   #[serde(default, skip_serializing_if = "Option::is_none")]
2477//   pub docvalue_fields: Option<String>,
2478//   #[serde(default, skip_serializing_if = "Option::is_none")]
2479//   pub explain: Option<bool>,
2480//   #[serde(default, skip_serializing_if = "Vec::is_empty")]
2481//   pub fields: Vec<String>,
2482//   #[serde(default, skip_serializing_if = "Option::is_none")]
2483//   pub from: Option<u32>,
2484//   #[serde(default, skip_serializing_if = "Vec::is_empty")]
2485//   pub indices_boost: Vec<serde_json::Value>,
2486//   #[serde(default, skip_serializing_if = "Option::is_none")]
2487//   pub min_score: Option<u32>,
2488//   #[serde(default, skip_serializing_if = "Option::is_none")]
2489//   pub query: Option<UserDefinedObjectStructure>,
2490//   #[serde(default, skip_serializing_if = "Option::is_none")]
2491//   pub seq_no_primary_term: Option<bool>,
2492//   #[serde(default, skip_serializing_if = "Option::is_none")]
2493//   pub size: Option<u32>,
2494//   #[serde(default, skip_serializing_if = "Option::is_none")]
2495//   pub source: Option<String>,
2496//   #[serde(default, skip_serializing_if = "Option::is_none")]
2497//   pub stats: Option<String>,
2498//   #[serde(default, skip_serializing_if = "Option::is_none")]
2499//   pub terminate_after: Option<u32>,
2500//   #[serde(default, skip_serializing_if = "Option::is_none")]
2501//   pub timeout: Option<Time>,
2502//   #[serde(default, skip_serializing_if = "Option::is_none")]
2503//   pub version: Option<bool>,
2504//   #[serde(default, skip_serializing_if = "Option::is_none")]
2505//   pub search_after: Option<serde_json::Value>,
2506//   #[serde(default, skip_serializing_if = "Option::is_none")]
2507//   pub sort: Option<serde_json::Value>,
2508// }
2509
2510// impl Default for SearchBodyParams {
2511//   fn default() -> Self {
2512//     Self {
2513//       docvalue_fields: None,
2514//       explain: None,
2515//       fields: Vec::new(),
2516//       from: None,
2517//       indices_boost: Vec::new(),
2518//       min_score: None,
2519//       query: None,
2520//       seq_no_primary_term: None,
2521//       size: None,
2522//       source: None,
2523//       stats: None,
2524//       terminate_after: None,
2525//       timeout: None,
2526//       version: None,
2527//       search_after: None,
2528//       sort: None,
2529//     }
2530//   }
2531// }
2532
2533// impl From<&SearchBodyParams> for SearchBodyParams {
2534//   fn from(value: &SearchBodyParams) -> Self {
2535//     value.clone()
2536//   }
2537// }
2538
2539// impl SearchBodyParams {
2540//   pub fn builder() -> builder::SearchBodyParams {
2541//     builder::SearchBodyParams::default()
2542//   }
2543// }
2544
2545#[derive(Clone, Debug, Deserialize, Serialize)]
2546pub struct SearchGetResponseContent<T> {
2547  #[serde(default, skip_serializing_if = "Option::is_none")]
2548  pub hits: Option<HitsMetadata<T>>,
2549  #[serde(rename = "_scroll_id", default, skip_serializing_if = "Option::is_none")]
2550  pub scroll_id: Option<String>,
2551  #[serde(rename = "_shards", default, skip_serializing_if = "Option::is_none")]
2552  pub shards: Option<ShardStatistics>,
2553  #[serde(default, skip_serializing_if = "Option::is_none")]
2554  pub timed_out: Option<bool>,
2555  #[serde(default, skip_serializing_if = "Option::is_none")]
2556  pub took: Option<i64>,
2557}
2558
2559impl<T> From<&SearchGetResponseContent<T>> for SearchGetResponseContent<T> {
2560  fn from(value: &SearchGetResponseContent<T>) -> Self {
2561    value.into()
2562  }
2563}
2564
2565impl<T> SearchGetResponseContent<T> {
2566  pub fn builder() -> builder::SearchGetResponseContent<T> {
2567    builder::SearchGetResponseContent::default()
2568  }
2569}
2570
2571///Specify how long a consistent view of the index should be maintained for
2572/// scrolled search.
2573#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)]
2574pub struct SearchGetScroll(String);
2575impl std::ops::Deref for SearchGetScroll {
2576  type Target = String;
2577
2578  fn deref(&self) -> &String {
2579    &self.0
2580  }
2581}
2582
2583impl From<SearchGetScroll> for String {
2584  fn from(value: SearchGetScroll) -> Self {
2585    value.0
2586  }
2587}
2588
2589impl From<&SearchGetScroll> for SearchGetScroll {
2590  fn from(value: &SearchGetScroll) -> Self {
2591    value.clone()
2592  }
2593}
2594
2595impl std::str::FromStr for SearchGetScroll {
2596  type Err = &'static str;
2597
2598  fn from_str(value: &str) -> Result<Self, &'static str> {
2599    if regress::Regex::new("^([0-9]+)(?:d|h|m|s|ms|micros|nanos)$")
2600      .unwrap()
2601      .find(value)
2602      .is_none()
2603    {
2604      return Err("doesn't match pattern \"^([0-9]+)(?:d|h|m|s|ms|micros|nanos)$\"");
2605    }
2606    Ok(Self(value.to_string()))
2607  }
2608}
2609
2610impl std::convert::TryFrom<&str> for SearchGetScroll {
2611  type Error = &'static str;
2612
2613  fn try_from(value: &str) -> Result<Self, &'static str> {
2614    value.parse()
2615  }
2616}
2617
2618impl std::convert::TryFrom<&String> for SearchGetScroll {
2619  type Error = &'static str;
2620
2621  fn try_from(value: &String) -> Result<Self, &'static str> {
2622    value.parse()
2623  }
2624}
2625
2626impl std::convert::TryFrom<String> for SearchGetScroll {
2627  type Error = &'static str;
2628
2629  fn try_from(value: String) -> Result<Self, &'static str> {
2630    value.parse()
2631  }
2632}
2633
2634impl<'de> serde::Deserialize<'de> for SearchGetScroll {
2635  fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
2636  where
2637    D: serde::Deserializer<'de>, {
2638    String::deserialize(deserializer)?
2639      .parse()
2640      .map_err(|e: &'static str| <D::Error as serde::de::Error>::custom(e.to_string()))
2641  }
2642}
2643
2644///Specify how long a consistent view of the index should be maintained for
2645/// scrolled search.
2646#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)]
2647pub struct SearchGetWithIndexScroll(String);
2648impl std::ops::Deref for SearchGetWithIndexScroll {
2649  type Target = String;
2650
2651  fn deref(&self) -> &String {
2652    &self.0
2653  }
2654}
2655
2656impl From<SearchGetWithIndexScroll> for String {
2657  fn from(value: SearchGetWithIndexScroll) -> Self {
2658    value.0
2659  }
2660}
2661
2662impl From<&SearchGetWithIndexScroll> for SearchGetWithIndexScroll {
2663  fn from(value: &SearchGetWithIndexScroll) -> Self {
2664    value.clone()
2665  }
2666}
2667
2668impl std::str::FromStr for SearchGetWithIndexScroll {
2669  type Err = &'static str;
2670
2671  fn from_str(value: &str) -> Result<Self, &'static str> {
2672    if regress::Regex::new("^([0-9]+)(?:d|h|m|s|ms|micros|nanos)$")
2673      .unwrap()
2674      .find(value)
2675      .is_none()
2676    {
2677      return Err("doesn't match pattern \"^([0-9]+)(?:d|h|m|s|ms|micros|nanos)$\"");
2678    }
2679    Ok(Self(value.to_string()))
2680  }
2681}
2682
2683impl std::convert::TryFrom<&str> for SearchGetWithIndexScroll {
2684  type Error = &'static str;
2685
2686  fn try_from(value: &str) -> Result<Self, &'static str> {
2687    value.parse()
2688  }
2689}
2690
2691impl std::convert::TryFrom<&String> for SearchGetWithIndexScroll {
2692  type Error = &'static str;
2693
2694  fn try_from(value: &String) -> Result<Self, &'static str> {
2695    value.parse()
2696  }
2697}
2698
2699impl std::convert::TryFrom<String> for SearchGetWithIndexScroll {
2700  type Error = &'static str;
2701
2702  fn try_from(value: String) -> Result<Self, &'static str> {
2703    value.parse()
2704  }
2705}
2706
2707impl<'de> serde::Deserialize<'de> for SearchGetWithIndexScroll {
2708  fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
2709  where
2710    D: serde::Deserializer<'de>, {
2711    String::deserialize(deserializer)?
2712      .parse()
2713      .map_err(|e: &'static str| <D::Error as serde::de::Error>::custom(e.to_string()))
2714  }
2715}
2716
2717#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
2718#[serde(rename_all = "camelCase")]
2719pub struct Aggregations {}
2720
2721#[derive(Clone, Debug, Deserialize, Serialize)]
2722pub struct SearchPostResponseContent<T> {
2723  #[serde(default, skip_serializing_if = "Option::is_none")]
2724  pub hits: Option<HitsMetadata<T>>,
2725  #[serde(rename = "_scroll_id", default, skip_serializing_if = "Option::is_none")]
2726  pub scroll_id: Option<String>,
2727  #[serde(rename = "_shards", default, skip_serializing_if = "Option::is_none")]
2728  pub shards: Option<ShardStatistics>,
2729  #[serde(default, skip_serializing_if = "Option::is_none")]
2730  pub timed_out: Option<bool>,
2731  #[serde(default, skip_serializing_if = "Option::is_none")]
2732  pub took: Option<i64>,
2733  #[serde(default, skip_serializing_if = "Option::is_none")]
2734  pub aggregations: Option<Aggregations>,
2735}
2736
2737impl<T> From<&SearchPostResponseContent<T>> for SearchPostResponseContent<T> {
2738  fn from(value: &SearchPostResponseContent<T>) -> Self {
2739    value.into()
2740  }
2741}
2742
2743impl<T> SearchPostResponseContent<T> {
2744  pub fn builder() -> builder::SearchPostResponseContent<T> {
2745    builder::SearchPostResponseContent::default()
2746  }
2747}
2748
2749///Specify how long a consistent view of the index should be maintained for
2750/// scrolled search.
2751#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)]
2752pub struct SearchPostScroll(String);
2753impl std::ops::Deref for SearchPostScroll {
2754  type Target = String;
2755
2756  fn deref(&self) -> &String {
2757    &self.0
2758  }
2759}
2760
2761impl From<SearchPostScroll> for String {
2762  fn from(value: SearchPostScroll) -> Self {
2763    value.0
2764  }
2765}
2766
2767impl From<&SearchPostScroll> for SearchPostScroll {
2768  fn from(value: &SearchPostScroll) -> Self {
2769    value.clone()
2770  }
2771}
2772
2773impl std::str::FromStr for SearchPostScroll {
2774  type Err = &'static str;
2775
2776  fn from_str(value: &str) -> Result<Self, &'static str> {
2777    if regress::Regex::new("^([0-9]+)(?:d|h|m|s|ms|micros|nanos)$")
2778      .unwrap()
2779      .find(value)
2780      .is_none()
2781    {
2782      return Err("doesn't match pattern \"^([0-9]+)(?:d|h|m|s|ms|micros|nanos)$\"");
2783    }
2784    Ok(Self(value.to_string()))
2785  }
2786}
2787
2788impl std::convert::TryFrom<&str> for SearchPostScroll {
2789  type Error = &'static str;
2790
2791  fn try_from(value: &str) -> Result<Self, &'static str> {
2792    value.parse()
2793  }
2794}
2795
2796impl std::convert::TryFrom<&String> for SearchPostScroll {
2797  type Error = &'static str;
2798
2799  fn try_from(value: &String) -> Result<Self, &'static str> {
2800    value.parse()
2801  }
2802}
2803
2804impl std::convert::TryFrom<String> for SearchPostScroll {
2805  type Error = &'static str;
2806
2807  fn try_from(value: String) -> Result<Self, &'static str> {
2808    value.parse()
2809  }
2810}
2811
2812impl<'de> serde::Deserialize<'de> for SearchPostScroll {
2813  fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
2814  where
2815    D: serde::Deserializer<'de>, {
2816    String::deserialize(deserializer)?
2817      .parse()
2818      .map_err(|e: &'static str| <D::Error as serde::de::Error>::custom(e.to_string()))
2819  }
2820}
2821
2822#[derive(Clone, Debug, Deserialize, Serialize, Default)]
2823pub struct SearchResult<T> {
2824  #[serde(default)]
2825  pub hits: HitsMetadata<T>,
2826  #[serde(rename = "_scroll_id", default, skip_serializing_if = "Option::is_none")]
2827  pub scroll_id: Option<String>,
2828  #[serde(rename = "_shards", default, skip_serializing_if = "Option::is_none")]
2829  pub shards: Option<ShardStatistics>,
2830  #[serde(default, skip_serializing_if = "Option::is_none")]
2831  pub timed_out: Option<bool>,
2832  #[serde(default, skip_serializing_if = "Option::is_none")]
2833  pub took: Option<i64>,
2834}
2835
2836impl<T> From<&SearchResult<T>> for SearchResult<T> {
2837  fn from(value: &SearchResult<T>) -> Self {
2838    value.into()
2839  }
2840}
2841
2842impl<T> SearchResult<T> {
2843  pub fn builder() -> builder::SearchResult<T> {
2844    builder::SearchResult::default()
2845  }
2846}
2847
2848///Specify how long a consistent view of the index should be maintained for
2849/// scrolled search.
2850#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)]
2851pub struct SearchPostWithIndexScroll(String);
2852impl std::ops::Deref for SearchPostWithIndexScroll {
2853  type Target = String;
2854
2855  fn deref(&self) -> &String {
2856    &self.0
2857  }
2858}
2859
2860impl From<SearchPostWithIndexScroll> for String {
2861  fn from(value: SearchPostWithIndexScroll) -> Self {
2862    value.0
2863  }
2864}
2865
2866impl From<&SearchPostWithIndexScroll> for SearchPostWithIndexScroll {
2867  fn from(value: &SearchPostWithIndexScroll) -> Self {
2868    value.clone()
2869  }
2870}
2871
2872impl std::str::FromStr for SearchPostWithIndexScroll {
2873  type Err = &'static str;
2874
2875  fn from_str(value: &str) -> Result<Self, &'static str> {
2876    if regress::Regex::new("^([0-9]+)(?:d|h|m|s|ms|micros|nanos)$")
2877      .unwrap()
2878      .find(value)
2879      .is_none()
2880    {
2881      return Err("doesn't match pattern \"^([0-9]+)(?:d|h|m|s|ms|micros|nanos)$\"");
2882    }
2883    Ok(Self(value.to_string()))
2884  }
2885}
2886
2887impl std::convert::TryFrom<&str> for SearchPostWithIndexScroll {
2888  type Error = &'static str;
2889
2890  fn try_from(value: &str) -> Result<Self, &'static str> {
2891    value.parse()
2892  }
2893}
2894
2895impl std::convert::TryFrom<&String> for SearchPostWithIndexScroll {
2896  type Error = &'static str;
2897
2898  fn try_from(value: &String) -> Result<Self, &'static str> {
2899    value.parse()
2900  }
2901}
2902
2903impl std::convert::TryFrom<String> for SearchPostWithIndexScroll {
2904  type Error = &'static str;
2905
2906  fn try_from(value: String) -> Result<Self, &'static str> {
2907    value.parse()
2908  }
2909}
2910
2911impl<'de> serde::Deserialize<'de> for SearchPostWithIndexScroll {
2912  fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
2913  where
2914    D: serde::Deserializer<'de>, {
2915    String::deserialize(deserializer)?
2916      .parse()
2917      .map_err(|e: &'static str| <D::Error as serde::de::Error>::custom(e.to_string()))
2918  }
2919}
2920
2921///The search definition template and its params
2922#[derive(Clone, Debug, Deserialize, Serialize)]
2923pub struct SearchTemplateBodyParams(pub serde_json::Map<String, serde_json::Value>);
2924impl std::ops::Deref for SearchTemplateBodyParams {
2925  type Target = serde_json::Map<String, serde_json::Value>;
2926
2927  fn deref(&self) -> &serde_json::Map<String, serde_json::Value> {
2928    &self.0
2929  }
2930}
2931
2932impl From<SearchTemplateBodyParams> for serde_json::Map<String, serde_json::Value> {
2933  fn from(value: SearchTemplateBodyParams) -> Self {
2934    value.0
2935  }
2936}
2937
2938impl From<&SearchTemplateBodyParams> for SearchTemplateBodyParams {
2939  fn from(value: &SearchTemplateBodyParams) -> Self {
2940    value.clone()
2941  }
2942}
2943
2944impl From<serde_json::Map<String, serde_json::Value>> for SearchTemplateBodyParams {
2945  fn from(value: serde_json::Map<String, serde_json::Value>) -> Self {
2946    Self(value)
2947  }
2948}
2949
2950///Specify how long a consistent view of the index should be maintained for
2951/// scrolled search.
2952#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)]
2953pub struct SearchTemplateGetScroll(String);
2954impl std::ops::Deref for SearchTemplateGetScroll {
2955  type Target = String;
2956
2957  fn deref(&self) -> &String {
2958    &self.0
2959  }
2960}
2961
2962impl From<SearchTemplateGetScroll> for String {
2963  fn from(value: SearchTemplateGetScroll) -> Self {
2964    value.0
2965  }
2966}
2967
2968impl From<&SearchTemplateGetScroll> for SearchTemplateGetScroll {
2969  fn from(value: &SearchTemplateGetScroll) -> Self {
2970    value.clone()
2971  }
2972}
2973
2974impl std::str::FromStr for SearchTemplateGetScroll {
2975  type Err = &'static str;
2976
2977  fn from_str(value: &str) -> Result<Self, &'static str> {
2978    if regress::Regex::new("^([0-9]+)(?:d|h|m|s|ms|micros|nanos)$")
2979      .unwrap()
2980      .find(value)
2981      .is_none()
2982    {
2983      return Err("doesn't match pattern \"^([0-9]+)(?:d|h|m|s|ms|micros|nanos)$\"");
2984    }
2985    Ok(Self(value.to_string()))
2986  }
2987}
2988
2989impl std::convert::TryFrom<&str> for SearchTemplateGetScroll {
2990  type Error = &'static str;
2991
2992  fn try_from(value: &str) -> Result<Self, &'static str> {
2993    value.parse()
2994  }
2995}
2996
2997impl std::convert::TryFrom<&String> for SearchTemplateGetScroll {
2998  type Error = &'static str;
2999
3000  fn try_from(value: &String) -> Result<Self, &'static str> {
3001    value.parse()
3002  }
3003}
3004
3005impl std::convert::TryFrom<String> for SearchTemplateGetScroll {
3006  type Error = &'static str;
3007
3008  fn try_from(value: String) -> Result<Self, &'static str> {
3009    value.parse()
3010  }
3011}
3012
3013impl<'de> serde::Deserialize<'de> for SearchTemplateGetScroll {
3014  fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
3015  where
3016    D: serde::Deserializer<'de>, {
3017    String::deserialize(deserializer)?
3018      .parse()
3019      .map_err(|e: &'static str| <D::Error as serde::de::Error>::custom(e.to_string()))
3020  }
3021}
3022
3023///Specify how long a consistent view of the index should be maintained for
3024/// scrolled search.
3025#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)]
3026pub struct SearchTemplateGetWithIndexScroll(String);
3027impl std::ops::Deref for SearchTemplateGetWithIndexScroll {
3028  type Target = String;
3029
3030  fn deref(&self) -> &String {
3031    &self.0
3032  }
3033}
3034
3035impl From<SearchTemplateGetWithIndexScroll> for String {
3036  fn from(value: SearchTemplateGetWithIndexScroll) -> Self {
3037    value.0
3038  }
3039}
3040
3041impl From<&SearchTemplateGetWithIndexScroll> for SearchTemplateGetWithIndexScroll {
3042  fn from(value: &SearchTemplateGetWithIndexScroll) -> Self {
3043    value.clone()
3044  }
3045}
3046
3047impl std::str::FromStr for SearchTemplateGetWithIndexScroll {
3048  type Err = &'static str;
3049
3050  fn from_str(value: &str) -> Result<Self, &'static str> {
3051    if regress::Regex::new("^([0-9]+)(?:d|h|m|s|ms|micros|nanos)$")
3052      .unwrap()
3053      .find(value)
3054      .is_none()
3055    {
3056      return Err("doesn't match pattern \"^([0-9]+)(?:d|h|m|s|ms|micros|nanos)$\"");
3057    }
3058    Ok(Self(value.to_string()))
3059  }
3060}
3061
3062impl std::convert::TryFrom<&str> for SearchTemplateGetWithIndexScroll {
3063  type Error = &'static str;
3064
3065  fn try_from(value: &str) -> Result<Self, &'static str> {
3066    value.parse()
3067  }
3068}
3069
3070impl std::convert::TryFrom<&String> for SearchTemplateGetWithIndexScroll {
3071  type Error = &'static str;
3072
3073  fn try_from(value: &String) -> Result<Self, &'static str> {
3074    value.parse()
3075  }
3076}
3077
3078impl std::convert::TryFrom<String> for SearchTemplateGetWithIndexScroll {
3079  type Error = &'static str;
3080
3081  fn try_from(value: String) -> Result<Self, &'static str> {
3082    value.parse()
3083  }
3084}
3085
3086impl<'de> serde::Deserialize<'de> for SearchTemplateGetWithIndexScroll {
3087  fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
3088  where
3089    D: serde::Deserializer<'de>, {
3090    String::deserialize(deserializer)?
3091      .parse()
3092      .map_err(|e: &'static str| <D::Error as serde::de::Error>::custom(e.to_string()))
3093  }
3094}
3095
3096///Specify how long a consistent view of the index should be maintained for
3097/// scrolled search.
3098#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)]
3099pub struct SearchTemplatePostScroll(String);
3100impl std::ops::Deref for SearchTemplatePostScroll {
3101  type Target = String;
3102
3103  fn deref(&self) -> &String {
3104    &self.0
3105  }
3106}
3107
3108impl From<SearchTemplatePostScroll> for String {
3109  fn from(value: SearchTemplatePostScroll) -> Self {
3110    value.0
3111  }
3112}
3113
3114impl From<&SearchTemplatePostScroll> for SearchTemplatePostScroll {
3115  fn from(value: &SearchTemplatePostScroll) -> Self {
3116    value.clone()
3117  }
3118}
3119
3120impl std::str::FromStr for SearchTemplatePostScroll {
3121  type Err = &'static str;
3122
3123  fn from_str(value: &str) -> Result<Self, &'static str> {
3124    if regress::Regex::new("^([0-9]+)(?:d|h|m|s|ms|micros|nanos)$")
3125      .unwrap()
3126      .find(value)
3127      .is_none()
3128    {
3129      return Err("doesn't match pattern \"^([0-9]+)(?:d|h|m|s|ms|micros|nanos)$\"");
3130    }
3131    Ok(Self(value.to_string()))
3132  }
3133}
3134
3135impl std::convert::TryFrom<&str> for SearchTemplatePostScroll {
3136  type Error = &'static str;
3137
3138  fn try_from(value: &str) -> Result<Self, &'static str> {
3139    value.parse()
3140  }
3141}
3142
3143impl std::convert::TryFrom<&String> for SearchTemplatePostScroll {
3144  type Error = &'static str;
3145
3146  fn try_from(value: &String) -> Result<Self, &'static str> {
3147    value.parse()
3148  }
3149}
3150
3151impl std::convert::TryFrom<String> for SearchTemplatePostScroll {
3152  type Error = &'static str;
3153
3154  fn try_from(value: String) -> Result<Self, &'static str> {
3155    value.parse()
3156  }
3157}
3158
3159impl<'de> serde::Deserialize<'de> for SearchTemplatePostScroll {
3160  fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
3161  where
3162    D: serde::Deserializer<'de>, {
3163    String::deserialize(deserializer)?
3164      .parse()
3165      .map_err(|e: &'static str| <D::Error as serde::de::Error>::custom(e.to_string()))
3166  }
3167}
3168
3169///Specify how long a consistent view of the index should be maintained for
3170/// scrolled search.
3171#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)]
3172pub struct SearchTemplatePostWithIndexScroll(String);
3173impl std::ops::Deref for SearchTemplatePostWithIndexScroll {
3174  type Target = String;
3175
3176  fn deref(&self) -> &String {
3177    &self.0
3178  }
3179}
3180
3181impl From<SearchTemplatePostWithIndexScroll> for String {
3182  fn from(value: SearchTemplatePostWithIndexScroll) -> Self {
3183    value.0
3184  }
3185}
3186
3187impl From<&SearchTemplatePostWithIndexScroll> for SearchTemplatePostWithIndexScroll {
3188  fn from(value: &SearchTemplatePostWithIndexScroll) -> Self {
3189    value.clone()
3190  }
3191}
3192
3193impl std::str::FromStr for SearchTemplatePostWithIndexScroll {
3194  type Err = &'static str;
3195
3196  fn from_str(value: &str) -> Result<Self, &'static str> {
3197    if regress::Regex::new("^([0-9]+)(?:d|h|m|s|ms|micros|nanos)$")
3198      .unwrap()
3199      .find(value)
3200      .is_none()
3201    {
3202      return Err("doesn't match pattern \"^([0-9]+)(?:d|h|m|s|ms|micros|nanos)$\"");
3203    }
3204    Ok(Self(value.to_string()))
3205  }
3206}
3207
3208impl std::convert::TryFrom<&str> for SearchTemplatePostWithIndexScroll {
3209  type Error = &'static str;
3210
3211  fn try_from(value: &str) -> Result<Self, &'static str> {
3212    value.parse()
3213  }
3214}
3215
3216impl std::convert::TryFrom<&String> for SearchTemplatePostWithIndexScroll {
3217  type Error = &'static str;
3218
3219  fn try_from(value: &String) -> Result<Self, &'static str> {
3220    value.parse()
3221  }
3222}
3223
3224impl std::convert::TryFrom<String> for SearchTemplatePostWithIndexScroll {
3225  type Error = &'static str;
3226
3227  fn try_from(value: String) -> Result<Self, &'static str> {
3228    value.parse()
3229  }
3230}
3231
3232impl<'de> serde::Deserialize<'de> for SearchTemplatePostWithIndexScroll {
3233  fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
3234  where
3235    D: serde::Deserializer<'de>, {
3236    String::deserialize(deserializer)?
3237      .parse()
3238      .map_err(|e: &'static str| <D::Error as serde::de::Error>::custom(e.to_string()))
3239  }
3240}
3241
3242///Search operation type.
3243#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)]
3244pub enum SearchType {
3245  #[serde(rename = "query_then_fetch")]
3246  QueryThenFetch,
3247  #[serde(rename = "dfs_query_then_fetch")]
3248  DfsQueryThenFetch,
3249}
3250
3251impl From<&SearchType> for SearchType {
3252  fn from(value: &SearchType) -> Self {
3253    value.clone()
3254  }
3255}
3256
3257impl ToString for SearchType {
3258  fn to_string(&self) -> String {
3259    match *self {
3260      Self::QueryThenFetch => "query_then_fetch".to_string(),
3261      Self::DfsQueryThenFetch => "dfs_query_then_fetch".to_string(),
3262    }
3263  }
3264}
3265
3266impl std::str::FromStr for SearchType {
3267  type Err = &'static str;
3268
3269  fn from_str(value: &str) -> Result<Self, &'static str> {
3270    match value {
3271      "query_then_fetch" => Ok(Self::QueryThenFetch),
3272      "dfs_query_then_fetch" => Ok(Self::DfsQueryThenFetch),
3273      _ => Err("invalid value"),
3274    }
3275  }
3276}
3277
3278impl std::convert::TryFrom<&str> for SearchType {
3279  type Error = &'static str;
3280
3281  fn try_from(value: &str) -> Result<Self, &'static str> {
3282    value.parse()
3283  }
3284}
3285
3286impl std::convert::TryFrom<&String> for SearchType {
3287  type Error = &'static str;
3288
3289  fn try_from(value: &String) -> Result<Self, &'static str> {
3290    value.parse()
3291  }
3292}
3293
3294impl std::convert::TryFrom<String> for SearchType {
3295  type Error = &'static str;
3296
3297  fn try_from(value: String) -> Result<Self, &'static str> {
3298    value.parse()
3299  }
3300}
3301
3302///Search operation type.
3303#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)]
3304pub enum SearchTypeMulti {
3305  #[serde(rename = "query_then_fetch")]
3306  QueryThenFetch,
3307  #[serde(rename = "query_and_fetch")]
3308  QueryAndFetch,
3309  #[serde(rename = "dfs_query_then_fetch")]
3310  DfsQueryThenFetch,
3311  #[serde(rename = "dfs_query_and_fetch")]
3312  DfsQueryAndFetch,
3313}
3314
3315impl From<&SearchTypeMulti> for SearchTypeMulti {
3316  fn from(value: &SearchTypeMulti) -> Self {
3317    value.clone()
3318  }
3319}
3320
3321impl ToString for SearchTypeMulti {
3322  fn to_string(&self) -> String {
3323    match *self {
3324      Self::QueryThenFetch => "query_then_fetch".to_string(),
3325      Self::QueryAndFetch => "query_and_fetch".to_string(),
3326      Self::DfsQueryThenFetch => "dfs_query_then_fetch".to_string(),
3327      Self::DfsQueryAndFetch => "dfs_query_and_fetch".to_string(),
3328    }
3329  }
3330}
3331
3332impl std::str::FromStr for SearchTypeMulti {
3333  type Err = &'static str;
3334
3335  fn from_str(value: &str) -> Result<Self, &'static str> {
3336    match value {
3337      "query_then_fetch" => Ok(Self::QueryThenFetch),
3338      "query_and_fetch" => Ok(Self::QueryAndFetch),
3339      "dfs_query_then_fetch" => Ok(Self::DfsQueryThenFetch),
3340      "dfs_query_and_fetch" => Ok(Self::DfsQueryAndFetch),
3341      _ => Err("invalid value"),
3342    }
3343  }
3344}
3345
3346impl std::convert::TryFrom<&str> for SearchTypeMulti {
3347  type Error = &'static str;
3348
3349  fn try_from(value: &str) -> Result<Self, &'static str> {
3350    value.parse()
3351  }
3352}
3353
3354impl std::convert::TryFrom<&String> for SearchTypeMulti {
3355  type Error = &'static str;
3356
3357  fn try_from(value: &String) -> Result<Self, &'static str> {
3358    value.parse()
3359  }
3360}
3361
3362impl std::convert::TryFrom<String> for SearchTypeMulti {
3363  type Error = &'static str;
3364
3365  fn try_from(value: String) -> Result<Self, &'static str> {
3366    value.parse()
3367  }
3368}
3369
3370#[derive(Clone, Debug, Deserialize, Serialize, PartialEq)]
3371pub struct ShardStatistics {
3372  #[serde(default, skip_serializing_if = "Option::is_none")]
3373  pub failed: Option<i32>,
3374  #[serde(default, skip_serializing_if = "Option::is_none")]
3375  pub skipped: Option<i32>,
3376  #[serde(default, skip_serializing_if = "Option::is_none")]
3377  pub successful: Option<i32>,
3378  #[serde(default, skip_serializing_if = "Option::is_none")]
3379  pub total: Option<i32>,
3380}
3381
3382impl From<&ShardStatistics> for ShardStatistics {
3383  fn from(value: &ShardStatistics) -> Self {
3384    value.clone()
3385  }
3386}
3387
3388impl ShardStatistics {
3389  pub fn builder() -> builder::ShardStatistics {
3390    builder::ShardStatistics::default()
3391  }
3392}
3393
3394#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)]
3395pub enum StatusMember {
3396  #[serde(rename = "green")]
3397  Green,
3398  #[serde(rename = "yellow")]
3399  Yellow,
3400  #[serde(rename = "red")]
3401  Red,
3402  #[serde(rename = "all")]
3403  All,
3404}
3405
3406impl From<&StatusMember> for StatusMember {
3407  fn from(value: &StatusMember) -> Self {
3408    value.clone()
3409  }
3410}
3411
3412impl ToString for StatusMember {
3413  fn to_string(&self) -> String {
3414    match *self {
3415      Self::Green => "green".to_string(),
3416      Self::Yellow => "yellow".to_string(),
3417      Self::Red => "red".to_string(),
3418      Self::All => "all".to_string(),
3419    }
3420  }
3421}
3422
3423impl std::str::FromStr for StatusMember {
3424  type Err = &'static str;
3425
3426  fn from_str(value: &str) -> Result<Self, &'static str> {
3427    match value {
3428      "green" => Ok(Self::Green),
3429      "yellow" => Ok(Self::Yellow),
3430      "red" => Ok(Self::Red),
3431      "all" => Ok(Self::All),
3432      _ => Err("invalid value"),
3433    }
3434  }
3435}
3436
3437impl std::convert::TryFrom<&str> for StatusMember {
3438  type Error = &'static str;
3439
3440  fn try_from(value: &str) -> Result<Self, &'static str> {
3441    value.parse()
3442  }
3443}
3444
3445impl std::convert::TryFrom<&String> for StatusMember {
3446  type Error = &'static str;
3447
3448  fn try_from(value: &String) -> Result<Self, &'static str> {
3449    value.parse()
3450  }
3451}
3452
3453impl std::convert::TryFrom<String> for StatusMember {
3454  type Error = &'static str;
3455
3456  fn try_from(value: String) -> Result<Self, &'static str> {
3457    value.parse()
3458  }
3459}
3460
3461///Specify suggest mode.
3462#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)]
3463pub enum SuggestMode {
3464  #[serde(rename = "missing")]
3465  Missing,
3466  #[serde(rename = "popular")]
3467  Popular,
3468  #[serde(rename = "always")]
3469  Always,
3470}
3471
3472impl From<&SuggestMode> for SuggestMode {
3473  fn from(value: &SuggestMode) -> Self {
3474    value.clone()
3475  }
3476}
3477
3478impl ToString for SuggestMode {
3479  fn to_string(&self) -> String {
3480    match *self {
3481      Self::Missing => "missing".to_string(),
3482      Self::Popular => "popular".to_string(),
3483      Self::Always => "always".to_string(),
3484    }
3485  }
3486}
3487
3488impl std::str::FromStr for SuggestMode {
3489  type Err = &'static str;
3490
3491  fn from_str(value: &str) -> Result<Self, &'static str> {
3492    match value {
3493      "missing" => Ok(Self::Missing),
3494      "popular" => Ok(Self::Popular),
3495      "always" => Ok(Self::Always),
3496      _ => Err("invalid value"),
3497    }
3498  }
3499}
3500
3501impl std::convert::TryFrom<&str> for SuggestMode {
3502  type Error = &'static str;
3503
3504  fn try_from(value: &str) -> Result<Self, &'static str> {
3505    value.parse()
3506  }
3507}
3508
3509impl std::convert::TryFrom<&String> for SuggestMode {
3510  type Error = &'static str;
3511
3512  fn try_from(value: &String) -> Result<Self, &'static str> {
3513    value.parse()
3514  }
3515}
3516
3517impl std::convert::TryFrom<String> for SuggestMode {
3518  type Error = &'static str;
3519
3520  fn try_from(value: String) -> Result<Self, &'static str> {
3521    value.parse()
3522  }
3523}
3524
3525///Define parameters and or supply a document to get termvectors for. See
3526/// documentation.
3527#[derive(Clone, Debug, Deserialize, Serialize)]
3528pub struct TermvectorsBodyParams(pub serde_json::Map<String, serde_json::Value>);
3529impl std::ops::Deref for TermvectorsBodyParams {
3530  type Target = serde_json::Map<String, serde_json::Value>;
3531
3532  fn deref(&self) -> &serde_json::Map<String, serde_json::Value> {
3533    &self.0
3534  }
3535}
3536
3537impl From<TermvectorsBodyParams> for serde_json::Map<String, serde_json::Value> {
3538  fn from(value: TermvectorsBodyParams) -> Self {
3539    value.0
3540  }
3541}
3542
3543impl From<&TermvectorsBodyParams> for TermvectorsBodyParams {
3544  fn from(value: &TermvectorsBodyParams) -> Self {
3545    value.clone()
3546  }
3547}
3548
3549impl From<serde_json::Map<String, serde_json::Value>> for TermvectorsBodyParams {
3550  fn from(value: serde_json::Map<String, serde_json::Value>) -> Self {
3551    Self(value)
3552  }
3553}
3554
3555///The unit in which to display time values.
3556#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)]
3557pub enum Time {
3558  #[serde(rename = "d")]
3559  D,
3560  #[serde(rename = "h")]
3561  H,
3562  #[serde(rename = "m")]
3563  M,
3564  #[serde(rename = "s")]
3565  S,
3566  #[serde(rename = "ms")]
3567  Ms,
3568  #[serde(rename = "micros")]
3569  Micros,
3570  #[serde(rename = "nanos")]
3571  Nanos,
3572}
3573
3574impl From<&Time> for Time {
3575  fn from(value: &Time) -> Self {
3576    value.clone()
3577  }
3578}
3579
3580impl ToString for Time {
3581  fn to_string(&self) -> String {
3582    match *self {
3583      Self::D => "d".to_string(),
3584      Self::H => "h".to_string(),
3585      Self::M => "m".to_string(),
3586      Self::S => "s".to_string(),
3587      Self::Ms => "ms".to_string(),
3588      Self::Micros => "micros".to_string(),
3589      Self::Nanos => "nanos".to_string(),
3590    }
3591  }
3592}
3593
3594impl std::str::FromStr for Time {
3595  type Err = &'static str;
3596
3597  fn from_str(value: &str) -> Result<Self, &'static str> {
3598    match value {
3599      "d" => Ok(Self::D),
3600      "h" => Ok(Self::H),
3601      "m" => Ok(Self::M),
3602      "s" => Ok(Self::S),
3603      "ms" => Ok(Self::Ms),
3604      "micros" => Ok(Self::Micros),
3605      "nanos" => Ok(Self::Nanos),
3606      _ => Err("invalid value"),
3607    }
3608  }
3609}
3610
3611impl std::convert::TryFrom<&str> for Time {
3612  type Error = &'static str;
3613
3614  fn try_from(value: &str) -> Result<Self, &'static str> {
3615    value.parse()
3616  }
3617}
3618
3619impl std::convert::TryFrom<&String> for Time {
3620  type Error = &'static str;
3621
3622  fn try_from(value: &String) -> Result<Self, &'static str> {
3623    value.parse()
3624  }
3625}
3626
3627impl std::convert::TryFrom<String> for Time {
3628  type Error = &'static str;
3629
3630  fn try_from(value: String) -> Result<Self, &'static str> {
3631    value.parse()
3632  }
3633}
3634
3635#[derive(Clone, Debug, Deserialize, Serialize)]
3636pub struct Total {
3637  #[serde(default, skip_serializing_if = "Option::is_none")]
3638  pub relation: Option<Relation>,
3639  #[serde(default, skip_serializing_if = "Option::is_none")]
3640  pub value: Option<i32>,
3641}
3642
3643impl From<&Total> for Total {
3644  fn from(value: &Total) -> Self {
3645    value.clone()
3646  }
3647}
3648
3649impl Total {
3650  pub fn builder() -> builder::Total {
3651    builder::Total::default()
3652  }
3653}
3654
3655///The request definition requires either `script` or partial `doc`
3656#[derive(Clone, Debug, Deserialize, Serialize)]
3657pub struct UpdateBodyParams(pub serde_json::Value);
3658impl std::ops::Deref for UpdateBodyParams {
3659  type Target = serde_json::Value;
3660
3661  fn deref(&self) -> &serde_json::Value {
3662    &self.0
3663  }
3664}
3665
3666impl From<UpdateBodyParams> for serde_json::Value {
3667  fn from(value: UpdateBodyParams) -> Self {
3668    value.0
3669  }
3670}
3671
3672impl From<&UpdateBodyParams> for UpdateBodyParams {
3673  fn from(value: &UpdateBodyParams) -> Self {
3674    value.clone()
3675  }
3676}
3677
3678impl From<serde_json::Value> for UpdateBodyParams {
3679  fn from(value: serde_json::Value) -> Self {
3680    Self(value)
3681  }
3682}
3683
3684///The search definition using the Query DSL
3685#[derive(Clone, Debug, Deserialize, Serialize)]
3686pub struct UpdateByQueryBodyParams(pub serde_json::Map<String, serde_json::Value>);
3687impl std::ops::Deref for UpdateByQueryBodyParams {
3688  type Target = serde_json::Map<String, serde_json::Value>;
3689
3690  fn deref(&self) -> &serde_json::Map<String, serde_json::Value> {
3691    &self.0
3692  }
3693}
3694
3695impl From<UpdateByQueryBodyParams> for serde_json::Map<String, serde_json::Value> {
3696  fn from(value: UpdateByQueryBodyParams) -> Self {
3697    value.0
3698  }
3699}
3700
3701impl From<&UpdateByQueryBodyParams> for UpdateByQueryBodyParams {
3702  fn from(value: &UpdateByQueryBodyParams) -> Self {
3703    value.clone()
3704  }
3705}
3706
3707impl From<serde_json::Map<String, serde_json::Value>> for UpdateByQueryBodyParams {
3708  fn from(value: serde_json::Map<String, serde_json::Value>) -> Self {
3709    Self(value)
3710  }
3711}
3712
3713///Specify how long a consistent view of the index should be maintained for
3714/// scrolled search.
3715#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)]
3716pub struct UpdateByQueryScroll(String);
3717impl std::ops::Deref for UpdateByQueryScroll {
3718  type Target = String;
3719
3720  fn deref(&self) -> &String {
3721    &self.0
3722  }
3723}
3724
3725impl From<UpdateByQueryScroll> for String {
3726  fn from(value: UpdateByQueryScroll) -> Self {
3727    value.0
3728  }
3729}
3730
3731impl From<&UpdateByQueryScroll> for UpdateByQueryScroll {
3732  fn from(value: &UpdateByQueryScroll) -> Self {
3733    value.clone()
3734  }
3735}
3736
3737impl std::str::FromStr for UpdateByQueryScroll {
3738  type Err = &'static str;
3739
3740  fn from_str(value: &str) -> Result<Self, &'static str> {
3741    if regress::Regex::new("^([0-9]+)(?:d|h|m|s|ms|micros|nanos)$")
3742      .unwrap()
3743      .find(value)
3744      .is_none()
3745    {
3746      return Err("doesn't match pattern \"^([0-9]+)(?:d|h|m|s|ms|micros|nanos)$\"");
3747    }
3748    Ok(Self(value.to_string()))
3749  }
3750}
3751
3752impl std::convert::TryFrom<&str> for UpdateByQueryScroll {
3753  type Error = &'static str;
3754
3755  fn try_from(value: &str) -> Result<Self, &'static str> {
3756    value.parse()
3757  }
3758}
3759
3760impl std::convert::TryFrom<&String> for UpdateByQueryScroll {
3761  type Error = &'static str;
3762
3763  fn try_from(value: &String) -> Result<Self, &'static str> {
3764    value.parse()
3765  }
3766}
3767
3768impl std::convert::TryFrom<String> for UpdateByQueryScroll {
3769  type Error = &'static str;
3770
3771  fn try_from(value: String) -> Result<Self, &'static str> {
3772    value.parse()
3773  }
3774}
3775
3776impl<'de> serde::Deserialize<'de> for UpdateByQueryScroll {
3777  fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
3778  where
3779    D: serde::Deserializer<'de>, {
3780    String::deserialize(deserializer)?
3781      .parse()
3782      .map_err(|e: &'static str| <D::Error as serde::de::Error>::custom(e.to_string()))
3783  }
3784}
3785
3786#[derive(Clone, Debug, Deserialize, Serialize)]
3787pub struct UserDefinedObjectStructure {
3788  #[serde(default, skip_serializing_if = "Option::is_none")]
3789  pub bool: Option<serde_json::Value>,
3790  #[serde(default, skip_serializing_if = "Option::is_none")]
3791  pub boosting: Option<serde_json::Value>,
3792  #[serde(default, skip_serializing_if = "Option::is_none")]
3793  pub combined_fields: Option<serde_json::Value>,
3794  #[serde(default, skip_serializing_if = "Option::is_none")]
3795  pub constant_score: Option<serde_json::Value>,
3796  #[serde(default, skip_serializing_if = "Option::is_none")]
3797  pub dis_max: Option<serde_json::Value>,
3798  #[serde(default, skip_serializing_if = "Option::is_none")]
3799  pub distance_feature: Option<serde_json::Value>,
3800  #[serde(default, skip_serializing_if = "Option::is_none")]
3801  pub exists: Option<serde_json::Value>,
3802  #[serde(default, skip_serializing_if = "Option::is_none")]
3803  pub field_masking_span: Option<serde_json::Value>,
3804  #[serde(default, skip_serializing_if = "Option::is_none")]
3805  pub function_score: Option<serde_json::Value>,
3806  #[serde(default, skip_serializing_if = "Option::is_none")]
3807  pub fuzzy: Option<UserDefinedValueMap>,
3808  #[serde(default, skip_serializing_if = "Option::is_none")]
3809  pub geo_bounding_box: Option<serde_json::Value>,
3810  #[serde(default, skip_serializing_if = "Option::is_none")]
3811  pub geo_distance: Option<serde_json::Value>,
3812  #[serde(default, skip_serializing_if = "Option::is_none")]
3813  pub geo_polygon: Option<serde_json::Value>,
3814  #[serde(default, skip_serializing_if = "Option::is_none")]
3815  pub geo_shape: Option<serde_json::Value>,
3816  #[serde(default, skip_serializing_if = "Option::is_none")]
3817  pub has_child: Option<serde_json::Value>,
3818  #[serde(default, skip_serializing_if = "Option::is_none")]
3819  pub has_parent: Option<serde_json::Value>,
3820  #[serde(default, skip_serializing_if = "Option::is_none")]
3821  pub ids: Option<serde_json::Value>,
3822  #[serde(default, skip_serializing_if = "Option::is_none")]
3823  pub intervals: Option<UserDefinedValueMap>,
3824  #[serde(default, skip_serializing_if = "Option::is_none")]
3825  pub knn: Option<serde_json::Value>,
3826  #[serde(rename = "match", default, skip_serializing_if = "Option::is_none")]
3827  pub match_: Option<UserDefinedValueMap>,
3828  #[serde(default, skip_serializing_if = "Option::is_none")]
3829  pub match_all: Option<serde_json::Value>,
3830  #[serde(default, skip_serializing_if = "Option::is_none")]
3831  pub match_bool_prefix: Option<UserDefinedValueMap>,
3832  #[serde(default, skip_serializing_if = "Option::is_none")]
3833  pub match_none: Option<serde_json::Value>,
3834  #[serde(default, skip_serializing_if = "Option::is_none")]
3835  pub match_phrase: Option<UserDefinedValueMap>,
3836  #[serde(default, skip_serializing_if = "Option::is_none")]
3837  pub match_phrase_prefix: Option<UserDefinedValueMap>,
3838  #[serde(default, skip_serializing_if = "Option::is_none")]
3839  pub more_like_this: Option<serde_json::Value>,
3840  #[serde(default, skip_serializing_if = "Option::is_none")]
3841  pub multi_match: Option<serde_json::Value>,
3842  #[serde(default, skip_serializing_if = "Option::is_none")]
3843  pub nested: Option<serde_json::Value>,
3844  #[serde(default, skip_serializing_if = "Option::is_none")]
3845  pub parent_id: Option<serde_json::Value>,
3846  #[serde(default, skip_serializing_if = "Option::is_none")]
3847  pub percolate: Option<serde_json::Value>,
3848  #[serde(default, skip_serializing_if = "Option::is_none")]
3849  pub pinned: Option<serde_json::Value>,
3850  #[serde(default, skip_serializing_if = "Option::is_none")]
3851  pub prefix: Option<UserDefinedValueMap>,
3852  #[serde(default, skip_serializing_if = "Option::is_none")]
3853  pub query_string: Option<serde_json::Value>,
3854  #[serde(default, skip_serializing_if = "Option::is_none")]
3855  pub range: Option<UserDefinedValueMap>,
3856  #[serde(default, skip_serializing_if = "Option::is_none")]
3857  pub rank_feature: Option<serde_json::Value>,
3858  #[serde(default, skip_serializing_if = "Option::is_none")]
3859  pub regexp: Option<UserDefinedValueMap>,
3860  #[serde(default, skip_serializing_if = "Option::is_none")]
3861  pub script: Option<serde_json::Value>,
3862  #[serde(default, skip_serializing_if = "Option::is_none")]
3863  pub script_score: Option<serde_json::Value>,
3864  #[serde(default, skip_serializing_if = "Option::is_none")]
3865  pub shape: Option<serde_json::Value>,
3866  #[serde(default, skip_serializing_if = "Option::is_none")]
3867  pub simple_query_string: Option<serde_json::Value>,
3868  #[serde(default, skip_serializing_if = "Option::is_none")]
3869  pub span_containing: Option<serde_json::Value>,
3870  #[serde(default, skip_serializing_if = "Option::is_none")]
3871  pub span_first: Option<serde_json::Value>,
3872  #[serde(default, skip_serializing_if = "Option::is_none")]
3873  pub span_multi: Option<serde_json::Value>,
3874  #[serde(default, skip_serializing_if = "Option::is_none")]
3875  pub span_near: Option<serde_json::Value>,
3876  #[serde(default, skip_serializing_if = "Option::is_none")]
3877  pub span_not: Option<serde_json::Value>,
3878  #[serde(default, skip_serializing_if = "Option::is_none")]
3879  pub span_or: Option<serde_json::Value>,
3880  #[serde(default, skip_serializing_if = "Option::is_none")]
3881  pub span_term: Option<UserDefinedValueMap>,
3882  #[serde(default, skip_serializing_if = "Option::is_none")]
3883  pub span_within: Option<serde_json::Value>,
3884  #[serde(default, skip_serializing_if = "Option::is_none")]
3885  pub term: Option<UserDefinedValueMap>,
3886  #[serde(default, skip_serializing_if = "Option::is_none")]
3887  pub terms: Option<serde_json::Value>,
3888  #[serde(default, skip_serializing_if = "Option::is_none")]
3889  pub terms_set: Option<UserDefinedValueMap>,
3890  #[serde(default, skip_serializing_if = "Option::is_none")]
3891  pub wildcard: Option<UserDefinedValueMap>,
3892  #[serde(default, skip_serializing_if = "Option::is_none")]
3893  pub wrapper: Option<serde_json::Value>,
3894}
3895
3896impl From<&UserDefinedObjectStructure> for UserDefinedObjectStructure {
3897  fn from(value: &UserDefinedObjectStructure) -> Self {
3898    value.clone()
3899  }
3900}
3901
3902impl UserDefinedObjectStructure {
3903  pub fn builder() -> builder::UserDefinedObjectStructure {
3904    builder::UserDefinedObjectStructure::default()
3905  }
3906}
3907
3908#[derive(Clone, Debug, Deserialize, Serialize)]
3909pub struct UserDefinedStructure {
3910  #[serde(default, skip_serializing_if = "Option::is_none")]
3911  pub alias: Option<String>,
3912  #[serde(default, skip_serializing_if = "Vec::is_empty")]
3913  pub aliases: Vec<String>,
3914  #[serde(default, skip_serializing_if = "Option::is_none")]
3915  pub filter: Option<serde_json::Value>,
3916  #[serde(default, skip_serializing_if = "Option::is_none")]
3917  pub index: Option<String>,
3918  #[serde(default, skip_serializing_if = "Option::is_none")]
3919  pub index_routing: Option<String>,
3920  #[serde(default, skip_serializing_if = "Vec::is_empty")]
3921  pub indices: Vec<String>,
3922  #[serde(default, skip_serializing_if = "Option::is_none")]
3923  pub is_hidden: Option<bool>,
3924  #[serde(default, skip_serializing_if = "Option::is_none")]
3925  pub is_write_index: Option<bool>,
3926  #[serde(default, skip_serializing_if = "Option::is_none")]
3927  pub must_exist: Option<String>,
3928  #[serde(default, skip_serializing_if = "Option::is_none")]
3929  pub routing: Option<String>,
3930  #[serde(default, skip_serializing_if = "Option::is_none")]
3931  pub search_routing: Option<String>,
3932}
3933
3934impl From<&UserDefinedStructure> for UserDefinedStructure {
3935  fn from(value: &UserDefinedStructure) -> Self {
3936    value.clone()
3937  }
3938}
3939
3940impl UserDefinedStructure {
3941  pub fn builder() -> builder::UserDefinedStructure {
3942    builder::UserDefinedStructure::default()
3943  }
3944}
3945
3946#[derive(Clone, Debug, Deserialize, Serialize)]
3947pub struct UserDefinedValueMap(pub serde_json::Map<String, serde_json::Value>);
3948impl std::ops::Deref for UserDefinedValueMap {
3949  type Target = serde_json::Map<String, serde_json::Value>;
3950
3951  fn deref(&self) -> &serde_json::Map<String, serde_json::Value> {
3952    &self.0
3953  }
3954}
3955
3956impl From<UserDefinedValueMap> for serde_json::Map<String, serde_json::Value> {
3957  fn from(value: UserDefinedValueMap) -> Self {
3958    value.0
3959  }
3960}
3961
3962impl From<&UserDefinedValueMap> for UserDefinedValueMap {
3963  fn from(value: &UserDefinedValueMap) -> Self {
3964    value.clone()
3965  }
3966}
3967
3968impl From<serde_json::Map<String, serde_json::Value>> for UserDefinedValueMap {
3969  fn from(value: serde_json::Map<String, serde_json::Value>) -> Self {
3970    Self(value)
3971  }
3972}
3973
3974///Specific version type.
3975#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)]
3976pub enum VersionType {
3977  #[serde(rename = "internal")]
3978  Internal,
3979  #[serde(rename = "external")]
3980  External,
3981  #[serde(rename = "external_gte")]
3982  ExternalGte,
3983  #[serde(rename = "force")]
3984  Force,
3985}
3986
3987impl From<&VersionType> for VersionType {
3988  fn from(value: &VersionType) -> Self {
3989    value.clone()
3990  }
3991}
3992
3993impl ToString for VersionType {
3994  fn to_string(&self) -> String {
3995    match *self {
3996      Self::Internal => "internal".to_string(),
3997      Self::External => "external".to_string(),
3998      Self::ExternalGte => "external_gte".to_string(),
3999      Self::Force => "force".to_string(),
4000    }
4001  }
4002}
4003
4004impl std::str::FromStr for VersionType {
4005  type Err = &'static str;
4006
4007  fn from_str(value: &str) -> Result<Self, &'static str> {
4008    match value {
4009      "internal" => Ok(Self::Internal),
4010      "external" => Ok(Self::External),
4011      "external_gte" => Ok(Self::ExternalGte),
4012      "force" => Ok(Self::Force),
4013      _ => Err("invalid value"),
4014    }
4015  }
4016}
4017
4018impl std::convert::TryFrom<&str> for VersionType {
4019  type Error = &'static str;
4020
4021  fn try_from(value: &str) -> Result<Self, &'static str> {
4022    value.parse()
4023  }
4024}
4025
4026impl std::convert::TryFrom<&String> for VersionType {
4027  type Error = &'static str;
4028
4029  fn try_from(value: &String) -> Result<Self, &'static str> {
4030    value.parse()
4031  }
4032}
4033
4034impl std::convert::TryFrom<String> for VersionType {
4035  type Error = &'static str;
4036
4037  fn try_from(value: String) -> Result<Self, &'static str> {
4038    value.parse()
4039  }
4040}
4041
4042///Wait until all currently queued events with the given priority are
4043/// processed.
4044#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)]
4045pub enum WaitForEvents {
4046  #[serde(rename = "immediate")]
4047  Immediate,
4048  #[serde(rename = "urgent")]
4049  Urgent,
4050  #[serde(rename = "high")]
4051  High,
4052  #[serde(rename = "normal")]
4053  Normal,
4054  #[serde(rename = "low")]
4055  Low,
4056  #[serde(rename = "languid")]
4057  Languid,
4058}
4059
4060impl From<&WaitForEvents> for WaitForEvents {
4061  fn from(value: &WaitForEvents) -> Self {
4062    value.clone()
4063  }
4064}
4065
4066impl ToString for WaitForEvents {
4067  fn to_string(&self) -> String {
4068    match *self {
4069      Self::Immediate => "immediate".to_string(),
4070      Self::Urgent => "urgent".to_string(),
4071      Self::High => "high".to_string(),
4072      Self::Normal => "normal".to_string(),
4073      Self::Low => "low".to_string(),
4074      Self::Languid => "languid".to_string(),
4075    }
4076  }
4077}
4078
4079impl std::str::FromStr for WaitForEvents {
4080  type Err = &'static str;
4081
4082  fn from_str(value: &str) -> Result<Self, &'static str> {
4083    match value {
4084      "immediate" => Ok(Self::Immediate),
4085      "urgent" => Ok(Self::Urgent),
4086      "high" => Ok(Self::High),
4087      "normal" => Ok(Self::Normal),
4088      "low" => Ok(Self::Low),
4089      "languid" => Ok(Self::Languid),
4090      _ => Err("invalid value"),
4091    }
4092  }
4093}
4094
4095impl std::convert::TryFrom<&str> for WaitForEvents {
4096  type Error = &'static str;
4097
4098  fn try_from(value: &str) -> Result<Self, &'static str> {
4099    value.parse()
4100  }
4101}
4102
4103impl std::convert::TryFrom<&String> for WaitForEvents {
4104  type Error = &'static str;
4105
4106  fn try_from(value: &String) -> Result<Self, &'static str> {
4107    value.parse()
4108  }
4109}
4110
4111impl std::convert::TryFrom<String> for WaitForEvents {
4112  type Error = &'static str;
4113
4114  fn try_from(value: String) -> Result<Self, &'static str> {
4115    value.parse()
4116  }
4117}
4118
4119///Wait until cluster is in a specific state.
4120#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)]
4121pub enum WaitForStatus {
4122  #[serde(rename = "green")]
4123  Green,
4124  #[serde(rename = "yellow")]
4125  Yellow,
4126  #[serde(rename = "red")]
4127  Red,
4128}
4129
4130impl From<&WaitForStatus> for WaitForStatus {
4131  fn from(value: &WaitForStatus) -> Self {
4132    value.clone()
4133  }
4134}
4135
4136impl ToString for WaitForStatus {
4137  fn to_string(&self) -> String {
4138    match *self {
4139      Self::Green => "green".to_string(),
4140      Self::Yellow => "yellow".to_string(),
4141      Self::Red => "red".to_string(),
4142    }
4143  }
4144}
4145
4146impl std::str::FromStr for WaitForStatus {
4147  type Err = &'static str;
4148
4149  fn from_str(value: &str) -> Result<Self, &'static str> {
4150    match value {
4151      "green" => Ok(Self::Green),
4152      "yellow" => Ok(Self::Yellow),
4153      "red" => Ok(Self::Red),
4154      _ => Err("invalid value"),
4155    }
4156  }
4157}
4158
4159impl std::convert::TryFrom<&str> for WaitForStatus {
4160  type Error = &'static str;
4161
4162  fn try_from(value: &str) -> Result<Self, &'static str> {
4163    value.parse()
4164  }
4165}
4166
4167impl std::convert::TryFrom<&String> for WaitForStatus {
4168  type Error = &'static str;
4169
4170  fn try_from(value: &String) -> Result<Self, &'static str> {
4171    value.parse()
4172  }
4173}
4174
4175impl std::convert::TryFrom<String> for WaitForStatus {
4176  type Error = &'static str;
4177
4178  fn try_from(value: String) -> Result<Self, &'static str> {
4179    value.parse()
4180  }
4181}
4182
4183pub mod builder {
4184  use super::Aggregations;
4185
4186  #[derive(Clone, Debug)]
4187  pub struct CreatePitResponseContent {
4188    creation_time: Result<Option<i64>, String>,
4189    pit_id: Result<Option<String>, String>,
4190    shard: Result<Option<super::ShardStatistics>, String>,
4191  }
4192
4193  impl Default for CreatePitResponseContent {
4194    fn default() -> Self {
4195      Self {
4196        creation_time: Ok(Default::default()),
4197        pit_id: Ok(Default::default()),
4198        shard: Ok(Default::default()),
4199      }
4200    }
4201  }
4202
4203  impl CreatePitResponseContent {
4204    pub fn creation_time<T>(mut self, value: T) -> Self
4205    where
4206      T: std::convert::TryInto<Option<i64>>,
4207      T::Error: std::fmt::Display, {
4208      self.creation_time = value
4209        .try_into()
4210        .map_err(|e| format!("error converting supplied value for creation_time: {}", e));
4211      self
4212    }
4213
4214    pub fn pit_id<T>(mut self, value: T) -> Self
4215    where
4216      T: std::convert::TryInto<Option<String>>,
4217      T::Error: std::fmt::Display, {
4218      self.pit_id = value
4219        .try_into()
4220        .map_err(|e| format!("error converting supplied value for pit_id: {}", e));
4221      self
4222    }
4223
4224    pub fn shard<T>(mut self, value: T) -> Self
4225    where
4226      T: std::convert::TryInto<Option<super::ShardStatistics>>,
4227      T::Error: std::fmt::Display, {
4228      self.shard = value
4229        .try_into()
4230        .map_err(|e| format!("error converting supplied value for shard: {}", e));
4231      self
4232    }
4233  }
4234
4235  impl std::convert::TryFrom<CreatePitResponseContent> for super::CreatePitResponseContent {
4236    type Error = String;
4237
4238    fn try_from(value: CreatePitResponseContent) -> Result<Self, String> {
4239      Ok(Self {
4240        creation_time: value.creation_time?,
4241        pit_id: value.pit_id?,
4242        shard: value.shard?,
4243      })
4244    }
4245  }
4246
4247  impl From<super::CreatePitResponseContent> for CreatePitResponseContent {
4248    fn from(value: super::CreatePitResponseContent) -> Self {
4249      Self {
4250        creation_time: Ok(value.creation_time),
4251        pit_id: Ok(value.pit_id),
4252        shard: Ok(value.shard),
4253      }
4254    }
4255  }
4256
4257  #[derive(Clone, Debug)]
4258  pub struct DataStream {
4259    generation: Result<Option<i64>, String>,
4260    indices: Result<Vec<super::DataStreamIndex>, String>,
4261    name: Result<Option<String>, String>,
4262    status: Result<Option<super::DataStreamStatus>, String>,
4263    template: Result<Option<String>, String>,
4264    timestamp_field: Result<Option<super::DataStreamTimestampField>, String>,
4265  }
4266
4267  impl Default for DataStream {
4268    fn default() -> Self {
4269      Self {
4270        generation: Ok(Default::default()),
4271        indices: Ok(Default::default()),
4272        name: Ok(Default::default()),
4273        status: Ok(Default::default()),
4274        template: Ok(Default::default()),
4275        timestamp_field: Ok(Default::default()),
4276      }
4277    }
4278  }
4279
4280  impl DataStream {
4281    pub fn generation<T>(mut self, value: T) -> Self
4282    where
4283      T: std::convert::TryInto<Option<i64>>,
4284      T::Error: std::fmt::Display, {
4285      self.generation = value
4286        .try_into()
4287        .map_err(|e| format!("error converting supplied value for generation: {}", e));
4288      self
4289    }
4290
4291    pub fn indices<T>(mut self, value: T) -> Self
4292    where
4293      T: std::convert::TryInto<Vec<super::DataStreamIndex>>,
4294      T::Error: std::fmt::Display, {
4295      self.indices = value
4296        .try_into()
4297        .map_err(|e| format!("error converting supplied value for indices: {}", e));
4298      self
4299    }
4300
4301    pub fn name<T>(mut self, value: T) -> Self
4302    where
4303      T: std::convert::TryInto<Option<String>>,
4304      T::Error: std::fmt::Display, {
4305      self.name = value
4306        .try_into()
4307        .map_err(|e| format!("error converting supplied value for name: {}", e));
4308      self
4309    }
4310
4311    pub fn status<T>(mut self, value: T) -> Self
4312    where
4313      T: std::convert::TryInto<Option<super::DataStreamStatus>>,
4314      T::Error: std::fmt::Display, {
4315      self.status = value
4316        .try_into()
4317        .map_err(|e| format!("error converting supplied value for status: {}", e));
4318      self
4319    }
4320
4321    pub fn template<T>(mut self, value: T) -> Self
4322    where
4323      T: std::convert::TryInto<Option<String>>,
4324      T::Error: std::fmt::Display, {
4325      self.template = value
4326        .try_into()
4327        .map_err(|e| format!("error converting supplied value for template: {}", e));
4328      self
4329    }
4330
4331    pub fn timestamp_field<T>(mut self, value: T) -> Self
4332    where
4333      T: std::convert::TryInto<Option<super::DataStreamTimestampField>>,
4334      T::Error: std::fmt::Display, {
4335      self.timestamp_field = value
4336        .try_into()
4337        .map_err(|e| format!("error converting supplied value for timestamp_field: {}", e));
4338      self
4339    }
4340  }
4341
4342  impl std::convert::TryFrom<DataStream> for super::DataStream {
4343    type Error = String;
4344
4345    fn try_from(value: DataStream) -> Result<Self, String> {
4346      Ok(Self {
4347        generation: value.generation?,
4348        indices: value.indices?,
4349        name: value.name?,
4350        status: value.status?,
4351        template: value.template?,
4352        timestamp_field: value.timestamp_field?,
4353      })
4354    }
4355  }
4356
4357  impl From<super::DataStream> for DataStream {
4358    fn from(value: super::DataStream) -> Self {
4359      Self {
4360        generation: Ok(value.generation),
4361        indices: Ok(value.indices),
4362        name: Ok(value.name),
4363        status: Ok(value.status),
4364        template: Ok(value.template),
4365        timestamp_field: Ok(value.timestamp_field),
4366      }
4367    }
4368  }
4369
4370  #[derive(Clone, Debug)]
4371  pub struct DataStreamIndex {
4372    index_name: Result<Option<String>, String>,
4373    index_uuid: Result<Option<String>, String>,
4374  }
4375
4376  impl Default for DataStreamIndex {
4377    fn default() -> Self {
4378      Self {
4379        index_name: Ok(Default::default()),
4380        index_uuid: Ok(Default::default()),
4381      }
4382    }
4383  }
4384
4385  impl DataStreamIndex {
4386    pub fn index_name<T>(mut self, value: T) -> Self
4387    where
4388      T: std::convert::TryInto<Option<String>>,
4389      T::Error: std::fmt::Display, {
4390      self.index_name = value
4391        .try_into()
4392        .map_err(|e| format!("error converting supplied value for index_name: {}", e));
4393      self
4394    }
4395
4396    pub fn index_uuid<T>(mut self, value: T) -> Self
4397    where
4398      T: std::convert::TryInto<Option<String>>,
4399      T::Error: std::fmt::Display, {
4400      self.index_uuid = value
4401        .try_into()
4402        .map_err(|e| format!("error converting supplied value for index_uuid: {}", e));
4403      self
4404    }
4405  }
4406
4407  impl std::convert::TryFrom<DataStreamIndex> for super::DataStreamIndex {
4408    type Error = String;
4409
4410    fn try_from(value: DataStreamIndex) -> Result<Self, String> {
4411      Ok(Self {
4412        index_name: value.index_name?,
4413        index_uuid: value.index_uuid?,
4414      })
4415    }
4416  }
4417
4418  impl From<super::DataStreamIndex> for DataStreamIndex {
4419    fn from(value: super::DataStreamIndex) -> Self {
4420      Self {
4421        index_name: Ok(value.index_name),
4422        index_uuid: Ok(value.index_uuid),
4423      }
4424    }
4425  }
4426
4427  #[derive(Clone, Debug)]
4428  pub struct DataStreamTimestampField {
4429    name: Result<Option<String>, String>,
4430  }
4431
4432  impl Default for DataStreamTimestampField {
4433    fn default() -> Self {
4434      Self {
4435        name: Ok(Default::default()),
4436      }
4437    }
4438  }
4439
4440  impl DataStreamTimestampField {
4441    pub fn name<T>(mut self, value: T) -> Self
4442    where
4443      T: std::convert::TryInto<Option<String>>,
4444      T::Error: std::fmt::Display, {
4445      self.name = value
4446        .try_into()
4447        .map_err(|e| format!("error converting supplied value for name: {}", e));
4448      self
4449    }
4450  }
4451
4452  impl std::convert::TryFrom<DataStreamTimestampField> for super::DataStreamTimestampField {
4453    type Error = String;
4454
4455    fn try_from(value: DataStreamTimestampField) -> Result<Self, String> {
4456      Ok(Self { name: value.name? })
4457    }
4458  }
4459
4460  impl From<super::DataStreamTimestampField> for DataStreamTimestampField {
4461    fn from(value: super::DataStreamTimestampField) -> Self {
4462      Self { name: Ok(value.name) }
4463    }
4464  }
4465
4466  #[derive(Clone, Debug)]
4467  pub struct DeleteAllPitsResponseContent {
4468    pits: Result<Vec<super::PitsDetailsDeleteAll>, String>,
4469  }
4470
4471  impl Default for DeleteAllPitsResponseContent {
4472    fn default() -> Self {
4473      Self {
4474        pits: Ok(Default::default()),
4475      }
4476    }
4477  }
4478
4479  impl DeleteAllPitsResponseContent {
4480    pub fn pits<T>(mut self, value: T) -> Self
4481    where
4482      T: std::convert::TryInto<Vec<super::PitsDetailsDeleteAll>>,
4483      T::Error: std::fmt::Display, {
4484      self.pits = value
4485        .try_into()
4486        .map_err(|e| format!("error converting supplied value for pits: {}", e));
4487      self
4488    }
4489  }
4490
4491  impl std::convert::TryFrom<DeleteAllPitsResponseContent> for super::DeleteAllPitsResponseContent {
4492    type Error = String;
4493
4494    fn try_from(value: DeleteAllPitsResponseContent) -> Result<Self, String> {
4495      Ok(Self { pits: value.pits? })
4496    }
4497  }
4498
4499  impl From<super::DeleteAllPitsResponseContent> for DeleteAllPitsResponseContent {
4500    fn from(value: super::DeleteAllPitsResponseContent) -> Self {
4501      Self { pits: Ok(value.pits) }
4502    }
4503  }
4504
4505  #[derive(Clone, Debug)]
4506  pub struct DeletePitBodyParams {
4507    pit_id: Result<Vec<String>, String>,
4508  }
4509
4510  impl Default for DeletePitBodyParams {
4511    fn default() -> Self {
4512      Self {
4513        pit_id: Err("no value supplied for pit_id".to_string()),
4514      }
4515    }
4516  }
4517
4518  impl DeletePitBodyParams {
4519    pub fn pit_id<T>(mut self, value: T) -> Self
4520    where
4521      T: std::convert::TryInto<Vec<String>>,
4522      T::Error: std::fmt::Display, {
4523      self.pit_id = value
4524        .try_into()
4525        .map_err(|e| format!("error converting supplied value for pit_id: {}", e));
4526      self
4527    }
4528  }
4529
4530  impl std::convert::TryFrom<DeletePitBodyParams> for super::DeletePitBodyParams {
4531    type Error = String;
4532
4533    fn try_from(value: DeletePitBodyParams) -> Result<Self, String> {
4534      Ok(Self { pit_id: value.pit_id? })
4535    }
4536  }
4537
4538  impl From<super::DeletePitBodyParams> for DeletePitBodyParams {
4539    fn from(value: super::DeletePitBodyParams) -> Self {
4540      Self {
4541        pit_id: Ok(value.pit_id),
4542      }
4543    }
4544  }
4545
4546  #[derive(Clone, Debug)]
4547  pub struct DeletePitResponseContent {
4548    pits: Result<Vec<super::DeletedPit>, String>,
4549  }
4550
4551  impl Default for DeletePitResponseContent {
4552    fn default() -> Self {
4553      Self {
4554        pits: Ok(Default::default()),
4555      }
4556    }
4557  }
4558
4559  impl DeletePitResponseContent {
4560    pub fn pits<T>(mut self, value: T) -> Self
4561    where
4562      T: std::convert::TryInto<Vec<super::DeletedPit>>,
4563      T::Error: std::fmt::Display, {
4564      self.pits = value
4565        .try_into()
4566        .map_err(|e| format!("error converting supplied value for pits: {}", e));
4567      self
4568    }
4569  }
4570
4571  impl std::convert::TryFrom<DeletePitResponseContent> for super::DeletePitResponseContent {
4572    type Error = String;
4573
4574    fn try_from(value: DeletePitResponseContent) -> Result<Self, String> {
4575      Ok(Self { pits: value.pits? })
4576    }
4577  }
4578
4579  impl From<super::DeletePitResponseContent> for DeletePitResponseContent {
4580    fn from(value: super::DeletePitResponseContent) -> Self {
4581      Self { pits: Ok(value.pits) }
4582    }
4583  }
4584
4585  #[derive(Clone, Debug)]
4586  pub struct DeletedPit {
4587    pit_id: Result<Option<String>, String>,
4588    successful: Result<Option<bool>, String>,
4589  }
4590
4591  impl Default for DeletedPit {
4592    fn default() -> Self {
4593      Self {
4594        pit_id: Ok(Default::default()),
4595        successful: Ok(Default::default()),
4596      }
4597    }
4598  }
4599
4600  impl DeletedPit {
4601    pub fn pit_id<T>(mut self, value: T) -> Self
4602    where
4603      T: std::convert::TryInto<Option<String>>,
4604      T::Error: std::fmt::Display, {
4605      self.pit_id = value
4606        .try_into()
4607        .map_err(|e| format!("error converting supplied value for pit_id: {}", e));
4608      self
4609    }
4610
4611    pub fn successful<T>(mut self, value: T) -> Self
4612    where
4613      T: std::convert::TryInto<Option<bool>>,
4614      T::Error: std::fmt::Display, {
4615      self.successful = value
4616        .try_into()
4617        .map_err(|e| format!("error converting supplied value for successful: {}", e));
4618      self
4619    }
4620  }
4621
4622  impl std::convert::TryFrom<DeletedPit> for super::DeletedPit {
4623    type Error = String;
4624
4625    fn try_from(value: DeletedPit) -> Result<Self, String> {
4626      Ok(Self {
4627        pit_id: value.pit_id?,
4628        successful: value.successful?,
4629      })
4630    }
4631  }
4632
4633  impl From<super::DeletedPit> for DeletedPit {
4634    fn from(value: super::DeletedPit) -> Self {
4635      Self {
4636        pit_id: Ok(value.pit_id),
4637        successful: Ok(value.successful),
4638      }
4639    }
4640  }
4641
4642  #[derive(Clone, Debug)]
4643  pub struct GetAllPitsResponseContent {
4644    pits: Result<Vec<super::PitDetail>, String>,
4645  }
4646
4647  impl Default for GetAllPitsResponseContent {
4648    fn default() -> Self {
4649      Self {
4650        pits: Ok(Default::default()),
4651      }
4652    }
4653  }
4654
4655  impl GetAllPitsResponseContent {
4656    pub fn pits<T>(mut self, value: T) -> Self
4657    where
4658      T: std::convert::TryInto<Vec<super::PitDetail>>,
4659      T::Error: std::fmt::Display, {
4660      self.pits = value
4661        .try_into()
4662        .map_err(|e| format!("error converting supplied value for pits: {}", e));
4663      self
4664    }
4665  }
4666
4667  impl std::convert::TryFrom<GetAllPitsResponseContent> for super::GetAllPitsResponseContent {
4668    type Error = String;
4669
4670    fn try_from(value: GetAllPitsResponseContent) -> Result<Self, String> {
4671      Ok(Self { pits: value.pits? })
4672    }
4673  }
4674
4675  impl From<super::GetAllPitsResponseContent> for GetAllPitsResponseContent {
4676    fn from(value: super::GetAllPitsResponseContent) -> Self {
4677      Self { pits: Ok(value.pits) }
4678    }
4679  }
4680
4681  #[derive(Clone, Debug)]
4682  pub struct GetResponseContent<T> {
4683    fields: Result<Option<super::UserDefinedValueMap>, String>,
4684    found: Result<bool, String>,
4685    id: Result<String, String>,
4686    index: Result<String, String>,
4687    primary_term: Result<Option<i64>, String>,
4688    routing: Result<Option<String>, String>,
4689    seq_no: Result<Option<i64>, String>,
4690    source: Result<Option<T>, String>,
4691    type_: Result<Option<String>, String>,
4692    version: Result<Option<i32>, String>,
4693  }
4694
4695  impl<T> Default for GetResponseContent<T> {
4696    fn default() -> Self {
4697      Self {
4698        fields: Ok(Default::default()),
4699        found: Err("no value supplied for found".to_string()),
4700        id: Err("no value supplied for id".to_string()),
4701        index: Err("no value supplied for index".to_string()),
4702        primary_term: Ok(Default::default()),
4703        routing: Ok(Default::default()),
4704        seq_no: Ok(Default::default()),
4705        source: Ok(Default::default()),
4706        type_: Ok(Default::default()),
4707        version: Ok(Default::default()),
4708      }
4709    }
4710  }
4711
4712  impl<T3> GetResponseContent<T3> {
4713    pub fn fields<T>(mut self, value: T) -> Self
4714    where
4715      T: std::convert::TryInto<Option<super::UserDefinedValueMap>>,
4716      T::Error: std::fmt::Display, {
4717      self.fields = value
4718        .try_into()
4719        .map_err(|e| format!("error converting supplied value for fields: {}", e));
4720      self
4721    }
4722
4723    pub fn found<T>(mut self, value: T) -> Self
4724    where
4725      T: std::convert::TryInto<bool>,
4726      T::Error: std::fmt::Display, {
4727      self.found = value
4728        .try_into()
4729        .map_err(|e| format!("error converting supplied value for found: {}", e));
4730      self
4731    }
4732
4733    pub fn id<T>(mut self, value: T) -> Self
4734    where
4735      T: std::convert::TryInto<String>,
4736      T::Error: std::fmt::Display, {
4737      self.id = value
4738        .try_into()
4739        .map_err(|e| format!("error converting supplied value for id: {}", e));
4740      self
4741    }
4742
4743    pub fn index<T>(mut self, value: T) -> Self
4744    where
4745      T: std::convert::TryInto<String>,
4746      T::Error: std::fmt::Display, {
4747      self.index = value
4748        .try_into()
4749        .map_err(|e| format!("error converting supplied value for index: {}", e));
4750      self
4751    }
4752
4753    pub fn primary_term<T>(mut self, value: T) -> Self
4754    where
4755      T: std::convert::TryInto<Option<i64>>,
4756      T::Error: std::fmt::Display, {
4757      self.primary_term = value
4758        .try_into()
4759        .map_err(|e| format!("error converting supplied value for primary_term: {}", e));
4760      self
4761    }
4762
4763    pub fn routing<T>(mut self, value: T) -> Self
4764    where
4765      T: std::convert::TryInto<Option<String>>,
4766      T::Error: std::fmt::Display, {
4767      self.routing = value
4768        .try_into()
4769        .map_err(|e| format!("error converting supplied value for routing: {}", e));
4770      self
4771    }
4772
4773    pub fn seq_no<T>(mut self, value: T) -> Self
4774    where
4775      T: std::convert::TryInto<Option<i64>>,
4776      T::Error: std::fmt::Display, {
4777      self.seq_no = value
4778        .try_into()
4779        .map_err(|e| format!("error converting supplied value for seq_no: {}", e));
4780      self
4781    }
4782
4783    pub fn source(mut self, value: T3) -> Self
4784    where
4785      T3: std::convert::TryInto<Option<T3>>,
4786      T3::Error: std::fmt::Display, {
4787      self.source = value
4788        .try_into()
4789        .map_err(|e| format!("error converting supplied value for source: {}", e));
4790      self
4791    }
4792
4793    pub fn type_<T>(mut self, value: T) -> Self
4794    where
4795      T: std::convert::TryInto<Option<String>>,
4796      T::Error: std::fmt::Display, {
4797      self.type_ = value
4798        .try_into()
4799        .map_err(|e| format!("error converting supplied value for type_: {}", e));
4800      self
4801    }
4802
4803    pub fn version<T>(mut self, value: T) -> Self
4804    where
4805      T: std::convert::TryInto<Option<i32>>,
4806      T::Error: std::fmt::Display, {
4807      self.version = value
4808        .try_into()
4809        .map_err(|e| format!("error converting supplied value for version: {}", e));
4810      self
4811    }
4812  }
4813
4814  impl<T2> std::convert::TryFrom<GetResponseContent<T2>> for super::GetResponseContent<T2> {
4815    type Error = String;
4816
4817    fn try_from(value: GetResponseContent<T2>) -> Result<Self, String> {
4818      Ok(Self {
4819        fields: value.fields?,
4820        found: value.found?,
4821        id: value.id?,
4822        index: value.index?,
4823        primary_term: value.primary_term?,
4824        routing: value.routing?,
4825        seq_no: value.seq_no?,
4826        source: value.source?,
4827        type_: value.type_?,
4828        version: value.version?,
4829      })
4830    }
4831  }
4832
4833  impl<T2> From<super::GetResponseContent<T2>> for GetResponseContent<T2> {
4834    fn from(value: super::GetResponseContent<T2>) -> Self {
4835      Self {
4836        fields: Ok(value.fields),
4837        found: Ok(value.found),
4838        id: Ok(value.id),
4839        index: Ok(value.index),
4840        primary_term: Ok(value.primary_term),
4841        routing: Ok(value.routing),
4842        seq_no: Ok(value.seq_no),
4843        source: Ok(value.source),
4844        type_: Ok(value.type_),
4845        version: Ok(value.version),
4846      }
4847    }
4848  }
4849
4850  #[derive(Clone, Debug)]
4851  pub struct Hit<T> {
4852    fields: Result<Option<serde_json::Value>, String>,
4853    id: Result<String, String>,
4854    index: Result<String, String>,
4855    score: Result<Option<f64>, String>,
4856    source: Result<Option<T>, String>,
4857    type_: Result<Option<String>, String>,
4858    sort: Result<Option<serde_json::Value>, String>,
4859  }
4860
4861  impl<T> Default for Hit<T> {
4862    fn default() -> Self {
4863      Self {
4864        fields: Ok(Default::default()),
4865        id: Ok(Default::default()),
4866        index: Ok(Default::default()),
4867        score: Ok(Default::default()),
4868        source: Ok(Default::default()),
4869        type_: Ok(Default::default()),
4870        sort: Ok(Default::default()),
4871      }
4872    }
4873  }
4874
4875  impl<T3> Hit<T3> {
4876    pub fn fields<T>(mut self, value: T) -> Self
4877    where
4878      T: std::convert::TryInto<Option<serde_json::Value>>,
4879      T::Error: std::fmt::Display, {
4880      self.fields = value
4881        .try_into()
4882        .map_err(|e| format!("error converting supplied value for fields: {}", e));
4883      self
4884    }
4885
4886    pub fn id<T>(mut self, value: T) -> Self
4887    where
4888      T: std::convert::TryInto<String>,
4889      T::Error: std::fmt::Display, {
4890      self.id = value
4891        .try_into()
4892        .map_err(|e| format!("error converting supplied value for id: {}", e));
4893      self
4894    }
4895
4896    pub fn index<T>(mut self, value: T) -> Self
4897    where
4898      T: std::convert::TryInto<String>,
4899      T::Error: std::fmt::Display, {
4900      self.index = value
4901        .try_into()
4902        .map_err(|e| format!("error converting supplied value for index: {}", e));
4903      self
4904    }
4905
4906    pub fn score<T>(mut self, value: T) -> Self
4907    where
4908      T: std::convert::TryInto<Option<f64>>,
4909      T::Error: std::fmt::Display, {
4910      self.score = value
4911        .try_into()
4912        .map_err(|e| format!("error converting supplied value for score: {}", e));
4913      self
4914    }
4915
4916    // pub fn source(mut self, value: T3) -> Self
4917    // where
4918    //   T3: std::convert::TryInto<Option<serde_json::Value>>,
4919    //   T3::Error: std::fmt::Display, {
4920    //   self.source = value
4921    //     .try_into()
4922    //     .map_err(|e| format!("error converting supplied value for source: {}",
4923    // e));   self
4924    // }
4925
4926    pub fn type_<T>(mut self, value: T) -> Self
4927    where
4928      T: std::convert::TryInto<Option<String>>,
4929      T::Error: std::fmt::Display, {
4930      self.type_ = value
4931        .try_into()
4932        .map_err(|e| format!("error converting supplied value for type_: {}", e));
4933      self
4934    }
4935  }
4936
4937  impl<T2> std::convert::TryFrom<Hit<T2>> for super::Hit<T2> {
4938    type Error = String;
4939
4940    fn try_from(value: Hit<T2>) -> Result<Self, String> {
4941      Ok(Self {
4942        fields: value.fields?,
4943        id: value.id?,
4944        index: value.index?,
4945        score: value.score?,
4946        source: value.source?,
4947        type_: value.type_?,
4948        sort: value.sort?,
4949      })
4950    }
4951  }
4952
4953  impl<T2> From<super::Hit<T2>> for Hit<T2> {
4954    fn from(value: super::Hit<T2>) -> Self {
4955      Self {
4956        fields: Ok(value.fields),
4957        id: Ok(value.id),
4958        index: Ok(value.index),
4959        score: Ok(value.score),
4960        source: Ok(value.source),
4961        type_: Ok(value.type_),
4962        sort: Ok(value.sort),
4963      }
4964    }
4965  }
4966
4967  #[derive(Clone, Debug)]
4968  pub struct HitsMetadata<T> {
4969    hits: Result<Vec<super::Hit<T>>, String>,
4970    max_score: Result<Option<f64>, String>,
4971    total: Result<Option<super::Total>, String>,
4972  }
4973
4974  impl<T> Default for HitsMetadata<T> {
4975    fn default() -> Self {
4976      Self {
4977        hits: Ok(Default::default()),
4978        max_score: Ok(Default::default()),
4979        total: Ok(Default::default()),
4980      }
4981    }
4982  }
4983
4984  impl<T2> HitsMetadata<T2> {
4985    pub fn hits<T>(mut self, value: T) -> Self
4986    where
4987      T: std::convert::TryInto<Vec<super::Hit<T2>>>,
4988      T::Error: std::fmt::Display, {
4989      self.hits = value
4990        .try_into()
4991        .map_err(|e| format!("error converting supplied value for hits: {}", e));
4992      self
4993    }
4994
4995    pub fn max_score<T>(mut self, value: T) -> Self
4996    where
4997      T: std::convert::TryInto<Option<f64>>,
4998      T::Error: std::fmt::Display, {
4999      self.max_score = value
5000        .try_into()
5001        .map_err(|e| format!("error converting supplied value for max_score: {}", e));
5002      self
5003    }
5004
5005    pub fn total<T>(mut self, value: T) -> Self
5006    where
5007      T: std::convert::TryInto<Option<super::Total>>,
5008      T::Error: std::fmt::Display, {
5009      self.total = value
5010        .try_into()
5011        .map_err(|e| format!("error converting supplied value for total: {}", e));
5012      self
5013    }
5014  }
5015
5016  impl<T> std::convert::TryFrom<HitsMetadata<T>> for super::HitsMetadata<T> {
5017    type Error = String;
5018
5019    fn try_from(value: HitsMetadata<T>) -> Result<Self, String> {
5020      Ok(Self {
5021        hits: value.hits?,
5022        max_score: value.max_score?,
5023        total: value.total?,
5024      })
5025    }
5026  }
5027
5028  impl<T> From<super::HitsMetadata<T>> for HitsMetadata<T> {
5029    fn from(value: super::HitsMetadata<T>) -> Self {
5030      Self {
5031        hits: Ok(value.hits),
5032        max_score: Ok(value.max_score),
5033        total: Ok(value.total),
5034      }
5035    }
5036  }
5037
5038  #[derive(Clone, Debug)]
5039  pub struct InfoResponseContent {
5040    cluster_name: Result<Option<String>, String>,
5041    cluster_uuid: Result<Option<String>, String>,
5042    name: Result<Option<String>, String>,
5043    tagline: Result<Option<String>, String>,
5044    version: Result<Option<super::InfoVersion>, String>,
5045  }
5046
5047  impl Default for InfoResponseContent {
5048    fn default() -> Self {
5049      Self {
5050        cluster_name: Ok(Default::default()),
5051        cluster_uuid: Ok(Default::default()),
5052        name: Ok(Default::default()),
5053        tagline: Ok(Default::default()),
5054        version: Ok(Default::default()),
5055      }
5056    }
5057  }
5058
5059  impl InfoResponseContent {
5060    pub fn cluster_name<T>(mut self, value: T) -> Self
5061    where
5062      T: std::convert::TryInto<Option<String>>,
5063      T::Error: std::fmt::Display, {
5064      self.cluster_name = value
5065        .try_into()
5066        .map_err(|e| format!("error converting supplied value for cluster_name: {}", e));
5067      self
5068    }
5069
5070    pub fn cluster_uuid<T>(mut self, value: T) -> Self
5071    where
5072      T: std::convert::TryInto<Option<String>>,
5073      T::Error: std::fmt::Display, {
5074      self.cluster_uuid = value
5075        .try_into()
5076        .map_err(|e| format!("error converting supplied value for cluster_uuid: {}", e));
5077      self
5078    }
5079
5080    pub fn name<T>(mut self, value: T) -> Self
5081    where
5082      T: std::convert::TryInto<Option<String>>,
5083      T::Error: std::fmt::Display, {
5084      self.name = value
5085        .try_into()
5086        .map_err(|e| format!("error converting supplied value for name: {}", e));
5087      self
5088    }
5089
5090    pub fn tagline<T>(mut self, value: T) -> Self
5091    where
5092      T: std::convert::TryInto<Option<String>>,
5093      T::Error: std::fmt::Display, {
5094      self.tagline = value
5095        .try_into()
5096        .map_err(|e| format!("error converting supplied value for tagline: {}", e));
5097      self
5098    }
5099
5100    pub fn version<T>(mut self, value: T) -> Self
5101    where
5102      T: std::convert::TryInto<Option<super::InfoVersion>>,
5103      T::Error: std::fmt::Display, {
5104      self.version = value
5105        .try_into()
5106        .map_err(|e| format!("error converting supplied value for version: {}", e));
5107      self
5108    }
5109  }
5110
5111  impl std::convert::TryFrom<InfoResponseContent> for super::InfoResponseContent {
5112    type Error = String;
5113
5114    fn try_from(value: InfoResponseContent) -> Result<Self, String> {
5115      Ok(Self {
5116        cluster_name: value.cluster_name?,
5117        cluster_uuid: value.cluster_uuid?,
5118        name: value.name?,
5119        tagline: value.tagline?,
5120        version: value.version?,
5121      })
5122    }
5123  }
5124
5125  impl From<super::InfoResponseContent> for InfoResponseContent {
5126    fn from(value: super::InfoResponseContent) -> Self {
5127      Self {
5128        cluster_name: Ok(value.cluster_name),
5129        cluster_uuid: Ok(value.cluster_uuid),
5130        name: Ok(value.name),
5131        tagline: Ok(value.tagline),
5132        version: Ok(value.version),
5133      }
5134    }
5135  }
5136
5137  #[derive(Clone, Debug)]
5138  pub struct InfoVersion {
5139    build_date: Result<Option<String>, String>,
5140    build_hash: Result<Option<String>, String>,
5141    build_snapshot: Result<Option<bool>, String>,
5142    build_type: Result<Option<String>, String>,
5143    distribution: Result<Option<String>, String>,
5144    lucene_version: Result<Option<String>, String>,
5145    minimum_index_compatibility_version: Result<Option<String>, String>,
5146    minimum_wire_compatibility_version: Result<Option<String>, String>,
5147    number: Result<Option<String>, String>,
5148  }
5149
5150  impl Default for InfoVersion {
5151    fn default() -> Self {
5152      Self {
5153        build_date: Ok(Default::default()),
5154        build_hash: Ok(Default::default()),
5155        build_snapshot: Ok(Default::default()),
5156        build_type: Ok(Default::default()),
5157        distribution: Ok(Default::default()),
5158        lucene_version: Ok(Default::default()),
5159        minimum_index_compatibility_version: Ok(Default::default()),
5160        minimum_wire_compatibility_version: Ok(Default::default()),
5161        number: Ok(Default::default()),
5162      }
5163    }
5164  }
5165
5166  impl InfoVersion {
5167    pub fn build_date<T>(mut self, value: T) -> Self
5168    where
5169      T: std::convert::TryInto<Option<String>>,
5170      T::Error: std::fmt::Display, {
5171      self.build_date = value
5172        .try_into()
5173        .map_err(|e| format!("error converting supplied value for build_date: {}", e));
5174      self
5175    }
5176
5177    pub fn build_hash<T>(mut self, value: T) -> Self
5178    where
5179      T: std::convert::TryInto<Option<String>>,
5180      T::Error: std::fmt::Display, {
5181      self.build_hash = value
5182        .try_into()
5183        .map_err(|e| format!("error converting supplied value for build_hash: {}", e));
5184      self
5185    }
5186
5187    pub fn build_snapshot<T>(mut self, value: T) -> Self
5188    where
5189      T: std::convert::TryInto<Option<bool>>,
5190      T::Error: std::fmt::Display, {
5191      self.build_snapshot = value
5192        .try_into()
5193        .map_err(|e| format!("error converting supplied value for build_snapshot: {}", e));
5194      self
5195    }
5196
5197    pub fn build_type<T>(mut self, value: T) -> Self
5198    where
5199      T: std::convert::TryInto<Option<String>>,
5200      T::Error: std::fmt::Display, {
5201      self.build_type = value
5202        .try_into()
5203        .map_err(|e| format!("error converting supplied value for build_type: {}", e));
5204      self
5205    }
5206
5207    pub fn distribution<T>(mut self, value: T) -> Self
5208    where
5209      T: std::convert::TryInto<Option<String>>,
5210      T::Error: std::fmt::Display, {
5211      self.distribution = value
5212        .try_into()
5213        .map_err(|e| format!("error converting supplied value for distribution: {}", e));
5214      self
5215    }
5216
5217    pub fn lucene_version<T>(mut self, value: T) -> Self
5218    where
5219      T: std::convert::TryInto<Option<String>>,
5220      T::Error: std::fmt::Display, {
5221      self.lucene_version = value
5222        .try_into()
5223        .map_err(|e| format!("error converting supplied value for lucene_version: {}", e));
5224      self
5225    }
5226
5227    pub fn minimum_index_compatibility_version<T>(mut self, value: T) -> Self
5228    where
5229      T: std::convert::TryInto<Option<String>>,
5230      T::Error: std::fmt::Display, {
5231      self.minimum_index_compatibility_version = value.try_into().map_err(|e| {
5232        format!(
5233          "error converting supplied value for minimum_index_compatibility_version: {}",
5234          e
5235        )
5236      });
5237      self
5238    }
5239
5240    pub fn minimum_wire_compatibility_version<T>(mut self, value: T) -> Self
5241    where
5242      T: std::convert::TryInto<Option<String>>,
5243      T::Error: std::fmt::Display, {
5244      self.minimum_wire_compatibility_version = value.try_into().map_err(|e| {
5245        format!(
5246          "error converting supplied value for minimum_wire_compatibility_version: {}",
5247          e
5248        )
5249      });
5250      self
5251    }
5252
5253    pub fn number<T>(mut self, value: T) -> Self
5254    where
5255      T: std::convert::TryInto<Option<String>>,
5256      T::Error: std::fmt::Display, {
5257      self.number = value
5258        .try_into()
5259        .map_err(|e| format!("error converting supplied value for number: {}", e));
5260      self
5261    }
5262  }
5263
5264  impl std::convert::TryFrom<InfoVersion> for super::InfoVersion {
5265    type Error = String;
5266
5267    fn try_from(value: InfoVersion) -> Result<Self, String> {
5268      Ok(Self {
5269        build_date: value.build_date?,
5270        build_hash: value.build_hash?,
5271        build_snapshot: value.build_snapshot?,
5272        build_type: value.build_type?,
5273        distribution: value.distribution?,
5274        lucene_version: value.lucene_version?,
5275        minimum_index_compatibility_version: value.minimum_index_compatibility_version?,
5276        minimum_wire_compatibility_version: value.minimum_wire_compatibility_version?,
5277        number: value.number?,
5278      })
5279    }
5280  }
5281
5282  impl From<super::InfoVersion> for InfoVersion {
5283    fn from(value: super::InfoVersion) -> Self {
5284      Self {
5285        build_date: Ok(value.build_date),
5286        build_hash: Ok(value.build_hash),
5287        build_snapshot: Ok(value.build_snapshot),
5288        build_type: Ok(value.build_type),
5289        distribution: Ok(value.distribution),
5290        lucene_version: Ok(value.lucene_version),
5291        minimum_index_compatibility_version: Ok(value.minimum_index_compatibility_version),
5292        minimum_wire_compatibility_version: Ok(value.minimum_wire_compatibility_version),
5293        number: Ok(value.number),
5294      }
5295    }
5296  }
5297
5298  #[derive(Clone, Debug)]
5299  pub struct PitDetail {
5300    creation_time: Result<Option<i64>, String>,
5301    keep_alive: Result<Option<i64>, String>,
5302    pit_id: Result<Option<String>, String>,
5303  }
5304
5305  impl Default for PitDetail {
5306    fn default() -> Self {
5307      Self {
5308        creation_time: Ok(Default::default()),
5309        keep_alive: Ok(Default::default()),
5310        pit_id: Ok(Default::default()),
5311      }
5312    }
5313  }
5314
5315  impl PitDetail {
5316    pub fn creation_time<T>(mut self, value: T) -> Self
5317    where
5318      T: std::convert::TryInto<Option<i64>>,
5319      T::Error: std::fmt::Display, {
5320      self.creation_time = value
5321        .try_into()
5322        .map_err(|e| format!("error converting supplied value for creation_time: {}", e));
5323      self
5324    }
5325
5326    pub fn keep_alive<T>(mut self, value: T) -> Self
5327    where
5328      T: std::convert::TryInto<Option<i64>>,
5329      T::Error: std::fmt::Display, {
5330      self.keep_alive = value
5331        .try_into()
5332        .map_err(|e| format!("error converting supplied value for keep_alive: {}", e));
5333      self
5334    }
5335
5336    pub fn pit_id<T>(mut self, value: T) -> Self
5337    where
5338      T: std::convert::TryInto<Option<String>>,
5339      T::Error: std::fmt::Display, {
5340      self.pit_id = value
5341        .try_into()
5342        .map_err(|e| format!("error converting supplied value for pit_id: {}", e));
5343      self
5344    }
5345  }
5346
5347  impl std::convert::TryFrom<PitDetail> for super::PitDetail {
5348    type Error = String;
5349
5350    fn try_from(value: PitDetail) -> Result<Self, String> {
5351      Ok(Self {
5352        creation_time: value.creation_time?,
5353        keep_alive: value.keep_alive?,
5354        pit_id: value.pit_id?,
5355      })
5356    }
5357  }
5358
5359  impl From<super::PitDetail> for PitDetail {
5360    fn from(value: super::PitDetail) -> Self {
5361      Self {
5362        creation_time: Ok(value.creation_time),
5363        keep_alive: Ok(value.keep_alive),
5364        pit_id: Ok(value.pit_id),
5365      }
5366    }
5367  }
5368
5369  #[derive(Clone, Debug)]
5370  pub struct PitsDetailsDeleteAll {
5371    pit_id: Result<Option<String>, String>,
5372    successful: Result<Option<bool>, String>,
5373  }
5374
5375  impl Default for PitsDetailsDeleteAll {
5376    fn default() -> Self {
5377      Self {
5378        pit_id: Ok(Default::default()),
5379        successful: Ok(Default::default()),
5380      }
5381    }
5382  }
5383
5384  impl PitsDetailsDeleteAll {
5385    pub fn pit_id<T>(mut self, value: T) -> Self
5386    where
5387      T: std::convert::TryInto<Option<String>>,
5388      T::Error: std::fmt::Display, {
5389      self.pit_id = value
5390        .try_into()
5391        .map_err(|e| format!("error converting supplied value for pit_id: {}", e));
5392      self
5393    }
5394
5395    pub fn successful<T>(mut self, value: T) -> Self
5396    where
5397      T: std::convert::TryInto<Option<bool>>,
5398      T::Error: std::fmt::Display, {
5399      self.successful = value
5400        .try_into()
5401        .map_err(|e| format!("error converting supplied value for successful: {}", e));
5402      self
5403    }
5404  }
5405
5406  impl std::convert::TryFrom<PitsDetailsDeleteAll> for super::PitsDetailsDeleteAll {
5407    type Error = String;
5408
5409    fn try_from(value: PitsDetailsDeleteAll) -> Result<Self, String> {
5410      Ok(Self {
5411        pit_id: value.pit_id?,
5412        successful: value.successful?,
5413      })
5414    }
5415  }
5416
5417  impl From<super::PitsDetailsDeleteAll> for PitsDetailsDeleteAll {
5418    fn from(value: super::PitsDetailsDeleteAll) -> Self {
5419      Self {
5420        pit_id: Ok(value.pit_id),
5421        successful: Ok(value.successful),
5422      }
5423    }
5424  }
5425
5426  // #[derive(Clone, Debug)]
5427  // pub struct SearchBodyParams {
5428  //   docvalue_fields: Result<Option<String>, String>,
5429  //   explain: Result<Option<bool>, String>,
5430  //   fields: Result<Vec<String>, String>,
5431  //   from: Result<Option<u32>, String>,
5432  //   indices_boost: Result<Vec<serde_json::Value>, String>,
5433  //   min_score: Result<Option<u32>, String>,
5434  //   query: Result<Option<super::UserDefinedObjectStructure>, String>,
5435  //   seq_no_primary_term: Result<Option<bool>, String>,
5436  //   size: Result<Option<u32>, String>,
5437  //   source: Result<Option<String>, String>,
5438  //   stats: Result<Option<String>, String>,
5439  //   terminate_after: Result<Option<u32>, String>,
5440  //   timeout: Result<Option<super::Time>, String>,
5441  //   version: Result<Option<bool>, String>,
5442  //   search_after: Result<Option<serde_json::Value>, String>,
5443  //   sort: Result<Option<serde_json::Value>, String>,
5444  // }
5445
5446  // impl Default for SearchBodyParams {
5447  //   fn default() -> Self {
5448  //     Self {
5449  //       docvalue_fields: Ok(Default::default()),
5450  //       explain: Ok(Default::default()),
5451  //       fields: Ok(Default::default()),
5452  //       from: Ok(Default::default()),
5453  //       indices_boost: Ok(Default::default()),
5454  //       min_score: Ok(Default::default()),
5455  //       query: Ok(Default::default()),
5456  //       seq_no_primary_term: Ok(Default::default()),
5457  //       size: Ok(Default::default()),
5458  //       source: Ok(Default::default()),
5459  //       stats: Ok(Default::default()),
5460  //       terminate_after: Ok(Default::default()),
5461  //       timeout: Ok(Default::default()),
5462  //       version: Ok(Default::default()),
5463  //       search_after: Ok(Default::default()),
5464  //       sort: Ok(Default::default()),
5465  //     }
5466  //   }
5467  // }
5468
5469  // impl SearchBodyParams {
5470  //   pub fn docvalue_fields<T>(mut self, value: T) -> Self
5471  //   where
5472  //     T: std::convert::TryInto<Option<String>>,
5473  //     T::Error: std::fmt::Display, {
5474  //     self.docvalue_fields = value
5475  //       .try_into()
5476  //       .map_err(|e| format!("error converting supplied value for
5477  // docvalue_fields: {}", e));     self
5478  //   }
5479
5480  //   pub fn explain<T>(mut self, value: T) -> Self
5481  //   where
5482  //     T: std::convert::TryInto<Option<bool>>,
5483  //     T::Error: std::fmt::Display, {
5484  //     self.explain = value
5485  //       .try_into()
5486  //       .map_err(|e| format!("error converting supplied value for explain: {}",
5487  // e));     self
5488  //   }
5489
5490  //   pub fn fields<T>(mut self, value: T) -> Self
5491  //   where
5492  //     T: std::convert::TryInto<Vec<String>>,
5493  //     T::Error: std::fmt::Display, {
5494  //     self.fields = value
5495  //       .try_into()
5496  //       .map_err(|e| format!("error converting supplied value for fields: {}",
5497  // e));     self
5498  //   }
5499
5500  //   pub fn from<T>(mut self, value: T) -> Self
5501  //   where
5502  //     T: std::convert::TryInto<Option<u32>>,
5503  //     T::Error: std::fmt::Display, {
5504  //     self.from = value
5505  //       .try_into()
5506  //       .map_err(|e| format!("error converting supplied value for from: {}",
5507  // e));     self
5508  //   }
5509
5510  //   pub fn indices_boost<T>(mut self, value: T) -> Self
5511  //   where
5512  //     T: std::convert::TryInto<Vec<serde_json::Value>>,
5513  //     T::Error: std::fmt::Display, {
5514  //     self.indices_boost = value
5515  //       .try_into()
5516  //       .map_err(|e| format!("error converting supplied value for
5517  // indices_boost: {}", e));     self
5518  //   }
5519
5520  //   pub fn min_score<T>(mut self, value: T) -> Self
5521  //   where
5522  //     T: std::convert::TryInto<Option<u32>>,
5523  //     T::Error: std::fmt::Display, {
5524  //     self.min_score = value
5525  //       .try_into()
5526  //       .map_err(|e| format!("error converting supplied value for min_score:
5527  // {}", e));     self
5528  //   }
5529
5530  //   pub fn query<T>(mut self, value: T) -> Self
5531  //   where
5532  //     T: std::convert::TryInto<Option<super::UserDefinedObjectStructure>>,
5533  //     T::Error: std::fmt::Display, {
5534  //     self.query = value
5535  //       .try_into()
5536  //       .map_err(|e| format!("error converting supplied value for query: {}",
5537  // e));     self
5538  //   }
5539
5540  //   pub fn seq_no_primary_term<T>(mut self, value: T) -> Self
5541  //   where
5542  //     T: std::convert::TryInto<Option<bool>>,
5543  //     T::Error: std::fmt::Display, {
5544  //     self.seq_no_primary_term = value
5545  //       .try_into()
5546  //       .map_err(|e| format!("error converting supplied value for
5547  // seq_no_primary_term: {}", e));     self
5548  //   }
5549
5550  //   pub fn size<T>(mut self, value: T) -> Self
5551  //   where
5552  //     T: std::convert::TryInto<Option<u32>>,
5553  //     T::Error: std::fmt::Display, {
5554  //     self.size = value
5555  //       .try_into()
5556  //       .map_err(|e| format!("error converting supplied value for size: {}",
5557  // e));     self
5558  //   }
5559
5560  //   pub fn source<T>(mut self, value: T) -> Self
5561  //   where
5562  //     T: std::convert::TryInto<Option<String>>,
5563  //     T::Error: std::fmt::Display, {
5564  //     self.source = value
5565  //       .try_into()
5566  //       .map_err(|e| format!("error converting supplied value for source: {}",
5567  // e));     self
5568  //   }
5569
5570  //   pub fn stats<T>(mut self, value: T) -> Self
5571  //   where
5572  //     T: std::convert::TryInto<Option<String>>,
5573  //     T::Error: std::fmt::Display, {
5574  //     self.stats = value
5575  //       .try_into()
5576  //       .map_err(|e| format!("error converting supplied value for stats: {}",
5577  // e));     self
5578  //   }
5579
5580  //   pub fn terminate_after<T>(mut self, value: T) -> Self
5581  //   where
5582  //     T: std::convert::TryInto<Option<u32>>,
5583  //     T::Error: std::fmt::Display, {
5584  //     self.terminate_after = value
5585  //       .try_into()
5586  //       .map_err(|e| format!("error converting supplied value for
5587  // terminate_after: {}", e));     self
5588  //   }
5589
5590  //   pub fn timeout<T>(mut self, value: T) -> Self
5591  //   where
5592  //     T: std::convert::TryInto<Option<super::Time>>,
5593  //     T::Error: std::fmt::Display, {
5594  //     self.timeout = value
5595  //       .try_into()
5596  //       .map_err(|e| format!("error converting supplied value for timeout: {}",
5597  // e));     self
5598  //   }
5599
5600  //   pub fn version<T>(mut self, value: T) -> Self
5601  //   where
5602  //     T: std::convert::TryInto<Option<bool>>,
5603  //     T::Error: std::fmt::Display, {
5604  //     self.version = value
5605  //       .try_into()
5606  //       .map_err(|e| format!("error converting supplied value for version: {}",
5607  // e));     self
5608  //   }
5609  // }
5610
5611  // impl std::convert::TryFrom<SearchBodyParams> for super::SearchBodyParams {
5612  //   type Error = String;
5613
5614  //   fn try_from(value: SearchBodyParams) -> Result<Self, String> {
5615  //     Ok(Self {
5616  //       docvalue_fields: value.docvalue_fields?,
5617  //       explain: value.explain?,
5618  //       fields: value.fields?,
5619  //       from: value.from?,
5620  //       indices_boost: value.indices_boost?,
5621  //       min_score: value.min_score?,
5622  //       query: value.query?,
5623  //       seq_no_primary_term: value.seq_no_primary_term?,
5624  //       size: value.size?,
5625  //       source: value.source?,
5626  //       stats: value.stats?,
5627  //       terminate_after: value.terminate_after?,
5628  //       timeout: value.timeout?,
5629  //       version: value.version?,
5630  //       search_after: value.search_after?,
5631  //       sort: value.sort?,
5632  //     })
5633  //   }
5634  // }
5635
5636  // impl From<super::SearchBodyParams> for SearchBodyParams {
5637  //   fn from(value: super::SearchBodyParams) -> Self {
5638  //     Self {
5639  //       docvalue_fields: Ok(value.docvalue_fields),
5640  //       explain: Ok(value.explain),
5641  //       fields: Ok(value.fields),
5642  //       from: Ok(value.from),
5643  //       indices_boost: Ok(value.indices_boost),
5644  //       min_score: Ok(value.min_score),
5645  //       query: Ok(value.query),
5646  //       seq_no_primary_term: Ok(value.seq_no_primary_term),
5647  //       size: Ok(value.size),
5648  //       source: Ok(value.source),
5649  //       stats: Ok(value.stats),
5650  //       terminate_after: Ok(value.terminate_after),
5651  //       timeout: Ok(value.timeout),
5652  //       version: Ok(value.version),
5653  //       search_after: Ok(value.search_after),
5654  //       sort: Ok(value.sort),
5655  //     }
5656  //   }
5657  // }
5658
5659  #[derive(Clone, Debug)]
5660  pub struct SearchGetResponseContent<T> {
5661    hits: Result<Option<super::HitsMetadata<T>>, String>,
5662    scroll_id: Result<Option<String>, String>,
5663    shards: Result<Option<super::ShardStatistics>, String>,
5664    timed_out: Result<Option<bool>, String>,
5665    took: Result<Option<i64>, String>,
5666  }
5667
5668  impl<T2> Default for SearchGetResponseContent<T2> {
5669    fn default() -> Self {
5670      Self {
5671        hits: Ok(Default::default()),
5672        scroll_id: Ok(Default::default()),
5673        shards: Ok(Default::default()),
5674        timed_out: Ok(Default::default()),
5675        took: Ok(Default::default()),
5676      }
5677    }
5678  }
5679
5680  impl<T2> SearchGetResponseContent<T2> {
5681    pub fn hits<T>(mut self, value: T) -> Self
5682    where
5683      T: std::convert::TryInto<Option<super::HitsMetadata<T2>>>,
5684      T::Error: std::fmt::Display, {
5685      self.hits = value
5686        .try_into()
5687        .map_err(|e| format!("error converting supplied value for hits: {}", e));
5688      self
5689    }
5690
5691    pub fn scroll_id<T>(mut self, value: T) -> Self
5692    where
5693      T: std::convert::TryInto<Option<String>>,
5694      T::Error: std::fmt::Display, {
5695      self.scroll_id = value
5696        .try_into()
5697        .map_err(|e| format!("error converting supplied value for scroll_id: {}", e));
5698      self
5699    }
5700
5701    pub fn shards<T>(mut self, value: T) -> Self
5702    where
5703      T: std::convert::TryInto<Option<super::ShardStatistics>>,
5704      T::Error: std::fmt::Display, {
5705      self.shards = value
5706        .try_into()
5707        .map_err(|e| format!("error converting supplied value for shards: {}", e));
5708      self
5709    }
5710
5711    pub fn timed_out<T>(mut self, value: T) -> Self
5712    where
5713      T: std::convert::TryInto<Option<bool>>,
5714      T::Error: std::fmt::Display, {
5715      self.timed_out = value
5716        .try_into()
5717        .map_err(|e| format!("error converting supplied value for timed_out: {}", e));
5718      self
5719    }
5720
5721    pub fn took<T>(mut self, value: T) -> Self
5722    where
5723      T: std::convert::TryInto<Option<i64>>,
5724      T::Error: std::fmt::Display, {
5725      self.took = value
5726        .try_into()
5727        .map_err(|e| format!("error converting supplied value for took: {}", e));
5728      self
5729    }
5730  }
5731
5732  impl<T2> std::convert::TryFrom<SearchGetResponseContent<T2>> for super::SearchGetResponseContent<T2> {
5733    type Error = String;
5734
5735    fn try_from(value: SearchGetResponseContent<T2>) -> Result<Self, String> {
5736      Ok(Self {
5737        hits: value.hits?,
5738        scroll_id: value.scroll_id?,
5739        shards: value.shards?,
5740        timed_out: value.timed_out?,
5741        took: value.took?,
5742      })
5743    }
5744  }
5745
5746  impl<T2> From<super::SearchGetResponseContent<T2>> for SearchGetResponseContent<T2> {
5747    fn from(value: super::SearchGetResponseContent<T2>) -> Self {
5748      Self {
5749        hits: Ok(value.hits),
5750        scroll_id: Ok(value.scroll_id),
5751        shards: Ok(value.shards),
5752        timed_out: Ok(value.timed_out),
5753        took: Ok(value.took),
5754      }
5755    }
5756  }
5757
5758  #[derive(Clone, Debug)]
5759  pub struct SearchPostResponseContent<T> {
5760    hits: Result<Option<super::HitsMetadata<T>>, String>,
5761    scroll_id: Result<Option<String>, String>,
5762    shards: Result<Option<super::ShardStatistics>, String>,
5763    timed_out: Result<Option<bool>, String>,
5764    took: Result<Option<i64>, String>,
5765    aggregations: Result<Option<Aggregations>, String>,
5766  }
5767
5768  impl<T2> Default for SearchPostResponseContent<T2> {
5769    fn default() -> Self {
5770      Self {
5771        hits: Ok(Default::default()),
5772        scroll_id: Ok(Default::default()),
5773        shards: Ok(Default::default()),
5774        timed_out: Ok(Default::default()),
5775        took: Ok(Default::default()),
5776        aggregations: Ok(Default::default()),
5777      }
5778    }
5779  }
5780
5781  impl<T2> SearchPostResponseContent<T2> {
5782    pub fn hits<T>(mut self, value: T) -> Self
5783    where
5784      T: std::convert::TryInto<Option<super::HitsMetadata<T2>>>,
5785      T::Error: std::fmt::Display, {
5786      self.hits = value
5787        .try_into()
5788        .map_err(|e| format!("error converting supplied value for hits: {}", e));
5789      self
5790    }
5791
5792    pub fn scroll_id<T>(mut self, value: T) -> Self
5793    where
5794      T: std::convert::TryInto<Option<String>>,
5795      T::Error: std::fmt::Display, {
5796      self.scroll_id = value
5797        .try_into()
5798        .map_err(|e| format!("error converting supplied value for scroll_id: {}", e));
5799      self
5800    }
5801
5802    pub fn shards<T>(mut self, value: T) -> Self
5803    where
5804      T: std::convert::TryInto<Option<super::ShardStatistics>>,
5805      T::Error: std::fmt::Display, {
5806      self.shards = value
5807        .try_into()
5808        .map_err(|e| format!("error converting supplied value for shards: {}", e));
5809      self
5810    }
5811
5812    pub fn timed_out<T>(mut self, value: T) -> Self
5813    where
5814      T: std::convert::TryInto<Option<bool>>,
5815      T::Error: std::fmt::Display, {
5816      self.timed_out = value
5817        .try_into()
5818        .map_err(|e| format!("error converting supplied value for timed_out: {}", e));
5819      self
5820    }
5821
5822    pub fn took<T>(mut self, value: T) -> Self
5823    where
5824      T: std::convert::TryInto<Option<i64>>,
5825      T::Error: std::fmt::Display, {
5826      self.took = value
5827        .try_into()
5828        .map_err(|e| format!("error converting supplied value for took: {}", e));
5829      self
5830    }
5831  }
5832
5833  impl<T2> std::convert::TryFrom<SearchPostResponseContent<T2>> for super::SearchPostResponseContent<T2> {
5834    type Error = String;
5835
5836    fn try_from(value: SearchPostResponseContent<T2>) -> Result<Self, String> {
5837      Ok(Self {
5838        hits: value.hits?,
5839        scroll_id: value.scroll_id?,
5840        shards: value.shards?,
5841        timed_out: value.timed_out?,
5842        took: value.took?,
5843        aggregations: value.aggregations?,
5844      })
5845    }
5846  }
5847
5848  impl<T2> From<super::SearchPostResponseContent<T2>> for SearchPostResponseContent<T2> {
5849    fn from(value: super::SearchPostResponseContent<T2>) -> Self {
5850      Self {
5851        hits: Ok(value.hits),
5852        scroll_id: Ok(value.scroll_id),
5853        shards: Ok(value.shards),
5854        timed_out: Ok(value.timed_out),
5855        took: Ok(value.took),
5856        aggregations: Ok(value.aggregations),
5857      }
5858    }
5859  }
5860
5861  #[derive(Clone, Debug)]
5862  pub struct SearchResult<T> {
5863    hits: Result<super::HitsMetadata<T>, String>,
5864    scroll_id: Result<Option<String>, String>,
5865    shards: Result<Option<super::ShardStatistics>, String>,
5866    timed_out: Result<Option<bool>, String>,
5867    took: Result<Option<i64>, String>,
5868  }
5869
5870  impl<T> Default for SearchResult<T> {
5871    fn default() -> Self {
5872      Self {
5873        hits: Ok(super::HitsMetadata::<T>::default()),
5874        scroll_id: Ok(Default::default()),
5875        shards: Ok(Default::default()),
5876        timed_out: Ok(Default::default()),
5877        took: Ok(Default::default()),
5878      }
5879    }
5880  }
5881
5882  impl<T2> SearchResult<T2> {
5883    pub fn hits<T>(mut self, value: T) -> Self
5884    where
5885      T: std::convert::TryInto<super::HitsMetadata<T2>>,
5886      T::Error: std::fmt::Display, {
5887      self.hits = value
5888        .try_into()
5889        .map_err(|e| format!("error converting supplied value for hits: {}", e));
5890      self
5891    }
5892
5893    pub fn scroll_id<T>(mut self, value: T) -> Self
5894    where
5895      T: std::convert::TryInto<Option<String>>,
5896      T::Error: std::fmt::Display, {
5897      self.scroll_id = value
5898        .try_into()
5899        .map_err(|e| format!("error converting supplied value for scroll_id: {}", e));
5900      self
5901    }
5902
5903    pub fn shards<T>(mut self, value: T) -> Self
5904    where
5905      T: std::convert::TryInto<Option<super::ShardStatistics>>,
5906      T::Error: std::fmt::Display, {
5907      self.shards = value
5908        .try_into()
5909        .map_err(|e| format!("error converting supplied value for shards: {}", e));
5910      self
5911    }
5912
5913    pub fn timed_out<T>(mut self, value: T) -> Self
5914    where
5915      T: std::convert::TryInto<Option<bool>>,
5916      T::Error: std::fmt::Display, {
5917      self.timed_out = value
5918        .try_into()
5919        .map_err(|e| format!("error converting supplied value for timed_out: {}", e));
5920      self
5921    }
5922
5923    pub fn took<T>(mut self, value: T) -> Self
5924    where
5925      T: std::convert::TryInto<Option<i64>>,
5926      T::Error: std::fmt::Display, {
5927      self.took = value
5928        .try_into()
5929        .map_err(|e| format!("error converting supplied value for took: {}", e));
5930      self
5931    }
5932  }
5933
5934  impl<T> std::convert::TryFrom<SearchResult<T>> for super::SearchResult<T> {
5935    type Error = String;
5936
5937    fn try_from(value: SearchResult<T>) -> Result<Self, String> {
5938      Ok(Self {
5939        hits: value.hits?,
5940        scroll_id: value.scroll_id?,
5941        shards: value.shards?,
5942        timed_out: value.timed_out?,
5943        took: value.took?,
5944      })
5945    }
5946  }
5947
5948  impl<T> From<super::SearchResult<T>> for SearchResult<T> {
5949    fn from(value: super::SearchResult<T>) -> Self {
5950      Self {
5951        hits: Ok(value.hits),
5952        scroll_id: Ok(value.scroll_id),
5953        shards: Ok(value.shards),
5954        timed_out: Ok(value.timed_out),
5955        took: Ok(value.took),
5956      }
5957    }
5958  }
5959
5960  #[derive(Clone, Debug)]
5961  pub struct ShardStatistics {
5962    failed: Result<Option<i32>, String>,
5963    skipped: Result<Option<i32>, String>,
5964    successful: Result<Option<i32>, String>,
5965    total: Result<Option<i32>, String>,
5966  }
5967
5968  impl Default for ShardStatistics {
5969    fn default() -> Self {
5970      Self {
5971        failed: Ok(Default::default()),
5972        skipped: Ok(Default::default()),
5973        successful: Ok(Default::default()),
5974        total: Ok(Default::default()),
5975      }
5976    }
5977  }
5978
5979  impl ShardStatistics {
5980    pub fn failed<T>(mut self, value: T) -> Self
5981    where
5982      T: std::convert::TryInto<Option<i32>>,
5983      T::Error: std::fmt::Display, {
5984      self.failed = value
5985        .try_into()
5986        .map_err(|e| format!("error converting supplied value for failed: {}", e));
5987      self
5988    }
5989
5990    pub fn skipped<T>(mut self, value: T) -> Self
5991    where
5992      T: std::convert::TryInto<Option<i32>>,
5993      T::Error: std::fmt::Display, {
5994      self.skipped = value
5995        .try_into()
5996        .map_err(|e| format!("error converting supplied value for skipped: {}", e));
5997      self
5998    }
5999
6000    pub fn successful<T>(mut self, value: T) -> Self
6001    where
6002      T: std::convert::TryInto<Option<i32>>,
6003      T::Error: std::fmt::Display, {
6004      self.successful = value
6005        .try_into()
6006        .map_err(|e| format!("error converting supplied value for successful: {}", e));
6007      self
6008    }
6009
6010    pub fn total<T>(mut self, value: T) -> Self
6011    where
6012      T: std::convert::TryInto<Option<i32>>,
6013      T::Error: std::fmt::Display, {
6014      self.total = value
6015        .try_into()
6016        .map_err(|e| format!("error converting supplied value for total: {}", e));
6017      self
6018    }
6019  }
6020
6021  impl std::convert::TryFrom<ShardStatistics> for super::ShardStatistics {
6022    type Error = String;
6023
6024    fn try_from(value: ShardStatistics) -> Result<Self, String> {
6025      Ok(Self {
6026        failed: value.failed?,
6027        skipped: value.skipped?,
6028        successful: value.successful?,
6029        total: value.total?,
6030      })
6031    }
6032  }
6033
6034  impl From<super::ShardStatistics> for ShardStatistics {
6035    fn from(value: super::ShardStatistics) -> Self {
6036      Self {
6037        failed: Ok(value.failed),
6038        skipped: Ok(value.skipped),
6039        successful: Ok(value.successful),
6040        total: Ok(value.total),
6041      }
6042    }
6043  }
6044
6045  #[derive(Clone, Debug)]
6046  pub struct Total {
6047    relation: Result<Option<super::Relation>, String>,
6048    value: Result<Option<i32>, String>,
6049  }
6050
6051  impl Default for Total {
6052    fn default() -> Self {
6053      Self {
6054        relation: Ok(Default::default()),
6055        value: Ok(Default::default()),
6056      }
6057    }
6058  }
6059
6060  impl Total {
6061    pub fn relation<T>(mut self, value: T) -> Self
6062    where
6063      T: std::convert::TryInto<Option<super::Relation>>,
6064      T::Error: std::fmt::Display, {
6065      self.relation = value
6066        .try_into()
6067        .map_err(|e| format!("error converting supplied value for relation: {}", e));
6068      self
6069    }
6070
6071    pub fn value<T>(mut self, value: T) -> Self
6072    where
6073      T: std::convert::TryInto<Option<i32>>,
6074      T::Error: std::fmt::Display, {
6075      self.value = value
6076        .try_into()
6077        .map_err(|e| format!("error converting supplied value for value: {}", e));
6078      self
6079    }
6080  }
6081
6082  impl std::convert::TryFrom<Total> for super::Total {
6083    type Error = String;
6084
6085    fn try_from(value: Total) -> Result<Self, String> {
6086      Ok(Self {
6087        relation: value.relation?,
6088        value: value.value?,
6089      })
6090    }
6091  }
6092
6093  impl From<super::Total> for Total {
6094    fn from(value: super::Total) -> Self {
6095      Self {
6096        relation: Ok(value.relation),
6097        value: Ok(value.value),
6098      }
6099    }
6100  }
6101
6102  #[derive(Clone, Debug)]
6103  pub struct UserDefinedObjectStructure {
6104    bool: Result<Option<serde_json::Value>, String>,
6105    boosting: Result<Option<serde_json::Value>, String>,
6106    combined_fields: Result<Option<serde_json::Value>, String>,
6107    constant_score: Result<Option<serde_json::Value>, String>,
6108    dis_max: Result<Option<serde_json::Value>, String>,
6109    distance_feature: Result<Option<serde_json::Value>, String>,
6110    exists: Result<Option<serde_json::Value>, String>,
6111    field_masking_span: Result<Option<serde_json::Value>, String>,
6112    function_score: Result<Option<serde_json::Value>, String>,
6113    fuzzy: Result<Option<super::UserDefinedValueMap>, String>,
6114    geo_bounding_box: Result<Option<serde_json::Value>, String>,
6115    geo_distance: Result<Option<serde_json::Value>, String>,
6116    geo_polygon: Result<Option<serde_json::Value>, String>,
6117    geo_shape: Result<Option<serde_json::Value>, String>,
6118    has_child: Result<Option<serde_json::Value>, String>,
6119    has_parent: Result<Option<serde_json::Value>, String>,
6120    ids: Result<Option<serde_json::Value>, String>,
6121    intervals: Result<Option<super::UserDefinedValueMap>, String>,
6122    knn: Result<Option<serde_json::Value>, String>,
6123    match_: Result<Option<super::UserDefinedValueMap>, String>,
6124    match_all: Result<Option<serde_json::Value>, String>,
6125    match_bool_prefix: Result<Option<super::UserDefinedValueMap>, String>,
6126    match_none: Result<Option<serde_json::Value>, String>,
6127    match_phrase: Result<Option<super::UserDefinedValueMap>, String>,
6128    match_phrase_prefix: Result<Option<super::UserDefinedValueMap>, String>,
6129    more_like_this: Result<Option<serde_json::Value>, String>,
6130    multi_match: Result<Option<serde_json::Value>, String>,
6131    nested: Result<Option<serde_json::Value>, String>,
6132    parent_id: Result<Option<serde_json::Value>, String>,
6133    percolate: Result<Option<serde_json::Value>, String>,
6134    pinned: Result<Option<serde_json::Value>, String>,
6135    prefix: Result<Option<super::UserDefinedValueMap>, String>,
6136    query_string: Result<Option<serde_json::Value>, String>,
6137    range: Result<Option<super::UserDefinedValueMap>, String>,
6138    rank_feature: Result<Option<serde_json::Value>, String>,
6139    regexp: Result<Option<super::UserDefinedValueMap>, String>,
6140    script: Result<Option<serde_json::Value>, String>,
6141    script_score: Result<Option<serde_json::Value>, String>,
6142    shape: Result<Option<serde_json::Value>, String>,
6143    simple_query_string: Result<Option<serde_json::Value>, String>,
6144    span_containing: Result<Option<serde_json::Value>, String>,
6145    span_first: Result<Option<serde_json::Value>, String>,
6146    span_multi: Result<Option<serde_json::Value>, String>,
6147    span_near: Result<Option<serde_json::Value>, String>,
6148    span_not: Result<Option<serde_json::Value>, String>,
6149    span_or: Result<Option<serde_json::Value>, String>,
6150    span_term: Result<Option<super::UserDefinedValueMap>, String>,
6151    span_within: Result<Option<serde_json::Value>, String>,
6152    term: Result<Option<super::UserDefinedValueMap>, String>,
6153    terms: Result<Option<serde_json::Value>, String>,
6154    terms_set: Result<Option<super::UserDefinedValueMap>, String>,
6155    wildcard: Result<Option<super::UserDefinedValueMap>, String>,
6156    wrapper: Result<Option<serde_json::Value>, String>,
6157  }
6158
6159  impl Default for UserDefinedObjectStructure {
6160    fn default() -> Self {
6161      Self {
6162        bool: Ok(Default::default()),
6163        boosting: Ok(Default::default()),
6164        combined_fields: Ok(Default::default()),
6165        constant_score: Ok(Default::default()),
6166        dis_max: Ok(Default::default()),
6167        distance_feature: Ok(Default::default()),
6168        exists: Ok(Default::default()),
6169        field_masking_span: Ok(Default::default()),
6170        function_score: Ok(Default::default()),
6171        fuzzy: Ok(Default::default()),
6172        geo_bounding_box: Ok(Default::default()),
6173        geo_distance: Ok(Default::default()),
6174        geo_polygon: Ok(Default::default()),
6175        geo_shape: Ok(Default::default()),
6176        has_child: Ok(Default::default()),
6177        has_parent: Ok(Default::default()),
6178        ids: Ok(Default::default()),
6179        intervals: Ok(Default::default()),
6180        knn: Ok(Default::default()),
6181        match_: Ok(Default::default()),
6182        match_all: Ok(Default::default()),
6183        match_bool_prefix: Ok(Default::default()),
6184        match_none: Ok(Default::default()),
6185        match_phrase: Ok(Default::default()),
6186        match_phrase_prefix: Ok(Default::default()),
6187        more_like_this: Ok(Default::default()),
6188        multi_match: Ok(Default::default()),
6189        nested: Ok(Default::default()),
6190        parent_id: Ok(Default::default()),
6191        percolate: Ok(Default::default()),
6192        pinned: Ok(Default::default()),
6193        prefix: Ok(Default::default()),
6194        query_string: Ok(Default::default()),
6195        range: Ok(Default::default()),
6196        rank_feature: Ok(Default::default()),
6197        regexp: Ok(Default::default()),
6198        script: Ok(Default::default()),
6199        script_score: Ok(Default::default()),
6200        shape: Ok(Default::default()),
6201        simple_query_string: Ok(Default::default()),
6202        span_containing: Ok(Default::default()),
6203        span_first: Ok(Default::default()),
6204        span_multi: Ok(Default::default()),
6205        span_near: Ok(Default::default()),
6206        span_not: Ok(Default::default()),
6207        span_or: Ok(Default::default()),
6208        span_term: Ok(Default::default()),
6209        span_within: Ok(Default::default()),
6210        term: Ok(Default::default()),
6211        terms: Ok(Default::default()),
6212        terms_set: Ok(Default::default()),
6213        wildcard: Ok(Default::default()),
6214        wrapper: Ok(Default::default()),
6215      }
6216    }
6217  }
6218
6219  impl UserDefinedObjectStructure {
6220    pub fn bool<T>(mut self, value: T) -> Self
6221    where
6222      T: std::convert::TryInto<Option<serde_json::Value>>,
6223      T::Error: std::fmt::Display, {
6224      self.bool = value
6225        .try_into()
6226        .map_err(|e| format!("error converting supplied value for bool: {}", e));
6227      self
6228    }
6229
6230    pub fn boosting<T>(mut self, value: T) -> Self
6231    where
6232      T: std::convert::TryInto<Option<serde_json::Value>>,
6233      T::Error: std::fmt::Display, {
6234      self.boosting = value
6235        .try_into()
6236        .map_err(|e| format!("error converting supplied value for boosting: {}", e));
6237      self
6238    }
6239
6240    pub fn combined_fields<T>(mut self, value: T) -> Self
6241    where
6242      T: std::convert::TryInto<Option<serde_json::Value>>,
6243      T::Error: std::fmt::Display, {
6244      self.combined_fields = value
6245        .try_into()
6246        .map_err(|e| format!("error converting supplied value for combined_fields: {}", e));
6247      self
6248    }
6249
6250    pub fn constant_score<T>(mut self, value: T) -> Self
6251    where
6252      T: std::convert::TryInto<Option<serde_json::Value>>,
6253      T::Error: std::fmt::Display, {
6254      self.constant_score = value
6255        .try_into()
6256        .map_err(|e| format!("error converting supplied value for constant_score: {}", e));
6257      self
6258    }
6259
6260    pub fn dis_max<T>(mut self, value: T) -> Self
6261    where
6262      T: std::convert::TryInto<Option<serde_json::Value>>,
6263      T::Error: std::fmt::Display, {
6264      self.dis_max = value
6265        .try_into()
6266        .map_err(|e| format!("error converting supplied value for dis_max: {}", e));
6267      self
6268    }
6269
6270    pub fn distance_feature<T>(mut self, value: T) -> Self
6271    where
6272      T: std::convert::TryInto<Option<serde_json::Value>>,
6273      T::Error: std::fmt::Display, {
6274      self.distance_feature = value
6275        .try_into()
6276        .map_err(|e| format!("error converting supplied value for distance_feature: {}", e));
6277      self
6278    }
6279
6280    pub fn exists<T>(mut self, value: T) -> Self
6281    where
6282      T: std::convert::TryInto<Option<serde_json::Value>>,
6283      T::Error: std::fmt::Display, {
6284      self.exists = value
6285        .try_into()
6286        .map_err(|e| format!("error converting supplied value for exists: {}", e));
6287      self
6288    }
6289
6290    pub fn field_masking_span<T>(mut self, value: T) -> Self
6291    where
6292      T: std::convert::TryInto<Option<serde_json::Value>>,
6293      T::Error: std::fmt::Display, {
6294      self.field_masking_span = value
6295        .try_into()
6296        .map_err(|e| format!("error converting supplied value for field_masking_span: {}", e));
6297      self
6298    }
6299
6300    pub fn function_score<T>(mut self, value: T) -> Self
6301    where
6302      T: std::convert::TryInto<Option<serde_json::Value>>,
6303      T::Error: std::fmt::Display, {
6304      self.function_score = value
6305        .try_into()
6306        .map_err(|e| format!("error converting supplied value for function_score: {}", e));
6307      self
6308    }
6309
6310    pub fn fuzzy<T>(mut self, value: T) -> Self
6311    where
6312      T: std::convert::TryInto<Option<super::UserDefinedValueMap>>,
6313      T::Error: std::fmt::Display, {
6314      self.fuzzy = value
6315        .try_into()
6316        .map_err(|e| format!("error converting supplied value for fuzzy: {}", e));
6317      self
6318    }
6319
6320    pub fn geo_bounding_box<T>(mut self, value: T) -> Self
6321    where
6322      T: std::convert::TryInto<Option<serde_json::Value>>,
6323      T::Error: std::fmt::Display, {
6324      self.geo_bounding_box = value
6325        .try_into()
6326        .map_err(|e| format!("error converting supplied value for geo_bounding_box: {}", e));
6327      self
6328    }
6329
6330    pub fn geo_distance<T>(mut self, value: T) -> Self
6331    where
6332      T: std::convert::TryInto<Option<serde_json::Value>>,
6333      T::Error: std::fmt::Display, {
6334      self.geo_distance = value
6335        .try_into()
6336        .map_err(|e| format!("error converting supplied value for geo_distance: {}", e));
6337      self
6338    }
6339
6340    pub fn geo_polygon<T>(mut self, value: T) -> Self
6341    where
6342      T: std::convert::TryInto<Option<serde_json::Value>>,
6343      T::Error: std::fmt::Display, {
6344      self.geo_polygon = value
6345        .try_into()
6346        .map_err(|e| format!("error converting supplied value for geo_polygon: {}", e));
6347      self
6348    }
6349
6350    pub fn geo_shape<T>(mut self, value: T) -> Self
6351    where
6352      T: std::convert::TryInto<Option<serde_json::Value>>,
6353      T::Error: std::fmt::Display, {
6354      self.geo_shape = value
6355        .try_into()
6356        .map_err(|e| format!("error converting supplied value for geo_shape: {}", e));
6357      self
6358    }
6359
6360    pub fn has_child<T>(mut self, value: T) -> Self
6361    where
6362      T: std::convert::TryInto<Option<serde_json::Value>>,
6363      T::Error: std::fmt::Display, {
6364      self.has_child = value
6365        .try_into()
6366        .map_err(|e| format!("error converting supplied value for has_child: {}", e));
6367      self
6368    }
6369
6370    pub fn has_parent<T>(mut self, value: T) -> Self
6371    where
6372      T: std::convert::TryInto<Option<serde_json::Value>>,
6373      T::Error: std::fmt::Display, {
6374      self.has_parent = value
6375        .try_into()
6376        .map_err(|e| format!("error converting supplied value for has_parent: {}", e));
6377      self
6378    }
6379
6380    pub fn ids<T>(mut self, value: T) -> Self
6381    where
6382      T: std::convert::TryInto<Option<serde_json::Value>>,
6383      T::Error: std::fmt::Display, {
6384      self.ids = value
6385        .try_into()
6386        .map_err(|e| format!("error converting supplied value for ids: {}", e));
6387      self
6388    }
6389
6390    pub fn intervals<T>(mut self, value: T) -> Self
6391    where
6392      T: std::convert::TryInto<Option<super::UserDefinedValueMap>>,
6393      T::Error: std::fmt::Display, {
6394      self.intervals = value
6395        .try_into()
6396        .map_err(|e| format!("error converting supplied value for intervals: {}", e));
6397      self
6398    }
6399
6400    pub fn knn<T>(mut self, value: T) -> Self
6401    where
6402      T: std::convert::TryInto<Option<serde_json::Value>>,
6403      T::Error: std::fmt::Display, {
6404      self.knn = value
6405        .try_into()
6406        .map_err(|e| format!("error converting supplied value for knn: {}", e));
6407      self
6408    }
6409
6410    pub fn match_<T>(mut self, value: T) -> Self
6411    where
6412      T: std::convert::TryInto<Option<super::UserDefinedValueMap>>,
6413      T::Error: std::fmt::Display, {
6414      self.match_ = value
6415        .try_into()
6416        .map_err(|e| format!("error converting supplied value for match_: {}", e));
6417      self
6418    }
6419
6420    pub fn match_all<T>(mut self, value: T) -> Self
6421    where
6422      T: std::convert::TryInto<Option<serde_json::Value>>,
6423      T::Error: std::fmt::Display, {
6424      self.match_all = value
6425        .try_into()
6426        .map_err(|e| format!("error converting supplied value for match_all: {}", e));
6427      self
6428    }
6429
6430    pub fn match_bool_prefix<T>(mut self, value: T) -> Self
6431    where
6432      T: std::convert::TryInto<Option<super::UserDefinedValueMap>>,
6433      T::Error: std::fmt::Display, {
6434      self.match_bool_prefix = value
6435        .try_into()
6436        .map_err(|e| format!("error converting supplied value for match_bool_prefix: {}", e));
6437      self
6438    }
6439
6440    pub fn match_none<T>(mut self, value: T) -> Self
6441    where
6442      T: std::convert::TryInto<Option<serde_json::Value>>,
6443      T::Error: std::fmt::Display, {
6444      self.match_none = value
6445        .try_into()
6446        .map_err(|e| format!("error converting supplied value for match_none: {}", e));
6447      self
6448    }
6449
6450    pub fn match_phrase<T>(mut self, value: T) -> Self
6451    where
6452      T: std::convert::TryInto<Option<super::UserDefinedValueMap>>,
6453      T::Error: std::fmt::Display, {
6454      self.match_phrase = value
6455        .try_into()
6456        .map_err(|e| format!("error converting supplied value for match_phrase: {}", e));
6457      self
6458    }
6459
6460    pub fn match_phrase_prefix<T>(mut self, value: T) -> Self
6461    where
6462      T: std::convert::TryInto<Option<super::UserDefinedValueMap>>,
6463      T::Error: std::fmt::Display, {
6464      self.match_phrase_prefix = value
6465        .try_into()
6466        .map_err(|e| format!("error converting supplied value for match_phrase_prefix: {}", e));
6467      self
6468    }
6469
6470    pub fn more_like_this<T>(mut self, value: T) -> Self
6471    where
6472      T: std::convert::TryInto<Option<serde_json::Value>>,
6473      T::Error: std::fmt::Display, {
6474      self.more_like_this = value
6475        .try_into()
6476        .map_err(|e| format!("error converting supplied value for more_like_this: {}", e));
6477      self
6478    }
6479
6480    pub fn multi_match<T>(mut self, value: T) -> Self
6481    where
6482      T: std::convert::TryInto<Option<serde_json::Value>>,
6483      T::Error: std::fmt::Display, {
6484      self.multi_match = value
6485        .try_into()
6486        .map_err(|e| format!("error converting supplied value for multi_match: {}", e));
6487      self
6488    }
6489
6490    pub fn nested<T>(mut self, value: T) -> Self
6491    where
6492      T: std::convert::TryInto<Option<serde_json::Value>>,
6493      T::Error: std::fmt::Display, {
6494      self.nested = value
6495        .try_into()
6496        .map_err(|e| format!("error converting supplied value for nested: {}", e));
6497      self
6498    }
6499
6500    pub fn parent_id<T>(mut self, value: T) -> Self
6501    where
6502      T: std::convert::TryInto<Option<serde_json::Value>>,
6503      T::Error: std::fmt::Display, {
6504      self.parent_id = value
6505        .try_into()
6506        .map_err(|e| format!("error converting supplied value for parent_id: {}", e));
6507      self
6508    }
6509
6510    pub fn percolate<T>(mut self, value: T) -> Self
6511    where
6512      T: std::convert::TryInto<Option<serde_json::Value>>,
6513      T::Error: std::fmt::Display, {
6514      self.percolate = value
6515        .try_into()
6516        .map_err(|e| format!("error converting supplied value for percolate: {}", e));
6517      self
6518    }
6519
6520    pub fn pinned<T>(mut self, value: T) -> Self
6521    where
6522      T: std::convert::TryInto<Option<serde_json::Value>>,
6523      T::Error: std::fmt::Display, {
6524      self.pinned = value
6525        .try_into()
6526        .map_err(|e| format!("error converting supplied value for pinned: {}", e));
6527      self
6528    }
6529
6530    pub fn prefix<T>(mut self, value: T) -> Self
6531    where
6532      T: std::convert::TryInto<Option<super::UserDefinedValueMap>>,
6533      T::Error: std::fmt::Display, {
6534      self.prefix = value
6535        .try_into()
6536        .map_err(|e| format!("error converting supplied value for prefix: {}", e));
6537      self
6538    }
6539
6540    pub fn query_string<T>(mut self, value: T) -> Self
6541    where
6542      T: std::convert::TryInto<Option<serde_json::Value>>,
6543      T::Error: std::fmt::Display, {
6544      self.query_string = value
6545        .try_into()
6546        .map_err(|e| format!("error converting supplied value for query_string: {}", e));
6547      self
6548    }
6549
6550    pub fn range<T>(mut self, value: T) -> Self
6551    where
6552      T: std::convert::TryInto<Option<super::UserDefinedValueMap>>,
6553      T::Error: std::fmt::Display, {
6554      self.range = value
6555        .try_into()
6556        .map_err(|e| format!("error converting supplied value for range: {}", e));
6557      self
6558    }
6559
6560    pub fn rank_feature<T>(mut self, value: T) -> Self
6561    where
6562      T: std::convert::TryInto<Option<serde_json::Value>>,
6563      T::Error: std::fmt::Display, {
6564      self.rank_feature = value
6565        .try_into()
6566        .map_err(|e| format!("error converting supplied value for rank_feature: {}", e));
6567      self
6568    }
6569
6570    pub fn regexp<T>(mut self, value: T) -> Self
6571    where
6572      T: std::convert::TryInto<Option<super::UserDefinedValueMap>>,
6573      T::Error: std::fmt::Display, {
6574      self.regexp = value
6575        .try_into()
6576        .map_err(|e| format!("error converting supplied value for regexp: {}", e));
6577      self
6578    }
6579
6580    pub fn script<T>(mut self, value: T) -> Self
6581    where
6582      T: std::convert::TryInto<Option<serde_json::Value>>,
6583      T::Error: std::fmt::Display, {
6584      self.script = value
6585        .try_into()
6586        .map_err(|e| format!("error converting supplied value for script: {}", e));
6587      self
6588    }
6589
6590    pub fn script_score<T>(mut self, value: T) -> Self
6591    where
6592      T: std::convert::TryInto<Option<serde_json::Value>>,
6593      T::Error: std::fmt::Display, {
6594      self.script_score = value
6595        .try_into()
6596        .map_err(|e| format!("error converting supplied value for script_score: {}", e));
6597      self
6598    }
6599
6600    pub fn shape<T>(mut self, value: T) -> Self
6601    where
6602      T: std::convert::TryInto<Option<serde_json::Value>>,
6603      T::Error: std::fmt::Display, {
6604      self.shape = value
6605        .try_into()
6606        .map_err(|e| format!("error converting supplied value for shape: {}", e));
6607      self
6608    }
6609
6610    pub fn simple_query_string<T>(mut self, value: T) -> Self
6611    where
6612      T: std::convert::TryInto<Option<serde_json::Value>>,
6613      T::Error: std::fmt::Display, {
6614      self.simple_query_string = value
6615        .try_into()
6616        .map_err(|e| format!("error converting supplied value for simple_query_string: {}", e));
6617      self
6618    }
6619
6620    pub fn span_containing<T>(mut self, value: T) -> Self
6621    where
6622      T: std::convert::TryInto<Option<serde_json::Value>>,
6623      T::Error: std::fmt::Display, {
6624      self.span_containing = value
6625        .try_into()
6626        .map_err(|e| format!("error converting supplied value for span_containing: {}", e));
6627      self
6628    }
6629
6630    pub fn span_first<T>(mut self, value: T) -> Self
6631    where
6632      T: std::convert::TryInto<Option<serde_json::Value>>,
6633      T::Error: std::fmt::Display, {
6634      self.span_first = value
6635        .try_into()
6636        .map_err(|e| format!("error converting supplied value for span_first: {}", e));
6637      self
6638    }
6639
6640    pub fn span_multi<T>(mut self, value: T) -> Self
6641    where
6642      T: std::convert::TryInto<Option<serde_json::Value>>,
6643      T::Error: std::fmt::Display, {
6644      self.span_multi = value
6645        .try_into()
6646        .map_err(|e| format!("error converting supplied value for span_multi: {}", e));
6647      self
6648    }
6649
6650    pub fn span_near<T>(mut self, value: T) -> Self
6651    where
6652      T: std::convert::TryInto<Option<serde_json::Value>>,
6653      T::Error: std::fmt::Display, {
6654      self.span_near = value
6655        .try_into()
6656        .map_err(|e| format!("error converting supplied value for span_near: {}", e));
6657      self
6658    }
6659
6660    pub fn span_not<T>(mut self, value: T) -> Self
6661    where
6662      T: std::convert::TryInto<Option<serde_json::Value>>,
6663      T::Error: std::fmt::Display, {
6664      self.span_not = value
6665        .try_into()
6666        .map_err(|e| format!("error converting supplied value for span_not: {}", e));
6667      self
6668    }
6669
6670    pub fn span_or<T>(mut self, value: T) -> Self
6671    where
6672      T: std::convert::TryInto<Option<serde_json::Value>>,
6673      T::Error: std::fmt::Display, {
6674      self.span_or = value
6675        .try_into()
6676        .map_err(|e| format!("error converting supplied value for span_or: {}", e));
6677      self
6678    }
6679
6680    pub fn span_term<T>(mut self, value: T) -> Self
6681    where
6682      T: std::convert::TryInto<Option<super::UserDefinedValueMap>>,
6683      T::Error: std::fmt::Display, {
6684      self.span_term = value
6685        .try_into()
6686        .map_err(|e| format!("error converting supplied value for span_term: {}", e));
6687      self
6688    }
6689
6690    pub fn span_within<T>(mut self, value: T) -> Self
6691    where
6692      T: std::convert::TryInto<Option<serde_json::Value>>,
6693      T::Error: std::fmt::Display, {
6694      self.span_within = value
6695        .try_into()
6696        .map_err(|e| format!("error converting supplied value for span_within: {}", e));
6697      self
6698    }
6699
6700    pub fn term<T>(mut self, value: T) -> Self
6701    where
6702      T: std::convert::TryInto<Option<super::UserDefinedValueMap>>,
6703      T::Error: std::fmt::Display, {
6704      self.term = value
6705        .try_into()
6706        .map_err(|e| format!("error converting supplied value for term: {}", e));
6707      self
6708    }
6709
6710    pub fn terms<T>(mut self, value: T) -> Self
6711    where
6712      T: std::convert::TryInto<Option<serde_json::Value>>,
6713      T::Error: std::fmt::Display, {
6714      self.terms = value
6715        .try_into()
6716        .map_err(|e| format!("error converting supplied value for terms: {}", e));
6717      self
6718    }
6719
6720    pub fn terms_set<T>(mut self, value: T) -> Self
6721    where
6722      T: std::convert::TryInto<Option<super::UserDefinedValueMap>>,
6723      T::Error: std::fmt::Display, {
6724      self.terms_set = value
6725        .try_into()
6726        .map_err(|e| format!("error converting supplied value for terms_set: {}", e));
6727      self
6728    }
6729
6730    pub fn wildcard<T>(mut self, value: T) -> Self
6731    where
6732      T: std::convert::TryInto<Option<super::UserDefinedValueMap>>,
6733      T::Error: std::fmt::Display, {
6734      self.wildcard = value
6735        .try_into()
6736        .map_err(|e| format!("error converting supplied value for wildcard: {}", e));
6737      self
6738    }
6739
6740    pub fn wrapper<T>(mut self, value: T) -> Self
6741    where
6742      T: std::convert::TryInto<Option<serde_json::Value>>,
6743      T::Error: std::fmt::Display, {
6744      self.wrapper = value
6745        .try_into()
6746        .map_err(|e| format!("error converting supplied value for wrapper: {}", e));
6747      self
6748    }
6749  }
6750
6751  impl std::convert::TryFrom<UserDefinedObjectStructure> for super::UserDefinedObjectStructure {
6752    type Error = String;
6753
6754    fn try_from(value: UserDefinedObjectStructure) -> Result<Self, String> {
6755      Ok(Self {
6756        bool: value.bool?,
6757        boosting: value.boosting?,
6758        combined_fields: value.combined_fields?,
6759        constant_score: value.constant_score?,
6760        dis_max: value.dis_max?,
6761        distance_feature: value.distance_feature?,
6762        exists: value.exists?,
6763        field_masking_span: value.field_masking_span?,
6764        function_score: value.function_score?,
6765        fuzzy: value.fuzzy?,
6766        geo_bounding_box: value.geo_bounding_box?,
6767        geo_distance: value.geo_distance?,
6768        geo_polygon: value.geo_polygon?,
6769        geo_shape: value.geo_shape?,
6770        has_child: value.has_child?,
6771        has_parent: value.has_parent?,
6772        ids: value.ids?,
6773        intervals: value.intervals?,
6774        knn: value.knn?,
6775        match_: value.match_?,
6776        match_all: value.match_all?,
6777        match_bool_prefix: value.match_bool_prefix?,
6778        match_none: value.match_none?,
6779        match_phrase: value.match_phrase?,
6780        match_phrase_prefix: value.match_phrase_prefix?,
6781        more_like_this: value.more_like_this?,
6782        multi_match: value.multi_match?,
6783        nested: value.nested?,
6784        parent_id: value.parent_id?,
6785        percolate: value.percolate?,
6786        pinned: value.pinned?,
6787        prefix: value.prefix?,
6788        query_string: value.query_string?,
6789        range: value.range?,
6790        rank_feature: value.rank_feature?,
6791        regexp: value.regexp?,
6792        script: value.script?,
6793        script_score: value.script_score?,
6794        shape: value.shape?,
6795        simple_query_string: value.simple_query_string?,
6796        span_containing: value.span_containing?,
6797        span_first: value.span_first?,
6798        span_multi: value.span_multi?,
6799        span_near: value.span_near?,
6800        span_not: value.span_not?,
6801        span_or: value.span_or?,
6802        span_term: value.span_term?,
6803        span_within: value.span_within?,
6804        term: value.term?,
6805        terms: value.terms?,
6806        terms_set: value.terms_set?,
6807        wildcard: value.wildcard?,
6808        wrapper: value.wrapper?,
6809      })
6810    }
6811  }
6812
6813  impl From<super::UserDefinedObjectStructure> for UserDefinedObjectStructure {
6814    fn from(value: super::UserDefinedObjectStructure) -> Self {
6815      Self {
6816        bool: Ok(value.bool),
6817        boosting: Ok(value.boosting),
6818        combined_fields: Ok(value.combined_fields),
6819        constant_score: Ok(value.constant_score),
6820        dis_max: Ok(value.dis_max),
6821        distance_feature: Ok(value.distance_feature),
6822        exists: Ok(value.exists),
6823        field_masking_span: Ok(value.field_masking_span),
6824        function_score: Ok(value.function_score),
6825        fuzzy: Ok(value.fuzzy),
6826        geo_bounding_box: Ok(value.geo_bounding_box),
6827        geo_distance: Ok(value.geo_distance),
6828        geo_polygon: Ok(value.geo_polygon),
6829        geo_shape: Ok(value.geo_shape),
6830        has_child: Ok(value.has_child),
6831        has_parent: Ok(value.has_parent),
6832        ids: Ok(value.ids),
6833        intervals: Ok(value.intervals),
6834        knn: Ok(value.knn),
6835        match_: Ok(value.match_),
6836        match_all: Ok(value.match_all),
6837        match_bool_prefix: Ok(value.match_bool_prefix),
6838        match_none: Ok(value.match_none),
6839        match_phrase: Ok(value.match_phrase),
6840        match_phrase_prefix: Ok(value.match_phrase_prefix),
6841        more_like_this: Ok(value.more_like_this),
6842        multi_match: Ok(value.multi_match),
6843        nested: Ok(value.nested),
6844        parent_id: Ok(value.parent_id),
6845        percolate: Ok(value.percolate),
6846        pinned: Ok(value.pinned),
6847        prefix: Ok(value.prefix),
6848        query_string: Ok(value.query_string),
6849        range: Ok(value.range),
6850        rank_feature: Ok(value.rank_feature),
6851        regexp: Ok(value.regexp),
6852        script: Ok(value.script),
6853        script_score: Ok(value.script_score),
6854        shape: Ok(value.shape),
6855        simple_query_string: Ok(value.simple_query_string),
6856        span_containing: Ok(value.span_containing),
6857        span_first: Ok(value.span_first),
6858        span_multi: Ok(value.span_multi),
6859        span_near: Ok(value.span_near),
6860        span_not: Ok(value.span_not),
6861        span_or: Ok(value.span_or),
6862        span_term: Ok(value.span_term),
6863        span_within: Ok(value.span_within),
6864        term: Ok(value.term),
6865        terms: Ok(value.terms),
6866        terms_set: Ok(value.terms_set),
6867        wildcard: Ok(value.wildcard),
6868        wrapper: Ok(value.wrapper),
6869      }
6870    }
6871  }
6872
6873  #[derive(Clone, Debug)]
6874  pub struct UserDefinedStructure {
6875    alias: Result<Option<String>, String>,
6876    aliases: Result<Vec<String>, String>,
6877    filter: Result<Option<serde_json::Value>, String>,
6878    index: Result<Option<String>, String>,
6879    index_routing: Result<Option<String>, String>,
6880    indices: Result<Vec<String>, String>,
6881    is_hidden: Result<Option<bool>, String>,
6882    is_write_index: Result<Option<bool>, String>,
6883    must_exist: Result<Option<String>, String>,
6884    routing: Result<Option<String>, String>,
6885    search_routing: Result<Option<String>, String>,
6886  }
6887
6888  impl Default for UserDefinedStructure {
6889    fn default() -> Self {
6890      Self {
6891        alias: Ok(Default::default()),
6892        aliases: Ok(Default::default()),
6893        filter: Ok(Default::default()),
6894        index: Ok(Default::default()),
6895        index_routing: Ok(Default::default()),
6896        indices: Ok(Default::default()),
6897        is_hidden: Ok(Default::default()),
6898        is_write_index: Ok(Default::default()),
6899        must_exist: Ok(Default::default()),
6900        routing: Ok(Default::default()),
6901        search_routing: Ok(Default::default()),
6902      }
6903    }
6904  }
6905
6906  impl UserDefinedStructure {
6907    pub fn alias<T>(mut self, value: T) -> Self
6908    where
6909      T: std::convert::TryInto<Option<String>>,
6910      T::Error: std::fmt::Display, {
6911      self.alias = value
6912        .try_into()
6913        .map_err(|e| format!("error converting supplied value for alias: {}", e));
6914      self
6915    }
6916
6917    pub fn aliases<T>(mut self, value: T) -> Self
6918    where
6919      T: std::convert::TryInto<Vec<String>>,
6920      T::Error: std::fmt::Display, {
6921      self.aliases = value
6922        .try_into()
6923        .map_err(|e| format!("error converting supplied value for aliases: {}", e));
6924      self
6925    }
6926
6927    pub fn filter<T>(mut self, value: T) -> Self
6928    where
6929      T: std::convert::TryInto<Option<serde_json::Value>>,
6930      T::Error: std::fmt::Display, {
6931      self.filter = value
6932        .try_into()
6933        .map_err(|e| format!("error converting supplied value for filter: {}", e));
6934      self
6935    }
6936
6937    pub fn index<T>(mut self, value: T) -> Self
6938    where
6939      T: std::convert::TryInto<Option<String>>,
6940      T::Error: std::fmt::Display, {
6941      self.index = value
6942        .try_into()
6943        .map_err(|e| format!("error converting supplied value for index: {}", e));
6944      self
6945    }
6946
6947    pub fn index_routing<T>(mut self, value: T) -> Self
6948    where
6949      T: std::convert::TryInto<Option<String>>,
6950      T::Error: std::fmt::Display, {
6951      self.index_routing = value
6952        .try_into()
6953        .map_err(|e| format!("error converting supplied value for index_routing: {}", e));
6954      self
6955    }
6956
6957    pub fn indices<T>(mut self, value: T) -> Self
6958    where
6959      T: std::convert::TryInto<Vec<String>>,
6960      T::Error: std::fmt::Display, {
6961      self.indices = value
6962        .try_into()
6963        .map_err(|e| format!("error converting supplied value for indices: {}", e));
6964      self
6965    }
6966
6967    pub fn is_hidden<T>(mut self, value: T) -> Self
6968    where
6969      T: std::convert::TryInto<Option<bool>>,
6970      T::Error: std::fmt::Display, {
6971      self.is_hidden = value
6972        .try_into()
6973        .map_err(|e| format!("error converting supplied value for is_hidden: {}", e));
6974      self
6975    }
6976
6977    pub fn is_write_index<T>(mut self, value: T) -> Self
6978    where
6979      T: std::convert::TryInto<Option<bool>>,
6980      T::Error: std::fmt::Display, {
6981      self.is_write_index = value
6982        .try_into()
6983        .map_err(|e| format!("error converting supplied value for is_write_index: {}", e));
6984      self
6985    }
6986
6987    pub fn must_exist<T>(mut self, value: T) -> Self
6988    where
6989      T: std::convert::TryInto<Option<String>>,
6990      T::Error: std::fmt::Display, {
6991      self.must_exist = value
6992        .try_into()
6993        .map_err(|e| format!("error converting supplied value for must_exist: {}", e));
6994      self
6995    }
6996
6997    pub fn routing<T>(mut self, value: T) -> Self
6998    where
6999      T: std::convert::TryInto<Option<String>>,
7000      T::Error: std::fmt::Display, {
7001      self.routing = value
7002        .try_into()
7003        .map_err(|e| format!("error converting supplied value for routing: {}", e));
7004      self
7005    }
7006
7007    pub fn search_routing<T>(mut self, value: T) -> Self
7008    where
7009      T: std::convert::TryInto<Option<String>>,
7010      T::Error: std::fmt::Display, {
7011      self.search_routing = value
7012        .try_into()
7013        .map_err(|e| format!("error converting supplied value for search_routing: {}", e));
7014      self
7015    }
7016  }
7017
7018  impl std::convert::TryFrom<UserDefinedStructure> for super::UserDefinedStructure {
7019    type Error = String;
7020
7021    fn try_from(value: UserDefinedStructure) -> Result<Self, String> {
7022      Ok(Self {
7023        alias: value.alias?,
7024        aliases: value.aliases?,
7025        filter: value.filter?,
7026        index: value.index?,
7027        index_routing: value.index_routing?,
7028        indices: value.indices?,
7029        is_hidden: value.is_hidden?,
7030        is_write_index: value.is_write_index?,
7031        must_exist: value.must_exist?,
7032        routing: value.routing?,
7033        search_routing: value.search_routing?,
7034      })
7035    }
7036  }
7037
7038  impl From<super::UserDefinedStructure> for UserDefinedStructure {
7039    fn from(value: super::UserDefinedStructure) -> Self {
7040      Self {
7041        alias: Ok(value.alias),
7042        aliases: Ok(value.aliases),
7043        filter: Ok(value.filter),
7044        index: Ok(value.index),
7045        index_routing: Ok(value.index_routing),
7046        indices: Ok(value.indices),
7047        is_hidden: Ok(value.is_hidden),
7048        is_write_index: Ok(value.is_write_index),
7049        must_exist: Ok(value.must_exist),
7050        routing: Ok(value.routing),
7051        search_routing: Ok(value.search_routing),
7052      }
7053    }
7054  }
7055}
7056
7057#[derive(Serialize, Deserialize, Debug)]
7058pub struct DocumentDeleteResponse {
7059  #[serde(rename = "_index")]
7060  pub index: String,
7061  #[serde(rename = "_id")]
7062  pub id: String,
7063  #[serde(rename = "_version")]
7064  pub version: u32,
7065  pub result: String,
7066  #[serde(rename = "_shards")]
7067  pub shards: ShardStatistics,
7068  #[serde(rename = "_seq_no")]
7069  pub seq_no: u32,
7070  #[serde(rename = "_primary_term")]
7071  pub primary_term: u32,
7072}