Skip to main content

oxsearch_core/generated/
mod.rs

1// Generated by `cargo run -p xtask -- generate` from elastic/elasticsearch-specification 9.5 at
2// 84bf510a907bae62ffe29af35f516af287a79eab. Don't edit it: change the generator.
3
4#![allow(
5    missing_docs,
6    non_camel_case_types,
7    non_snake_case,
8    deprecated,
9    dead_code,
10    unused_imports,
11    clippy::all,
12    rustdoc::all
13)]
14
15pub mod aggregations;
16pub mod analysis;
17pub mod bulk;
18pub mod cluster;
19pub mod indices;
20pub mod inference;
21pub mod info;
22pub mod mapping;
23pub mod ping;
24pub mod query_dsl;
25pub mod search;
26pub mod spec_utils;
27
28#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
29#[non_exhaustive]
30pub struct AcknowledgedResponseBase {
31    /// For a successful response, this value is always true. On failure, an exception is returned instead.
32    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
33    pub acknowledged: ::core::option::Option<bool>,
34}
35
36impl AcknowledgedResponseBase {
37    /// A `AcknowledgedResponseBase` with its required properties set.
38    pub fn new(acknowledged: bool) -> Self {
39        Self {
40            acknowledged: ::core::option::Option::Some(acknowledged.into()),
41        }
42    }
43}
44
45impl AcknowledgedResponseBase {}
46
47/// The aggregation name as returned from the server. Depending whether typed_keys is specified this could come back
48/// in the form of `name#type` instead of simply `name`
49pub type AggregateName = ::std::string::String;
50
51#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
52#[non_exhaustive]
53pub struct BulkIndexByScrollFailure {
54    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
55    pub cause: ::core::option::Option<crate::ErrorCause>,
56    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
57    pub id: ::core::option::Option<crate::Id>,
58    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
59    pub index: ::core::option::Option<crate::IndexName>,
60    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
61    pub status: ::core::option::Option<i32>,
62}
63
64impl BulkIndexByScrollFailure {
65    /// A `BulkIndexByScrollFailure` with its required properties set.
66    pub fn new(
67        cause: impl ::core::convert::Into<crate::ErrorCause>,
68        id: impl ::core::convert::Into<crate::Id>,
69        index: impl ::core::convert::Into<crate::IndexName>,
70        status: i32,
71    ) -> Self {
72        Self {
73            cause: ::core::option::Option::Some(cause.into()),
74            id: ::core::option::Option::Some(id.into()),
75            index: ::core::option::Option::Some(index.into()),
76            status: ::core::option::Option::Some(status.into()),
77        }
78    }
79}
80
81impl BulkIndexByScrollFailure {}
82
83#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
84#[non_exhaustive]
85pub struct BulkStats {
86    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
87    pub total_operations: ::core::option::Option<i64>,
88    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
89    pub total_time: ::core::option::Option<crate::Duration>,
90    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
91    pub total_time_in_millis: ::core::option::Option<crate::UnitMillis>,
92    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
93    pub total_size: ::core::option::Option<crate::ByteSize>,
94    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
95    pub total_size_in_bytes: ::core::option::Option<i64>,
96    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
97    pub avg_time: ::core::option::Option<crate::Duration>,
98    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
99    pub avg_time_in_millis: ::core::option::Option<crate::UnitMillis>,
100    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
101    pub avg_size: ::core::option::Option<crate::ByteSize>,
102    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
103    pub avg_size_in_bytes: ::core::option::Option<i64>,
104}
105
106impl BulkStats {
107    /// A `BulkStats` with its required properties set.
108    pub fn new(
109        total_operations: i64,
110        total_time_in_millis: impl ::core::convert::Into<crate::UnitMillis>,
111        total_size_in_bytes: i64,
112        avg_time_in_millis: impl ::core::convert::Into<crate::UnitMillis>,
113        avg_size_in_bytes: i64,
114    ) -> Self {
115        Self {
116            total_operations: ::core::option::Option::Some(total_operations.into()),
117            total_time: ::core::option::Option::None,
118            total_time_in_millis: ::core::option::Option::Some(total_time_in_millis.into()),
119            total_size: ::core::option::Option::None,
120            total_size_in_bytes: ::core::option::Option::Some(total_size_in_bytes.into()),
121            avg_time: ::core::option::Option::None,
122            avg_time_in_millis: ::core::option::Option::Some(avg_time_in_millis.into()),
123            avg_size: ::core::option::Option::None,
124            avg_size_in_bytes: ::core::option::Option::Some(avg_size_in_bytes.into()),
125        }
126    }
127}
128
129impl BulkStats {
130    /// Sets `total_time`.
131    pub fn total_time(mut self, value: impl ::core::convert::Into<crate::Duration>) -> Self {
132        self.total_time = ::core::option::Option::Some(value.into());
133        self
134    }
135    /// Sets `total_size`.
136    pub fn total_size(mut self, value: impl ::core::convert::Into<crate::ByteSize>) -> Self {
137        self.total_size = ::core::option::Option::Some(value.into());
138        self
139    }
140    /// Sets `avg_time`.
141    pub fn avg_time(mut self, value: impl ::core::convert::Into<crate::Duration>) -> Self {
142        self.avg_time = ::core::option::Option::Some(value.into());
143        self
144    }
145    /// Sets `avg_size`.
146    pub fn avg_size(mut self, value: impl ::core::convert::Into<crate::ByteSize>) -> Self {
147        self.avg_size = ::core::option::Option::Some(value.into());
148        self
149    }
150}
151
152#[derive(Clone, Debug, PartialEq)]
153#[non_exhaustive]
154pub enum ByteSize {
155    /// A number.
156    Long(i64),
157    /// A string.
158    String(::std::string::String),
159}
160
161impl ::serde::Serialize for ByteSize {
162    fn serialize<S__: ::serde::Serializer>(
163        &self,
164        serializer: S__,
165    ) -> ::core::result::Result<S__::Ok, S__::Error> {
166        match self {
167            Self::Long(value) => ::serde::Serialize::serialize(value, serializer),
168            Self::String(value) => ::serde::Serialize::serialize(value, serializer),
169        }
170    }
171}
172
173impl<'de> ::serde::Deserialize<'de> for ByteSize {
174    fn deserialize<D__: ::serde::Deserializer<'de>>(
175        deserializer: D__,
176    ) -> ::core::result::Result<Self, D__::Error> {
177        struct Shape;
178        impl<'de> ::oxsearch_core::__private::ByKind<'de> for Shape {
179            type Value = ByteSize;
180            const EXPECTING: &'static str = "ByteSize: number or string";
181            fn visit<V__: ::serde::Deserializer<'de>>(
182                self,
183                kind: ::oxsearch_core::__private::Kind,
184                value: V__,
185            ) -> ::core::result::Result<Self::Value, V__::Error> {
186                match kind {
187                    ::oxsearch_core::__private::Kind::Number => {
188                        <i64 as ::serde::Deserialize>::deserialize(value).map(ByteSize::Long)
189                    }
190                    ::oxsearch_core::__private::Kind::String => {
191                        <::std::string::String as ::serde::Deserialize>::deserialize(value)
192                            .map(ByteSize::String)
193                    }
194                    _ => ::core::result::Result::Err(<V__::Error as ::serde::de::Error>::custom(
195                        format_args!("ByteSize can't be {kind:?}"),
196                    )),
197                }
198            }
199        }
200        ::oxsearch_core::__private::deserialize_by_kind(deserializer, Shape)
201    }
202}
203
204impl ::core::convert::From<i64> for ByteSize {
205    fn from(value: i64) -> Self {
206        Self::Long(value)
207    }
208}
209
210impl ::core::convert::From<::std::string::String> for ByteSize {
211    fn from(value: ::std::string::String) -> Self {
212        Self::String(value)
213    }
214}
215
216impl ::core::convert::From<&str> for ByteSize {
217    fn from(value: &str) -> Self {
218        Self::String(::std::borrow::ToOwned::to_owned(value))
219    }
220}
221
222#[derive(Clone, Debug, PartialEq, Eq, Hash)]
223#[non_exhaustive]
224pub enum Bytes {
225    /// `b`
226    Bytes,
227    /// `kb`
228    KiloBytes,
229    /// `mb`
230    MegaBytes,
231    /// `gb`
232    GigaBytes,
233    /// `tb`
234    TeraBytes,
235    /// `pb`
236    PetaBytes,
237    /// A value this version of the specification doesn't list.
238    Raw(::std::string::String),
239}
240
241impl Bytes {
242    /// The value as Elasticsearch writes it.
243    pub fn as_str(&self) -> &str {
244        match self {
245            Self::Bytes => "b",
246            Self::KiloBytes => "kb",
247            Self::MegaBytes => "mb",
248            Self::GigaBytes => "gb",
249            Self::TeraBytes => "tb",
250            Self::PetaBytes => "pb",
251            Self::Raw(value) => value,
252        }
253    }
254
255    /// The listed value with this name, if there is one.
256    pub fn from_known(value: &str) -> ::core::option::Option<Self> {
257        match value {
258            "b" => ::core::option::Option::Some(Self::Bytes),
259            "kb" => ::core::option::Option::Some(Self::KiloBytes),
260            "mb" => ::core::option::Option::Some(Self::MegaBytes),
261            "gb" => ::core::option::Option::Some(Self::GigaBytes),
262            "tb" => ::core::option::Option::Some(Self::TeraBytes),
263            "pb" => ::core::option::Option::Some(Self::PetaBytes),
264            _ => ::core::option::Option::None,
265        }
266    }
267}
268
269impl ::serde::Serialize for Bytes {
270    fn serialize<S__: ::serde::Serializer>(
271        &self,
272        serializer: S__,
273    ) -> ::core::result::Result<S__::Ok, S__::Error> {
274        serializer.serialize_str(self.as_str())
275    }
276}
277
278impl<'de> ::serde::Deserialize<'de> for Bytes {
279    fn deserialize<D__: ::serde::Deserializer<'de>>(
280        deserializer: D__,
281    ) -> ::core::result::Result<Self, D__::Error> {
282        ::oxsearch_core::__private::deserialize_string_enum(deserializer, "Bytes", |value| {
283            Self::from_known(value).unwrap_or_else(|| Self::Raw(value.to_owned()))
284        })
285    }
286}
287
288#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
289#[non_exhaustive]
290pub struct CartesianPoint {
291    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
292    pub x: ::core::option::Option<f64>,
293    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
294    pub y: ::core::option::Option<f64>,
295}
296
297impl CartesianPoint {
298    /// A `CartesianPoint` with its required properties set.
299    pub fn new(x: f64, y: f64) -> Self {
300        Self {
301            x: ::core::option::Option::Some(x.into()),
302            y: ::core::option::Option::Some(y.into()),
303        }
304    }
305}
306
307impl CartesianPoint {}
308
309pub type CategoryId = i64;
310
311#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
312#[non_exhaustive]
313pub struct ChunkRescorer {
314    /// The number of chunks per document to evaluate for reranking.
315    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
316    pub size: ::core::option::Option<i32>,
317    /// Chunking settings to apply
318    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
319    pub chunking_settings: ::core::option::Option<crate::mapping::ChunkRescorerChunkingSettings>,
320}
321
322impl ChunkRescorer {
323    /// A `ChunkRescorer` with its required properties set.
324    pub fn new() -> Self {
325        Self {
326            size: ::core::option::Option::None,
327            chunking_settings: ::core::option::Option::None,
328        }
329    }
330}
331
332impl ChunkRescorer {
333    /// Sets `size`.
334    pub fn size(mut self, value: i32) -> Self {
335        self.size = ::core::option::Option::Some(value.into());
336        self
337    }
338    /// Sets `chunking_settings`.
339    pub fn chunking_settings(
340        mut self,
341        value: impl ::core::convert::Into<crate::mapping::ChunkRescorerChunkingSettings>,
342    ) -> Self {
343        self.chunking_settings = ::core::option::Option::Some(value.into());
344        self
345    }
346}
347
348pub type ClusterAlias = ::std::string::String;
349
350#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
351#[non_exhaustive]
352pub struct ClusterDetails {
353    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
354    pub status: ::core::option::Option<crate::ClusterSearchStatus>,
355    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
356    pub indices: ::core::option::Option<::std::string::String>,
357    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
358    pub took: ::core::option::Option<crate::UnitMillis>,
359    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
360    pub timed_out: ::core::option::Option<bool>,
361    #[serde(
362        rename = "_shards",
363        skip_serializing_if = "::core::option::Option::is_none"
364    )]
365    pub shards: ::core::option::Option<crate::ShardStatistics>,
366    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
367    pub failures: ::core::option::Option<::std::vec::Vec<crate::ShardFailure>>,
368}
369
370impl ClusterDetails {
371    /// A `ClusterDetails` with its required properties set.
372    pub fn new(
373        status: impl ::core::convert::Into<crate::ClusterSearchStatus>,
374        indices: impl ::core::convert::Into<::std::string::String>,
375        timed_out: bool,
376    ) -> Self {
377        Self {
378            status: ::core::option::Option::Some(status.into()),
379            indices: ::core::option::Option::Some(indices.into()),
380            took: ::core::option::Option::None,
381            timed_out: ::core::option::Option::Some(timed_out.into()),
382            shards: ::core::option::Option::None,
383            failures: ::core::option::Option::None,
384        }
385    }
386}
387
388impl ClusterDetails {
389    /// Sets `took`.
390    pub fn took(mut self, value: impl ::core::convert::Into<crate::UnitMillis>) -> Self {
391        self.took = ::core::option::Option::Some(value.into());
392        self
393    }
394    /// Sets `shards`.
395    pub fn shards(mut self, value: impl ::core::convert::Into<crate::ShardStatistics>) -> Self {
396        self.shards = ::core::option::Option::Some(value.into());
397        self
398    }
399    /// Sets `failures`.
400    pub fn failures(
401        mut self,
402        value: impl ::core::convert::Into<::std::vec::Vec<crate::ShardFailure>>,
403    ) -> Self {
404        self.failures = ::core::option::Option::Some(value.into());
405        self
406    }
407}
408
409#[derive(Clone, Debug, PartialEq, Eq, Hash)]
410#[non_exhaustive]
411pub enum ClusterInfoTarget {
412    /// `_all`
413    All,
414    /// `http`
415    Http,
416    /// `ingest`
417    Ingest,
418    /// `thread_pool`
419    ThreadPool,
420    /// `script`
421    Script,
422    /// A value this version of the specification doesn't list.
423    Raw(::std::string::String),
424}
425
426impl ClusterInfoTarget {
427    /// The value as Elasticsearch writes it.
428    pub fn as_str(&self) -> &str {
429        match self {
430            Self::All => "_all",
431            Self::Http => "http",
432            Self::Ingest => "ingest",
433            Self::ThreadPool => "thread_pool",
434            Self::Script => "script",
435            Self::Raw(value) => value,
436        }
437    }
438
439    /// The listed value with this name, if there is one.
440    pub fn from_known(value: &str) -> ::core::option::Option<Self> {
441        match value {
442            "_all" => ::core::option::Option::Some(Self::All),
443            "http" => ::core::option::Option::Some(Self::Http),
444            "ingest" => ::core::option::Option::Some(Self::Ingest),
445            "thread_pool" => ::core::option::Option::Some(Self::ThreadPool),
446            "script" => ::core::option::Option::Some(Self::Script),
447            _ => ::core::option::Option::None,
448        }
449    }
450}
451
452impl ::serde::Serialize for ClusterInfoTarget {
453    fn serialize<S__: ::serde::Serializer>(
454        &self,
455        serializer: S__,
456    ) -> ::core::result::Result<S__::Ok, S__::Error> {
457        serializer.serialize_str(self.as_str())
458    }
459}
460
461impl<'de> ::serde::Deserialize<'de> for ClusterInfoTarget {
462    fn deserialize<D__: ::serde::Deserializer<'de>>(
463        deserializer: D__,
464    ) -> ::core::result::Result<Self, D__::Error> {
465        ::oxsearch_core::__private::deserialize_string_enum(
466            deserializer,
467            "ClusterInfoTarget",
468            |value| Self::from_known(value).unwrap_or_else(|| Self::Raw(value.to_owned())),
469        )
470    }
471}
472
473pub type ClusterInfoTargets = ::oxsearch_core::shapes::OneOrMany<crate::ClusterInfoTarget>;
474
475#[derive(Clone, Debug, PartialEq, Eq, Hash)]
476#[non_exhaustive]
477pub enum ClusterSearchStatus {
478    /// `running`
479    Running,
480    /// `successful`
481    Successful,
482    /// `partial`
483    Partial,
484    /// `skipped`
485    Skipped,
486    /// `failed`
487    Failed,
488    /// A value this version of the specification doesn't list.
489    Raw(::std::string::String),
490}
491
492impl ClusterSearchStatus {
493    /// The value as Elasticsearch writes it.
494    pub fn as_str(&self) -> &str {
495        match self {
496            Self::Running => "running",
497            Self::Successful => "successful",
498            Self::Partial => "partial",
499            Self::Skipped => "skipped",
500            Self::Failed => "failed",
501            Self::Raw(value) => value,
502        }
503    }
504
505    /// The listed value with this name, if there is one.
506    pub fn from_known(value: &str) -> ::core::option::Option<Self> {
507        match value {
508            "running" => ::core::option::Option::Some(Self::Running),
509            "successful" => ::core::option::Option::Some(Self::Successful),
510            "partial" => ::core::option::Option::Some(Self::Partial),
511            "skipped" => ::core::option::Option::Some(Self::Skipped),
512            "failed" => ::core::option::Option::Some(Self::Failed),
513            _ => ::core::option::Option::None,
514        }
515    }
516}
517
518impl ::serde::Serialize for ClusterSearchStatus {
519    fn serialize<S__: ::serde::Serializer>(
520        &self,
521        serializer: S__,
522    ) -> ::core::result::Result<S__::Ok, S__::Error> {
523        serializer.serialize_str(self.as_str())
524    }
525}
526
527impl<'de> ::serde::Deserialize<'de> for ClusterSearchStatus {
528    fn deserialize<D__: ::serde::Deserializer<'de>>(
529        deserializer: D__,
530    ) -> ::core::result::Result<Self, D__::Error> {
531        ::oxsearch_core::__private::deserialize_string_enum(
532            deserializer,
533            "ClusterSearchStatus",
534            |value| Self::from_known(value).unwrap_or_else(|| Self::Raw(value.to_owned())),
535        )
536    }
537}
538
539#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
540#[non_exhaustive]
541pub struct ClusterStatistics {
542    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
543    pub skipped: ::core::option::Option<i32>,
544    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
545    pub successful: ::core::option::Option<i32>,
546    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
547    pub total: ::core::option::Option<i32>,
548    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
549    pub running: ::core::option::Option<i32>,
550    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
551    pub partial: ::core::option::Option<i32>,
552    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
553    pub failed: ::core::option::Option<i32>,
554    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
555    pub details:
556        ::core::option::Option<::indexmap::IndexMap<crate::ClusterAlias, crate::ClusterDetails>>,
557}
558
559impl ClusterStatistics {
560    /// A `ClusterStatistics` with its required properties set.
561    pub fn new(
562        skipped: i32,
563        successful: i32,
564        total: i32,
565        running: i32,
566        partial: i32,
567        failed: i32,
568    ) -> Self {
569        Self {
570            skipped: ::core::option::Option::Some(skipped.into()),
571            successful: ::core::option::Option::Some(successful.into()),
572            total: ::core::option::Option::Some(total.into()),
573            running: ::core::option::Option::Some(running.into()),
574            partial: ::core::option::Option::Some(partial.into()),
575            failed: ::core::option::Option::Some(failed.into()),
576            details: ::core::option::Option::None,
577        }
578    }
579}
580
581impl ClusterStatistics {
582    /// Sets `details`.
583    pub fn details(
584        mut self,
585        value: impl ::core::convert::Into<
586            ::indexmap::IndexMap<crate::ClusterAlias, crate::ClusterDetails>,
587        >,
588    ) -> Self {
589        self.details = ::core::option::Option::Some(value.into());
590        self
591    }
592}
593
594#[derive(Clone, Debug, PartialEq, Eq, Hash)]
595#[non_exhaustive]
596pub enum CommonStatsFlag {
597    /// Return all statistics.
598    All,
599    /// Size of the index in byte units.
600    Store,
601    /// Indexing statistics.
602    Indexing,
603    /// Get statistics, including missing stats.
604    Get,
605    /// Search statistics including suggest statistics.
606    /// You can include statistics for custom groups by adding an extra `groups` parameter
607    /// (search operations can be associated with one or more groups).
608    /// The `groups` parameter accepts a comma-separated list of group names.
609    /// Use `_all` to return statistics for all groups.
610    Search,
611    /// Merge statistics.
612    Merge,
613    /// Flush statistics.
614    Flush,
615    /// Refresh statistics.
616    Refresh,
617    /// Query cache statistics.
618    QueryCache,
619    /// Fielddata statistics.
620    Fielddata,
621    /// Number of documents and deleted docs not yet merged out. Index refreshes can affect this statistic.
622    Docs,
623    /// Index warming statistics.
624    Warmer,
625    /// Completion suggester statistics.
626    Completion,
627    /// Memory use of all open segments.
628    /// If the `include_segment_file_sizes` parameter is `true`, this metric includes the aggregated disk usage of each Lucene index file.
629    Segments,
630    /// Translog statistics.
631    Translog,
632    /// Shard request cache statistics.
633    RequestCache,
634    /// Recovery statistics.
635    Recovery,
636    /// Bulk operations statistics.
637    Bulk,
638    /// Shard statistics, including the total number of shards.
639    ShardStats,
640    /// Mapping statistics, including the total count and estimated overhead.
641    Mappings,
642    /// Total number of dense vectors indexed. Index refreshes can affect this statistic.
643    DenseVector,
644    /// Total number of sparse vectors indexed. Index refreshes can affect this statistic.
645    SparseVector,
646    /// A value this version of the specification doesn't list.
647    Raw(::std::string::String),
648}
649
650impl CommonStatsFlag {
651    /// The value as Elasticsearch writes it.
652    pub fn as_str(&self) -> &str {
653        match self {
654            Self::All => "_all",
655            Self::Store => "store",
656            Self::Indexing => "indexing",
657            Self::Get => "get",
658            Self::Search => "search",
659            Self::Merge => "merge",
660            Self::Flush => "flush",
661            Self::Refresh => "refresh",
662            Self::QueryCache => "query_cache",
663            Self::Fielddata => "fielddata",
664            Self::Docs => "docs",
665            Self::Warmer => "warmer",
666            Self::Completion => "completion",
667            Self::Segments => "segments",
668            Self::Translog => "translog",
669            Self::RequestCache => "request_cache",
670            Self::Recovery => "recovery",
671            Self::Bulk => "bulk",
672            Self::ShardStats => "shard_stats",
673            Self::Mappings => "mappings",
674            Self::DenseVector => "dense_vector",
675            Self::SparseVector => "sparse_vector",
676            Self::Raw(value) => value,
677        }
678    }
679
680    /// The listed value with this name, if there is one.
681    pub fn from_known(value: &str) -> ::core::option::Option<Self> {
682        match value {
683            "_all" => ::core::option::Option::Some(Self::All),
684            "store" => ::core::option::Option::Some(Self::Store),
685            "indexing" => ::core::option::Option::Some(Self::Indexing),
686            "get" => ::core::option::Option::Some(Self::Get),
687            "search" => ::core::option::Option::Some(Self::Search),
688            "merge" => ::core::option::Option::Some(Self::Merge),
689            "flush" => ::core::option::Option::Some(Self::Flush),
690            "refresh" => ::core::option::Option::Some(Self::Refresh),
691            "query_cache" => ::core::option::Option::Some(Self::QueryCache),
692            "fielddata" => ::core::option::Option::Some(Self::Fielddata),
693            "docs" => ::core::option::Option::Some(Self::Docs),
694            "warmer" => ::core::option::Option::Some(Self::Warmer),
695            "completion" => ::core::option::Option::Some(Self::Completion),
696            "segments" => ::core::option::Option::Some(Self::Segments),
697            "translog" => ::core::option::Option::Some(Self::Translog),
698            "request_cache" => ::core::option::Option::Some(Self::RequestCache),
699            "recovery" => ::core::option::Option::Some(Self::Recovery),
700            "bulk" => ::core::option::Option::Some(Self::Bulk),
701            "shard_stats" => ::core::option::Option::Some(Self::ShardStats),
702            "mappings" => ::core::option::Option::Some(Self::Mappings),
703            "dense_vector" => ::core::option::Option::Some(Self::DenseVector),
704            "sparse_vector" => ::core::option::Option::Some(Self::SparseVector),
705            _ => ::core::option::Option::None,
706        }
707    }
708}
709
710impl ::serde::Serialize for CommonStatsFlag {
711    fn serialize<S__: ::serde::Serializer>(
712        &self,
713        serializer: S__,
714    ) -> ::core::result::Result<S__::Ok, S__::Error> {
715        serializer.serialize_str(self.as_str())
716    }
717}
718
719impl<'de> ::serde::Deserialize<'de> for CommonStatsFlag {
720    fn deserialize<D__: ::serde::Deserializer<'de>>(
721        deserializer: D__,
722    ) -> ::core::result::Result<Self, D__::Error> {
723        ::oxsearch_core::__private::deserialize_string_enum(
724            deserializer,
725            "CommonStatsFlag",
726            |value| Self::from_known(value).unwrap_or_else(|| Self::Raw(value.to_owned())),
727        )
728    }
729}
730
731pub type CommonStatsFlags = ::oxsearch_core::shapes::OneOrMany<crate::CommonStatsFlag>;
732
733#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
734#[non_exhaustive]
735pub struct CompletionStats {
736    /// Total amount, in bytes, of memory used for completion across all shards assigned to selected nodes.
737    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
738    pub size_in_bytes: ::core::option::Option<i64>,
739    /// Total amount of memory used for completion across all shards assigned to selected nodes.
740    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
741    pub size: ::core::option::Option<crate::ByteSize>,
742    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
743    pub fields: ::core::option::Option<::indexmap::IndexMap<crate::Field, crate::FieldSizeUsage>>,
744}
745
746impl CompletionStats {
747    /// A `CompletionStats` with its required properties set.
748    pub fn new(size_in_bytes: i64) -> Self {
749        Self {
750            size_in_bytes: ::core::option::Option::Some(size_in_bytes.into()),
751            size: ::core::option::Option::None,
752            fields: ::core::option::Option::None,
753        }
754    }
755}
756
757impl CompletionStats {
758    /// Sets `size`.
759    pub fn size(mut self, value: impl ::core::convert::Into<crate::ByteSize>) -> Self {
760        self.size = ::core::option::Option::Some(value.into());
761        self
762    }
763    /// Sets `fields`.
764    pub fn fields(
765        mut self,
766        value: impl ::core::convert::Into<::indexmap::IndexMap<crate::Field, crate::FieldSizeUsage>>,
767    ) -> Self {
768        self.fields = ::core::option::Option::Some(value.into());
769        self
770    }
771}
772
773#[derive(Clone, Debug, PartialEq, Eq, Hash)]
774#[non_exhaustive]
775pub enum Conflicts {
776    /// Stop reindexing if there are conflicts.
777    Abort,
778    /// Continue reindexing even if there are conflicts.
779    Proceed,
780    /// A value this version of the specification doesn't list.
781    Raw(::std::string::String),
782}
783
784impl Conflicts {
785    /// The value as Elasticsearch writes it.
786    pub fn as_str(&self) -> &str {
787        match self {
788            Self::Abort => "abort",
789            Self::Proceed => "proceed",
790            Self::Raw(value) => value,
791        }
792    }
793
794    /// The listed value with this name, if there is one.
795    pub fn from_known(value: &str) -> ::core::option::Option<Self> {
796        match value {
797            "abort" => ::core::option::Option::Some(Self::Abort),
798            "proceed" => ::core::option::Option::Some(Self::Proceed),
799            _ => ::core::option::Option::None,
800        }
801    }
802}
803
804impl ::serde::Serialize for Conflicts {
805    fn serialize<S__: ::serde::Serializer>(
806        &self,
807        serializer: S__,
808    ) -> ::core::result::Result<S__::Ok, S__::Error> {
809        serializer.serialize_str(self.as_str())
810    }
811}
812
813impl<'de> ::serde::Deserialize<'de> for Conflicts {
814    fn deserialize<D__: ::serde::Deserializer<'de>>(
815        deserializer: D__,
816    ) -> ::core::result::Result<Self, D__::Error> {
817        ::oxsearch_core::__private::deserialize_string_enum(deserializer, "Conflicts", |value| {
818            Self::from_known(value).unwrap_or_else(|| Self::Raw(value.to_owned()))
819        })
820    }
821}
822
823#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
824#[non_exhaustive]
825pub struct CoordsGeoBounds {
826    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
827    pub top: ::core::option::Option<f64>,
828    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
829    pub bottom: ::core::option::Option<f64>,
830    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
831    pub left: ::core::option::Option<f64>,
832    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
833    pub right: ::core::option::Option<f64>,
834}
835
836impl CoordsGeoBounds {
837    /// A `CoordsGeoBounds` with its required properties set.
838    pub fn new(top: f64, bottom: f64, left: f64, right: f64) -> Self {
839        Self {
840            top: ::core::option::Option::Some(top.into()),
841            bottom: ::core::option::Option::Some(bottom.into()),
842            left: ::core::option::Option::Some(left.into()),
843            right: ::core::option::Option::Some(right.into()),
844        }
845    }
846}
847
848impl CoordsGeoBounds {}
849
850#[derive(Clone, Debug, PartialEq, Eq, Hash)]
851#[non_exhaustive]
852pub enum DFIIndependenceMeasure {
853    /// `standardized`
854    Standardized,
855    /// `saturated`
856    Saturated,
857    /// `chisquared`
858    Chisquared,
859    /// A value this version of the specification doesn't list.
860    Raw(::std::string::String),
861}
862
863impl DFIIndependenceMeasure {
864    /// The value as Elasticsearch writes it.
865    pub fn as_str(&self) -> &str {
866        match self {
867            Self::Standardized => "standardized",
868            Self::Saturated => "saturated",
869            Self::Chisquared => "chisquared",
870            Self::Raw(value) => value,
871        }
872    }
873
874    /// The listed value with this name, if there is one.
875    pub fn from_known(value: &str) -> ::core::option::Option<Self> {
876        match value {
877            "standardized" => ::core::option::Option::Some(Self::Standardized),
878            "saturated" => ::core::option::Option::Some(Self::Saturated),
879            "chisquared" => ::core::option::Option::Some(Self::Chisquared),
880            _ => ::core::option::Option::None,
881        }
882    }
883}
884
885impl ::serde::Serialize for DFIIndependenceMeasure {
886    fn serialize<S__: ::serde::Serializer>(
887        &self,
888        serializer: S__,
889    ) -> ::core::result::Result<S__::Ok, S__::Error> {
890        serializer.serialize_str(self.as_str())
891    }
892}
893
894impl<'de> ::serde::Deserialize<'de> for DFIIndependenceMeasure {
895    fn deserialize<D__: ::serde::Deserializer<'de>>(
896        deserializer: D__,
897    ) -> ::core::result::Result<Self, D__::Error> {
898        ::oxsearch_core::__private::deserialize_string_enum(
899            deserializer,
900            "DFIIndependenceMeasure",
901            |value| Self::from_known(value).unwrap_or_else(|| Self::Raw(value.to_owned())),
902        )
903    }
904}
905
906#[derive(Clone, Debug, PartialEq, Eq, Hash)]
907#[non_exhaustive]
908pub enum DFRAfterEffect {
909    /// `no`
910    No,
911    /// `b`
912    B,
913    /// `l`
914    L,
915    /// A value this version of the specification doesn't list.
916    Raw(::std::string::String),
917}
918
919impl DFRAfterEffect {
920    /// The value as Elasticsearch writes it.
921    pub fn as_str(&self) -> &str {
922        match self {
923            Self::No => "no",
924            Self::B => "b",
925            Self::L => "l",
926            Self::Raw(value) => value,
927        }
928    }
929
930    /// The listed value with this name, if there is one.
931    pub fn from_known(value: &str) -> ::core::option::Option<Self> {
932        match value {
933            "no" => ::core::option::Option::Some(Self::No),
934            "b" => ::core::option::Option::Some(Self::B),
935            "l" => ::core::option::Option::Some(Self::L),
936            _ => ::core::option::Option::None,
937        }
938    }
939}
940
941impl ::serde::Serialize for DFRAfterEffect {
942    fn serialize<S__: ::serde::Serializer>(
943        &self,
944        serializer: S__,
945    ) -> ::core::result::Result<S__::Ok, S__::Error> {
946        serializer.serialize_str(self.as_str())
947    }
948}
949
950impl<'de> ::serde::Deserialize<'de> for DFRAfterEffect {
951    fn deserialize<D__: ::serde::Deserializer<'de>>(
952        deserializer: D__,
953    ) -> ::core::result::Result<Self, D__::Error> {
954        ::oxsearch_core::__private::deserialize_string_enum(
955            deserializer,
956            "DFRAfterEffect",
957            |value| Self::from_known(value).unwrap_or_else(|| Self::Raw(value.to_owned())),
958        )
959    }
960}
961
962#[derive(Clone, Debug, PartialEq, Eq, Hash)]
963#[non_exhaustive]
964pub enum DFRBasicModel {
965    /// `be`
966    Be,
967    /// `d`
968    D,
969    /// `g`
970    G,
971    /// `if`
972    If,
973    /// `in`
974    In,
975    /// `ine`
976    Ine,
977    /// `p`
978    P,
979    /// A value this version of the specification doesn't list.
980    Raw(::std::string::String),
981}
982
983impl DFRBasicModel {
984    /// The value as Elasticsearch writes it.
985    pub fn as_str(&self) -> &str {
986        match self {
987            Self::Be => "be",
988            Self::D => "d",
989            Self::G => "g",
990            Self::If => "if",
991            Self::In => "in",
992            Self::Ine => "ine",
993            Self::P => "p",
994            Self::Raw(value) => value,
995        }
996    }
997
998    /// The listed value with this name, if there is one.
999    pub fn from_known(value: &str) -> ::core::option::Option<Self> {
1000        match value {
1001            "be" => ::core::option::Option::Some(Self::Be),
1002            "d" => ::core::option::Option::Some(Self::D),
1003            "g" => ::core::option::Option::Some(Self::G),
1004            "if" => ::core::option::Option::Some(Self::If),
1005            "in" => ::core::option::Option::Some(Self::In),
1006            "ine" => ::core::option::Option::Some(Self::Ine),
1007            "p" => ::core::option::Option::Some(Self::P),
1008            _ => ::core::option::Option::None,
1009        }
1010    }
1011}
1012
1013impl ::serde::Serialize for DFRBasicModel {
1014    fn serialize<S__: ::serde::Serializer>(
1015        &self,
1016        serializer: S__,
1017    ) -> ::core::result::Result<S__::Ok, S__::Error> {
1018        serializer.serialize_str(self.as_str())
1019    }
1020}
1021
1022impl<'de> ::serde::Deserialize<'de> for DFRBasicModel {
1023    fn deserialize<D__: ::serde::Deserializer<'de>>(
1024        deserializer: D__,
1025    ) -> ::core::result::Result<Self, D__::Error> {
1026        ::oxsearch_core::__private::deserialize_string_enum(
1027            deserializer,
1028            "DFRBasicModel",
1029            |value| Self::from_known(value).unwrap_or_else(|| Self::Raw(value.to_owned())),
1030        )
1031    }
1032}
1033
1034pub type DataStreamName = ::std::string::String;
1035
1036pub type DataStreamNames = ::oxsearch_core::shapes::OneOrMany<crate::DataStreamName>;
1037
1038pub type DateFormat = ::std::string::String;
1039
1040pub type DateMath = ::std::string::String;
1041
1042/// A date and time, either as a string whose format can depend on the context (defaulting to ISO 8601), or a
1043/// number of milliseconds since the Epoch. Elasticsearch accepts both as input, but will generally output a string
1044/// representation.
1045#[derive(Clone, Debug, PartialEq)]
1046#[non_exhaustive]
1047pub enum DateTime {
1048    /// A string.
1049    String(::std::string::String),
1050    /// A number.
1051    EpochTime(crate::UnitMillis),
1052}
1053
1054impl ::serde::Serialize for DateTime {
1055    fn serialize<S__: ::serde::Serializer>(
1056        &self,
1057        serializer: S__,
1058    ) -> ::core::result::Result<S__::Ok, S__::Error> {
1059        match self {
1060            Self::String(value) => ::serde::Serialize::serialize(value, serializer),
1061            Self::EpochTime(value) => ::serde::Serialize::serialize(value, serializer),
1062        }
1063    }
1064}
1065
1066impl<'de> ::serde::Deserialize<'de> for DateTime {
1067    fn deserialize<D__: ::serde::Deserializer<'de>>(
1068        deserializer: D__,
1069    ) -> ::core::result::Result<Self, D__::Error> {
1070        struct Shape;
1071        impl<'de> ::oxsearch_core::__private::ByKind<'de> for Shape {
1072            type Value = DateTime;
1073            const EXPECTING: &'static str = "DateTime: number or string";
1074            fn visit<V__: ::serde::Deserializer<'de>>(
1075                self,
1076                kind: ::oxsearch_core::__private::Kind,
1077                value: V__,
1078            ) -> ::core::result::Result<Self::Value, V__::Error> {
1079                match kind {
1080                    ::oxsearch_core::__private::Kind::Number => {
1081                        <crate::UnitMillis as ::serde::Deserialize>::deserialize(value)
1082                            .map(DateTime::EpochTime)
1083                    }
1084                    ::oxsearch_core::__private::Kind::String => {
1085                        <::std::string::String as ::serde::Deserialize>::deserialize(value)
1086                            .map(DateTime::String)
1087                    }
1088                    _ => ::core::result::Result::Err(<V__::Error as ::serde::de::Error>::custom(
1089                        format_args!("DateTime can't be {kind:?}"),
1090                    )),
1091                }
1092            }
1093        }
1094        ::oxsearch_core::__private::deserialize_by_kind(deserializer, Shape)
1095    }
1096}
1097
1098impl ::core::convert::From<::std::string::String> for DateTime {
1099    fn from(value: ::std::string::String) -> Self {
1100        Self::String(value)
1101    }
1102}
1103
1104impl ::core::convert::From<crate::UnitMillis> for DateTime {
1105    fn from(value: crate::UnitMillis) -> Self {
1106        Self::EpochTime(value)
1107    }
1108}
1109
1110impl ::core::convert::From<&str> for DateTime {
1111    fn from(value: &str) -> Self {
1112        Self::String(::std::borrow::ToOwned::to_owned(value))
1113    }
1114}
1115
1116pub type Distance = ::std::string::String;
1117
1118#[derive(Clone, Debug, PartialEq, Eq, Hash)]
1119#[non_exhaustive]
1120pub enum DistanceUnit {
1121    /// `in`
1122    Inches,
1123    /// `ft`
1124    Feet,
1125    /// `yd`
1126    Yards,
1127    /// `mi`
1128    Miles,
1129    /// `nmi`
1130    NauticMiles,
1131    /// `km`
1132    Kilometers,
1133    /// `m`
1134    Meters,
1135    /// `cm`
1136    Centimeters,
1137    /// `mm`
1138    Millimeters,
1139    /// A value this version of the specification doesn't list.
1140    Raw(::std::string::String),
1141}
1142
1143impl DistanceUnit {
1144    /// The value as Elasticsearch writes it.
1145    pub fn as_str(&self) -> &str {
1146        match self {
1147            Self::Inches => "in",
1148            Self::Feet => "ft",
1149            Self::Yards => "yd",
1150            Self::Miles => "mi",
1151            Self::NauticMiles => "nmi",
1152            Self::Kilometers => "km",
1153            Self::Meters => "m",
1154            Self::Centimeters => "cm",
1155            Self::Millimeters => "mm",
1156            Self::Raw(value) => value,
1157        }
1158    }
1159
1160    /// The listed value with this name, if there is one.
1161    pub fn from_known(value: &str) -> ::core::option::Option<Self> {
1162        match value {
1163            "in" => ::core::option::Option::Some(Self::Inches),
1164            "ft" => ::core::option::Option::Some(Self::Feet),
1165            "yd" => ::core::option::Option::Some(Self::Yards),
1166            "mi" => ::core::option::Option::Some(Self::Miles),
1167            "nmi" => ::core::option::Option::Some(Self::NauticMiles),
1168            "km" => ::core::option::Option::Some(Self::Kilometers),
1169            "m" => ::core::option::Option::Some(Self::Meters),
1170            "cm" => ::core::option::Option::Some(Self::Centimeters),
1171            "mm" => ::core::option::Option::Some(Self::Millimeters),
1172            _ => ::core::option::Option::None,
1173        }
1174    }
1175}
1176
1177impl ::serde::Serialize for DistanceUnit {
1178    fn serialize<S__: ::serde::Serializer>(
1179        &self,
1180        serializer: S__,
1181    ) -> ::core::result::Result<S__::Ok, S__::Error> {
1182        serializer.serialize_str(self.as_str())
1183    }
1184}
1185
1186impl<'de> ::serde::Deserialize<'de> for DistanceUnit {
1187    fn deserialize<D__: ::serde::Deserializer<'de>>(
1188        deserializer: D__,
1189    ) -> ::core::result::Result<Self, D__::Error> {
1190        ::oxsearch_core::__private::deserialize_string_enum(deserializer, "DistanceUnit", |value| {
1191            Self::from_known(value).unwrap_or_else(|| Self::Raw(value.to_owned()))
1192        })
1193    }
1194}
1195
1196#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
1197#[non_exhaustive]
1198pub struct DiversifyRetriever {
1199    /// Query to filter the documents that can match.
1200    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
1201    pub filter: ::core::option::Option<
1202        ::oxsearch_core::shapes::OneOrMany<crate::query_dsl::QueryContainer>,
1203    >,
1204    /// Minimum _score for matching documents. Documents with a lower _score are not included in the top documents.
1205    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
1206    pub min_score: ::core::option::Option<f32>,
1207    /// Retriever name.
1208    #[serde(
1209        rename = "_name",
1210        skip_serializing_if = "::core::option::Option::is_none"
1211    )]
1212    pub name: ::core::option::Option<::std::string::String>,
1213    /// The diversification strategy to apply.
1214    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
1215    pub r#type: ::core::option::Option<crate::DiversifyRetrieverTypes>,
1216    /// The document field on which to diversify results on.
1217    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
1218    pub field: ::core::option::Option<::std::string::String>,
1219    /// The nested retriever whose results will be diversified.
1220    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
1221    pub retriever: ::core::option::Option<crate::RetrieverContainer>,
1222    /// The number of top documents to return after diversification.
1223    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
1224    pub size: ::core::option::Option<i32>,
1225    /// The number of top documents from the nested retriever to consider for diversification.
1226    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
1227    pub rank_window_size: ::core::option::Option<i32>,
1228    /// The query vector used for diversification.
1229    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
1230    pub query_vector: ::core::option::Option<crate::QueryVector>,
1231    /// a dense vector query vector builder to use instead of a static query_vector
1232    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
1233    pub query_vector_builder: ::core::option::Option<crate::QueryVectorBuilder>,
1234    /// Controls the trade-off between relevance and diversity for MMR. A value of 0.0 focuses solely on diversity, while a value of 1.0 focuses solely on relevance. Required for MMR
1235    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
1236    pub lambda: ::core::option::Option<f32>,
1237}
1238
1239impl DiversifyRetriever {
1240    /// A `DiversifyRetriever` with its required properties set.
1241    pub fn new(
1242        r#type: impl ::core::convert::Into<crate::DiversifyRetrieverTypes>,
1243        field: impl ::core::convert::Into<::std::string::String>,
1244        retriever: impl ::core::convert::Into<crate::RetrieverContainer>,
1245    ) -> Self {
1246        Self {
1247            filter: ::core::option::Option::None,
1248            min_score: ::core::option::Option::None,
1249            name: ::core::option::Option::None,
1250            r#type: ::core::option::Option::Some(r#type.into()),
1251            field: ::core::option::Option::Some(field.into()),
1252            retriever: ::core::option::Option::Some(retriever.into()),
1253            size: ::core::option::Option::None,
1254            rank_window_size: ::core::option::Option::None,
1255            query_vector: ::core::option::Option::None,
1256            query_vector_builder: ::core::option::Option::None,
1257            lambda: ::core::option::Option::None,
1258        }
1259    }
1260}
1261
1262impl DiversifyRetriever {
1263    /// Sets `filter`.
1264    pub fn filter(
1265        mut self,
1266        value: impl ::core::convert::Into<
1267            ::oxsearch_core::shapes::OneOrMany<crate::query_dsl::QueryContainer>,
1268        >,
1269    ) -> Self {
1270        self.filter = ::core::option::Option::Some(value.into());
1271        self
1272    }
1273    /// Sets `min_score`.
1274    pub fn min_score(mut self, value: f32) -> Self {
1275        self.min_score = ::core::option::Option::Some(value.into());
1276        self
1277    }
1278    /// Sets `name`.
1279    pub fn name(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
1280        self.name = ::core::option::Option::Some(value.into());
1281        self
1282    }
1283    /// Sets `size`.
1284    pub fn size(mut self, value: i32) -> Self {
1285        self.size = ::core::option::Option::Some(value.into());
1286        self
1287    }
1288    /// Sets `rank_window_size`.
1289    pub fn rank_window_size(mut self, value: i32) -> Self {
1290        self.rank_window_size = ::core::option::Option::Some(value.into());
1291        self
1292    }
1293    /// Sets `query_vector`.
1294    pub fn query_vector(mut self, value: impl ::core::convert::Into<crate::QueryVector>) -> Self {
1295        self.query_vector = ::core::option::Option::Some(value.into());
1296        self
1297    }
1298    /// Sets `query_vector_builder`.
1299    pub fn query_vector_builder(
1300        mut self,
1301        value: impl ::core::convert::Into<crate::QueryVectorBuilder>,
1302    ) -> Self {
1303        self.query_vector_builder = ::core::option::Option::Some(value.into());
1304        self
1305    }
1306    /// Sets `lambda`.
1307    pub fn lambda(mut self, value: f32) -> Self {
1308        self.lambda = ::core::option::Option::Some(value.into());
1309        self
1310    }
1311}
1312
1313#[derive(Clone, Debug, PartialEq, Eq, Hash)]
1314#[non_exhaustive]
1315pub enum DiversifyRetrieverTypes {
1316    /// `mmr`
1317    Mmr,
1318    /// A value this version of the specification doesn't list.
1319    Raw(::std::string::String),
1320}
1321
1322impl DiversifyRetrieverTypes {
1323    /// The value as Elasticsearch writes it.
1324    pub fn as_str(&self) -> &str {
1325        match self {
1326            Self::Mmr => "mmr",
1327            Self::Raw(value) => value,
1328        }
1329    }
1330
1331    /// The listed value with this name, if there is one.
1332    pub fn from_known(value: &str) -> ::core::option::Option<Self> {
1333        match value {
1334            "mmr" => ::core::option::Option::Some(Self::Mmr),
1335            _ => ::core::option::Option::None,
1336        }
1337    }
1338}
1339
1340impl ::serde::Serialize for DiversifyRetrieverTypes {
1341    fn serialize<S__: ::serde::Serializer>(
1342        &self,
1343        serializer: S__,
1344    ) -> ::core::result::Result<S__::Ok, S__::Error> {
1345        serializer.serialize_str(self.as_str())
1346    }
1347}
1348
1349impl<'de> ::serde::Deserialize<'de> for DiversifyRetrieverTypes {
1350    fn deserialize<D__: ::serde::Deserializer<'de>>(
1351        deserializer: D__,
1352    ) -> ::core::result::Result<Self, D__::Error> {
1353        ::oxsearch_core::__private::deserialize_string_enum(
1354            deserializer,
1355            "DiversifyRetrieverTypes",
1356            |value| Self::from_known(value).unwrap_or_else(|| Self::Raw(value.to_owned())),
1357        )
1358    }
1359}
1360
1361#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
1362#[non_exhaustive]
1363pub struct DocStats {
1364    /// Total number of non-deleted documents across all primary shards assigned to selected nodes.
1365    /// This number is based on documents in Lucene segments and may include documents from nested fields.
1366    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
1367    pub count: ::core::option::Option<i64>,
1368    /// Total number of deleted documents across all primary shards assigned to selected nodes.
1369    /// This number is based on documents in Lucene segments.
1370    /// Elasticsearch reclaims the disk space of deleted Lucene documents when a segment is merged.
1371    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
1372    pub deleted: ::core::option::Option<i64>,
1373    /// Returns the total size in bytes of all documents in this stats.
1374    /// This value may be more reliable than store_stats.size_in_bytes in estimating the index size.
1375    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
1376    pub total_size_in_bytes: ::core::option::Option<i64>,
1377    /// Human readable total_size_in_bytes
1378    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
1379    pub total_size: ::core::option::Option<crate::ByteSize>,
1380}
1381
1382impl DocStats {
1383    /// A `DocStats` with its required properties set.
1384    pub fn new(count: i64, total_size_in_bytes: i64) -> Self {
1385        Self {
1386            count: ::core::option::Option::Some(count.into()),
1387            deleted: ::core::option::Option::None,
1388            total_size_in_bytes: ::core::option::Option::Some(total_size_in_bytes.into()),
1389            total_size: ::core::option::Option::None,
1390        }
1391    }
1392}
1393
1394impl DocStats {
1395    /// Sets `deleted`.
1396    pub fn deleted(mut self, value: i64) -> Self {
1397        self.deleted = ::core::option::Option::Some(value.into());
1398        self
1399    }
1400    /// Sets `total_size`.
1401    pub fn total_size(mut self, value: impl ::core::convert::Into<crate::ByteSize>) -> Self {
1402        self.total_size = ::core::option::Option::Some(value.into());
1403        self
1404    }
1405}
1406
1407/// A duration. Units can be `nanos`, `micros`, `ms` (milliseconds), `s` (seconds), `m` (minutes), `h` (hours) and
1408/// `d` (days). Also accepts "0" without a unit and "-1" to indicate an unspecified value.
1409#[derive(Clone, Debug, PartialEq)]
1410#[non_exhaustive]
1411pub enum Duration {
1412    /// A string.
1413    String(::std::string::String),
1414    /// `-1`.
1415    MinusOne,
1416    /// `0`.
1417    Zero,
1418}
1419
1420impl ::serde::Serialize for Duration {
1421    fn serialize<S__: ::serde::Serializer>(
1422        &self,
1423        serializer: S__,
1424    ) -> ::core::result::Result<S__::Ok, S__::Error> {
1425        match self {
1426            Self::String(value) => ::serde::Serialize::serialize(value, serializer),
1427            Self::MinusOne => serializer.serialize_i64(-1),
1428            Self::Zero => serializer.serialize_i64(0),
1429        }
1430    }
1431}
1432
1433impl<'de> ::serde::Deserialize<'de> for Duration {
1434    fn deserialize<D__: ::serde::Deserializer<'de>>(
1435        deserializer: D__,
1436    ) -> ::core::result::Result<Self, D__::Error> {
1437        struct Shape;
1438        impl<'de> ::oxsearch_core::__private::ByKind<'de> for Shape {
1439            type Value = Duration;
1440            const EXPECTING: &'static str = "Duration: number or string";
1441            fn visit<V__: ::serde::Deserializer<'de>>(
1442                self,
1443                kind: ::oxsearch_core::__private::Kind,
1444                value: V__,
1445            ) -> ::core::result::Result<Self::Value, V__::Error> {
1446                match kind {
1447                    ::oxsearch_core::__private::Kind::Number => {
1448                        let json: ::serde_json::Value = ::serde::Deserialize::deserialize(value)?;
1449                        if json.as_f64() == ::core::option::Option::Some(-1f64) {
1450                            return ::core::result::Result::Ok(Duration::MinusOne);
1451                        }
1452                        if json.as_f64() == ::core::option::Option::Some(0f64) {
1453                            return ::core::result::Result::Ok(Duration::Zero);
1454                        }
1455                        ::core::result::Result::Err(<V__::Error as ::serde::de::Error>::custom(
1456                            "no member of Duration matches",
1457                        ))
1458                    }
1459                    ::oxsearch_core::__private::Kind::String => {
1460                        <::std::string::String as ::serde::Deserialize>::deserialize(value)
1461                            .map(Duration::String)
1462                    }
1463                    _ => ::core::result::Result::Err(<V__::Error as ::serde::de::Error>::custom(
1464                        format_args!("Duration can't be {kind:?}"),
1465                    )),
1466                }
1467            }
1468        }
1469        ::oxsearch_core::__private::deserialize_by_kind(deserializer, Shape)
1470    }
1471}
1472
1473impl ::core::convert::From<::std::string::String> for Duration {
1474    fn from(value: ::std::string::String) -> Self {
1475        Self::String(value)
1476    }
1477}
1478
1479impl ::core::convert::From<&str> for Duration {
1480    fn from(value: &str) -> Self {
1481        Self::String(::std::borrow::ToOwned::to_owned(value))
1482    }
1483}
1484
1485/// A date histogram interval. Similar to `Duration` with additional units: `w` (week), `M` (month), `q` (quarter) and
1486/// `y` (year)
1487pub type DurationLarge = ::std::string::String;
1488
1489#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
1490#[non_exhaustive]
1491pub struct ElasticsearchVersionInfo {
1492    /// The Elasticsearch Git commit's date.
1493    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
1494    pub build_date: ::core::option::Option<crate::DateTime>,
1495    /// The build flavor. For example, `default`.
1496    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
1497    pub build_flavor: ::core::option::Option<::std::string::String>,
1498    /// The Elasticsearch Git commit's SHA hash.
1499    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
1500    pub build_hash: ::core::option::Option<::std::string::String>,
1501    /// Indicates whether the Elasticsearch build was a snapshot.
1502    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
1503    pub build_snapshot: ::core::option::Option<bool>,
1504    /// The build type that corresponds to how Elasticsearch was installed.
1505    /// For example, `docker`, `rpm`, or `tar`.
1506    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
1507    pub build_type: ::core::option::Option<::std::string::String>,
1508    /// The version number of Elasticsearch's underlying Lucene software.
1509    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
1510    pub lucene_version: ::core::option::Option<crate::VersionString>,
1511    /// The minimum index version with which the responding node can read from disk.
1512    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
1513    pub minimum_index_compatibility_version: ::core::option::Option<crate::VersionString>,
1514    /// The minimum node version with which the responding node can communicate.
1515    /// Also the minimum version from which you can perform a rolling upgrade.
1516    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
1517    pub minimum_wire_compatibility_version: ::core::option::Option<crate::VersionString>,
1518    /// The Elasticsearch version number.
1519    ///
1520    /// ::: IMPORTANT: For Serverless deployments, this static value is always `8.11.0` and is used solely for backward compatibility with legacy clients.
1521    /// Serverless environments are versionless and automatically upgraded, so this value can be safely ignored.
1522    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
1523    pub number: ::core::option::Option<::std::string::String>,
1524}
1525
1526impl ElasticsearchVersionInfo {
1527    /// A `ElasticsearchVersionInfo` with its required properties set.
1528    pub fn new(
1529        build_date: impl ::core::convert::Into<crate::DateTime>,
1530        build_flavor: impl ::core::convert::Into<::std::string::String>,
1531        build_hash: impl ::core::convert::Into<::std::string::String>,
1532        build_snapshot: bool,
1533        build_type: impl ::core::convert::Into<::std::string::String>,
1534        lucene_version: impl ::core::convert::Into<crate::VersionString>,
1535        minimum_index_compatibility_version: impl ::core::convert::Into<crate::VersionString>,
1536        minimum_wire_compatibility_version: impl ::core::convert::Into<crate::VersionString>,
1537        number: impl ::core::convert::Into<::std::string::String>,
1538    ) -> Self {
1539        Self {
1540            build_date: ::core::option::Option::Some(build_date.into()),
1541            build_flavor: ::core::option::Option::Some(build_flavor.into()),
1542            build_hash: ::core::option::Option::Some(build_hash.into()),
1543            build_snapshot: ::core::option::Option::Some(build_snapshot.into()),
1544            build_type: ::core::option::Option::Some(build_type.into()),
1545            lucene_version: ::core::option::Option::Some(lucene_version.into()),
1546            minimum_index_compatibility_version: ::core::option::Option::Some(
1547                minimum_index_compatibility_version.into(),
1548            ),
1549            minimum_wire_compatibility_version: ::core::option::Option::Some(
1550                minimum_wire_compatibility_version.into(),
1551            ),
1552            number: ::core::option::Option::Some(number.into()),
1553        }
1554    }
1555}
1556
1557impl ElasticsearchVersionInfo {}
1558
1559/// Reduced (minimal) info ElasticsearchVersion
1560#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
1561#[non_exhaustive]
1562pub struct ElasticsearchVersionMinInfo {
1563    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
1564    pub build_flavor: ::core::option::Option<::std::string::String>,
1565    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
1566    pub minimum_index_compatibility_version: ::core::option::Option<crate::VersionString>,
1567    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
1568    pub minimum_wire_compatibility_version: ::core::option::Option<crate::VersionString>,
1569    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
1570    pub number: ::core::option::Option<::std::string::String>,
1571}
1572
1573impl ElasticsearchVersionMinInfo {
1574    /// A `ElasticsearchVersionMinInfo` with its required properties set.
1575    pub fn new(
1576        build_flavor: impl ::core::convert::Into<::std::string::String>,
1577        minimum_index_compatibility_version: impl ::core::convert::Into<crate::VersionString>,
1578        minimum_wire_compatibility_version: impl ::core::convert::Into<crate::VersionString>,
1579        number: impl ::core::convert::Into<::std::string::String>,
1580    ) -> Self {
1581        Self {
1582            build_flavor: ::core::option::Option::Some(build_flavor.into()),
1583            minimum_index_compatibility_version: ::core::option::Option::Some(
1584                minimum_index_compatibility_version.into(),
1585            ),
1586            minimum_wire_compatibility_version: ::core::option::Option::Some(
1587                minimum_wire_compatibility_version.into(),
1588            ),
1589            number: ::core::option::Option::Some(number.into()),
1590        }
1591    }
1592}
1593
1594impl ElasticsearchVersionMinInfo {}
1595
1596#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
1597#[non_exhaustive]
1598pub struct Embedding {
1599    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
1600    pub inference_id: ::core::option::Option<::std::string::String>,
1601    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
1602    pub input: ::core::option::Option<crate::KnnEmbeddingInput>,
1603    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
1604    pub timeout: ::core::option::Option<crate::Duration>,
1605}
1606
1607impl Embedding {
1608    /// A `Embedding` with its required properties set.
1609    pub fn new(input: impl ::core::convert::Into<crate::KnnEmbeddingInput>) -> Self {
1610        Self {
1611            inference_id: ::core::option::Option::None,
1612            input: ::core::option::Option::Some(input.into()),
1613            timeout: ::core::option::Option::None,
1614        }
1615    }
1616}
1617
1618impl Embedding {
1619    /// Sets `inference_id`.
1620    pub fn inference_id(
1621        mut self,
1622        value: impl ::core::convert::Into<::std::string::String>,
1623    ) -> Self {
1624        self.inference_id = ::core::option::Option::Some(value.into());
1625        self
1626    }
1627    /// Sets `timeout`.
1628    pub fn timeout(mut self, value: impl ::core::convert::Into<crate::Duration>) -> Self {
1629        self.timeout = ::core::option::Option::Some(value.into());
1630        self
1631    }
1632}
1633
1634/// For empty Class assignments
1635#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
1636#[non_exhaustive]
1637pub struct EmptyObject {}
1638
1639impl EmptyObject {
1640    /// A `EmptyObject` with its required properties set.
1641    pub fn new() -> Self {
1642        Self {}
1643    }
1644}
1645
1646impl EmptyObject {}
1647
1648/// Cause and details about a request failure. This class defines the properties common to all error types.
1649/// Additional details are also provided, that depend on the error type.
1650#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
1651#[non_exhaustive]
1652pub struct ErrorCause {
1653    /// The type of error
1654    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
1655    pub r#type: ::core::option::Option<::std::string::String>,
1656    /// A human-readable explanation of the error, in English.
1657    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
1658    pub reason: ::core::option::Option<::std::string::String>,
1659    /// The server stack trace. Present only if the `error_trace=true` parameter was sent with the request.
1660    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
1661    pub stack_trace: ::core::option::Option<::std::string::String>,
1662    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
1663    pub caused_by: ::core::option::Option<::std::boxed::Box<crate::ErrorCause>>,
1664    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
1665    pub root_cause: ::core::option::Option<::std::vec::Vec<crate::ErrorCause>>,
1666    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
1667    pub suppressed: ::core::option::Option<::std::vec::Vec<crate::ErrorCause>>,
1668    /// Properties the specification doesn't name.
1669    #[serde(flatten)]
1670    pub metadata: ::indexmap::IndexMap<::std::string::String, ::serde_json::Value>,
1671}
1672
1673impl ErrorCause {
1674    /// A `ErrorCause` with its required properties set.
1675    pub fn new(r#type: impl ::core::convert::Into<::std::string::String>) -> Self {
1676        Self {
1677            r#type: ::core::option::Option::Some(r#type.into()),
1678            reason: ::core::option::Option::None,
1679            stack_trace: ::core::option::Option::None,
1680            caused_by: ::core::option::Option::None,
1681            root_cause: ::core::option::Option::None,
1682            suppressed: ::core::option::Option::None,
1683            metadata: ::core::default::Default::default(),
1684        }
1685    }
1686}
1687
1688impl ErrorCause {
1689    /// Sets `reason`.
1690    pub fn reason(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
1691        self.reason = ::core::option::Option::Some(value.into());
1692        self
1693    }
1694    /// Sets `stack_trace`.
1695    pub fn stack_trace(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
1696        self.stack_trace = ::core::option::Option::Some(value.into());
1697        self
1698    }
1699    /// Sets `caused_by`.
1700    pub fn caused_by(mut self, value: impl ::core::convert::Into<crate::ErrorCause>) -> Self {
1701        self.caused_by = ::core::option::Option::Some(::std::boxed::Box::new(value.into()));
1702        self
1703    }
1704    /// Sets `root_cause`.
1705    pub fn root_cause(
1706        mut self,
1707        value: impl ::core::convert::Into<::std::vec::Vec<crate::ErrorCause>>,
1708    ) -> Self {
1709        self.root_cause = ::core::option::Option::Some(value.into());
1710        self
1711    }
1712    /// Sets `suppressed`.
1713    pub fn suppressed(
1714        mut self,
1715        value: impl ::core::convert::Into<::std::vec::Vec<crate::ErrorCause>>,
1716    ) -> Self {
1717        self.suppressed = ::core::option::Option::Some(value.into());
1718        self
1719    }
1720}
1721
1722/// The response returned by Elasticsearch when request execution did not succeed.
1723#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
1724#[non_exhaustive]
1725pub struct ErrorResponseBase {
1726    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
1727    pub error: ::core::option::Option<crate::ErrorCause>,
1728    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
1729    pub status: ::core::option::Option<i32>,
1730}
1731
1732impl ErrorResponseBase {
1733    /// A `ErrorResponseBase` with its required properties set.
1734    pub fn new(error: impl ::core::convert::Into<crate::ErrorCause>, status: i32) -> Self {
1735        Self {
1736            error: ::core::option::Option::Some(error.into()),
1737            status: ::core::option::Option::Some(status.into()),
1738        }
1739    }
1740}
1741
1742impl ErrorResponseBase {}
1743
1744#[derive(Clone, Debug, PartialEq, Eq, Hash)]
1745#[non_exhaustive]
1746pub enum ExpandWildcard {
1747    /// Match any data stream or index, including hidden ones.
1748    All,
1749    /// Match open, non-hidden indices. Also matches any non-hidden data stream.
1750    Open,
1751    /// Match closed, non-hidden indices. Also matches any non-hidden data stream. Data streams cannot be closed.
1752    Closed,
1753    /// Match hidden data streams and hidden indices. Must be combined with `open`, `closed`, or `both`.
1754    Hidden,
1755    /// Wildcard expressions are not accepted.
1756    None,
1757    /// A value this version of the specification doesn't list.
1758    Raw(::std::string::String),
1759}
1760
1761impl ExpandWildcard {
1762    /// The value as Elasticsearch writes it.
1763    pub fn as_str(&self) -> &str {
1764        match self {
1765            Self::All => "all",
1766            Self::Open => "open",
1767            Self::Closed => "closed",
1768            Self::Hidden => "hidden",
1769            Self::None => "none",
1770            Self::Raw(value) => value,
1771        }
1772    }
1773
1774    /// The listed value with this name, if there is one.
1775    pub fn from_known(value: &str) -> ::core::option::Option<Self> {
1776        match value {
1777            "all" => ::core::option::Option::Some(Self::All),
1778            "open" => ::core::option::Option::Some(Self::Open),
1779            "closed" => ::core::option::Option::Some(Self::Closed),
1780            "hidden" => ::core::option::Option::Some(Self::Hidden),
1781            "none" => ::core::option::Option::Some(Self::None),
1782            _ => ::core::option::Option::None,
1783        }
1784    }
1785}
1786
1787impl ::serde::Serialize for ExpandWildcard {
1788    fn serialize<S__: ::serde::Serializer>(
1789        &self,
1790        serializer: S__,
1791    ) -> ::core::result::Result<S__::Ok, S__::Error> {
1792        serializer.serialize_str(self.as_str())
1793    }
1794}
1795
1796impl<'de> ::serde::Deserialize<'de> for ExpandWildcard {
1797    fn deserialize<D__: ::serde::Deserializer<'de>>(
1798        deserializer: D__,
1799    ) -> ::core::result::Result<Self, D__::Error> {
1800        ::oxsearch_core::__private::deserialize_string_enum(
1801            deserializer,
1802            "ExpandWildcard",
1803            |value| Self::from_known(value).unwrap_or_else(|| Self::Raw(value.to_owned())),
1804        )
1805    }
1806}
1807
1808pub type ExpandWildcards = ::oxsearch_core::shapes::OneOrMany<crate::ExpandWildcard>;
1809
1810/// Path to field or array of paths. Some API's support wildcards in the path to select multiple fields.
1811pub type Field = ::std::string::String;
1812
1813#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
1814#[non_exhaustive]
1815pub struct FieldMemoryUsage {
1816    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
1817    pub memory_size: ::core::option::Option<crate::ByteSize>,
1818    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
1819    pub memory_size_in_bytes: ::core::option::Option<i64>,
1820}
1821
1822impl FieldMemoryUsage {
1823    /// A `FieldMemoryUsage` with its required properties set.
1824    pub fn new(memory_size_in_bytes: i64) -> Self {
1825        Self {
1826            memory_size: ::core::option::Option::None,
1827            memory_size_in_bytes: ::core::option::Option::Some(memory_size_in_bytes.into()),
1828        }
1829    }
1830}
1831
1832impl FieldMemoryUsage {
1833    /// Sets `memory_size`.
1834    pub fn memory_size(mut self, value: impl ::core::convert::Into<crate::ByteSize>) -> Self {
1835        self.memory_size = ::core::option::Option::Some(value.into());
1836        self
1837    }
1838}
1839
1840#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
1841#[non_exhaustive]
1842pub struct FieldSizeUsage {
1843    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
1844    pub size: ::core::option::Option<crate::ByteSize>,
1845    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
1846    pub size_in_bytes: ::core::option::Option<i64>,
1847}
1848
1849impl FieldSizeUsage {
1850    /// A `FieldSizeUsage` with its required properties set.
1851    pub fn new(size_in_bytes: i64) -> Self {
1852        Self {
1853            size: ::core::option::Option::None,
1854            size_in_bytes: ::core::option::Option::Some(size_in_bytes.into()),
1855        }
1856    }
1857}
1858
1859impl FieldSizeUsage {
1860    /// Sets `size`.
1861    pub fn size(mut self, value: impl ::core::convert::Into<crate::ByteSize>) -> Self {
1862        self.size = ::core::option::Option::Some(value.into());
1863        self
1864    }
1865}
1866
1867#[derive(Clone, Debug, PartialEq)]
1868#[non_exhaustive]
1869pub struct FieldSort {
1870    pub missing: ::core::option::Option<crate::aggregations::Missing>,
1871    pub mode: ::core::option::Option<crate::SortMode>,
1872    pub nested: ::core::option::Option<crate::NestedSortValue>,
1873    pub order: ::core::option::Option<crate::SortOrder>,
1874    pub unmapped_type: ::core::option::Option<crate::mapping::FieldType>,
1875    pub numeric_type: ::core::option::Option<crate::FieldSortNumericType>,
1876    pub format: ::core::option::Option<::std::string::String>,
1877}
1878
1879impl FieldSort {
1880    /// A `FieldSort` with its required properties set.
1881    pub fn new() -> Self {
1882        Self {
1883            missing: ::core::option::Option::None,
1884            mode: ::core::option::Option::None,
1885            nested: ::core::option::Option::None,
1886            order: ::core::option::Option::None,
1887            unmapped_type: ::core::option::Option::None,
1888            numeric_type: ::core::option::Option::None,
1889            format: ::core::option::Option::None,
1890        }
1891    }
1892}
1893
1894impl FieldSort {
1895    /// Sets `missing`.
1896    pub fn missing(
1897        mut self,
1898        value: impl ::core::convert::Into<crate::aggregations::Missing>,
1899    ) -> Self {
1900        self.missing = ::core::option::Option::Some(value.into());
1901        self
1902    }
1903    /// Sets `mode`.
1904    pub fn mode(mut self, value: impl ::core::convert::Into<crate::SortMode>) -> Self {
1905        self.mode = ::core::option::Option::Some(value.into());
1906        self
1907    }
1908    /// Sets `nested`.
1909    pub fn nested(mut self, value: impl ::core::convert::Into<crate::NestedSortValue>) -> Self {
1910        self.nested = ::core::option::Option::Some(value.into());
1911        self
1912    }
1913    /// Sets `order`.
1914    pub fn order(mut self, value: impl ::core::convert::Into<crate::SortOrder>) -> Self {
1915        self.order = ::core::option::Option::Some(value.into());
1916        self
1917    }
1918    /// Sets `unmapped_type`.
1919    pub fn unmapped_type(
1920        mut self,
1921        value: impl ::core::convert::Into<crate::mapping::FieldType>,
1922    ) -> Self {
1923        self.unmapped_type = ::core::option::Option::Some(value.into());
1924        self
1925    }
1926    /// Sets `numeric_type`.
1927    pub fn numeric_type(
1928        mut self,
1929        value: impl ::core::convert::Into<crate::FieldSortNumericType>,
1930    ) -> Self {
1931        self.numeric_type = ::core::option::Option::Some(value.into());
1932        self
1933    }
1934    /// Sets `format`.
1935    pub fn format(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
1936        self.format = ::core::option::Option::Some(value.into());
1937        self
1938    }
1939}
1940
1941#[derive(::serde::Serialize, ::serde::Deserialize)]
1942#[serde(remote = "FieldSort")]
1943struct FieldSortDef {
1944    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
1945    missing: ::core::option::Option<crate::aggregations::Missing>,
1946    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
1947    mode: ::core::option::Option<crate::SortMode>,
1948    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
1949    nested: ::core::option::Option<crate::NestedSortValue>,
1950    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
1951    order: ::core::option::Option<crate::SortOrder>,
1952    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
1953    unmapped_type: ::core::option::Option<crate::mapping::FieldType>,
1954    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
1955    numeric_type: ::core::option::Option<crate::FieldSortNumericType>,
1956    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
1957    format: ::core::option::Option<::std::string::String>,
1958}
1959
1960impl ::serde::Serialize for FieldSort {
1961    fn serialize<S__: ::serde::Serializer>(
1962        &self,
1963        serializer: S__,
1964    ) -> ::core::result::Result<S__::Ok, S__::Error> {
1965        if let (::core::option::Option::Some(short), true) = (
1966            &self.order,
1967            self.missing.is_none()
1968                && self.mode.is_none()
1969                && self.nested.is_none()
1970                && self.unmapped_type.is_none()
1971                && self.numeric_type.is_none()
1972                && self.format.is_none(),
1973        ) {
1974            return ::serde::Serialize::serialize(short, serializer);
1975        }
1976        FieldSortDef::serialize(self, serializer)
1977    }
1978}
1979
1980impl<'de> ::oxsearch_core::__private::Shorthand<'de> for FieldSort {
1981    type Short = crate::SortOrder;
1982    fn from_short(short: crate::SortOrder) -> Self {
1983        Self {
1984            missing: ::core::option::Option::None,
1985            mode: ::core::option::Option::None,
1986            nested: ::core::option::Option::None,
1987            order: ::core::option::Option::Some(short),
1988            unmapped_type: ::core::option::Option::None,
1989            numeric_type: ::core::option::Option::None,
1990            format: ::core::option::Option::None,
1991        }
1992    }
1993    fn deserialize_full<D__: ::serde::Deserializer<'de>>(
1994        deserializer: D__,
1995    ) -> ::core::result::Result<Self, D__::Error> {
1996        FieldSortDef::deserialize(deserializer)
1997    }
1998}
1999
2000impl<'de> ::serde::Deserialize<'de> for FieldSort {
2001    fn deserialize<D__: ::serde::Deserializer<'de>>(
2002        deserializer: D__,
2003    ) -> ::core::result::Result<Self, D__::Error> {
2004        ::oxsearch_core::__private::deserialize_shorthand(deserializer)
2005    }
2006}
2007
2008#[derive(Clone, Debug, PartialEq, Eq, Hash)]
2009#[non_exhaustive]
2010pub enum FieldSortNumericType {
2011    /// `long`
2012    Long,
2013    /// `double`
2014    Double,
2015    /// `date`
2016    Date,
2017    /// `date_nanos`
2018    DateNanos,
2019    /// A value this version of the specification doesn't list.
2020    Raw(::std::string::String),
2021}
2022
2023impl FieldSortNumericType {
2024    /// The value as Elasticsearch writes it.
2025    pub fn as_str(&self) -> &str {
2026        match self {
2027            Self::Long => "long",
2028            Self::Double => "double",
2029            Self::Date => "date",
2030            Self::DateNanos => "date_nanos",
2031            Self::Raw(value) => value,
2032        }
2033    }
2034
2035    /// The listed value with this name, if there is one.
2036    pub fn from_known(value: &str) -> ::core::option::Option<Self> {
2037        match value {
2038            "long" => ::core::option::Option::Some(Self::Long),
2039            "double" => ::core::option::Option::Some(Self::Double),
2040            "date" => ::core::option::Option::Some(Self::Date),
2041            "date_nanos" => ::core::option::Option::Some(Self::DateNanos),
2042            _ => ::core::option::Option::None,
2043        }
2044    }
2045}
2046
2047impl ::serde::Serialize for FieldSortNumericType {
2048    fn serialize<S__: ::serde::Serializer>(
2049        &self,
2050        serializer: S__,
2051    ) -> ::core::result::Result<S__::Ok, S__::Error> {
2052        serializer.serialize_str(self.as_str())
2053    }
2054}
2055
2056impl<'de> ::serde::Deserialize<'de> for FieldSortNumericType {
2057    fn deserialize<D__: ::serde::Deserializer<'de>>(
2058        deserializer: D__,
2059    ) -> ::core::result::Result<Self, D__::Error> {
2060        ::oxsearch_core::__private::deserialize_string_enum(
2061            deserializer,
2062            "FieldSortNumericType",
2063            |value| Self::from_known(value).unwrap_or_else(|| Self::Raw(value.to_owned())),
2064        )
2065    }
2066}
2067
2068/// A field value.
2069#[derive(Clone, Debug, PartialEq)]
2070#[non_exhaustive]
2071pub enum FieldValue {
2072    /// A number.
2073    Long(i64),
2074    /// A number.
2075    Double(f64),
2076    /// A string.
2077    String(::std::string::String),
2078    /// A boolean.
2079    Boolean(bool),
2080    /// A null.
2081    Null(()),
2082}
2083
2084impl ::serde::Serialize for FieldValue {
2085    fn serialize<S__: ::serde::Serializer>(
2086        &self,
2087        serializer: S__,
2088    ) -> ::core::result::Result<S__::Ok, S__::Error> {
2089        match self {
2090            Self::Long(value) => ::serde::Serialize::serialize(value, serializer),
2091            Self::Double(value) => ::serde::Serialize::serialize(value, serializer),
2092            Self::String(value) => ::serde::Serialize::serialize(value, serializer),
2093            Self::Boolean(value) => ::serde::Serialize::serialize(value, serializer),
2094            Self::Null(value) => ::serde::Serialize::serialize(value, serializer),
2095        }
2096    }
2097}
2098
2099impl<'de> ::serde::Deserialize<'de> for FieldValue {
2100    fn deserialize<D__: ::serde::Deserializer<'de>>(
2101        deserializer: D__,
2102    ) -> ::core::result::Result<Self, D__::Error> {
2103        struct Shape;
2104        impl<'de> ::oxsearch_core::__private::ByKind<'de> for Shape {
2105            type Value = FieldValue;
2106            const EXPECTING: &'static str = "FieldValue: boolean or null or number or string";
2107            fn visit<V__: ::serde::Deserializer<'de>>(
2108                self,
2109                kind: ::oxsearch_core::__private::Kind,
2110                value: V__,
2111            ) -> ::core::result::Result<Self::Value, V__::Error> {
2112                match kind {
2113                    ::oxsearch_core::__private::Kind::Null => {
2114                        <() as ::serde::Deserialize>::deserialize(value).map(FieldValue::Null)
2115                    }
2116                    ::oxsearch_core::__private::Kind::Bool => {
2117                        <bool as ::serde::Deserialize>::deserialize(value).map(FieldValue::Boolean)
2118                    }
2119                    ::oxsearch_core::__private::Kind::Number => {
2120                        let json: ::serde_json::Value = ::serde::Deserialize::deserialize(value)?;
2121                        if let ::core::result::Result::Ok(found) =
2122                            ::oxsearch_core::__private::from_value::<i64, V__::Error>(json.clone())
2123                        {
2124                            return ::core::result::Result::Ok(FieldValue::Long(found));
2125                        }
2126                        ::oxsearch_core::__private::from_value(json).map(FieldValue::Double)
2127                    }
2128                    ::oxsearch_core::__private::Kind::String => {
2129                        <::std::string::String as ::serde::Deserialize>::deserialize(value)
2130                            .map(FieldValue::String)
2131                    }
2132                    _ => ::core::result::Result::Err(<V__::Error as ::serde::de::Error>::custom(
2133                        format_args!("FieldValue can't be {kind:?}"),
2134                    )),
2135                }
2136            }
2137        }
2138        ::oxsearch_core::__private::deserialize_by_kind(deserializer, Shape)
2139    }
2140}
2141
2142impl ::core::convert::From<i64> for FieldValue {
2143    fn from(value: i64) -> Self {
2144        Self::Long(value)
2145    }
2146}
2147
2148impl ::core::convert::From<f64> for FieldValue {
2149    fn from(value: f64) -> Self {
2150        Self::Double(value)
2151    }
2152}
2153
2154impl ::core::convert::From<::std::string::String> for FieldValue {
2155    fn from(value: ::std::string::String) -> Self {
2156        Self::String(value)
2157    }
2158}
2159
2160impl ::core::convert::From<bool> for FieldValue {
2161    fn from(value: bool) -> Self {
2162        Self::Boolean(value)
2163    }
2164}
2165
2166impl ::core::convert::From<&str> for FieldValue {
2167    fn from(value: &str) -> Self {
2168        Self::String(::std::borrow::ToOwned::to_owned(value))
2169    }
2170}
2171
2172#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
2173#[non_exhaustive]
2174pub struct FielddataStats {
2175    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
2176    pub evictions: ::core::option::Option<i64>,
2177    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
2178    pub memory_size: ::core::option::Option<crate::ByteSize>,
2179    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
2180    pub memory_size_in_bytes: ::core::option::Option<i64>,
2181    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
2182    pub fields: ::core::option::Option<::indexmap::IndexMap<crate::Field, crate::FieldMemoryUsage>>,
2183    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
2184    pub global_ordinals: ::core::option::Option<crate::GlobalOrdinalsStats>,
2185}
2186
2187impl FielddataStats {
2188    /// A `FielddataStats` with its required properties set.
2189    pub fn new(
2190        memory_size_in_bytes: i64,
2191        global_ordinals: impl ::core::convert::Into<crate::GlobalOrdinalsStats>,
2192    ) -> Self {
2193        Self {
2194            evictions: ::core::option::Option::None,
2195            memory_size: ::core::option::Option::None,
2196            memory_size_in_bytes: ::core::option::Option::Some(memory_size_in_bytes.into()),
2197            fields: ::core::option::Option::None,
2198            global_ordinals: ::core::option::Option::Some(global_ordinals.into()),
2199        }
2200    }
2201}
2202
2203impl FielddataStats {
2204    /// Sets `evictions`.
2205    pub fn evictions(mut self, value: i64) -> Self {
2206        self.evictions = ::core::option::Option::Some(value.into());
2207        self
2208    }
2209    /// Sets `memory_size`.
2210    pub fn memory_size(mut self, value: impl ::core::convert::Into<crate::ByteSize>) -> Self {
2211        self.memory_size = ::core::option::Option::Some(value.into());
2212        self
2213    }
2214    /// Sets `fields`.
2215    pub fn fields(
2216        mut self,
2217        value: impl ::core::convert::Into<::indexmap::IndexMap<crate::Field, crate::FieldMemoryUsage>>,
2218    ) -> Self {
2219        self.fields = ::core::option::Option::Some(value.into());
2220        self
2221    }
2222}
2223
2224pub type Fields = ::oxsearch_core::shapes::OneOrMany<crate::Field>;
2225
2226#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
2227#[non_exhaustive]
2228pub struct FlushStats {
2229    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
2230    pub periodic: ::core::option::Option<i64>,
2231    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
2232    pub total: ::core::option::Option<i64>,
2233    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
2234    pub total_time: ::core::option::Option<crate::Duration>,
2235    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
2236    pub total_time_in_millis: ::core::option::Option<crate::UnitMillis>,
2237    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
2238    pub total_time_excluding_waiting: ::core::option::Option<crate::Duration>,
2239    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
2240    pub total_time_excluding_waiting_on_lock_in_millis: ::core::option::Option<crate::UnitMillis>,
2241}
2242
2243impl FlushStats {
2244    /// A `FlushStats` with its required properties set.
2245    pub fn new(
2246        periodic: i64,
2247        total: i64,
2248        total_time_in_millis: impl ::core::convert::Into<crate::UnitMillis>,
2249        total_time_excluding_waiting_on_lock_in_millis: impl ::core::convert::Into<crate::UnitMillis>,
2250    ) -> Self {
2251        Self {
2252            periodic: ::core::option::Option::Some(periodic.into()),
2253            total: ::core::option::Option::Some(total.into()),
2254            total_time: ::core::option::Option::None,
2255            total_time_in_millis: ::core::option::Option::Some(total_time_in_millis.into()),
2256            total_time_excluding_waiting: ::core::option::Option::None,
2257            total_time_excluding_waiting_on_lock_in_millis: ::core::option::Option::Some(
2258                total_time_excluding_waiting_on_lock_in_millis.into(),
2259            ),
2260        }
2261    }
2262}
2263
2264impl FlushStats {
2265    /// Sets `total_time`.
2266    pub fn total_time(mut self, value: impl ::core::convert::Into<crate::Duration>) -> Self {
2267        self.total_time = ::core::option::Option::Some(value.into());
2268        self
2269    }
2270    /// Sets `total_time_excluding_waiting`.
2271    pub fn total_time_excluding_waiting(
2272        mut self,
2273        value: impl ::core::convert::Into<crate::Duration>,
2274    ) -> Self {
2275        self.total_time_excluding_waiting = ::core::option::Option::Some(value.into());
2276        self
2277    }
2278}
2279
2280#[derive(Clone, Debug, PartialEq)]
2281#[non_exhaustive]
2282pub enum Fuzziness {
2283    /// A string.
2284    String(::std::string::String),
2285    /// A number.
2286    Integer(i32),
2287}
2288
2289impl ::serde::Serialize for Fuzziness {
2290    fn serialize<S__: ::serde::Serializer>(
2291        &self,
2292        serializer: S__,
2293    ) -> ::core::result::Result<S__::Ok, S__::Error> {
2294        match self {
2295            Self::String(value) => ::serde::Serialize::serialize(value, serializer),
2296            Self::Integer(value) => ::serde::Serialize::serialize(value, serializer),
2297        }
2298    }
2299}
2300
2301impl<'de> ::serde::Deserialize<'de> for Fuzziness {
2302    fn deserialize<D__: ::serde::Deserializer<'de>>(
2303        deserializer: D__,
2304    ) -> ::core::result::Result<Self, D__::Error> {
2305        struct Shape;
2306        impl<'de> ::oxsearch_core::__private::ByKind<'de> for Shape {
2307            type Value = Fuzziness;
2308            const EXPECTING: &'static str = "Fuzziness: number or string";
2309            fn visit<V__: ::serde::Deserializer<'de>>(
2310                self,
2311                kind: ::oxsearch_core::__private::Kind,
2312                value: V__,
2313            ) -> ::core::result::Result<Self::Value, V__::Error> {
2314                match kind {
2315                    ::oxsearch_core::__private::Kind::Number => {
2316                        <i32 as ::serde::Deserialize>::deserialize(value).map(Fuzziness::Integer)
2317                    }
2318                    ::oxsearch_core::__private::Kind::String => {
2319                        <::std::string::String as ::serde::Deserialize>::deserialize(value)
2320                            .map(Fuzziness::String)
2321                    }
2322                    _ => ::core::result::Result::Err(<V__::Error as ::serde::de::Error>::custom(
2323                        format_args!("Fuzziness can't be {kind:?}"),
2324                    )),
2325                }
2326            }
2327        }
2328        ::oxsearch_core::__private::deserialize_by_kind(deserializer, Shape)
2329    }
2330}
2331
2332impl ::core::convert::From<::std::string::String> for Fuzziness {
2333    fn from(value: ::std::string::String) -> Self {
2334        Self::String(value)
2335    }
2336}
2337
2338impl ::core::convert::From<i32> for Fuzziness {
2339    fn from(value: i32) -> Self {
2340        Self::Integer(value)
2341    }
2342}
2343
2344impl ::core::convert::From<&str> for Fuzziness {
2345    fn from(value: &str) -> Self {
2346        Self::String(::std::borrow::ToOwned::to_owned(value))
2347    }
2348}
2349
2350/// A geo bounding box. It can be represented in various ways:
2351/// - as 4 top/bottom/left/right coordinates
2352/// - as 2 top_left / bottom_right points
2353/// - as 2 top_right / bottom_left points
2354/// - as a WKT bounding box
2355#[derive(Clone, Debug, PartialEq)]
2356#[non_exhaustive]
2357pub enum GeoBounds {
2358    /// A object.
2359    Coords(crate::CoordsGeoBounds),
2360    /// A object.
2361    Tlbr(crate::TopLeftBottomRightGeoBounds),
2362    /// A object.
2363    Trbl(crate::TopRightBottomLeftGeoBounds),
2364    /// A object.
2365    Wkt(crate::WktGeoBounds),
2366}
2367
2368impl ::serde::Serialize for GeoBounds {
2369    fn serialize<S__: ::serde::Serializer>(
2370        &self,
2371        serializer: S__,
2372    ) -> ::core::result::Result<S__::Ok, S__::Error> {
2373        match self {
2374            Self::Coords(value) => ::serde::Serialize::serialize(value, serializer),
2375            Self::Tlbr(value) => ::serde::Serialize::serialize(value, serializer),
2376            Self::Trbl(value) => ::serde::Serialize::serialize(value, serializer),
2377            Self::Wkt(value) => ::serde::Serialize::serialize(value, serializer),
2378        }
2379    }
2380}
2381
2382impl<'de> ::serde::Deserialize<'de> for GeoBounds {
2383    fn deserialize<D__: ::serde::Deserializer<'de>>(
2384        deserializer: D__,
2385    ) -> ::core::result::Result<Self, D__::Error> {
2386        struct Shape;
2387        impl<'de> ::oxsearch_core::__private::ByKind<'de> for Shape {
2388            type Value = GeoBounds;
2389            const EXPECTING: &'static str = "GeoBounds: object";
2390            fn visit<V__: ::serde::Deserializer<'de>>(
2391                self,
2392                kind: ::oxsearch_core::__private::Kind,
2393                value: V__,
2394            ) -> ::core::result::Result<Self::Value, V__::Error> {
2395                match kind {
2396                    ::oxsearch_core::__private::Kind::Object => {
2397                        let json: ::serde_json::Value = ::serde::Deserialize::deserialize(value)?;
2398                        if ::oxsearch_core::__private::has(&json, "bottom")
2399                            || ::oxsearch_core::__private::has(&json, "left")
2400                            || ::oxsearch_core::__private::has(&json, "right")
2401                            || ::oxsearch_core::__private::has(&json, "top")
2402                        {
2403                            return ::oxsearch_core::__private::from_value(json)
2404                                .map(GeoBounds::Coords);
2405                        }
2406                        if ::oxsearch_core::__private::has(&json, "bottom_right")
2407                            || ::oxsearch_core::__private::has(&json, "top_left")
2408                        {
2409                            return ::oxsearch_core::__private::from_value(json)
2410                                .map(GeoBounds::Tlbr);
2411                        }
2412                        if ::oxsearch_core::__private::has(&json, "bottom_left")
2413                            || ::oxsearch_core::__private::has(&json, "top_right")
2414                        {
2415                            return ::oxsearch_core::__private::from_value(json)
2416                                .map(GeoBounds::Trbl);
2417                        }
2418                        if ::oxsearch_core::__private::has(&json, "wkt") {
2419                            return ::oxsearch_core::__private::from_value(json)
2420                                .map(GeoBounds::Wkt);
2421                        }
2422                        if let ::core::result::Result::Ok(found) =
2423                            ::oxsearch_core::__private::from_value::<
2424                                crate::CoordsGeoBounds,
2425                                V__::Error,
2426                            >(json.clone())
2427                        {
2428                            return ::core::result::Result::Ok(GeoBounds::Coords(found));
2429                        }
2430                        if let ::core::result::Result::Ok(found) =
2431                            ::oxsearch_core::__private::from_value::<
2432                                crate::TopLeftBottomRightGeoBounds,
2433                                V__::Error,
2434                            >(json.clone())
2435                        {
2436                            return ::core::result::Result::Ok(GeoBounds::Tlbr(found));
2437                        }
2438                        if let ::core::result::Result::Ok(found) =
2439                            ::oxsearch_core::__private::from_value::<
2440                                crate::TopRightBottomLeftGeoBounds,
2441                                V__::Error,
2442                            >(json.clone())
2443                        {
2444                            return ::core::result::Result::Ok(GeoBounds::Trbl(found));
2445                        }
2446                        ::oxsearch_core::__private::from_value(json).map(GeoBounds::Wkt)
2447                    }
2448                    _ => ::core::result::Result::Err(<V__::Error as ::serde::de::Error>::custom(
2449                        format_args!("GeoBounds can't be {kind:?}"),
2450                    )),
2451                }
2452            }
2453        }
2454        ::oxsearch_core::__private::deserialize_by_kind(deserializer, Shape)
2455    }
2456}
2457
2458impl ::core::convert::From<crate::CoordsGeoBounds> for GeoBounds {
2459    fn from(value: crate::CoordsGeoBounds) -> Self {
2460        Self::Coords(value)
2461    }
2462}
2463
2464impl ::core::convert::From<crate::TopLeftBottomRightGeoBounds> for GeoBounds {
2465    fn from(value: crate::TopLeftBottomRightGeoBounds) -> Self {
2466        Self::Tlbr(value)
2467    }
2468}
2469
2470impl ::core::convert::From<crate::TopRightBottomLeftGeoBounds> for GeoBounds {
2471    fn from(value: crate::TopRightBottomLeftGeoBounds) -> Self {
2472        Self::Trbl(value)
2473    }
2474}
2475
2476impl ::core::convert::From<crate::WktGeoBounds> for GeoBounds {
2477    fn from(value: crate::WktGeoBounds) -> Self {
2478        Self::Wkt(value)
2479    }
2480}
2481
2482#[derive(Clone, Debug, PartialEq)]
2483#[non_exhaustive]
2484pub enum GeoDistanceSortLocation {
2485    /// A string or array or object.
2486    GeoLocation(crate::GeoLocation),
2487    /// A array.
2488    GeoLocationList(::std::vec::Vec<crate::GeoLocation>),
2489}
2490
2491impl ::serde::Serialize for GeoDistanceSortLocation {
2492    fn serialize<S__: ::serde::Serializer>(
2493        &self,
2494        serializer: S__,
2495    ) -> ::core::result::Result<S__::Ok, S__::Error> {
2496        match self {
2497            Self::GeoLocation(value) => ::serde::Serialize::serialize(value, serializer),
2498            Self::GeoLocationList(value) => ::serde::Serialize::serialize(value, serializer),
2499        }
2500    }
2501}
2502
2503impl<'de> ::serde::Deserialize<'de> for GeoDistanceSortLocation {
2504    fn deserialize<D__: ::serde::Deserializer<'de>>(
2505        deserializer: D__,
2506    ) -> ::core::result::Result<Self, D__::Error> {
2507        struct Shape;
2508        impl<'de> ::oxsearch_core::__private::ByKind<'de> for Shape {
2509            type Value = GeoDistanceSortLocation;
2510            const EXPECTING: &'static str =
2511                "GeoDistanceSortLocation: array or string or array or object";
2512            fn visit<V__: ::serde::Deserializer<'de>>(
2513                self,
2514                kind: ::oxsearch_core::__private::Kind,
2515                value: V__,
2516            ) -> ::core::result::Result<Self::Value, V__::Error> {
2517                match kind {
2518                    ::oxsearch_core::__private::Kind::String => {
2519                        <crate::GeoLocation as ::serde::Deserialize>::deserialize(value)
2520                            .map(GeoDistanceSortLocation::GeoLocation)
2521                    }
2522                    ::oxsearch_core::__private::Kind::Array => {
2523                        let json: ::serde_json::Value = ::serde::Deserialize::deserialize(value)?;
2524                        if let ::core::result::Result::Ok(found) =
2525                            ::oxsearch_core::__private::from_value::<crate::GeoLocation, V__::Error>(
2526                                json.clone(),
2527                            )
2528                        {
2529                            return ::core::result::Result::Ok(
2530                                GeoDistanceSortLocation::GeoLocation(found),
2531                            );
2532                        }
2533                        ::oxsearch_core::__private::from_value(json)
2534                            .map(GeoDistanceSortLocation::GeoLocationList)
2535                    }
2536                    ::oxsearch_core::__private::Kind::Object => {
2537                        <crate::GeoLocation as ::serde::Deserialize>::deserialize(value)
2538                            .map(GeoDistanceSortLocation::GeoLocation)
2539                    }
2540                    _ => ::core::result::Result::Err(<V__::Error as ::serde::de::Error>::custom(
2541                        format_args!("GeoDistanceSortLocation can't be {kind:?}"),
2542                    )),
2543                }
2544            }
2545        }
2546        ::oxsearch_core::__private::deserialize_by_kind(deserializer, Shape)
2547    }
2548}
2549
2550impl ::core::convert::From<crate::GeoLocation> for GeoDistanceSortLocation {
2551    fn from(value: crate::GeoLocation) -> Self {
2552        Self::GeoLocation(value)
2553    }
2554}
2555
2556impl ::core::convert::From<::std::vec::Vec<crate::GeoLocation>> for GeoDistanceSortLocation {
2557    fn from(value: ::std::vec::Vec<crate::GeoLocation>) -> Self {
2558        Self::GeoLocationList(value)
2559    }
2560}
2561
2562#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
2563#[serde(try_from = "GeoDistanceSortRepr", into = "GeoDistanceSortRepr")]
2564#[non_exhaustive]
2565pub struct GeoDistanceSort {
2566    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
2567    pub mode: ::core::option::Option<crate::SortMode>,
2568    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
2569    pub distance_type: ::core::option::Option<crate::GeoDistanceType>,
2570    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
2571    pub ignore_unmapped: ::core::option::Option<bool>,
2572    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
2573    pub order: ::core::option::Option<crate::SortOrder>,
2574    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
2575    pub unit: ::core::option::Option<crate::DistanceUnit>,
2576    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
2577    pub nested: ::core::option::Option<crate::NestedSortValue>,
2578    /// The name of the property that holds `location`.
2579    pub field: crate::Field,
2580    /// The value under `field`.
2581    pub location: crate::GeoDistanceSortLocation,
2582}
2583
2584impl GeoDistanceSort {
2585    /// A `GeoDistanceSort` with its required properties set.
2586    pub fn new(
2587        field: impl ::core::convert::Into<crate::Field>,
2588        location: impl ::core::convert::Into<crate::GeoDistanceSortLocation>,
2589    ) -> Self {
2590        Self {
2591            mode: ::core::option::Option::None,
2592            distance_type: ::core::option::Option::None,
2593            ignore_unmapped: ::core::option::Option::None,
2594            order: ::core::option::Option::None,
2595            unit: ::core::option::Option::None,
2596            nested: ::core::option::Option::None,
2597            field: field.into(),
2598            location: location.into(),
2599        }
2600    }
2601}
2602
2603impl GeoDistanceSort {
2604    /// Sets `mode`.
2605    pub fn mode(mut self, value: impl ::core::convert::Into<crate::SortMode>) -> Self {
2606        self.mode = ::core::option::Option::Some(value.into());
2607        self
2608    }
2609    /// Sets `distance_type`.
2610    pub fn distance_type(
2611        mut self,
2612        value: impl ::core::convert::Into<crate::GeoDistanceType>,
2613    ) -> Self {
2614        self.distance_type = ::core::option::Option::Some(value.into());
2615        self
2616    }
2617    /// Sets `ignore_unmapped`.
2618    pub fn ignore_unmapped(mut self, value: bool) -> Self {
2619        self.ignore_unmapped = ::core::option::Option::Some(value.into());
2620        self
2621    }
2622    /// Sets `order`.
2623    pub fn order(mut self, value: impl ::core::convert::Into<crate::SortOrder>) -> Self {
2624        self.order = ::core::option::Option::Some(value.into());
2625        self
2626    }
2627    /// Sets `unit`.
2628    pub fn unit(mut self, value: impl ::core::convert::Into<crate::DistanceUnit>) -> Self {
2629        self.unit = ::core::option::Option::Some(value.into());
2630        self
2631    }
2632    /// Sets `nested`.
2633    pub fn nested(mut self, value: impl ::core::convert::Into<crate::NestedSortValue>) -> Self {
2634        self.nested = ::core::option::Option::Some(value.into());
2635        self
2636    }
2637}
2638
2639#[derive(::serde::Serialize, ::serde::Deserialize)]
2640struct GeoDistanceSortRepr {
2641    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
2642    mode: ::core::option::Option<crate::SortMode>,
2643    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
2644    distance_type: ::core::option::Option<crate::GeoDistanceType>,
2645    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
2646    ignore_unmapped: ::core::option::Option<bool>,
2647    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
2648    order: ::core::option::Option<crate::SortOrder>,
2649    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
2650    unit: ::core::option::Option<crate::DistanceUnit>,
2651    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
2652    nested: ::core::option::Option<crate::NestedSortValue>,
2653    #[serde(flatten)]
2654    keyed__: ::indexmap::IndexMap<crate::Field, crate::GeoDistanceSortLocation>,
2655}
2656
2657impl ::core::convert::TryFrom<GeoDistanceSortRepr> for GeoDistanceSort {
2658    type Error = ::std::string::String;
2659    fn try_from(repr: GeoDistanceSortRepr) -> ::core::result::Result<Self, Self::Error> {
2660        let mut keyed = repr.keyed__.into_iter();
2661        match (keyed.next(), keyed.next()) {
2662            (::core::option::Option::Some((field, location)), ::core::option::Option::None) => {
2663                ::core::result::Result::Ok(Self {
2664                    mode: repr.mode,
2665                    distance_type: repr.distance_type,
2666                    ignore_unmapped: repr.ignore_unmapped,
2667                    order: repr.order,
2668                    unit: repr.unit,
2669                    nested: repr.nested,
2670                    field,
2671                    location,
2672                })
2673            }
2674            _ => ::core::result::Result::Err(::std::string::String::from(
2675                "GeoDistanceSort needs exactly one property keyed by its field",
2676            )),
2677        }
2678    }
2679}
2680
2681impl ::core::convert::From<GeoDistanceSort> for GeoDistanceSortRepr {
2682    fn from(value: GeoDistanceSort) -> Self {
2683        let mut keyed__ = ::indexmap::IndexMap::new();
2684        keyed__.insert(value.field, value.location);
2685        Self {
2686            mode: value.mode,
2687            distance_type: value.distance_type,
2688            ignore_unmapped: value.ignore_unmapped,
2689            order: value.order,
2690            unit: value.unit,
2691            nested: value.nested,
2692            keyed__,
2693        }
2694    }
2695}
2696
2697#[derive(Clone, Debug, PartialEq, Eq, Hash)]
2698#[non_exhaustive]
2699pub enum GeoDistanceType {
2700    /// The `arc` calculation is the most accurate.
2701    Arc,
2702    /// The `plane` calculation is faster but less accurate.
2703    Plane,
2704    /// A value this version of the specification doesn't list.
2705    Raw(::std::string::String),
2706}
2707
2708impl GeoDistanceType {
2709    /// The value as Elasticsearch writes it.
2710    pub fn as_str(&self) -> &str {
2711        match self {
2712            Self::Arc => "arc",
2713            Self::Plane => "plane",
2714            Self::Raw(value) => value,
2715        }
2716    }
2717
2718    /// The listed value with this name, if there is one.
2719    pub fn from_known(value: &str) -> ::core::option::Option<Self> {
2720        match value {
2721            "arc" => ::core::option::Option::Some(Self::Arc),
2722            "plane" => ::core::option::Option::Some(Self::Plane),
2723            _ => ::core::option::Option::None,
2724        }
2725    }
2726}
2727
2728impl ::serde::Serialize for GeoDistanceType {
2729    fn serialize<S__: ::serde::Serializer>(
2730        &self,
2731        serializer: S__,
2732    ) -> ::core::result::Result<S__::Ok, S__::Error> {
2733        serializer.serialize_str(self.as_str())
2734    }
2735}
2736
2737impl<'de> ::serde::Deserialize<'de> for GeoDistanceType {
2738    fn deserialize<D__: ::serde::Deserializer<'de>>(
2739        deserializer: D__,
2740    ) -> ::core::result::Result<Self, D__::Error> {
2741        ::oxsearch_core::__private::deserialize_string_enum(
2742            deserializer,
2743            "GeoDistanceType",
2744            |value| Self::from_known(value).unwrap_or_else(|| Self::Raw(value.to_owned())),
2745        )
2746    }
2747}
2748
2749pub type GeoHash = ::std::string::String;
2750
2751#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
2752#[non_exhaustive]
2753pub struct GeoHashLocation {
2754    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
2755    pub geohash: ::core::option::Option<crate::GeoHash>,
2756}
2757
2758impl GeoHashLocation {
2759    /// A `GeoHashLocation` with its required properties set.
2760    pub fn new(geohash: impl ::core::convert::Into<crate::GeoHash>) -> Self {
2761        Self {
2762            geohash: ::core::option::Option::Some(geohash.into()),
2763        }
2764    }
2765}
2766
2767impl GeoHashLocation {}
2768
2769/// A precision that can be expressed as a geohash length between 1 and 12, or a distance measure like "1km", "10m".
2770#[derive(Clone, Debug, PartialEq)]
2771#[non_exhaustive]
2772pub enum GeoHashPrecision {
2773    /// A number.
2774    GeohashLength(i32),
2775    /// A string.
2776    Distance(::std::string::String),
2777}
2778
2779impl ::serde::Serialize for GeoHashPrecision {
2780    fn serialize<S__: ::serde::Serializer>(
2781        &self,
2782        serializer: S__,
2783    ) -> ::core::result::Result<S__::Ok, S__::Error> {
2784        match self {
2785            Self::GeohashLength(value) => ::serde::Serialize::serialize(value, serializer),
2786            Self::Distance(value) => ::serde::Serialize::serialize(value, serializer),
2787        }
2788    }
2789}
2790
2791impl<'de> ::serde::Deserialize<'de> for GeoHashPrecision {
2792    fn deserialize<D__: ::serde::Deserializer<'de>>(
2793        deserializer: D__,
2794    ) -> ::core::result::Result<Self, D__::Error> {
2795        struct Shape;
2796        impl<'de> ::oxsearch_core::__private::ByKind<'de> for Shape {
2797            type Value = GeoHashPrecision;
2798            const EXPECTING: &'static str = "GeoHashPrecision: number or string";
2799            fn visit<V__: ::serde::Deserializer<'de>>(
2800                self,
2801                kind: ::oxsearch_core::__private::Kind,
2802                value: V__,
2803            ) -> ::core::result::Result<Self::Value, V__::Error> {
2804                match kind {
2805                    ::oxsearch_core::__private::Kind::Number => {
2806                        <i32 as ::serde::Deserialize>::deserialize(value)
2807                            .map(GeoHashPrecision::GeohashLength)
2808                    }
2809                    ::oxsearch_core::__private::Kind::String => {
2810                        <::std::string::String as ::serde::Deserialize>::deserialize(value)
2811                            .map(GeoHashPrecision::Distance)
2812                    }
2813                    _ => ::core::result::Result::Err(<V__::Error as ::serde::de::Error>::custom(
2814                        format_args!("GeoHashPrecision can't be {kind:?}"),
2815                    )),
2816                }
2817            }
2818        }
2819        ::oxsearch_core::__private::deserialize_by_kind(deserializer, Shape)
2820    }
2821}
2822
2823impl ::core::convert::From<i32> for GeoHashPrecision {
2824    fn from(value: i32) -> Self {
2825        Self::GeohashLength(value)
2826    }
2827}
2828
2829impl ::core::convert::From<::std::string::String> for GeoHashPrecision {
2830    fn from(value: ::std::string::String) -> Self {
2831        Self::Distance(value)
2832    }
2833}
2834
2835impl ::core::convert::From<&str> for GeoHashPrecision {
2836    fn from(value: &str) -> Self {
2837        Self::Distance(::std::borrow::ToOwned::to_owned(value))
2838    }
2839}
2840
2841/// A map hex cell (H3) reference
2842pub type GeoHexCell = ::std::string::String;
2843
2844/// A GeoJson GeoLine.
2845#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
2846#[non_exhaustive]
2847pub struct GeoLine {
2848    /// Always `"LineString"`
2849    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
2850    pub r#type: ::core::option::Option<::std::string::String>,
2851    /// Array of `[lon, lat]` coordinates
2852    #[serde(default = "::core::default::Default::default")]
2853    pub coordinates: ::std::vec::Vec<::std::vec::Vec<f64>>,
2854}
2855
2856impl GeoLine {
2857    /// A `GeoLine` with its required properties set.
2858    pub fn new(
2859        r#type: impl ::core::convert::Into<::std::string::String>,
2860        coordinates: impl ::core::convert::Into<::std::vec::Vec<::std::vec::Vec<f64>>>,
2861    ) -> Self {
2862        Self {
2863            r#type: ::core::option::Option::Some(r#type.into()),
2864            coordinates: coordinates.into(),
2865        }
2866    }
2867}
2868
2869impl GeoLine {}
2870
2871/// A latitude/longitude as a 2 dimensional point. It can be represented in various ways:
2872/// - as a `{lat, long}` object
2873/// - as a geo hash value
2874/// - as a `[lon, lat]` array
2875/// - as a string in `"<lat>, <lon>"` or WKT point formats
2876#[derive(Clone, Debug, PartialEq)]
2877#[non_exhaustive]
2878pub enum GeoLocation {
2879    /// A object.
2880    Latlon(crate::LatLonGeoLocation),
2881    /// A object.
2882    Geohash(crate::GeoHashLocation),
2883    /// A array.
2884    Coords(::std::vec::Vec<f64>),
2885    /// A string.
2886    Text(::std::string::String),
2887}
2888
2889impl ::serde::Serialize for GeoLocation {
2890    fn serialize<S__: ::serde::Serializer>(
2891        &self,
2892        serializer: S__,
2893    ) -> ::core::result::Result<S__::Ok, S__::Error> {
2894        match self {
2895            Self::Latlon(value) => ::serde::Serialize::serialize(value, serializer),
2896            Self::Geohash(value) => ::serde::Serialize::serialize(value, serializer),
2897            Self::Coords(value) => ::serde::Serialize::serialize(value, serializer),
2898            Self::Text(value) => ::serde::Serialize::serialize(value, serializer),
2899        }
2900    }
2901}
2902
2903impl<'de> ::serde::Deserialize<'de> for GeoLocation {
2904    fn deserialize<D__: ::serde::Deserializer<'de>>(
2905        deserializer: D__,
2906    ) -> ::core::result::Result<Self, D__::Error> {
2907        struct Shape;
2908        impl<'de> ::oxsearch_core::__private::ByKind<'de> for Shape {
2909            type Value = GeoLocation;
2910            const EXPECTING: &'static str = "GeoLocation: array or object or string";
2911            fn visit<V__: ::serde::Deserializer<'de>>(
2912                self,
2913                kind: ::oxsearch_core::__private::Kind,
2914                value: V__,
2915            ) -> ::core::result::Result<Self::Value, V__::Error> {
2916                match kind {
2917                    ::oxsearch_core::__private::Kind::String => {
2918                        <::std::string::String as ::serde::Deserialize>::deserialize(value)
2919                            .map(GeoLocation::Text)
2920                    }
2921                    ::oxsearch_core::__private::Kind::Array => {
2922                        <::std::vec::Vec<f64> as ::serde::Deserialize>::deserialize(value)
2923                            .map(GeoLocation::Coords)
2924                    }
2925                    ::oxsearch_core::__private::Kind::Object => {
2926                        let json: ::serde_json::Value = ::serde::Deserialize::deserialize(value)?;
2927                        if ::oxsearch_core::__private::has(&json, "lat")
2928                            || ::oxsearch_core::__private::has(&json, "lon")
2929                        {
2930                            return ::oxsearch_core::__private::from_value(json)
2931                                .map(GeoLocation::Latlon);
2932                        }
2933                        if ::oxsearch_core::__private::has(&json, "geohash") {
2934                            return ::oxsearch_core::__private::from_value(json)
2935                                .map(GeoLocation::Geohash);
2936                        }
2937                        if let ::core::result::Result::Ok(found) =
2938                            ::oxsearch_core::__private::from_value::<
2939                                crate::LatLonGeoLocation,
2940                                V__::Error,
2941                            >(json.clone())
2942                        {
2943                            return ::core::result::Result::Ok(GeoLocation::Latlon(found));
2944                        }
2945                        ::oxsearch_core::__private::from_value(json).map(GeoLocation::Geohash)
2946                    }
2947                    _ => ::core::result::Result::Err(<V__::Error as ::serde::de::Error>::custom(
2948                        format_args!("GeoLocation can't be {kind:?}"),
2949                    )),
2950                }
2951            }
2952        }
2953        ::oxsearch_core::__private::deserialize_by_kind(deserializer, Shape)
2954    }
2955}
2956
2957impl ::core::convert::From<crate::LatLonGeoLocation> for GeoLocation {
2958    fn from(value: crate::LatLonGeoLocation) -> Self {
2959        Self::Latlon(value)
2960    }
2961}
2962
2963impl ::core::convert::From<crate::GeoHashLocation> for GeoLocation {
2964    fn from(value: crate::GeoHashLocation) -> Self {
2965        Self::Geohash(value)
2966    }
2967}
2968
2969impl ::core::convert::From<::std::vec::Vec<f64>> for GeoLocation {
2970    fn from(value: ::std::vec::Vec<f64>) -> Self {
2971        Self::Coords(value)
2972    }
2973}
2974
2975impl ::core::convert::From<::std::string::String> for GeoLocation {
2976    fn from(value: ::std::string::String) -> Self {
2977        Self::Text(value)
2978    }
2979}
2980
2981impl ::core::convert::From<&str> for GeoLocation {
2982    fn from(value: &str) -> Self {
2983        Self::Text(::std::borrow::ToOwned::to_owned(value))
2984    }
2985}
2986
2987/// A GeoJson shape, that can also use Elasticsearch's `envelope` extension.
2988pub type GeoShape = ::serde_json::Value;
2989
2990#[derive(Clone, Debug, PartialEq, Eq, Hash)]
2991#[non_exhaustive]
2992pub enum GeoShapeRelation {
2993    /// Return all documents whose `geo_shape` or `geo_point` field intersects the query geometry.
2994    Intersects,
2995    /// Return all documents whose `geo_shape` or `geo_point` field has nothing in common with the query geometry.
2996    Disjoint,
2997    /// Return all documents whose `geo_shape` or `geo_point` field is within the query geometry.
2998    /// Line geometries are not supported.
2999    Within,
3000    /// Return all documents whose `geo_shape` or `geo_point` field contains the query geometry.
3001    Contains,
3002    /// A value this version of the specification doesn't list.
3003    Raw(::std::string::String),
3004}
3005
3006impl GeoShapeRelation {
3007    /// The value as Elasticsearch writes it.
3008    pub fn as_str(&self) -> &str {
3009        match self {
3010            Self::Intersects => "intersects",
3011            Self::Disjoint => "disjoint",
3012            Self::Within => "within",
3013            Self::Contains => "contains",
3014            Self::Raw(value) => value,
3015        }
3016    }
3017
3018    /// The listed value with this name, if there is one.
3019    pub fn from_known(value: &str) -> ::core::option::Option<Self> {
3020        match value {
3021            "intersects" => ::core::option::Option::Some(Self::Intersects),
3022            "disjoint" => ::core::option::Option::Some(Self::Disjoint),
3023            "within" => ::core::option::Option::Some(Self::Within),
3024            "contains" => ::core::option::Option::Some(Self::Contains),
3025            _ => ::core::option::Option::None,
3026        }
3027    }
3028}
3029
3030impl ::serde::Serialize for GeoShapeRelation {
3031    fn serialize<S__: ::serde::Serializer>(
3032        &self,
3033        serializer: S__,
3034    ) -> ::core::result::Result<S__::Ok, S__::Error> {
3035        serializer.serialize_str(self.as_str())
3036    }
3037}
3038
3039impl<'de> ::serde::Deserialize<'de> for GeoShapeRelation {
3040    fn deserialize<D__: ::serde::Deserializer<'de>>(
3041        deserializer: D__,
3042    ) -> ::core::result::Result<Self, D__::Error> {
3043        ::oxsearch_core::__private::deserialize_string_enum(
3044            deserializer,
3045            "GeoShapeRelation",
3046            |value| Self::from_known(value).unwrap_or_else(|| Self::Raw(value.to_owned())),
3047        )
3048    }
3049}
3050
3051/// A map tile reference, represented as `{zoom}/{x}/{y}`
3052pub type GeoTile = ::std::string::String;
3053
3054pub type GeoTilePrecision = i32;
3055
3056#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
3057#[non_exhaustive]
3058pub struct GetStats {
3059    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
3060    pub current: ::core::option::Option<i64>,
3061    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
3062    pub exists_time: ::core::option::Option<crate::Duration>,
3063    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
3064    pub exists_time_in_millis: ::core::option::Option<crate::UnitMillis>,
3065    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
3066    pub exists_total: ::core::option::Option<i64>,
3067    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
3068    pub missing_time: ::core::option::Option<crate::Duration>,
3069    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
3070    pub missing_time_in_millis: ::core::option::Option<crate::UnitMillis>,
3071    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
3072    pub missing_total: ::core::option::Option<i64>,
3073    #[serde(
3074        rename = "getTime",
3075        skip_serializing_if = "::core::option::Option::is_none"
3076    )]
3077    pub get_time: ::core::option::Option<crate::Duration>,
3078    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
3079    pub time_in_millis: ::core::option::Option<crate::UnitMillis>,
3080    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
3081    pub total: ::core::option::Option<i64>,
3082}
3083
3084impl GetStats {
3085    /// A `GetStats` with its required properties set.
3086    pub fn new(
3087        current: i64,
3088        exists_time_in_millis: impl ::core::convert::Into<crate::UnitMillis>,
3089        exists_total: i64,
3090        missing_time_in_millis: impl ::core::convert::Into<crate::UnitMillis>,
3091        missing_total: i64,
3092        time_in_millis: impl ::core::convert::Into<crate::UnitMillis>,
3093        total: i64,
3094    ) -> Self {
3095        Self {
3096            current: ::core::option::Option::Some(current.into()),
3097            exists_time: ::core::option::Option::None,
3098            exists_time_in_millis: ::core::option::Option::Some(exists_time_in_millis.into()),
3099            exists_total: ::core::option::Option::Some(exists_total.into()),
3100            missing_time: ::core::option::Option::None,
3101            missing_time_in_millis: ::core::option::Option::Some(missing_time_in_millis.into()),
3102            missing_total: ::core::option::Option::Some(missing_total.into()),
3103            get_time: ::core::option::Option::None,
3104            time_in_millis: ::core::option::Option::Some(time_in_millis.into()),
3105            total: ::core::option::Option::Some(total.into()),
3106        }
3107    }
3108}
3109
3110impl GetStats {
3111    /// Sets `exists_time`.
3112    pub fn exists_time(mut self, value: impl ::core::convert::Into<crate::Duration>) -> Self {
3113        self.exists_time = ::core::option::Option::Some(value.into());
3114        self
3115    }
3116    /// Sets `missing_time`.
3117    pub fn missing_time(mut self, value: impl ::core::convert::Into<crate::Duration>) -> Self {
3118        self.missing_time = ::core::option::Option::Some(value.into());
3119        self
3120    }
3121    /// Sets `get_time`.
3122    pub fn get_time(mut self, value: impl ::core::convert::Into<crate::Duration>) -> Self {
3123        self.get_time = ::core::option::Option::Some(value.into());
3124        self
3125    }
3126}
3127
3128#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
3129#[non_exhaustive]
3130pub struct GlobalOrdinalFieldStats {
3131    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
3132    pub build_time_in_millis: ::core::option::Option<crate::UnitMillis>,
3133    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
3134    pub build_time: ::core::option::Option<::std::string::String>,
3135    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
3136    pub shard_max_value_count: ::core::option::Option<i64>,
3137}
3138
3139impl GlobalOrdinalFieldStats {
3140    /// A `GlobalOrdinalFieldStats` with its required properties set.
3141    pub fn new(
3142        build_time_in_millis: impl ::core::convert::Into<crate::UnitMillis>,
3143        shard_max_value_count: i64,
3144    ) -> Self {
3145        Self {
3146            build_time_in_millis: ::core::option::Option::Some(build_time_in_millis.into()),
3147            build_time: ::core::option::Option::None,
3148            shard_max_value_count: ::core::option::Option::Some(shard_max_value_count.into()),
3149        }
3150    }
3151}
3152
3153impl GlobalOrdinalFieldStats {
3154    /// Sets `build_time`.
3155    pub fn build_time(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
3156        self.build_time = ::core::option::Option::Some(value.into());
3157        self
3158    }
3159}
3160
3161#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
3162#[non_exhaustive]
3163pub struct GlobalOrdinalsStats {
3164    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
3165    pub build_time_in_millis: ::core::option::Option<crate::UnitMillis>,
3166    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
3167    pub build_time: ::core::option::Option<::std::string::String>,
3168    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
3169    pub fields:
3170        ::core::option::Option<::indexmap::IndexMap<crate::Name, crate::GlobalOrdinalFieldStats>>,
3171}
3172
3173impl GlobalOrdinalsStats {
3174    /// A `GlobalOrdinalsStats` with its required properties set.
3175    pub fn new(build_time_in_millis: impl ::core::convert::Into<crate::UnitMillis>) -> Self {
3176        Self {
3177            build_time_in_millis: ::core::option::Option::Some(build_time_in_millis.into()),
3178            build_time: ::core::option::Option::None,
3179            fields: ::core::option::Option::None,
3180        }
3181    }
3182}
3183
3184impl GlobalOrdinalsStats {
3185    /// Sets `build_time`.
3186    pub fn build_time(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
3187        self.build_time = ::core::option::Option::Some(value.into());
3188        self
3189    }
3190    /// Sets `fields`.
3191    pub fn fields(
3192        mut self,
3193        value: impl ::core::convert::Into<
3194            ::indexmap::IndexMap<crate::Name, crate::GlobalOrdinalFieldStats>,
3195        >,
3196    ) -> Self {
3197        self.fields = ::core::option::Option::Some(value.into());
3198        self
3199    }
3200}
3201
3202pub type GrokPattern = ::std::string::String;
3203
3204#[derive(Clone, Debug, PartialEq, Eq, Hash)]
3205#[non_exhaustive]
3206pub enum HealthStatus {
3207    /// All shards are assigned.
3208    Green,
3209    /// All primary shards are assigned, but one or more replica shards are unassigned. If a node in the cluster fails, some data could be unavailable until that node is repaired.
3210    Yellow,
3211    /// One or more primary shards are unassigned, so some data is unavailable. This can occur briefly during cluster startup as primary shards are assigned.
3212    Red,
3213    /// `unknown`
3214    Unknown,
3215    /// `unavailable`
3216    Unavailable,
3217    /// A value this version of the specification doesn't list.
3218    Raw(::std::string::String),
3219}
3220
3221impl HealthStatus {
3222    /// The value as Elasticsearch writes it.
3223    pub fn as_str(&self) -> &str {
3224        match self {
3225            Self::Green => "green",
3226            Self::Yellow => "yellow",
3227            Self::Red => "red",
3228            Self::Unknown => "unknown",
3229            Self::Unavailable => "unavailable",
3230            Self::Raw(value) => value,
3231        }
3232    }
3233
3234    /// The listed value with this name, if there is one.
3235    pub fn from_known(value: &str) -> ::core::option::Option<Self> {
3236        match value {
3237            "green" | "GREEN" => ::core::option::Option::Some(Self::Green),
3238            "yellow" | "YELLOW" => ::core::option::Option::Some(Self::Yellow),
3239            "red" | "RED" => ::core::option::Option::Some(Self::Red),
3240            "unknown" => ::core::option::Option::Some(Self::Unknown),
3241            "unavailable" => ::core::option::Option::Some(Self::Unavailable),
3242            _ => ::core::option::Option::None,
3243        }
3244    }
3245}
3246
3247impl ::serde::Serialize for HealthStatus {
3248    fn serialize<S__: ::serde::Serializer>(
3249        &self,
3250        serializer: S__,
3251    ) -> ::core::result::Result<S__::Ok, S__::Error> {
3252        serializer.serialize_str(self.as_str())
3253    }
3254}
3255
3256impl<'de> ::serde::Deserialize<'de> for HealthStatus {
3257    fn deserialize<D__: ::serde::Deserializer<'de>>(
3258        deserializer: D__,
3259    ) -> ::core::result::Result<Self, D__::Error> {
3260        ::oxsearch_core::__private::deserialize_string_enum(deserializer, "HealthStatus", |value| {
3261            Self::from_known(value).unwrap_or_else(|| Self::Raw(value.to_owned()))
3262        })
3263    }
3264}
3265
3266pub type Host = ::std::string::String;
3267
3268pub type HttpHeaders = ::indexmap::IndexMap<
3269    ::std::string::String,
3270    ::oxsearch_core::shapes::OneOrMany<::std::string::String>,
3271>;
3272
3273#[derive(Clone, Debug, PartialEq, Eq, Hash)]
3274#[non_exhaustive]
3275pub enum IBDistribution {
3276    /// `ll`
3277    Ll,
3278    /// `spl`
3279    Spl,
3280    /// A value this version of the specification doesn't list.
3281    Raw(::std::string::String),
3282}
3283
3284impl IBDistribution {
3285    /// The value as Elasticsearch writes it.
3286    pub fn as_str(&self) -> &str {
3287        match self {
3288            Self::Ll => "ll",
3289            Self::Spl => "spl",
3290            Self::Raw(value) => value,
3291        }
3292    }
3293
3294    /// The listed value with this name, if there is one.
3295    pub fn from_known(value: &str) -> ::core::option::Option<Self> {
3296        match value {
3297            "ll" => ::core::option::Option::Some(Self::Ll),
3298            "spl" => ::core::option::Option::Some(Self::Spl),
3299            _ => ::core::option::Option::None,
3300        }
3301    }
3302}
3303
3304impl ::serde::Serialize for IBDistribution {
3305    fn serialize<S__: ::serde::Serializer>(
3306        &self,
3307        serializer: S__,
3308    ) -> ::core::result::Result<S__::Ok, S__::Error> {
3309        serializer.serialize_str(self.as_str())
3310    }
3311}
3312
3313impl<'de> ::serde::Deserialize<'de> for IBDistribution {
3314    fn deserialize<D__: ::serde::Deserializer<'de>>(
3315        deserializer: D__,
3316    ) -> ::core::result::Result<Self, D__::Error> {
3317        ::oxsearch_core::__private::deserialize_string_enum(
3318            deserializer,
3319            "IBDistribution",
3320            |value| Self::from_known(value).unwrap_or_else(|| Self::Raw(value.to_owned())),
3321        )
3322    }
3323}
3324
3325#[derive(Clone, Debug, PartialEq, Eq, Hash)]
3326#[non_exhaustive]
3327pub enum IBLambda {
3328    /// `df`
3329    Df,
3330    /// `ttf`
3331    Ttf,
3332    /// A value this version of the specification doesn't list.
3333    Raw(::std::string::String),
3334}
3335
3336impl IBLambda {
3337    /// The value as Elasticsearch writes it.
3338    pub fn as_str(&self) -> &str {
3339        match self {
3340            Self::Df => "df",
3341            Self::Ttf => "ttf",
3342            Self::Raw(value) => value,
3343        }
3344    }
3345
3346    /// The listed value with this name, if there is one.
3347    pub fn from_known(value: &str) -> ::core::option::Option<Self> {
3348        match value {
3349            "df" => ::core::option::Option::Some(Self::Df),
3350            "ttf" => ::core::option::Option::Some(Self::Ttf),
3351            _ => ::core::option::Option::None,
3352        }
3353    }
3354}
3355
3356impl ::serde::Serialize for IBLambda {
3357    fn serialize<S__: ::serde::Serializer>(
3358        &self,
3359        serializer: S__,
3360    ) -> ::core::result::Result<S__::Ok, S__::Error> {
3361        serializer.serialize_str(self.as_str())
3362    }
3363}
3364
3365impl<'de> ::serde::Deserialize<'de> for IBLambda {
3366    fn deserialize<D__: ::serde::Deserializer<'de>>(
3367        deserializer: D__,
3368    ) -> ::core::result::Result<Self, D__::Error> {
3369        ::oxsearch_core::__private::deserialize_string_enum(deserializer, "IBLambda", |value| {
3370            Self::from_known(value).unwrap_or_else(|| Self::Raw(value.to_owned()))
3371        })
3372    }
3373}
3374
3375pub type Id = ::std::string::String;
3376
3377pub type Ids = ::oxsearch_core::shapes::OneOrMany<crate::Id>;
3378
3379pub type IndexAlias = ::std::string::String;
3380
3381pub type IndexName = ::std::string::String;
3382
3383pub type IndexPattern = ::std::string::String;
3384
3385pub type IndexPatterns = ::std::vec::Vec<crate::IndexPattern>;
3386
3387#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
3388#[non_exhaustive]
3389pub struct IndexingStats {
3390    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
3391    pub index_current: ::core::option::Option<i64>,
3392    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
3393    pub delete_current: ::core::option::Option<i64>,
3394    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
3395    pub delete_time: ::core::option::Option<crate::Duration>,
3396    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
3397    pub delete_time_in_millis: ::core::option::Option<crate::UnitMillis>,
3398    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
3399    pub delete_total: ::core::option::Option<i64>,
3400    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
3401    pub is_throttled: ::core::option::Option<bool>,
3402    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
3403    pub noop_update_total: ::core::option::Option<i64>,
3404    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
3405    pub throttle_time: ::core::option::Option<crate::Duration>,
3406    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
3407    pub throttle_time_in_millis: ::core::option::Option<crate::UnitMillis>,
3408    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
3409    pub index_time: ::core::option::Option<crate::Duration>,
3410    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
3411    pub index_time_in_millis: ::core::option::Option<crate::UnitMillis>,
3412    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
3413    pub index_total: ::core::option::Option<i64>,
3414    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
3415    pub index_failed: ::core::option::Option<i64>,
3416    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
3417    pub index_failed_due_to_version_conflict: ::core::option::Option<i64>,
3418    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
3419    pub types:
3420        ::core::option::Option<::indexmap::IndexMap<::std::string::String, crate::IndexingStats>>,
3421    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
3422    pub write_load: ::core::option::Option<f64>,
3423    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
3424    pub recent_write_load: ::core::option::Option<f64>,
3425    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
3426    pub peak_write_load: ::core::option::Option<f64>,
3427}
3428
3429impl IndexingStats {
3430    /// A `IndexingStats` with its required properties set.
3431    pub fn new(
3432        index_current: i64,
3433        delete_current: i64,
3434        delete_time_in_millis: impl ::core::convert::Into<crate::UnitMillis>,
3435        delete_total: i64,
3436        is_throttled: bool,
3437        noop_update_total: i64,
3438        throttle_time_in_millis: impl ::core::convert::Into<crate::UnitMillis>,
3439        index_time_in_millis: impl ::core::convert::Into<crate::UnitMillis>,
3440        index_total: i64,
3441        index_failed: i64,
3442        index_failed_due_to_version_conflict: i64,
3443    ) -> Self {
3444        Self {
3445            index_current: ::core::option::Option::Some(index_current.into()),
3446            delete_current: ::core::option::Option::Some(delete_current.into()),
3447            delete_time: ::core::option::Option::None,
3448            delete_time_in_millis: ::core::option::Option::Some(delete_time_in_millis.into()),
3449            delete_total: ::core::option::Option::Some(delete_total.into()),
3450            is_throttled: ::core::option::Option::Some(is_throttled.into()),
3451            noop_update_total: ::core::option::Option::Some(noop_update_total.into()),
3452            throttle_time: ::core::option::Option::None,
3453            throttle_time_in_millis: ::core::option::Option::Some(throttle_time_in_millis.into()),
3454            index_time: ::core::option::Option::None,
3455            index_time_in_millis: ::core::option::Option::Some(index_time_in_millis.into()),
3456            index_total: ::core::option::Option::Some(index_total.into()),
3457            index_failed: ::core::option::Option::Some(index_failed.into()),
3458            index_failed_due_to_version_conflict: ::core::option::Option::Some(
3459                index_failed_due_to_version_conflict.into(),
3460            ),
3461            types: ::core::option::Option::None,
3462            write_load: ::core::option::Option::None,
3463            recent_write_load: ::core::option::Option::None,
3464            peak_write_load: ::core::option::Option::None,
3465        }
3466    }
3467}
3468
3469impl IndexingStats {
3470    /// Sets `delete_time`.
3471    pub fn delete_time(mut self, value: impl ::core::convert::Into<crate::Duration>) -> Self {
3472        self.delete_time = ::core::option::Option::Some(value.into());
3473        self
3474    }
3475    /// Sets `throttle_time`.
3476    pub fn throttle_time(mut self, value: impl ::core::convert::Into<crate::Duration>) -> Self {
3477        self.throttle_time = ::core::option::Option::Some(value.into());
3478        self
3479    }
3480    /// Sets `index_time`.
3481    pub fn index_time(mut self, value: impl ::core::convert::Into<crate::Duration>) -> Self {
3482        self.index_time = ::core::option::Option::Some(value.into());
3483        self
3484    }
3485    /// Sets `types`.
3486    pub fn types(
3487        mut self,
3488        value: impl ::core::convert::Into<
3489            ::indexmap::IndexMap<::std::string::String, crate::IndexingStats>,
3490        >,
3491    ) -> Self {
3492        self.types = ::core::option::Option::Some(value.into());
3493        self
3494    }
3495    /// Sets `write_load`.
3496    pub fn write_load(mut self, value: f64) -> Self {
3497        self.write_load = ::core::option::Option::Some(value.into());
3498        self
3499    }
3500    /// Sets `recent_write_load`.
3501    pub fn recent_write_load(mut self, value: f64) -> Self {
3502        self.recent_write_load = ::core::option::Option::Some(value.into());
3503        self
3504    }
3505    /// Sets `peak_write_load`.
3506    pub fn peak_write_load(mut self, value: f64) -> Self {
3507        self.peak_write_load = ::core::option::Option::Some(value.into());
3508        self
3509    }
3510}
3511
3512pub type Indices = ::oxsearch_core::shapes::OneOrMany<crate::IndexName>;
3513
3514/// Controls how to deal with unavailable concrete indices (closed or missing), how wildcard expressions are expanded
3515/// to actual indices (all, closed or open indices) and how to deal with wildcard expressions that resolve to no indices.
3516#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
3517#[non_exhaustive]
3518pub struct IndicesOptions {
3519    /// A setting that does two separate checks on the index expression.
3520    /// If `false`, the request returns an error (1) if any wildcard expression
3521    /// (including `_all` and `*`) resolves to zero matching indices or (2) if the
3522    /// complete set of resolved indices, aliases or data streams is empty after all
3523    /// expressions are evaluated. If `true`, index expressions that resolve to no
3524    /// indices are allowed and the request returns an empty result.
3525    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
3526    pub allow_no_indices: ::core::option::Option<bool>,
3527    /// Type of index that wildcard patterns can match. If the request can target data streams, this argument
3528    /// determines whether wildcard expressions match hidden data streams. Supports comma-separated values,
3529    /// such as `open,hidden`.
3530    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
3531    pub expand_wildcards: ::core::option::Option<crate::ExpandWildcards>,
3532    /// If `false`, the request returns an error if it targets a concrete (non-wildcarded)
3533    /// index, alias, or data stream that is missing, closed, or otherwise unavailable.
3534    /// If `true`, unavailable concrete targets are silently ignored.
3535    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
3536    pub ignore_unavailable: ::core::option::Option<bool>,
3537    /// If true, concrete, expanded or aliased indices are ignored when frozen.
3538    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
3539    pub ignore_throttled: ::core::option::Option<bool>,
3540}
3541
3542impl IndicesOptions {
3543    /// A `IndicesOptions` with its required properties set.
3544    pub fn new() -> Self {
3545        Self {
3546            allow_no_indices: ::core::option::Option::None,
3547            expand_wildcards: ::core::option::Option::None,
3548            ignore_unavailable: ::core::option::Option::None,
3549            ignore_throttled: ::core::option::Option::None,
3550        }
3551    }
3552}
3553
3554impl IndicesOptions {
3555    /// Sets `allow_no_indices`.
3556    pub fn allow_no_indices(mut self, value: bool) -> Self {
3557        self.allow_no_indices = ::core::option::Option::Some(value.into());
3558        self
3559    }
3560    /// Sets `expand_wildcards`.
3561    pub fn expand_wildcards(
3562        mut self,
3563        value: impl ::core::convert::Into<crate::ExpandWildcards>,
3564    ) -> Self {
3565        self.expand_wildcards = ::core::option::Option::Some(value.into());
3566        self
3567    }
3568    /// Sets `ignore_unavailable`.
3569    pub fn ignore_unavailable(mut self, value: bool) -> Self {
3570        self.ignore_unavailable = ::core::option::Option::Some(value.into());
3571        self
3572    }
3573    /// Sets `ignore_throttled`.
3574    pub fn ignore_throttled(mut self, value: bool) -> Self {
3575        self.ignore_throttled = ::core::option::Option::Some(value.into());
3576        self
3577    }
3578}
3579
3580#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
3581#[non_exhaustive]
3582pub struct IndicesResponseBase {
3583    /// For a successful response, this value is always true. On failure, an exception is returned instead.
3584    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
3585    pub acknowledged: ::core::option::Option<bool>,
3586    #[serde(
3587        rename = "_shards",
3588        skip_serializing_if = "::core::option::Option::is_none"
3589    )]
3590    pub shards: ::core::option::Option<crate::ShardStatistics>,
3591}
3592
3593impl IndicesResponseBase {
3594    /// A `IndicesResponseBase` with its required properties set.
3595    pub fn new(acknowledged: bool) -> Self {
3596        Self {
3597            acknowledged: ::core::option::Option::Some(acknowledged.into()),
3598            shards: ::core::option::Option::None,
3599        }
3600    }
3601}
3602
3603impl IndicesResponseBase {
3604    /// Sets `shards`.
3605    pub fn shards(mut self, value: impl ::core::convert::Into<crate::ShardStatistics>) -> Self {
3606        self.shards = ::core::option::Option::Some(value.into());
3607        self
3608    }
3609}
3610
3611#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
3612#[non_exhaustive]
3613pub struct InferenceString {
3614    /// The type of data that the value represents.
3615    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
3616    pub r#type: ::core::option::Option<crate::inference::EmbeddingContentType>,
3617    /// The format of the data. If null, the default data format for the given type is used.
3618    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
3619    pub format: ::core::option::Option<crate::inference::EmbeddingContentFormat>,
3620    /// String which may be raw text, or the string representation of some other data such as an image in base64.
3621    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
3622    pub value: ::core::option::Option<::std::string::String>,
3623}
3624
3625impl InferenceString {
3626    /// A `InferenceString` with its required properties set.
3627    pub fn new(
3628        r#type: impl ::core::convert::Into<crate::inference::EmbeddingContentType>,
3629        value: impl ::core::convert::Into<::std::string::String>,
3630    ) -> Self {
3631        Self {
3632            r#type: ::core::option::Option::Some(r#type.into()),
3633            format: ::core::option::Option::None,
3634            value: ::core::option::Option::Some(value.into()),
3635        }
3636    }
3637}
3638
3639impl InferenceString {
3640    /// Sets `format`.
3641    pub fn format(
3642        mut self,
3643        value: impl ::core::convert::Into<crate::inference::EmbeddingContentFormat>,
3644    ) -> Self {
3645        self.format = ::core::option::Option::Some(value.into());
3646        self
3647    }
3648}
3649
3650pub type InferenceStringGroup = ::oxsearch_core::shapes::OneOrMany<crate::InferenceString>;
3651
3652#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
3653#[non_exhaustive]
3654pub struct InlineGet<TDocument = ::serde_json::Value> {
3655    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
3656    pub fields:
3657        ::core::option::Option<::indexmap::IndexMap<::std::string::String, ::serde_json::Value>>,
3658    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
3659    pub found: ::core::option::Option<bool>,
3660    #[serde(
3661        rename = "_seq_no",
3662        skip_serializing_if = "::core::option::Option::is_none"
3663    )]
3664    pub seq_no: ::core::option::Option<crate::SequenceNumber>,
3665    #[serde(
3666        rename = "_primary_term",
3667        skip_serializing_if = "::core::option::Option::is_none"
3668    )]
3669    pub primary_term: ::core::option::Option<i64>,
3670    #[serde(
3671        rename = "_routing",
3672        skip_serializing_if = "::core::option::Option::is_none"
3673    )]
3674    pub routing: ::core::option::Option<crate::Routing>,
3675    #[serde(
3676        rename = "_source",
3677        skip_serializing_if = "::core::option::Option::is_none"
3678    )]
3679    pub source: ::core::option::Option<TDocument>,
3680    /// Properties the specification doesn't name.
3681    #[serde(flatten)]
3682    pub metadata: ::indexmap::IndexMap<::std::string::String, ::serde_json::Value>,
3683}
3684
3685impl InlineGet<::serde_json::Value> {
3686    /// A `InlineGet` with its required properties set.
3687    pub fn new(found: bool) -> Self {
3688        Self {
3689            fields: ::core::option::Option::None,
3690            found: ::core::option::Option::Some(found.into()),
3691            seq_no: ::core::option::Option::None,
3692            primary_term: ::core::option::Option::None,
3693            routing: ::core::option::Option::None,
3694            source: ::core::option::Option::None,
3695            metadata: ::core::default::Default::default(),
3696        }
3697    }
3698}
3699
3700impl<TDocument> InlineGet<TDocument> {
3701    /// Sets `fields`.
3702    pub fn fields(
3703        mut self,
3704        value: impl ::core::convert::Into<
3705            ::indexmap::IndexMap<::std::string::String, ::serde_json::Value>,
3706        >,
3707    ) -> Self {
3708        self.fields = ::core::option::Option::Some(value.into());
3709        self
3710    }
3711    /// Sets `seq_no`.
3712    pub fn seq_no(mut self, value: impl ::core::convert::Into<crate::SequenceNumber>) -> Self {
3713        self.seq_no = ::core::option::Option::Some(value.into());
3714        self
3715    }
3716    /// Sets `primary_term`.
3717    pub fn primary_term(mut self, value: i64) -> Self {
3718        self.primary_term = ::core::option::Option::Some(value.into());
3719        self
3720    }
3721    /// Sets `routing`.
3722    pub fn routing(mut self, value: impl ::core::convert::Into<crate::Routing>) -> Self {
3723        self.routing = ::core::option::Option::Some(value.into());
3724        self
3725    }
3726    /// Sets `source`.
3727    pub fn source<TDocument2>(self, value: TDocument2) -> InlineGet<TDocument2> {
3728        InlineGet {
3729            fields: self.fields,
3730            found: self.found,
3731            seq_no: self.seq_no,
3732            primary_term: self.primary_term,
3733            routing: self.routing,
3734            metadata: self.metadata,
3735            source: ::core::option::Option::Some(value.into()),
3736        }
3737    }
3738}
3739
3740#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
3741#[non_exhaustive]
3742pub struct InnerRetriever {
3743    /// The nested retriever configuration.
3744    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
3745    pub retriever: ::core::option::Option<crate::RetrieverContainer>,
3746    /// Weight multiplier for this retriever's contribution to the linear combination.
3747    /// Must be non-negative.
3748    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
3749    pub weight: ::core::option::Option<f32>,
3750    /// Score normalizer to apply to this retriever's results before weighting.
3751    /// Falls back to the top-level `normalizer` on the linear retriever if unset,
3752    /// then to `none` (identity) if neither is set.
3753    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
3754    pub normalizer: ::core::option::Option<crate::ScoreNormalizer>,
3755}
3756
3757impl InnerRetriever {
3758    /// A `InnerRetriever` with its required properties set.
3759    pub fn new(retriever: impl ::core::convert::Into<crate::RetrieverContainer>) -> Self {
3760        Self {
3761            retriever: ::core::option::Option::Some(retriever.into()),
3762            weight: ::core::option::Option::None,
3763            normalizer: ::core::option::Option::None,
3764        }
3765    }
3766}
3767
3768impl InnerRetriever {
3769    /// Sets `weight`.
3770    pub fn weight(mut self, value: f32) -> Self {
3771        self.weight = ::core::option::Option::Some(value.into());
3772        self
3773    }
3774    /// Sets `normalizer`.
3775    pub fn normalizer(mut self, value: impl ::core::convert::Into<crate::ScoreNormalizer>) -> Self {
3776        self.normalizer = ::core::option::Option::Some(value.into());
3777        self
3778    }
3779}
3780
3781pub type Ip = ::std::string::String;
3782
3783/// Knn embedding input.
3784/// Either a string, an object or array of objects
3785#[derive(Clone, Debug, PartialEq)]
3786#[non_exhaustive]
3787pub enum KnnEmbeddingInput {
3788    /// A string.
3789    String(::std::string::String),
3790    /// A array or object.
3791    Object(crate::InferenceStringGroup),
3792}
3793
3794impl ::serde::Serialize for KnnEmbeddingInput {
3795    fn serialize<S__: ::serde::Serializer>(
3796        &self,
3797        serializer: S__,
3798    ) -> ::core::result::Result<S__::Ok, S__::Error> {
3799        match self {
3800            Self::String(value) => ::serde::Serialize::serialize(value, serializer),
3801            Self::Object(value) => ::serde::Serialize::serialize(value, serializer),
3802        }
3803    }
3804}
3805
3806impl<'de> ::serde::Deserialize<'de> for KnnEmbeddingInput {
3807    fn deserialize<D__: ::serde::Deserializer<'de>>(
3808        deserializer: D__,
3809    ) -> ::core::result::Result<Self, D__::Error> {
3810        struct Shape;
3811        impl<'de> ::oxsearch_core::__private::ByKind<'de> for Shape {
3812            type Value = KnnEmbeddingInput;
3813            const EXPECTING: &'static str = "KnnEmbeddingInput: array or object or string";
3814            fn visit<V__: ::serde::Deserializer<'de>>(
3815                self,
3816                kind: ::oxsearch_core::__private::Kind,
3817                value: V__,
3818            ) -> ::core::result::Result<Self::Value, V__::Error> {
3819                match kind {
3820                    ::oxsearch_core::__private::Kind::String => {
3821                        <::std::string::String as ::serde::Deserialize>::deserialize(value)
3822                            .map(KnnEmbeddingInput::String)
3823                    }
3824                    ::oxsearch_core::__private::Kind::Array => {
3825                        <crate::InferenceStringGroup as ::serde::Deserialize>::deserialize(value)
3826                            .map(KnnEmbeddingInput::Object)
3827                    }
3828                    ::oxsearch_core::__private::Kind::Object => {
3829                        <crate::InferenceStringGroup as ::serde::Deserialize>::deserialize(value)
3830                            .map(KnnEmbeddingInput::Object)
3831                    }
3832                    _ => ::core::result::Result::Err(<V__::Error as ::serde::de::Error>::custom(
3833                        format_args!("KnnEmbeddingInput can't be {kind:?}"),
3834                    )),
3835                }
3836            }
3837        }
3838        ::oxsearch_core::__private::deserialize_by_kind(deserializer, Shape)
3839    }
3840}
3841
3842impl ::core::convert::From<::std::string::String> for KnnEmbeddingInput {
3843    fn from(value: ::std::string::String) -> Self {
3844        Self::String(value)
3845    }
3846}
3847
3848impl ::core::convert::From<crate::InferenceStringGroup> for KnnEmbeddingInput {
3849    fn from(value: crate::InferenceStringGroup) -> Self {
3850        Self::Object(value)
3851    }
3852}
3853
3854impl ::core::convert::From<&str> for KnnEmbeddingInput {
3855    fn from(value: &str) -> Self {
3856        Self::String(::std::borrow::ToOwned::to_owned(value))
3857    }
3858}
3859
3860#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
3861#[non_exhaustive]
3862pub struct KnnQuery {
3863    /// Floating point number used to decrease or increase the relevance scores of the query.
3864    /// Boost values are relative to the default value of 1.0.
3865    /// A boost value between 0 and 1.0 decreases the relevance score.
3866    /// A value greater than 1.0 increases the relevance score.
3867    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
3868    pub boost: ::core::option::Option<f32>,
3869    #[serde(
3870        rename = "_name",
3871        skip_serializing_if = "::core::option::Option::is_none"
3872    )]
3873    pub name: ::core::option::Option<::std::string::String>,
3874    /// The name of the vector field to search against
3875    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
3876    pub field: ::core::option::Option<crate::Field>,
3877    /// The query vector
3878    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
3879    pub query_vector: ::core::option::Option<crate::QueryVector>,
3880    /// The query vector builder. You must provide a query_vector_builder or query_vector, but not both.
3881    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
3882    pub query_vector_builder: ::core::option::Option<crate::QueryVectorBuilder>,
3883    /// The number of nearest neighbor candidates to consider per shard
3884    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
3885    pub num_candidates: ::core::option::Option<i32>,
3886    /// The percentage of vectors to explore per shard while doing knn search with bbq_disk
3887    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
3888    pub visit_percentage: ::core::option::Option<f32>,
3889    /// The final number of nearest neighbors to return as top hits
3890    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
3891    pub k: ::core::option::Option<i32>,
3892    /// Filters for the kNN search query
3893    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
3894    pub filter: ::core::option::Option<
3895        ::oxsearch_core::shapes::OneOrMany<crate::query_dsl::QueryContainer>,
3896    >,
3897    /// The minimum similarity for a vector to be considered a match
3898    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
3899    pub similarity: ::core::option::Option<f32>,
3900    /// Apply oversampling and rescoring to quantized vectors
3901    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
3902    pub rescore_vector: ::core::option::Option<crate::RescoreVector>,
3903}
3904
3905impl KnnQuery {
3906    /// A `KnnQuery` with its required properties set.
3907    pub fn new(field: impl ::core::convert::Into<crate::Field>) -> Self {
3908        Self {
3909            boost: ::core::option::Option::None,
3910            name: ::core::option::Option::None,
3911            field: ::core::option::Option::Some(field.into()),
3912            query_vector: ::core::option::Option::None,
3913            query_vector_builder: ::core::option::Option::None,
3914            num_candidates: ::core::option::Option::None,
3915            visit_percentage: ::core::option::Option::None,
3916            k: ::core::option::Option::None,
3917            filter: ::core::option::Option::None,
3918            similarity: ::core::option::Option::None,
3919            rescore_vector: ::core::option::Option::None,
3920        }
3921    }
3922}
3923
3924impl KnnQuery {
3925    /// Sets `boost`.
3926    pub fn boost(mut self, value: f32) -> Self {
3927        self.boost = ::core::option::Option::Some(value.into());
3928        self
3929    }
3930    /// Sets `name`.
3931    pub fn name(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
3932        self.name = ::core::option::Option::Some(value.into());
3933        self
3934    }
3935    /// Sets `query_vector`.
3936    pub fn query_vector(mut self, value: impl ::core::convert::Into<crate::QueryVector>) -> Self {
3937        self.query_vector = ::core::option::Option::Some(value.into());
3938        self
3939    }
3940    /// Sets `query_vector_builder`.
3941    pub fn query_vector_builder(
3942        mut self,
3943        value: impl ::core::convert::Into<crate::QueryVectorBuilder>,
3944    ) -> Self {
3945        self.query_vector_builder = ::core::option::Option::Some(value.into());
3946        self
3947    }
3948    /// Sets `num_candidates`.
3949    pub fn num_candidates(mut self, value: i32) -> Self {
3950        self.num_candidates = ::core::option::Option::Some(value.into());
3951        self
3952    }
3953    /// Sets `visit_percentage`.
3954    pub fn visit_percentage(mut self, value: f32) -> Self {
3955        self.visit_percentage = ::core::option::Option::Some(value.into());
3956        self
3957    }
3958    /// Sets `k`.
3959    pub fn k(mut self, value: i32) -> Self {
3960        self.k = ::core::option::Option::Some(value.into());
3961        self
3962    }
3963    /// Sets `filter`.
3964    pub fn filter(
3965        mut self,
3966        value: impl ::core::convert::Into<
3967            ::oxsearch_core::shapes::OneOrMany<crate::query_dsl::QueryContainer>,
3968        >,
3969    ) -> Self {
3970        self.filter = ::core::option::Option::Some(value.into());
3971        self
3972    }
3973    /// Sets `similarity`.
3974    pub fn similarity(mut self, value: f32) -> Self {
3975        self.similarity = ::core::option::Option::Some(value.into());
3976        self
3977    }
3978    /// Sets `rescore_vector`.
3979    pub fn rescore_vector(
3980        mut self,
3981        value: impl ::core::convert::Into<crate::RescoreVector>,
3982    ) -> Self {
3983        self.rescore_vector = ::core::option::Option::Some(value.into());
3984        self
3985    }
3986}
3987
3988#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
3989#[non_exhaustive]
3990pub struct KnnRetriever {
3991    /// Query to filter the documents that can match.
3992    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
3993    pub filter: ::core::option::Option<
3994        ::oxsearch_core::shapes::OneOrMany<crate::query_dsl::QueryContainer>,
3995    >,
3996    /// Minimum _score for matching documents. Documents with a lower _score are not included in the top documents.
3997    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
3998    pub min_score: ::core::option::Option<f32>,
3999    /// Retriever name.
4000    #[serde(
4001        rename = "_name",
4002        skip_serializing_if = "::core::option::Option::is_none"
4003    )]
4004    pub name: ::core::option::Option<::std::string::String>,
4005    /// The name of the vector field to search against.
4006    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
4007    pub field: ::core::option::Option<::std::string::String>,
4008    /// Query vector. Must have the same number of dimensions as the vector field you are searching against. You must provide a query_vector_builder or query_vector, but not both.
4009    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
4010    pub query_vector: ::core::option::Option<crate::QueryVector>,
4011    /// Defines a model to build a query vector.
4012    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
4013    pub query_vector_builder: ::core::option::Option<crate::QueryVectorBuilder>,
4014    /// Number of nearest neighbors to return as top hits.
4015    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
4016    pub k: ::core::option::Option<i32>,
4017    /// Number of nearest neighbor candidates to consider per shard.
4018    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
4019    pub num_candidates: ::core::option::Option<i32>,
4020    /// The percentage of vectors to explore per shard while doing knn search with bbq_disk
4021    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
4022    pub visit_percentage: ::core::option::Option<f32>,
4023    /// The minimum similarity required for a document to be considered a match.
4024    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
4025    pub similarity: ::core::option::Option<f32>,
4026    /// Apply oversampling and rescoring to quantized vectors
4027    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
4028    pub rescore_vector: ::core::option::Option<crate::RescoreVector>,
4029}
4030
4031impl KnnRetriever {
4032    /// A `KnnRetriever` with its required properties set.
4033    pub fn new(field: impl ::core::convert::Into<::std::string::String>, k: i32) -> Self {
4034        Self {
4035            filter: ::core::option::Option::None,
4036            min_score: ::core::option::Option::None,
4037            name: ::core::option::Option::None,
4038            field: ::core::option::Option::Some(field.into()),
4039            query_vector: ::core::option::Option::None,
4040            query_vector_builder: ::core::option::Option::None,
4041            k: ::core::option::Option::Some(k.into()),
4042            num_candidates: ::core::option::Option::None,
4043            visit_percentage: ::core::option::Option::None,
4044            similarity: ::core::option::Option::None,
4045            rescore_vector: ::core::option::Option::None,
4046        }
4047    }
4048}
4049
4050impl KnnRetriever {
4051    /// Sets `filter`.
4052    pub fn filter(
4053        mut self,
4054        value: impl ::core::convert::Into<
4055            ::oxsearch_core::shapes::OneOrMany<crate::query_dsl::QueryContainer>,
4056        >,
4057    ) -> Self {
4058        self.filter = ::core::option::Option::Some(value.into());
4059        self
4060    }
4061    /// Sets `min_score`.
4062    pub fn min_score(mut self, value: f32) -> Self {
4063        self.min_score = ::core::option::Option::Some(value.into());
4064        self
4065    }
4066    /// Sets `name`.
4067    pub fn name(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
4068        self.name = ::core::option::Option::Some(value.into());
4069        self
4070    }
4071    /// Sets `query_vector`.
4072    pub fn query_vector(mut self, value: impl ::core::convert::Into<crate::QueryVector>) -> Self {
4073        self.query_vector = ::core::option::Option::Some(value.into());
4074        self
4075    }
4076    /// Sets `query_vector_builder`.
4077    pub fn query_vector_builder(
4078        mut self,
4079        value: impl ::core::convert::Into<crate::QueryVectorBuilder>,
4080    ) -> Self {
4081        self.query_vector_builder = ::core::option::Option::Some(value.into());
4082        self
4083    }
4084    /// Sets `num_candidates`.
4085    pub fn num_candidates(mut self, value: i32) -> Self {
4086        self.num_candidates = ::core::option::Option::Some(value.into());
4087        self
4088    }
4089    /// Sets `visit_percentage`.
4090    pub fn visit_percentage(mut self, value: f32) -> Self {
4091        self.visit_percentage = ::core::option::Option::Some(value.into());
4092        self
4093    }
4094    /// Sets `similarity`.
4095    pub fn similarity(mut self, value: f32) -> Self {
4096        self.similarity = ::core::option::Option::Some(value.into());
4097        self
4098    }
4099    /// Sets `rescore_vector`.
4100    pub fn rescore_vector(
4101        mut self,
4102        value: impl ::core::convert::Into<crate::RescoreVector>,
4103    ) -> Self {
4104        self.rescore_vector = ::core::option::Option::Some(value.into());
4105        self
4106    }
4107}
4108
4109#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
4110#[non_exhaustive]
4111pub struct KnnSearch {
4112    /// The name of the vector field to search against
4113    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
4114    pub field: ::core::option::Option<crate::Field>,
4115    /// The query vector
4116    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
4117    pub query_vector: ::core::option::Option<crate::QueryVector>,
4118    /// The query vector builder. You must provide a query_vector_builder or query_vector, but not both.
4119    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
4120    pub query_vector_builder: ::core::option::Option<crate::QueryVectorBuilder>,
4121    /// The final number of nearest neighbors to return as top hits
4122    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
4123    pub k: ::core::option::Option<i32>,
4124    /// The number of nearest neighbor candidates to consider per shard
4125    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
4126    pub num_candidates: ::core::option::Option<i32>,
4127    /// The percentage of vectors to explore per shard while doing knn search with bbq_disk
4128    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
4129    pub visit_percentage: ::core::option::Option<f32>,
4130    /// Boost value to apply to kNN scores
4131    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
4132    pub boost: ::core::option::Option<f32>,
4133    /// Filters for the kNN search query
4134    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
4135    pub filter: ::core::option::Option<
4136        ::oxsearch_core::shapes::OneOrMany<crate::query_dsl::QueryContainer>,
4137    >,
4138    /// The minimum similarity for a vector to be considered a match
4139    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
4140    pub similarity: ::core::option::Option<f32>,
4141    /// If defined, each search hit will contain inner hits.
4142    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
4143    pub inner_hits: ::core::option::Option<crate::search::InnerHits>,
4144    /// Apply oversampling and rescoring to quantized vectors
4145    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
4146    pub rescore_vector: ::core::option::Option<crate::RescoreVector>,
4147    #[serde(
4148        rename = "_name",
4149        skip_serializing_if = "::core::option::Option::is_none"
4150    )]
4151    pub name: ::core::option::Option<::std::string::String>,
4152}
4153
4154impl KnnSearch {
4155    /// A `KnnSearch` with its required properties set.
4156    pub fn new(field: impl ::core::convert::Into<crate::Field>) -> Self {
4157        Self {
4158            field: ::core::option::Option::Some(field.into()),
4159            query_vector: ::core::option::Option::None,
4160            query_vector_builder: ::core::option::Option::None,
4161            k: ::core::option::Option::None,
4162            num_candidates: ::core::option::Option::None,
4163            visit_percentage: ::core::option::Option::None,
4164            boost: ::core::option::Option::None,
4165            filter: ::core::option::Option::None,
4166            similarity: ::core::option::Option::None,
4167            inner_hits: ::core::option::Option::None,
4168            rescore_vector: ::core::option::Option::None,
4169            name: ::core::option::Option::None,
4170        }
4171    }
4172}
4173
4174impl KnnSearch {
4175    /// Sets `query_vector`.
4176    pub fn query_vector(mut self, value: impl ::core::convert::Into<crate::QueryVector>) -> Self {
4177        self.query_vector = ::core::option::Option::Some(value.into());
4178        self
4179    }
4180    /// Sets `query_vector_builder`.
4181    pub fn query_vector_builder(
4182        mut self,
4183        value: impl ::core::convert::Into<crate::QueryVectorBuilder>,
4184    ) -> Self {
4185        self.query_vector_builder = ::core::option::Option::Some(value.into());
4186        self
4187    }
4188    /// Sets `k`.
4189    pub fn k(mut self, value: i32) -> Self {
4190        self.k = ::core::option::Option::Some(value.into());
4191        self
4192    }
4193    /// Sets `num_candidates`.
4194    pub fn num_candidates(mut self, value: i32) -> Self {
4195        self.num_candidates = ::core::option::Option::Some(value.into());
4196        self
4197    }
4198    /// Sets `visit_percentage`.
4199    pub fn visit_percentage(mut self, value: f32) -> Self {
4200        self.visit_percentage = ::core::option::Option::Some(value.into());
4201        self
4202    }
4203    /// Sets `boost`.
4204    pub fn boost(mut self, value: f32) -> Self {
4205        self.boost = ::core::option::Option::Some(value.into());
4206        self
4207    }
4208    /// Sets `filter`.
4209    pub fn filter(
4210        mut self,
4211        value: impl ::core::convert::Into<
4212            ::oxsearch_core::shapes::OneOrMany<crate::query_dsl::QueryContainer>,
4213        >,
4214    ) -> Self {
4215        self.filter = ::core::option::Option::Some(value.into());
4216        self
4217    }
4218    /// Sets `similarity`.
4219    pub fn similarity(mut self, value: f32) -> Self {
4220        self.similarity = ::core::option::Option::Some(value.into());
4221        self
4222    }
4223    /// Sets `inner_hits`.
4224    pub fn inner_hits(
4225        mut self,
4226        value: impl ::core::convert::Into<crate::search::InnerHits>,
4227    ) -> Self {
4228        self.inner_hits = ::core::option::Option::Some(value.into());
4229        self
4230    }
4231    /// Sets `rescore_vector`.
4232    pub fn rescore_vector(
4233        mut self,
4234        value: impl ::core::convert::Into<crate::RescoreVector>,
4235    ) -> Self {
4236        self.rescore_vector = ::core::option::Option::Some(value.into());
4237        self
4238    }
4239    /// Sets `name`.
4240    pub fn name(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
4241        self.name = ::core::option::Option::Some(value.into());
4242        self
4243    }
4244}
4245
4246#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
4247#[non_exhaustive]
4248pub struct LatLonGeoLocation {
4249    /// Latitude
4250    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
4251    pub lat: ::core::option::Option<f64>,
4252    /// Longitude
4253    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
4254    pub lon: ::core::option::Option<f64>,
4255}
4256
4257impl LatLonGeoLocation {
4258    /// A `LatLonGeoLocation` with its required properties set.
4259    pub fn new(lat: f64, lon: f64) -> Self {
4260        Self {
4261            lat: ::core::option::Option::Some(lat.into()),
4262            lon: ::core::option::Option::Some(lon.into()),
4263        }
4264    }
4265}
4266
4267impl LatLonGeoLocation {}
4268
4269#[derive(Clone, Debug, PartialEq, Eq, Hash)]
4270#[non_exhaustive]
4271pub enum Level {
4272    /// `cluster`
4273    Cluster,
4274    /// `indices`
4275    Indices,
4276    /// `shards`
4277    Shards,
4278    /// A value this version of the specification doesn't list.
4279    Raw(::std::string::String),
4280}
4281
4282impl Level {
4283    /// The value as Elasticsearch writes it.
4284    pub fn as_str(&self) -> &str {
4285        match self {
4286            Self::Cluster => "cluster",
4287            Self::Indices => "indices",
4288            Self::Shards => "shards",
4289            Self::Raw(value) => value,
4290        }
4291    }
4292
4293    /// The listed value with this name, if there is one.
4294    pub fn from_known(value: &str) -> ::core::option::Option<Self> {
4295        match value {
4296            "cluster" => ::core::option::Option::Some(Self::Cluster),
4297            "indices" => ::core::option::Option::Some(Self::Indices),
4298            "shards" => ::core::option::Option::Some(Self::Shards),
4299            _ => ::core::option::Option::None,
4300        }
4301    }
4302}
4303
4304impl ::serde::Serialize for Level {
4305    fn serialize<S__: ::serde::Serializer>(
4306        &self,
4307        serializer: S__,
4308    ) -> ::core::result::Result<S__::Ok, S__::Error> {
4309        serializer.serialize_str(self.as_str())
4310    }
4311}
4312
4313impl<'de> ::serde::Deserialize<'de> for Level {
4314    fn deserialize<D__: ::serde::Deserializer<'de>>(
4315        deserializer: D__,
4316    ) -> ::core::result::Result<Self, D__::Error> {
4317        ::oxsearch_core::__private::deserialize_string_enum(deserializer, "Level", |value| {
4318            Self::from_known(value).unwrap_or_else(|| Self::Raw(value.to_owned()))
4319        })
4320    }
4321}
4322
4323#[derive(Clone, Debug, PartialEq, Eq, Hash)]
4324#[non_exhaustive]
4325pub enum LifecycleOperationMode {
4326    /// `RUNNING`
4327    Running,
4328    /// `STOPPING`
4329    Stopping,
4330    /// `STOPPED`
4331    Stopped,
4332    /// A value this version of the specification doesn't list.
4333    Raw(::std::string::String),
4334}
4335
4336impl LifecycleOperationMode {
4337    /// The value as Elasticsearch writes it.
4338    pub fn as_str(&self) -> &str {
4339        match self {
4340            Self::Running => "RUNNING",
4341            Self::Stopping => "STOPPING",
4342            Self::Stopped => "STOPPED",
4343            Self::Raw(value) => value,
4344        }
4345    }
4346
4347    /// The listed value with this name, if there is one.
4348    pub fn from_known(value: &str) -> ::core::option::Option<Self> {
4349        match value {
4350            "RUNNING" => ::core::option::Option::Some(Self::Running),
4351            "STOPPING" => ::core::option::Option::Some(Self::Stopping),
4352            "STOPPED" => ::core::option::Option::Some(Self::Stopped),
4353            _ => ::core::option::Option::None,
4354        }
4355    }
4356}
4357
4358impl ::serde::Serialize for LifecycleOperationMode {
4359    fn serialize<S__: ::serde::Serializer>(
4360        &self,
4361        serializer: S__,
4362    ) -> ::core::result::Result<S__::Ok, S__::Error> {
4363        serializer.serialize_str(self.as_str())
4364    }
4365}
4366
4367impl<'de> ::serde::Deserialize<'de> for LifecycleOperationMode {
4368    fn deserialize<D__: ::serde::Deserializer<'de>>(
4369        deserializer: D__,
4370    ) -> ::core::result::Result<Self, D__::Error> {
4371        ::oxsearch_core::__private::deserialize_string_enum(
4372            deserializer,
4373            "LifecycleOperationMode",
4374            |value| Self::from_known(value).unwrap_or_else(|| Self::Raw(value.to_owned())),
4375        )
4376    }
4377}
4378
4379#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
4380#[non_exhaustive]
4381pub struct LinearRetriever {
4382    /// Query to filter the documents that can match.
4383    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
4384    pub filter: ::core::option::Option<
4385        ::oxsearch_core::shapes::OneOrMany<crate::query_dsl::QueryContainer>,
4386    >,
4387    /// Minimum _score for matching documents. Documents with a lower _score are not included in the top documents.
4388    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
4389    pub min_score: ::core::option::Option<f32>,
4390    /// Retriever name.
4391    #[serde(
4392        rename = "_name",
4393        skip_serializing_if = "::core::option::Option::is_none"
4394    )]
4395    pub name: ::core::option::Option<::std::string::String>,
4396    /// Inner retrievers.
4397    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
4398    pub retrievers: ::core::option::Option<::std::vec::Vec<crate::InnerRetriever>>,
4399    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
4400    pub rank_window_size: ::core::option::Option<i32>,
4401    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
4402    pub query: ::core::option::Option<::std::string::String>,
4403    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
4404    pub fields: ::core::option::Option<::std::vec::Vec<::std::string::String>>,
4405    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
4406    pub normalizer: ::core::option::Option<crate::ScoreNormalizer>,
4407}
4408
4409impl LinearRetriever {
4410    /// A `LinearRetriever` with its required properties set.
4411    pub fn new() -> Self {
4412        Self {
4413            filter: ::core::option::Option::None,
4414            min_score: ::core::option::Option::None,
4415            name: ::core::option::Option::None,
4416            retrievers: ::core::option::Option::None,
4417            rank_window_size: ::core::option::Option::None,
4418            query: ::core::option::Option::None,
4419            fields: ::core::option::Option::None,
4420            normalizer: ::core::option::Option::None,
4421        }
4422    }
4423}
4424
4425impl LinearRetriever {
4426    /// Sets `filter`.
4427    pub fn filter(
4428        mut self,
4429        value: impl ::core::convert::Into<
4430            ::oxsearch_core::shapes::OneOrMany<crate::query_dsl::QueryContainer>,
4431        >,
4432    ) -> Self {
4433        self.filter = ::core::option::Option::Some(value.into());
4434        self
4435    }
4436    /// Sets `min_score`.
4437    pub fn min_score(mut self, value: f32) -> Self {
4438        self.min_score = ::core::option::Option::Some(value.into());
4439        self
4440    }
4441    /// Sets `name`.
4442    pub fn name(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
4443        self.name = ::core::option::Option::Some(value.into());
4444        self
4445    }
4446    /// Sets `retrievers`.
4447    pub fn retrievers(
4448        mut self,
4449        value: impl ::core::convert::Into<::std::vec::Vec<crate::InnerRetriever>>,
4450    ) -> Self {
4451        self.retrievers = ::core::option::Option::Some(value.into());
4452        self
4453    }
4454    /// Sets `rank_window_size`.
4455    pub fn rank_window_size(mut self, value: i32) -> Self {
4456        self.rank_window_size = ::core::option::Option::Some(value.into());
4457        self
4458    }
4459    /// Sets `query`.
4460    pub fn query(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
4461        self.query = ::core::option::Option::Some(value.into());
4462        self
4463    }
4464    /// Sets `fields`.
4465    pub fn fields(
4466        mut self,
4467        value: impl ::core::convert::Into<::std::vec::Vec<::std::string::String>>,
4468    ) -> Self {
4469        self.fields = ::core::option::Option::Some(value.into());
4470        self
4471    }
4472    /// Sets `normalizer`.
4473    pub fn normalizer(mut self, value: impl ::core::convert::Into<crate::ScoreNormalizer>) -> Self {
4474        self.normalizer = ::core::option::Option::Some(value.into());
4475        self
4476    }
4477}
4478
4479#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
4480#[non_exhaustive]
4481pub struct LookupQueryVectorBuilder {
4482    /// The ID of the document to fetch the vector from
4483    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
4484    pub id: ::core::option::Option<::std::string::String>,
4485    /// The name of the index to fetch the document from
4486    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
4487    pub index: ::core::option::Option<::std::string::String>,
4488    /// The name of the field containing the vector
4489    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
4490    pub path: ::core::option::Option<::std::string::String>,
4491    /// The routing value to use when fetching the document
4492    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
4493    pub routing: ::core::option::Option<::std::string::String>,
4494}
4495
4496impl LookupQueryVectorBuilder {
4497    /// A `LookupQueryVectorBuilder` with its required properties set.
4498    pub fn new(
4499        id: impl ::core::convert::Into<::std::string::String>,
4500        index: impl ::core::convert::Into<::std::string::String>,
4501        path: impl ::core::convert::Into<::std::string::String>,
4502    ) -> Self {
4503        Self {
4504            id: ::core::option::Option::Some(id.into()),
4505            index: ::core::option::Option::Some(index.into()),
4506            path: ::core::option::Option::Some(path.into()),
4507            routing: ::core::option::Option::None,
4508        }
4509    }
4510}
4511
4512impl LookupQueryVectorBuilder {
4513    /// Sets `routing`.
4514    pub fn routing(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
4515        self.routing = ::core::option::Option::Some(value.into());
4516        self
4517    }
4518}
4519
4520pub type MapboxVectorTiles = ::std::string::String;
4521
4522#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
4523#[non_exhaustive]
4524pub struct MergesStats {
4525    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
4526    pub current: ::core::option::Option<i64>,
4527    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
4528    pub current_docs: ::core::option::Option<i64>,
4529    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
4530    pub current_size: ::core::option::Option<::std::string::String>,
4531    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
4532    pub current_size_in_bytes: ::core::option::Option<i64>,
4533    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
4534    pub total: ::core::option::Option<i64>,
4535    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
4536    pub total_auto_throttle: ::core::option::Option<::std::string::String>,
4537    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
4538    pub total_auto_throttle_in_bytes: ::core::option::Option<i64>,
4539    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
4540    pub total_docs: ::core::option::Option<i64>,
4541    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
4542    pub total_size: ::core::option::Option<::std::string::String>,
4543    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
4544    pub total_size_in_bytes: ::core::option::Option<i64>,
4545    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
4546    pub total_stopped_time: ::core::option::Option<crate::Duration>,
4547    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
4548    pub total_stopped_time_in_millis: ::core::option::Option<crate::UnitMillis>,
4549    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
4550    pub total_throttled_time: ::core::option::Option<crate::Duration>,
4551    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
4552    pub total_throttled_time_in_millis: ::core::option::Option<crate::UnitMillis>,
4553    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
4554    pub total_time: ::core::option::Option<crate::Duration>,
4555    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
4556    pub total_time_in_millis: ::core::option::Option<crate::UnitMillis>,
4557}
4558
4559impl MergesStats {
4560    /// A `MergesStats` with its required properties set.
4561    pub fn new(
4562        current: i64,
4563        current_docs: i64,
4564        current_size_in_bytes: i64,
4565        total: i64,
4566        total_auto_throttle_in_bytes: i64,
4567        total_docs: i64,
4568        total_size_in_bytes: i64,
4569        total_stopped_time_in_millis: impl ::core::convert::Into<crate::UnitMillis>,
4570        total_throttled_time_in_millis: impl ::core::convert::Into<crate::UnitMillis>,
4571        total_time_in_millis: impl ::core::convert::Into<crate::UnitMillis>,
4572    ) -> Self {
4573        Self {
4574            current: ::core::option::Option::Some(current.into()),
4575            current_docs: ::core::option::Option::Some(current_docs.into()),
4576            current_size: ::core::option::Option::None,
4577            current_size_in_bytes: ::core::option::Option::Some(current_size_in_bytes.into()),
4578            total: ::core::option::Option::Some(total.into()),
4579            total_auto_throttle: ::core::option::Option::None,
4580            total_auto_throttle_in_bytes: ::core::option::Option::Some(
4581                total_auto_throttle_in_bytes.into(),
4582            ),
4583            total_docs: ::core::option::Option::Some(total_docs.into()),
4584            total_size: ::core::option::Option::None,
4585            total_size_in_bytes: ::core::option::Option::Some(total_size_in_bytes.into()),
4586            total_stopped_time: ::core::option::Option::None,
4587            total_stopped_time_in_millis: ::core::option::Option::Some(
4588                total_stopped_time_in_millis.into(),
4589            ),
4590            total_throttled_time: ::core::option::Option::None,
4591            total_throttled_time_in_millis: ::core::option::Option::Some(
4592                total_throttled_time_in_millis.into(),
4593            ),
4594            total_time: ::core::option::Option::None,
4595            total_time_in_millis: ::core::option::Option::Some(total_time_in_millis.into()),
4596        }
4597    }
4598}
4599
4600impl MergesStats {
4601    /// Sets `current_size`.
4602    pub fn current_size(
4603        mut self,
4604        value: impl ::core::convert::Into<::std::string::String>,
4605    ) -> Self {
4606        self.current_size = ::core::option::Option::Some(value.into());
4607        self
4608    }
4609    /// Sets `total_auto_throttle`.
4610    pub fn total_auto_throttle(
4611        mut self,
4612        value: impl ::core::convert::Into<::std::string::String>,
4613    ) -> Self {
4614        self.total_auto_throttle = ::core::option::Option::Some(value.into());
4615        self
4616    }
4617    /// Sets `total_size`.
4618    pub fn total_size(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
4619        self.total_size = ::core::option::Option::Some(value.into());
4620        self
4621    }
4622    /// Sets `total_stopped_time`.
4623    pub fn total_stopped_time(
4624        mut self,
4625        value: impl ::core::convert::Into<crate::Duration>,
4626    ) -> Self {
4627        self.total_stopped_time = ::core::option::Option::Some(value.into());
4628        self
4629    }
4630    /// Sets `total_throttled_time`.
4631    pub fn total_throttled_time(
4632        mut self,
4633        value: impl ::core::convert::Into<crate::Duration>,
4634    ) -> Self {
4635        self.total_throttled_time = ::core::option::Option::Some(value.into());
4636        self
4637    }
4638    /// Sets `total_time`.
4639    pub fn total_time(mut self, value: impl ::core::convert::Into<crate::Duration>) -> Self {
4640        self.total_time = ::core::option::Option::Some(value.into());
4641        self
4642    }
4643}
4644
4645pub type Metadata = ::indexmap::IndexMap<::std::string::String, ::serde_json::Value>;
4646
4647/// The minimum number of terms that should match as integer, percentage or range
4648#[derive(Clone, Debug, PartialEq)]
4649#[non_exhaustive]
4650pub enum MinimumShouldMatch {
4651    /// A number.
4652    Integer(i32),
4653    /// A string.
4654    String(::std::string::String),
4655}
4656
4657impl ::serde::Serialize for MinimumShouldMatch {
4658    fn serialize<S__: ::serde::Serializer>(
4659        &self,
4660        serializer: S__,
4661    ) -> ::core::result::Result<S__::Ok, S__::Error> {
4662        match self {
4663            Self::Integer(value) => ::serde::Serialize::serialize(value, serializer),
4664            Self::String(value) => ::serde::Serialize::serialize(value, serializer),
4665        }
4666    }
4667}
4668
4669impl<'de> ::serde::Deserialize<'de> for MinimumShouldMatch {
4670    fn deserialize<D__: ::serde::Deserializer<'de>>(
4671        deserializer: D__,
4672    ) -> ::core::result::Result<Self, D__::Error> {
4673        struct Shape;
4674        impl<'de> ::oxsearch_core::__private::ByKind<'de> for Shape {
4675            type Value = MinimumShouldMatch;
4676            const EXPECTING: &'static str = "MinimumShouldMatch: number or string";
4677            fn visit<V__: ::serde::Deserializer<'de>>(
4678                self,
4679                kind: ::oxsearch_core::__private::Kind,
4680                value: V__,
4681            ) -> ::core::result::Result<Self::Value, V__::Error> {
4682                match kind {
4683                    ::oxsearch_core::__private::Kind::Number => {
4684                        <i32 as ::serde::Deserialize>::deserialize(value)
4685                            .map(MinimumShouldMatch::Integer)
4686                    }
4687                    ::oxsearch_core::__private::Kind::String => {
4688                        <::std::string::String as ::serde::Deserialize>::deserialize(value)
4689                            .map(MinimumShouldMatch::String)
4690                    }
4691                    _ => ::core::result::Result::Err(<V__::Error as ::serde::de::Error>::custom(
4692                        format_args!("MinimumShouldMatch can't be {kind:?}"),
4693                    )),
4694                }
4695            }
4696        }
4697        ::oxsearch_core::__private::deserialize_by_kind(deserializer, Shape)
4698    }
4699}
4700
4701impl ::core::convert::From<i32> for MinimumShouldMatch {
4702    fn from(value: i32) -> Self {
4703        Self::Integer(value)
4704    }
4705}
4706
4707impl ::core::convert::From<::std::string::String> for MinimumShouldMatch {
4708    fn from(value: ::std::string::String) -> Self {
4709        Self::String(value)
4710    }
4711}
4712
4713impl ::core::convert::From<&str> for MinimumShouldMatch {
4714    fn from(value: &str) -> Self {
4715        Self::String(::std::borrow::ToOwned::to_owned(value))
4716    }
4717}
4718
4719pub type MultiTermQueryRewrite = ::std::string::String;
4720
4721pub type Name = ::std::string::String;
4722
4723pub type Names = ::oxsearch_core::shapes::OneOrMany<crate::Name>;
4724
4725pub type Namespace = ::std::string::String;
4726
4727#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
4728#[non_exhaustive]
4729pub struct NestedSortValue {
4730    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
4731    pub filter: ::core::option::Option<crate::query_dsl::QueryContainer>,
4732    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
4733    pub max_children: ::core::option::Option<i32>,
4734    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
4735    pub nested: ::core::option::Option<::std::boxed::Box<crate::NestedSortValue>>,
4736    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
4737    pub path: ::core::option::Option<crate::Field>,
4738}
4739
4740impl NestedSortValue {
4741    /// A `NestedSortValue` with its required properties set.
4742    pub fn new(path: impl ::core::convert::Into<crate::Field>) -> Self {
4743        Self {
4744            filter: ::core::option::Option::None,
4745            max_children: ::core::option::Option::None,
4746            nested: ::core::option::Option::None,
4747            path: ::core::option::Option::Some(path.into()),
4748        }
4749    }
4750}
4751
4752impl NestedSortValue {
4753    /// Sets `filter`.
4754    pub fn filter(
4755        mut self,
4756        value: impl ::core::convert::Into<crate::query_dsl::QueryContainer>,
4757    ) -> Self {
4758        self.filter = ::core::option::Option::Some(value.into());
4759        self
4760    }
4761    /// Sets `max_children`.
4762    pub fn max_children(mut self, value: i32) -> Self {
4763        self.max_children = ::core::option::Option::Some(value.into());
4764        self
4765    }
4766    /// Sets `nested`.
4767    pub fn nested(mut self, value: impl ::core::convert::Into<crate::NestedSortValue>) -> Self {
4768        self.nested = ::core::option::Option::Some(::std::boxed::Box::new(value.into()));
4769        self
4770    }
4771}
4772
4773#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
4774#[non_exhaustive]
4775pub struct NodeAttributes {
4776    /// Lists node attributes.
4777    pub attributes: ::indexmap::IndexMap<::std::string::String, ::std::string::String>,
4778    /// The ephemeral ID of the node.
4779    pub ephemeral_id: crate::Id,
4780    /// The unique identifier of the node.
4781    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
4782    pub id: ::core::option::Option<crate::NodeId>,
4783    /// The unique identifier of the node.
4784    pub name: crate::NodeName,
4785    /// The host and port where transport HTTP connections are accepted.
4786    pub transport_address: crate::TransportAddress,
4787}
4788
4789impl NodeAttributes {
4790    /// A `NodeAttributes` with its required properties set.
4791    pub fn new(
4792        attributes: impl ::core::convert::Into<
4793            ::indexmap::IndexMap<::std::string::String, ::std::string::String>,
4794        >,
4795        ephemeral_id: impl ::core::convert::Into<crate::Id>,
4796        name: impl ::core::convert::Into<crate::NodeName>,
4797        transport_address: impl ::core::convert::Into<crate::TransportAddress>,
4798    ) -> Self {
4799        Self {
4800            attributes: attributes.into(),
4801            ephemeral_id: ephemeral_id.into(),
4802            id: ::core::option::Option::None,
4803            name: name.into(),
4804            transport_address: transport_address.into(),
4805        }
4806    }
4807}
4808
4809impl NodeAttributes {
4810    /// Sets `id`.
4811    pub fn id(mut self, value: impl ::core::convert::Into<crate::NodeId>) -> Self {
4812        self.id = ::core::option::Option::Some(value.into());
4813        self
4814    }
4815}
4816
4817pub type NodeId = ::std::string::String;
4818
4819pub type NodeIds = ::oxsearch_core::shapes::OneOrMany<crate::NodeId>;
4820
4821pub type NodeName = ::std::string::String;
4822
4823#[derive(Clone, Debug, PartialEq, Eq, Hash)]
4824#[non_exhaustive]
4825pub enum NodeRole {
4826    /// `master`
4827    Master,
4828    /// `data`
4829    Data,
4830    /// `data_cold`
4831    DataCold,
4832    /// `data_content`
4833    DataContent,
4834    /// `data_frozen`
4835    DataFrozen,
4836    /// `data_hot`
4837    DataHot,
4838    /// `data_warm`
4839    DataWarm,
4840    /// `client`
4841    Client,
4842    /// `ingest`
4843    Ingest,
4844    /// `ml`
4845    Ml,
4846    /// `voting_only`
4847    VotingOnly,
4848    /// `transform`
4849    Transform,
4850    /// `remote_cluster_client`
4851    RemoteClusterClient,
4852    /// `coordinating_only`
4853    CoordinatingOnly,
4854    /// A value this version of the specification doesn't list.
4855    Raw(::std::string::String),
4856}
4857
4858impl NodeRole {
4859    /// The value as Elasticsearch writes it.
4860    pub fn as_str(&self) -> &str {
4861        match self {
4862            Self::Master => "master",
4863            Self::Data => "data",
4864            Self::DataCold => "data_cold",
4865            Self::DataContent => "data_content",
4866            Self::DataFrozen => "data_frozen",
4867            Self::DataHot => "data_hot",
4868            Self::DataWarm => "data_warm",
4869            Self::Client => "client",
4870            Self::Ingest => "ingest",
4871            Self::Ml => "ml",
4872            Self::VotingOnly => "voting_only",
4873            Self::Transform => "transform",
4874            Self::RemoteClusterClient => "remote_cluster_client",
4875            Self::CoordinatingOnly => "coordinating_only",
4876            Self::Raw(value) => value,
4877        }
4878    }
4879
4880    /// The listed value with this name, if there is one.
4881    pub fn from_known(value: &str) -> ::core::option::Option<Self> {
4882        match value {
4883            "master" => ::core::option::Option::Some(Self::Master),
4884            "data" => ::core::option::Option::Some(Self::Data),
4885            "data_cold" => ::core::option::Option::Some(Self::DataCold),
4886            "data_content" => ::core::option::Option::Some(Self::DataContent),
4887            "data_frozen" => ::core::option::Option::Some(Self::DataFrozen),
4888            "data_hot" => ::core::option::Option::Some(Self::DataHot),
4889            "data_warm" => ::core::option::Option::Some(Self::DataWarm),
4890            "client" => ::core::option::Option::Some(Self::Client),
4891            "ingest" => ::core::option::Option::Some(Self::Ingest),
4892            "ml" => ::core::option::Option::Some(Self::Ml),
4893            "voting_only" => ::core::option::Option::Some(Self::VotingOnly),
4894            "transform" => ::core::option::Option::Some(Self::Transform),
4895            "remote_cluster_client" => ::core::option::Option::Some(Self::RemoteClusterClient),
4896            "coordinating_only" => ::core::option::Option::Some(Self::CoordinatingOnly),
4897            _ => ::core::option::Option::None,
4898        }
4899    }
4900}
4901
4902impl ::serde::Serialize for NodeRole {
4903    fn serialize<S__: ::serde::Serializer>(
4904        &self,
4905        serializer: S__,
4906    ) -> ::core::result::Result<S__::Ok, S__::Error> {
4907        serializer.serialize_str(self.as_str())
4908    }
4909}
4910
4911impl<'de> ::serde::Deserialize<'de> for NodeRole {
4912    fn deserialize<D__: ::serde::Deserializer<'de>>(
4913        deserializer: D__,
4914    ) -> ::core::result::Result<Self, D__::Error> {
4915        ::oxsearch_core::__private::deserialize_string_enum(deserializer, "NodeRole", |value| {
4916            Self::from_known(value).unwrap_or_else(|| Self::Raw(value.to_owned()))
4917        })
4918    }
4919}
4920
4921pub type NodeRoles = ::std::vec::Vec<crate::NodeRole>;
4922
4923#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
4924#[non_exhaustive]
4925pub struct NodeShard {
4926    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
4927    pub state: ::core::option::Option<crate::indices::stats::ShardRoutingState>,
4928    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
4929    pub primary: ::core::option::Option<bool>,
4930    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
4931    pub node: ::core::option::Option<crate::NodeName>,
4932    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
4933    pub shard: ::core::option::Option<i32>,
4934    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
4935    pub index: ::core::option::Option<crate::IndexName>,
4936    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
4937    pub allocation_id:
4938        ::core::option::Option<::indexmap::IndexMap<::std::string::String, crate::Id>>,
4939    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
4940    pub recovery_source:
4941        ::core::option::Option<::indexmap::IndexMap<::std::string::String, crate::Id>>,
4942    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
4943    pub unassigned_info:
4944        ::core::option::Option<crate::cluster::allocation_explain::UnassignedInformation>,
4945    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
4946    pub relocating_node: ::core::option::Option<crate::NodeId>,
4947    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
4948    pub relocation_failure_info: ::core::option::Option<crate::RelocationFailureInfo>,
4949}
4950
4951impl NodeShard {
4952    /// A `NodeShard` with its required properties set.
4953    pub fn new(
4954        state: impl ::core::convert::Into<crate::indices::stats::ShardRoutingState>,
4955        primary: bool,
4956        shard: i32,
4957        index: impl ::core::convert::Into<crate::IndexName>,
4958    ) -> Self {
4959        Self {
4960            state: ::core::option::Option::Some(state.into()),
4961            primary: ::core::option::Option::Some(primary.into()),
4962            node: ::core::option::Option::None,
4963            shard: ::core::option::Option::Some(shard.into()),
4964            index: ::core::option::Option::Some(index.into()),
4965            allocation_id: ::core::option::Option::None,
4966            recovery_source: ::core::option::Option::None,
4967            unassigned_info: ::core::option::Option::None,
4968            relocating_node: ::core::option::Option::None,
4969            relocation_failure_info: ::core::option::Option::None,
4970        }
4971    }
4972}
4973
4974impl NodeShard {
4975    /// Sets `node`.
4976    pub fn node(mut self, value: impl ::core::convert::Into<crate::NodeName>) -> Self {
4977        self.node = ::core::option::Option::Some(value.into());
4978        self
4979    }
4980    /// Sets `allocation_id`.
4981    pub fn allocation_id(
4982        mut self,
4983        value: impl ::core::convert::Into<::indexmap::IndexMap<::std::string::String, crate::Id>>,
4984    ) -> Self {
4985        self.allocation_id = ::core::option::Option::Some(value.into());
4986        self
4987    }
4988    /// Sets `recovery_source`.
4989    pub fn recovery_source(
4990        mut self,
4991        value: impl ::core::convert::Into<::indexmap::IndexMap<::std::string::String, crate::Id>>,
4992    ) -> Self {
4993        self.recovery_source = ::core::option::Option::Some(value.into());
4994        self
4995    }
4996    /// Sets `unassigned_info`.
4997    pub fn unassigned_info(
4998        mut self,
4999        value: impl ::core::convert::Into<crate::cluster::allocation_explain::UnassignedInformation>,
5000    ) -> Self {
5001        self.unassigned_info = ::core::option::Option::Some(value.into());
5002        self
5003    }
5004    /// Sets `relocating_node`.
5005    pub fn relocating_node(mut self, value: impl ::core::convert::Into<crate::NodeId>) -> Self {
5006        self.relocating_node = ::core::option::Option::Some(value.into());
5007        self
5008    }
5009    /// Sets `relocation_failure_info`.
5010    pub fn relocation_failure_info(
5011        mut self,
5012        value: impl ::core::convert::Into<crate::RelocationFailureInfo>,
5013    ) -> Self {
5014        self.relocation_failure_info = ::core::option::Option::Some(value.into());
5015        self
5016    }
5017}
5018
5019/// Contains statistics about the number of nodes selected by the request.
5020#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
5021#[non_exhaustive]
5022pub struct NodeStatistics {
5023    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
5024    pub failures: ::core::option::Option<::std::vec::Vec<crate::ErrorCause>>,
5025    /// Total number of nodes selected by the request.
5026    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
5027    pub total: ::core::option::Option<i32>,
5028    /// Number of nodes that responded successfully to the request.
5029    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
5030    pub successful: ::core::option::Option<i32>,
5031    /// Number of nodes that rejected the request or failed to respond. If this value is not 0, a reason for the rejection or failure is included in the response.
5032    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
5033    pub failed: ::core::option::Option<i32>,
5034}
5035
5036impl NodeStatistics {
5037    /// A `NodeStatistics` with its required properties set.
5038    pub fn new(total: i32, successful: i32, failed: i32) -> Self {
5039        Self {
5040            failures: ::core::option::Option::None,
5041            total: ::core::option::Option::Some(total.into()),
5042            successful: ::core::option::Option::Some(successful.into()),
5043            failed: ::core::option::Option::Some(failed.into()),
5044        }
5045    }
5046}
5047
5048impl NodeStatistics {
5049    /// Sets `failures`.
5050    pub fn failures(
5051        mut self,
5052        value: impl ::core::convert::Into<::std::vec::Vec<crate::ErrorCause>>,
5053    ) -> Self {
5054        self.failures = ::core::option::Option::Some(value.into());
5055        self
5056    }
5057}
5058
5059#[derive(Clone, Debug, PartialEq, Eq, Hash)]
5060#[non_exhaustive]
5061pub enum NodeStatsLevel {
5062    /// `node`
5063    Node,
5064    /// `indices`
5065    Indices,
5066    /// `shards`
5067    Shards,
5068    /// A value this version of the specification doesn't list.
5069    Raw(::std::string::String),
5070}
5071
5072impl NodeStatsLevel {
5073    /// The value as Elasticsearch writes it.
5074    pub fn as_str(&self) -> &str {
5075        match self {
5076            Self::Node => "node",
5077            Self::Indices => "indices",
5078            Self::Shards => "shards",
5079            Self::Raw(value) => value,
5080        }
5081    }
5082
5083    /// The listed value with this name, if there is one.
5084    pub fn from_known(value: &str) -> ::core::option::Option<Self> {
5085        match value {
5086            "node" => ::core::option::Option::Some(Self::Node),
5087            "indices" => ::core::option::Option::Some(Self::Indices),
5088            "shards" => ::core::option::Option::Some(Self::Shards),
5089            _ => ::core::option::Option::None,
5090        }
5091    }
5092}
5093
5094impl ::serde::Serialize for NodeStatsLevel {
5095    fn serialize<S__: ::serde::Serializer>(
5096        &self,
5097        serializer: S__,
5098    ) -> ::core::result::Result<S__::Ok, S__::Error> {
5099        serializer.serialize_str(self.as_str())
5100    }
5101}
5102
5103impl<'de> ::serde::Deserialize<'de> for NodeStatsLevel {
5104    fn deserialize<D__: ::serde::Deserializer<'de>>(
5105        deserializer: D__,
5106    ) -> ::core::result::Result<Self, D__::Error> {
5107        ::oxsearch_core::__private::deserialize_string_enum(
5108            deserializer,
5109            "NodeStatsLevel",
5110            |value| Self::from_known(value).unwrap_or_else(|| Self::Raw(value.to_owned())),
5111        )
5112    }
5113}
5114
5115#[derive(Clone, Debug, PartialEq, Eq, Hash)]
5116#[non_exhaustive]
5117pub enum Normalization {
5118    /// `no`
5119    No,
5120    /// `h1`
5121    H1,
5122    /// `h2`
5123    H2,
5124    /// `h3`
5125    H3,
5126    /// `z`
5127    Z,
5128    /// A value this version of the specification doesn't list.
5129    Raw(::std::string::String),
5130}
5131
5132impl Normalization {
5133    /// The value as Elasticsearch writes it.
5134    pub fn as_str(&self) -> &str {
5135        match self {
5136            Self::No => "no",
5137            Self::H1 => "h1",
5138            Self::H2 => "h2",
5139            Self::H3 => "h3",
5140            Self::Z => "z",
5141            Self::Raw(value) => value,
5142        }
5143    }
5144
5145    /// The listed value with this name, if there is one.
5146    pub fn from_known(value: &str) -> ::core::option::Option<Self> {
5147        match value {
5148            "no" => ::core::option::Option::Some(Self::No),
5149            "h1" => ::core::option::Option::Some(Self::H1),
5150            "h2" => ::core::option::Option::Some(Self::H2),
5151            "h3" => ::core::option::Option::Some(Self::H3),
5152            "z" => ::core::option::Option::Some(Self::Z),
5153            _ => ::core::option::Option::None,
5154        }
5155    }
5156}
5157
5158impl ::serde::Serialize for Normalization {
5159    fn serialize<S__: ::serde::Serializer>(
5160        &self,
5161        serializer: S__,
5162    ) -> ::core::result::Result<S__::Ok, S__::Error> {
5163        serializer.serialize_str(self.as_str())
5164    }
5165}
5166
5167impl<'de> ::serde::Deserialize<'de> for Normalization {
5168    fn deserialize<D__: ::serde::Deserializer<'de>>(
5169        deserializer: D__,
5170    ) -> ::core::result::Result<Self, D__::Error> {
5171        ::oxsearch_core::__private::deserialize_string_enum(
5172            deserializer,
5173            "Normalization",
5174            |value| Self::from_known(value).unwrap_or_else(|| Self::Raw(value.to_owned())),
5175        )
5176    }
5177}
5178
5179#[derive(Clone, Debug, PartialEq, Eq, Hash)]
5180#[non_exhaustive]
5181pub enum OpType {
5182    /// Overwrite any documents that already exist.
5183    Index,
5184    /// Only index documents that do not already exist.
5185    Create,
5186    /// A value this version of the specification doesn't list.
5187    Raw(::std::string::String),
5188}
5189
5190impl OpType {
5191    /// The value as Elasticsearch writes it.
5192    pub fn as_str(&self) -> &str {
5193        match self {
5194            Self::Index => "index",
5195            Self::Create => "create",
5196            Self::Raw(value) => value,
5197        }
5198    }
5199
5200    /// The listed value with this name, if there is one.
5201    pub fn from_known(value: &str) -> ::core::option::Option<Self> {
5202        match value {
5203            "index" => ::core::option::Option::Some(Self::Index),
5204            "create" => ::core::option::Option::Some(Self::Create),
5205            _ => ::core::option::Option::None,
5206        }
5207    }
5208}
5209
5210impl ::serde::Serialize for OpType {
5211    fn serialize<S__: ::serde::Serializer>(
5212        &self,
5213        serializer: S__,
5214    ) -> ::core::result::Result<S__::Ok, S__::Error> {
5215        serializer.serialize_str(self.as_str())
5216    }
5217}
5218
5219impl<'de> ::serde::Deserialize<'de> for OpType {
5220    fn deserialize<D__: ::serde::Deserializer<'de>>(
5221        deserializer: D__,
5222    ) -> ::core::result::Result<Self, D__::Error> {
5223        ::oxsearch_core::__private::deserialize_string_enum(deserializer, "OpType", |value| {
5224            Self::from_known(value).unwrap_or_else(|| Self::Raw(value.to_owned()))
5225        })
5226    }
5227}
5228
5229pub type Password = ::std::string::String;
5230
5231#[derive(Clone, Debug, PartialEq)]
5232#[non_exhaustive]
5233pub enum Percentage {
5234    /// A string.
5235    String(::std::string::String),
5236    /// A number.
5237    Float(f32),
5238}
5239
5240impl ::serde::Serialize for Percentage {
5241    fn serialize<S__: ::serde::Serializer>(
5242        &self,
5243        serializer: S__,
5244    ) -> ::core::result::Result<S__::Ok, S__::Error> {
5245        match self {
5246            Self::String(value) => ::serde::Serialize::serialize(value, serializer),
5247            Self::Float(value) => ::serde::Serialize::serialize(value, serializer),
5248        }
5249    }
5250}
5251
5252impl<'de> ::serde::Deserialize<'de> for Percentage {
5253    fn deserialize<D__: ::serde::Deserializer<'de>>(
5254        deserializer: D__,
5255    ) -> ::core::result::Result<Self, D__::Error> {
5256        struct Shape;
5257        impl<'de> ::oxsearch_core::__private::ByKind<'de> for Shape {
5258            type Value = Percentage;
5259            const EXPECTING: &'static str = "Percentage: number or string";
5260            fn visit<V__: ::serde::Deserializer<'de>>(
5261                self,
5262                kind: ::oxsearch_core::__private::Kind,
5263                value: V__,
5264            ) -> ::core::result::Result<Self::Value, V__::Error> {
5265                match kind {
5266                    ::oxsearch_core::__private::Kind::Number => {
5267                        <f32 as ::serde::Deserialize>::deserialize(value).map(Percentage::Float)
5268                    }
5269                    ::oxsearch_core::__private::Kind::String => {
5270                        <::std::string::String as ::serde::Deserialize>::deserialize(value)
5271                            .map(Percentage::String)
5272                    }
5273                    _ => ::core::result::Result::Err(<V__::Error as ::serde::de::Error>::custom(
5274                        format_args!("Percentage can't be {kind:?}"),
5275                    )),
5276                }
5277            }
5278        }
5279        ::oxsearch_core::__private::deserialize_by_kind(deserializer, Shape)
5280    }
5281}
5282
5283impl ::core::convert::From<::std::string::String> for Percentage {
5284    fn from(value: ::std::string::String) -> Self {
5285        Self::String(value)
5286    }
5287}
5288
5289impl ::core::convert::From<f32> for Percentage {
5290    fn from(value: f32) -> Self {
5291        Self::Float(value)
5292    }
5293}
5294
5295impl ::core::convert::From<&str> for Percentage {
5296    fn from(value: &str) -> Self {
5297        Self::String(::std::borrow::ToOwned::to_owned(value))
5298    }
5299}
5300
5301#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
5302#[non_exhaustive]
5303pub struct PinnedRetriever {
5304    /// Query to filter the documents that can match.
5305    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
5306    pub filter: ::core::option::Option<
5307        ::oxsearch_core::shapes::OneOrMany<crate::query_dsl::QueryContainer>,
5308    >,
5309    /// Minimum _score for matching documents. Documents with a lower _score are not included in the top documents.
5310    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
5311    pub min_score: ::core::option::Option<f32>,
5312    /// Retriever name.
5313    #[serde(
5314        rename = "_name",
5315        skip_serializing_if = "::core::option::Option::is_none"
5316    )]
5317    pub name: ::core::option::Option<::std::string::String>,
5318    /// Inner retriever.
5319    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
5320    pub retriever: ::core::option::Option<crate::RetrieverContainer>,
5321    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
5322    pub ids: ::core::option::Option<::std::vec::Vec<::std::string::String>>,
5323    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
5324    pub docs: ::core::option::Option<::std::vec::Vec<crate::SpecifiedDocument>>,
5325    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
5326    pub rank_window_size: ::core::option::Option<i32>,
5327}
5328
5329impl PinnedRetriever {
5330    /// A `PinnedRetriever` with its required properties set.
5331    pub fn new(retriever: impl ::core::convert::Into<crate::RetrieverContainer>) -> Self {
5332        Self {
5333            filter: ::core::option::Option::None,
5334            min_score: ::core::option::Option::None,
5335            name: ::core::option::Option::None,
5336            retriever: ::core::option::Option::Some(retriever.into()),
5337            ids: ::core::option::Option::None,
5338            docs: ::core::option::Option::None,
5339            rank_window_size: ::core::option::Option::None,
5340        }
5341    }
5342}
5343
5344impl PinnedRetriever {
5345    /// Sets `filter`.
5346    pub fn filter(
5347        mut self,
5348        value: impl ::core::convert::Into<
5349            ::oxsearch_core::shapes::OneOrMany<crate::query_dsl::QueryContainer>,
5350        >,
5351    ) -> Self {
5352        self.filter = ::core::option::Option::Some(value.into());
5353        self
5354    }
5355    /// Sets `min_score`.
5356    pub fn min_score(mut self, value: f32) -> Self {
5357        self.min_score = ::core::option::Option::Some(value.into());
5358        self
5359    }
5360    /// Sets `name`.
5361    pub fn name(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
5362        self.name = ::core::option::Option::Some(value.into());
5363        self
5364    }
5365    /// Sets `ids`.
5366    pub fn ids(
5367        mut self,
5368        value: impl ::core::convert::Into<::std::vec::Vec<::std::string::String>>,
5369    ) -> Self {
5370        self.ids = ::core::option::Option::Some(value.into());
5371        self
5372    }
5373    /// Sets `docs`.
5374    pub fn docs(
5375        mut self,
5376        value: impl ::core::convert::Into<::std::vec::Vec<crate::SpecifiedDocument>>,
5377    ) -> Self {
5378        self.docs = ::core::option::Option::Some(value.into());
5379        self
5380    }
5381    /// Sets `rank_window_size`.
5382    pub fn rank_window_size(mut self, value: i32) -> Self {
5383        self.rank_window_size = ::core::option::Option::Some(value.into());
5384        self
5385    }
5386}
5387
5388pub type PipelineName = ::std::string::String;
5389
5390#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
5391#[non_exhaustive]
5392pub struct PluginStats {
5393    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
5394    pub classname: ::core::option::Option<::std::string::String>,
5395    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
5396    pub description: ::core::option::Option<::std::string::String>,
5397    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
5398    pub elasticsearch_version: ::core::option::Option<crate::VersionString>,
5399    #[serde(default = "::core::default::Default::default")]
5400    pub extended_plugins: ::std::vec::Vec<::std::string::String>,
5401    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
5402    pub has_native_controller: ::core::option::Option<bool>,
5403    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
5404    pub java_version: ::core::option::Option<crate::VersionString>,
5405    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
5406    pub name: ::core::option::Option<crate::Name>,
5407    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
5408    pub version: ::core::option::Option<crate::VersionString>,
5409    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
5410    pub licensed: ::core::option::Option<bool>,
5411}
5412
5413impl PluginStats {
5414    /// A `PluginStats` with its required properties set.
5415    pub fn new(
5416        classname: impl ::core::convert::Into<::std::string::String>,
5417        description: impl ::core::convert::Into<::std::string::String>,
5418        elasticsearch_version: impl ::core::convert::Into<crate::VersionString>,
5419        extended_plugins: impl ::core::convert::Into<::std::vec::Vec<::std::string::String>>,
5420        has_native_controller: bool,
5421        java_version: impl ::core::convert::Into<crate::VersionString>,
5422        name: impl ::core::convert::Into<crate::Name>,
5423        version: impl ::core::convert::Into<crate::VersionString>,
5424        licensed: bool,
5425    ) -> Self {
5426        Self {
5427            classname: ::core::option::Option::Some(classname.into()),
5428            description: ::core::option::Option::Some(description.into()),
5429            elasticsearch_version: ::core::option::Option::Some(elasticsearch_version.into()),
5430            extended_plugins: extended_plugins.into(),
5431            has_native_controller: ::core::option::Option::Some(has_native_controller.into()),
5432            java_version: ::core::option::Option::Some(java_version.into()),
5433            name: ::core::option::Option::Some(name.into()),
5434            version: ::core::option::Option::Some(version.into()),
5435            licensed: ::core::option::Option::Some(licensed.into()),
5436        }
5437    }
5438}
5439
5440impl PluginStats {}
5441
5442pub type ProjectRouting = ::std::string::String;
5443
5444pub type PropertyName = ::std::string::String;
5445
5446#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
5447#[non_exhaustive]
5448pub struct QueryCacheStats {
5449    /// Total number of entries added to the query cache across all shards assigned to selected nodes.
5450    /// This number includes current and evicted entries.
5451    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
5452    pub cache_count: ::core::option::Option<i64>,
5453    /// Total number of entries currently in the query cache across all shards assigned to selected nodes.
5454    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
5455    pub cache_size: ::core::option::Option<i64>,
5456    /// Total number of query cache evictions across all shards assigned to selected nodes.
5457    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
5458    pub evictions: ::core::option::Option<i64>,
5459    /// Total count of query cache hits across all shards assigned to selected nodes.
5460    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
5461    pub hit_count: ::core::option::Option<i64>,
5462    /// Total amount of memory used for the query cache across all shards assigned to selected nodes.
5463    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
5464    pub memory_size: ::core::option::Option<crate::ByteSize>,
5465    /// Total amount, in bytes, of memory used for the query cache across all shards assigned to selected nodes.
5466    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
5467    pub memory_size_in_bytes: ::core::option::Option<i64>,
5468    /// Total count of query cache misses across all shards assigned to selected nodes.
5469    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
5470    pub miss_count: ::core::option::Option<i64>,
5471    /// Total count of hits and misses in the query cache across all shards assigned to selected nodes.
5472    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
5473    pub total_count: ::core::option::Option<i64>,
5474}
5475
5476impl QueryCacheStats {
5477    /// A `QueryCacheStats` with its required properties set.
5478    pub fn new(
5479        cache_count: i64,
5480        cache_size: i64,
5481        evictions: i64,
5482        hit_count: i64,
5483        memory_size_in_bytes: i64,
5484        miss_count: i64,
5485        total_count: i64,
5486    ) -> Self {
5487        Self {
5488            cache_count: ::core::option::Option::Some(cache_count.into()),
5489            cache_size: ::core::option::Option::Some(cache_size.into()),
5490            evictions: ::core::option::Option::Some(evictions.into()),
5491            hit_count: ::core::option::Option::Some(hit_count.into()),
5492            memory_size: ::core::option::Option::None,
5493            memory_size_in_bytes: ::core::option::Option::Some(memory_size_in_bytes.into()),
5494            miss_count: ::core::option::Option::Some(miss_count.into()),
5495            total_count: ::core::option::Option::Some(total_count.into()),
5496        }
5497    }
5498}
5499
5500impl QueryCacheStats {
5501    /// Sets `memory_size`.
5502    pub fn memory_size(mut self, value: impl ::core::convert::Into<crate::ByteSize>) -> Self {
5503        self.memory_size = ::core::option::Option::Some(value.into());
5504        self
5505    }
5506}
5507
5508pub type QueryVector = ::std::vec::Vec<f32>;
5509
5510#[derive(Clone, Debug, PartialEq)]
5511#[non_exhaustive]
5512pub enum QueryVectorBuilder {
5513    Embedding(crate::Embedding),
5514    TextEmbedding(crate::TextEmbedding),
5515    /// Lookup a vector from an existing document.
5516    /// Must reference a dense_vector field and a single value.
5517    Lookup(crate::LookupQueryVectorBuilder),
5518    /// Any variant, as JSON: an object with one property.
5519    Raw(::serde_json::Value),
5520}
5521
5522impl QueryVectorBuilder {
5523    /// Writes the variant as one entry of a map.
5524    pub fn serialize_entry<M__: ::serde::ser::SerializeMap>(
5525        &self,
5526        map: &mut M__,
5527    ) -> ::core::result::Result<(), M__::Error> {
5528        match self {
5529            Self::Embedding(value) => map.serialize_entry("embedding", value),
5530            Self::TextEmbedding(value) => map.serialize_entry("text_embedding", value),
5531            Self::Lookup(value) => map.serialize_entry("lookup", value),
5532            Self::Raw(value) => match value {
5533                ::serde_json::Value::Object(entries) => {
5534                    for (key, value) in entries {
5535                        map.serialize_entry(key, value)?;
5536                    }
5537                    ::core::result::Result::Ok(())
5538                }
5539                _ => ::core::result::Result::Err(<M__::Error as ::serde::ser::Error>::custom(
5540                    "a raw variant must be an object",
5541                )),
5542            },
5543        }
5544    }
5545}
5546
5547impl ::serde::Serialize for QueryVectorBuilder {
5548    fn serialize<S__: ::serde::Serializer>(
5549        &self,
5550        serializer: S__,
5551    ) -> ::core::result::Result<S__::Ok, S__::Error> {
5552        match self {
5553            Self::Embedding(value) => {
5554                ::oxsearch_core::__private::serialize_variant(serializer, "embedding", value)
5555            }
5556            Self::TextEmbedding(value) => {
5557                ::oxsearch_core::__private::serialize_variant(serializer, "text_embedding", value)
5558            }
5559            Self::Lookup(value) => {
5560                ::oxsearch_core::__private::serialize_variant(serializer, "lookup", value)
5561            }
5562            Self::Raw(value) => ::serde::Serialize::serialize(value, serializer),
5563        }
5564    }
5565}
5566
5567impl<'de> ::serde::Deserialize<'de> for QueryVectorBuilder {
5568    fn deserialize<D__: ::serde::Deserializer<'de>>(
5569        deserializer: D__,
5570    ) -> ::core::result::Result<Self, D__::Error> {
5571        ::oxsearch_core::__private::deserialize_container(deserializer)
5572    }
5573}
5574
5575impl<'de> ::oxsearch_core::__private::Container<'de> for QueryVectorBuilder {
5576    const NAME: &'static str = "QueryVectorBuilder";
5577    fn variant<A__: ::serde::de::MapAccess<'de>>(
5578        key: &str,
5579        map: &mut A__,
5580    ) -> ::core::result::Result<Self, A__::Error> {
5581        ::core::result::Result::Ok(match key {
5582            "embedding" => Self::Embedding(map.next_value()?),
5583            "text_embedding" => Self::TextEmbedding(map.next_value()?),
5584            "lookup" => Self::Lookup(map.next_value()?),
5585            _ => Self::Raw(::oxsearch_core::__private::raw_variant(
5586                key,
5587                map.next_value()?,
5588            )),
5589        })
5590    }
5591}
5592
5593impl ::core::convert::From<crate::Embedding> for QueryVectorBuilder {
5594    fn from(value: crate::Embedding) -> Self {
5595        Self::Embedding(value)
5596    }
5597}
5598
5599impl ::core::convert::From<crate::TextEmbedding> for QueryVectorBuilder {
5600    fn from(value: crate::TextEmbedding) -> Self {
5601        Self::TextEmbedding(value)
5602    }
5603}
5604
5605impl ::core::convert::From<crate::LookupQueryVectorBuilder> for QueryVectorBuilder {
5606    fn from(value: crate::LookupQueryVectorBuilder) -> Self {
5607        Self::Lookup(value)
5608    }
5609}
5610
5611#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
5612#[non_exhaustive]
5613pub struct RRFRetriever {
5614    /// Query to filter the documents that can match.
5615    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
5616    pub filter: ::core::option::Option<
5617        ::oxsearch_core::shapes::OneOrMany<crate::query_dsl::QueryContainer>,
5618    >,
5619    /// Minimum _score for matching documents. Documents with a lower _score are not included in the top documents.
5620    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
5621    pub min_score: ::core::option::Option<f32>,
5622    /// Retriever name.
5623    #[serde(
5624        rename = "_name",
5625        skip_serializing_if = "::core::option::Option::is_none"
5626    )]
5627    pub name: ::core::option::Option<::std::string::String>,
5628    /// A list of child retrievers to specify which sets of returned top documents will have the RRF formula applied to them. Each retriever can optionally include a weight parameter.
5629    #[serde(default = "::core::default::Default::default")]
5630    pub retrievers: ::std::vec::Vec<crate::RRFRetrieverEntry>,
5631    /// This value determines how much influence documents in individual result sets per query have over the final ranked result set.
5632    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
5633    pub rank_constant: ::core::option::Option<i32>,
5634    /// This value determines the size of the individual result sets per query.
5635    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
5636    pub rank_window_size: ::core::option::Option<i32>,
5637    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
5638    pub query: ::core::option::Option<::std::string::String>,
5639    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
5640    pub fields: ::core::option::Option<::std::vec::Vec<::std::string::String>>,
5641}
5642
5643impl RRFRetriever {
5644    /// A `RRFRetriever` with its required properties set.
5645    pub fn new(
5646        retrievers: impl ::core::convert::Into<::std::vec::Vec<crate::RRFRetrieverEntry>>,
5647    ) -> Self {
5648        Self {
5649            filter: ::core::option::Option::None,
5650            min_score: ::core::option::Option::None,
5651            name: ::core::option::Option::None,
5652            retrievers: retrievers.into(),
5653            rank_constant: ::core::option::Option::None,
5654            rank_window_size: ::core::option::Option::None,
5655            query: ::core::option::Option::None,
5656            fields: ::core::option::Option::None,
5657        }
5658    }
5659}
5660
5661impl RRFRetriever {
5662    /// Sets `filter`.
5663    pub fn filter(
5664        mut self,
5665        value: impl ::core::convert::Into<
5666            ::oxsearch_core::shapes::OneOrMany<crate::query_dsl::QueryContainer>,
5667        >,
5668    ) -> Self {
5669        self.filter = ::core::option::Option::Some(value.into());
5670        self
5671    }
5672    /// Sets `min_score`.
5673    pub fn min_score(mut self, value: f32) -> Self {
5674        self.min_score = ::core::option::Option::Some(value.into());
5675        self
5676    }
5677    /// Sets `name`.
5678    pub fn name(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
5679        self.name = ::core::option::Option::Some(value.into());
5680        self
5681    }
5682    /// Sets `rank_constant`.
5683    pub fn rank_constant(mut self, value: i32) -> Self {
5684        self.rank_constant = ::core::option::Option::Some(value.into());
5685        self
5686    }
5687    /// Sets `rank_window_size`.
5688    pub fn rank_window_size(mut self, value: i32) -> Self {
5689        self.rank_window_size = ::core::option::Option::Some(value.into());
5690        self
5691    }
5692    /// Sets `query`.
5693    pub fn query(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
5694        self.query = ::core::option::Option::Some(value.into());
5695        self
5696    }
5697    /// Sets `fields`.
5698    pub fn fields(
5699        mut self,
5700        value: impl ::core::convert::Into<::std::vec::Vec<::std::string::String>>,
5701    ) -> Self {
5702        self.fields = ::core::option::Option::Some(value.into());
5703        self
5704    }
5705}
5706
5707/// Wraps a retriever with an optional weight for RRF scoring.
5708#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
5709#[non_exhaustive]
5710pub struct RRFRetrieverComponent {
5711    /// The nested retriever configuration.
5712    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
5713    pub retriever: ::core::option::Option<crate::RetrieverContainer>,
5714    /// Weight multiplier for this retriever's contribution to the RRF score. Higher values increase influence. Defaults to 1.0 if not specified. Must be non-negative.
5715    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
5716    pub weight: ::core::option::Option<f32>,
5717}
5718
5719impl RRFRetrieverComponent {
5720    /// A `RRFRetrieverComponent` with its required properties set.
5721    pub fn new(retriever: impl ::core::convert::Into<crate::RetrieverContainer>) -> Self {
5722        Self {
5723            retriever: ::core::option::Option::Some(retriever.into()),
5724            weight: ::core::option::Option::None,
5725        }
5726    }
5727}
5728
5729impl RRFRetrieverComponent {
5730    /// Sets `weight`.
5731    pub fn weight(mut self, value: f32) -> Self {
5732        self.weight = ::core::option::Option::Some(value.into());
5733        self
5734    }
5735}
5736
5737/// Either a direct RetrieverContainer (backward compatible) or an RRFRetrieverComponent with weight.
5738#[derive(Clone, Debug, PartialEq)]
5739#[non_exhaustive]
5740pub enum RRFRetrieverEntry {
5741    /// A object.
5742    Retriever(crate::RetrieverContainer),
5743    /// A object.
5744    Weighted(crate::RRFRetrieverComponent),
5745}
5746
5747impl ::serde::Serialize for RRFRetrieverEntry {
5748    fn serialize<S__: ::serde::Serializer>(
5749        &self,
5750        serializer: S__,
5751    ) -> ::core::result::Result<S__::Ok, S__::Error> {
5752        match self {
5753            Self::Retriever(value) => ::serde::Serialize::serialize(value, serializer),
5754            Self::Weighted(value) => ::serde::Serialize::serialize(value, serializer),
5755        }
5756    }
5757}
5758
5759impl<'de> ::serde::Deserialize<'de> for RRFRetrieverEntry {
5760    fn deserialize<D__: ::serde::Deserializer<'de>>(
5761        deserializer: D__,
5762    ) -> ::core::result::Result<Self, D__::Error> {
5763        struct Shape;
5764        impl<'de> ::oxsearch_core::__private::ByKind<'de> for Shape {
5765            type Value = RRFRetrieverEntry;
5766            const EXPECTING: &'static str = "RRFRetrieverEntry: object";
5767            fn visit<V__: ::serde::Deserializer<'de>>(
5768                self,
5769                kind: ::oxsearch_core::__private::Kind,
5770                value: V__,
5771            ) -> ::core::result::Result<Self::Value, V__::Error> {
5772                match kind {
5773                    ::oxsearch_core::__private::Kind::Object => {
5774                        let json: ::serde_json::Value = ::serde::Deserialize::deserialize(value)?;
5775                        if ::oxsearch_core::__private::has(&json, "diversify")
5776                            || ::oxsearch_core::__private::has(&json, "knn")
5777                            || ::oxsearch_core::__private::has(&json, "linear")
5778                            || ::oxsearch_core::__private::has(&json, "pinned")
5779                            || ::oxsearch_core::__private::has(&json, "rescorer")
5780                            || ::oxsearch_core::__private::has(&json, "rrf")
5781                            || ::oxsearch_core::__private::has(&json, "rule")
5782                            || ::oxsearch_core::__private::has(&json, "standard")
5783                            || ::oxsearch_core::__private::has(&json, "text_similarity_reranker")
5784                        {
5785                            return ::oxsearch_core::__private::from_value(json)
5786                                .map(RRFRetrieverEntry::Retriever);
5787                        }
5788                        if ::oxsearch_core::__private::has(&json, "retriever")
5789                            || ::oxsearch_core::__private::has(&json, "weight")
5790                        {
5791                            return ::oxsearch_core::__private::from_value(json)
5792                                .map(RRFRetrieverEntry::Weighted);
5793                        }
5794                        if let ::core::result::Result::Ok(found) =
5795                            ::oxsearch_core::__private::from_value::<
5796                                crate::RetrieverContainer,
5797                                V__::Error,
5798                            >(json.clone())
5799                        {
5800                            return ::core::result::Result::Ok(RRFRetrieverEntry::Retriever(found));
5801                        }
5802                        ::oxsearch_core::__private::from_value(json)
5803                            .map(RRFRetrieverEntry::Weighted)
5804                    }
5805                    _ => ::core::result::Result::Err(<V__::Error as ::serde::de::Error>::custom(
5806                        format_args!("RRFRetrieverEntry can't be {kind:?}"),
5807                    )),
5808                }
5809            }
5810        }
5811        ::oxsearch_core::__private::deserialize_by_kind(deserializer, Shape)
5812    }
5813}
5814
5815impl ::core::convert::From<crate::RetrieverContainer> for RRFRetrieverEntry {
5816    fn from(value: crate::RetrieverContainer) -> Self {
5817        Self::Retriever(value)
5818    }
5819}
5820
5821impl ::core::convert::From<crate::RRFRetrieverComponent> for RRFRetrieverEntry {
5822    fn from(value: crate::RRFRetrieverComponent) -> Self {
5823        Self::Weighted(value)
5824    }
5825}
5826
5827#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
5828#[non_exhaustive]
5829pub struct RankBase {}
5830
5831impl RankBase {
5832    /// A `RankBase` with its required properties set.
5833    pub fn new() -> Self {
5834        Self {}
5835    }
5836}
5837
5838impl RankBase {}
5839
5840#[derive(Clone, Debug, PartialEq)]
5841#[non_exhaustive]
5842pub enum RankContainer {
5843    /// The reciprocal rank fusion parameters
5844    Rrf(crate::RrfRank),
5845    /// Any variant, as JSON: an object with one property.
5846    Raw(::serde_json::Value),
5847}
5848
5849impl RankContainer {
5850    /// Writes the variant as one entry of a map.
5851    pub fn serialize_entry<M__: ::serde::ser::SerializeMap>(
5852        &self,
5853        map: &mut M__,
5854    ) -> ::core::result::Result<(), M__::Error> {
5855        match self {
5856            Self::Rrf(value) => map.serialize_entry("rrf", value),
5857            Self::Raw(value) => match value {
5858                ::serde_json::Value::Object(entries) => {
5859                    for (key, value) in entries {
5860                        map.serialize_entry(key, value)?;
5861                    }
5862                    ::core::result::Result::Ok(())
5863                }
5864                _ => ::core::result::Result::Err(<M__::Error as ::serde::ser::Error>::custom(
5865                    "a raw variant must be an object",
5866                )),
5867            },
5868        }
5869    }
5870}
5871
5872impl ::serde::Serialize for RankContainer {
5873    fn serialize<S__: ::serde::Serializer>(
5874        &self,
5875        serializer: S__,
5876    ) -> ::core::result::Result<S__::Ok, S__::Error> {
5877        match self {
5878            Self::Rrf(value) => {
5879                ::oxsearch_core::__private::serialize_variant(serializer, "rrf", value)
5880            }
5881            Self::Raw(value) => ::serde::Serialize::serialize(value, serializer),
5882        }
5883    }
5884}
5885
5886impl<'de> ::serde::Deserialize<'de> for RankContainer {
5887    fn deserialize<D__: ::serde::Deserializer<'de>>(
5888        deserializer: D__,
5889    ) -> ::core::result::Result<Self, D__::Error> {
5890        ::oxsearch_core::__private::deserialize_container(deserializer)
5891    }
5892}
5893
5894impl<'de> ::oxsearch_core::__private::Container<'de> for RankContainer {
5895    const NAME: &'static str = "RankContainer";
5896    fn variant<A__: ::serde::de::MapAccess<'de>>(
5897        key: &str,
5898        map: &mut A__,
5899    ) -> ::core::result::Result<Self, A__::Error> {
5900        ::core::result::Result::Ok(match key {
5901            "rrf" => Self::Rrf(map.next_value()?),
5902            _ => Self::Raw(::oxsearch_core::__private::raw_variant(
5903                key,
5904                map.next_value()?,
5905            )),
5906        })
5907    }
5908}
5909
5910impl ::core::convert::From<crate::RrfRank> for RankContainer {
5911    fn from(value: crate::RrfRank) -> Self {
5912        Self::Rrf(value)
5913    }
5914}
5915
5916#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
5917#[non_exhaustive]
5918pub struct RecoveryStats {
5919    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
5920    pub current_as_source: ::core::option::Option<i64>,
5921    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
5922    pub current_as_source_queued: ::core::option::Option<i64>,
5923    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
5924    pub current_as_target: ::core::option::Option<i64>,
5925    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
5926    pub current_as_target_queued: ::core::option::Option<i64>,
5927    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
5928    pub current_from_store: ::core::option::Option<i64>,
5929    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
5930    pub current_from_store_queued: ::core::option::Option<i64>,
5931    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
5932    pub throttle_time: ::core::option::Option<crate::Duration>,
5933    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
5934    pub throttle_time_in_millis: ::core::option::Option<crate::UnitMillis>,
5935}
5936
5937impl RecoveryStats {
5938    /// A `RecoveryStats` with its required properties set.
5939    pub fn new(
5940        current_as_source: i64,
5941        current_as_target: i64,
5942        throttle_time_in_millis: impl ::core::convert::Into<crate::UnitMillis>,
5943    ) -> Self {
5944        Self {
5945            current_as_source: ::core::option::Option::Some(current_as_source.into()),
5946            current_as_source_queued: ::core::option::Option::None,
5947            current_as_target: ::core::option::Option::Some(current_as_target.into()),
5948            current_as_target_queued: ::core::option::Option::None,
5949            current_from_store: ::core::option::Option::None,
5950            current_from_store_queued: ::core::option::Option::None,
5951            throttle_time: ::core::option::Option::None,
5952            throttle_time_in_millis: ::core::option::Option::Some(throttle_time_in_millis.into()),
5953        }
5954    }
5955}
5956
5957impl RecoveryStats {
5958    /// Sets `current_as_source_queued`.
5959    pub fn current_as_source_queued(mut self, value: i64) -> Self {
5960        self.current_as_source_queued = ::core::option::Option::Some(value.into());
5961        self
5962    }
5963    /// Sets `current_as_target_queued`.
5964    pub fn current_as_target_queued(mut self, value: i64) -> Self {
5965        self.current_as_target_queued = ::core::option::Option::Some(value.into());
5966        self
5967    }
5968    /// Sets `current_from_store`.
5969    pub fn current_from_store(mut self, value: i64) -> Self {
5970        self.current_from_store = ::core::option::Option::Some(value.into());
5971        self
5972    }
5973    /// Sets `current_from_store_queued`.
5974    pub fn current_from_store_queued(mut self, value: i64) -> Self {
5975        self.current_from_store_queued = ::core::option::Option::Some(value.into());
5976        self
5977    }
5978    /// Sets `throttle_time`.
5979    pub fn throttle_time(mut self, value: impl ::core::convert::Into<crate::Duration>) -> Self {
5980        self.throttle_time = ::core::option::Option::Some(value.into());
5981        self
5982    }
5983}
5984
5985#[derive(Clone, Debug, PartialEq, Eq, Hash)]
5986#[non_exhaustive]
5987pub enum Refresh {
5988    /// `true`
5989    True,
5990    /// `false`
5991    False,
5992    /// `wait_for`
5993    WaitFor,
5994    /// A value this version of the specification doesn't list.
5995    Raw(::std::string::String),
5996}
5997
5998impl Refresh {
5999    /// The value as Elasticsearch writes it.
6000    pub fn as_str(&self) -> &str {
6001        match self {
6002            Self::True => "true",
6003            Self::False => "false",
6004            Self::WaitFor => "wait_for",
6005            Self::Raw(value) => value,
6006        }
6007    }
6008
6009    /// The listed value with this name, if there is one.
6010    pub fn from_known(value: &str) -> ::core::option::Option<Self> {
6011        match value {
6012            "true" => ::core::option::Option::Some(Self::True),
6013            "false" => ::core::option::Option::Some(Self::False),
6014            "wait_for" => ::core::option::Option::Some(Self::WaitFor),
6015            _ => ::core::option::Option::None,
6016        }
6017    }
6018}
6019
6020impl ::serde::Serialize for Refresh {
6021    fn serialize<S__: ::serde::Serializer>(
6022        &self,
6023        serializer: S__,
6024    ) -> ::core::result::Result<S__::Ok, S__::Error> {
6025        serializer.serialize_str(self.as_str())
6026    }
6027}
6028
6029impl<'de> ::serde::Deserialize<'de> for Refresh {
6030    fn deserialize<D__: ::serde::Deserializer<'de>>(
6031        deserializer: D__,
6032    ) -> ::core::result::Result<Self, D__::Error> {
6033        ::oxsearch_core::__private::deserialize_string_enum(deserializer, "Refresh", |value| {
6034            Self::from_known(value).unwrap_or_else(|| Self::Raw(value.to_owned()))
6035        })
6036    }
6037}
6038
6039#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
6040#[non_exhaustive]
6041pub struct RefreshStats {
6042    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
6043    pub external_total: ::core::option::Option<i64>,
6044    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
6045    pub external_total_time: ::core::option::Option<crate::Duration>,
6046    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
6047    pub external_total_time_in_millis: ::core::option::Option<crate::UnitMillis>,
6048    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
6049    pub listeners: ::core::option::Option<i64>,
6050    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
6051    pub total: ::core::option::Option<i64>,
6052    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
6053    pub total_time: ::core::option::Option<crate::Duration>,
6054    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
6055    pub total_time_in_millis: ::core::option::Option<crate::UnitMillis>,
6056}
6057
6058impl RefreshStats {
6059    /// A `RefreshStats` with its required properties set.
6060    pub fn new(
6061        external_total: i64,
6062        external_total_time_in_millis: impl ::core::convert::Into<crate::UnitMillis>,
6063        listeners: i64,
6064        total: i64,
6065        total_time_in_millis: impl ::core::convert::Into<crate::UnitMillis>,
6066    ) -> Self {
6067        Self {
6068            external_total: ::core::option::Option::Some(external_total.into()),
6069            external_total_time: ::core::option::Option::None,
6070            external_total_time_in_millis: ::core::option::Option::Some(
6071                external_total_time_in_millis.into(),
6072            ),
6073            listeners: ::core::option::Option::Some(listeners.into()),
6074            total: ::core::option::Option::Some(total.into()),
6075            total_time: ::core::option::Option::None,
6076            total_time_in_millis: ::core::option::Option::Some(total_time_in_millis.into()),
6077        }
6078    }
6079}
6080
6081impl RefreshStats {
6082    /// Sets `external_total_time`.
6083    pub fn external_total_time(
6084        mut self,
6085        value: impl ::core::convert::Into<crate::Duration>,
6086    ) -> Self {
6087        self.external_total_time = ::core::option::Option::Some(value.into());
6088        self
6089    }
6090    /// Sets `total_time`.
6091    pub fn total_time(mut self, value: impl ::core::convert::Into<crate::Duration>) -> Self {
6092        self.total_time = ::core::option::Option::Some(value.into());
6093        self
6094    }
6095}
6096
6097#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
6098#[non_exhaustive]
6099pub struct ReindexStatus {
6100    /// The slice ID
6101    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
6102    pub slice_id: ::core::option::Option<i32>,
6103    /// The number of scroll responses pulled back by the reindex.
6104    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
6105    pub batches: ::core::option::Option<i64>,
6106    /// The number of documents that were successfully created.
6107    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
6108    pub created: ::core::option::Option<i64>,
6109    /// The number of documents that were successfully deleted.
6110    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
6111    pub deleted: ::core::option::Option<i64>,
6112    /// The number of documents that were ignored because the script used for the reindex returned a `noop` value for `ctx.op`.
6113    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
6114    pub noops: ::core::option::Option<i64>,
6115    /// The number of requests per second effectively executed during the reindex.
6116    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
6117    pub requests_per_second: ::core::option::Option<f32>,
6118    /// The number of retries attempted by reindex. `bulk` is the number of bulk actions retried and `search` is the number of search actions retried.
6119    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
6120    pub retries: ::core::option::Option<crate::Retries>,
6121    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
6122    pub throttled: ::core::option::Option<crate::Duration>,
6123    /// Number of milliseconds the request slept to conform to `requests_per_second`.
6124    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
6125    pub throttled_millis: ::core::option::Option<crate::UnitMillis>,
6126    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
6127    pub throttled_until: ::core::option::Option<crate::Duration>,
6128    /// This field should always be equal to zero in a `_reindex` response.
6129    /// It only has meaning when using the Task API, where it indicates the next time (in milliseconds since epoch) a throttled request will be executed again in order to conform to `requests_per_second`.
6130    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
6131    pub throttled_until_millis: ::core::option::Option<crate::UnitMillis>,
6132    /// The number of documents that were successfully processed.
6133    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
6134    pub total: ::core::option::Option<i64>,
6135    /// The number of documents that were successfully updated, for example, a document with same ID already existed prior to reindex updating it.
6136    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
6137    pub updated: ::core::option::Option<i64>,
6138    /// The number of version conflicts that reindex hits.
6139    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
6140    pub version_conflicts: ::core::option::Option<i64>,
6141    /// The reason for cancellation if the slice was canceled
6142    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
6143    pub cancelled: ::core::option::Option<::std::string::String>,
6144}
6145
6146impl ReindexStatus {
6147    /// A `ReindexStatus` with its required properties set.
6148    pub fn new(
6149        batches: i64,
6150        deleted: i64,
6151        noops: i64,
6152        requests_per_second: f32,
6153        retries: impl ::core::convert::Into<crate::Retries>,
6154        throttled_millis: impl ::core::convert::Into<crate::UnitMillis>,
6155        throttled_until_millis: impl ::core::convert::Into<crate::UnitMillis>,
6156        total: i64,
6157        version_conflicts: i64,
6158    ) -> Self {
6159        Self {
6160            slice_id: ::core::option::Option::None,
6161            batches: ::core::option::Option::Some(batches.into()),
6162            created: ::core::option::Option::None,
6163            deleted: ::core::option::Option::Some(deleted.into()),
6164            noops: ::core::option::Option::Some(noops.into()),
6165            requests_per_second: ::core::option::Option::Some(requests_per_second.into()),
6166            retries: ::core::option::Option::Some(retries.into()),
6167            throttled: ::core::option::Option::None,
6168            throttled_millis: ::core::option::Option::Some(throttled_millis.into()),
6169            throttled_until: ::core::option::Option::None,
6170            throttled_until_millis: ::core::option::Option::Some(throttled_until_millis.into()),
6171            total: ::core::option::Option::Some(total.into()),
6172            updated: ::core::option::Option::None,
6173            version_conflicts: ::core::option::Option::Some(version_conflicts.into()),
6174            cancelled: ::core::option::Option::None,
6175        }
6176    }
6177}
6178
6179impl ReindexStatus {
6180    /// Sets `slice_id`.
6181    pub fn slice_id(mut self, value: i32) -> Self {
6182        self.slice_id = ::core::option::Option::Some(value.into());
6183        self
6184    }
6185    /// Sets `created`.
6186    pub fn created(mut self, value: i64) -> Self {
6187        self.created = ::core::option::Option::Some(value.into());
6188        self
6189    }
6190    /// Sets `throttled`.
6191    pub fn throttled(mut self, value: impl ::core::convert::Into<crate::Duration>) -> Self {
6192        self.throttled = ::core::option::Option::Some(value.into());
6193        self
6194    }
6195    /// Sets `throttled_until`.
6196    pub fn throttled_until(mut self, value: impl ::core::convert::Into<crate::Duration>) -> Self {
6197        self.throttled_until = ::core::option::Option::Some(value.into());
6198        self
6199    }
6200    /// Sets `updated`.
6201    pub fn updated(mut self, value: i64) -> Self {
6202        self.updated = ::core::option::Option::Some(value.into());
6203        self
6204    }
6205    /// Sets `cancelled`.
6206    pub fn cancelled(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
6207        self.cancelled = ::core::option::Option::Some(value.into());
6208        self
6209    }
6210}
6211
6212/// Information about a single parent reindex task, as returned by the reindex management APIs.
6213#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
6214#[non_exhaustive]
6215pub struct ReindexTaskInfo {
6216    /// The ID of the reindex task. The ID is assigned when the task was first created and remains the same across graceful shutdown relocations.
6217    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
6218    pub id: ::core::option::Option<crate::TaskId>,
6219    /// A sanitized description of the reindex operation (source and destination indices, and optionally remote host info).
6220    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
6221    pub description: ::core::option::Option<::std::string::String>,
6222    /// The time at which the reindex task started, in milliseconds since the Unix epoch. Remains the same across graceful shutdown relocations.
6223    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
6224    pub start_time_in_millis: ::core::option::Option<crate::UnitMillis>,
6225    /// The time at which the reindex task started, as an ISO-8601 formatted string. Remains the same across graceful shutdown relocations.
6226    /// Only present when the request includes the `?human=true` query parameter.
6227    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
6228    pub start_time: ::core::option::Option<::std::string::String>,
6229    /// The elapsed running time of the reindex task, including relocations, in a human-readable format.
6230    /// Only present when the request includes the `?human=true` query parameter.
6231    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
6232    pub running_time: ::core::option::Option<crate::Duration>,
6233    /// The elapsed running time of the reindex task, including relocations, in nanoseconds.
6234    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
6235    pub running_time_in_nanos: ::core::option::Option<crate::UnitNanos>,
6236    /// Whether the reindex task has been cancelled.
6237    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
6238    pub cancelled: ::core::option::Option<bool>,
6239    /// The current progress of the reindex operation.
6240    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
6241    pub status: ::core::option::Option<crate::ReindexStatus>,
6242}
6243
6244impl ReindexTaskInfo {
6245    /// A `ReindexTaskInfo` with its required properties set.
6246    pub fn new(
6247        id: impl ::core::convert::Into<crate::TaskId>,
6248        start_time_in_millis: impl ::core::convert::Into<crate::UnitMillis>,
6249        running_time_in_nanos: impl ::core::convert::Into<crate::UnitNanos>,
6250        cancelled: bool,
6251    ) -> Self {
6252        Self {
6253            id: ::core::option::Option::Some(id.into()),
6254            description: ::core::option::Option::None,
6255            start_time_in_millis: ::core::option::Option::Some(start_time_in_millis.into()),
6256            start_time: ::core::option::Option::None,
6257            running_time: ::core::option::Option::None,
6258            running_time_in_nanos: ::core::option::Option::Some(running_time_in_nanos.into()),
6259            cancelled: ::core::option::Option::Some(cancelled.into()),
6260            status: ::core::option::Option::None,
6261        }
6262    }
6263}
6264
6265impl ReindexTaskInfo {
6266    /// Sets `description`.
6267    pub fn description(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
6268        self.description = ::core::option::Option::Some(value.into());
6269        self
6270    }
6271    /// Sets `start_time`.
6272    pub fn start_time(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
6273        self.start_time = ::core::option::Option::Some(value.into());
6274        self
6275    }
6276    /// Sets `running_time`.
6277    pub fn running_time(mut self, value: impl ::core::convert::Into<crate::Duration>) -> Self {
6278        self.running_time = ::core::option::Option::Some(value.into());
6279        self
6280    }
6281    /// Sets `status`.
6282    pub fn status(mut self, value: impl ::core::convert::Into<crate::ReindexStatus>) -> Self {
6283        self.status = ::core::option::Option::Some(value.into());
6284        self
6285    }
6286}
6287
6288/// The final result of a completed reindex operation, as stored in the task result.
6289/// This is the serialized form of `BulkByScrollResponse`.
6290#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
6291#[non_exhaustive]
6292pub struct ReindexTaskResult {
6293    /// The number of scroll responses pulled back by the reindex.
6294    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
6295    pub batches: ::core::option::Option<i64>,
6296    /// The number of documents that were successfully created.
6297    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
6298    pub created: ::core::option::Option<i64>,
6299    /// The number of documents that were successfully deleted.
6300    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
6301    pub deleted: ::core::option::Option<i64>,
6302    /// Any failures encountered during the reindex. If non-empty, the reindex ended because of these failures.
6303    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
6304    pub failures: ::core::option::Option<::std::vec::Vec<crate::BulkIndexByScrollFailure>>,
6305    /// The number of documents that were ignored because the script returned a `noop` value for `ctx.op`.
6306    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
6307    pub noops: ::core::option::Option<i64>,
6308    /// The number of requests per second effectively executed during the reindex.
6309    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
6310    pub requests_per_second: ::core::option::Option<f32>,
6311    /// The number of retries attempted by reindex.
6312    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
6313    pub retries: ::core::option::Option<crate::Retries>,
6314    /// Number of milliseconds the request slept to conform to `requests_per_second`.
6315    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
6316    pub throttled_millis: ::core::option::Option<crate::UnitMillis>,
6317    /// This field should always be equal to zero in a completed reindex result.
6318    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
6319    pub throttled_until_millis: ::core::option::Option<crate::UnitMillis>,
6320    /// Whether any of the requests executed during the reindex timed out.
6321    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
6322    pub timed_out: ::core::option::Option<bool>,
6323    /// The total milliseconds the entire operation took.
6324    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
6325    pub took: ::core::option::Option<crate::UnitMillis>,
6326    /// The number of documents that were successfully processed.
6327    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
6328    pub total: ::core::option::Option<i64>,
6329    /// The number of documents that were successfully updated.
6330    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
6331    pub updated: ::core::option::Option<i64>,
6332    /// The number of version conflicts that occurred.
6333    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
6334    pub version_conflicts: ::core::option::Option<i64>,
6335}
6336
6337impl ReindexTaskResult {
6338    /// A `ReindexTaskResult` with its required properties set.
6339    pub fn new() -> Self {
6340        Self {
6341            batches: ::core::option::Option::None,
6342            created: ::core::option::Option::None,
6343            deleted: ::core::option::Option::None,
6344            failures: ::core::option::Option::None,
6345            noops: ::core::option::Option::None,
6346            requests_per_second: ::core::option::Option::None,
6347            retries: ::core::option::Option::None,
6348            throttled_millis: ::core::option::Option::None,
6349            throttled_until_millis: ::core::option::Option::None,
6350            timed_out: ::core::option::Option::None,
6351            took: ::core::option::Option::None,
6352            total: ::core::option::Option::None,
6353            updated: ::core::option::Option::None,
6354            version_conflicts: ::core::option::Option::None,
6355        }
6356    }
6357}
6358
6359impl ReindexTaskResult {
6360    /// Sets `batches`.
6361    pub fn batches(mut self, value: i64) -> Self {
6362        self.batches = ::core::option::Option::Some(value.into());
6363        self
6364    }
6365    /// Sets `created`.
6366    pub fn created(mut self, value: i64) -> Self {
6367        self.created = ::core::option::Option::Some(value.into());
6368        self
6369    }
6370    /// Sets `deleted`.
6371    pub fn deleted(mut self, value: i64) -> Self {
6372        self.deleted = ::core::option::Option::Some(value.into());
6373        self
6374    }
6375    /// Sets `failures`.
6376    pub fn failures(
6377        mut self,
6378        value: impl ::core::convert::Into<::std::vec::Vec<crate::BulkIndexByScrollFailure>>,
6379    ) -> Self {
6380        self.failures = ::core::option::Option::Some(value.into());
6381        self
6382    }
6383    /// Sets `noops`.
6384    pub fn noops(mut self, value: i64) -> Self {
6385        self.noops = ::core::option::Option::Some(value.into());
6386        self
6387    }
6388    /// Sets `requests_per_second`.
6389    pub fn requests_per_second(mut self, value: f32) -> Self {
6390        self.requests_per_second = ::core::option::Option::Some(value.into());
6391        self
6392    }
6393    /// Sets `retries`.
6394    pub fn retries(mut self, value: impl ::core::convert::Into<crate::Retries>) -> Self {
6395        self.retries = ::core::option::Option::Some(value.into());
6396        self
6397    }
6398    /// Sets `throttled_millis`.
6399    pub fn throttled_millis(
6400        mut self,
6401        value: impl ::core::convert::Into<crate::UnitMillis>,
6402    ) -> Self {
6403        self.throttled_millis = ::core::option::Option::Some(value.into());
6404        self
6405    }
6406    /// Sets `throttled_until_millis`.
6407    pub fn throttled_until_millis(
6408        mut self,
6409        value: impl ::core::convert::Into<crate::UnitMillis>,
6410    ) -> Self {
6411        self.throttled_until_millis = ::core::option::Option::Some(value.into());
6412        self
6413    }
6414    /// Sets `timed_out`.
6415    pub fn timed_out(mut self, value: bool) -> Self {
6416        self.timed_out = ::core::option::Option::Some(value.into());
6417        self
6418    }
6419    /// Sets `took`.
6420    pub fn took(mut self, value: impl ::core::convert::Into<crate::UnitMillis>) -> Self {
6421        self.took = ::core::option::Option::Some(value.into());
6422        self
6423    }
6424    /// Sets `total`.
6425    pub fn total(mut self, value: i64) -> Self {
6426        self.total = ::core::option::Option::Some(value.into());
6427        self
6428    }
6429    /// Sets `updated`.
6430    pub fn updated(mut self, value: i64) -> Self {
6431        self.updated = ::core::option::Option::Some(value.into());
6432        self
6433    }
6434    /// Sets `version_conflicts`.
6435    pub fn version_conflicts(mut self, value: i64) -> Self {
6436        self.version_conflicts = ::core::option::Option::Some(value.into());
6437        self
6438    }
6439}
6440
6441pub type RelationName = ::std::string::String;
6442
6443#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
6444#[non_exhaustive]
6445pub struct RelocationFailureInfo {
6446    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
6447    pub failed_attempts: ::core::option::Option<i32>,
6448}
6449
6450impl RelocationFailureInfo {
6451    /// A `RelocationFailureInfo` with its required properties set.
6452    pub fn new(failed_attempts: i32) -> Self {
6453        Self {
6454            failed_attempts: ::core::option::Option::Some(failed_attempts.into()),
6455        }
6456    }
6457}
6458
6459impl RelocationFailureInfo {}
6460
6461#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
6462#[non_exhaustive]
6463pub struct RequestBase {}
6464
6465impl RequestBase {
6466    /// A `RequestBase` with its required properties set.
6467    pub fn new() -> Self {
6468        Self {}
6469    }
6470}
6471
6472impl RequestBase {}
6473
6474#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
6475#[non_exhaustive]
6476pub struct RequestCacheStats {
6477    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
6478    pub evictions: ::core::option::Option<i64>,
6479    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
6480    pub hit_count: ::core::option::Option<i64>,
6481    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
6482    pub memory_size: ::core::option::Option<::std::string::String>,
6483    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
6484    pub memory_size_in_bytes: ::core::option::Option<i64>,
6485    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
6486    pub miss_count: ::core::option::Option<i64>,
6487}
6488
6489impl RequestCacheStats {
6490    /// A `RequestCacheStats` with its required properties set.
6491    pub fn new(evictions: i64, hit_count: i64, memory_size_in_bytes: i64, miss_count: i64) -> Self {
6492        Self {
6493            evictions: ::core::option::Option::Some(evictions.into()),
6494            hit_count: ::core::option::Option::Some(hit_count.into()),
6495            memory_size: ::core::option::Option::None,
6496            memory_size_in_bytes: ::core::option::Option::Some(memory_size_in_bytes.into()),
6497            miss_count: ::core::option::Option::Some(miss_count.into()),
6498        }
6499    }
6500}
6501
6502impl RequestCacheStats {
6503    /// Sets `memory_size`.
6504    pub fn memory_size(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
6505        self.memory_size = ::core::option::Option::Some(value.into());
6506        self
6507    }
6508}
6509
6510#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
6511#[non_exhaustive]
6512pub struct RescoreVector {
6513    /// Applies the specified oversample factor to k on the approximate kNN search
6514    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
6515    pub oversample: ::core::option::Option<f32>,
6516}
6517
6518impl RescoreVector {
6519    /// A `RescoreVector` with its required properties set.
6520    pub fn new(oversample: f32) -> Self {
6521        Self {
6522            oversample: ::core::option::Option::Some(oversample.into()),
6523        }
6524    }
6525}
6526
6527impl RescoreVector {}
6528
6529#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
6530#[non_exhaustive]
6531pub struct RescorerRetriever {
6532    /// Query to filter the documents that can match.
6533    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
6534    pub filter: ::core::option::Option<
6535        ::oxsearch_core::shapes::OneOrMany<crate::query_dsl::QueryContainer>,
6536    >,
6537    /// Minimum _score for matching documents. Documents with a lower _score are not included in the top documents.
6538    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
6539    pub min_score: ::core::option::Option<f32>,
6540    /// Retriever name.
6541    #[serde(
6542        rename = "_name",
6543        skip_serializing_if = "::core::option::Option::is_none"
6544    )]
6545    pub name: ::core::option::Option<::std::string::String>,
6546    /// Inner retriever.
6547    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
6548    pub retriever: ::core::option::Option<crate::RetrieverContainer>,
6549    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
6550    pub rescore: ::core::option::Option<::oxsearch_core::shapes::OneOrMany<crate::search::Rescore>>,
6551}
6552
6553impl RescorerRetriever {
6554    /// A `RescorerRetriever` with its required properties set.
6555    pub fn new(
6556        retriever: impl ::core::convert::Into<crate::RetrieverContainer>,
6557        rescore: impl ::core::convert::Into<::oxsearch_core::shapes::OneOrMany<crate::search::Rescore>>,
6558    ) -> Self {
6559        Self {
6560            filter: ::core::option::Option::None,
6561            min_score: ::core::option::Option::None,
6562            name: ::core::option::Option::None,
6563            retriever: ::core::option::Option::Some(retriever.into()),
6564            rescore: ::core::option::Option::Some(rescore.into()),
6565        }
6566    }
6567}
6568
6569impl RescorerRetriever {
6570    /// Sets `filter`.
6571    pub fn filter(
6572        mut self,
6573        value: impl ::core::convert::Into<
6574            ::oxsearch_core::shapes::OneOrMany<crate::query_dsl::QueryContainer>,
6575        >,
6576    ) -> Self {
6577        self.filter = ::core::option::Option::Some(value.into());
6578        self
6579    }
6580    /// Sets `min_score`.
6581    pub fn min_score(mut self, value: f32) -> Self {
6582        self.min_score = ::core::option::Option::Some(value.into());
6583        self
6584    }
6585    /// Sets `name`.
6586    pub fn name(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
6587        self.name = ::core::option::Option::Some(value.into());
6588        self
6589    }
6590}
6591
6592#[derive(Clone, Debug, PartialEq, Eq, Hash)]
6593#[non_exhaustive]
6594pub enum Result {
6595    /// `created`
6596    Created,
6597    /// `updated`
6598    Updated,
6599    /// `deleted`
6600    Deleted,
6601    /// `not_found`
6602    NotFound,
6603    /// `noop`
6604    NoOp,
6605    /// A value this version of the specification doesn't list.
6606    Raw(::std::string::String),
6607}
6608
6609impl Result {
6610    /// The value as Elasticsearch writes it.
6611    pub fn as_str(&self) -> &str {
6612        match self {
6613            Self::Created => "created",
6614            Self::Updated => "updated",
6615            Self::Deleted => "deleted",
6616            Self::NotFound => "not_found",
6617            Self::NoOp => "noop",
6618            Self::Raw(value) => value,
6619        }
6620    }
6621
6622    /// The listed value with this name, if there is one.
6623    pub fn from_known(value: &str) -> ::core::option::Option<Self> {
6624        match value {
6625            "created" => ::core::option::Option::Some(Self::Created),
6626            "updated" => ::core::option::Option::Some(Self::Updated),
6627            "deleted" => ::core::option::Option::Some(Self::Deleted),
6628            "not_found" => ::core::option::Option::Some(Self::NotFound),
6629            "noop" => ::core::option::Option::Some(Self::NoOp),
6630            _ => ::core::option::Option::None,
6631        }
6632    }
6633}
6634
6635impl ::serde::Serialize for Result {
6636    fn serialize<S__: ::serde::Serializer>(
6637        &self,
6638        serializer: S__,
6639    ) -> ::core::result::Result<S__::Ok, S__::Error> {
6640        serializer.serialize_str(self.as_str())
6641    }
6642}
6643
6644impl<'de> ::serde::Deserialize<'de> for Result {
6645    fn deserialize<D__: ::serde::Deserializer<'de>>(
6646        deserializer: D__,
6647    ) -> ::core::result::Result<Self, D__::Error> {
6648        ::oxsearch_core::__private::deserialize_string_enum(deserializer, "Result", |value| {
6649            Self::from_known(value).unwrap_or_else(|| Self::Raw(value.to_owned()))
6650        })
6651    }
6652}
6653
6654#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
6655#[non_exhaustive]
6656pub struct Retries {
6657    /// The number of bulk actions retried.
6658    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
6659    pub bulk: ::core::option::Option<i64>,
6660    /// The number of search actions retried.
6661    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
6662    pub search: ::core::option::Option<i64>,
6663}
6664
6665impl Retries {
6666    /// A `Retries` with its required properties set.
6667    pub fn new(bulk: i64, search: i64) -> Self {
6668        Self {
6669            bulk: ::core::option::Option::Some(bulk.into()),
6670            search: ::core::option::Option::Some(search.into()),
6671        }
6672    }
6673}
6674
6675impl Retries {}
6676
6677#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
6678#[non_exhaustive]
6679pub struct RetrieverBase {
6680    /// Query to filter the documents that can match.
6681    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
6682    pub filter: ::core::option::Option<
6683        ::oxsearch_core::shapes::OneOrMany<crate::query_dsl::QueryContainer>,
6684    >,
6685    /// Minimum _score for matching documents. Documents with a lower _score are not included in the top documents.
6686    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
6687    pub min_score: ::core::option::Option<f32>,
6688    /// Retriever name.
6689    #[serde(
6690        rename = "_name",
6691        skip_serializing_if = "::core::option::Option::is_none"
6692    )]
6693    pub name: ::core::option::Option<::std::string::String>,
6694}
6695
6696impl RetrieverBase {
6697    /// A `RetrieverBase` with its required properties set.
6698    pub fn new() -> Self {
6699        Self {
6700            filter: ::core::option::Option::None,
6701            min_score: ::core::option::Option::None,
6702            name: ::core::option::Option::None,
6703        }
6704    }
6705}
6706
6707impl RetrieverBase {
6708    /// Sets `filter`.
6709    pub fn filter(
6710        mut self,
6711        value: impl ::core::convert::Into<
6712            ::oxsearch_core::shapes::OneOrMany<crate::query_dsl::QueryContainer>,
6713        >,
6714    ) -> Self {
6715        self.filter = ::core::option::Option::Some(value.into());
6716        self
6717    }
6718    /// Sets `min_score`.
6719    pub fn min_score(mut self, value: f32) -> Self {
6720        self.min_score = ::core::option::Option::Some(value.into());
6721        self
6722    }
6723    /// Sets `name`.
6724    pub fn name(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
6725        self.name = ::core::option::Option::Some(value.into());
6726        self
6727    }
6728}
6729
6730#[derive(Clone, Debug, PartialEq)]
6731#[non_exhaustive]
6732pub enum RetrieverContainer {
6733    /// A retriever that replaces the functionality of a traditional query.
6734    Standard(crate::StandardRetriever),
6735    /// A retriever that replaces the functionality  of a knn search.
6736    Knn(crate::KnnRetriever),
6737    /// A retriever that produces top documents from reciprocal rank fusion (RRF).
6738    Rrf(crate::RRFRetriever),
6739    /// A retriever that reranks the top documents based on a reranking model using the InferenceAPI
6740    TextSimilarityReranker(::std::boxed::Box<crate::TextSimilarityReranker>),
6741    /// A retriever that replaces the functionality of a rule query.
6742    Rule(::std::boxed::Box<crate::RuleRetriever>),
6743    /// A retriever that re-scores only the results produced by its child retriever.
6744    Rescorer(::std::boxed::Box<crate::RescorerRetriever>),
6745    /// A retriever that supports the combination of different retrievers through a weighted linear combination.
6746    Linear(crate::LinearRetriever),
6747    /// A pinned retriever applies pinned documents to the underlying retriever.
6748    /// This retriever will rewrite to a PinnedQueryBuilder.
6749    Pinned(::std::boxed::Box<crate::PinnedRetriever>),
6750    /// A retriever that diversifies the results from its child retriever.
6751    Diversify(::std::boxed::Box<crate::DiversifyRetriever>),
6752    /// Any variant, as JSON: an object with one property.
6753    Raw(::serde_json::Value),
6754}
6755
6756impl RetrieverContainer {
6757    /// Writes the variant as one entry of a map.
6758    pub fn serialize_entry<M__: ::serde::ser::SerializeMap>(
6759        &self,
6760        map: &mut M__,
6761    ) -> ::core::result::Result<(), M__::Error> {
6762        match self {
6763            Self::Standard(value) => map.serialize_entry("standard", value),
6764            Self::Knn(value) => map.serialize_entry("knn", value),
6765            Self::Rrf(value) => map.serialize_entry("rrf", value),
6766            Self::TextSimilarityReranker(value) => {
6767                map.serialize_entry("text_similarity_reranker", value)
6768            }
6769            Self::Rule(value) => map.serialize_entry("rule", value),
6770            Self::Rescorer(value) => map.serialize_entry("rescorer", value),
6771            Self::Linear(value) => map.serialize_entry("linear", value),
6772            Self::Pinned(value) => map.serialize_entry("pinned", value),
6773            Self::Diversify(value) => map.serialize_entry("diversify", value),
6774            Self::Raw(value) => match value {
6775                ::serde_json::Value::Object(entries) => {
6776                    for (key, value) in entries {
6777                        map.serialize_entry(key, value)?;
6778                    }
6779                    ::core::result::Result::Ok(())
6780                }
6781                _ => ::core::result::Result::Err(<M__::Error as ::serde::ser::Error>::custom(
6782                    "a raw variant must be an object",
6783                )),
6784            },
6785        }
6786    }
6787}
6788
6789impl ::serde::Serialize for RetrieverContainer {
6790    fn serialize<S__: ::serde::Serializer>(
6791        &self,
6792        serializer: S__,
6793    ) -> ::core::result::Result<S__::Ok, S__::Error> {
6794        match self {
6795            Self::Standard(value) => {
6796                ::oxsearch_core::__private::serialize_variant(serializer, "standard", value)
6797            }
6798            Self::Knn(value) => {
6799                ::oxsearch_core::__private::serialize_variant(serializer, "knn", value)
6800            }
6801            Self::Rrf(value) => {
6802                ::oxsearch_core::__private::serialize_variant(serializer, "rrf", value)
6803            }
6804            Self::TextSimilarityReranker(value) => ::oxsearch_core::__private::serialize_variant(
6805                serializer,
6806                "text_similarity_reranker",
6807                value,
6808            ),
6809            Self::Rule(value) => {
6810                ::oxsearch_core::__private::serialize_variant(serializer, "rule", value)
6811            }
6812            Self::Rescorer(value) => {
6813                ::oxsearch_core::__private::serialize_variant(serializer, "rescorer", value)
6814            }
6815            Self::Linear(value) => {
6816                ::oxsearch_core::__private::serialize_variant(serializer, "linear", value)
6817            }
6818            Self::Pinned(value) => {
6819                ::oxsearch_core::__private::serialize_variant(serializer, "pinned", value)
6820            }
6821            Self::Diversify(value) => {
6822                ::oxsearch_core::__private::serialize_variant(serializer, "diversify", value)
6823            }
6824            Self::Raw(value) => ::serde::Serialize::serialize(value, serializer),
6825        }
6826    }
6827}
6828
6829impl<'de> ::serde::Deserialize<'de> for RetrieverContainer {
6830    fn deserialize<D__: ::serde::Deserializer<'de>>(
6831        deserializer: D__,
6832    ) -> ::core::result::Result<Self, D__::Error> {
6833        ::oxsearch_core::__private::deserialize_container(deserializer)
6834    }
6835}
6836
6837impl<'de> ::oxsearch_core::__private::Container<'de> for RetrieverContainer {
6838    const NAME: &'static str = "RetrieverContainer";
6839    fn variant<A__: ::serde::de::MapAccess<'de>>(
6840        key: &str,
6841        map: &mut A__,
6842    ) -> ::core::result::Result<Self, A__::Error> {
6843        ::core::result::Result::Ok(match key {
6844            "standard" => Self::Standard(map.next_value()?),
6845            "knn" => Self::Knn(map.next_value()?),
6846            "rrf" => Self::Rrf(map.next_value()?),
6847            "text_similarity_reranker" => Self::TextSimilarityReranker(map.next_value()?),
6848            "rule" => Self::Rule(map.next_value()?),
6849            "rescorer" => Self::Rescorer(map.next_value()?),
6850            "linear" => Self::Linear(map.next_value()?),
6851            "pinned" => Self::Pinned(map.next_value()?),
6852            "diversify" => Self::Diversify(map.next_value()?),
6853            _ => Self::Raw(::oxsearch_core::__private::raw_variant(
6854                key,
6855                map.next_value()?,
6856            )),
6857        })
6858    }
6859}
6860
6861impl ::core::convert::From<crate::StandardRetriever> for RetrieverContainer {
6862    fn from(value: crate::StandardRetriever) -> Self {
6863        Self::Standard(value)
6864    }
6865}
6866
6867impl ::core::convert::From<crate::KnnRetriever> for RetrieverContainer {
6868    fn from(value: crate::KnnRetriever) -> Self {
6869        Self::Knn(value)
6870    }
6871}
6872
6873impl ::core::convert::From<crate::RRFRetriever> for RetrieverContainer {
6874    fn from(value: crate::RRFRetriever) -> Self {
6875        Self::Rrf(value)
6876    }
6877}
6878
6879impl ::core::convert::From<crate::TextSimilarityReranker> for RetrieverContainer {
6880    fn from(value: crate::TextSimilarityReranker) -> Self {
6881        Self::TextSimilarityReranker(::std::boxed::Box::new(value))
6882    }
6883}
6884
6885impl ::core::convert::From<crate::RuleRetriever> for RetrieverContainer {
6886    fn from(value: crate::RuleRetriever) -> Self {
6887        Self::Rule(::std::boxed::Box::new(value))
6888    }
6889}
6890
6891impl ::core::convert::From<crate::RescorerRetriever> for RetrieverContainer {
6892    fn from(value: crate::RescorerRetriever) -> Self {
6893        Self::Rescorer(::std::boxed::Box::new(value))
6894    }
6895}
6896
6897impl ::core::convert::From<crate::LinearRetriever> for RetrieverContainer {
6898    fn from(value: crate::LinearRetriever) -> Self {
6899        Self::Linear(value)
6900    }
6901}
6902
6903impl ::core::convert::From<crate::PinnedRetriever> for RetrieverContainer {
6904    fn from(value: crate::PinnedRetriever) -> Self {
6905        Self::Pinned(::std::boxed::Box::new(value))
6906    }
6907}
6908
6909impl ::core::convert::From<crate::DiversifyRetriever> for RetrieverContainer {
6910    fn from(value: crate::DiversifyRetriever) -> Self {
6911        Self::Diversify(::std::boxed::Box::new(value))
6912    }
6913}
6914
6915/// Only to be used in query and path parameters, as the array form is actually a csv
6916pub type Routing = ::oxsearch_core::shapes::OneOrMany<::std::string::String>;
6917
6918#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
6919#[non_exhaustive]
6920pub struct RrfRank {
6921    /// How much influence documents in individual result sets per query have over the final ranked result set
6922    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
6923    pub rank_constant: ::core::option::Option<i64>,
6924    /// Size of the individual result sets per query
6925    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
6926    pub rank_window_size: ::core::option::Option<i64>,
6927}
6928
6929impl RrfRank {
6930    /// A `RrfRank` with its required properties set.
6931    pub fn new() -> Self {
6932        Self {
6933            rank_constant: ::core::option::Option::None,
6934            rank_window_size: ::core::option::Option::None,
6935        }
6936    }
6937}
6938
6939impl RrfRank {
6940    /// Sets `rank_constant`.
6941    pub fn rank_constant(mut self, value: i64) -> Self {
6942        self.rank_constant = ::core::option::Option::Some(value.into());
6943        self
6944    }
6945    /// Sets `rank_window_size`.
6946    pub fn rank_window_size(mut self, value: i64) -> Self {
6947        self.rank_window_size = ::core::option::Option::Some(value.into());
6948        self
6949    }
6950}
6951
6952#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
6953#[non_exhaustive]
6954pub struct RuleRetriever {
6955    /// Query to filter the documents that can match.
6956    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
6957    pub filter: ::core::option::Option<
6958        ::oxsearch_core::shapes::OneOrMany<crate::query_dsl::QueryContainer>,
6959    >,
6960    /// Minimum _score for matching documents. Documents with a lower _score are not included in the top documents.
6961    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
6962    pub min_score: ::core::option::Option<f32>,
6963    /// Retriever name.
6964    #[serde(
6965        rename = "_name",
6966        skip_serializing_if = "::core::option::Option::is_none"
6967    )]
6968    pub name: ::core::option::Option<::std::string::String>,
6969    /// The ruleset IDs containing the rules this retriever is evaluating against.
6970    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
6971    pub ruleset_ids: ::core::option::Option<::oxsearch_core::shapes::OneOrMany<crate::Id>>,
6972    /// The match criteria that will determine if a rule in the provided rulesets should be applied.
6973    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
6974    pub match_criteria: ::core::option::Option<::serde_json::Value>,
6975    /// The retriever whose results rules should be applied to.
6976    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
6977    pub retriever: ::core::option::Option<crate::RetrieverContainer>,
6978    /// This value determines the size of the individual result set.
6979    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
6980    pub rank_window_size: ::core::option::Option<i32>,
6981}
6982
6983impl RuleRetriever {
6984    /// A `RuleRetriever` with its required properties set.
6985    pub fn new(
6986        ruleset_ids: impl ::core::convert::Into<::oxsearch_core::shapes::OneOrMany<crate::Id>>,
6987        match_criteria: impl ::core::convert::Into<::serde_json::Value>,
6988        retriever: impl ::core::convert::Into<crate::RetrieverContainer>,
6989    ) -> Self {
6990        Self {
6991            filter: ::core::option::Option::None,
6992            min_score: ::core::option::Option::None,
6993            name: ::core::option::Option::None,
6994            ruleset_ids: ::core::option::Option::Some(ruleset_ids.into()),
6995            match_criteria: ::core::option::Option::Some(match_criteria.into()),
6996            retriever: ::core::option::Option::Some(retriever.into()),
6997            rank_window_size: ::core::option::Option::None,
6998        }
6999    }
7000}
7001
7002impl RuleRetriever {
7003    /// Sets `filter`.
7004    pub fn filter(
7005        mut self,
7006        value: impl ::core::convert::Into<
7007            ::oxsearch_core::shapes::OneOrMany<crate::query_dsl::QueryContainer>,
7008        >,
7009    ) -> Self {
7010        self.filter = ::core::option::Option::Some(value.into());
7011        self
7012    }
7013    /// Sets `min_score`.
7014    pub fn min_score(mut self, value: f32) -> Self {
7015        self.min_score = ::core::option::Option::Some(value.into());
7016        self
7017    }
7018    /// Sets `name`.
7019    pub fn name(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
7020        self.name = ::core::option::Option::Some(value.into());
7021        self
7022    }
7023    /// Sets `rank_window_size`.
7024    pub fn rank_window_size(mut self, value: i32) -> Self {
7025        self.rank_window_size = ::core::option::Option::Some(value.into());
7026        self
7027    }
7028}
7029
7030/// A scalar value.
7031#[derive(Clone, Debug, PartialEq)]
7032#[non_exhaustive]
7033pub enum ScalarValue {
7034    /// A number.
7035    Long(i64),
7036    /// A number.
7037    Double(f64),
7038    /// A string.
7039    String(::std::string::String),
7040    /// A boolean.
7041    Boolean(bool),
7042    /// A null.
7043    Null(()),
7044}
7045
7046impl ::serde::Serialize for ScalarValue {
7047    fn serialize<S__: ::serde::Serializer>(
7048        &self,
7049        serializer: S__,
7050    ) -> ::core::result::Result<S__::Ok, S__::Error> {
7051        match self {
7052            Self::Long(value) => ::serde::Serialize::serialize(value, serializer),
7053            Self::Double(value) => ::serde::Serialize::serialize(value, serializer),
7054            Self::String(value) => ::serde::Serialize::serialize(value, serializer),
7055            Self::Boolean(value) => ::serde::Serialize::serialize(value, serializer),
7056            Self::Null(value) => ::serde::Serialize::serialize(value, serializer),
7057        }
7058    }
7059}
7060
7061impl<'de> ::serde::Deserialize<'de> for ScalarValue {
7062    fn deserialize<D__: ::serde::Deserializer<'de>>(
7063        deserializer: D__,
7064    ) -> ::core::result::Result<Self, D__::Error> {
7065        struct Shape;
7066        impl<'de> ::oxsearch_core::__private::ByKind<'de> for Shape {
7067            type Value = ScalarValue;
7068            const EXPECTING: &'static str = "ScalarValue: boolean or null or number or string";
7069            fn visit<V__: ::serde::Deserializer<'de>>(
7070                self,
7071                kind: ::oxsearch_core::__private::Kind,
7072                value: V__,
7073            ) -> ::core::result::Result<Self::Value, V__::Error> {
7074                match kind {
7075                    ::oxsearch_core::__private::Kind::Null => {
7076                        <() as ::serde::Deserialize>::deserialize(value).map(ScalarValue::Null)
7077                    }
7078                    ::oxsearch_core::__private::Kind::Bool => {
7079                        <bool as ::serde::Deserialize>::deserialize(value).map(ScalarValue::Boolean)
7080                    }
7081                    ::oxsearch_core::__private::Kind::Number => {
7082                        let json: ::serde_json::Value = ::serde::Deserialize::deserialize(value)?;
7083                        if let ::core::result::Result::Ok(found) =
7084                            ::oxsearch_core::__private::from_value::<i64, V__::Error>(json.clone())
7085                        {
7086                            return ::core::result::Result::Ok(ScalarValue::Long(found));
7087                        }
7088                        ::oxsearch_core::__private::from_value(json).map(ScalarValue::Double)
7089                    }
7090                    ::oxsearch_core::__private::Kind::String => {
7091                        <::std::string::String as ::serde::Deserialize>::deserialize(value)
7092                            .map(ScalarValue::String)
7093                    }
7094                    _ => ::core::result::Result::Err(<V__::Error as ::serde::de::Error>::custom(
7095                        format_args!("ScalarValue can't be {kind:?}"),
7096                    )),
7097                }
7098            }
7099        }
7100        ::oxsearch_core::__private::deserialize_by_kind(deserializer, Shape)
7101    }
7102}
7103
7104impl ::core::convert::From<i64> for ScalarValue {
7105    fn from(value: i64) -> Self {
7106        Self::Long(value)
7107    }
7108}
7109
7110impl ::core::convert::From<f64> for ScalarValue {
7111    fn from(value: f64) -> Self {
7112        Self::Double(value)
7113    }
7114}
7115
7116impl ::core::convert::From<::std::string::String> for ScalarValue {
7117    fn from(value: ::std::string::String) -> Self {
7118        Self::String(value)
7119    }
7120}
7121
7122impl ::core::convert::From<bool> for ScalarValue {
7123    fn from(value: bool) -> Self {
7124        Self::Boolean(value)
7125    }
7126}
7127
7128impl ::core::convert::From<&str> for ScalarValue {
7129    fn from(value: &str) -> Self {
7130        Self::String(::std::borrow::ToOwned::to_owned(value))
7131    }
7132}
7133
7134#[derive(Clone, Debug, PartialEq, Eq, Hash)]
7135#[non_exhaustive]
7136pub enum ScoreNormalizer {
7137    /// `none`
7138    None,
7139    /// `minmax`
7140    Minmax,
7141    /// `l2_norm`
7142    L2Norm,
7143    /// A value this version of the specification doesn't list.
7144    Raw(::std::string::String),
7145}
7146
7147impl ScoreNormalizer {
7148    /// The value as Elasticsearch writes it.
7149    pub fn as_str(&self) -> &str {
7150        match self {
7151            Self::None => "none",
7152            Self::Minmax => "minmax",
7153            Self::L2Norm => "l2_norm",
7154            Self::Raw(value) => value,
7155        }
7156    }
7157
7158    /// The listed value with this name, if there is one.
7159    pub fn from_known(value: &str) -> ::core::option::Option<Self> {
7160        match value {
7161            "none" => ::core::option::Option::Some(Self::None),
7162            "minmax" => ::core::option::Option::Some(Self::Minmax),
7163            "l2_norm" => ::core::option::Option::Some(Self::L2Norm),
7164            _ => ::core::option::Option::None,
7165        }
7166    }
7167}
7168
7169impl ::serde::Serialize for ScoreNormalizer {
7170    fn serialize<S__: ::serde::Serializer>(
7171        &self,
7172        serializer: S__,
7173    ) -> ::core::result::Result<S__::Ok, S__::Error> {
7174        serializer.serialize_str(self.as_str())
7175    }
7176}
7177
7178impl<'de> ::serde::Deserialize<'de> for ScoreNormalizer {
7179    fn deserialize<D__: ::serde::Deserializer<'de>>(
7180        deserializer: D__,
7181    ) -> ::core::result::Result<Self, D__::Error> {
7182        ::oxsearch_core::__private::deserialize_string_enum(
7183            deserializer,
7184            "ScoreNormalizer",
7185            |value| Self::from_known(value).unwrap_or_else(|| Self::Raw(value.to_owned())),
7186        )
7187    }
7188}
7189
7190#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
7191#[non_exhaustive]
7192pub struct ScoreSort {
7193    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
7194    pub order: ::core::option::Option<crate::SortOrder>,
7195}
7196
7197impl ScoreSort {
7198    /// A `ScoreSort` with its required properties set.
7199    pub fn new() -> Self {
7200        Self {
7201            order: ::core::option::Option::None,
7202        }
7203    }
7204}
7205
7206impl ScoreSort {
7207    /// Sets `order`.
7208    pub fn order(mut self, value: impl ::core::convert::Into<crate::SortOrder>) -> Self {
7209        self.order = ::core::option::Option::Some(value.into());
7210        self
7211    }
7212}
7213
7214#[derive(Clone, Debug, PartialEq)]
7215#[non_exhaustive]
7216pub struct Script {
7217    /// The script source.
7218    pub source: ::core::option::Option<crate::ScriptSource>,
7219    /// The `id` for a stored script.
7220    pub id: ::core::option::Option<crate::Id>,
7221    /// Specifies any named parameters that are passed into the script as variables.
7222    /// Use parameters instead of hard-coded values to decrease compile time.
7223    pub params:
7224        ::core::option::Option<::indexmap::IndexMap<::std::string::String, ::serde_json::Value>>,
7225    /// Specifies the language the script is written in.
7226    pub lang: ::core::option::Option<crate::ScriptLanguage>,
7227    pub options:
7228        ::core::option::Option<::indexmap::IndexMap<::std::string::String, ::std::string::String>>,
7229}
7230
7231impl Script {
7232    /// A `Script` with its required properties set.
7233    pub fn new() -> Self {
7234        Self {
7235            source: ::core::option::Option::None,
7236            id: ::core::option::Option::None,
7237            params: ::core::option::Option::None,
7238            lang: ::core::option::Option::None,
7239            options: ::core::option::Option::None,
7240        }
7241    }
7242}
7243
7244impl Script {
7245    /// Sets `source`.
7246    pub fn source(mut self, value: impl ::core::convert::Into<crate::ScriptSource>) -> Self {
7247        self.source = ::core::option::Option::Some(value.into());
7248        self
7249    }
7250    /// Sets `id`.
7251    pub fn id(mut self, value: impl ::core::convert::Into<crate::Id>) -> Self {
7252        self.id = ::core::option::Option::Some(value.into());
7253        self
7254    }
7255    /// Sets `params`.
7256    pub fn params(
7257        mut self,
7258        value: impl ::core::convert::Into<
7259            ::indexmap::IndexMap<::std::string::String, ::serde_json::Value>,
7260        >,
7261    ) -> Self {
7262        self.params = ::core::option::Option::Some(value.into());
7263        self
7264    }
7265    /// Sets `lang`.
7266    pub fn lang(mut self, value: impl ::core::convert::Into<crate::ScriptLanguage>) -> Self {
7267        self.lang = ::core::option::Option::Some(value.into());
7268        self
7269    }
7270    /// Sets `options`.
7271    pub fn options(
7272        mut self,
7273        value: impl ::core::convert::Into<
7274            ::indexmap::IndexMap<::std::string::String, ::std::string::String>,
7275        >,
7276    ) -> Self {
7277        self.options = ::core::option::Option::Some(value.into());
7278        self
7279    }
7280}
7281
7282#[derive(::serde::Serialize, ::serde::Deserialize)]
7283#[serde(remote = "Script")]
7284struct ScriptDef {
7285    /// The script source.
7286    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
7287    source: ::core::option::Option<crate::ScriptSource>,
7288    /// The `id` for a stored script.
7289    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
7290    id: ::core::option::Option<crate::Id>,
7291    /// Specifies any named parameters that are passed into the script as variables.
7292    /// Use parameters instead of hard-coded values to decrease compile time.
7293    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
7294    params:
7295        ::core::option::Option<::indexmap::IndexMap<::std::string::String, ::serde_json::Value>>,
7296    /// Specifies the language the script is written in.
7297    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
7298    lang: ::core::option::Option<crate::ScriptLanguage>,
7299    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
7300    options:
7301        ::core::option::Option<::indexmap::IndexMap<::std::string::String, ::std::string::String>>,
7302}
7303
7304impl ::serde::Serialize for Script {
7305    fn serialize<S__: ::serde::Serializer>(
7306        &self,
7307        serializer: S__,
7308    ) -> ::core::result::Result<S__::Ok, S__::Error> {
7309        ScriptDef::serialize(self, serializer)
7310    }
7311}
7312
7313impl<'de> ::oxsearch_core::__private::Shorthand<'de> for Script {
7314    type Short = crate::ScriptSource;
7315    fn from_short(short: crate::ScriptSource) -> Self {
7316        Self {
7317            source: ::core::option::Option::Some(short),
7318            id: ::core::option::Option::None,
7319            params: ::core::option::Option::None,
7320            lang: ::core::option::Option::None,
7321            options: ::core::option::Option::None,
7322        }
7323    }
7324    fn deserialize_full<D__: ::serde::Deserializer<'de>>(
7325        deserializer: D__,
7326    ) -> ::core::result::Result<Self, D__::Error> {
7327        ScriptDef::deserialize(deserializer)
7328    }
7329}
7330
7331impl<'de> ::serde::Deserialize<'de> for Script {
7332    fn deserialize<D__: ::serde::Deserializer<'de>>(
7333        deserializer: D__,
7334    ) -> ::core::result::Result<Self, D__::Error> {
7335        ::oxsearch_core::__private::deserialize_shorthand(deserializer)
7336    }
7337}
7338
7339#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
7340#[non_exhaustive]
7341pub struct ScriptField {
7342    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
7343    pub script: ::core::option::Option<crate::Script>,
7344    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
7345    pub ignore_failure: ::core::option::Option<bool>,
7346}
7347
7348impl ScriptField {
7349    /// A `ScriptField` with its required properties set.
7350    pub fn new(script: impl ::core::convert::Into<crate::Script>) -> Self {
7351        Self {
7352            script: ::core::option::Option::Some(script.into()),
7353            ignore_failure: ::core::option::Option::None,
7354        }
7355    }
7356}
7357
7358impl ScriptField {
7359    /// Sets `ignore_failure`.
7360    pub fn ignore_failure(mut self, value: bool) -> Self {
7361        self.ignore_failure = ::core::option::Option::Some(value.into());
7362        self
7363    }
7364}
7365
7366#[derive(Clone, Debug, PartialEq, Eq, Hash)]
7367#[non_exhaustive]
7368pub enum ScriptLanguage {
7369    /// Painless scripting language, purpose-built for Elasticsearch.
7370    Painless,
7371    /// Lucene’s expressions language, compiles a JavaScript expression to bytecode.
7372    Expression,
7373    /// Mustache templated, used for templates.
7374    Mustache,
7375    /// Expert Java API
7376    Java,
7377    /// A value this version of the specification doesn't list.
7378    Raw(::std::string::String),
7379}
7380
7381impl ScriptLanguage {
7382    /// The value as Elasticsearch writes it.
7383    pub fn as_str(&self) -> &str {
7384        match self {
7385            Self::Painless => "painless",
7386            Self::Expression => "expression",
7387            Self::Mustache => "mustache",
7388            Self::Java => "java",
7389            Self::Raw(value) => value,
7390        }
7391    }
7392
7393    /// The listed value with this name, if there is one.
7394    pub fn from_known(value: &str) -> ::core::option::Option<Self> {
7395        match value {
7396            "painless" => ::core::option::Option::Some(Self::Painless),
7397            "expression" => ::core::option::Option::Some(Self::Expression),
7398            "mustache" => ::core::option::Option::Some(Self::Mustache),
7399            "java" => ::core::option::Option::Some(Self::Java),
7400            _ => ::core::option::Option::None,
7401        }
7402    }
7403}
7404
7405impl ::serde::Serialize for ScriptLanguage {
7406    fn serialize<S__: ::serde::Serializer>(
7407        &self,
7408        serializer: S__,
7409    ) -> ::core::result::Result<S__::Ok, S__::Error> {
7410        serializer.serialize_str(self.as_str())
7411    }
7412}
7413
7414impl<'de> ::serde::Deserialize<'de> for ScriptLanguage {
7415    fn deserialize<D__: ::serde::Deserializer<'de>>(
7416        deserializer: D__,
7417    ) -> ::core::result::Result<Self, D__::Error> {
7418        ::oxsearch_core::__private::deserialize_string_enum(
7419            deserializer,
7420            "ScriptLanguage",
7421            |value| Self::from_known(value).unwrap_or_else(|| Self::Raw(value.to_owned())),
7422        )
7423    }
7424}
7425
7426#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
7427#[non_exhaustive]
7428pub struct ScriptSort {
7429    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
7430    pub order: ::core::option::Option<crate::SortOrder>,
7431    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
7432    pub script: ::core::option::Option<crate::Script>,
7433    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
7434    pub r#type: ::core::option::Option<crate::ScriptSortType>,
7435    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
7436    pub mode: ::core::option::Option<crate::SortMode>,
7437    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
7438    pub nested: ::core::option::Option<crate::NestedSortValue>,
7439}
7440
7441impl ScriptSort {
7442    /// A `ScriptSort` with its required properties set.
7443    pub fn new(script: impl ::core::convert::Into<crate::Script>) -> Self {
7444        Self {
7445            order: ::core::option::Option::None,
7446            script: ::core::option::Option::Some(script.into()),
7447            r#type: ::core::option::Option::None,
7448            mode: ::core::option::Option::None,
7449            nested: ::core::option::Option::None,
7450        }
7451    }
7452}
7453
7454impl ScriptSort {
7455    /// Sets `order`.
7456    pub fn order(mut self, value: impl ::core::convert::Into<crate::SortOrder>) -> Self {
7457        self.order = ::core::option::Option::Some(value.into());
7458        self
7459    }
7460    /// Sets `type`.
7461    pub fn r#type(mut self, value: impl ::core::convert::Into<crate::ScriptSortType>) -> Self {
7462        self.r#type = ::core::option::Option::Some(value.into());
7463        self
7464    }
7465    /// Sets `mode`.
7466    pub fn mode(mut self, value: impl ::core::convert::Into<crate::SortMode>) -> Self {
7467        self.mode = ::core::option::Option::Some(value.into());
7468        self
7469    }
7470    /// Sets `nested`.
7471    pub fn nested(mut self, value: impl ::core::convert::Into<crate::NestedSortValue>) -> Self {
7472        self.nested = ::core::option::Option::Some(value.into());
7473        self
7474    }
7475}
7476
7477#[derive(Clone, Debug, PartialEq, Eq, Hash)]
7478#[non_exhaustive]
7479pub enum ScriptSortType {
7480    /// `string`
7481    String,
7482    /// `number`
7483    Number,
7484    /// `version`
7485    Version,
7486    /// A value this version of the specification doesn't list.
7487    Raw(::std::string::String),
7488}
7489
7490impl ScriptSortType {
7491    /// The value as Elasticsearch writes it.
7492    pub fn as_str(&self) -> &str {
7493        match self {
7494            Self::String => "string",
7495            Self::Number => "number",
7496            Self::Version => "version",
7497            Self::Raw(value) => value,
7498        }
7499    }
7500
7501    /// The listed value with this name, if there is one.
7502    pub fn from_known(value: &str) -> ::core::option::Option<Self> {
7503        match value {
7504            "string" => ::core::option::Option::Some(Self::String),
7505            "number" => ::core::option::Option::Some(Self::Number),
7506            "version" => ::core::option::Option::Some(Self::Version),
7507            _ => ::core::option::Option::None,
7508        }
7509    }
7510}
7511
7512impl ::serde::Serialize for ScriptSortType {
7513    fn serialize<S__: ::serde::Serializer>(
7514        &self,
7515        serializer: S__,
7516    ) -> ::core::result::Result<S__::Ok, S__::Error> {
7517        serializer.serialize_str(self.as_str())
7518    }
7519}
7520
7521impl<'de> ::serde::Deserialize<'de> for ScriptSortType {
7522    fn deserialize<D__: ::serde::Deserializer<'de>>(
7523        deserializer: D__,
7524    ) -> ::core::result::Result<Self, D__::Error> {
7525        ::oxsearch_core::__private::deserialize_string_enum(
7526            deserializer,
7527            "ScriptSortType",
7528            |value| Self::from_known(value).unwrap_or_else(|| Self::Raw(value.to_owned())),
7529        )
7530    }
7531}
7532
7533#[derive(Clone, Debug, PartialEq)]
7534#[non_exhaustive]
7535pub enum ScriptSource {
7536    /// A string.
7537    ScriptString(::std::string::String),
7538    /// A value of any kind.
7539    ScriptTemplate(::serde_json::Value),
7540}
7541
7542impl ::serde::Serialize for ScriptSource {
7543    fn serialize<S__: ::serde::Serializer>(
7544        &self,
7545        serializer: S__,
7546    ) -> ::core::result::Result<S__::Ok, S__::Error> {
7547        match self {
7548            Self::ScriptString(value) => ::serde::Serialize::serialize(value, serializer),
7549            Self::ScriptTemplate(value) => ::serde::Serialize::serialize(value, serializer),
7550        }
7551    }
7552}
7553
7554impl<'de> ::serde::Deserialize<'de> for ScriptSource {
7555    fn deserialize<D__: ::serde::Deserializer<'de>>(
7556        deserializer: D__,
7557    ) -> ::core::result::Result<Self, D__::Error> {
7558        struct Shape;
7559        impl<'de> ::oxsearch_core::__private::ByKind<'de> for Shape {
7560            type Value = ScriptSource;
7561            const EXPECTING: &'static str = "ScriptSource: string or value of any kind";
7562            fn visit<V__: ::serde::Deserializer<'de>>(
7563                self,
7564                kind: ::oxsearch_core::__private::Kind,
7565                value: V__,
7566            ) -> ::core::result::Result<Self::Value, V__::Error> {
7567                match kind {
7568                    ::oxsearch_core::__private::Kind::Null => {
7569                        <::serde_json::Value as ::serde::Deserialize>::deserialize(value)
7570                            .map(ScriptSource::ScriptTemplate)
7571                    }
7572                    ::oxsearch_core::__private::Kind::Bool => {
7573                        <::serde_json::Value as ::serde::Deserialize>::deserialize(value)
7574                            .map(ScriptSource::ScriptTemplate)
7575                    }
7576                    ::oxsearch_core::__private::Kind::Number => {
7577                        <::serde_json::Value as ::serde::Deserialize>::deserialize(value)
7578                            .map(ScriptSource::ScriptTemplate)
7579                    }
7580                    ::oxsearch_core::__private::Kind::String => {
7581                        let json: ::serde_json::Value = ::serde::Deserialize::deserialize(value)?;
7582                        if let ::core::result::Result::Ok(found) =
7583                            ::oxsearch_core::__private::from_value::<
7584                                ::std::string::String,
7585                                V__::Error,
7586                            >(json.clone())
7587                        {
7588                            return ::core::result::Result::Ok(ScriptSource::ScriptString(found));
7589                        }
7590                        ::oxsearch_core::__private::from_value(json)
7591                            .map(ScriptSource::ScriptTemplate)
7592                    }
7593                    ::oxsearch_core::__private::Kind::Array => {
7594                        <::serde_json::Value as ::serde::Deserialize>::deserialize(value)
7595                            .map(ScriptSource::ScriptTemplate)
7596                    }
7597                    ::oxsearch_core::__private::Kind::Object => {
7598                        <::serde_json::Value as ::serde::Deserialize>::deserialize(value)
7599                            .map(ScriptSource::ScriptTemplate)
7600                    }
7601                }
7602            }
7603        }
7604        ::oxsearch_core::__private::deserialize_by_kind(deserializer, Shape)
7605    }
7606}
7607
7608impl ::core::convert::From<::std::string::String> for ScriptSource {
7609    fn from(value: ::std::string::String) -> Self {
7610        Self::ScriptString(value)
7611    }
7612}
7613
7614impl ::core::convert::From<::serde_json::Value> for ScriptSource {
7615    fn from(value: ::serde_json::Value) -> Self {
7616        Self::ScriptTemplate(value)
7617    }
7618}
7619
7620impl ::core::convert::From<&str> for ScriptSource {
7621    fn from(value: &str) -> Self {
7622        Self::ScriptString(::std::borrow::ToOwned::to_owned(value))
7623    }
7624}
7625
7626#[derive(Clone, Debug, PartialEq)]
7627#[non_exhaustive]
7628pub struct ScriptTransform {
7629    pub lang: ::core::option::Option<::std::string::String>,
7630    pub params:
7631        ::core::option::Option<::indexmap::IndexMap<::std::string::String, ::serde_json::Value>>,
7632    pub source: ::core::option::Option<crate::ScriptSource>,
7633    pub id: ::core::option::Option<::std::string::String>,
7634}
7635
7636impl ScriptTransform {
7637    /// A `ScriptTransform` with its required properties set.
7638    pub fn new() -> Self {
7639        Self {
7640            lang: ::core::option::Option::None,
7641            params: ::core::option::Option::None,
7642            source: ::core::option::Option::None,
7643            id: ::core::option::Option::None,
7644        }
7645    }
7646}
7647
7648impl ScriptTransform {
7649    /// Sets `lang`.
7650    pub fn lang(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
7651        self.lang = ::core::option::Option::Some(value.into());
7652        self
7653    }
7654    /// Sets `params`.
7655    pub fn params(
7656        mut self,
7657        value: impl ::core::convert::Into<
7658            ::indexmap::IndexMap<::std::string::String, ::serde_json::Value>,
7659        >,
7660    ) -> Self {
7661        self.params = ::core::option::Option::Some(value.into());
7662        self
7663    }
7664    /// Sets `source`.
7665    pub fn source(mut self, value: impl ::core::convert::Into<crate::ScriptSource>) -> Self {
7666        self.source = ::core::option::Option::Some(value.into());
7667        self
7668    }
7669    /// Sets `id`.
7670    pub fn id(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
7671        self.id = ::core::option::Option::Some(value.into());
7672        self
7673    }
7674}
7675
7676#[derive(::serde::Serialize, ::serde::Deserialize)]
7677#[serde(remote = "ScriptTransform")]
7678struct ScriptTransformDef {
7679    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
7680    lang: ::core::option::Option<::std::string::String>,
7681    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
7682    params:
7683        ::core::option::Option<::indexmap::IndexMap<::std::string::String, ::serde_json::Value>>,
7684    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
7685    source: ::core::option::Option<crate::ScriptSource>,
7686    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
7687    id: ::core::option::Option<::std::string::String>,
7688}
7689
7690impl ::serde::Serialize for ScriptTransform {
7691    fn serialize<S__: ::serde::Serializer>(
7692        &self,
7693        serializer: S__,
7694    ) -> ::core::result::Result<S__::Ok, S__::Error> {
7695        ScriptTransformDef::serialize(self, serializer)
7696    }
7697}
7698
7699impl<'de> ::oxsearch_core::__private::Shorthand<'de> for ScriptTransform {
7700    type Short = crate::ScriptSource;
7701    fn from_short(short: crate::ScriptSource) -> Self {
7702        Self {
7703            lang: ::core::option::Option::None,
7704            params: ::core::option::Option::None,
7705            source: ::core::option::Option::Some(short),
7706            id: ::core::option::Option::None,
7707        }
7708    }
7709    fn deserialize_full<D__: ::serde::Deserializer<'de>>(
7710        deserializer: D__,
7711    ) -> ::core::result::Result<Self, D__::Error> {
7712        ScriptTransformDef::deserialize(deserializer)
7713    }
7714}
7715
7716impl<'de> ::serde::Deserialize<'de> for ScriptTransform {
7717    fn deserialize<D__: ::serde::Deserializer<'de>>(
7718        deserializer: D__,
7719    ) -> ::core::result::Result<Self, D__::Error> {
7720        ::oxsearch_core::__private::deserialize_shorthand(deserializer)
7721    }
7722}
7723
7724pub type ScrollId = ::std::string::String;
7725
7726pub type ScrollIds = ::oxsearch_core::shapes::OneOrMany<crate::ScrollId>;
7727
7728#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
7729#[non_exhaustive]
7730pub struct SearchStats {
7731    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
7732    pub fetch_current: ::core::option::Option<i64>,
7733    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
7734    pub fetch_time: ::core::option::Option<crate::Duration>,
7735    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
7736    pub fetch_time_in_millis: ::core::option::Option<crate::UnitMillis>,
7737    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
7738    pub fetch_total: ::core::option::Option<i64>,
7739    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
7740    pub fetch_failure: ::core::option::Option<i64>,
7741    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
7742    pub open_contexts: ::core::option::Option<i64>,
7743    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
7744    pub query_current: ::core::option::Option<i64>,
7745    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
7746    pub query_time: ::core::option::Option<crate::Duration>,
7747    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
7748    pub query_time_in_millis: ::core::option::Option<crate::UnitMillis>,
7749    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
7750    pub query_total: ::core::option::Option<i64>,
7751    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
7752    pub query_failure: ::core::option::Option<i64>,
7753    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
7754    pub scroll_current: ::core::option::Option<i64>,
7755    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
7756    pub scroll_time: ::core::option::Option<crate::Duration>,
7757    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
7758    pub scroll_time_in_millis: ::core::option::Option<crate::UnitMillis>,
7759    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
7760    pub scroll_total: ::core::option::Option<i64>,
7761    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
7762    pub suggest_current: ::core::option::Option<i64>,
7763    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
7764    pub suggest_time: ::core::option::Option<crate::Duration>,
7765    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
7766    pub suggest_time_in_millis: ::core::option::Option<crate::UnitMillis>,
7767    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
7768    pub suggest_total: ::core::option::Option<i64>,
7769    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
7770    pub recent_search_load: ::core::option::Option<f64>,
7771    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
7772    pub groups:
7773        ::core::option::Option<::indexmap::IndexMap<::std::string::String, crate::SearchStats>>,
7774}
7775
7776impl SearchStats {
7777    /// A `SearchStats` with its required properties set.
7778    pub fn new(
7779        fetch_current: i64,
7780        fetch_time_in_millis: impl ::core::convert::Into<crate::UnitMillis>,
7781        fetch_total: i64,
7782        fetch_failure: i64,
7783        query_current: i64,
7784        query_time_in_millis: impl ::core::convert::Into<crate::UnitMillis>,
7785        query_total: i64,
7786        query_failure: i64,
7787        scroll_current: i64,
7788        scroll_time_in_millis: impl ::core::convert::Into<crate::UnitMillis>,
7789        scroll_total: i64,
7790        suggest_current: i64,
7791        suggest_time_in_millis: impl ::core::convert::Into<crate::UnitMillis>,
7792        suggest_total: i64,
7793    ) -> Self {
7794        Self {
7795            fetch_current: ::core::option::Option::Some(fetch_current.into()),
7796            fetch_time: ::core::option::Option::None,
7797            fetch_time_in_millis: ::core::option::Option::Some(fetch_time_in_millis.into()),
7798            fetch_total: ::core::option::Option::Some(fetch_total.into()),
7799            fetch_failure: ::core::option::Option::Some(fetch_failure.into()),
7800            open_contexts: ::core::option::Option::None,
7801            query_current: ::core::option::Option::Some(query_current.into()),
7802            query_time: ::core::option::Option::None,
7803            query_time_in_millis: ::core::option::Option::Some(query_time_in_millis.into()),
7804            query_total: ::core::option::Option::Some(query_total.into()),
7805            query_failure: ::core::option::Option::Some(query_failure.into()),
7806            scroll_current: ::core::option::Option::Some(scroll_current.into()),
7807            scroll_time: ::core::option::Option::None,
7808            scroll_time_in_millis: ::core::option::Option::Some(scroll_time_in_millis.into()),
7809            scroll_total: ::core::option::Option::Some(scroll_total.into()),
7810            suggest_current: ::core::option::Option::Some(suggest_current.into()),
7811            suggest_time: ::core::option::Option::None,
7812            suggest_time_in_millis: ::core::option::Option::Some(suggest_time_in_millis.into()),
7813            suggest_total: ::core::option::Option::Some(suggest_total.into()),
7814            recent_search_load: ::core::option::Option::None,
7815            groups: ::core::option::Option::None,
7816        }
7817    }
7818}
7819
7820impl SearchStats {
7821    /// Sets `fetch_time`.
7822    pub fn fetch_time(mut self, value: impl ::core::convert::Into<crate::Duration>) -> Self {
7823        self.fetch_time = ::core::option::Option::Some(value.into());
7824        self
7825    }
7826    /// Sets `open_contexts`.
7827    pub fn open_contexts(mut self, value: i64) -> Self {
7828        self.open_contexts = ::core::option::Option::Some(value.into());
7829        self
7830    }
7831    /// Sets `query_time`.
7832    pub fn query_time(mut self, value: impl ::core::convert::Into<crate::Duration>) -> Self {
7833        self.query_time = ::core::option::Option::Some(value.into());
7834        self
7835    }
7836    /// Sets `scroll_time`.
7837    pub fn scroll_time(mut self, value: impl ::core::convert::Into<crate::Duration>) -> Self {
7838        self.scroll_time = ::core::option::Option::Some(value.into());
7839        self
7840    }
7841    /// Sets `suggest_time`.
7842    pub fn suggest_time(mut self, value: impl ::core::convert::Into<crate::Duration>) -> Self {
7843        self.suggest_time = ::core::option::Option::Some(value.into());
7844        self
7845    }
7846    /// Sets `recent_search_load`.
7847    pub fn recent_search_load(mut self, value: f64) -> Self {
7848        self.recent_search_load = ::core::option::Option::Some(value.into());
7849        self
7850    }
7851    /// Sets `groups`.
7852    pub fn groups(
7853        mut self,
7854        value: impl ::core::convert::Into<
7855            ::indexmap::IndexMap<::std::string::String, crate::SearchStats>,
7856        >,
7857    ) -> Self {
7858        self.groups = ::core::option::Option::Some(value.into());
7859        self
7860    }
7861}
7862
7863#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
7864#[non_exhaustive]
7865pub struct SearchTransform {
7866    pub request: ::serde_json::Value,
7867    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
7868    pub timeout: ::core::option::Option<crate::Duration>,
7869}
7870
7871impl SearchTransform {
7872    /// A `SearchTransform` with its required properties set.
7873    pub fn new(request: impl ::core::convert::Into<::serde_json::Value>) -> Self {
7874        Self {
7875            request: request.into(),
7876            timeout: ::core::option::Option::None,
7877        }
7878    }
7879}
7880
7881impl SearchTransform {
7882    /// Sets `timeout`.
7883    pub fn timeout(mut self, value: impl ::core::convert::Into<crate::Duration>) -> Self {
7884        self.timeout = ::core::option::Option::Some(value.into());
7885        self
7886    }
7887}
7888
7889#[derive(Clone, Debug, PartialEq, Eq, Hash)]
7890#[non_exhaustive]
7891pub enum SearchType {
7892    /// Documents are scored using local term and document frequencies for the shard. This is usually faster but less accurate.
7893    QueryThenFetch,
7894    /// Documents are scored using global term and document frequencies across all shards. This is usually slower but more accurate.
7895    DfsQueryThenFetch,
7896    /// A value this version of the specification doesn't list.
7897    Raw(::std::string::String),
7898}
7899
7900impl SearchType {
7901    /// The value as Elasticsearch writes it.
7902    pub fn as_str(&self) -> &str {
7903        match self {
7904            Self::QueryThenFetch => "query_then_fetch",
7905            Self::DfsQueryThenFetch => "dfs_query_then_fetch",
7906            Self::Raw(value) => value,
7907        }
7908    }
7909
7910    /// The listed value with this name, if there is one.
7911    pub fn from_known(value: &str) -> ::core::option::Option<Self> {
7912        match value {
7913            "query_then_fetch" => ::core::option::Option::Some(Self::QueryThenFetch),
7914            "dfs_query_then_fetch" => ::core::option::Option::Some(Self::DfsQueryThenFetch),
7915            _ => ::core::option::Option::None,
7916        }
7917    }
7918}
7919
7920impl ::serde::Serialize for SearchType {
7921    fn serialize<S__: ::serde::Serializer>(
7922        &self,
7923        serializer: S__,
7924    ) -> ::core::result::Result<S__::Ok, S__::Error> {
7925        serializer.serialize_str(self.as_str())
7926    }
7927}
7928
7929impl<'de> ::serde::Deserialize<'de> for SearchType {
7930    fn deserialize<D__: ::serde::Deserializer<'de>>(
7931        deserializer: D__,
7932    ) -> ::core::result::Result<Self, D__::Error> {
7933        ::oxsearch_core::__private::deserialize_string_enum(deserializer, "SearchType", |value| {
7934            Self::from_known(value).unwrap_or_else(|| Self::Raw(value.to_owned()))
7935        })
7936    }
7937}
7938
7939#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
7940#[non_exhaustive]
7941pub struct SegmentsStats {
7942    /// Total number of segments across all shards assigned to selected nodes.
7943    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
7944    pub count: ::core::option::Option<i32>,
7945    /// Total amount of memory used for doc values across all shards assigned to selected nodes.
7946    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
7947    pub doc_values_memory: ::core::option::Option<crate::ByteSize>,
7948    /// Total amount, in bytes, of memory used for doc values across all shards assigned to selected nodes.
7949    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
7950    pub doc_values_memory_in_bytes: ::core::option::Option<i64>,
7951    /// This object is not populated by the cluster stats API.
7952    /// To get information on segment files, use the node stats API.
7953    #[serde(default = "::core::default::Default::default")]
7954    pub file_sizes:
7955        ::indexmap::IndexMap<::std::string::String, crate::indices::stats::ShardFileSizeInfo>,
7956    /// Total amount of memory used by fixed bit sets across all shards assigned to selected nodes.
7957    /// Fixed bit sets are used for nested object field types and type filters for join fields.
7958    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
7959    pub fixed_bit_set: ::core::option::Option<crate::ByteSize>,
7960    /// Total amount of memory, in bytes, used by fixed bit sets across all shards assigned to selected nodes.
7961    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
7962    pub fixed_bit_set_memory_in_bytes: ::core::option::Option<i64>,
7963    /// Total amount of memory used by all index writers across all shards assigned to selected nodes.
7964    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
7965    pub index_writer_memory: ::core::option::Option<crate::ByteSize>,
7966    /// Total amount, in bytes, of memory used by all index writers across all shards assigned to selected nodes.
7967    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
7968    pub index_writer_memory_in_bytes: ::core::option::Option<i64>,
7969    /// Unix timestamp, in milliseconds, of the most recently retried indexing request.
7970    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
7971    pub max_unsafe_auto_id_timestamp: ::core::option::Option<i64>,
7972    /// Total amount of memory used for segments across all shards assigned to selected nodes.
7973    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
7974    pub memory: ::core::option::Option<crate::ByteSize>,
7975    /// Total amount, in bytes, of memory used for segments across all shards assigned to selected nodes.
7976    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
7977    pub memory_in_bytes: ::core::option::Option<i64>,
7978    /// Total amount of memory used for normalization factors across all shards assigned to selected nodes.
7979    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
7980    pub norms_memory: ::core::option::Option<crate::ByteSize>,
7981    /// Total amount, in bytes, of memory used for normalization factors across all shards assigned to selected nodes.
7982    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
7983    pub norms_memory_in_bytes: ::core::option::Option<i64>,
7984    /// Total amount of memory used for points across all shards assigned to selected nodes.
7985    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
7986    pub points_memory: ::core::option::Option<crate::ByteSize>,
7987    /// Total amount, in bytes, of memory used for points across all shards assigned to selected nodes.
7988    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
7989    pub points_memory_in_bytes: ::core::option::Option<i64>,
7990    /// Total amount, in bytes, of memory used for stored fields across all shards assigned to selected nodes.
7991    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
7992    pub stored_fields_memory_in_bytes: ::core::option::Option<i64>,
7993    /// Total amount of memory used for stored fields across all shards assigned to selected nodes.
7994    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
7995    pub stored_fields_memory: ::core::option::Option<crate::ByteSize>,
7996    /// Total amount, in bytes, of memory used for terms across all shards assigned to selected nodes.
7997    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
7998    pub terms_memory_in_bytes: ::core::option::Option<i64>,
7999    /// Total amount of memory used for terms across all shards assigned to selected nodes.
8000    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
8001    pub terms_memory: ::core::option::Option<crate::ByteSize>,
8002    /// Total amount of memory used for term vectors across all shards assigned to selected nodes.
8003    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
8004    pub term_vectors_memory: ::core::option::Option<crate::ByteSize>,
8005    /// Total amount, in bytes, of memory used for term vectors across all shards assigned to selected nodes.
8006    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
8007    pub term_vectors_memory_in_bytes: ::core::option::Option<i64>,
8008    /// Total amount of memory used by all version maps across all shards assigned to selected nodes.
8009    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
8010    pub version_map_memory: ::core::option::Option<crate::ByteSize>,
8011    /// Total amount, in bytes, of memory used by all version maps across all shards assigned to selected nodes.
8012    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
8013    pub version_map_memory_in_bytes: ::core::option::Option<i64>,
8014}
8015
8016impl SegmentsStats {
8017    /// A `SegmentsStats` with its required properties set.
8018    pub fn new(
8019        count: i32,
8020        doc_values_memory_in_bytes: i64,
8021        file_sizes: impl ::core::convert::Into<
8022            ::indexmap::IndexMap<::std::string::String, crate::indices::stats::ShardFileSizeInfo>,
8023        >,
8024        fixed_bit_set_memory_in_bytes: i64,
8025        index_writer_memory_in_bytes: i64,
8026        max_unsafe_auto_id_timestamp: i64,
8027        memory_in_bytes: i64,
8028        norms_memory_in_bytes: i64,
8029        points_memory_in_bytes: i64,
8030        stored_fields_memory_in_bytes: i64,
8031        terms_memory_in_bytes: i64,
8032        term_vectors_memory_in_bytes: i64,
8033        version_map_memory_in_bytes: i64,
8034    ) -> Self {
8035        Self {
8036            count: ::core::option::Option::Some(count.into()),
8037            doc_values_memory: ::core::option::Option::None,
8038            doc_values_memory_in_bytes: ::core::option::Option::Some(
8039                doc_values_memory_in_bytes.into(),
8040            ),
8041            file_sizes: file_sizes.into(),
8042            fixed_bit_set: ::core::option::Option::None,
8043            fixed_bit_set_memory_in_bytes: ::core::option::Option::Some(
8044                fixed_bit_set_memory_in_bytes.into(),
8045            ),
8046            index_writer_memory: ::core::option::Option::None,
8047            index_writer_memory_in_bytes: ::core::option::Option::Some(
8048                index_writer_memory_in_bytes.into(),
8049            ),
8050            max_unsafe_auto_id_timestamp: ::core::option::Option::Some(
8051                max_unsafe_auto_id_timestamp.into(),
8052            ),
8053            memory: ::core::option::Option::None,
8054            memory_in_bytes: ::core::option::Option::Some(memory_in_bytes.into()),
8055            norms_memory: ::core::option::Option::None,
8056            norms_memory_in_bytes: ::core::option::Option::Some(norms_memory_in_bytes.into()),
8057            points_memory: ::core::option::Option::None,
8058            points_memory_in_bytes: ::core::option::Option::Some(points_memory_in_bytes.into()),
8059            stored_fields_memory_in_bytes: ::core::option::Option::Some(
8060                stored_fields_memory_in_bytes.into(),
8061            ),
8062            stored_fields_memory: ::core::option::Option::None,
8063            terms_memory_in_bytes: ::core::option::Option::Some(terms_memory_in_bytes.into()),
8064            terms_memory: ::core::option::Option::None,
8065            term_vectors_memory: ::core::option::Option::None,
8066            term_vectors_memory_in_bytes: ::core::option::Option::Some(
8067                term_vectors_memory_in_bytes.into(),
8068            ),
8069            version_map_memory: ::core::option::Option::None,
8070            version_map_memory_in_bytes: ::core::option::Option::Some(
8071                version_map_memory_in_bytes.into(),
8072            ),
8073        }
8074    }
8075}
8076
8077impl SegmentsStats {
8078    /// Sets `doc_values_memory`.
8079    pub fn doc_values_memory(mut self, value: impl ::core::convert::Into<crate::ByteSize>) -> Self {
8080        self.doc_values_memory = ::core::option::Option::Some(value.into());
8081        self
8082    }
8083    /// Sets `fixed_bit_set`.
8084    pub fn fixed_bit_set(mut self, value: impl ::core::convert::Into<crate::ByteSize>) -> Self {
8085        self.fixed_bit_set = ::core::option::Option::Some(value.into());
8086        self
8087    }
8088    /// Sets `index_writer_memory`.
8089    pub fn index_writer_memory(
8090        mut self,
8091        value: impl ::core::convert::Into<crate::ByteSize>,
8092    ) -> Self {
8093        self.index_writer_memory = ::core::option::Option::Some(value.into());
8094        self
8095    }
8096    /// Sets `memory`.
8097    pub fn memory(mut self, value: impl ::core::convert::Into<crate::ByteSize>) -> Self {
8098        self.memory = ::core::option::Option::Some(value.into());
8099        self
8100    }
8101    /// Sets `norms_memory`.
8102    pub fn norms_memory(mut self, value: impl ::core::convert::Into<crate::ByteSize>) -> Self {
8103        self.norms_memory = ::core::option::Option::Some(value.into());
8104        self
8105    }
8106    /// Sets `points_memory`.
8107    pub fn points_memory(mut self, value: impl ::core::convert::Into<crate::ByteSize>) -> Self {
8108        self.points_memory = ::core::option::Option::Some(value.into());
8109        self
8110    }
8111    /// Sets `stored_fields_memory`.
8112    pub fn stored_fields_memory(
8113        mut self,
8114        value: impl ::core::convert::Into<crate::ByteSize>,
8115    ) -> Self {
8116        self.stored_fields_memory = ::core::option::Option::Some(value.into());
8117        self
8118    }
8119    /// Sets `terms_memory`.
8120    pub fn terms_memory(mut self, value: impl ::core::convert::Into<crate::ByteSize>) -> Self {
8121        self.terms_memory = ::core::option::Option::Some(value.into());
8122        self
8123    }
8124    /// Sets `term_vectors_memory`.
8125    pub fn term_vectors_memory(
8126        mut self,
8127        value: impl ::core::convert::Into<crate::ByteSize>,
8128    ) -> Self {
8129        self.term_vectors_memory = ::core::option::Option::Some(value.into());
8130        self
8131    }
8132    /// Sets `version_map_memory`.
8133    pub fn version_map_memory(
8134        mut self,
8135        value: impl ::core::convert::Into<crate::ByteSize>,
8136    ) -> Self {
8137        self.version_map_memory = ::core::option::Option::Some(value.into());
8138        self
8139    }
8140}
8141
8142pub type SequenceNumber = i64;
8143
8144pub type Service = ::std::string::String;
8145
8146#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
8147#[non_exhaustive]
8148pub struct ShardFailure {
8149    #[serde(
8150        alias = "_index",
8151        skip_serializing_if = "::core::option::Option::is_none"
8152    )]
8153    pub index: ::core::option::Option<crate::IndexName>,
8154    #[serde(
8155        alias = "_node",
8156        skip_serializing_if = "::core::option::Option::is_none"
8157    )]
8158    pub node: ::core::option::Option<::std::string::String>,
8159    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
8160    pub reason: ::core::option::Option<crate::ErrorCause>,
8161    #[serde(
8162        alias = "_shard",
8163        skip_serializing_if = "::core::option::Option::is_none"
8164    )]
8165    pub shard: ::core::option::Option<i32>,
8166    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
8167    pub status: ::core::option::Option<::std::string::String>,
8168    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
8169    pub primary: ::core::option::Option<bool>,
8170}
8171
8172impl ShardFailure {
8173    /// A `ShardFailure` with its required properties set.
8174    pub fn new(reason: impl ::core::convert::Into<crate::ErrorCause>) -> Self {
8175        Self {
8176            index: ::core::option::Option::None,
8177            node: ::core::option::Option::None,
8178            reason: ::core::option::Option::Some(reason.into()),
8179            shard: ::core::option::Option::None,
8180            status: ::core::option::Option::None,
8181            primary: ::core::option::Option::None,
8182        }
8183    }
8184}
8185
8186impl ShardFailure {
8187    /// Sets `index`.
8188    pub fn index(mut self, value: impl ::core::convert::Into<crate::IndexName>) -> Self {
8189        self.index = ::core::option::Option::Some(value.into());
8190        self
8191    }
8192    /// Sets `node`.
8193    pub fn node(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
8194        self.node = ::core::option::Option::Some(value.into());
8195        self
8196    }
8197    /// Sets `shard`.
8198    pub fn shard(mut self, value: i32) -> Self {
8199        self.shard = ::core::option::Option::Some(value.into());
8200        self
8201    }
8202    /// Sets `status`.
8203    pub fn status(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
8204        self.status = ::core::option::Option::Some(value.into());
8205        self
8206    }
8207    /// Sets `primary`.
8208    pub fn primary(mut self, value: bool) -> Self {
8209        self.primary = ::core::option::Option::Some(value.into());
8210        self
8211    }
8212}
8213
8214#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
8215#[non_exhaustive]
8216pub struct ShardStatistics {
8217    /// The number of shards the operation or search attempted to run on but failed.
8218    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
8219    pub failed: ::core::option::Option<u32>,
8220    /// The number of shards the operation or search succeeded on.
8221    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
8222    pub successful: ::core::option::Option<u32>,
8223    /// The number of shards the operation or search will run on overall.
8224    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
8225    pub total: ::core::option::Option<u32>,
8226    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
8227    pub failures: ::core::option::Option<::std::vec::Vec<crate::ShardFailure>>,
8228    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
8229    pub skipped: ::core::option::Option<u32>,
8230}
8231
8232impl ShardStatistics {
8233    /// A `ShardStatistics` with its required properties set.
8234    pub fn new(failed: u32, successful: u32, total: u32) -> Self {
8235        Self {
8236            failed: ::core::option::Option::Some(failed.into()),
8237            successful: ::core::option::Option::Some(successful.into()),
8238            total: ::core::option::Option::Some(total.into()),
8239            failures: ::core::option::Option::None,
8240            skipped: ::core::option::Option::None,
8241        }
8242    }
8243}
8244
8245impl ShardStatistics {
8246    /// Sets `failures`.
8247    pub fn failures(
8248        mut self,
8249        value: impl ::core::convert::Into<::std::vec::Vec<crate::ShardFailure>>,
8250    ) -> Self {
8251        self.failures = ::core::option::Option::Some(value.into());
8252        self
8253    }
8254    /// Sets `skipped`.
8255    pub fn skipped(mut self, value: u32) -> Self {
8256        self.skipped = ::core::option::Option::Some(value.into());
8257        self
8258    }
8259}
8260
8261#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
8262#[non_exhaustive]
8263pub struct ShardsOperationResponseBase {
8264    #[serde(
8265        rename = "_shards",
8266        skip_serializing_if = "::core::option::Option::is_none"
8267    )]
8268    pub shards: ::core::option::Option<crate::ShardStatistics>,
8269}
8270
8271impl ShardsOperationResponseBase {
8272    /// A `ShardsOperationResponseBase` with its required properties set.
8273    pub fn new() -> Self {
8274        Self {
8275            shards: ::core::option::Option::None,
8276        }
8277    }
8278}
8279
8280impl ShardsOperationResponseBase {
8281    /// Sets `shards`.
8282    pub fn shards(mut self, value: impl ::core::convert::Into<crate::ShardStatistics>) -> Self {
8283        self.shards = ::core::option::Option::Some(value.into());
8284        self
8285    }
8286}
8287
8288#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
8289#[non_exhaustive]
8290pub struct SlicedScroll {
8291    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
8292    pub field: ::core::option::Option<crate::Field>,
8293    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
8294    pub id: ::core::option::Option<crate::Id>,
8295    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
8296    pub max: ::core::option::Option<i32>,
8297}
8298
8299impl SlicedScroll {
8300    /// A `SlicedScroll` with its required properties set.
8301    pub fn new(id: impl ::core::convert::Into<crate::Id>, max: i32) -> Self {
8302        Self {
8303            field: ::core::option::Option::None,
8304            id: ::core::option::Option::Some(id.into()),
8305            max: ::core::option::Option::Some(max.into()),
8306        }
8307    }
8308}
8309
8310impl SlicedScroll {
8311    /// Sets `field`.
8312    pub fn field(mut self, value: impl ::core::convert::Into<crate::Field>) -> Self {
8313        self.field = ::core::option::Option::Some(value.into());
8314        self
8315    }
8316}
8317
8318/// Slices configuration used to parallelize a process.
8319#[derive(Clone, Debug, PartialEq)]
8320#[non_exhaustive]
8321pub enum Slices {
8322    /// A number.
8323    Value(i32),
8324    /// A string.
8325    Computed(crate::SlicesCalculation),
8326}
8327
8328impl ::serde::Serialize for Slices {
8329    fn serialize<S__: ::serde::Serializer>(
8330        &self,
8331        serializer: S__,
8332    ) -> ::core::result::Result<S__::Ok, S__::Error> {
8333        match self {
8334            Self::Value(value) => ::serde::Serialize::serialize(value, serializer),
8335            Self::Computed(value) => ::serde::Serialize::serialize(value, serializer),
8336        }
8337    }
8338}
8339
8340impl<'de> ::serde::Deserialize<'de> for Slices {
8341    fn deserialize<D__: ::serde::Deserializer<'de>>(
8342        deserializer: D__,
8343    ) -> ::core::result::Result<Self, D__::Error> {
8344        struct Shape;
8345        impl<'de> ::oxsearch_core::__private::ByKind<'de> for Shape {
8346            type Value = Slices;
8347            const EXPECTING: &'static str = "Slices: number or string";
8348            fn visit<V__: ::serde::Deserializer<'de>>(
8349                self,
8350                kind: ::oxsearch_core::__private::Kind,
8351                value: V__,
8352            ) -> ::core::result::Result<Self::Value, V__::Error> {
8353                match kind {
8354                    ::oxsearch_core::__private::Kind::Number => {
8355                        <i32 as ::serde::Deserialize>::deserialize(value).map(Slices::Value)
8356                    }
8357                    ::oxsearch_core::__private::Kind::String => {
8358                        <crate::SlicesCalculation as ::serde::Deserialize>::deserialize(value)
8359                            .map(Slices::Computed)
8360                    }
8361                    _ => ::core::result::Result::Err(<V__::Error as ::serde::de::Error>::custom(
8362                        format_args!("Slices can't be {kind:?}"),
8363                    )),
8364                }
8365            }
8366        }
8367        ::oxsearch_core::__private::deserialize_by_kind(deserializer, Shape)
8368    }
8369}
8370
8371impl ::core::convert::From<i32> for Slices {
8372    fn from(value: i32) -> Self {
8373        Self::Value(value)
8374    }
8375}
8376
8377impl ::core::convert::From<crate::SlicesCalculation> for Slices {
8378    fn from(value: crate::SlicesCalculation) -> Self {
8379        Self::Computed(value)
8380    }
8381}
8382
8383#[derive(Clone, Debug, PartialEq, Eq, Hash)]
8384#[non_exhaustive]
8385pub enum SlicesCalculation {
8386    /// Let Elasticsearch choose a reasonable number for most data streams and indices.
8387    Auto,
8388    /// A value this version of the specification doesn't list.
8389    Raw(::std::string::String),
8390}
8391
8392impl SlicesCalculation {
8393    /// The value as Elasticsearch writes it.
8394    pub fn as_str(&self) -> &str {
8395        match self {
8396            Self::Auto => "auto",
8397            Self::Raw(value) => value,
8398        }
8399    }
8400
8401    /// The listed value with this name, if there is one.
8402    pub fn from_known(value: &str) -> ::core::option::Option<Self> {
8403        match value {
8404            "auto" => ::core::option::Option::Some(Self::Auto),
8405            _ => ::core::option::Option::None,
8406        }
8407    }
8408}
8409
8410impl ::serde::Serialize for SlicesCalculation {
8411    fn serialize<S__: ::serde::Serializer>(
8412        &self,
8413        serializer: S__,
8414    ) -> ::core::result::Result<S__::Ok, S__::Error> {
8415        serializer.serialize_str(self.as_str())
8416    }
8417}
8418
8419impl<'de> ::serde::Deserialize<'de> for SlicesCalculation {
8420    fn deserialize<D__: ::serde::Deserializer<'de>>(
8421        deserializer: D__,
8422    ) -> ::core::result::Result<Self, D__::Error> {
8423        ::oxsearch_core::__private::deserialize_string_enum(
8424            deserializer,
8425            "SlicesCalculation",
8426            |value| Self::from_known(value).unwrap_or_else(|| Self::Raw(value.to_owned())),
8427        )
8428    }
8429}
8430
8431pub type Sort = ::oxsearch_core::shapes::OneOrMany<crate::SortCombinations>;
8432
8433#[derive(Clone, Debug, PartialEq)]
8434#[non_exhaustive]
8435pub enum SortCombinations {
8436    /// A string.
8437    Field(crate::Field),
8438    /// A object.
8439    Options(crate::SortOptions),
8440}
8441
8442impl ::serde::Serialize for SortCombinations {
8443    fn serialize<S__: ::serde::Serializer>(
8444        &self,
8445        serializer: S__,
8446    ) -> ::core::result::Result<S__::Ok, S__::Error> {
8447        match self {
8448            Self::Field(value) => ::serde::Serialize::serialize(value, serializer),
8449            Self::Options(value) => ::serde::Serialize::serialize(value, serializer),
8450        }
8451    }
8452}
8453
8454impl<'de> ::serde::Deserialize<'de> for SortCombinations {
8455    fn deserialize<D__: ::serde::Deserializer<'de>>(
8456        deserializer: D__,
8457    ) -> ::core::result::Result<Self, D__::Error> {
8458        struct Shape;
8459        impl<'de> ::oxsearch_core::__private::ByKind<'de> for Shape {
8460            type Value = SortCombinations;
8461            const EXPECTING: &'static str = "SortCombinations: object or string";
8462            fn visit<V__: ::serde::Deserializer<'de>>(
8463                self,
8464                kind: ::oxsearch_core::__private::Kind,
8465                value: V__,
8466            ) -> ::core::result::Result<Self::Value, V__::Error> {
8467                match kind {
8468                    ::oxsearch_core::__private::Kind::String => {
8469                        <crate::Field as ::serde::Deserialize>::deserialize(value)
8470                            .map(SortCombinations::Field)
8471                    }
8472                    ::oxsearch_core::__private::Kind::Object => {
8473                        <crate::SortOptions as ::serde::Deserialize>::deserialize(value)
8474                            .map(SortCombinations::Options)
8475                    }
8476                    _ => ::core::result::Result::Err(<V__::Error as ::serde::de::Error>::custom(
8477                        format_args!("SortCombinations can't be {kind:?}"),
8478                    )),
8479                }
8480            }
8481        }
8482        ::oxsearch_core::__private::deserialize_by_kind(deserializer, Shape)
8483    }
8484}
8485
8486impl ::core::convert::From<crate::Field> for SortCombinations {
8487    fn from(value: crate::Field) -> Self {
8488        Self::Field(value)
8489    }
8490}
8491
8492impl ::core::convert::From<crate::SortOptions> for SortCombinations {
8493    fn from(value: crate::SortOptions) -> Self {
8494        Self::Options(value)
8495    }
8496}
8497
8498impl ::core::convert::From<&str> for SortCombinations {
8499    fn from(value: &str) -> Self {
8500        Self::Field(::std::borrow::ToOwned::to_owned(value))
8501    }
8502}
8503
8504#[derive(Clone, Debug, PartialEq, Eq, Hash)]
8505#[non_exhaustive]
8506pub enum SortMode {
8507    /// `min`
8508    Min,
8509    /// `max`
8510    Max,
8511    /// `sum`
8512    Sum,
8513    /// `avg`
8514    Avg,
8515    /// `median`
8516    Median,
8517    /// A value this version of the specification doesn't list.
8518    Raw(::std::string::String),
8519}
8520
8521impl SortMode {
8522    /// The value as Elasticsearch writes it.
8523    pub fn as_str(&self) -> &str {
8524        match self {
8525            Self::Min => "min",
8526            Self::Max => "max",
8527            Self::Sum => "sum",
8528            Self::Avg => "avg",
8529            Self::Median => "median",
8530            Self::Raw(value) => value,
8531        }
8532    }
8533
8534    /// The listed value with this name, if there is one.
8535    pub fn from_known(value: &str) -> ::core::option::Option<Self> {
8536        match value {
8537            "min" => ::core::option::Option::Some(Self::Min),
8538            "max" => ::core::option::Option::Some(Self::Max),
8539            "sum" => ::core::option::Option::Some(Self::Sum),
8540            "avg" => ::core::option::Option::Some(Self::Avg),
8541            "median" => ::core::option::Option::Some(Self::Median),
8542            _ => ::core::option::Option::None,
8543        }
8544    }
8545}
8546
8547impl ::serde::Serialize for SortMode {
8548    fn serialize<S__: ::serde::Serializer>(
8549        &self,
8550        serializer: S__,
8551    ) -> ::core::result::Result<S__::Ok, S__::Error> {
8552        serializer.serialize_str(self.as_str())
8553    }
8554}
8555
8556impl<'de> ::serde::Deserialize<'de> for SortMode {
8557    fn deserialize<D__: ::serde::Deserializer<'de>>(
8558        deserializer: D__,
8559    ) -> ::core::result::Result<Self, D__::Error> {
8560        ::oxsearch_core::__private::deserialize_string_enum(deserializer, "SortMode", |value| {
8561            Self::from_known(value).unwrap_or_else(|| Self::Raw(value.to_owned()))
8562        })
8563    }
8564}
8565
8566#[derive(Clone, Debug, PartialEq)]
8567#[non_exhaustive]
8568pub enum SortOptions {
8569    Score(crate::ScoreSort),
8570    Doc(crate::ScoreSort),
8571    GeoDistance(::std::boxed::Box<crate::GeoDistanceSort>),
8572    Script(::std::boxed::Box<crate::ScriptSort>),
8573    /// A property named by data, such as a field name.
8574    Field(::oxsearch_core::shapes::SingleKey<crate::Field, ::std::boxed::Box<crate::FieldSort>>),
8575    /// Any variant, as JSON: an object with one property.
8576    Raw(::serde_json::Value),
8577}
8578
8579impl SortOptions {
8580    /// Writes the variant as one entry of a map.
8581    pub fn serialize_entry<M__: ::serde::ser::SerializeMap>(
8582        &self,
8583        map: &mut M__,
8584    ) -> ::core::result::Result<(), M__::Error> {
8585        match self {
8586            Self::Score(value) => map.serialize_entry("_score", value),
8587            Self::Doc(value) => map.serialize_entry("_doc", value),
8588            Self::GeoDistance(value) => map.serialize_entry("_geo_distance", value),
8589            Self::Script(value) => map.serialize_entry("_script", value),
8590            Self::Field(pair) => map.serialize_entry(&pair.key, &pair.value),
8591            Self::Raw(value) => match value {
8592                ::serde_json::Value::Object(entries) => {
8593                    for (key, value) in entries {
8594                        map.serialize_entry(key, value)?;
8595                    }
8596                    ::core::result::Result::Ok(())
8597                }
8598                _ => ::core::result::Result::Err(<M__::Error as ::serde::ser::Error>::custom(
8599                    "a raw variant must be an object",
8600                )),
8601            },
8602        }
8603    }
8604}
8605
8606impl ::serde::Serialize for SortOptions {
8607    fn serialize<S__: ::serde::Serializer>(
8608        &self,
8609        serializer: S__,
8610    ) -> ::core::result::Result<S__::Ok, S__::Error> {
8611        match self {
8612            Self::Score(value) => {
8613                ::oxsearch_core::__private::serialize_variant(serializer, "_score", value)
8614            }
8615            Self::Doc(value) => {
8616                ::oxsearch_core::__private::serialize_variant(serializer, "_doc", value)
8617            }
8618            Self::GeoDistance(value) => {
8619                ::oxsearch_core::__private::serialize_variant(serializer, "_geo_distance", value)
8620            }
8621            Self::Script(value) => {
8622                ::oxsearch_core::__private::serialize_variant(serializer, "_script", value)
8623            }
8624            Self::Field(pair) => ::serde::Serialize::serialize(pair, serializer),
8625            Self::Raw(value) => ::serde::Serialize::serialize(value, serializer),
8626        }
8627    }
8628}
8629
8630impl<'de> ::serde::Deserialize<'de> for SortOptions {
8631    fn deserialize<D__: ::serde::Deserializer<'de>>(
8632        deserializer: D__,
8633    ) -> ::core::result::Result<Self, D__::Error> {
8634        ::oxsearch_core::__private::deserialize_container(deserializer)
8635    }
8636}
8637
8638impl<'de> ::oxsearch_core::__private::Container<'de> for SortOptions {
8639    const NAME: &'static str = "SortOptions";
8640    fn variant<A__: ::serde::de::MapAccess<'de>>(
8641        key: &str,
8642        map: &mut A__,
8643    ) -> ::core::result::Result<Self, A__::Error> {
8644        ::core::result::Result::Ok(match key {
8645            "_score" => Self::Score(map.next_value()?),
8646            "_doc" => Self::Doc(map.next_value()?),
8647            "_geo_distance" => Self::GeoDistance(map.next_value()?),
8648            "_script" => Self::Script(map.next_value()?),
8649            _ => Self::Field(::oxsearch_core::shapes::SingleKey {
8650                key: ::core::convert::From::from(key),
8651                value: map.next_value()?,
8652            }),
8653        })
8654    }
8655}
8656
8657impl ::core::convert::From<crate::GeoDistanceSort> for SortOptions {
8658    fn from(value: crate::GeoDistanceSort) -> Self {
8659        Self::GeoDistance(::std::boxed::Box::new(value))
8660    }
8661}
8662
8663impl ::core::convert::From<crate::ScriptSort> for SortOptions {
8664    fn from(value: crate::ScriptSort) -> Self {
8665        Self::Script(::std::boxed::Box::new(value))
8666    }
8667}
8668
8669#[derive(Clone, Debug, PartialEq, Eq, Hash)]
8670#[non_exhaustive]
8671pub enum SortOrder {
8672    /// Ascending (smallest to largest)
8673    Asc,
8674    /// Descending (largest to smallest)
8675    Desc,
8676    /// A value this version of the specification doesn't list.
8677    Raw(::std::string::String),
8678}
8679
8680impl SortOrder {
8681    /// The value as Elasticsearch writes it.
8682    pub fn as_str(&self) -> &str {
8683        match self {
8684            Self::Asc => "asc",
8685            Self::Desc => "desc",
8686            Self::Raw(value) => value,
8687        }
8688    }
8689
8690    /// The listed value with this name, if there is one.
8691    pub fn from_known(value: &str) -> ::core::option::Option<Self> {
8692        match value {
8693            "asc" => ::core::option::Option::Some(Self::Asc),
8694            "desc" => ::core::option::Option::Some(Self::Desc),
8695            _ => ::core::option::Option::None,
8696        }
8697    }
8698}
8699
8700impl ::serde::Serialize for SortOrder {
8701    fn serialize<S__: ::serde::Serializer>(
8702        &self,
8703        serializer: S__,
8704    ) -> ::core::result::Result<S__::Ok, S__::Error> {
8705        serializer.serialize_str(self.as_str())
8706    }
8707}
8708
8709impl<'de> ::serde::Deserialize<'de> for SortOrder {
8710    fn deserialize<D__: ::serde::Deserializer<'de>>(
8711        deserializer: D__,
8712    ) -> ::core::result::Result<Self, D__::Error> {
8713        ::oxsearch_core::__private::deserialize_string_enum(deserializer, "SortOrder", |value| {
8714            Self::from_known(value).unwrap_or_else(|| Self::Raw(value.to_owned()))
8715        })
8716    }
8717}
8718
8719pub type SortResults = ::std::vec::Vec<crate::FieldValue>;
8720
8721#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
8722#[non_exhaustive]
8723pub struct SpecifiedDocument {
8724    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
8725    pub index: ::core::option::Option<crate::IndexName>,
8726    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
8727    pub id: ::core::option::Option<crate::Id>,
8728}
8729
8730impl SpecifiedDocument {
8731    /// A `SpecifiedDocument` with its required properties set.
8732    pub fn new(id: impl ::core::convert::Into<crate::Id>) -> Self {
8733        Self {
8734            index: ::core::option::Option::None,
8735            id: ::core::option::Option::Some(id.into()),
8736        }
8737    }
8738}
8739
8740impl SpecifiedDocument {
8741    /// Sets `index`.
8742    pub fn index(mut self, value: impl ::core::convert::Into<crate::IndexName>) -> Self {
8743        self.index = ::core::option::Option::Some(value.into());
8744        self
8745    }
8746}
8747
8748#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
8749#[non_exhaustive]
8750pub struct StandardRetriever {
8751    /// Query to filter the documents that can match.
8752    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
8753    pub filter: ::core::option::Option<
8754        ::oxsearch_core::shapes::OneOrMany<crate::query_dsl::QueryContainer>,
8755    >,
8756    /// Minimum _score for matching documents. Documents with a lower _score are not included in the top documents.
8757    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
8758    pub min_score: ::core::option::Option<f32>,
8759    /// Retriever name.
8760    #[serde(
8761        rename = "_name",
8762        skip_serializing_if = "::core::option::Option::is_none"
8763    )]
8764    pub name: ::core::option::Option<::std::string::String>,
8765    /// Defines a query to retrieve a set of top documents.
8766    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
8767    pub query: ::core::option::Option<crate::query_dsl::QueryContainer>,
8768    /// Defines a search after object parameter used for pagination.
8769    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
8770    pub search_after: ::core::option::Option<crate::SortResults>,
8771    /// Maximum number of documents to collect for each shard.
8772    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
8773    pub terminate_after: ::core::option::Option<i32>,
8774    /// A sort object that that specifies the order of matching documents.
8775    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
8776    pub sort: ::core::option::Option<crate::Sort>,
8777    /// Collapses the top documents by a specified key into a single top document per key.
8778    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
8779    pub collapse: ::core::option::Option<crate::search::FieldCollapse>,
8780}
8781
8782impl StandardRetriever {
8783    /// A `StandardRetriever` with its required properties set.
8784    pub fn new() -> Self {
8785        Self {
8786            filter: ::core::option::Option::None,
8787            min_score: ::core::option::Option::None,
8788            name: ::core::option::Option::None,
8789            query: ::core::option::Option::None,
8790            search_after: ::core::option::Option::None,
8791            terminate_after: ::core::option::Option::None,
8792            sort: ::core::option::Option::None,
8793            collapse: ::core::option::Option::None,
8794        }
8795    }
8796}
8797
8798impl StandardRetriever {
8799    /// Sets `filter`.
8800    pub fn filter(
8801        mut self,
8802        value: impl ::core::convert::Into<
8803            ::oxsearch_core::shapes::OneOrMany<crate::query_dsl::QueryContainer>,
8804        >,
8805    ) -> Self {
8806        self.filter = ::core::option::Option::Some(value.into());
8807        self
8808    }
8809    /// Sets `min_score`.
8810    pub fn min_score(mut self, value: f32) -> Self {
8811        self.min_score = ::core::option::Option::Some(value.into());
8812        self
8813    }
8814    /// Sets `name`.
8815    pub fn name(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
8816        self.name = ::core::option::Option::Some(value.into());
8817        self
8818    }
8819    /// Sets `query`.
8820    pub fn query(
8821        mut self,
8822        value: impl ::core::convert::Into<crate::query_dsl::QueryContainer>,
8823    ) -> Self {
8824        self.query = ::core::option::Option::Some(value.into());
8825        self
8826    }
8827    /// Sets `search_after`.
8828    pub fn search_after(mut self, value: impl ::core::convert::Into<crate::SortResults>) -> Self {
8829        self.search_after = ::core::option::Option::Some(value.into());
8830        self
8831    }
8832    /// Sets `terminate_after`.
8833    pub fn terminate_after(mut self, value: i32) -> Self {
8834        self.terminate_after = ::core::option::Option::Some(value.into());
8835        self
8836    }
8837    /// Sets `sort`.
8838    pub fn sort(mut self, value: impl ::core::convert::Into<crate::Sort>) -> Self {
8839        self.sort = ::core::option::Option::Some(value.into());
8840        self
8841    }
8842    /// Sets `collapse`.
8843    pub fn collapse(
8844        mut self,
8845        value: impl ::core::convert::Into<crate::search::FieldCollapse>,
8846    ) -> Self {
8847        self.collapse = ::core::option::Option::Some(value.into());
8848        self
8849    }
8850}
8851
8852#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
8853#[non_exhaustive]
8854pub struct StoreStats {
8855    /// Total size of all shards assigned to selected nodes.
8856    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
8857    pub size: ::core::option::Option<crate::ByteSize>,
8858    /// Total size, in bytes, of all shards assigned to selected nodes.
8859    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
8860    pub size_in_bytes: ::core::option::Option<i64>,
8861    /// A prediction of how much larger the shard stores will eventually grow due to ongoing peer recoveries, restoring snapshots, and similar activities.
8862    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
8863    pub reserved: ::core::option::Option<crate::ByteSize>,
8864    /// A prediction, in bytes, of how much larger the shard stores will eventually grow due to ongoing peer recoveries, restoring snapshots, and similar activities.
8865    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
8866    pub reserved_in_bytes: ::core::option::Option<i64>,
8867    /// Total data set size of all shards assigned to selected nodes.
8868    /// This includes the size of shards not stored fully on the nodes, such as the cache for partially mounted indices.
8869    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
8870    pub total_data_set_size: ::core::option::Option<crate::ByteSize>,
8871    /// Total data set size, in bytes, of all shards assigned to selected nodes.
8872    /// This includes the size of shards not stored fully on the nodes, such as the cache for partially mounted indices.
8873    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
8874    pub total_data_set_size_in_bytes: ::core::option::Option<i64>,
8875}
8876
8877impl StoreStats {
8878    /// A `StoreStats` with its required properties set.
8879    pub fn new(size_in_bytes: i64, reserved_in_bytes: i64) -> Self {
8880        Self {
8881            size: ::core::option::Option::None,
8882            size_in_bytes: ::core::option::Option::Some(size_in_bytes.into()),
8883            reserved: ::core::option::Option::None,
8884            reserved_in_bytes: ::core::option::Option::Some(reserved_in_bytes.into()),
8885            total_data_set_size: ::core::option::Option::None,
8886            total_data_set_size_in_bytes: ::core::option::Option::None,
8887        }
8888    }
8889}
8890
8891impl StoreStats {
8892    /// Sets `size`.
8893    pub fn size(mut self, value: impl ::core::convert::Into<crate::ByteSize>) -> Self {
8894        self.size = ::core::option::Option::Some(value.into());
8895        self
8896    }
8897    /// Sets `reserved`.
8898    pub fn reserved(mut self, value: impl ::core::convert::Into<crate::ByteSize>) -> Self {
8899        self.reserved = ::core::option::Option::Some(value.into());
8900        self
8901    }
8902    /// Sets `total_data_set_size`.
8903    pub fn total_data_set_size(
8904        mut self,
8905        value: impl ::core::convert::Into<crate::ByteSize>,
8906    ) -> Self {
8907        self.total_data_set_size = ::core::option::Option::Some(value.into());
8908        self
8909    }
8910    /// Sets `total_data_set_size_in_bytes`.
8911    pub fn total_data_set_size_in_bytes(mut self, value: i64) -> Self {
8912        self.total_data_set_size_in_bytes = ::core::option::Option::Some(value.into());
8913        self
8914    }
8915}
8916
8917#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
8918#[non_exhaustive]
8919pub struct StoredScript {
8920    /// The language the script is written in.
8921    /// For search templates, use `mustache`.
8922    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
8923    pub lang: ::core::option::Option<crate::ScriptLanguage>,
8924    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
8925    pub options:
8926        ::core::option::Option<::indexmap::IndexMap<::std::string::String, ::std::string::String>>,
8927    /// The script source.
8928    /// For search templates, an object containing the search template.
8929    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
8930    pub source: ::core::option::Option<crate::ScriptSource>,
8931}
8932
8933impl StoredScript {
8934    /// A `StoredScript` with its required properties set.
8935    pub fn new(
8936        lang: impl ::core::convert::Into<crate::ScriptLanguage>,
8937        source: impl ::core::convert::Into<crate::ScriptSource>,
8938    ) -> Self {
8939        Self {
8940            lang: ::core::option::Option::Some(lang.into()),
8941            options: ::core::option::Option::None,
8942            source: ::core::option::Option::Some(source.into()),
8943        }
8944    }
8945}
8946
8947impl StoredScript {
8948    /// Sets `options`.
8949    pub fn options(
8950        mut self,
8951        value: impl ::core::convert::Into<
8952            ::indexmap::IndexMap<::std::string::String, ::std::string::String>,
8953        >,
8954    ) -> Self {
8955        self.options = ::core::option::Option::Some(value.into());
8956        self
8957    }
8958}
8959
8960pub type StreamResult = ::std::string::String;
8961
8962#[derive(Clone, Debug, PartialEq, Eq, Hash)]
8963#[non_exhaustive]
8964pub enum SuggestMode {
8965    /// Only generate suggestions for terms that are not in the shard.
8966    Missing,
8967    /// Only suggest terms that occur in more docs on the shard than the original term.
8968    Popular,
8969    /// Suggest any matching suggestions based on terms in the suggest text.
8970    Always,
8971    /// A value this version of the specification doesn't list.
8972    Raw(::std::string::String),
8973}
8974
8975impl SuggestMode {
8976    /// The value as Elasticsearch writes it.
8977    pub fn as_str(&self) -> &str {
8978        match self {
8979            Self::Missing => "missing",
8980            Self::Popular => "popular",
8981            Self::Always => "always",
8982            Self::Raw(value) => value,
8983        }
8984    }
8985
8986    /// The listed value with this name, if there is one.
8987    pub fn from_known(value: &str) -> ::core::option::Option<Self> {
8988        match value {
8989            "missing" => ::core::option::Option::Some(Self::Missing),
8990            "popular" => ::core::option::Option::Some(Self::Popular),
8991            "always" => ::core::option::Option::Some(Self::Always),
8992            _ => ::core::option::Option::None,
8993        }
8994    }
8995}
8996
8997impl ::serde::Serialize for SuggestMode {
8998    fn serialize<S__: ::serde::Serializer>(
8999        &self,
9000        serializer: S__,
9001    ) -> ::core::result::Result<S__::Ok, S__::Error> {
9002        serializer.serialize_str(self.as_str())
9003    }
9004}
9005
9006impl<'de> ::serde::Deserialize<'de> for SuggestMode {
9007    fn deserialize<D__: ::serde::Deserializer<'de>>(
9008        deserializer: D__,
9009    ) -> ::core::result::Result<Self, D__::Error> {
9010        ::oxsearch_core::__private::deserialize_string_enum(deserializer, "SuggestMode", |value| {
9011            Self::from_known(value).unwrap_or_else(|| Self::Raw(value.to_owned()))
9012        })
9013    }
9014}
9015
9016/// The suggestion name as returned from the server. Depending whether typed_keys is specified this could come back
9017/// in the form of `name#type` instead of simply `name`
9018pub type SuggestionName = ::std::string::String;
9019
9020#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
9021#[non_exhaustive]
9022pub struct TaskFailure {
9023    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
9024    pub task_id: ::core::option::Option<i64>,
9025    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
9026    pub node_id: ::core::option::Option<crate::NodeId>,
9027    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
9028    pub status: ::core::option::Option<::std::string::String>,
9029    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
9030    pub reason: ::core::option::Option<crate::ErrorCause>,
9031}
9032
9033impl TaskFailure {
9034    /// A `TaskFailure` with its required properties set.
9035    pub fn new(
9036        task_id: i64,
9037        node_id: impl ::core::convert::Into<crate::NodeId>,
9038        status: impl ::core::convert::Into<::std::string::String>,
9039        reason: impl ::core::convert::Into<crate::ErrorCause>,
9040    ) -> Self {
9041        Self {
9042            task_id: ::core::option::Option::Some(task_id.into()),
9043            node_id: ::core::option::Option::Some(node_id.into()),
9044            status: ::core::option::Option::Some(status.into()),
9045            reason: ::core::option::Option::Some(reason.into()),
9046        }
9047    }
9048}
9049
9050impl TaskFailure {}
9051
9052pub type TaskId = ::std::string::String;
9053
9054#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
9055#[non_exhaustive]
9056pub struct TextEmbedding {
9057    /// Model ID is required for all dense_vector fields but
9058    /// may be inferred for semantic_text fields
9059    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
9060    pub model_id: ::core::option::Option<::std::string::String>,
9061    /// The text to be converted into a vector by the specified model
9062    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
9063    pub model_text: ::core::option::Option<::std::string::String>,
9064}
9065
9066impl TextEmbedding {
9067    /// A `TextEmbedding` with its required properties set.
9068    pub fn new(model_text: impl ::core::convert::Into<::std::string::String>) -> Self {
9069        Self {
9070            model_id: ::core::option::Option::None,
9071            model_text: ::core::option::Option::Some(model_text.into()),
9072        }
9073    }
9074}
9075
9076impl TextEmbedding {
9077    /// Sets `model_id`.
9078    pub fn model_id(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
9079        self.model_id = ::core::option::Option::Some(value.into());
9080        self
9081    }
9082}
9083
9084#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
9085#[non_exhaustive]
9086pub struct TextSimilarityReranker {
9087    /// Query to filter the documents that can match.
9088    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
9089    pub filter: ::core::option::Option<
9090        ::oxsearch_core::shapes::OneOrMany<crate::query_dsl::QueryContainer>,
9091    >,
9092    /// Minimum _score for matching documents. Documents with a lower _score are not included in the top documents.
9093    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
9094    pub min_score: ::core::option::Option<f32>,
9095    /// Retriever name.
9096    #[serde(
9097        rename = "_name",
9098        skip_serializing_if = "::core::option::Option::is_none"
9099    )]
9100    pub name: ::core::option::Option<::std::string::String>,
9101    /// The nested retriever which will produce the first-level results, that will later be used for reranking.
9102    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
9103    pub retriever: ::core::option::Option<crate::RetrieverContainer>,
9104    /// This value determines how many documents we will consider from the nested retriever.
9105    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
9106    pub rank_window_size: ::core::option::Option<i32>,
9107    /// Unique identifier of the inference endpoint created using the inference API.
9108    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
9109    pub inference_id: ::core::option::Option<::std::string::String>,
9110    /// The text snippet used as the basis for similarity comparison.
9111    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
9112    pub inference_text: ::core::option::Option<::std::string::String>,
9113    /// The document field to be used for text similarity comparisons. This field should contain the text that will be evaluated against the inference_text.
9114    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
9115    pub field: ::core::option::Option<::std::string::String>,
9116    /// Whether to rescore on only the best matching chunks.
9117    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
9118    pub chunk_rescorer: ::core::option::Option<crate::ChunkRescorer>,
9119}
9120
9121impl TextSimilarityReranker {
9122    /// A `TextSimilarityReranker` with its required properties set.
9123    pub fn new(
9124        retriever: impl ::core::convert::Into<crate::RetrieverContainer>,
9125        inference_text: impl ::core::convert::Into<::std::string::String>,
9126        field: impl ::core::convert::Into<::std::string::String>,
9127    ) -> Self {
9128        Self {
9129            filter: ::core::option::Option::None,
9130            min_score: ::core::option::Option::None,
9131            name: ::core::option::Option::None,
9132            retriever: ::core::option::Option::Some(retriever.into()),
9133            rank_window_size: ::core::option::Option::None,
9134            inference_id: ::core::option::Option::None,
9135            inference_text: ::core::option::Option::Some(inference_text.into()),
9136            field: ::core::option::Option::Some(field.into()),
9137            chunk_rescorer: ::core::option::Option::None,
9138        }
9139    }
9140}
9141
9142impl TextSimilarityReranker {
9143    /// Sets `filter`.
9144    pub fn filter(
9145        mut self,
9146        value: impl ::core::convert::Into<
9147            ::oxsearch_core::shapes::OneOrMany<crate::query_dsl::QueryContainer>,
9148        >,
9149    ) -> Self {
9150        self.filter = ::core::option::Option::Some(value.into());
9151        self
9152    }
9153    /// Sets `min_score`.
9154    pub fn min_score(mut self, value: f32) -> Self {
9155        self.min_score = ::core::option::Option::Some(value.into());
9156        self
9157    }
9158    /// Sets `name`.
9159    pub fn name(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
9160        self.name = ::core::option::Option::Some(value.into());
9161        self
9162    }
9163    /// Sets `rank_window_size`.
9164    pub fn rank_window_size(mut self, value: i32) -> Self {
9165        self.rank_window_size = ::core::option::Option::Some(value.into());
9166        self
9167    }
9168    /// Sets `inference_id`.
9169    pub fn inference_id(
9170        mut self,
9171        value: impl ::core::convert::Into<::std::string::String>,
9172    ) -> Self {
9173        self.inference_id = ::core::option::Option::Some(value.into());
9174        self
9175    }
9176    /// Sets `chunk_rescorer`.
9177    pub fn chunk_rescorer(
9178        mut self,
9179        value: impl ::core::convert::Into<crate::ChunkRescorer>,
9180    ) -> Self {
9181        self.chunk_rescorer = ::core::option::Option::Some(value.into());
9182        self
9183    }
9184}
9185
9186#[derive(Clone, Debug, PartialEq, Eq, Hash)]
9187#[non_exhaustive]
9188pub enum ThreadType {
9189    /// Threads that consume the most CPU time.
9190    Cpu,
9191    /// Threads that have been in a waiting state the longest.
9192    Wait,
9193    /// Threads that have been blocked the longest.
9194    Block,
9195    /// Threads that consume the most GPU time.
9196    Gpu,
9197    /// Threads that allocate the most memory.
9198    Mem,
9199    /// A value this version of the specification doesn't list.
9200    Raw(::std::string::String),
9201}
9202
9203impl ThreadType {
9204    /// The value as Elasticsearch writes it.
9205    pub fn as_str(&self) -> &str {
9206        match self {
9207            Self::Cpu => "cpu",
9208            Self::Wait => "wait",
9209            Self::Block => "block",
9210            Self::Gpu => "gpu",
9211            Self::Mem => "mem",
9212            Self::Raw(value) => value,
9213        }
9214    }
9215
9216    /// The listed value with this name, if there is one.
9217    pub fn from_known(value: &str) -> ::core::option::Option<Self> {
9218        match value {
9219            "cpu" => ::core::option::Option::Some(Self::Cpu),
9220            "wait" => ::core::option::Option::Some(Self::Wait),
9221            "block" => ::core::option::Option::Some(Self::Block),
9222            "gpu" => ::core::option::Option::Some(Self::Gpu),
9223            "mem" => ::core::option::Option::Some(Self::Mem),
9224            _ => ::core::option::Option::None,
9225        }
9226    }
9227}
9228
9229impl ::serde::Serialize for ThreadType {
9230    fn serialize<S__: ::serde::Serializer>(
9231        &self,
9232        serializer: S__,
9233    ) -> ::core::result::Result<S__::Ok, S__::Error> {
9234        serializer.serialize_str(self.as_str())
9235    }
9236}
9237
9238impl<'de> ::serde::Deserialize<'de> for ThreadType {
9239    fn deserialize<D__: ::serde::Deserializer<'de>>(
9240        deserializer: D__,
9241    ) -> ::core::result::Result<Self, D__::Error> {
9242        ::oxsearch_core::__private::deserialize_string_enum(deserializer, "ThreadType", |value| {
9243            Self::from_known(value).unwrap_or_else(|| Self::Raw(value.to_owned()))
9244        })
9245    }
9246}
9247
9248/// Time of day, expressed as HH:MM:SS
9249pub type TimeOfDay = ::std::string::String;
9250
9251#[derive(Clone, Debug, PartialEq, Eq, Hash)]
9252#[non_exhaustive]
9253pub enum TimeUnit {
9254    /// `nanos`
9255    Nanoseconds,
9256    /// `micros`
9257    Microseconds,
9258    /// `ms`
9259    Milliseconds,
9260    /// `s`
9261    Seconds,
9262    /// `m`
9263    Minutes,
9264    /// `h`
9265    Hours,
9266    /// `d`
9267    Days,
9268    /// A value this version of the specification doesn't list.
9269    Raw(::std::string::String),
9270}
9271
9272impl TimeUnit {
9273    /// The value as Elasticsearch writes it.
9274    pub fn as_str(&self) -> &str {
9275        match self {
9276            Self::Nanoseconds => "nanos",
9277            Self::Microseconds => "micros",
9278            Self::Milliseconds => "ms",
9279            Self::Seconds => "s",
9280            Self::Minutes => "m",
9281            Self::Hours => "h",
9282            Self::Days => "d",
9283            Self::Raw(value) => value,
9284        }
9285    }
9286
9287    /// The listed value with this name, if there is one.
9288    pub fn from_known(value: &str) -> ::core::option::Option<Self> {
9289        match value {
9290            "nanos" => ::core::option::Option::Some(Self::Nanoseconds),
9291            "micros" => ::core::option::Option::Some(Self::Microseconds),
9292            "ms" => ::core::option::Option::Some(Self::Milliseconds),
9293            "s" => ::core::option::Option::Some(Self::Seconds),
9294            "m" => ::core::option::Option::Some(Self::Minutes),
9295            "h" => ::core::option::Option::Some(Self::Hours),
9296            "d" => ::core::option::Option::Some(Self::Days),
9297            _ => ::core::option::Option::None,
9298        }
9299    }
9300}
9301
9302impl ::serde::Serialize for TimeUnit {
9303    fn serialize<S__: ::serde::Serializer>(
9304        &self,
9305        serializer: S__,
9306    ) -> ::core::result::Result<S__::Ok, S__::Error> {
9307        serializer.serialize_str(self.as_str())
9308    }
9309}
9310
9311impl<'de> ::serde::Deserialize<'de> for TimeUnit {
9312    fn deserialize<D__: ::serde::Deserializer<'de>>(
9313        deserializer: D__,
9314    ) -> ::core::result::Result<Self, D__::Error> {
9315        ::oxsearch_core::__private::deserialize_string_enum(deserializer, "TimeUnit", |value| {
9316            Self::from_known(value).unwrap_or_else(|| Self::Raw(value.to_owned()))
9317        })
9318    }
9319}
9320
9321pub type TimeZone = ::std::string::String;
9322
9323#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
9324#[non_exhaustive]
9325pub struct TokenPruningConfig {
9326    /// Tokens whose frequency is more than this threshold times the average frequency of all tokens in the specified field are considered outliers and pruned.
9327    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
9328    pub tokens_freq_ratio_threshold: ::core::option::Option<i32>,
9329    /// Tokens whose weight is less than this threshold are considered nonsignificant and pruned.
9330    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
9331    pub tokens_weight_threshold: ::core::option::Option<f32>,
9332    /// Whether to only score pruned tokens, vs only scoring kept tokens.
9333    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
9334    pub only_score_pruned_tokens: ::core::option::Option<bool>,
9335}
9336
9337impl TokenPruningConfig {
9338    /// A `TokenPruningConfig` with its required properties set.
9339    pub fn new() -> Self {
9340        Self {
9341            tokens_freq_ratio_threshold: ::core::option::Option::None,
9342            tokens_weight_threshold: ::core::option::Option::None,
9343            only_score_pruned_tokens: ::core::option::Option::None,
9344        }
9345    }
9346}
9347
9348impl TokenPruningConfig {
9349    /// Sets `tokens_freq_ratio_threshold`.
9350    pub fn tokens_freq_ratio_threshold(mut self, value: i32) -> Self {
9351        self.tokens_freq_ratio_threshold = ::core::option::Option::Some(value.into());
9352        self
9353    }
9354    /// Sets `tokens_weight_threshold`.
9355    pub fn tokens_weight_threshold(mut self, value: f32) -> Self {
9356        self.tokens_weight_threshold = ::core::option::Option::Some(value.into());
9357        self
9358    }
9359    /// Sets `only_score_pruned_tokens`.
9360    pub fn only_score_pruned_tokens(mut self, value: bool) -> Self {
9361        self.only_score_pruned_tokens = ::core::option::Option::Some(value.into());
9362        self
9363    }
9364}
9365
9366#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
9367#[non_exhaustive]
9368pub struct TopLeftBottomRightGeoBounds {
9369    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
9370    pub top_left: ::core::option::Option<crate::GeoLocation>,
9371    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
9372    pub bottom_right: ::core::option::Option<crate::GeoLocation>,
9373}
9374
9375impl TopLeftBottomRightGeoBounds {
9376    /// A `TopLeftBottomRightGeoBounds` with its required properties set.
9377    pub fn new(
9378        top_left: impl ::core::convert::Into<crate::GeoLocation>,
9379        bottom_right: impl ::core::convert::Into<crate::GeoLocation>,
9380    ) -> Self {
9381        Self {
9382            top_left: ::core::option::Option::Some(top_left.into()),
9383            bottom_right: ::core::option::Option::Some(bottom_right.into()),
9384        }
9385    }
9386}
9387
9388impl TopLeftBottomRightGeoBounds {}
9389
9390#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
9391#[non_exhaustive]
9392pub struct TopRightBottomLeftGeoBounds {
9393    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
9394    pub top_right: ::core::option::Option<crate::GeoLocation>,
9395    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
9396    pub bottom_left: ::core::option::Option<crate::GeoLocation>,
9397}
9398
9399impl TopRightBottomLeftGeoBounds {
9400    /// A `TopRightBottomLeftGeoBounds` with its required properties set.
9401    pub fn new(
9402        top_right: impl ::core::convert::Into<crate::GeoLocation>,
9403        bottom_left: impl ::core::convert::Into<crate::GeoLocation>,
9404    ) -> Self {
9405        Self {
9406            top_right: ::core::option::Option::Some(top_right.into()),
9407            bottom_left: ::core::option::Option::Some(bottom_left.into()),
9408        }
9409    }
9410}
9411
9412impl TopRightBottomLeftGeoBounds {}
9413
9414#[derive(Clone, Debug, PartialEq)]
9415#[non_exhaustive]
9416pub enum TransformContainer {
9417    Chain(::std::vec::Vec<crate::TransformContainer>),
9418    Script(crate::ScriptTransform),
9419    Search(crate::SearchTransform),
9420    /// Any variant, as JSON: an object with one property.
9421    Raw(::serde_json::Value),
9422}
9423
9424impl TransformContainer {
9425    /// Writes the variant as one entry of a map.
9426    pub fn serialize_entry<M__: ::serde::ser::SerializeMap>(
9427        &self,
9428        map: &mut M__,
9429    ) -> ::core::result::Result<(), M__::Error> {
9430        match self {
9431            Self::Chain(value) => map.serialize_entry("chain", value),
9432            Self::Script(value) => map.serialize_entry("script", value),
9433            Self::Search(value) => map.serialize_entry("search", value),
9434            Self::Raw(value) => match value {
9435                ::serde_json::Value::Object(entries) => {
9436                    for (key, value) in entries {
9437                        map.serialize_entry(key, value)?;
9438                    }
9439                    ::core::result::Result::Ok(())
9440                }
9441                _ => ::core::result::Result::Err(<M__::Error as ::serde::ser::Error>::custom(
9442                    "a raw variant must be an object",
9443                )),
9444            },
9445        }
9446    }
9447}
9448
9449impl ::serde::Serialize for TransformContainer {
9450    fn serialize<S__: ::serde::Serializer>(
9451        &self,
9452        serializer: S__,
9453    ) -> ::core::result::Result<S__::Ok, S__::Error> {
9454        match self {
9455            Self::Chain(value) => {
9456                ::oxsearch_core::__private::serialize_variant(serializer, "chain", value)
9457            }
9458            Self::Script(value) => {
9459                ::oxsearch_core::__private::serialize_variant(serializer, "script", value)
9460            }
9461            Self::Search(value) => {
9462                ::oxsearch_core::__private::serialize_variant(serializer, "search", value)
9463            }
9464            Self::Raw(value) => ::serde::Serialize::serialize(value, serializer),
9465        }
9466    }
9467}
9468
9469impl<'de> ::serde::Deserialize<'de> for TransformContainer {
9470    fn deserialize<D__: ::serde::Deserializer<'de>>(
9471        deserializer: D__,
9472    ) -> ::core::result::Result<Self, D__::Error> {
9473        ::oxsearch_core::__private::deserialize_container(deserializer)
9474    }
9475}
9476
9477impl<'de> ::oxsearch_core::__private::Container<'de> for TransformContainer {
9478    const NAME: &'static str = "TransformContainer";
9479    fn variant<A__: ::serde::de::MapAccess<'de>>(
9480        key: &str,
9481        map: &mut A__,
9482    ) -> ::core::result::Result<Self, A__::Error> {
9483        ::core::result::Result::Ok(match key {
9484            "chain" => Self::Chain(map.next_value()?),
9485            "script" => Self::Script(map.next_value()?),
9486            "search" => Self::Search(map.next_value()?),
9487            _ => Self::Raw(::oxsearch_core::__private::raw_variant(
9488                key,
9489                map.next_value()?,
9490            )),
9491        })
9492    }
9493}
9494
9495impl ::core::convert::From<::std::vec::Vec<crate::TransformContainer>> for TransformContainer {
9496    fn from(value: ::std::vec::Vec<crate::TransformContainer>) -> Self {
9497        Self::Chain(value)
9498    }
9499}
9500
9501impl ::core::convert::From<crate::ScriptTransform> for TransformContainer {
9502    fn from(value: crate::ScriptTransform) -> Self {
9503        Self::Script(value)
9504    }
9505}
9506
9507impl ::core::convert::From<crate::SearchTransform> for TransformContainer {
9508    fn from(value: crate::SearchTransform) -> Self {
9509        Self::Search(value)
9510    }
9511}
9512
9513#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
9514#[non_exhaustive]
9515pub struct TranslogStats {
9516    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
9517    pub earliest_last_modified_age: ::core::option::Option<i64>,
9518    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
9519    pub operations: ::core::option::Option<i64>,
9520    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
9521    pub size: ::core::option::Option<::std::string::String>,
9522    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
9523    pub size_in_bytes: ::core::option::Option<i64>,
9524    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
9525    pub uncommitted_operations: ::core::option::Option<i32>,
9526    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
9527    pub uncommitted_size: ::core::option::Option<::std::string::String>,
9528    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
9529    pub uncommitted_size_in_bytes: ::core::option::Option<i64>,
9530}
9531
9532impl TranslogStats {
9533    /// A `TranslogStats` with its required properties set.
9534    pub fn new(
9535        earliest_last_modified_age: i64,
9536        operations: i64,
9537        size_in_bytes: i64,
9538        uncommitted_operations: i32,
9539        uncommitted_size_in_bytes: i64,
9540    ) -> Self {
9541        Self {
9542            earliest_last_modified_age: ::core::option::Option::Some(
9543                earliest_last_modified_age.into(),
9544            ),
9545            operations: ::core::option::Option::Some(operations.into()),
9546            size: ::core::option::Option::None,
9547            size_in_bytes: ::core::option::Option::Some(size_in_bytes.into()),
9548            uncommitted_operations: ::core::option::Option::Some(uncommitted_operations.into()),
9549            uncommitted_size: ::core::option::Option::None,
9550            uncommitted_size_in_bytes: ::core::option::Option::Some(
9551                uncommitted_size_in_bytes.into(),
9552            ),
9553        }
9554    }
9555}
9556
9557impl TranslogStats {
9558    /// Sets `size`.
9559    pub fn size(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
9560        self.size = ::core::option::Option::Some(value.into());
9561        self
9562    }
9563    /// Sets `uncommitted_size`.
9564    pub fn uncommitted_size(
9565        mut self,
9566        value: impl ::core::convert::Into<::std::string::String>,
9567    ) -> Self {
9568        self.uncommitted_size = ::core::option::Option::Some(value.into());
9569        self
9570    }
9571}
9572
9573pub type TransportAddress = ::std::string::String;
9574
9575/// Time unit for fractional milliseconds
9576pub type UnitFloatMillis = f64;
9577
9578/// Time unit for milliseconds
9579pub type UnitMillis = i64;
9580
9581/// Time unit for nanoseconds
9582pub type UnitNanos = i64;
9583
9584/// Time unit for seconds
9585pub type UnitSeconds = i64;
9586
9587pub type Username = ::std::string::String;
9588
9589pub type Uuid = ::std::string::String;
9590
9591pub type VersionNumber = i64;
9592
9593pub type VersionString = ::std::string::String;
9594
9595#[derive(Clone, Debug, PartialEq, Eq, Hash)]
9596#[non_exhaustive]
9597pub enum VersionType {
9598    /// Use internal versioning that starts at 1 and increments with each update or delete.
9599    Internal,
9600    /// Only index the document if the specified version is strictly higher than the version of the stored document or if there is no existing document.
9601    External,
9602    /// Only index the document if the specified version is equal or higher than the version of the stored document or if there is no existing document.
9603    /// NOTE: The `external_gte` version type is meant for special use cases and should be used with care.
9604    /// If used incorrectly, it can result in loss of data.
9605    ExternalGte,
9606    /// A value this version of the specification doesn't list.
9607    Raw(::std::string::String),
9608}
9609
9610impl VersionType {
9611    /// The value as Elasticsearch writes it.
9612    pub fn as_str(&self) -> &str {
9613        match self {
9614            Self::Internal => "internal",
9615            Self::External => "external",
9616            Self::ExternalGte => "external_gte",
9617            Self::Raw(value) => value,
9618        }
9619    }
9620
9621    /// The listed value with this name, if there is one.
9622    pub fn from_known(value: &str) -> ::core::option::Option<Self> {
9623        match value {
9624            "internal" => ::core::option::Option::Some(Self::Internal),
9625            "external" => ::core::option::Option::Some(Self::External),
9626            "external_gte" => ::core::option::Option::Some(Self::ExternalGte),
9627            _ => ::core::option::Option::None,
9628        }
9629    }
9630}
9631
9632impl ::serde::Serialize for VersionType {
9633    fn serialize<S__: ::serde::Serializer>(
9634        &self,
9635        serializer: S__,
9636    ) -> ::core::result::Result<S__::Ok, S__::Error> {
9637        serializer.serialize_str(self.as_str())
9638    }
9639}
9640
9641impl<'de> ::serde::Deserialize<'de> for VersionType {
9642    fn deserialize<D__: ::serde::Deserializer<'de>>(
9643        deserializer: D__,
9644    ) -> ::core::result::Result<Self, D__::Error> {
9645        ::oxsearch_core::__private::deserialize_string_enum(deserializer, "VersionType", |value| {
9646            Self::from_known(value).unwrap_or_else(|| Self::Raw(value.to_owned()))
9647        })
9648    }
9649}
9650
9651#[derive(Clone, Debug, PartialEq, Eq, Hash)]
9652#[non_exhaustive]
9653pub enum WaitForActiveShardOptions {
9654    /// `all`
9655    All,
9656    /// `index-setting`
9657    IndexSetting,
9658    /// A value this version of the specification doesn't list.
9659    Raw(::std::string::String),
9660}
9661
9662impl WaitForActiveShardOptions {
9663    /// The value as Elasticsearch writes it.
9664    pub fn as_str(&self) -> &str {
9665        match self {
9666            Self::All => "all",
9667            Self::IndexSetting => "index-setting",
9668            Self::Raw(value) => value,
9669        }
9670    }
9671
9672    /// The listed value with this name, if there is one.
9673    pub fn from_known(value: &str) -> ::core::option::Option<Self> {
9674        match value {
9675            "all" => ::core::option::Option::Some(Self::All),
9676            "index-setting" => ::core::option::Option::Some(Self::IndexSetting),
9677            _ => ::core::option::Option::None,
9678        }
9679    }
9680}
9681
9682impl ::serde::Serialize for WaitForActiveShardOptions {
9683    fn serialize<S__: ::serde::Serializer>(
9684        &self,
9685        serializer: S__,
9686    ) -> ::core::result::Result<S__::Ok, S__::Error> {
9687        serializer.serialize_str(self.as_str())
9688    }
9689}
9690
9691impl<'de> ::serde::Deserialize<'de> for WaitForActiveShardOptions {
9692    fn deserialize<D__: ::serde::Deserializer<'de>>(
9693        deserializer: D__,
9694    ) -> ::core::result::Result<Self, D__::Error> {
9695        ::oxsearch_core::__private::deserialize_string_enum(
9696            deserializer,
9697            "WaitForActiveShardOptions",
9698            |value| Self::from_known(value).unwrap_or_else(|| Self::Raw(value.to_owned())),
9699        )
9700    }
9701}
9702
9703#[derive(Clone, Debug, PartialEq)]
9704#[non_exhaustive]
9705pub enum WaitForActiveShards {
9706    /// A number.
9707    Count(i32),
9708    /// A string.
9709    Option(crate::WaitForActiveShardOptions),
9710}
9711
9712impl ::serde::Serialize for WaitForActiveShards {
9713    fn serialize<S__: ::serde::Serializer>(
9714        &self,
9715        serializer: S__,
9716    ) -> ::core::result::Result<S__::Ok, S__::Error> {
9717        match self {
9718            Self::Count(value) => ::serde::Serialize::serialize(value, serializer),
9719            Self::Option(value) => ::serde::Serialize::serialize(value, serializer),
9720        }
9721    }
9722}
9723
9724impl<'de> ::serde::Deserialize<'de> for WaitForActiveShards {
9725    fn deserialize<D__: ::serde::Deserializer<'de>>(
9726        deserializer: D__,
9727    ) -> ::core::result::Result<Self, D__::Error> {
9728        struct Shape;
9729        impl<'de> ::oxsearch_core::__private::ByKind<'de> for Shape {
9730            type Value = WaitForActiveShards;
9731            const EXPECTING: &'static str = "WaitForActiveShards: number or string";
9732            fn visit<V__: ::serde::Deserializer<'de>>(
9733                self,
9734                kind: ::oxsearch_core::__private::Kind,
9735                value: V__,
9736            ) -> ::core::result::Result<Self::Value, V__::Error> {
9737                match kind {
9738                    ::oxsearch_core::__private::Kind::Number => {
9739                        <i32 as ::serde::Deserialize>::deserialize(value)
9740                            .map(WaitForActiveShards::Count)
9741                    }
9742                    ::oxsearch_core::__private::Kind::String => {
9743                        <crate::WaitForActiveShardOptions as ::serde::Deserialize>::deserialize(
9744                            value,
9745                        )
9746                        .map(WaitForActiveShards::Option)
9747                    }
9748                    _ => ::core::result::Result::Err(<V__::Error as ::serde::de::Error>::custom(
9749                        format_args!("WaitForActiveShards can't be {kind:?}"),
9750                    )),
9751                }
9752            }
9753        }
9754        ::oxsearch_core::__private::deserialize_by_kind(deserializer, Shape)
9755    }
9756}
9757
9758impl ::core::convert::From<i32> for WaitForActiveShards {
9759    fn from(value: i32) -> Self {
9760        Self::Count(value)
9761    }
9762}
9763
9764impl ::core::convert::From<crate::WaitForActiveShardOptions> for WaitForActiveShards {
9765    fn from(value: crate::WaitForActiveShardOptions) -> Self {
9766        Self::Option(value)
9767    }
9768}
9769
9770#[derive(Clone, Debug, PartialEq, Eq, Hash)]
9771#[non_exhaustive]
9772pub enum WaitForEvents {
9773    /// `immediate`
9774    Immediate,
9775    /// `urgent`
9776    Urgent,
9777    /// `high`
9778    High,
9779    /// `normal`
9780    Normal,
9781    /// `low`
9782    Low,
9783    /// `languid`
9784    Languid,
9785    /// A value this version of the specification doesn't list.
9786    Raw(::std::string::String),
9787}
9788
9789impl WaitForEvents {
9790    /// The value as Elasticsearch writes it.
9791    pub fn as_str(&self) -> &str {
9792        match self {
9793            Self::Immediate => "immediate",
9794            Self::Urgent => "urgent",
9795            Self::High => "high",
9796            Self::Normal => "normal",
9797            Self::Low => "low",
9798            Self::Languid => "languid",
9799            Self::Raw(value) => value,
9800        }
9801    }
9802
9803    /// The listed value with this name, if there is one.
9804    pub fn from_known(value: &str) -> ::core::option::Option<Self> {
9805        match value {
9806            "immediate" => ::core::option::Option::Some(Self::Immediate),
9807            "urgent" => ::core::option::Option::Some(Self::Urgent),
9808            "high" => ::core::option::Option::Some(Self::High),
9809            "normal" => ::core::option::Option::Some(Self::Normal),
9810            "low" => ::core::option::Option::Some(Self::Low),
9811            "languid" => ::core::option::Option::Some(Self::Languid),
9812            _ => ::core::option::Option::None,
9813        }
9814    }
9815}
9816
9817impl ::serde::Serialize for WaitForEvents {
9818    fn serialize<S__: ::serde::Serializer>(
9819        &self,
9820        serializer: S__,
9821    ) -> ::core::result::Result<S__::Ok, S__::Error> {
9822        serializer.serialize_str(self.as_str())
9823    }
9824}
9825
9826impl<'de> ::serde::Deserialize<'de> for WaitForEvents {
9827    fn deserialize<D__: ::serde::Deserializer<'de>>(
9828        deserializer: D__,
9829    ) -> ::core::result::Result<Self, D__::Error> {
9830        ::oxsearch_core::__private::deserialize_string_enum(
9831            deserializer,
9832            "WaitForEvents",
9833            |value| Self::from_known(value).unwrap_or_else(|| Self::Raw(value.to_owned())),
9834        )
9835    }
9836}
9837
9838#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
9839#[non_exhaustive]
9840pub struct WarmerStats {
9841    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
9842    pub current: ::core::option::Option<i64>,
9843    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
9844    pub total: ::core::option::Option<i64>,
9845    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
9846    pub total_time: ::core::option::Option<crate::Duration>,
9847    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
9848    pub total_time_in_millis: ::core::option::Option<crate::UnitMillis>,
9849}
9850
9851impl WarmerStats {
9852    /// A `WarmerStats` with its required properties set.
9853    pub fn new(
9854        current: i64,
9855        total: i64,
9856        total_time_in_millis: impl ::core::convert::Into<crate::UnitMillis>,
9857    ) -> Self {
9858        Self {
9859            current: ::core::option::Option::Some(current.into()),
9860            total: ::core::option::Option::Some(total.into()),
9861            total_time: ::core::option::Option::None,
9862            total_time_in_millis: ::core::option::Option::Some(total_time_in_millis.into()),
9863        }
9864    }
9865}
9866
9867impl WarmerStats {
9868    /// Sets `total_time`.
9869    pub fn total_time(mut self, value: impl ::core::convert::Into<crate::Duration>) -> Self {
9870        self.total_time = ::core::option::Option::Some(value.into());
9871        self
9872    }
9873}
9874
9875#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
9876#[non_exhaustive]
9877pub struct WktGeoBounds {
9878    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
9879    pub wkt: ::core::option::Option<::std::string::String>,
9880}
9881
9882impl WktGeoBounds {
9883    /// A `WktGeoBounds` with its required properties set.
9884    pub fn new(wkt: impl ::core::convert::Into<::std::string::String>) -> Self {
9885        Self {
9886            wkt: ::core::option::Option::Some(wkt.into()),
9887        }
9888    }
9889}
9890
9891impl WktGeoBounds {}
9892
9893#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
9894#[non_exhaustive]
9895pub struct WriteResponseBase {
9896    /// The unique identifier for the added document.
9897    #[serde(
9898        rename = "_id",
9899        skip_serializing_if = "::core::option::Option::is_none"
9900    )]
9901    pub id: ::core::option::Option<crate::Id>,
9902    /// The name of the index the document was added to.
9903    #[serde(
9904        rename = "_index",
9905        skip_serializing_if = "::core::option::Option::is_none"
9906    )]
9907    pub index: ::core::option::Option<crate::IndexName>,
9908    /// The primary term assigned to the document for the indexing operation.
9909    #[serde(
9910        rename = "_primary_term",
9911        skip_serializing_if = "::core::option::Option::is_none"
9912    )]
9913    pub primary_term: ::core::option::Option<i64>,
9914    /// The result of the indexing operation: `created` or `updated`.
9915    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
9916    pub result: ::core::option::Option<crate::Result>,
9917    /// The sequence number assigned to the document for the indexing operation.
9918    /// Sequence numbers are used to ensure an older version of a document doesn't overwrite a newer version.
9919    #[serde(
9920        rename = "_seq_no",
9921        skip_serializing_if = "::core::option::Option::is_none"
9922    )]
9923    pub seq_no: ::core::option::Option<crate::SequenceNumber>,
9924    /// Information about the replication process of the operation.
9925    #[serde(
9926        rename = "_shards",
9927        skip_serializing_if = "::core::option::Option::is_none"
9928    )]
9929    pub shards: ::core::option::Option<crate::ShardStatistics>,
9930    /// The document version, which is incremented each time the document is updated.
9931    #[serde(
9932        rename = "_version",
9933        skip_serializing_if = "::core::option::Option::is_none"
9934    )]
9935    pub version: ::core::option::Option<crate::VersionNumber>,
9936    /// The role of the failure store in this document response
9937    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
9938    pub failure_store: ::core::option::Option<crate::bulk::FailureStoreStatus>,
9939    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
9940    pub forced_refresh: ::core::option::Option<bool>,
9941}
9942
9943impl WriteResponseBase {
9944    /// A `WriteResponseBase` with its required properties set.
9945    pub fn new(
9946        id: impl ::core::convert::Into<crate::Id>,
9947        index: impl ::core::convert::Into<crate::IndexName>,
9948        result: impl ::core::convert::Into<crate::Result>,
9949        shards: impl ::core::convert::Into<crate::ShardStatistics>,
9950        version: impl ::core::convert::Into<crate::VersionNumber>,
9951    ) -> Self {
9952        Self {
9953            id: ::core::option::Option::Some(id.into()),
9954            index: ::core::option::Option::Some(index.into()),
9955            primary_term: ::core::option::Option::None,
9956            result: ::core::option::Option::Some(result.into()),
9957            seq_no: ::core::option::Option::None,
9958            shards: ::core::option::Option::Some(shards.into()),
9959            version: ::core::option::Option::Some(version.into()),
9960            failure_store: ::core::option::Option::None,
9961            forced_refresh: ::core::option::Option::None,
9962        }
9963    }
9964}
9965
9966impl WriteResponseBase {
9967    /// Sets `primary_term`.
9968    pub fn primary_term(mut self, value: i64) -> Self {
9969        self.primary_term = ::core::option::Option::Some(value.into());
9970        self
9971    }
9972    /// Sets `seq_no`.
9973    pub fn seq_no(mut self, value: impl ::core::convert::Into<crate::SequenceNumber>) -> Self {
9974        self.seq_no = ::core::option::Option::Some(value.into());
9975        self
9976    }
9977    /// Sets `failure_store`.
9978    pub fn failure_store(
9979        mut self,
9980        value: impl ::core::convert::Into<crate::bulk::FailureStoreStatus>,
9981    ) -> Self {
9982        self.failure_store = ::core::option::Option::Some(value.into());
9983        self
9984    }
9985    /// Sets `forced_refresh`.
9986    pub fn forced_refresh(mut self, value: bool) -> Self {
9987        self.forced_refresh = ::core::option::Option::Some(value.into());
9988        self
9989    }
9990}