Skip to main content

oxsearch_core/generated/
query_dsl.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#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
5#[non_exhaustive]
6pub struct BoolQuery {
7    /// Floating point number used to decrease or increase the relevance scores of the query.
8    /// Boost values are relative to the default value of 1.0.
9    /// A boost value between 0 and 1.0 decreases the relevance score.
10    /// A value greater than 1.0 increases the relevance score.
11    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
12    pub boost: ::core::option::Option<f32>,
13    #[serde(
14        rename = "_name",
15        skip_serializing_if = "::core::option::Option::is_none"
16    )]
17    pub name: ::core::option::Option<::std::string::String>,
18    /// The clause (query) must appear in matching documents.
19    /// However, unlike `must`, the score of the query will be ignored.
20    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
21    pub filter: ::core::option::Option<
22        ::oxsearch_core::shapes::OneOrMany<crate::query_dsl::QueryContainer>,
23    >,
24    /// Specifies the number or percentage of `should` clauses returned documents must match.
25    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
26    pub minimum_should_match: ::core::option::Option<crate::MinimumShouldMatch>,
27    /// The clause (query) must appear in matching documents and will contribute to the score.
28    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
29    pub must: ::core::option::Option<
30        ::oxsearch_core::shapes::OneOrMany<crate::query_dsl::QueryContainer>,
31    >,
32    /// The clause (query) must not appear in the matching documents.
33    /// Because scoring is ignored, a score of `0` is returned for all documents.
34    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
35    pub must_not: ::core::option::Option<
36        ::oxsearch_core::shapes::OneOrMany<crate::query_dsl::QueryContainer>,
37    >,
38    /// The clause (query) should appear in the matching document.
39    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
40    pub should: ::core::option::Option<
41        ::oxsearch_core::shapes::OneOrMany<crate::query_dsl::QueryContainer>,
42    >,
43}
44
45impl BoolQuery {
46    /// A `BoolQuery` with its required properties set.
47    pub fn new() -> Self {
48        Self {
49            boost: ::core::option::Option::None,
50            name: ::core::option::Option::None,
51            filter: ::core::option::Option::None,
52            minimum_should_match: ::core::option::Option::None,
53            must: ::core::option::Option::None,
54            must_not: ::core::option::Option::None,
55            should: ::core::option::Option::None,
56        }
57    }
58}
59
60impl BoolQuery {
61    /// Sets `boost`.
62    pub fn boost(mut self, value: f32) -> Self {
63        self.boost = ::core::option::Option::Some(value.into());
64        self
65    }
66    /// Sets `name`.
67    pub fn name(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
68        self.name = ::core::option::Option::Some(value.into());
69        self
70    }
71    /// Sets `filter`.
72    pub fn filter(
73        mut self,
74        value: impl ::core::convert::Into<
75            ::oxsearch_core::shapes::OneOrMany<crate::query_dsl::QueryContainer>,
76        >,
77    ) -> Self {
78        self.filter = ::core::option::Option::Some(value.into());
79        self
80    }
81    /// Sets `minimum_should_match`.
82    pub fn minimum_should_match(
83        mut self,
84        value: impl ::core::convert::Into<crate::MinimumShouldMatch>,
85    ) -> Self {
86        self.minimum_should_match = ::core::option::Option::Some(value.into());
87        self
88    }
89    /// Sets `must`.
90    pub fn must(
91        mut self,
92        value: impl ::core::convert::Into<
93            ::oxsearch_core::shapes::OneOrMany<crate::query_dsl::QueryContainer>,
94        >,
95    ) -> Self {
96        self.must = ::core::option::Option::Some(value.into());
97        self
98    }
99    /// Sets `must_not`.
100    pub fn must_not(
101        mut self,
102        value: impl ::core::convert::Into<
103            ::oxsearch_core::shapes::OneOrMany<crate::query_dsl::QueryContainer>,
104        >,
105    ) -> Self {
106        self.must_not = ::core::option::Option::Some(value.into());
107        self
108    }
109    /// Sets `should`.
110    pub fn should(
111        mut self,
112        value: impl ::core::convert::Into<
113            ::oxsearch_core::shapes::OneOrMany<crate::query_dsl::QueryContainer>,
114        >,
115    ) -> Self {
116        self.should = ::core::option::Option::Some(value.into());
117        self
118    }
119}
120
121#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
122#[non_exhaustive]
123pub struct BoostingQuery {
124    /// Floating point number used to decrease or increase the relevance scores of the query.
125    /// Boost values are relative to the default value of 1.0.
126    /// A boost value between 0 and 1.0 decreases the relevance score.
127    /// A value greater than 1.0 increases the relevance score.
128    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
129    pub boost: ::core::option::Option<f32>,
130    #[serde(
131        rename = "_name",
132        skip_serializing_if = "::core::option::Option::is_none"
133    )]
134    pub name: ::core::option::Option<::std::string::String>,
135    /// Floating point number between 0 and 1.0 used to decrease the relevance scores of documents matching the `negative` query.
136    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
137    pub negative_boost: ::core::option::Option<f64>,
138    /// Query used to decrease the relevance score of matching documents.
139    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
140    pub negative: ::core::option::Option<crate::query_dsl::QueryContainer>,
141    /// Any returned documents must match this query.
142    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
143    pub positive: ::core::option::Option<crate::query_dsl::QueryContainer>,
144}
145
146impl BoostingQuery {
147    /// A `BoostingQuery` with its required properties set.
148    pub fn new(
149        negative_boost: f64,
150        negative: impl ::core::convert::Into<crate::query_dsl::QueryContainer>,
151        positive: impl ::core::convert::Into<crate::query_dsl::QueryContainer>,
152    ) -> Self {
153        Self {
154            boost: ::core::option::Option::None,
155            name: ::core::option::Option::None,
156            negative_boost: ::core::option::Option::Some(negative_boost.into()),
157            negative: ::core::option::Option::Some(negative.into()),
158            positive: ::core::option::Option::Some(positive.into()),
159        }
160    }
161}
162
163impl BoostingQuery {
164    /// Sets `boost`.
165    pub fn boost(mut self, value: f32) -> Self {
166        self.boost = ::core::option::Option::Some(value.into());
167        self
168    }
169    /// Sets `name`.
170    pub fn name(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
171        self.name = ::core::option::Option::Some(value.into());
172        self
173    }
174}
175
176#[derive(Clone, Debug, PartialEq, Eq, Hash)]
177#[non_exhaustive]
178pub enum ChildScoreMode {
179    /// `none`
180    None,
181    /// `avg`
182    Avg,
183    /// `sum`
184    Sum,
185    /// `max`
186    Max,
187    /// `min`
188    Min,
189    /// A value this version of the specification doesn't list.
190    Raw(::std::string::String),
191}
192
193impl ChildScoreMode {
194    /// The value as Elasticsearch writes it.
195    pub fn as_str(&self) -> &str {
196        match self {
197            Self::None => "none",
198            Self::Avg => "avg",
199            Self::Sum => "sum",
200            Self::Max => "max",
201            Self::Min => "min",
202            Self::Raw(value) => value,
203        }
204    }
205
206    /// The listed value with this name, if there is one.
207    pub fn from_known(value: &str) -> ::core::option::Option<Self> {
208        match value {
209            "none" => ::core::option::Option::Some(Self::None),
210            "avg" => ::core::option::Option::Some(Self::Avg),
211            "sum" => ::core::option::Option::Some(Self::Sum),
212            "max" => ::core::option::Option::Some(Self::Max),
213            "min" => ::core::option::Option::Some(Self::Min),
214            _ => ::core::option::Option::None,
215        }
216    }
217}
218
219impl ::serde::Serialize for ChildScoreMode {
220    fn serialize<S__: ::serde::Serializer>(
221        &self,
222        serializer: S__,
223    ) -> ::core::result::Result<S__::Ok, S__::Error> {
224        serializer.serialize_str(self.as_str())
225    }
226}
227
228impl<'de> ::serde::Deserialize<'de> for ChildScoreMode {
229    fn deserialize<D__: ::serde::Deserializer<'de>>(
230        deserializer: D__,
231    ) -> ::core::result::Result<Self, D__::Error> {
232        ::oxsearch_core::__private::deserialize_string_enum(
233            deserializer,
234            "ChildScoreMode",
235            |value| Self::from_known(value).unwrap_or_else(|| Self::Raw(value.to_owned())),
236        )
237    }
238}
239
240#[derive(Clone, Debug, PartialEq, Eq, Hash)]
241#[non_exhaustive]
242pub enum CombinedFieldsOperator {
243    /// `or`
244    Or,
245    /// `and`
246    And,
247    /// A value this version of the specification doesn't list.
248    Raw(::std::string::String),
249}
250
251impl CombinedFieldsOperator {
252    /// The value as Elasticsearch writes it.
253    pub fn as_str(&self) -> &str {
254        match self {
255            Self::Or => "or",
256            Self::And => "and",
257            Self::Raw(value) => value,
258        }
259    }
260
261    /// The listed value with this name, if there is one.
262    pub fn from_known(value: &str) -> ::core::option::Option<Self> {
263        match value {
264            "or" => ::core::option::Option::Some(Self::Or),
265            "and" => ::core::option::Option::Some(Self::And),
266            _ => ::core::option::Option::None,
267        }
268    }
269}
270
271impl ::serde::Serialize for CombinedFieldsOperator {
272    fn serialize<S__: ::serde::Serializer>(
273        &self,
274        serializer: S__,
275    ) -> ::core::result::Result<S__::Ok, S__::Error> {
276        serializer.serialize_str(self.as_str())
277    }
278}
279
280impl<'de> ::serde::Deserialize<'de> for CombinedFieldsOperator {
281    fn deserialize<D__: ::serde::Deserializer<'de>>(
282        deserializer: D__,
283    ) -> ::core::result::Result<Self, D__::Error> {
284        ::oxsearch_core::__private::deserialize_string_enum(
285            deserializer,
286            "CombinedFieldsOperator",
287            |value| Self::from_known(value).unwrap_or_else(|| Self::Raw(value.to_owned())),
288        )
289    }
290}
291
292#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
293#[non_exhaustive]
294pub struct CombinedFieldsQuery {
295    /// Floating point number used to decrease or increase the relevance scores of the query.
296    /// Boost values are relative to the default value of 1.0.
297    /// A boost value between 0 and 1.0 decreases the relevance score.
298    /// A value greater than 1.0 increases the relevance score.
299    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
300    pub boost: ::core::option::Option<f32>,
301    #[serde(
302        rename = "_name",
303        skip_serializing_if = "::core::option::Option::is_none"
304    )]
305    pub name: ::core::option::Option<::std::string::String>,
306    /// List of fields to search. Field wildcard patterns are allowed. Only `text` fields are supported, and they must all have the same search `analyzer`.
307    #[serde(default = "::core::default::Default::default")]
308    pub fields: ::std::vec::Vec<crate::Field>,
309    /// Text to search for in the provided `fields`.
310    /// The `combined_fields` query analyzes the provided text before performing a search.
311    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
312    pub query: ::core::option::Option<::std::string::String>,
313    /// If true, match phrase queries are automatically created for multi-term synonyms.
314    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
315    pub auto_generate_synonyms_phrase_query: ::core::option::Option<bool>,
316    /// Boolean logic used to interpret text in the query value.
317    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
318    pub operator: ::core::option::Option<crate::query_dsl::CombinedFieldsOperator>,
319    /// Minimum number of clauses that must match for a document to be returned.
320    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
321    pub minimum_should_match: ::core::option::Option<crate::MinimumShouldMatch>,
322    /// Indicates whether no documents are returned if the analyzer removes all tokens, such as when using a `stop` filter.
323    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
324    pub zero_terms_query: ::core::option::Option<crate::query_dsl::CombinedFieldsZeroTerms>,
325}
326
327impl CombinedFieldsQuery {
328    /// A `CombinedFieldsQuery` with its required properties set.
329    pub fn new(
330        fields: impl ::core::convert::Into<::std::vec::Vec<crate::Field>>,
331        query: impl ::core::convert::Into<::std::string::String>,
332    ) -> Self {
333        Self {
334            boost: ::core::option::Option::None,
335            name: ::core::option::Option::None,
336            fields: fields.into(),
337            query: ::core::option::Option::Some(query.into()),
338            auto_generate_synonyms_phrase_query: ::core::option::Option::None,
339            operator: ::core::option::Option::None,
340            minimum_should_match: ::core::option::Option::None,
341            zero_terms_query: ::core::option::Option::None,
342        }
343    }
344}
345
346impl CombinedFieldsQuery {
347    /// Sets `boost`.
348    pub fn boost(mut self, value: f32) -> Self {
349        self.boost = ::core::option::Option::Some(value.into());
350        self
351    }
352    /// Sets `name`.
353    pub fn name(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
354        self.name = ::core::option::Option::Some(value.into());
355        self
356    }
357    /// Sets `auto_generate_synonyms_phrase_query`.
358    pub fn auto_generate_synonyms_phrase_query(mut self, value: bool) -> Self {
359        self.auto_generate_synonyms_phrase_query = ::core::option::Option::Some(value.into());
360        self
361    }
362    /// Sets `operator`.
363    pub fn operator(
364        mut self,
365        value: impl ::core::convert::Into<crate::query_dsl::CombinedFieldsOperator>,
366    ) -> Self {
367        self.operator = ::core::option::Option::Some(value.into());
368        self
369    }
370    /// Sets `minimum_should_match`.
371    pub fn minimum_should_match(
372        mut self,
373        value: impl ::core::convert::Into<crate::MinimumShouldMatch>,
374    ) -> Self {
375        self.minimum_should_match = ::core::option::Option::Some(value.into());
376        self
377    }
378    /// Sets `zero_terms_query`.
379    pub fn zero_terms_query(
380        mut self,
381        value: impl ::core::convert::Into<crate::query_dsl::CombinedFieldsZeroTerms>,
382    ) -> Self {
383        self.zero_terms_query = ::core::option::Option::Some(value.into());
384        self
385    }
386}
387
388#[derive(Clone, Debug, PartialEq, Eq, Hash)]
389#[non_exhaustive]
390pub enum CombinedFieldsZeroTerms {
391    /// No documents are returned if the analyzer removes all tokens.
392    None,
393    /// Returns all documents, similar to a `match_all` query.
394    All,
395    /// A value this version of the specification doesn't list.
396    Raw(::std::string::String),
397}
398
399impl CombinedFieldsZeroTerms {
400    /// The value as Elasticsearch writes it.
401    pub fn as_str(&self) -> &str {
402        match self {
403            Self::None => "none",
404            Self::All => "all",
405            Self::Raw(value) => value,
406        }
407    }
408
409    /// The listed value with this name, if there is one.
410    pub fn from_known(value: &str) -> ::core::option::Option<Self> {
411        match value {
412            "none" => ::core::option::Option::Some(Self::None),
413            "all" => ::core::option::Option::Some(Self::All),
414            _ => ::core::option::Option::None,
415        }
416    }
417}
418
419impl ::serde::Serialize for CombinedFieldsZeroTerms {
420    fn serialize<S__: ::serde::Serializer>(
421        &self,
422        serializer: S__,
423    ) -> ::core::result::Result<S__::Ok, S__::Error> {
424        serializer.serialize_str(self.as_str())
425    }
426}
427
428impl<'de> ::serde::Deserialize<'de> for CombinedFieldsZeroTerms {
429    fn deserialize<D__: ::serde::Deserializer<'de>>(
430        deserializer: D__,
431    ) -> ::core::result::Result<Self, D__::Error> {
432        ::oxsearch_core::__private::deserialize_string_enum(
433            deserializer,
434            "CombinedFieldsZeroTerms",
435            |value| Self::from_known(value).unwrap_or_else(|| Self::Raw(value.to_owned())),
436        )
437    }
438}
439
440#[derive(Clone, Debug, PartialEq)]
441#[non_exhaustive]
442pub struct CommonTermsQuery {
443    /// Floating point number used to decrease or increase the relevance scores of the query.
444    /// Boost values are relative to the default value of 1.0.
445    /// A boost value between 0 and 1.0 decreases the relevance score.
446    /// A value greater than 1.0 increases the relevance score.
447    pub boost: ::core::option::Option<f32>,
448    pub name: ::core::option::Option<::std::string::String>,
449    pub analyzer: ::core::option::Option<::std::string::String>,
450    pub cutoff_frequency: ::core::option::Option<f64>,
451    pub high_freq_operator: ::core::option::Option<crate::query_dsl::Operator>,
452    pub low_freq_operator: ::core::option::Option<crate::query_dsl::Operator>,
453    pub minimum_should_match: ::core::option::Option<crate::MinimumShouldMatch>,
454    pub query: ::core::option::Option<::std::string::String>,
455}
456
457impl CommonTermsQuery {
458    /// A `CommonTermsQuery` with its required properties set.
459    pub fn new(query: impl ::core::convert::Into<::std::string::String>) -> Self {
460        Self {
461            boost: ::core::option::Option::None,
462            name: ::core::option::Option::None,
463            analyzer: ::core::option::Option::None,
464            cutoff_frequency: ::core::option::Option::None,
465            high_freq_operator: ::core::option::Option::None,
466            low_freq_operator: ::core::option::Option::None,
467            minimum_should_match: ::core::option::Option::None,
468            query: ::core::option::Option::Some(query.into()),
469        }
470    }
471}
472
473impl CommonTermsQuery {
474    /// Sets `boost`.
475    pub fn boost(mut self, value: f32) -> Self {
476        self.boost = ::core::option::Option::Some(value.into());
477        self
478    }
479    /// Sets `name`.
480    pub fn name(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
481        self.name = ::core::option::Option::Some(value.into());
482        self
483    }
484    /// Sets `analyzer`.
485    pub fn analyzer(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
486        self.analyzer = ::core::option::Option::Some(value.into());
487        self
488    }
489    /// Sets `cutoff_frequency`.
490    pub fn cutoff_frequency(mut self, value: f64) -> Self {
491        self.cutoff_frequency = ::core::option::Option::Some(value.into());
492        self
493    }
494    /// Sets `high_freq_operator`.
495    pub fn high_freq_operator(
496        mut self,
497        value: impl ::core::convert::Into<crate::query_dsl::Operator>,
498    ) -> Self {
499        self.high_freq_operator = ::core::option::Option::Some(value.into());
500        self
501    }
502    /// Sets `low_freq_operator`.
503    pub fn low_freq_operator(
504        mut self,
505        value: impl ::core::convert::Into<crate::query_dsl::Operator>,
506    ) -> Self {
507        self.low_freq_operator = ::core::option::Option::Some(value.into());
508        self
509    }
510    /// Sets `minimum_should_match`.
511    pub fn minimum_should_match(
512        mut self,
513        value: impl ::core::convert::Into<crate::MinimumShouldMatch>,
514    ) -> Self {
515        self.minimum_should_match = ::core::option::Option::Some(value.into());
516        self
517    }
518}
519
520#[derive(::serde::Serialize, ::serde::Deserialize)]
521#[serde(remote = "CommonTermsQuery")]
522struct CommonTermsQueryDef {
523    /// Floating point number used to decrease or increase the relevance scores of the query.
524    /// Boost values are relative to the default value of 1.0.
525    /// A boost value between 0 and 1.0 decreases the relevance score.
526    /// A value greater than 1.0 increases the relevance score.
527    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
528    boost: ::core::option::Option<f32>,
529    #[serde(
530        rename = "_name",
531        skip_serializing_if = "::core::option::Option::is_none"
532    )]
533    name: ::core::option::Option<::std::string::String>,
534    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
535    analyzer: ::core::option::Option<::std::string::String>,
536    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
537    cutoff_frequency: ::core::option::Option<f64>,
538    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
539    high_freq_operator: ::core::option::Option<crate::query_dsl::Operator>,
540    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
541    low_freq_operator: ::core::option::Option<crate::query_dsl::Operator>,
542    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
543    minimum_should_match: ::core::option::Option<crate::MinimumShouldMatch>,
544    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
545    query: ::core::option::Option<::std::string::String>,
546}
547
548impl ::serde::Serialize for CommonTermsQuery {
549    fn serialize<S__: ::serde::Serializer>(
550        &self,
551        serializer: S__,
552    ) -> ::core::result::Result<S__::Ok, S__::Error> {
553        if let (::core::option::Option::Some(short), true) = (
554            &self.query,
555            self.boost.is_none()
556                && self.name.is_none()
557                && self.analyzer.is_none()
558                && self.cutoff_frequency.is_none()
559                && self.high_freq_operator.is_none()
560                && self.low_freq_operator.is_none()
561                && self.minimum_should_match.is_none(),
562        ) {
563            return ::serde::Serialize::serialize(short, serializer);
564        }
565        CommonTermsQueryDef::serialize(self, serializer)
566    }
567}
568
569impl<'de> ::oxsearch_core::__private::Shorthand<'de> for CommonTermsQuery {
570    type Short = ::std::string::String;
571    fn from_short(short: ::std::string::String) -> Self {
572        Self {
573            boost: ::core::option::Option::None,
574            name: ::core::option::Option::None,
575            analyzer: ::core::option::Option::None,
576            cutoff_frequency: ::core::option::Option::None,
577            high_freq_operator: ::core::option::Option::None,
578            low_freq_operator: ::core::option::Option::None,
579            minimum_should_match: ::core::option::Option::None,
580            query: ::core::option::Option::Some(short),
581        }
582    }
583    fn deserialize_full<D__: ::serde::Deserializer<'de>>(
584        deserializer: D__,
585    ) -> ::core::result::Result<Self, D__::Error> {
586        CommonTermsQueryDef::deserialize(deserializer)
587    }
588}
589
590impl<'de> ::serde::Deserialize<'de> for CommonTermsQuery {
591    fn deserialize<D__: ::serde::Deserializer<'de>>(
592        deserializer: D__,
593    ) -> ::core::result::Result<Self, D__::Error> {
594        ::oxsearch_core::__private::deserialize_shorthand(deserializer)
595    }
596}
597
598#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
599#[non_exhaustive]
600pub struct ConstantScoreQuery {
601    /// Floating point number used to decrease or increase the relevance scores of the query.
602    /// Boost values are relative to the default value of 1.0.
603    /// A boost value between 0 and 1.0 decreases the relevance score.
604    /// A value greater than 1.0 increases the relevance score.
605    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
606    pub boost: ::core::option::Option<f32>,
607    #[serde(
608        rename = "_name",
609        skip_serializing_if = "::core::option::Option::is_none"
610    )]
611    pub name: ::core::option::Option<::std::string::String>,
612    /// Filter query you wish to run. Any returned documents must match this query.
613    /// Filter queries do not calculate relevance scores.
614    /// To speed up performance, Elasticsearch automatically caches frequently used filter queries.
615    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
616    pub filter: ::core::option::Option<crate::query_dsl::QueryContainer>,
617}
618
619impl ConstantScoreQuery {
620    /// A `ConstantScoreQuery` with its required properties set.
621    pub fn new(filter: impl ::core::convert::Into<crate::query_dsl::QueryContainer>) -> Self {
622        Self {
623            boost: ::core::option::Option::None,
624            name: ::core::option::Option::None,
625            filter: ::core::option::Option::Some(filter.into()),
626        }
627    }
628}
629
630impl ConstantScoreQuery {
631    /// Sets `boost`.
632    pub fn boost(mut self, value: f32) -> Self {
633        self.boost = ::core::option::Option::Some(value.into());
634        self
635    }
636    /// Sets `name`.
637    pub fn name(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
638        self.name = ::core::option::Option::Some(value.into());
639        self
640    }
641}
642
643#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
644#[serde(try_from = "DateDecayFunctionRepr", into = "DateDecayFunctionRepr")]
645#[non_exhaustive]
646pub struct DateDecayFunction {
647    /// Determines how the distance is calculated when a field used for computing the decay contains multiple values.
648    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
649    pub multi_value_mode: ::core::option::Option<crate::query_dsl::MultiValueMode>,
650    /// The name of the property that holds `placement`.
651    pub field: crate::Field,
652    /// The value under `field`.
653    pub placement: crate::query_dsl::DecayPlacement<crate::DateMath, crate::Duration>,
654}
655
656impl DateDecayFunction {
657    /// A `DateDecayFunction` with its required properties set.
658    pub fn new(
659        field: impl ::core::convert::Into<crate::Field>,
660        placement: impl ::core::convert::Into<
661            crate::query_dsl::DecayPlacement<crate::DateMath, crate::Duration>,
662        >,
663    ) -> Self {
664        Self {
665            multi_value_mode: ::core::option::Option::None,
666            field: field.into(),
667            placement: placement.into(),
668        }
669    }
670}
671
672impl DateDecayFunction {
673    /// Sets `multi_value_mode`.
674    pub fn multi_value_mode(
675        mut self,
676        value: impl ::core::convert::Into<crate::query_dsl::MultiValueMode>,
677    ) -> Self {
678        self.multi_value_mode = ::core::option::Option::Some(value.into());
679        self
680    }
681}
682
683#[derive(::serde::Serialize, ::serde::Deserialize)]
684struct DateDecayFunctionRepr {
685    /// Determines how the distance is calculated when a field used for computing the decay contains multiple values.
686    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
687    multi_value_mode: ::core::option::Option<crate::query_dsl::MultiValueMode>,
688    #[serde(flatten)]
689    keyed__: ::indexmap::IndexMap<
690        crate::Field,
691        crate::query_dsl::DecayPlacement<crate::DateMath, crate::Duration>,
692    >,
693}
694
695impl ::core::convert::TryFrom<DateDecayFunctionRepr> for DateDecayFunction {
696    type Error = ::std::string::String;
697    fn try_from(repr: DateDecayFunctionRepr) -> ::core::result::Result<Self, Self::Error> {
698        let mut keyed = repr.keyed__.into_iter();
699        match (keyed.next(), keyed.next()) {
700            (::core::option::Option::Some((field, placement)), ::core::option::Option::None) => {
701                ::core::result::Result::Ok(Self {
702                    multi_value_mode: repr.multi_value_mode,
703                    field,
704                    placement,
705                })
706            }
707            _ => ::core::result::Result::Err(::std::string::String::from(
708                "DateDecayFunction needs exactly one property keyed by its field",
709            )),
710        }
711    }
712}
713
714impl ::core::convert::From<DateDecayFunction> for DateDecayFunctionRepr {
715    fn from(value: DateDecayFunction) -> Self {
716        let mut keyed__ = ::indexmap::IndexMap::new();
717        keyed__.insert(value.field, value.placement);
718        Self {
719            multi_value_mode: value.multi_value_mode,
720            keyed__,
721        }
722    }
723}
724
725#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
726#[non_exhaustive]
727pub struct DateDistanceFeatureQuery {
728    /// Floating point number used to decrease or increase the relevance scores of the query.
729    /// Boost values are relative to the default value of 1.0.
730    /// A boost value between 0 and 1.0 decreases the relevance score.
731    /// A value greater than 1.0 increases the relevance score.
732    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
733    pub boost: ::core::option::Option<f32>,
734    #[serde(
735        rename = "_name",
736        skip_serializing_if = "::core::option::Option::is_none"
737    )]
738    pub name: ::core::option::Option<::std::string::String>,
739    /// Date or point of origin used to calculate distances.
740    /// If the `field` value is a `date` or `date_nanos` field, the `origin` value must be a date.
741    /// Date Math, such as `now-1h`, is supported.
742    /// If the field value is a `geo_point` field, the `origin` value must be a geopoint.
743    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
744    pub origin: ::core::option::Option<crate::DateMath>,
745    /// Distance from the `origin` at which relevance scores receive half of the `boost` value.
746    /// If the `field` value is a `date` or `date_nanos` field, the `pivot` value must be a time unit, such as `1h` or `10d`. If the `field` value is a `geo_point` field, the `pivot` value must be a distance unit, such as `1km` or `12m`.
747    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
748    pub pivot: ::core::option::Option<crate::Duration>,
749    /// Name of the field used to calculate distances. This field must meet the following criteria:
750    /// be a `date`, `date_nanos` or `geo_point` field;
751    /// have an `index` mapping parameter value of `true`, which is the default;
752    /// have an `doc_values` mapping parameter value of `true`, which is the default.
753    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
754    pub field: ::core::option::Option<crate::Field>,
755}
756
757impl DateDistanceFeatureQuery {
758    /// A `DateDistanceFeatureQuery` with its required properties set.
759    pub fn new(
760        origin: impl ::core::convert::Into<crate::DateMath>,
761        pivot: impl ::core::convert::Into<crate::Duration>,
762        field: impl ::core::convert::Into<crate::Field>,
763    ) -> Self {
764        Self {
765            boost: ::core::option::Option::None,
766            name: ::core::option::Option::None,
767            origin: ::core::option::Option::Some(origin.into()),
768            pivot: ::core::option::Option::Some(pivot.into()),
769            field: ::core::option::Option::Some(field.into()),
770        }
771    }
772}
773
774impl DateDistanceFeatureQuery {
775    /// Sets `boost`.
776    pub fn boost(mut self, value: f32) -> Self {
777        self.boost = ::core::option::Option::Some(value.into());
778        self
779    }
780    /// Sets `name`.
781    pub fn name(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
782        self.name = ::core::option::Option::Some(value.into());
783        self
784    }
785}
786
787#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
788#[non_exhaustive]
789pub struct DateRangeQuery {
790    /// Floating point number used to decrease or increase the relevance scores of the query.
791    /// Boost values are relative to the default value of 1.0.
792    /// A boost value between 0 and 1.0 decreases the relevance score.
793    /// A value greater than 1.0 increases the relevance score.
794    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
795    pub boost: ::core::option::Option<f32>,
796    #[serde(
797        rename = "_name",
798        skip_serializing_if = "::core::option::Option::is_none"
799    )]
800    pub name: ::core::option::Option<::std::string::String>,
801    /// Indicates how the range query matches values for `range` fields.
802    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
803    pub relation: ::core::option::Option<crate::query_dsl::RangeRelation>,
804    /// Greater than.
805    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
806    pub gt: ::core::option::Option<crate::DateMath>,
807    /// Greater than or equal to.
808    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
809    pub gte: ::core::option::Option<crate::DateMath>,
810    /// Less than.
811    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
812    pub lt: ::core::option::Option<crate::DateMath>,
813    /// Less than or equal to.
814    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
815    pub lte: ::core::option::Option<crate::DateMath>,
816    /// Date format used to convert `date` values in the query.
817    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
818    pub format: ::core::option::Option<crate::DateFormat>,
819    /// Coordinated Universal Time (UTC) offset or IANA time zone used to convert `date` values in the query to UTC.
820    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
821    pub time_zone: ::core::option::Option<crate::TimeZone>,
822}
823
824impl DateRangeQuery {
825    /// A `DateRangeQuery` with its required properties set.
826    pub fn new() -> Self {
827        Self {
828            boost: ::core::option::Option::None,
829            name: ::core::option::Option::None,
830            relation: ::core::option::Option::None,
831            gt: ::core::option::Option::None,
832            gte: ::core::option::Option::None,
833            lt: ::core::option::Option::None,
834            lte: ::core::option::Option::None,
835            format: ::core::option::Option::None,
836            time_zone: ::core::option::Option::None,
837        }
838    }
839}
840
841impl DateRangeQuery {
842    /// Sets `boost`.
843    pub fn boost(mut self, value: f32) -> Self {
844        self.boost = ::core::option::Option::Some(value.into());
845        self
846    }
847    /// Sets `name`.
848    pub fn name(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
849        self.name = ::core::option::Option::Some(value.into());
850        self
851    }
852    /// Sets `relation`.
853    pub fn relation(
854        mut self,
855        value: impl ::core::convert::Into<crate::query_dsl::RangeRelation>,
856    ) -> Self {
857        self.relation = ::core::option::Option::Some(value.into());
858        self
859    }
860    /// Sets `gt`.
861    pub fn gt(mut self, value: impl ::core::convert::Into<crate::DateMath>) -> Self {
862        self.gt = ::core::option::Option::Some(value.into());
863        self
864    }
865    /// Sets `gte`.
866    pub fn gte(mut self, value: impl ::core::convert::Into<crate::DateMath>) -> Self {
867        self.gte = ::core::option::Option::Some(value.into());
868        self
869    }
870    /// Sets `lt`.
871    pub fn lt(mut self, value: impl ::core::convert::Into<crate::DateMath>) -> Self {
872        self.lt = ::core::option::Option::Some(value.into());
873        self
874    }
875    /// Sets `lte`.
876    pub fn lte(mut self, value: impl ::core::convert::Into<crate::DateMath>) -> Self {
877        self.lte = ::core::option::Option::Some(value.into());
878        self
879    }
880    /// Sets `format`.
881    pub fn format(mut self, value: impl ::core::convert::Into<crate::DateFormat>) -> Self {
882        self.format = ::core::option::Option::Some(value.into());
883        self
884    }
885    /// Sets `time_zone`.
886    pub fn time_zone(mut self, value: impl ::core::convert::Into<crate::TimeZone>) -> Self {
887        self.time_zone = ::core::option::Option::Some(value.into());
888        self
889    }
890}
891
892#[derive(Clone, Debug, PartialEq)]
893#[non_exhaustive]
894pub enum DecayFunction {
895    /// `untyped_decay_function`.
896    Untyped(crate::query_dsl::UntypedDecayFunction),
897    /// `date_decay_function`.
898    Date(crate::query_dsl::DateDecayFunction),
899    /// `numeric_decay_function`.
900    Numeric(crate::query_dsl::NumericDecayFunction),
901    /// `geo_decay_function`.
902    Geo(crate::query_dsl::GeoDecayFunction),
903}
904
905impl ::serde::Serialize for DecayFunction {
906    fn serialize<S__: ::serde::Serializer>(
907        &self,
908        serializer: S__,
909    ) -> ::core::result::Result<S__::Ok, S__::Error> {
910        match self {
911            Self::Untyped(value) => ::serde::Serialize::serialize(value, serializer),
912            Self::Date(value) => ::serde::Serialize::serialize(value, serializer),
913            Self::Numeric(value) => ::serde::Serialize::serialize(value, serializer),
914            Self::Geo(value) => ::serde::Serialize::serialize(value, serializer),
915        }
916    }
917}
918
919impl<'de> ::serde::Deserialize<'de> for DecayFunction {
920    /// Always the untyped member, which keeps every property.
921    fn deserialize<D__: ::serde::Deserializer<'de>>(
922        deserializer: D__,
923    ) -> ::core::result::Result<Self, D__::Error> {
924        ::serde::Deserialize::deserialize(deserializer).map(Self::Untyped)
925    }
926}
927
928impl ::core::convert::From<crate::query_dsl::UntypedDecayFunction> for DecayFunction {
929    fn from(value: crate::query_dsl::UntypedDecayFunction) -> Self {
930        Self::Untyped(value)
931    }
932}
933
934impl ::core::convert::From<crate::query_dsl::DateDecayFunction> for DecayFunction {
935    fn from(value: crate::query_dsl::DateDecayFunction) -> Self {
936        Self::Date(value)
937    }
938}
939
940impl ::core::convert::From<crate::query_dsl::NumericDecayFunction> for DecayFunction {
941    fn from(value: crate::query_dsl::NumericDecayFunction) -> Self {
942        Self::Numeric(value)
943    }
944}
945
946impl ::core::convert::From<crate::query_dsl::GeoDecayFunction> for DecayFunction {
947    fn from(value: crate::query_dsl::GeoDecayFunction) -> Self {
948        Self::Geo(value)
949    }
950}
951
952#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
953#[serde(
954    try_from = "DecayFunctionBaseRepr<TOrigin, TScale>",
955    into = "DecayFunctionBaseRepr<TOrigin, TScale>"
956)]
957#[serde(bound(
958    serialize = "TOrigin: ::serde::Serialize + ::core::clone::Clone, TScale: ::serde::Serialize + ::core::clone::Clone"
959))]
960#[non_exhaustive]
961pub struct DecayFunctionBase<TOrigin = ::serde_json::Value, TScale = ::serde_json::Value> {
962    /// Determines how the distance is calculated when a field used for computing the decay contains multiple values.
963    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
964    pub multi_value_mode: ::core::option::Option<crate::query_dsl::MultiValueMode>,
965    /// The name of the property that holds `placement`.
966    pub field: crate::Field,
967    /// The value under `field`.
968    pub placement: crate::query_dsl::DecayPlacement<TOrigin, TScale>,
969}
970
971impl<TOrigin, TScale> DecayFunctionBase<TOrigin, TScale> {
972    /// A `DecayFunctionBase` with its required properties set.
973    pub fn new(
974        field: impl ::core::convert::Into<crate::Field>,
975        placement: impl ::core::convert::Into<crate::query_dsl::DecayPlacement<TOrigin, TScale>>,
976    ) -> Self {
977        Self {
978            multi_value_mode: ::core::option::Option::None,
979            field: field.into(),
980            placement: placement.into(),
981        }
982    }
983}
984
985impl<TOrigin, TScale> DecayFunctionBase<TOrigin, TScale> {
986    /// Sets `multi_value_mode`.
987    pub fn multi_value_mode(
988        mut self,
989        value: impl ::core::convert::Into<crate::query_dsl::MultiValueMode>,
990    ) -> Self {
991        self.multi_value_mode = ::core::option::Option::Some(value.into());
992        self
993    }
994}
995
996#[derive(::serde::Serialize, ::serde::Deserialize)]
997struct DecayFunctionBaseRepr<TOrigin = ::serde_json::Value, TScale = ::serde_json::Value> {
998    /// Determines how the distance is calculated when a field used for computing the decay contains multiple values.
999    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
1000    multi_value_mode: ::core::option::Option<crate::query_dsl::MultiValueMode>,
1001    #[serde(flatten)]
1002    keyed__: ::indexmap::IndexMap<crate::Field, crate::query_dsl::DecayPlacement<TOrigin, TScale>>,
1003}
1004
1005impl<TOrigin, TScale> ::core::convert::TryFrom<DecayFunctionBaseRepr<TOrigin, TScale>>
1006    for DecayFunctionBase<TOrigin, TScale>
1007{
1008    type Error = ::std::string::String;
1009    fn try_from(
1010        repr: DecayFunctionBaseRepr<TOrigin, TScale>,
1011    ) -> ::core::result::Result<Self, Self::Error> {
1012        let mut keyed = repr.keyed__.into_iter();
1013        match (keyed.next(), keyed.next()) {
1014            (::core::option::Option::Some((field, placement)), ::core::option::Option::None) => {
1015                ::core::result::Result::Ok(Self {
1016                    multi_value_mode: repr.multi_value_mode,
1017                    field,
1018                    placement,
1019                })
1020            }
1021            _ => ::core::result::Result::Err(::std::string::String::from(
1022                "DecayFunctionBase needs exactly one property keyed by its field",
1023            )),
1024        }
1025    }
1026}
1027
1028impl<TOrigin, TScale> ::core::convert::From<DecayFunctionBase<TOrigin, TScale>>
1029    for DecayFunctionBaseRepr<TOrigin, TScale>
1030{
1031    fn from(value: DecayFunctionBase<TOrigin, TScale>) -> Self {
1032        let mut keyed__ = ::indexmap::IndexMap::new();
1033        keyed__.insert(value.field, value.placement);
1034        Self {
1035            multi_value_mode: value.multi_value_mode,
1036            keyed__,
1037        }
1038    }
1039}
1040
1041#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
1042#[non_exhaustive]
1043pub struct DecayPlacement<TOrigin = ::serde_json::Value, TScale = ::serde_json::Value> {
1044    /// Defines how documents are scored at the distance given at scale.
1045    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
1046    pub decay: ::core::option::Option<f64>,
1047    /// If defined, the decay function will only compute the decay function for documents with a distance greater than the defined `offset`.
1048    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
1049    pub offset: ::core::option::Option<TScale>,
1050    /// Defines the distance from origin + offset at which the computed score will equal `decay` parameter.
1051    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
1052    pub scale: ::core::option::Option<TScale>,
1053    /// The point of origin used for calculating distance. Must be given as a number for numeric field, date for date fields and geo point for geo fields.
1054    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
1055    pub origin: ::core::option::Option<TOrigin>,
1056}
1057
1058impl DecayPlacement<::serde_json::Value, ::serde_json::Value> {
1059    /// A `DecayPlacement` with its required properties set.
1060    pub fn new() -> Self {
1061        Self {
1062            decay: ::core::option::Option::None,
1063            offset: ::core::option::Option::None,
1064            scale: ::core::option::Option::None,
1065            origin: ::core::option::Option::None,
1066        }
1067    }
1068}
1069
1070impl<TOrigin, TScale> DecayPlacement<TOrigin, TScale> {
1071    /// Sets `decay`.
1072    pub fn decay(mut self, value: f64) -> Self {
1073        self.decay = ::core::option::Option::Some(value.into());
1074        self
1075    }
1076    /// Sets `offset`.
1077    pub fn offset(mut self, value: TScale) -> Self {
1078        self.offset = ::core::option::Option::Some(value.into());
1079        self
1080    }
1081    /// Sets `scale`.
1082    pub fn scale(mut self, value: TScale) -> Self {
1083        self.scale = ::core::option::Option::Some(value.into());
1084        self
1085    }
1086    /// Sets `origin`.
1087    pub fn origin<TOrigin2>(self, value: TOrigin2) -> DecayPlacement<TOrigin2, TScale> {
1088        DecayPlacement {
1089            decay: self.decay,
1090            offset: self.offset,
1091            scale: self.scale,
1092            origin: ::core::option::Option::Some(value.into()),
1093        }
1094    }
1095}
1096
1097#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
1098#[non_exhaustive]
1099pub struct DisMaxQuery {
1100    /// Floating point number used to decrease or increase the relevance scores of the query.
1101    /// Boost values are relative to the default value of 1.0.
1102    /// A boost value between 0 and 1.0 decreases the relevance score.
1103    /// A value greater than 1.0 increases the relevance score.
1104    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
1105    pub boost: ::core::option::Option<f32>,
1106    #[serde(
1107        rename = "_name",
1108        skip_serializing_if = "::core::option::Option::is_none"
1109    )]
1110    pub name: ::core::option::Option<::std::string::String>,
1111    /// One or more query clauses.
1112    /// Returned documents must match one or more of these queries.
1113    /// If a document matches multiple queries, Elasticsearch uses the highest relevance score.
1114    #[serde(default = "::core::default::Default::default")]
1115    pub queries: ::std::vec::Vec<crate::query_dsl::QueryContainer>,
1116    /// Floating point number between 0 and 1.0 used to increase the relevance scores of documents matching multiple query clauses.
1117    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
1118    pub tie_breaker: ::core::option::Option<f64>,
1119}
1120
1121impl DisMaxQuery {
1122    /// A `DisMaxQuery` with its required properties set.
1123    pub fn new(
1124        queries: impl ::core::convert::Into<::std::vec::Vec<crate::query_dsl::QueryContainer>>,
1125    ) -> Self {
1126        Self {
1127            boost: ::core::option::Option::None,
1128            name: ::core::option::Option::None,
1129            queries: queries.into(),
1130            tie_breaker: ::core::option::Option::None,
1131        }
1132    }
1133}
1134
1135impl DisMaxQuery {
1136    /// Sets `boost`.
1137    pub fn boost(mut self, value: f32) -> Self {
1138        self.boost = ::core::option::Option::Some(value.into());
1139        self
1140    }
1141    /// Sets `name`.
1142    pub fn name(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
1143        self.name = ::core::option::Option::Some(value.into());
1144        self
1145    }
1146    /// Sets `tie_breaker`.
1147    pub fn tie_breaker(mut self, value: f64) -> Self {
1148        self.tie_breaker = ::core::option::Option::Some(value.into());
1149        self
1150    }
1151}
1152
1153#[derive(Clone, Debug, PartialEq)]
1154#[non_exhaustive]
1155pub enum DistanceFeatureQuery {
1156    /// `untyped_distance_feature_query`.
1157    Untyped(crate::query_dsl::UntypedDistanceFeatureQuery),
1158    /// `geo_distance_feature_query`.
1159    Geo(crate::query_dsl::GeoDistanceFeatureQuery),
1160    /// `date_distance_feature_query`.
1161    Date(crate::query_dsl::DateDistanceFeatureQuery),
1162}
1163
1164impl ::serde::Serialize for DistanceFeatureQuery {
1165    fn serialize<S__: ::serde::Serializer>(
1166        &self,
1167        serializer: S__,
1168    ) -> ::core::result::Result<S__::Ok, S__::Error> {
1169        match self {
1170            Self::Untyped(value) => ::serde::Serialize::serialize(value, serializer),
1171            Self::Geo(value) => ::serde::Serialize::serialize(value, serializer),
1172            Self::Date(value) => ::serde::Serialize::serialize(value, serializer),
1173        }
1174    }
1175}
1176
1177impl<'de> ::serde::Deserialize<'de> for DistanceFeatureQuery {
1178    /// Always the untyped member, which keeps every property.
1179    fn deserialize<D__: ::serde::Deserializer<'de>>(
1180        deserializer: D__,
1181    ) -> ::core::result::Result<Self, D__::Error> {
1182        ::serde::Deserialize::deserialize(deserializer).map(Self::Untyped)
1183    }
1184}
1185
1186impl ::core::convert::From<crate::query_dsl::UntypedDistanceFeatureQuery> for DistanceFeatureQuery {
1187    fn from(value: crate::query_dsl::UntypedDistanceFeatureQuery) -> Self {
1188        Self::Untyped(value)
1189    }
1190}
1191
1192impl ::core::convert::From<crate::query_dsl::GeoDistanceFeatureQuery> for DistanceFeatureQuery {
1193    fn from(value: crate::query_dsl::GeoDistanceFeatureQuery) -> Self {
1194        Self::Geo(value)
1195    }
1196}
1197
1198impl ::core::convert::From<crate::query_dsl::DateDistanceFeatureQuery> for DistanceFeatureQuery {
1199    fn from(value: crate::query_dsl::DateDistanceFeatureQuery) -> Self {
1200        Self::Date(value)
1201    }
1202}
1203
1204#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
1205#[non_exhaustive]
1206pub struct DistanceFeatureQueryBase<TOrigin = ::serde_json::Value, TDistance = ::serde_json::Value>
1207{
1208    /// Floating point number used to decrease or increase the relevance scores of the query.
1209    /// Boost values are relative to the default value of 1.0.
1210    /// A boost value between 0 and 1.0 decreases the relevance score.
1211    /// A value greater than 1.0 increases the relevance score.
1212    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
1213    pub boost: ::core::option::Option<f32>,
1214    #[serde(
1215        rename = "_name",
1216        skip_serializing_if = "::core::option::Option::is_none"
1217    )]
1218    pub name: ::core::option::Option<::std::string::String>,
1219    /// Date or point of origin used to calculate distances.
1220    /// If the `field` value is a `date` or `date_nanos` field, the `origin` value must be a date.
1221    /// Date Math, such as `now-1h`, is supported.
1222    /// If the field value is a `geo_point` field, the `origin` value must be a geopoint.
1223    pub origin: TOrigin,
1224    /// Distance from the `origin` at which relevance scores receive half of the `boost` value.
1225    /// If the `field` value is a `date` or `date_nanos` field, the `pivot` value must be a time unit, such as `1h` or `10d`. If the `field` value is a `geo_point` field, the `pivot` value must be a distance unit, such as `1km` or `12m`.
1226    pub pivot: TDistance,
1227    /// Name of the field used to calculate distances. This field must meet the following criteria:
1228    /// be a `date`, `date_nanos` or `geo_point` field;
1229    /// have an `index` mapping parameter value of `true`, which is the default;
1230    /// have an `doc_values` mapping parameter value of `true`, which is the default.
1231    pub field: crate::Field,
1232}
1233
1234impl<TOrigin, TDistance> DistanceFeatureQueryBase<TOrigin, TDistance> {
1235    /// A `DistanceFeatureQueryBase` with its required properties set.
1236    pub fn new(
1237        origin: TOrigin,
1238        pivot: TDistance,
1239        field: impl ::core::convert::Into<crate::Field>,
1240    ) -> Self {
1241        Self {
1242            boost: ::core::option::Option::None,
1243            name: ::core::option::Option::None,
1244            origin: origin.into(),
1245            pivot: pivot.into(),
1246            field: field.into(),
1247        }
1248    }
1249}
1250
1251impl<TOrigin, TDistance> DistanceFeatureQueryBase<TOrigin, TDistance> {
1252    /// Sets `boost`.
1253    pub fn boost(mut self, value: f32) -> Self {
1254        self.boost = ::core::option::Option::Some(value.into());
1255        self
1256    }
1257    /// Sets `name`.
1258    pub fn name(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
1259        self.name = ::core::option::Option::Some(value.into());
1260        self
1261    }
1262}
1263
1264#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
1265#[non_exhaustive]
1266pub struct ExistsQuery {
1267    /// Floating point number used to decrease or increase the relevance scores of the query.
1268    /// Boost values are relative to the default value of 1.0.
1269    /// A boost value between 0 and 1.0 decreases the relevance score.
1270    /// A value greater than 1.0 increases the relevance score.
1271    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
1272    pub boost: ::core::option::Option<f32>,
1273    #[serde(
1274        rename = "_name",
1275        skip_serializing_if = "::core::option::Option::is_none"
1276    )]
1277    pub name: ::core::option::Option<::std::string::String>,
1278    /// Name of the field you wish to search.
1279    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
1280    pub field: ::core::option::Option<crate::Field>,
1281}
1282
1283impl ExistsQuery {
1284    /// A `ExistsQuery` with its required properties set.
1285    pub fn new(field: impl ::core::convert::Into<crate::Field>) -> Self {
1286        Self {
1287            boost: ::core::option::Option::None,
1288            name: ::core::option::Option::None,
1289            field: ::core::option::Option::Some(field.into()),
1290        }
1291    }
1292}
1293
1294impl ExistsQuery {
1295    /// Sets `boost`.
1296    pub fn boost(mut self, value: f32) -> Self {
1297        self.boost = ::core::option::Option::Some(value.into());
1298        self
1299    }
1300    /// Sets `name`.
1301    pub fn name(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
1302        self.name = ::core::option::Option::Some(value.into());
1303        self
1304    }
1305}
1306
1307/// A reference to a field with formatting instructions on how to return the value
1308#[derive(Clone, Debug, PartialEq)]
1309#[non_exhaustive]
1310pub struct FieldAndFormat {
1311    /// A wildcard pattern. The request returns values for field names matching this pattern.
1312    pub field: ::core::option::Option<crate::Field>,
1313    /// The format in which the values are returned.
1314    pub format: ::core::option::Option<::std::string::String>,
1315    pub include_unmapped: ::core::option::Option<bool>,
1316}
1317
1318impl FieldAndFormat {
1319    /// A `FieldAndFormat` with its required properties set.
1320    pub fn new(field: impl ::core::convert::Into<crate::Field>) -> Self {
1321        Self {
1322            field: ::core::option::Option::Some(field.into()),
1323            format: ::core::option::Option::None,
1324            include_unmapped: ::core::option::Option::None,
1325        }
1326    }
1327}
1328
1329impl FieldAndFormat {
1330    /// Sets `format`.
1331    pub fn format(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
1332        self.format = ::core::option::Option::Some(value.into());
1333        self
1334    }
1335    /// Sets `include_unmapped`.
1336    pub fn include_unmapped(mut self, value: bool) -> Self {
1337        self.include_unmapped = ::core::option::Option::Some(value.into());
1338        self
1339    }
1340}
1341
1342#[derive(::serde::Serialize, ::serde::Deserialize)]
1343#[serde(remote = "FieldAndFormat")]
1344struct FieldAndFormatDef {
1345    /// A wildcard pattern. The request returns values for field names matching this pattern.
1346    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
1347    field: ::core::option::Option<crate::Field>,
1348    /// The format in which the values are returned.
1349    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
1350    format: ::core::option::Option<::std::string::String>,
1351    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
1352    include_unmapped: ::core::option::Option<bool>,
1353}
1354
1355impl ::serde::Serialize for FieldAndFormat {
1356    fn serialize<S__: ::serde::Serializer>(
1357        &self,
1358        serializer: S__,
1359    ) -> ::core::result::Result<S__::Ok, S__::Error> {
1360        if let (::core::option::Option::Some(short), true) = (
1361            &self.field,
1362            self.format.is_none() && self.include_unmapped.is_none(),
1363        ) {
1364            return ::serde::Serialize::serialize(short, serializer);
1365        }
1366        FieldAndFormatDef::serialize(self, serializer)
1367    }
1368}
1369
1370impl<'de> ::oxsearch_core::__private::Shorthand<'de> for FieldAndFormat {
1371    type Short = crate::Field;
1372    fn from_short(short: crate::Field) -> Self {
1373        Self {
1374            field: ::core::option::Option::Some(short),
1375            format: ::core::option::Option::None,
1376            include_unmapped: ::core::option::Option::None,
1377        }
1378    }
1379    fn deserialize_full<D__: ::serde::Deserializer<'de>>(
1380        deserializer: D__,
1381    ) -> ::core::result::Result<Self, D__::Error> {
1382        FieldAndFormatDef::deserialize(deserializer)
1383    }
1384}
1385
1386impl<'de> ::serde::Deserialize<'de> for FieldAndFormat {
1387    fn deserialize<D__: ::serde::Deserializer<'de>>(
1388        deserializer: D__,
1389    ) -> ::core::result::Result<Self, D__::Error> {
1390        ::oxsearch_core::__private::deserialize_shorthand(deserializer)
1391    }
1392}
1393
1394#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
1395#[non_exhaustive]
1396pub struct FieldLookup {
1397    /// `id` of the document.
1398    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
1399    pub id: ::core::option::Option<crate::Id>,
1400    /// Index from which to retrieve the document.
1401    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
1402    pub index: ::core::option::Option<crate::IndexName>,
1403    /// Name of the field.
1404    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
1405    pub path: ::core::option::Option<crate::Field>,
1406    /// Custom routing value.
1407    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
1408    pub routing: ::core::option::Option<::std::string::String>,
1409}
1410
1411impl FieldLookup {
1412    /// A `FieldLookup` with its required properties set.
1413    pub fn new(id: impl ::core::convert::Into<crate::Id>) -> Self {
1414        Self {
1415            id: ::core::option::Option::Some(id.into()),
1416            index: ::core::option::Option::None,
1417            path: ::core::option::Option::None,
1418            routing: ::core::option::Option::None,
1419        }
1420    }
1421}
1422
1423impl FieldLookup {
1424    /// Sets `index`.
1425    pub fn index(mut self, value: impl ::core::convert::Into<crate::IndexName>) -> Self {
1426        self.index = ::core::option::Option::Some(value.into());
1427        self
1428    }
1429    /// Sets `path`.
1430    pub fn path(mut self, value: impl ::core::convert::Into<crate::Field>) -> Self {
1431        self.path = ::core::option::Option::Some(value.into());
1432        self
1433    }
1434    /// Sets `routing`.
1435    pub fn routing(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
1436        self.routing = ::core::option::Option::Some(value.into());
1437        self
1438    }
1439}
1440
1441#[derive(Clone, Debug, PartialEq, Eq, Hash)]
1442#[non_exhaustive]
1443pub enum FieldValueFactorModifier {
1444    /// Do not apply any multiplier to the field value.
1445    None,
1446    /// Take the common logarithm of the field value.
1447    /// Because this function will return a negative value and cause an error if used on values between 0 and 1, it is recommended to use `log1p` instead.
1448    Log,
1449    /// Add 1 to the field value and take the common logarithm.
1450    Log1P,
1451    /// Add 2 to the field value and take the common logarithm.
1452    Log2P,
1453    /// Take the natural logarithm of the field value.
1454    /// Because this function will return a negative value and cause an error if used on values between 0 and 1, it is recommended to use `ln1p` instead.
1455    Ln,
1456    /// Add 1 to the field value and take the natural logarithm.
1457    Ln1P,
1458    /// Add 2 to the field value and take the natural logarithm.
1459    Ln2P,
1460    /// Square the field value (multiply it by itself).
1461    Square,
1462    /// Take the square root of the field value.
1463    Sqrt,
1464    /// Reciprocate the field value, same as `1/x` where `x` is the field’s value.
1465    Reciprocal,
1466    /// A value this version of the specification doesn't list.
1467    Raw(::std::string::String),
1468}
1469
1470impl FieldValueFactorModifier {
1471    /// The value as Elasticsearch writes it.
1472    pub fn as_str(&self) -> &str {
1473        match self {
1474            Self::None => "none",
1475            Self::Log => "log",
1476            Self::Log1P => "log1p",
1477            Self::Log2P => "log2p",
1478            Self::Ln => "ln",
1479            Self::Ln1P => "ln1p",
1480            Self::Ln2P => "ln2p",
1481            Self::Square => "square",
1482            Self::Sqrt => "sqrt",
1483            Self::Reciprocal => "reciprocal",
1484            Self::Raw(value) => value,
1485        }
1486    }
1487
1488    /// The listed value with this name, if there is one.
1489    pub fn from_known(value: &str) -> ::core::option::Option<Self> {
1490        match value {
1491            "none" => ::core::option::Option::Some(Self::None),
1492            "log" => ::core::option::Option::Some(Self::Log),
1493            "log1p" => ::core::option::Option::Some(Self::Log1P),
1494            "log2p" => ::core::option::Option::Some(Self::Log2P),
1495            "ln" => ::core::option::Option::Some(Self::Ln),
1496            "ln1p" => ::core::option::Option::Some(Self::Ln1P),
1497            "ln2p" => ::core::option::Option::Some(Self::Ln2P),
1498            "square" => ::core::option::Option::Some(Self::Square),
1499            "sqrt" => ::core::option::Option::Some(Self::Sqrt),
1500            "reciprocal" => ::core::option::Option::Some(Self::Reciprocal),
1501            _ => ::core::option::Option::None,
1502        }
1503    }
1504}
1505
1506impl ::serde::Serialize for FieldValueFactorModifier {
1507    fn serialize<S__: ::serde::Serializer>(
1508        &self,
1509        serializer: S__,
1510    ) -> ::core::result::Result<S__::Ok, S__::Error> {
1511        serializer.serialize_str(self.as_str())
1512    }
1513}
1514
1515impl<'de> ::serde::Deserialize<'de> for FieldValueFactorModifier {
1516    fn deserialize<D__: ::serde::Deserializer<'de>>(
1517        deserializer: D__,
1518    ) -> ::core::result::Result<Self, D__::Error> {
1519        ::oxsearch_core::__private::deserialize_string_enum(
1520            deserializer,
1521            "FieldValueFactorModifier",
1522            |value| Self::from_known(value).unwrap_or_else(|| Self::Raw(value.to_owned())),
1523        )
1524    }
1525}
1526
1527#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
1528#[non_exhaustive]
1529pub struct FieldValueFactorScoreFunction {
1530    /// Field to be extracted from the document.
1531    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
1532    pub field: ::core::option::Option<crate::Field>,
1533    /// Optional factor to multiply the field value with.
1534    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
1535    pub factor: ::core::option::Option<f64>,
1536    /// Value used if the document doesn’t have that field.
1537    /// The modifier and factor are still applied to it as though it were read from the document.
1538    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
1539    pub missing: ::core::option::Option<f64>,
1540    /// Modifier to apply to the field value.
1541    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
1542    pub modifier: ::core::option::Option<crate::query_dsl::FieldValueFactorModifier>,
1543}
1544
1545impl FieldValueFactorScoreFunction {
1546    /// A `FieldValueFactorScoreFunction` with its required properties set.
1547    pub fn new(field: impl ::core::convert::Into<crate::Field>) -> Self {
1548        Self {
1549            field: ::core::option::Option::Some(field.into()),
1550            factor: ::core::option::Option::None,
1551            missing: ::core::option::Option::None,
1552            modifier: ::core::option::Option::None,
1553        }
1554    }
1555}
1556
1557impl FieldValueFactorScoreFunction {
1558    /// Sets `factor`.
1559    pub fn factor(mut self, value: f64) -> Self {
1560        self.factor = ::core::option::Option::Some(value.into());
1561        self
1562    }
1563    /// Sets `missing`.
1564    pub fn missing(mut self, value: f64) -> Self {
1565        self.missing = ::core::option::Option::Some(value.into());
1566        self
1567    }
1568    /// Sets `modifier`.
1569    pub fn modifier(
1570        mut self,
1571        value: impl ::core::convert::Into<crate::query_dsl::FieldValueFactorModifier>,
1572    ) -> Self {
1573        self.modifier = ::core::option::Option::Some(value.into());
1574        self
1575    }
1576}
1577
1578#[derive(Clone, Debug, PartialEq, Eq, Hash)]
1579#[non_exhaustive]
1580pub enum FunctionBoostMode {
1581    /// Query score and function score are multiplied
1582    Multiply,
1583    /// Only the function score is used.
1584    /// The query score is ignored.
1585    Replace,
1586    /// Query score and function score are added
1587    Sum,
1588    /// Query score and function score are averaged
1589    Avg,
1590    /// Max of query score and function score
1591    Max,
1592    /// Min of query score and function score
1593    Min,
1594    /// A value this version of the specification doesn't list.
1595    Raw(::std::string::String),
1596}
1597
1598impl FunctionBoostMode {
1599    /// The value as Elasticsearch writes it.
1600    pub fn as_str(&self) -> &str {
1601        match self {
1602            Self::Multiply => "multiply",
1603            Self::Replace => "replace",
1604            Self::Sum => "sum",
1605            Self::Avg => "avg",
1606            Self::Max => "max",
1607            Self::Min => "min",
1608            Self::Raw(value) => value,
1609        }
1610    }
1611
1612    /// The listed value with this name, if there is one.
1613    pub fn from_known(value: &str) -> ::core::option::Option<Self> {
1614        match value {
1615            "multiply" => ::core::option::Option::Some(Self::Multiply),
1616            "replace" => ::core::option::Option::Some(Self::Replace),
1617            "sum" => ::core::option::Option::Some(Self::Sum),
1618            "avg" => ::core::option::Option::Some(Self::Avg),
1619            "max" => ::core::option::Option::Some(Self::Max),
1620            "min" => ::core::option::Option::Some(Self::Min),
1621            _ => ::core::option::Option::None,
1622        }
1623    }
1624}
1625
1626impl ::serde::Serialize for FunctionBoostMode {
1627    fn serialize<S__: ::serde::Serializer>(
1628        &self,
1629        serializer: S__,
1630    ) -> ::core::result::Result<S__::Ok, S__::Error> {
1631        serializer.serialize_str(self.as_str())
1632    }
1633}
1634
1635impl<'de> ::serde::Deserialize<'de> for FunctionBoostMode {
1636    fn deserialize<D__: ::serde::Deserializer<'de>>(
1637        deserializer: D__,
1638    ) -> ::core::result::Result<Self, D__::Error> {
1639        ::oxsearch_core::__private::deserialize_string_enum(
1640            deserializer,
1641            "FunctionBoostMode",
1642            |value| Self::from_known(value).unwrap_or_else(|| Self::Raw(value.to_owned())),
1643        )
1644    }
1645}
1646
1647/// The variants of [`FunctionScoreContainer`].
1648#[derive(Clone, Debug, PartialEq)]
1649#[non_exhaustive]
1650pub enum FunctionScoreContainerVariant {
1651    /// Function that scores a document with a exponential decay, depending on the distance of a numeric field value of the document from an origin.
1652    Exp(crate::query_dsl::DecayFunction),
1653    /// Function that scores a document with a normal decay, depending on the distance of a numeric field value of the document from an origin.
1654    Gauss(crate::query_dsl::DecayFunction),
1655    /// Function that scores a document with a linear decay, depending on the distance of a numeric field value of the document from an origin.
1656    Linear(crate::query_dsl::DecayFunction),
1657    /// Function allows you to use a field from a document to influence the score.
1658    /// It’s similar to using the script_score function, however, it avoids the overhead of scripting.
1659    FieldValueFactor(crate::query_dsl::FieldValueFactorScoreFunction),
1660    /// Generates scores that are uniformly distributed from 0 up to but not including 1.
1661    /// In case you want scores to be reproducible, it is possible to provide a `seed` and `field`.
1662    RandomScore(crate::query_dsl::RandomScoreFunction),
1663    /// Enables you to wrap another query and customize the scoring of it optionally with a computation derived from other numeric field values in the doc using a script expression.
1664    ScriptScore(crate::query_dsl::ScriptScoreFunction),
1665    /// Any variant, as JSON: an object with one property.
1666    Raw(::serde_json::Value),
1667}
1668
1669impl FunctionScoreContainerVariant {
1670    /// Writes the variant as one entry of a map.
1671    pub fn serialize_entry<M__: ::serde::ser::SerializeMap>(
1672        &self,
1673        map: &mut M__,
1674    ) -> ::core::result::Result<(), M__::Error> {
1675        match self {
1676            Self::Exp(value) => map.serialize_entry("exp", value),
1677            Self::Gauss(value) => map.serialize_entry("gauss", value),
1678            Self::Linear(value) => map.serialize_entry("linear", value),
1679            Self::FieldValueFactor(value) => map.serialize_entry("field_value_factor", value),
1680            Self::RandomScore(value) => map.serialize_entry("random_score", value),
1681            Self::ScriptScore(value) => map.serialize_entry("script_score", value),
1682            Self::Raw(value) => match value {
1683                ::serde_json::Value::Object(entries) => {
1684                    for (key, value) in entries {
1685                        map.serialize_entry(key, value)?;
1686                    }
1687                    ::core::result::Result::Ok(())
1688                }
1689                _ => ::core::result::Result::Err(<M__::Error as ::serde::ser::Error>::custom(
1690                    "a raw variant must be an object",
1691                )),
1692            },
1693        }
1694    }
1695}
1696
1697impl ::serde::Serialize for FunctionScoreContainerVariant {
1698    fn serialize<S__: ::serde::Serializer>(
1699        &self,
1700        serializer: S__,
1701    ) -> ::core::result::Result<S__::Ok, S__::Error> {
1702        match self {
1703            Self::Exp(value) => {
1704                ::oxsearch_core::__private::serialize_variant(serializer, "exp", value)
1705            }
1706            Self::Gauss(value) => {
1707                ::oxsearch_core::__private::serialize_variant(serializer, "gauss", value)
1708            }
1709            Self::Linear(value) => {
1710                ::oxsearch_core::__private::serialize_variant(serializer, "linear", value)
1711            }
1712            Self::FieldValueFactor(value) => ::oxsearch_core::__private::serialize_variant(
1713                serializer,
1714                "field_value_factor",
1715                value,
1716            ),
1717            Self::RandomScore(value) => {
1718                ::oxsearch_core::__private::serialize_variant(serializer, "random_score", value)
1719            }
1720            Self::ScriptScore(value) => {
1721                ::oxsearch_core::__private::serialize_variant(serializer, "script_score", value)
1722            }
1723            Self::Raw(value) => ::serde::Serialize::serialize(value, serializer),
1724        }
1725    }
1726}
1727
1728impl<'de> ::serde::Deserialize<'de> for FunctionScoreContainerVariant {
1729    fn deserialize<D__: ::serde::Deserializer<'de>>(
1730        deserializer: D__,
1731    ) -> ::core::result::Result<Self, D__::Error> {
1732        ::oxsearch_core::__private::deserialize_container(deserializer)
1733    }
1734}
1735
1736impl<'de> ::oxsearch_core::__private::Container<'de> for FunctionScoreContainerVariant {
1737    const NAME: &'static str = "FunctionScoreContainerVariant";
1738    fn variant<A__: ::serde::de::MapAccess<'de>>(
1739        key: &str,
1740        map: &mut A__,
1741    ) -> ::core::result::Result<Self, A__::Error> {
1742        ::core::result::Result::Ok(match key {
1743            "exp" => Self::Exp(map.next_value()?),
1744            "gauss" => Self::Gauss(map.next_value()?),
1745            "linear" => Self::Linear(map.next_value()?),
1746            "field_value_factor" => Self::FieldValueFactor(map.next_value()?),
1747            "random_score" => Self::RandomScore(map.next_value()?),
1748            "script_score" => Self::ScriptScore(map.next_value()?),
1749            _ => Self::Raw(::oxsearch_core::__private::raw_variant(
1750                key,
1751                map.next_value()?,
1752            )),
1753        })
1754    }
1755}
1756
1757impl ::core::convert::From<crate::query_dsl::FieldValueFactorScoreFunction>
1758    for FunctionScoreContainerVariant
1759{
1760    fn from(value: crate::query_dsl::FieldValueFactorScoreFunction) -> Self {
1761        Self::FieldValueFactor(value)
1762    }
1763}
1764
1765impl ::core::convert::From<crate::query_dsl::RandomScoreFunction>
1766    for FunctionScoreContainerVariant
1767{
1768    fn from(value: crate::query_dsl::RandomScoreFunction) -> Self {
1769        Self::RandomScore(value)
1770    }
1771}
1772
1773impl ::core::convert::From<crate::query_dsl::ScriptScoreFunction>
1774    for FunctionScoreContainerVariant
1775{
1776    fn from(value: crate::query_dsl::ScriptScoreFunction) -> Self {
1777        Self::ScriptScore(value)
1778    }
1779}
1780
1781#[derive(Clone, Debug, PartialEq)]
1782#[non_exhaustive]
1783pub struct FunctionScoreContainer {
1784    pub filter: ::core::option::Option<crate::query_dsl::QueryContainer>,
1785    pub weight: ::core::option::Option<f64>,
1786    /// A name to identify which function matched and influenced the score.
1787    pub name: ::core::option::Option<::std::string::String>,
1788    /// The variant.
1789    pub variant: ::core::option::Option<crate::query_dsl::FunctionScoreContainerVariant>,
1790}
1791
1792impl FunctionScoreContainer {
1793    /// A `FunctionScoreContainer` with its required properties set.
1794    pub fn new() -> Self {
1795        Self {
1796            filter: ::core::option::Option::None,
1797            weight: ::core::option::Option::None,
1798            name: ::core::option::Option::None,
1799            variant: ::core::option::Option::None,
1800        }
1801    }
1802}
1803
1804impl FunctionScoreContainer {
1805    /// Sets `filter`.
1806    pub fn filter(
1807        mut self,
1808        value: impl ::core::convert::Into<crate::query_dsl::QueryContainer>,
1809    ) -> Self {
1810        self.filter = ::core::option::Option::Some(value.into());
1811        self
1812    }
1813    /// Sets `weight`.
1814    pub fn weight(mut self, value: f64) -> Self {
1815        self.weight = ::core::option::Option::Some(value.into());
1816        self
1817    }
1818    /// Sets `name`.
1819    pub fn name(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
1820        self.name = ::core::option::Option::Some(value.into());
1821        self
1822    }
1823    /// Sets `variant`.
1824    pub fn variant(
1825        mut self,
1826        value: impl ::core::convert::Into<crate::query_dsl::FunctionScoreContainerVariant>,
1827    ) -> Self {
1828        self.variant = ::core::option::Option::Some(value.into());
1829        self
1830    }
1831}
1832
1833impl ::serde::Serialize for FunctionScoreContainer {
1834    fn serialize<S__: ::serde::Serializer>(
1835        &self,
1836        serializer: S__,
1837    ) -> ::core::result::Result<S__::Ok, S__::Error> {
1838        use ::serde::ser::SerializeMap as _;
1839        let mut map = serializer.serialize_map(::core::option::Option::None)?;
1840        if let ::core::option::Option::Some(value) = &self.filter {
1841            map.serialize_entry("filter", value)?;
1842        }
1843        if let ::core::option::Option::Some(value) = &self.weight {
1844            map.serialize_entry("weight", value)?;
1845        }
1846        if let ::core::option::Option::Some(value) = &self.name {
1847            map.serialize_entry("_name", value)?;
1848        }
1849        if let ::core::option::Option::Some(variant) = &self.variant {
1850            variant.serialize_entry(&mut map)?;
1851        }
1852        map.end()
1853    }
1854}
1855
1856impl<'de> ::serde::Deserialize<'de> for FunctionScoreContainer {
1857    fn deserialize<D__: ::serde::Deserializer<'de>>(
1858        deserializer: D__,
1859    ) -> ::core::result::Result<Self, D__::Error> {
1860        struct Fields;
1861        impl<'de> ::serde::de::Visitor<'de> for Fields {
1862            type Value = FunctionScoreContainer;
1863            fn expecting(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
1864                f.write_str("a FunctionScoreContainer object")
1865            }
1866            fn visit_map<A__: ::serde::de::MapAccess<'de>>(
1867                self,
1868                mut map: A__,
1869            ) -> ::core::result::Result<FunctionScoreContainer, A__::Error> {
1870                let mut filter = ::core::option::Option::None;
1871                let mut weight = ::core::option::Option::None;
1872                let mut name = ::core::option::Option::None;
1873                let mut variant__ = ::core::option::Option::None;
1874                while let ::core::option::Option::Some(key) =
1875                    map.next_key::<::std::string::String>()?
1876                {
1877                    match key.as_str() {
1878                        "filter" => filter = ::core::option::Option::Some(map.next_value()?),
1879                        "weight" => weight = ::core::option::Option::Some(map.next_value()?),
1880                        "_name" => name = ::core::option::Option::Some(map.next_value()?),
1881                        _ => {
1882                            if variant__.is_some() {
1883                                return ::core::result::Result::Err(
1884                                    ::oxsearch_core::__private::two_variants(
1885                                        "FunctionScoreContainer",
1886                                        &key,
1887                                    ),
1888                                );
1889                            }
1890                            variant__ = ::core::option::Option::Some(<FunctionScoreContainerVariant as ::oxsearch_core::__private::Container<'de>>::variant(&key, &mut map)?);
1891                        }
1892                    }
1893                }
1894                ::core::result::Result::Ok(FunctionScoreContainer {
1895                    filter,
1896                    weight,
1897                    name,
1898                    variant: variant__,
1899                })
1900            }
1901        }
1902        deserializer.deserialize_map(Fields)
1903    }
1904}
1905
1906#[derive(Clone, Debug, PartialEq, Eq, Hash)]
1907#[non_exhaustive]
1908pub enum FunctionScoreMode {
1909    /// Scores are multiplied.
1910    Multiply,
1911    /// Scores are summed.
1912    Sum,
1913    /// Scores are averaged.
1914    Avg,
1915    /// The first function that has a matching filter is applied.
1916    First,
1917    /// Maximum score is used.
1918    Max,
1919    /// Minimum score is used.
1920    Min,
1921    /// A value this version of the specification doesn't list.
1922    Raw(::std::string::String),
1923}
1924
1925impl FunctionScoreMode {
1926    /// The value as Elasticsearch writes it.
1927    pub fn as_str(&self) -> &str {
1928        match self {
1929            Self::Multiply => "multiply",
1930            Self::Sum => "sum",
1931            Self::Avg => "avg",
1932            Self::First => "first",
1933            Self::Max => "max",
1934            Self::Min => "min",
1935            Self::Raw(value) => value,
1936        }
1937    }
1938
1939    /// The listed value with this name, if there is one.
1940    pub fn from_known(value: &str) -> ::core::option::Option<Self> {
1941        match value {
1942            "multiply" => ::core::option::Option::Some(Self::Multiply),
1943            "sum" => ::core::option::Option::Some(Self::Sum),
1944            "avg" => ::core::option::Option::Some(Self::Avg),
1945            "first" => ::core::option::Option::Some(Self::First),
1946            "max" => ::core::option::Option::Some(Self::Max),
1947            "min" => ::core::option::Option::Some(Self::Min),
1948            _ => ::core::option::Option::None,
1949        }
1950    }
1951}
1952
1953impl ::serde::Serialize for FunctionScoreMode {
1954    fn serialize<S__: ::serde::Serializer>(
1955        &self,
1956        serializer: S__,
1957    ) -> ::core::result::Result<S__::Ok, S__::Error> {
1958        serializer.serialize_str(self.as_str())
1959    }
1960}
1961
1962impl<'de> ::serde::Deserialize<'de> for FunctionScoreMode {
1963    fn deserialize<D__: ::serde::Deserializer<'de>>(
1964        deserializer: D__,
1965    ) -> ::core::result::Result<Self, D__::Error> {
1966        ::oxsearch_core::__private::deserialize_string_enum(
1967            deserializer,
1968            "FunctionScoreMode",
1969            |value| Self::from_known(value).unwrap_or_else(|| Self::Raw(value.to_owned())),
1970        )
1971    }
1972}
1973
1974#[derive(Clone, Debug, PartialEq)]
1975#[non_exhaustive]
1976pub struct FunctionScoreQuery {
1977    /// Floating point number used to decrease or increase the relevance scores of the query.
1978    /// Boost values are relative to the default value of 1.0.
1979    /// A boost value between 0 and 1.0 decreases the relevance score.
1980    /// A value greater than 1.0 increases the relevance score.
1981    pub boost: ::core::option::Option<f32>,
1982    pub name: ::core::option::Option<::std::string::String>,
1983    /// Defines how he newly computed score is combined with the score of the query
1984    pub boost_mode: ::core::option::Option<crate::query_dsl::FunctionBoostMode>,
1985    /// One or more functions that compute a new score for each document returned by the query.
1986    pub functions:
1987        ::core::option::Option<::std::vec::Vec<crate::query_dsl::FunctionScoreContainer>>,
1988    /// Restricts the new score to not exceed the provided limit.
1989    pub max_boost: ::core::option::Option<f64>,
1990    /// Excludes documents that do not meet the provided score threshold.
1991    pub min_score: ::core::option::Option<f64>,
1992    /// A query that determines the documents for which a new score is computed.
1993    pub query: ::core::option::Option<crate::query_dsl::QueryContainer>,
1994    /// Specifies how the computed scores are combined
1995    pub score_mode: ::core::option::Option<crate::query_dsl::FunctionScoreMode>,
1996}
1997
1998impl FunctionScoreQuery {
1999    /// A `FunctionScoreQuery` with its required properties set.
2000    pub fn new() -> Self {
2001        Self {
2002            boost: ::core::option::Option::None,
2003            name: ::core::option::Option::None,
2004            boost_mode: ::core::option::Option::None,
2005            functions: ::core::option::Option::None,
2006            max_boost: ::core::option::Option::None,
2007            min_score: ::core::option::Option::None,
2008            query: ::core::option::Option::None,
2009            score_mode: ::core::option::Option::None,
2010        }
2011    }
2012}
2013
2014impl FunctionScoreQuery {
2015    /// Sets `boost`.
2016    pub fn boost(mut self, value: f32) -> Self {
2017        self.boost = ::core::option::Option::Some(value.into());
2018        self
2019    }
2020    /// Sets `name`.
2021    pub fn name(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
2022        self.name = ::core::option::Option::Some(value.into());
2023        self
2024    }
2025    /// Sets `boost_mode`.
2026    pub fn boost_mode(
2027        mut self,
2028        value: impl ::core::convert::Into<crate::query_dsl::FunctionBoostMode>,
2029    ) -> Self {
2030        self.boost_mode = ::core::option::Option::Some(value.into());
2031        self
2032    }
2033    /// Sets `functions`.
2034    pub fn functions(
2035        mut self,
2036        value: impl ::core::convert::Into<::std::vec::Vec<crate::query_dsl::FunctionScoreContainer>>,
2037    ) -> Self {
2038        self.functions = ::core::option::Option::Some(value.into());
2039        self
2040    }
2041    /// Sets `max_boost`.
2042    pub fn max_boost(mut self, value: f64) -> Self {
2043        self.max_boost = ::core::option::Option::Some(value.into());
2044        self
2045    }
2046    /// Sets `min_score`.
2047    pub fn min_score(mut self, value: f64) -> Self {
2048        self.min_score = ::core::option::Option::Some(value.into());
2049        self
2050    }
2051    /// Sets `query`.
2052    pub fn query(
2053        mut self,
2054        value: impl ::core::convert::Into<crate::query_dsl::QueryContainer>,
2055    ) -> Self {
2056        self.query = ::core::option::Option::Some(value.into());
2057        self
2058    }
2059    /// Sets `score_mode`.
2060    pub fn score_mode(
2061        mut self,
2062        value: impl ::core::convert::Into<crate::query_dsl::FunctionScoreMode>,
2063    ) -> Self {
2064        self.score_mode = ::core::option::Option::Some(value.into());
2065        self
2066    }
2067}
2068
2069#[derive(::serde::Serialize, ::serde::Deserialize)]
2070#[serde(remote = "FunctionScoreQuery")]
2071struct FunctionScoreQueryDef {
2072    /// Floating point number used to decrease or increase the relevance scores of the query.
2073    /// Boost values are relative to the default value of 1.0.
2074    /// A boost value between 0 and 1.0 decreases the relevance score.
2075    /// A value greater than 1.0 increases the relevance score.
2076    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
2077    boost: ::core::option::Option<f32>,
2078    #[serde(
2079        rename = "_name",
2080        skip_serializing_if = "::core::option::Option::is_none"
2081    )]
2082    name: ::core::option::Option<::std::string::String>,
2083    /// Defines how he newly computed score is combined with the score of the query
2084    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
2085    boost_mode: ::core::option::Option<crate::query_dsl::FunctionBoostMode>,
2086    /// One or more functions that compute a new score for each document returned by the query.
2087    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
2088    functions: ::core::option::Option<::std::vec::Vec<crate::query_dsl::FunctionScoreContainer>>,
2089    /// Restricts the new score to not exceed the provided limit.
2090    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
2091    max_boost: ::core::option::Option<f64>,
2092    /// Excludes documents that do not meet the provided score threshold.
2093    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
2094    min_score: ::core::option::Option<f64>,
2095    /// A query that determines the documents for which a new score is computed.
2096    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
2097    query: ::core::option::Option<crate::query_dsl::QueryContainer>,
2098    /// Specifies how the computed scores are combined
2099    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
2100    score_mode: ::core::option::Option<crate::query_dsl::FunctionScoreMode>,
2101}
2102
2103impl ::serde::Serialize for FunctionScoreQuery {
2104    fn serialize<S__: ::serde::Serializer>(
2105        &self,
2106        serializer: S__,
2107    ) -> ::core::result::Result<S__::Ok, S__::Error> {
2108        if let (::core::option::Option::Some(short), true) = (
2109            &self.functions,
2110            self.boost.is_none()
2111                && self.name.is_none()
2112                && self.boost_mode.is_none()
2113                && self.max_boost.is_none()
2114                && self.min_score.is_none()
2115                && self.query.is_none()
2116                && self.score_mode.is_none(),
2117        ) {
2118            return ::serde::Serialize::serialize(short, serializer);
2119        }
2120        FunctionScoreQueryDef::serialize(self, serializer)
2121    }
2122}
2123
2124impl<'de> ::oxsearch_core::__private::Shorthand<'de> for FunctionScoreQuery {
2125    type Short = ::std::vec::Vec<crate::query_dsl::FunctionScoreContainer>;
2126    fn from_short(short: ::std::vec::Vec<crate::query_dsl::FunctionScoreContainer>) -> Self {
2127        Self {
2128            boost: ::core::option::Option::None,
2129            name: ::core::option::Option::None,
2130            boost_mode: ::core::option::Option::None,
2131            functions: ::core::option::Option::Some(short),
2132            max_boost: ::core::option::Option::None,
2133            min_score: ::core::option::Option::None,
2134            query: ::core::option::Option::None,
2135            score_mode: ::core::option::Option::None,
2136        }
2137    }
2138    fn deserialize_full<D__: ::serde::Deserializer<'de>>(
2139        deserializer: D__,
2140    ) -> ::core::result::Result<Self, D__::Error> {
2141        FunctionScoreQueryDef::deserialize(deserializer)
2142    }
2143}
2144
2145impl<'de> ::serde::Deserialize<'de> for FunctionScoreQuery {
2146    fn deserialize<D__: ::serde::Deserializer<'de>>(
2147        deserializer: D__,
2148    ) -> ::core::result::Result<Self, D__::Error> {
2149        ::oxsearch_core::__private::deserialize_shorthand(deserializer)
2150    }
2151}
2152
2153#[derive(Clone, Debug, PartialEq)]
2154#[non_exhaustive]
2155pub enum FuzzyQueryValue {
2156    /// A string.
2157    String(::std::string::String),
2158    /// A number.
2159    Double(f64),
2160    /// A boolean.
2161    Bool(bool),
2162}
2163
2164impl ::serde::Serialize for FuzzyQueryValue {
2165    fn serialize<S__: ::serde::Serializer>(
2166        &self,
2167        serializer: S__,
2168    ) -> ::core::result::Result<S__::Ok, S__::Error> {
2169        match self {
2170            Self::String(value) => ::serde::Serialize::serialize(value, serializer),
2171            Self::Double(value) => ::serde::Serialize::serialize(value, serializer),
2172            Self::Bool(value) => ::serde::Serialize::serialize(value, serializer),
2173        }
2174    }
2175}
2176
2177impl<'de> ::serde::Deserialize<'de> for FuzzyQueryValue {
2178    fn deserialize<D__: ::serde::Deserializer<'de>>(
2179        deserializer: D__,
2180    ) -> ::core::result::Result<Self, D__::Error> {
2181        struct Shape;
2182        impl<'de> ::oxsearch_core::__private::ByKind<'de> for Shape {
2183            type Value = FuzzyQueryValue;
2184            const EXPECTING: &'static str = "FuzzyQueryValue: boolean or number or string";
2185            fn visit<V__: ::serde::Deserializer<'de>>(
2186                self,
2187                kind: ::oxsearch_core::__private::Kind,
2188                value: V__,
2189            ) -> ::core::result::Result<Self::Value, V__::Error> {
2190                match kind {
2191                    ::oxsearch_core::__private::Kind::Bool => {
2192                        <bool as ::serde::Deserialize>::deserialize(value)
2193                            .map(FuzzyQueryValue::Bool)
2194                    }
2195                    ::oxsearch_core::__private::Kind::Number => {
2196                        <f64 as ::serde::Deserialize>::deserialize(value)
2197                            .map(FuzzyQueryValue::Double)
2198                    }
2199                    ::oxsearch_core::__private::Kind::String => {
2200                        <::std::string::String as ::serde::Deserialize>::deserialize(value)
2201                            .map(FuzzyQueryValue::String)
2202                    }
2203                    _ => ::core::result::Result::Err(<V__::Error as ::serde::de::Error>::custom(
2204                        format_args!("FuzzyQueryValue can't be {kind:?}"),
2205                    )),
2206                }
2207            }
2208        }
2209        ::oxsearch_core::__private::deserialize_by_kind(deserializer, Shape)
2210    }
2211}
2212
2213impl ::core::convert::From<::std::string::String> for FuzzyQueryValue {
2214    fn from(value: ::std::string::String) -> Self {
2215        Self::String(value)
2216    }
2217}
2218
2219impl ::core::convert::From<f64> for FuzzyQueryValue {
2220    fn from(value: f64) -> Self {
2221        Self::Double(value)
2222    }
2223}
2224
2225impl ::core::convert::From<bool> for FuzzyQueryValue {
2226    fn from(value: bool) -> Self {
2227        Self::Bool(value)
2228    }
2229}
2230
2231impl ::core::convert::From<&str> for FuzzyQueryValue {
2232    fn from(value: &str) -> Self {
2233        Self::String(::std::borrow::ToOwned::to_owned(value))
2234    }
2235}
2236
2237#[derive(Clone, Debug, PartialEq)]
2238#[non_exhaustive]
2239pub struct FuzzyQuery {
2240    /// Floating point number used to decrease or increase the relevance scores of the query.
2241    /// Boost values are relative to the default value of 1.0.
2242    /// A boost value between 0 and 1.0 decreases the relevance score.
2243    /// A value greater than 1.0 increases the relevance score.
2244    pub boost: ::core::option::Option<f32>,
2245    pub name: ::core::option::Option<::std::string::String>,
2246    /// Maximum number of variations created.
2247    pub max_expansions: ::core::option::Option<i32>,
2248    /// Number of beginning characters left unchanged when creating expansions.
2249    pub prefix_length: ::core::option::Option<i32>,
2250    /// Number of beginning characters left unchanged when creating expansions.
2251    pub rewrite: ::core::option::Option<crate::MultiTermQueryRewrite>,
2252    /// Indicates whether edits include transpositions of two adjacent characters (for example `ab` to `ba`).
2253    pub transpositions: ::core::option::Option<bool>,
2254    /// Maximum edit distance allowed for matching.
2255    pub fuzziness: ::core::option::Option<crate::Fuzziness>,
2256    /// Term you wish to find in the provided field.
2257    pub value: ::core::option::Option<crate::query_dsl::FuzzyQueryValue>,
2258}
2259
2260impl FuzzyQuery {
2261    /// A `FuzzyQuery` with its required properties set.
2262    pub fn new(value: impl ::core::convert::Into<crate::query_dsl::FuzzyQueryValue>) -> Self {
2263        Self {
2264            boost: ::core::option::Option::None,
2265            name: ::core::option::Option::None,
2266            max_expansions: ::core::option::Option::None,
2267            prefix_length: ::core::option::Option::None,
2268            rewrite: ::core::option::Option::None,
2269            transpositions: ::core::option::Option::None,
2270            fuzziness: ::core::option::Option::None,
2271            value: ::core::option::Option::Some(value.into()),
2272        }
2273    }
2274}
2275
2276impl FuzzyQuery {
2277    /// Sets `boost`.
2278    pub fn boost(mut self, value: f32) -> Self {
2279        self.boost = ::core::option::Option::Some(value.into());
2280        self
2281    }
2282    /// Sets `name`.
2283    pub fn name(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
2284        self.name = ::core::option::Option::Some(value.into());
2285        self
2286    }
2287    /// Sets `max_expansions`.
2288    pub fn max_expansions(mut self, value: i32) -> Self {
2289        self.max_expansions = ::core::option::Option::Some(value.into());
2290        self
2291    }
2292    /// Sets `prefix_length`.
2293    pub fn prefix_length(mut self, value: i32) -> Self {
2294        self.prefix_length = ::core::option::Option::Some(value.into());
2295        self
2296    }
2297    /// Sets `rewrite`.
2298    pub fn rewrite(
2299        mut self,
2300        value: impl ::core::convert::Into<crate::MultiTermQueryRewrite>,
2301    ) -> Self {
2302        self.rewrite = ::core::option::Option::Some(value.into());
2303        self
2304    }
2305    /// Sets `transpositions`.
2306    pub fn transpositions(mut self, value: bool) -> Self {
2307        self.transpositions = ::core::option::Option::Some(value.into());
2308        self
2309    }
2310    /// Sets `fuzziness`.
2311    pub fn fuzziness(mut self, value: impl ::core::convert::Into<crate::Fuzziness>) -> Self {
2312        self.fuzziness = ::core::option::Option::Some(value.into());
2313        self
2314    }
2315}
2316
2317#[derive(::serde::Serialize, ::serde::Deserialize)]
2318#[serde(remote = "FuzzyQuery")]
2319struct FuzzyQueryDef {
2320    /// Floating point number used to decrease or increase the relevance scores of the query.
2321    /// Boost values are relative to the default value of 1.0.
2322    /// A boost value between 0 and 1.0 decreases the relevance score.
2323    /// A value greater than 1.0 increases the relevance score.
2324    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
2325    boost: ::core::option::Option<f32>,
2326    #[serde(
2327        rename = "_name",
2328        skip_serializing_if = "::core::option::Option::is_none"
2329    )]
2330    name: ::core::option::Option<::std::string::String>,
2331    /// Maximum number of variations created.
2332    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
2333    max_expansions: ::core::option::Option<i32>,
2334    /// Number of beginning characters left unchanged when creating expansions.
2335    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
2336    prefix_length: ::core::option::Option<i32>,
2337    /// Number of beginning characters left unchanged when creating expansions.
2338    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
2339    rewrite: ::core::option::Option<crate::MultiTermQueryRewrite>,
2340    /// Indicates whether edits include transpositions of two adjacent characters (for example `ab` to `ba`).
2341    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
2342    transpositions: ::core::option::Option<bool>,
2343    /// Maximum edit distance allowed for matching.
2344    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
2345    fuzziness: ::core::option::Option<crate::Fuzziness>,
2346    /// Term you wish to find in the provided field.
2347    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
2348    value: ::core::option::Option<crate::query_dsl::FuzzyQueryValue>,
2349}
2350
2351impl ::serde::Serialize for FuzzyQuery {
2352    fn serialize<S__: ::serde::Serializer>(
2353        &self,
2354        serializer: S__,
2355    ) -> ::core::result::Result<S__::Ok, S__::Error> {
2356        if let (::core::option::Option::Some(short), true) = (
2357            &self.value,
2358            self.boost.is_none()
2359                && self.name.is_none()
2360                && self.max_expansions.is_none()
2361                && self.prefix_length.is_none()
2362                && self.rewrite.is_none()
2363                && self.transpositions.is_none()
2364                && self.fuzziness.is_none(),
2365        ) {
2366            return ::serde::Serialize::serialize(short, serializer);
2367        }
2368        FuzzyQueryDef::serialize(self, serializer)
2369    }
2370}
2371
2372impl<'de> ::oxsearch_core::__private::Shorthand<'de> for FuzzyQuery {
2373    type Short = crate::query_dsl::FuzzyQueryValue;
2374    fn from_short(short: crate::query_dsl::FuzzyQueryValue) -> Self {
2375        Self {
2376            boost: ::core::option::Option::None,
2377            name: ::core::option::Option::None,
2378            max_expansions: ::core::option::Option::None,
2379            prefix_length: ::core::option::Option::None,
2380            rewrite: ::core::option::Option::None,
2381            transpositions: ::core::option::Option::None,
2382            fuzziness: ::core::option::Option::None,
2383            value: ::core::option::Option::Some(short),
2384        }
2385    }
2386    fn deserialize_full<D__: ::serde::Deserializer<'de>>(
2387        deserializer: D__,
2388    ) -> ::core::result::Result<Self, D__::Error> {
2389        FuzzyQueryDef::deserialize(deserializer)
2390    }
2391}
2392
2393impl<'de> ::serde::Deserialize<'de> for FuzzyQuery {
2394    fn deserialize<D__: ::serde::Deserializer<'de>>(
2395        deserializer: D__,
2396    ) -> ::core::result::Result<Self, D__::Error> {
2397        ::oxsearch_core::__private::deserialize_shorthand(deserializer)
2398    }
2399}
2400
2401#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
2402#[serde(try_from = "GeoBoundingBoxQueryRepr", into = "GeoBoundingBoxQueryRepr")]
2403#[non_exhaustive]
2404pub struct GeoBoundingBoxQuery {
2405    /// Floating point number used to decrease or increase the relevance scores of the query.
2406    /// Boost values are relative to the default value of 1.0.
2407    /// A boost value between 0 and 1.0 decreases the relevance score.
2408    /// A value greater than 1.0 increases the relevance score.
2409    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
2410    pub boost: ::core::option::Option<f32>,
2411    #[serde(
2412        rename = "_name",
2413        skip_serializing_if = "::core::option::Option::is_none"
2414    )]
2415    pub name: ::core::option::Option<::std::string::String>,
2416    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
2417    pub r#type: ::core::option::Option<crate::query_dsl::GeoExecution>,
2418    /// Set to `IGNORE_MALFORMED` to accept geo points with invalid latitude or longitude.
2419    /// Set to `COERCE` to also try to infer correct latitude or longitude.
2420    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
2421    pub validation_method: ::core::option::Option<crate::query_dsl::GeoValidationMethod>,
2422    /// Set to `true` to ignore an unmapped field and not match any documents for this query.
2423    /// Set to `false` to throw an exception if the field is not mapped.
2424    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
2425    pub ignore_unmapped: ::core::option::Option<bool>,
2426    /// The name of the property that holds `bounding_box`.
2427    pub field: crate::Field,
2428    /// The value under `field`.
2429    pub bounding_box: crate::GeoBounds,
2430}
2431
2432impl GeoBoundingBoxQuery {
2433    /// A `GeoBoundingBoxQuery` with its required properties set.
2434    pub fn new(
2435        field: impl ::core::convert::Into<crate::Field>,
2436        bounding_box: impl ::core::convert::Into<crate::GeoBounds>,
2437    ) -> Self {
2438        Self {
2439            boost: ::core::option::Option::None,
2440            name: ::core::option::Option::None,
2441            r#type: ::core::option::Option::None,
2442            validation_method: ::core::option::Option::None,
2443            ignore_unmapped: ::core::option::Option::None,
2444            field: field.into(),
2445            bounding_box: bounding_box.into(),
2446        }
2447    }
2448}
2449
2450impl GeoBoundingBoxQuery {
2451    /// Sets `boost`.
2452    pub fn boost(mut self, value: f32) -> Self {
2453        self.boost = ::core::option::Option::Some(value.into());
2454        self
2455    }
2456    /// Sets `name`.
2457    pub fn name(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
2458        self.name = ::core::option::Option::Some(value.into());
2459        self
2460    }
2461    /// Sets `type`.
2462    pub fn r#type(
2463        mut self,
2464        value: impl ::core::convert::Into<crate::query_dsl::GeoExecution>,
2465    ) -> Self {
2466        self.r#type = ::core::option::Option::Some(value.into());
2467        self
2468    }
2469    /// Sets `validation_method`.
2470    pub fn validation_method(
2471        mut self,
2472        value: impl ::core::convert::Into<crate::query_dsl::GeoValidationMethod>,
2473    ) -> Self {
2474        self.validation_method = ::core::option::Option::Some(value.into());
2475        self
2476    }
2477    /// Sets `ignore_unmapped`.
2478    pub fn ignore_unmapped(mut self, value: bool) -> Self {
2479        self.ignore_unmapped = ::core::option::Option::Some(value.into());
2480        self
2481    }
2482}
2483
2484#[derive(::serde::Serialize, ::serde::Deserialize)]
2485struct GeoBoundingBoxQueryRepr {
2486    /// Floating point number used to decrease or increase the relevance scores of the query.
2487    /// Boost values are relative to the default value of 1.0.
2488    /// A boost value between 0 and 1.0 decreases the relevance score.
2489    /// A value greater than 1.0 increases the relevance score.
2490    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
2491    boost: ::core::option::Option<f32>,
2492    #[serde(
2493        rename = "_name",
2494        skip_serializing_if = "::core::option::Option::is_none"
2495    )]
2496    name: ::core::option::Option<::std::string::String>,
2497    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
2498    r#type: ::core::option::Option<crate::query_dsl::GeoExecution>,
2499    /// Set to `IGNORE_MALFORMED` to accept geo points with invalid latitude or longitude.
2500    /// Set to `COERCE` to also try to infer correct latitude or longitude.
2501    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
2502    validation_method: ::core::option::Option<crate::query_dsl::GeoValidationMethod>,
2503    /// Set to `true` to ignore an unmapped field and not match any documents for this query.
2504    /// Set to `false` to throw an exception if the field is not mapped.
2505    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
2506    ignore_unmapped: ::core::option::Option<bool>,
2507    #[serde(flatten)]
2508    keyed__: ::indexmap::IndexMap<crate::Field, crate::GeoBounds>,
2509}
2510
2511impl ::core::convert::TryFrom<GeoBoundingBoxQueryRepr> for GeoBoundingBoxQuery {
2512    type Error = ::std::string::String;
2513    fn try_from(repr: GeoBoundingBoxQueryRepr) -> ::core::result::Result<Self, Self::Error> {
2514        let mut keyed = repr.keyed__.into_iter();
2515        match (keyed.next(), keyed.next()) {
2516            (::core::option::Option::Some((field, bounding_box)), ::core::option::Option::None) => {
2517                ::core::result::Result::Ok(Self {
2518                    boost: repr.boost,
2519                    name: repr.name,
2520                    r#type: repr.r#type,
2521                    validation_method: repr.validation_method,
2522                    ignore_unmapped: repr.ignore_unmapped,
2523                    field,
2524                    bounding_box,
2525                })
2526            }
2527            _ => ::core::result::Result::Err(::std::string::String::from(
2528                "GeoBoundingBoxQuery needs exactly one property keyed by its field",
2529            )),
2530        }
2531    }
2532}
2533
2534impl ::core::convert::From<GeoBoundingBoxQuery> for GeoBoundingBoxQueryRepr {
2535    fn from(value: GeoBoundingBoxQuery) -> Self {
2536        let mut keyed__ = ::indexmap::IndexMap::new();
2537        keyed__.insert(value.field, value.bounding_box);
2538        Self {
2539            boost: value.boost,
2540            name: value.name,
2541            r#type: value.r#type,
2542            validation_method: value.validation_method,
2543            ignore_unmapped: value.ignore_unmapped,
2544            keyed__,
2545        }
2546    }
2547}
2548
2549#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
2550#[serde(try_from = "GeoDecayFunctionRepr", into = "GeoDecayFunctionRepr")]
2551#[non_exhaustive]
2552pub struct GeoDecayFunction {
2553    /// Determines how the distance is calculated when a field used for computing the decay contains multiple values.
2554    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
2555    pub multi_value_mode: ::core::option::Option<crate::query_dsl::MultiValueMode>,
2556    /// The name of the property that holds `placement`.
2557    pub field: crate::Field,
2558    /// The value under `field`.
2559    pub placement: crate::query_dsl::DecayPlacement<crate::GeoLocation, crate::Distance>,
2560}
2561
2562impl GeoDecayFunction {
2563    /// A `GeoDecayFunction` with its required properties set.
2564    pub fn new(
2565        field: impl ::core::convert::Into<crate::Field>,
2566        placement: impl ::core::convert::Into<
2567            crate::query_dsl::DecayPlacement<crate::GeoLocation, crate::Distance>,
2568        >,
2569    ) -> Self {
2570        Self {
2571            multi_value_mode: ::core::option::Option::None,
2572            field: field.into(),
2573            placement: placement.into(),
2574        }
2575    }
2576}
2577
2578impl GeoDecayFunction {
2579    /// Sets `multi_value_mode`.
2580    pub fn multi_value_mode(
2581        mut self,
2582        value: impl ::core::convert::Into<crate::query_dsl::MultiValueMode>,
2583    ) -> Self {
2584        self.multi_value_mode = ::core::option::Option::Some(value.into());
2585        self
2586    }
2587}
2588
2589#[derive(::serde::Serialize, ::serde::Deserialize)]
2590struct GeoDecayFunctionRepr {
2591    /// Determines how the distance is calculated when a field used for computing the decay contains multiple values.
2592    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
2593    multi_value_mode: ::core::option::Option<crate::query_dsl::MultiValueMode>,
2594    #[serde(flatten)]
2595    keyed__: ::indexmap::IndexMap<
2596        crate::Field,
2597        crate::query_dsl::DecayPlacement<crate::GeoLocation, crate::Distance>,
2598    >,
2599}
2600
2601impl ::core::convert::TryFrom<GeoDecayFunctionRepr> for GeoDecayFunction {
2602    type Error = ::std::string::String;
2603    fn try_from(repr: GeoDecayFunctionRepr) -> ::core::result::Result<Self, Self::Error> {
2604        let mut keyed = repr.keyed__.into_iter();
2605        match (keyed.next(), keyed.next()) {
2606            (::core::option::Option::Some((field, placement)), ::core::option::Option::None) => {
2607                ::core::result::Result::Ok(Self {
2608                    multi_value_mode: repr.multi_value_mode,
2609                    field,
2610                    placement,
2611                })
2612            }
2613            _ => ::core::result::Result::Err(::std::string::String::from(
2614                "GeoDecayFunction needs exactly one property keyed by its field",
2615            )),
2616        }
2617    }
2618}
2619
2620impl ::core::convert::From<GeoDecayFunction> for GeoDecayFunctionRepr {
2621    fn from(value: GeoDecayFunction) -> Self {
2622        let mut keyed__ = ::indexmap::IndexMap::new();
2623        keyed__.insert(value.field, value.placement);
2624        Self {
2625            multi_value_mode: value.multi_value_mode,
2626            keyed__,
2627        }
2628    }
2629}
2630
2631#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
2632#[non_exhaustive]
2633pub struct GeoDistanceFeatureQuery {
2634    /// Floating point number used to decrease or increase the relevance scores of the query.
2635    /// Boost values are relative to the default value of 1.0.
2636    /// A boost value between 0 and 1.0 decreases the relevance score.
2637    /// A value greater than 1.0 increases the relevance score.
2638    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
2639    pub boost: ::core::option::Option<f32>,
2640    #[serde(
2641        rename = "_name",
2642        skip_serializing_if = "::core::option::Option::is_none"
2643    )]
2644    pub name: ::core::option::Option<::std::string::String>,
2645    /// Date or point of origin used to calculate distances.
2646    /// If the `field` value is a `date` or `date_nanos` field, the `origin` value must be a date.
2647    /// Date Math, such as `now-1h`, is supported.
2648    /// If the field value is a `geo_point` field, the `origin` value must be a geopoint.
2649    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
2650    pub origin: ::core::option::Option<crate::GeoLocation>,
2651    /// Distance from the `origin` at which relevance scores receive half of the `boost` value.
2652    /// If the `field` value is a `date` or `date_nanos` field, the `pivot` value must be a time unit, such as `1h` or `10d`. If the `field` value is a `geo_point` field, the `pivot` value must be a distance unit, such as `1km` or `12m`.
2653    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
2654    pub pivot: ::core::option::Option<crate::Distance>,
2655    /// Name of the field used to calculate distances. This field must meet the following criteria:
2656    /// be a `date`, `date_nanos` or `geo_point` field;
2657    /// have an `index` mapping parameter value of `true`, which is the default;
2658    /// have an `doc_values` mapping parameter value of `true`, which is the default.
2659    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
2660    pub field: ::core::option::Option<crate::Field>,
2661}
2662
2663impl GeoDistanceFeatureQuery {
2664    /// A `GeoDistanceFeatureQuery` with its required properties set.
2665    pub fn new(
2666        origin: impl ::core::convert::Into<crate::GeoLocation>,
2667        pivot: impl ::core::convert::Into<crate::Distance>,
2668        field: impl ::core::convert::Into<crate::Field>,
2669    ) -> Self {
2670        Self {
2671            boost: ::core::option::Option::None,
2672            name: ::core::option::Option::None,
2673            origin: ::core::option::Option::Some(origin.into()),
2674            pivot: ::core::option::Option::Some(pivot.into()),
2675            field: ::core::option::Option::Some(field.into()),
2676        }
2677    }
2678}
2679
2680impl GeoDistanceFeatureQuery {
2681    /// Sets `boost`.
2682    pub fn boost(mut self, value: f32) -> Self {
2683        self.boost = ::core::option::Option::Some(value.into());
2684        self
2685    }
2686    /// Sets `name`.
2687    pub fn name(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
2688        self.name = ::core::option::Option::Some(value.into());
2689        self
2690    }
2691}
2692
2693#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
2694#[serde(try_from = "GeoDistanceQueryRepr", into = "GeoDistanceQueryRepr")]
2695#[non_exhaustive]
2696pub struct GeoDistanceQuery {
2697    /// Floating point number used to decrease or increase the relevance scores of the query.
2698    /// Boost values are relative to the default value of 1.0.
2699    /// A boost value between 0 and 1.0 decreases the relevance score.
2700    /// A value greater than 1.0 increases the relevance score.
2701    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
2702    pub boost: ::core::option::Option<f32>,
2703    #[serde(
2704        rename = "_name",
2705        skip_serializing_if = "::core::option::Option::is_none"
2706    )]
2707    pub name: ::core::option::Option<::std::string::String>,
2708    /// The radius of the circle centred on the specified location.
2709    /// Points which fall into this circle are considered to be matches.
2710    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
2711    pub distance: ::core::option::Option<crate::Distance>,
2712    /// How to compute the distance.
2713    /// Set to `plane` for a faster calculation that's inaccurate on long distances and close to the poles.
2714    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
2715    pub distance_type: ::core::option::Option<crate::GeoDistanceType>,
2716    /// Set to `IGNORE_MALFORMED` to accept geo points with invalid latitude or longitude.
2717    /// Set to `COERCE` to also try to infer correct latitude or longitude.
2718    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
2719    pub validation_method: ::core::option::Option<crate::query_dsl::GeoValidationMethod>,
2720    /// Set to `true` to ignore an unmapped field and not match any documents for this query.
2721    /// Set to `false` to throw an exception if the field is not mapped.
2722    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
2723    pub ignore_unmapped: ::core::option::Option<bool>,
2724    /// The name of the property that holds `location`.
2725    pub field: crate::Field,
2726    /// The value under `field`.
2727    pub location: crate::GeoLocation,
2728}
2729
2730impl GeoDistanceQuery {
2731    /// A `GeoDistanceQuery` with its required properties set.
2732    pub fn new(
2733        distance: impl ::core::convert::Into<crate::Distance>,
2734        field: impl ::core::convert::Into<crate::Field>,
2735        location: impl ::core::convert::Into<crate::GeoLocation>,
2736    ) -> Self {
2737        Self {
2738            boost: ::core::option::Option::None,
2739            name: ::core::option::Option::None,
2740            distance: ::core::option::Option::Some(distance.into()),
2741            distance_type: ::core::option::Option::None,
2742            validation_method: ::core::option::Option::None,
2743            ignore_unmapped: ::core::option::Option::None,
2744            field: field.into(),
2745            location: location.into(),
2746        }
2747    }
2748}
2749
2750impl GeoDistanceQuery {
2751    /// Sets `boost`.
2752    pub fn boost(mut self, value: f32) -> Self {
2753        self.boost = ::core::option::Option::Some(value.into());
2754        self
2755    }
2756    /// Sets `name`.
2757    pub fn name(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
2758        self.name = ::core::option::Option::Some(value.into());
2759        self
2760    }
2761    /// Sets `distance_type`.
2762    pub fn distance_type(
2763        mut self,
2764        value: impl ::core::convert::Into<crate::GeoDistanceType>,
2765    ) -> Self {
2766        self.distance_type = ::core::option::Option::Some(value.into());
2767        self
2768    }
2769    /// Sets `validation_method`.
2770    pub fn validation_method(
2771        mut self,
2772        value: impl ::core::convert::Into<crate::query_dsl::GeoValidationMethod>,
2773    ) -> Self {
2774        self.validation_method = ::core::option::Option::Some(value.into());
2775        self
2776    }
2777    /// Sets `ignore_unmapped`.
2778    pub fn ignore_unmapped(mut self, value: bool) -> Self {
2779        self.ignore_unmapped = ::core::option::Option::Some(value.into());
2780        self
2781    }
2782}
2783
2784#[derive(::serde::Serialize, ::serde::Deserialize)]
2785struct GeoDistanceQueryRepr {
2786    /// Floating point number used to decrease or increase the relevance scores of the query.
2787    /// Boost values are relative to the default value of 1.0.
2788    /// A boost value between 0 and 1.0 decreases the relevance score.
2789    /// A value greater than 1.0 increases the relevance score.
2790    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
2791    boost: ::core::option::Option<f32>,
2792    #[serde(
2793        rename = "_name",
2794        skip_serializing_if = "::core::option::Option::is_none"
2795    )]
2796    name: ::core::option::Option<::std::string::String>,
2797    /// The radius of the circle centred on the specified location.
2798    /// Points which fall into this circle are considered to be matches.
2799    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
2800    distance: ::core::option::Option<crate::Distance>,
2801    /// How to compute the distance.
2802    /// Set to `plane` for a faster calculation that's inaccurate on long distances and close to the poles.
2803    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
2804    distance_type: ::core::option::Option<crate::GeoDistanceType>,
2805    /// Set to `IGNORE_MALFORMED` to accept geo points with invalid latitude or longitude.
2806    /// Set to `COERCE` to also try to infer correct latitude or longitude.
2807    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
2808    validation_method: ::core::option::Option<crate::query_dsl::GeoValidationMethod>,
2809    /// Set to `true` to ignore an unmapped field and not match any documents for this query.
2810    /// Set to `false` to throw an exception if the field is not mapped.
2811    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
2812    ignore_unmapped: ::core::option::Option<bool>,
2813    #[serde(flatten)]
2814    keyed__: ::indexmap::IndexMap<crate::Field, crate::GeoLocation>,
2815}
2816
2817impl ::core::convert::TryFrom<GeoDistanceQueryRepr> for GeoDistanceQuery {
2818    type Error = ::std::string::String;
2819    fn try_from(repr: GeoDistanceQueryRepr) -> ::core::result::Result<Self, Self::Error> {
2820        let mut keyed = repr.keyed__.into_iter();
2821        match (keyed.next(), keyed.next()) {
2822            (::core::option::Option::Some((field, location)), ::core::option::Option::None) => {
2823                ::core::result::Result::Ok(Self {
2824                    boost: repr.boost,
2825                    name: repr.name,
2826                    distance: repr.distance,
2827                    distance_type: repr.distance_type,
2828                    validation_method: repr.validation_method,
2829                    ignore_unmapped: repr.ignore_unmapped,
2830                    field,
2831                    location,
2832                })
2833            }
2834            _ => ::core::result::Result::Err(::std::string::String::from(
2835                "GeoDistanceQuery needs exactly one property keyed by its field",
2836            )),
2837        }
2838    }
2839}
2840
2841impl ::core::convert::From<GeoDistanceQuery> for GeoDistanceQueryRepr {
2842    fn from(value: GeoDistanceQuery) -> Self {
2843        let mut keyed__ = ::indexmap::IndexMap::new();
2844        keyed__.insert(value.field, value.location);
2845        Self {
2846            boost: value.boost,
2847            name: value.name,
2848            distance: value.distance,
2849            distance_type: value.distance_type,
2850            validation_method: value.validation_method,
2851            ignore_unmapped: value.ignore_unmapped,
2852            keyed__,
2853        }
2854    }
2855}
2856
2857#[derive(Clone, Debug, PartialEq, Eq, Hash)]
2858#[non_exhaustive]
2859pub enum GeoExecution {
2860    /// `memory`
2861    Memory,
2862    /// `indexed`
2863    Indexed,
2864    /// A value this version of the specification doesn't list.
2865    Raw(::std::string::String),
2866}
2867
2868impl GeoExecution {
2869    /// The value as Elasticsearch writes it.
2870    pub fn as_str(&self) -> &str {
2871        match self {
2872            Self::Memory => "memory",
2873            Self::Indexed => "indexed",
2874            Self::Raw(value) => value,
2875        }
2876    }
2877
2878    /// The listed value with this name, if there is one.
2879    pub fn from_known(value: &str) -> ::core::option::Option<Self> {
2880        match value {
2881            "memory" => ::core::option::Option::Some(Self::Memory),
2882            "indexed" => ::core::option::Option::Some(Self::Indexed),
2883            _ => ::core::option::Option::None,
2884        }
2885    }
2886}
2887
2888impl ::serde::Serialize for GeoExecution {
2889    fn serialize<S__: ::serde::Serializer>(
2890        &self,
2891        serializer: S__,
2892    ) -> ::core::result::Result<S__::Ok, S__::Error> {
2893        serializer.serialize_str(self.as_str())
2894    }
2895}
2896
2897impl<'de> ::serde::Deserialize<'de> for GeoExecution {
2898    fn deserialize<D__: ::serde::Deserializer<'de>>(
2899        deserializer: D__,
2900    ) -> ::core::result::Result<Self, D__::Error> {
2901        ::oxsearch_core::__private::deserialize_string_enum(deserializer, "GeoExecution", |value| {
2902            Self::from_known(value).unwrap_or_else(|| Self::Raw(value.to_owned()))
2903        })
2904    }
2905}
2906
2907/// The variants of [`GeoGridQuery`].
2908#[derive(Clone, Debug, PartialEq)]
2909#[non_exhaustive]
2910pub enum GeoGridQueryVariant {
2911    Geotile(crate::GeoTile),
2912    Geohash(crate::GeoHash),
2913    Geohex(crate::GeoHexCell),
2914    /// Any variant, as JSON: an object with one property.
2915    Raw(::serde_json::Value),
2916}
2917
2918impl GeoGridQueryVariant {
2919    /// Writes the variant as one entry of a map.
2920    pub fn serialize_entry<M__: ::serde::ser::SerializeMap>(
2921        &self,
2922        map: &mut M__,
2923    ) -> ::core::result::Result<(), M__::Error> {
2924        match self {
2925            Self::Geotile(value) => map.serialize_entry("geotile", value),
2926            Self::Geohash(value) => map.serialize_entry("geohash", value),
2927            Self::Geohex(value) => map.serialize_entry("geohex", value),
2928            Self::Raw(value) => match value {
2929                ::serde_json::Value::Object(entries) => {
2930                    for (key, value) in entries {
2931                        map.serialize_entry(key, value)?;
2932                    }
2933                    ::core::result::Result::Ok(())
2934                }
2935                _ => ::core::result::Result::Err(<M__::Error as ::serde::ser::Error>::custom(
2936                    "a raw variant must be an object",
2937                )),
2938            },
2939        }
2940    }
2941}
2942
2943impl ::serde::Serialize for GeoGridQueryVariant {
2944    fn serialize<S__: ::serde::Serializer>(
2945        &self,
2946        serializer: S__,
2947    ) -> ::core::result::Result<S__::Ok, S__::Error> {
2948        match self {
2949            Self::Geotile(value) => {
2950                ::oxsearch_core::__private::serialize_variant(serializer, "geotile", value)
2951            }
2952            Self::Geohash(value) => {
2953                ::oxsearch_core::__private::serialize_variant(serializer, "geohash", value)
2954            }
2955            Self::Geohex(value) => {
2956                ::oxsearch_core::__private::serialize_variant(serializer, "geohex", value)
2957            }
2958            Self::Raw(value) => ::serde::Serialize::serialize(value, serializer),
2959        }
2960    }
2961}
2962
2963impl<'de> ::serde::Deserialize<'de> for GeoGridQueryVariant {
2964    fn deserialize<D__: ::serde::Deserializer<'de>>(
2965        deserializer: D__,
2966    ) -> ::core::result::Result<Self, D__::Error> {
2967        ::oxsearch_core::__private::deserialize_container(deserializer)
2968    }
2969}
2970
2971impl<'de> ::oxsearch_core::__private::Container<'de> for GeoGridQueryVariant {
2972    const NAME: &'static str = "GeoGridQueryVariant";
2973    fn variant<A__: ::serde::de::MapAccess<'de>>(
2974        key: &str,
2975        map: &mut A__,
2976    ) -> ::core::result::Result<Self, A__::Error> {
2977        ::core::result::Result::Ok(match key {
2978            "geotile" => Self::Geotile(map.next_value()?),
2979            "geohash" => Self::Geohash(map.next_value()?),
2980            "geohex" => Self::Geohex(map.next_value()?),
2981            _ => Self::Raw(::oxsearch_core::__private::raw_variant(
2982                key,
2983                map.next_value()?,
2984            )),
2985        })
2986    }
2987}
2988
2989#[derive(Clone, Debug, PartialEq)]
2990#[non_exhaustive]
2991pub struct GeoGridQuery {
2992    /// Floating point number used to decrease or increase the relevance scores of the query.
2993    /// Boost values are relative to the default value of 1.0.
2994    /// A boost value between 0 and 1.0 decreases the relevance score.
2995    /// A value greater than 1.0 increases the relevance score.
2996    pub boost: ::core::option::Option<f32>,
2997    pub name: ::core::option::Option<::std::string::String>,
2998    /// The variant.
2999    pub variant: ::core::option::Option<crate::query_dsl::GeoGridQueryVariant>,
3000}
3001
3002impl GeoGridQuery {
3003    /// A `GeoGridQuery` with its required properties set.
3004    pub fn new() -> Self {
3005        Self {
3006            boost: ::core::option::Option::None,
3007            name: ::core::option::Option::None,
3008            variant: ::core::option::Option::None,
3009        }
3010    }
3011}
3012
3013impl GeoGridQuery {
3014    /// Sets `boost`.
3015    pub fn boost(mut self, value: f32) -> Self {
3016        self.boost = ::core::option::Option::Some(value.into());
3017        self
3018    }
3019    /// Sets `name`.
3020    pub fn name(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
3021        self.name = ::core::option::Option::Some(value.into());
3022        self
3023    }
3024    /// Sets `variant`.
3025    pub fn variant(
3026        mut self,
3027        value: impl ::core::convert::Into<crate::query_dsl::GeoGridQueryVariant>,
3028    ) -> Self {
3029        self.variant = ::core::option::Option::Some(value.into());
3030        self
3031    }
3032}
3033
3034impl ::serde::Serialize for GeoGridQuery {
3035    fn serialize<S__: ::serde::Serializer>(
3036        &self,
3037        serializer: S__,
3038    ) -> ::core::result::Result<S__::Ok, S__::Error> {
3039        use ::serde::ser::SerializeMap as _;
3040        let mut map = serializer.serialize_map(::core::option::Option::None)?;
3041        if let ::core::option::Option::Some(value) = &self.boost {
3042            map.serialize_entry("boost", value)?;
3043        }
3044        if let ::core::option::Option::Some(value) = &self.name {
3045            map.serialize_entry("_name", value)?;
3046        }
3047        if let ::core::option::Option::Some(variant) = &self.variant {
3048            variant.serialize_entry(&mut map)?;
3049        }
3050        map.end()
3051    }
3052}
3053
3054impl<'de> ::serde::Deserialize<'de> for GeoGridQuery {
3055    fn deserialize<D__: ::serde::Deserializer<'de>>(
3056        deserializer: D__,
3057    ) -> ::core::result::Result<Self, D__::Error> {
3058        struct Fields;
3059        impl<'de> ::serde::de::Visitor<'de> for Fields {
3060            type Value = GeoGridQuery;
3061            fn expecting(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
3062                f.write_str("a GeoGridQuery object")
3063            }
3064            fn visit_map<A__: ::serde::de::MapAccess<'de>>(
3065                self,
3066                mut map: A__,
3067            ) -> ::core::result::Result<GeoGridQuery, A__::Error> {
3068                let mut boost = ::core::option::Option::None;
3069                let mut name = ::core::option::Option::None;
3070                let mut variant__ = ::core::option::Option::None;
3071                while let ::core::option::Option::Some(key) =
3072                    map.next_key::<::std::string::String>()?
3073                {
3074                    match key.as_str() {
3075                        "boost" => boost = ::core::option::Option::Some(map.next_value()?),
3076                        "_name" => name = ::core::option::Option::Some(map.next_value()?),
3077                        _ => {
3078                            if variant__.is_some() {
3079                                return ::core::result::Result::Err(
3080                                    ::oxsearch_core::__private::two_variants("GeoGridQuery", &key),
3081                                );
3082                            }
3083                            variant__ = ::core::option::Option::Some(
3084                                <GeoGridQueryVariant as ::oxsearch_core::__private::Container<
3085                                    'de,
3086                                >>::variant(&key, &mut map)?,
3087                            );
3088                        }
3089                    }
3090                }
3091                ::core::result::Result::Ok(GeoGridQuery {
3092                    boost,
3093                    name,
3094                    variant: variant__,
3095                })
3096            }
3097        }
3098        deserializer.deserialize_map(Fields)
3099    }
3100}
3101
3102#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
3103#[non_exhaustive]
3104pub struct GeoPolygonPoints {
3105    #[serde(default = "::core::default::Default::default")]
3106    pub points: ::std::vec::Vec<crate::GeoLocation>,
3107}
3108
3109impl GeoPolygonPoints {
3110    /// A `GeoPolygonPoints` with its required properties set.
3111    pub fn new(points: impl ::core::convert::Into<::std::vec::Vec<crate::GeoLocation>>) -> Self {
3112        Self {
3113            points: points.into(),
3114        }
3115    }
3116}
3117
3118impl GeoPolygonPoints {}
3119
3120#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
3121#[serde(try_from = "GeoPolygonQueryRepr", into = "GeoPolygonQueryRepr")]
3122#[non_exhaustive]
3123pub struct GeoPolygonQuery {
3124    /// Floating point number used to decrease or increase the relevance scores of the query.
3125    /// Boost values are relative to the default value of 1.0.
3126    /// A boost value between 0 and 1.0 decreases the relevance score.
3127    /// A value greater than 1.0 increases the relevance score.
3128    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
3129    pub boost: ::core::option::Option<f32>,
3130    #[serde(
3131        rename = "_name",
3132        skip_serializing_if = "::core::option::Option::is_none"
3133    )]
3134    pub name: ::core::option::Option<::std::string::String>,
3135    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
3136    pub validation_method: ::core::option::Option<crate::query_dsl::GeoValidationMethod>,
3137    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
3138    pub ignore_unmapped: ::core::option::Option<bool>,
3139    /// The name of the property that holds `polygon`.
3140    pub field: crate::Field,
3141    /// The value under `field`.
3142    pub polygon: crate::query_dsl::GeoPolygonPoints,
3143}
3144
3145impl GeoPolygonQuery {
3146    /// A `GeoPolygonQuery` with its required properties set.
3147    pub fn new(
3148        field: impl ::core::convert::Into<crate::Field>,
3149        polygon: impl ::core::convert::Into<crate::query_dsl::GeoPolygonPoints>,
3150    ) -> Self {
3151        Self {
3152            boost: ::core::option::Option::None,
3153            name: ::core::option::Option::None,
3154            validation_method: ::core::option::Option::None,
3155            ignore_unmapped: ::core::option::Option::None,
3156            field: field.into(),
3157            polygon: polygon.into(),
3158        }
3159    }
3160}
3161
3162impl GeoPolygonQuery {
3163    /// Sets `boost`.
3164    pub fn boost(mut self, value: f32) -> Self {
3165        self.boost = ::core::option::Option::Some(value.into());
3166        self
3167    }
3168    /// Sets `name`.
3169    pub fn name(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
3170        self.name = ::core::option::Option::Some(value.into());
3171        self
3172    }
3173    /// Sets `validation_method`.
3174    pub fn validation_method(
3175        mut self,
3176        value: impl ::core::convert::Into<crate::query_dsl::GeoValidationMethod>,
3177    ) -> Self {
3178        self.validation_method = ::core::option::Option::Some(value.into());
3179        self
3180    }
3181    /// Sets `ignore_unmapped`.
3182    pub fn ignore_unmapped(mut self, value: bool) -> Self {
3183        self.ignore_unmapped = ::core::option::Option::Some(value.into());
3184        self
3185    }
3186}
3187
3188#[derive(::serde::Serialize, ::serde::Deserialize)]
3189struct GeoPolygonQueryRepr {
3190    /// Floating point number used to decrease or increase the relevance scores of the query.
3191    /// Boost values are relative to the default value of 1.0.
3192    /// A boost value between 0 and 1.0 decreases the relevance score.
3193    /// A value greater than 1.0 increases the relevance score.
3194    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
3195    boost: ::core::option::Option<f32>,
3196    #[serde(
3197        rename = "_name",
3198        skip_serializing_if = "::core::option::Option::is_none"
3199    )]
3200    name: ::core::option::Option<::std::string::String>,
3201    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
3202    validation_method: ::core::option::Option<crate::query_dsl::GeoValidationMethod>,
3203    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
3204    ignore_unmapped: ::core::option::Option<bool>,
3205    #[serde(flatten)]
3206    keyed__: ::indexmap::IndexMap<crate::Field, crate::query_dsl::GeoPolygonPoints>,
3207}
3208
3209impl ::core::convert::TryFrom<GeoPolygonQueryRepr> for GeoPolygonQuery {
3210    type Error = ::std::string::String;
3211    fn try_from(repr: GeoPolygonQueryRepr) -> ::core::result::Result<Self, Self::Error> {
3212        let mut keyed = repr.keyed__.into_iter();
3213        match (keyed.next(), keyed.next()) {
3214            (::core::option::Option::Some((field, polygon)), ::core::option::Option::None) => {
3215                ::core::result::Result::Ok(Self {
3216                    boost: repr.boost,
3217                    name: repr.name,
3218                    validation_method: repr.validation_method,
3219                    ignore_unmapped: repr.ignore_unmapped,
3220                    field,
3221                    polygon,
3222                })
3223            }
3224            _ => ::core::result::Result::Err(::std::string::String::from(
3225                "GeoPolygonQuery needs exactly one property keyed by its field",
3226            )),
3227        }
3228    }
3229}
3230
3231impl ::core::convert::From<GeoPolygonQuery> for GeoPolygonQueryRepr {
3232    fn from(value: GeoPolygonQuery) -> Self {
3233        let mut keyed__ = ::indexmap::IndexMap::new();
3234        keyed__.insert(value.field, value.polygon);
3235        Self {
3236            boost: value.boost,
3237            name: value.name,
3238            validation_method: value.validation_method,
3239            ignore_unmapped: value.ignore_unmapped,
3240            keyed__,
3241        }
3242    }
3243}
3244
3245#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
3246#[non_exhaustive]
3247pub struct GeoShapeFieldQuery {
3248    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
3249    pub shape: ::core::option::Option<crate::GeoShape>,
3250    /// Query using an indexed shape retrieved from the the specified document and path.
3251    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
3252    pub indexed_shape: ::core::option::Option<crate::query_dsl::FieldLookup>,
3253    /// Spatial relation operator used to search a geo field.
3254    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
3255    pub relation: ::core::option::Option<crate::GeoShapeRelation>,
3256}
3257
3258impl GeoShapeFieldQuery {
3259    /// A `GeoShapeFieldQuery` with its required properties set.
3260    pub fn new() -> Self {
3261        Self {
3262            shape: ::core::option::Option::None,
3263            indexed_shape: ::core::option::Option::None,
3264            relation: ::core::option::Option::None,
3265        }
3266    }
3267}
3268
3269impl GeoShapeFieldQuery {
3270    /// Sets `shape`.
3271    pub fn shape(mut self, value: impl ::core::convert::Into<crate::GeoShape>) -> Self {
3272        self.shape = ::core::option::Option::Some(value.into());
3273        self
3274    }
3275    /// Sets `indexed_shape`.
3276    pub fn indexed_shape(
3277        mut self,
3278        value: impl ::core::convert::Into<crate::query_dsl::FieldLookup>,
3279    ) -> Self {
3280        self.indexed_shape = ::core::option::Option::Some(value.into());
3281        self
3282    }
3283    /// Sets `relation`.
3284    pub fn relation(mut self, value: impl ::core::convert::Into<crate::GeoShapeRelation>) -> Self {
3285        self.relation = ::core::option::Option::Some(value.into());
3286        self
3287    }
3288}
3289
3290#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
3291#[serde(try_from = "GeoShapeQueryRepr", into = "GeoShapeQueryRepr")]
3292#[non_exhaustive]
3293pub struct GeoShapeQuery {
3294    /// Floating point number used to decrease or increase the relevance scores of the query.
3295    /// Boost values are relative to the default value of 1.0.
3296    /// A boost value between 0 and 1.0 decreases the relevance score.
3297    /// A value greater than 1.0 increases the relevance score.
3298    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
3299    pub boost: ::core::option::Option<f32>,
3300    #[serde(
3301        rename = "_name",
3302        skip_serializing_if = "::core::option::Option::is_none"
3303    )]
3304    pub name: ::core::option::Option<::std::string::String>,
3305    /// Set to `true` to ignore an unmapped field and not match any documents for this query.
3306    /// Set to `false` to throw an exception if the field is not mapped.
3307    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
3308    pub ignore_unmapped: ::core::option::Option<bool>,
3309    /// The name of the property that holds `shape`.
3310    pub field: crate::Field,
3311    /// The value under `field`.
3312    pub shape: crate::query_dsl::GeoShapeFieldQuery,
3313}
3314
3315impl GeoShapeQuery {
3316    /// A `GeoShapeQuery` with its required properties set.
3317    pub fn new(
3318        field: impl ::core::convert::Into<crate::Field>,
3319        shape: impl ::core::convert::Into<crate::query_dsl::GeoShapeFieldQuery>,
3320    ) -> Self {
3321        Self {
3322            boost: ::core::option::Option::None,
3323            name: ::core::option::Option::None,
3324            ignore_unmapped: ::core::option::Option::None,
3325            field: field.into(),
3326            shape: shape.into(),
3327        }
3328    }
3329}
3330
3331impl GeoShapeQuery {
3332    /// Sets `boost`.
3333    pub fn boost(mut self, value: f32) -> Self {
3334        self.boost = ::core::option::Option::Some(value.into());
3335        self
3336    }
3337    /// Sets `name`.
3338    pub fn name(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
3339        self.name = ::core::option::Option::Some(value.into());
3340        self
3341    }
3342    /// Sets `ignore_unmapped`.
3343    pub fn ignore_unmapped(mut self, value: bool) -> Self {
3344        self.ignore_unmapped = ::core::option::Option::Some(value.into());
3345        self
3346    }
3347}
3348
3349#[derive(::serde::Serialize, ::serde::Deserialize)]
3350struct GeoShapeQueryRepr {
3351    /// Floating point number used to decrease or increase the relevance scores of the query.
3352    /// Boost values are relative to the default value of 1.0.
3353    /// A boost value between 0 and 1.0 decreases the relevance score.
3354    /// A value greater than 1.0 increases the relevance score.
3355    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
3356    boost: ::core::option::Option<f32>,
3357    #[serde(
3358        rename = "_name",
3359        skip_serializing_if = "::core::option::Option::is_none"
3360    )]
3361    name: ::core::option::Option<::std::string::String>,
3362    /// Set to `true` to ignore an unmapped field and not match any documents for this query.
3363    /// Set to `false` to throw an exception if the field is not mapped.
3364    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
3365    ignore_unmapped: ::core::option::Option<bool>,
3366    #[serde(flatten)]
3367    keyed__: ::indexmap::IndexMap<crate::Field, crate::query_dsl::GeoShapeFieldQuery>,
3368}
3369
3370impl ::core::convert::TryFrom<GeoShapeQueryRepr> for GeoShapeQuery {
3371    type Error = ::std::string::String;
3372    fn try_from(repr: GeoShapeQueryRepr) -> ::core::result::Result<Self, Self::Error> {
3373        let mut keyed = repr.keyed__.into_iter();
3374        match (keyed.next(), keyed.next()) {
3375            (::core::option::Option::Some((field, shape)), ::core::option::Option::None) => {
3376                ::core::result::Result::Ok(Self {
3377                    boost: repr.boost,
3378                    name: repr.name,
3379                    ignore_unmapped: repr.ignore_unmapped,
3380                    field,
3381                    shape,
3382                })
3383            }
3384            _ => ::core::result::Result::Err(::std::string::String::from(
3385                "GeoShapeQuery needs exactly one property keyed by its field",
3386            )),
3387        }
3388    }
3389}
3390
3391impl ::core::convert::From<GeoShapeQuery> for GeoShapeQueryRepr {
3392    fn from(value: GeoShapeQuery) -> Self {
3393        let mut keyed__ = ::indexmap::IndexMap::new();
3394        keyed__.insert(value.field, value.shape);
3395        Self {
3396            boost: value.boost,
3397            name: value.name,
3398            ignore_unmapped: value.ignore_unmapped,
3399            keyed__,
3400        }
3401    }
3402}
3403
3404#[derive(Clone, Debug, PartialEq, Eq, Hash)]
3405#[non_exhaustive]
3406pub enum GeoValidationMethod {
3407    /// Accept geo points with invalid latitude or longitude and additionally try and infer correct coordinates.
3408    Coerce,
3409    /// Accept geo points with invalid latitude or longitude.
3410    IgnoreMalformed,
3411    /// `strict`
3412    Strict,
3413    /// A value this version of the specification doesn't list.
3414    Raw(::std::string::String),
3415}
3416
3417impl GeoValidationMethod {
3418    /// The value as Elasticsearch writes it.
3419    pub fn as_str(&self) -> &str {
3420        match self {
3421            Self::Coerce => "coerce",
3422            Self::IgnoreMalformed => "ignore_malformed",
3423            Self::Strict => "strict",
3424            Self::Raw(value) => value,
3425        }
3426    }
3427
3428    /// The listed value with this name, if there is one.
3429    pub fn from_known(value: &str) -> ::core::option::Option<Self> {
3430        match value {
3431            "coerce" => ::core::option::Option::Some(Self::Coerce),
3432            "ignore_malformed" => ::core::option::Option::Some(Self::IgnoreMalformed),
3433            "strict" => ::core::option::Option::Some(Self::Strict),
3434            _ => ::core::option::Option::None,
3435        }
3436    }
3437}
3438
3439impl ::serde::Serialize for GeoValidationMethod {
3440    fn serialize<S__: ::serde::Serializer>(
3441        &self,
3442        serializer: S__,
3443    ) -> ::core::result::Result<S__::Ok, S__::Error> {
3444        serializer.serialize_str(self.as_str())
3445    }
3446}
3447
3448impl<'de> ::serde::Deserialize<'de> for GeoValidationMethod {
3449    fn deserialize<D__: ::serde::Deserializer<'de>>(
3450        deserializer: D__,
3451    ) -> ::core::result::Result<Self, D__::Error> {
3452        ::oxsearch_core::__private::deserialize_string_enum(
3453            deserializer,
3454            "GeoValidationMethod",
3455            |value| Self::from_known(value).unwrap_or_else(|| Self::Raw(value.to_owned())),
3456        )
3457    }
3458}
3459
3460#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
3461#[non_exhaustive]
3462pub struct HasChildQuery {
3463    /// Floating point number used to decrease or increase the relevance scores of the query.
3464    /// Boost values are relative to the default value of 1.0.
3465    /// A boost value between 0 and 1.0 decreases the relevance score.
3466    /// A value greater than 1.0 increases the relevance score.
3467    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
3468    pub boost: ::core::option::Option<f32>,
3469    #[serde(
3470        rename = "_name",
3471        skip_serializing_if = "::core::option::Option::is_none"
3472    )]
3473    pub name: ::core::option::Option<::std::string::String>,
3474    /// Indicates whether to ignore an unmapped `type` and not return any documents instead of an error.
3475    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
3476    pub ignore_unmapped: ::core::option::Option<bool>,
3477    /// If defined, each search hit will contain inner hits.
3478    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
3479    pub inner_hits: ::core::option::Option<crate::search::InnerHits>,
3480    /// Maximum number of child documents that match the query allowed for a returned parent document.
3481    /// If the parent document exceeds this limit, it is excluded from the search results.
3482    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
3483    pub max_children: ::core::option::Option<i32>,
3484    /// Minimum number of child documents that match the query required to match the query for a returned parent document.
3485    /// If the parent document does not meet this limit, it is excluded from the search results.
3486    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
3487    pub min_children: ::core::option::Option<i32>,
3488    /// Query you wish to run on child documents of the `type` field.
3489    /// If a child document matches the search, the query returns the parent document.
3490    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
3491    pub query: ::core::option::Option<crate::query_dsl::QueryContainer>,
3492    /// Indicates how scores for matching child documents affect the root parent document’s relevance score.
3493    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
3494    pub score_mode: ::core::option::Option<crate::query_dsl::ChildScoreMode>,
3495    /// Name of the child relationship mapped for the `join` field.
3496    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
3497    pub r#type: ::core::option::Option<crate::RelationName>,
3498}
3499
3500impl HasChildQuery {
3501    /// A `HasChildQuery` with its required properties set.
3502    pub fn new(
3503        query: impl ::core::convert::Into<crate::query_dsl::QueryContainer>,
3504        r#type: impl ::core::convert::Into<crate::RelationName>,
3505    ) -> Self {
3506        Self {
3507            boost: ::core::option::Option::None,
3508            name: ::core::option::Option::None,
3509            ignore_unmapped: ::core::option::Option::None,
3510            inner_hits: ::core::option::Option::None,
3511            max_children: ::core::option::Option::None,
3512            min_children: ::core::option::Option::None,
3513            query: ::core::option::Option::Some(query.into()),
3514            score_mode: ::core::option::Option::None,
3515            r#type: ::core::option::Option::Some(r#type.into()),
3516        }
3517    }
3518}
3519
3520impl HasChildQuery {
3521    /// Sets `boost`.
3522    pub fn boost(mut self, value: f32) -> Self {
3523        self.boost = ::core::option::Option::Some(value.into());
3524        self
3525    }
3526    /// Sets `name`.
3527    pub fn name(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
3528        self.name = ::core::option::Option::Some(value.into());
3529        self
3530    }
3531    /// Sets `ignore_unmapped`.
3532    pub fn ignore_unmapped(mut self, value: bool) -> Self {
3533        self.ignore_unmapped = ::core::option::Option::Some(value.into());
3534        self
3535    }
3536    /// Sets `inner_hits`.
3537    pub fn inner_hits(
3538        mut self,
3539        value: impl ::core::convert::Into<crate::search::InnerHits>,
3540    ) -> Self {
3541        self.inner_hits = ::core::option::Option::Some(value.into());
3542        self
3543    }
3544    /// Sets `max_children`.
3545    pub fn max_children(mut self, value: i32) -> Self {
3546        self.max_children = ::core::option::Option::Some(value.into());
3547        self
3548    }
3549    /// Sets `min_children`.
3550    pub fn min_children(mut self, value: i32) -> Self {
3551        self.min_children = ::core::option::Option::Some(value.into());
3552        self
3553    }
3554    /// Sets `score_mode`.
3555    pub fn score_mode(
3556        mut self,
3557        value: impl ::core::convert::Into<crate::query_dsl::ChildScoreMode>,
3558    ) -> Self {
3559        self.score_mode = ::core::option::Option::Some(value.into());
3560        self
3561    }
3562}
3563
3564#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
3565#[non_exhaustive]
3566pub struct HasParentQuery {
3567    /// Floating point number used to decrease or increase the relevance scores of the query.
3568    /// Boost values are relative to the default value of 1.0.
3569    /// A boost value between 0 and 1.0 decreases the relevance score.
3570    /// A value greater than 1.0 increases the relevance score.
3571    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
3572    pub boost: ::core::option::Option<f32>,
3573    #[serde(
3574        rename = "_name",
3575        skip_serializing_if = "::core::option::Option::is_none"
3576    )]
3577    pub name: ::core::option::Option<::std::string::String>,
3578    /// Indicates whether to ignore an unmapped `parent_type` and not return any documents instead of an error.
3579    /// You can use this parameter to query multiple indices that may not contain the `parent_type`.
3580    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
3581    pub ignore_unmapped: ::core::option::Option<bool>,
3582    /// If defined, each search hit will contain inner hits.
3583    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
3584    pub inner_hits: ::core::option::Option<crate::search::InnerHits>,
3585    /// Name of the parent relationship mapped for the `join` field.
3586    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
3587    pub parent_type: ::core::option::Option<crate::RelationName>,
3588    /// Query you wish to run on parent documents of the `parent_type` field.
3589    /// If a parent document matches the search, the query returns its child documents.
3590    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
3591    pub query: ::core::option::Option<crate::query_dsl::QueryContainer>,
3592    /// Indicates whether the relevance score of a matching parent document is aggregated into its child documents.
3593    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
3594    pub score: ::core::option::Option<bool>,
3595}
3596
3597impl HasParentQuery {
3598    /// A `HasParentQuery` with its required properties set.
3599    pub fn new(
3600        parent_type: impl ::core::convert::Into<crate::RelationName>,
3601        query: impl ::core::convert::Into<crate::query_dsl::QueryContainer>,
3602    ) -> Self {
3603        Self {
3604            boost: ::core::option::Option::None,
3605            name: ::core::option::Option::None,
3606            ignore_unmapped: ::core::option::Option::None,
3607            inner_hits: ::core::option::Option::None,
3608            parent_type: ::core::option::Option::Some(parent_type.into()),
3609            query: ::core::option::Option::Some(query.into()),
3610            score: ::core::option::Option::None,
3611        }
3612    }
3613}
3614
3615impl HasParentQuery {
3616    /// Sets `boost`.
3617    pub fn boost(mut self, value: f32) -> Self {
3618        self.boost = ::core::option::Option::Some(value.into());
3619        self
3620    }
3621    /// Sets `name`.
3622    pub fn name(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
3623        self.name = ::core::option::Option::Some(value.into());
3624        self
3625    }
3626    /// Sets `ignore_unmapped`.
3627    pub fn ignore_unmapped(mut self, value: bool) -> Self {
3628        self.ignore_unmapped = ::core::option::Option::Some(value.into());
3629        self
3630    }
3631    /// Sets `inner_hits`.
3632    pub fn inner_hits(
3633        mut self,
3634        value: impl ::core::convert::Into<crate::search::InnerHits>,
3635    ) -> Self {
3636        self.inner_hits = ::core::option::Option::Some(value.into());
3637        self
3638    }
3639    /// Sets `score`.
3640    pub fn score(mut self, value: bool) -> Self {
3641        self.score = ::core::option::Option::Some(value.into());
3642        self
3643    }
3644}
3645
3646#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
3647#[non_exhaustive]
3648pub struct IdsQuery {
3649    /// Floating point number used to decrease or increase the relevance scores of the query.
3650    /// Boost values are relative to the default value of 1.0.
3651    /// A boost value between 0 and 1.0 decreases the relevance score.
3652    /// A value greater than 1.0 increases the relevance score.
3653    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
3654    pub boost: ::core::option::Option<f32>,
3655    #[serde(
3656        rename = "_name",
3657        skip_serializing_if = "::core::option::Option::is_none"
3658    )]
3659    pub name: ::core::option::Option<::std::string::String>,
3660    /// An array of document IDs.
3661    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
3662    pub values: ::core::option::Option<crate::Ids>,
3663}
3664
3665impl IdsQuery {
3666    /// A `IdsQuery` with its required properties set.
3667    pub fn new() -> Self {
3668        Self {
3669            boost: ::core::option::Option::None,
3670            name: ::core::option::Option::None,
3671            values: ::core::option::Option::None,
3672        }
3673    }
3674}
3675
3676impl IdsQuery {
3677    /// Sets `boost`.
3678    pub fn boost(mut self, value: f32) -> Self {
3679        self.boost = ::core::option::Option::Some(value.into());
3680        self
3681    }
3682    /// Sets `name`.
3683    pub fn name(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
3684        self.name = ::core::option::Option::Some(value.into());
3685        self
3686    }
3687    /// Sets `values`.
3688    pub fn values(mut self, value: impl ::core::convert::Into<crate::Ids>) -> Self {
3689        self.values = ::core::option::Option::Some(value.into());
3690        self
3691    }
3692}
3693
3694#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
3695#[non_exhaustive]
3696pub struct IntervalsAllOf {
3697    /// An array of rules to combine. All rules must produce a match in a document for the overall source to match.
3698    #[serde(default = "::core::default::Default::default")]
3699    pub intervals: ::std::vec::Vec<crate::query_dsl::IntervalsContainer>,
3700    /// Maximum number of positions between the matching terms.
3701    /// Intervals produced by the rules further apart than this are not considered matches.
3702    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
3703    pub max_gaps: ::core::option::Option<i32>,
3704    /// If `true`, intervals produced by the rules should appear in the order in which they are specified.
3705    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
3706    pub ordered: ::core::option::Option<bool>,
3707    /// Rule used to filter returned intervals.
3708    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
3709    pub filter: ::core::option::Option<crate::query_dsl::IntervalsFilter>,
3710}
3711
3712impl IntervalsAllOf {
3713    /// A `IntervalsAllOf` with its required properties set.
3714    pub fn new(
3715        intervals: impl ::core::convert::Into<::std::vec::Vec<crate::query_dsl::IntervalsContainer>>,
3716    ) -> Self {
3717        Self {
3718            intervals: intervals.into(),
3719            max_gaps: ::core::option::Option::None,
3720            ordered: ::core::option::Option::None,
3721            filter: ::core::option::Option::None,
3722        }
3723    }
3724}
3725
3726impl IntervalsAllOf {
3727    /// Sets `max_gaps`.
3728    pub fn max_gaps(mut self, value: i32) -> Self {
3729        self.max_gaps = ::core::option::Option::Some(value.into());
3730        self
3731    }
3732    /// Sets `ordered`.
3733    pub fn ordered(mut self, value: bool) -> Self {
3734        self.ordered = ::core::option::Option::Some(value.into());
3735        self
3736    }
3737    /// Sets `filter`.
3738    pub fn filter(
3739        mut self,
3740        value: impl ::core::convert::Into<crate::query_dsl::IntervalsFilter>,
3741    ) -> Self {
3742        self.filter = ::core::option::Option::Some(value.into());
3743        self
3744    }
3745}
3746
3747#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
3748#[non_exhaustive]
3749pub struct IntervalsAnyOf {
3750    /// An array of rules to match.
3751    #[serde(default = "::core::default::Default::default")]
3752    pub intervals: ::std::vec::Vec<crate::query_dsl::IntervalsContainer>,
3753    /// Rule used to filter returned intervals.
3754    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
3755    pub filter: ::core::option::Option<crate::query_dsl::IntervalsFilter>,
3756}
3757
3758impl IntervalsAnyOf {
3759    /// A `IntervalsAnyOf` with its required properties set.
3760    pub fn new(
3761        intervals: impl ::core::convert::Into<::std::vec::Vec<crate::query_dsl::IntervalsContainer>>,
3762    ) -> Self {
3763        Self {
3764            intervals: intervals.into(),
3765            filter: ::core::option::Option::None,
3766        }
3767    }
3768}
3769
3770impl IntervalsAnyOf {
3771    /// Sets `filter`.
3772    pub fn filter(
3773        mut self,
3774        value: impl ::core::convert::Into<crate::query_dsl::IntervalsFilter>,
3775    ) -> Self {
3776        self.filter = ::core::option::Option::Some(value.into());
3777        self
3778    }
3779}
3780
3781#[derive(Clone, Debug, PartialEq)]
3782#[non_exhaustive]
3783pub enum IntervalsContainer {
3784    /// Returns matches that span a combination of other rules.
3785    AllOf(::std::boxed::Box<crate::query_dsl::IntervalsAllOf>),
3786    /// Returns intervals produced by any of its sub-rules.
3787    AnyOf(::std::boxed::Box<crate::query_dsl::IntervalsAnyOf>),
3788    /// Matches analyzed text.
3789    Fuzzy(crate::query_dsl::IntervalsFuzzy),
3790    /// Matches analyzed text.
3791    Match(::std::boxed::Box<crate::query_dsl::IntervalsMatch>),
3792    /// Matches terms that start with a specified set of characters.
3793    Prefix(crate::query_dsl::IntervalsPrefix),
3794    Range(crate::query_dsl::IntervalsRange),
3795    Regexp(crate::query_dsl::IntervalsRegexp),
3796    /// Matches terms using a wildcard pattern.
3797    Wildcard(crate::query_dsl::IntervalsWildcard),
3798    /// Any variant, as JSON: an object with one property.
3799    Raw(::serde_json::Value),
3800}
3801
3802impl IntervalsContainer {
3803    /// Writes the variant as one entry of a map.
3804    pub fn serialize_entry<M__: ::serde::ser::SerializeMap>(
3805        &self,
3806        map: &mut M__,
3807    ) -> ::core::result::Result<(), M__::Error> {
3808        match self {
3809            Self::AllOf(value) => map.serialize_entry("all_of", value),
3810            Self::AnyOf(value) => map.serialize_entry("any_of", value),
3811            Self::Fuzzy(value) => map.serialize_entry("fuzzy", value),
3812            Self::Match(value) => map.serialize_entry("match", value),
3813            Self::Prefix(value) => map.serialize_entry("prefix", value),
3814            Self::Range(value) => map.serialize_entry("range", value),
3815            Self::Regexp(value) => map.serialize_entry("regexp", value),
3816            Self::Wildcard(value) => map.serialize_entry("wildcard", value),
3817            Self::Raw(value) => match value {
3818                ::serde_json::Value::Object(entries) => {
3819                    for (key, value) in entries {
3820                        map.serialize_entry(key, value)?;
3821                    }
3822                    ::core::result::Result::Ok(())
3823                }
3824                _ => ::core::result::Result::Err(<M__::Error as ::serde::ser::Error>::custom(
3825                    "a raw variant must be an object",
3826                )),
3827            },
3828        }
3829    }
3830}
3831
3832impl ::serde::Serialize for IntervalsContainer {
3833    fn serialize<S__: ::serde::Serializer>(
3834        &self,
3835        serializer: S__,
3836    ) -> ::core::result::Result<S__::Ok, S__::Error> {
3837        match self {
3838            Self::AllOf(value) => {
3839                ::oxsearch_core::__private::serialize_variant(serializer, "all_of", value)
3840            }
3841            Self::AnyOf(value) => {
3842                ::oxsearch_core::__private::serialize_variant(serializer, "any_of", value)
3843            }
3844            Self::Fuzzy(value) => {
3845                ::oxsearch_core::__private::serialize_variant(serializer, "fuzzy", value)
3846            }
3847            Self::Match(value) => {
3848                ::oxsearch_core::__private::serialize_variant(serializer, "match", value)
3849            }
3850            Self::Prefix(value) => {
3851                ::oxsearch_core::__private::serialize_variant(serializer, "prefix", value)
3852            }
3853            Self::Range(value) => {
3854                ::oxsearch_core::__private::serialize_variant(serializer, "range", value)
3855            }
3856            Self::Regexp(value) => {
3857                ::oxsearch_core::__private::serialize_variant(serializer, "regexp", value)
3858            }
3859            Self::Wildcard(value) => {
3860                ::oxsearch_core::__private::serialize_variant(serializer, "wildcard", value)
3861            }
3862            Self::Raw(value) => ::serde::Serialize::serialize(value, serializer),
3863        }
3864    }
3865}
3866
3867impl<'de> ::serde::Deserialize<'de> for IntervalsContainer {
3868    fn deserialize<D__: ::serde::Deserializer<'de>>(
3869        deserializer: D__,
3870    ) -> ::core::result::Result<Self, D__::Error> {
3871        ::oxsearch_core::__private::deserialize_container(deserializer)
3872    }
3873}
3874
3875impl<'de> ::oxsearch_core::__private::Container<'de> for IntervalsContainer {
3876    const NAME: &'static str = "IntervalsContainer";
3877    fn variant<A__: ::serde::de::MapAccess<'de>>(
3878        key: &str,
3879        map: &mut A__,
3880    ) -> ::core::result::Result<Self, A__::Error> {
3881        ::core::result::Result::Ok(match key {
3882            "all_of" => Self::AllOf(map.next_value()?),
3883            "any_of" => Self::AnyOf(map.next_value()?),
3884            "fuzzy" => Self::Fuzzy(map.next_value()?),
3885            "match" => Self::Match(map.next_value()?),
3886            "prefix" => Self::Prefix(map.next_value()?),
3887            "range" => Self::Range(map.next_value()?),
3888            "regexp" => Self::Regexp(map.next_value()?),
3889            "wildcard" => Self::Wildcard(map.next_value()?),
3890            _ => Self::Raw(::oxsearch_core::__private::raw_variant(
3891                key,
3892                map.next_value()?,
3893            )),
3894        })
3895    }
3896}
3897
3898impl ::core::convert::From<crate::query_dsl::IntervalsAllOf> for IntervalsContainer {
3899    fn from(value: crate::query_dsl::IntervalsAllOf) -> Self {
3900        Self::AllOf(::std::boxed::Box::new(value))
3901    }
3902}
3903
3904impl ::core::convert::From<crate::query_dsl::IntervalsAnyOf> for IntervalsContainer {
3905    fn from(value: crate::query_dsl::IntervalsAnyOf) -> Self {
3906        Self::AnyOf(::std::boxed::Box::new(value))
3907    }
3908}
3909
3910impl ::core::convert::From<crate::query_dsl::IntervalsFuzzy> for IntervalsContainer {
3911    fn from(value: crate::query_dsl::IntervalsFuzzy) -> Self {
3912        Self::Fuzzy(value)
3913    }
3914}
3915
3916impl ::core::convert::From<crate::query_dsl::IntervalsMatch> for IntervalsContainer {
3917    fn from(value: crate::query_dsl::IntervalsMatch) -> Self {
3918        Self::Match(::std::boxed::Box::new(value))
3919    }
3920}
3921
3922impl ::core::convert::From<crate::query_dsl::IntervalsPrefix> for IntervalsContainer {
3923    fn from(value: crate::query_dsl::IntervalsPrefix) -> Self {
3924        Self::Prefix(value)
3925    }
3926}
3927
3928impl ::core::convert::From<crate::query_dsl::IntervalsRange> for IntervalsContainer {
3929    fn from(value: crate::query_dsl::IntervalsRange) -> Self {
3930        Self::Range(value)
3931    }
3932}
3933
3934impl ::core::convert::From<crate::query_dsl::IntervalsRegexp> for IntervalsContainer {
3935    fn from(value: crate::query_dsl::IntervalsRegexp) -> Self {
3936        Self::Regexp(value)
3937    }
3938}
3939
3940impl ::core::convert::From<crate::query_dsl::IntervalsWildcard> for IntervalsContainer {
3941    fn from(value: crate::query_dsl::IntervalsWildcard) -> Self {
3942        Self::Wildcard(value)
3943    }
3944}
3945
3946#[derive(Clone, Debug, PartialEq)]
3947#[non_exhaustive]
3948pub enum IntervalsFilter {
3949    /// Query used to return intervals that follow an interval from the `filter` rule.
3950    After(crate::query_dsl::IntervalsContainer),
3951    /// Query used to return intervals that occur before an interval from the `filter` rule.
3952    Before(crate::query_dsl::IntervalsContainer),
3953    /// Query used to return intervals contained by an interval from the `filter` rule.
3954    ContainedBy(crate::query_dsl::IntervalsContainer),
3955    /// Query used to return intervals that contain an interval from the `filter` rule.
3956    Containing(crate::query_dsl::IntervalsContainer),
3957    /// Query used to return intervals that are **not** contained by an interval from the `filter` rule.
3958    NotContainedBy(crate::query_dsl::IntervalsContainer),
3959    /// Query used to return intervals that do **not** contain an interval from the `filter` rule.
3960    NotContaining(crate::query_dsl::IntervalsContainer),
3961    /// Query used to return intervals that do **not** overlap with an interval from the `filter` rule.
3962    NotOverlapping(crate::query_dsl::IntervalsContainer),
3963    /// Query used to return intervals that overlap with an interval from the `filter` rule.
3964    Overlapping(crate::query_dsl::IntervalsContainer),
3965    /// Script used to return matching documents.
3966    /// This script must return a boolean value: `true` or `false`.
3967    Script(crate::Script),
3968    /// Any variant, as JSON: an object with one property.
3969    Raw(::serde_json::Value),
3970}
3971
3972impl IntervalsFilter {
3973    /// Writes the variant as one entry of a map.
3974    pub fn serialize_entry<M__: ::serde::ser::SerializeMap>(
3975        &self,
3976        map: &mut M__,
3977    ) -> ::core::result::Result<(), M__::Error> {
3978        match self {
3979            Self::After(value) => map.serialize_entry("after", value),
3980            Self::Before(value) => map.serialize_entry("before", value),
3981            Self::ContainedBy(value) => map.serialize_entry("contained_by", value),
3982            Self::Containing(value) => map.serialize_entry("containing", value),
3983            Self::NotContainedBy(value) => map.serialize_entry("not_contained_by", value),
3984            Self::NotContaining(value) => map.serialize_entry("not_containing", value),
3985            Self::NotOverlapping(value) => map.serialize_entry("not_overlapping", value),
3986            Self::Overlapping(value) => map.serialize_entry("overlapping", value),
3987            Self::Script(value) => map.serialize_entry("script", value),
3988            Self::Raw(value) => match value {
3989                ::serde_json::Value::Object(entries) => {
3990                    for (key, value) in entries {
3991                        map.serialize_entry(key, value)?;
3992                    }
3993                    ::core::result::Result::Ok(())
3994                }
3995                _ => ::core::result::Result::Err(<M__::Error as ::serde::ser::Error>::custom(
3996                    "a raw variant must be an object",
3997                )),
3998            },
3999        }
4000    }
4001}
4002
4003impl ::serde::Serialize for IntervalsFilter {
4004    fn serialize<S__: ::serde::Serializer>(
4005        &self,
4006        serializer: S__,
4007    ) -> ::core::result::Result<S__::Ok, S__::Error> {
4008        match self {
4009            Self::After(value) => {
4010                ::oxsearch_core::__private::serialize_variant(serializer, "after", value)
4011            }
4012            Self::Before(value) => {
4013                ::oxsearch_core::__private::serialize_variant(serializer, "before", value)
4014            }
4015            Self::ContainedBy(value) => {
4016                ::oxsearch_core::__private::serialize_variant(serializer, "contained_by", value)
4017            }
4018            Self::Containing(value) => {
4019                ::oxsearch_core::__private::serialize_variant(serializer, "containing", value)
4020            }
4021            Self::NotContainedBy(value) => {
4022                ::oxsearch_core::__private::serialize_variant(serializer, "not_contained_by", value)
4023            }
4024            Self::NotContaining(value) => {
4025                ::oxsearch_core::__private::serialize_variant(serializer, "not_containing", value)
4026            }
4027            Self::NotOverlapping(value) => {
4028                ::oxsearch_core::__private::serialize_variant(serializer, "not_overlapping", value)
4029            }
4030            Self::Overlapping(value) => {
4031                ::oxsearch_core::__private::serialize_variant(serializer, "overlapping", value)
4032            }
4033            Self::Script(value) => {
4034                ::oxsearch_core::__private::serialize_variant(serializer, "script", value)
4035            }
4036            Self::Raw(value) => ::serde::Serialize::serialize(value, serializer),
4037        }
4038    }
4039}
4040
4041impl<'de> ::serde::Deserialize<'de> for IntervalsFilter {
4042    fn deserialize<D__: ::serde::Deserializer<'de>>(
4043        deserializer: D__,
4044    ) -> ::core::result::Result<Self, D__::Error> {
4045        ::oxsearch_core::__private::deserialize_container(deserializer)
4046    }
4047}
4048
4049impl<'de> ::oxsearch_core::__private::Container<'de> for IntervalsFilter {
4050    const NAME: &'static str = "IntervalsFilter";
4051    fn variant<A__: ::serde::de::MapAccess<'de>>(
4052        key: &str,
4053        map: &mut A__,
4054    ) -> ::core::result::Result<Self, A__::Error> {
4055        ::core::result::Result::Ok(match key {
4056            "after" => Self::After(map.next_value()?),
4057            "before" => Self::Before(map.next_value()?),
4058            "contained_by" => Self::ContainedBy(map.next_value()?),
4059            "containing" => Self::Containing(map.next_value()?),
4060            "not_contained_by" => Self::NotContainedBy(map.next_value()?),
4061            "not_containing" => Self::NotContaining(map.next_value()?),
4062            "not_overlapping" => Self::NotOverlapping(map.next_value()?),
4063            "overlapping" => Self::Overlapping(map.next_value()?),
4064            "script" => Self::Script(map.next_value()?),
4065            _ => Self::Raw(::oxsearch_core::__private::raw_variant(
4066                key,
4067                map.next_value()?,
4068            )),
4069        })
4070    }
4071}
4072
4073impl ::core::convert::From<crate::Script> for IntervalsFilter {
4074    fn from(value: crate::Script) -> Self {
4075        Self::Script(value)
4076    }
4077}
4078
4079#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
4080#[non_exhaustive]
4081pub struct IntervalsFuzzy {
4082    /// Analyzer used to normalize the term.
4083    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
4084    pub analyzer: ::core::option::Option<::std::string::String>,
4085    /// Maximum edit distance allowed for matching.
4086    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
4087    pub fuzziness: ::core::option::Option<crate::Fuzziness>,
4088    /// Number of beginning characters left unchanged when creating expansions.
4089    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
4090    pub prefix_length: ::core::option::Option<i32>,
4091    /// The term to match.
4092    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
4093    pub term: ::core::option::Option<::std::string::String>,
4094    /// Indicates whether edits include transpositions of two adjacent characters (for example, `ab` to `ba`).
4095    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
4096    pub transpositions: ::core::option::Option<bool>,
4097    /// If specified, match intervals from this field rather than the top-level field.
4098    /// The `term` is normalized using the search analyzer from this field, unless `analyzer` is specified separately.
4099    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
4100    pub use_field: ::core::option::Option<crate::Field>,
4101}
4102
4103impl IntervalsFuzzy {
4104    /// A `IntervalsFuzzy` with its required properties set.
4105    pub fn new(term: impl ::core::convert::Into<::std::string::String>) -> Self {
4106        Self {
4107            analyzer: ::core::option::Option::None,
4108            fuzziness: ::core::option::Option::None,
4109            prefix_length: ::core::option::Option::None,
4110            term: ::core::option::Option::Some(term.into()),
4111            transpositions: ::core::option::Option::None,
4112            use_field: ::core::option::Option::None,
4113        }
4114    }
4115}
4116
4117impl IntervalsFuzzy {
4118    /// Sets `analyzer`.
4119    pub fn analyzer(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
4120        self.analyzer = ::core::option::Option::Some(value.into());
4121        self
4122    }
4123    /// Sets `fuzziness`.
4124    pub fn fuzziness(mut self, value: impl ::core::convert::Into<crate::Fuzziness>) -> Self {
4125        self.fuzziness = ::core::option::Option::Some(value.into());
4126        self
4127    }
4128    /// Sets `prefix_length`.
4129    pub fn prefix_length(mut self, value: i32) -> Self {
4130        self.prefix_length = ::core::option::Option::Some(value.into());
4131        self
4132    }
4133    /// Sets `transpositions`.
4134    pub fn transpositions(mut self, value: bool) -> Self {
4135        self.transpositions = ::core::option::Option::Some(value.into());
4136        self
4137    }
4138    /// Sets `use_field`.
4139    pub fn use_field(mut self, value: impl ::core::convert::Into<crate::Field>) -> Self {
4140        self.use_field = ::core::option::Option::Some(value.into());
4141        self
4142    }
4143}
4144
4145#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
4146#[non_exhaustive]
4147pub struct IntervalsMatch {
4148    /// Analyzer used to analyze terms in the query.
4149    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
4150    pub analyzer: ::core::option::Option<::std::string::String>,
4151    /// Maximum number of positions between the matching terms.
4152    /// Terms further apart than this are not considered matches.
4153    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
4154    pub max_gaps: ::core::option::Option<i32>,
4155    /// If `true`, matching terms must appear in their specified order.
4156    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
4157    pub ordered: ::core::option::Option<bool>,
4158    /// Text you wish to find in the provided field.
4159    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
4160    pub query: ::core::option::Option<::std::string::String>,
4161    /// If specified, match intervals from this field rather than the top-level field.
4162    /// The `term` is normalized using the search analyzer from this field, unless `analyzer` is specified separately.
4163    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
4164    pub use_field: ::core::option::Option<crate::Field>,
4165    /// An optional interval filter.
4166    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
4167    pub filter: ::core::option::Option<crate::query_dsl::IntervalsFilter>,
4168}
4169
4170impl IntervalsMatch {
4171    /// A `IntervalsMatch` with its required properties set.
4172    pub fn new(query: impl ::core::convert::Into<::std::string::String>) -> Self {
4173        Self {
4174            analyzer: ::core::option::Option::None,
4175            max_gaps: ::core::option::Option::None,
4176            ordered: ::core::option::Option::None,
4177            query: ::core::option::Option::Some(query.into()),
4178            use_field: ::core::option::Option::None,
4179            filter: ::core::option::Option::None,
4180        }
4181    }
4182}
4183
4184impl IntervalsMatch {
4185    /// Sets `analyzer`.
4186    pub fn analyzer(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
4187        self.analyzer = ::core::option::Option::Some(value.into());
4188        self
4189    }
4190    /// Sets `max_gaps`.
4191    pub fn max_gaps(mut self, value: i32) -> Self {
4192        self.max_gaps = ::core::option::Option::Some(value.into());
4193        self
4194    }
4195    /// Sets `ordered`.
4196    pub fn ordered(mut self, value: bool) -> Self {
4197        self.ordered = ::core::option::Option::Some(value.into());
4198        self
4199    }
4200    /// Sets `use_field`.
4201    pub fn use_field(mut self, value: impl ::core::convert::Into<crate::Field>) -> Self {
4202        self.use_field = ::core::option::Option::Some(value.into());
4203        self
4204    }
4205    /// Sets `filter`.
4206    pub fn filter(
4207        mut self,
4208        value: impl ::core::convert::Into<crate::query_dsl::IntervalsFilter>,
4209    ) -> Self {
4210        self.filter = ::core::option::Option::Some(value.into());
4211        self
4212    }
4213}
4214
4215#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
4216#[non_exhaustive]
4217pub struct IntervalsPrefix {
4218    /// Analyzer used to analyze the `prefix`.
4219    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
4220    pub analyzer: ::core::option::Option<::std::string::String>,
4221    /// Beginning characters of terms you wish to find in the top-level field.
4222    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
4223    pub prefix: ::core::option::Option<::std::string::String>,
4224    /// If specified, match intervals from this field rather than the top-level field.
4225    /// The `prefix` is normalized using the search analyzer from this field, unless `analyzer` is specified separately.
4226    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
4227    pub use_field: ::core::option::Option<crate::Field>,
4228}
4229
4230impl IntervalsPrefix {
4231    /// A `IntervalsPrefix` with its required properties set.
4232    pub fn new(prefix: impl ::core::convert::Into<::std::string::String>) -> Self {
4233        Self {
4234            analyzer: ::core::option::Option::None,
4235            prefix: ::core::option::Option::Some(prefix.into()),
4236            use_field: ::core::option::Option::None,
4237        }
4238    }
4239}
4240
4241impl IntervalsPrefix {
4242    /// Sets `analyzer`.
4243    pub fn analyzer(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
4244        self.analyzer = ::core::option::Option::Some(value.into());
4245        self
4246    }
4247    /// Sets `use_field`.
4248    pub fn use_field(mut self, value: impl ::core::convert::Into<crate::Field>) -> Self {
4249        self.use_field = ::core::option::Option::Some(value.into());
4250        self
4251    }
4252}
4253
4254/// The variants of [`IntervalsQuery`].
4255#[derive(Clone, Debug, PartialEq)]
4256#[non_exhaustive]
4257pub enum IntervalsQueryVariant {
4258    /// Returns matches that span a combination of other rules.
4259    AllOf(crate::query_dsl::IntervalsAllOf),
4260    /// Returns intervals produced by any of its sub-rules.
4261    AnyOf(crate::query_dsl::IntervalsAnyOf),
4262    /// Matches terms that are similar to the provided term, within an edit distance defined by `fuzziness`.
4263    Fuzzy(crate::query_dsl::IntervalsFuzzy),
4264    /// Matches analyzed text.
4265    Match(crate::query_dsl::IntervalsMatch),
4266    /// Matches terms that start with a specified set of characters.
4267    Prefix(crate::query_dsl::IntervalsPrefix),
4268    Range(crate::query_dsl::IntervalsRange),
4269    Regexp(crate::query_dsl::IntervalsRegexp),
4270    /// Matches terms using a wildcard pattern.
4271    Wildcard(crate::query_dsl::IntervalsWildcard),
4272    /// Any variant, as JSON: an object with one property.
4273    Raw(::serde_json::Value),
4274}
4275
4276impl IntervalsQueryVariant {
4277    /// Writes the variant as one entry of a map.
4278    pub fn serialize_entry<M__: ::serde::ser::SerializeMap>(
4279        &self,
4280        map: &mut M__,
4281    ) -> ::core::result::Result<(), M__::Error> {
4282        match self {
4283            Self::AllOf(value) => map.serialize_entry("all_of", value),
4284            Self::AnyOf(value) => map.serialize_entry("any_of", value),
4285            Self::Fuzzy(value) => map.serialize_entry("fuzzy", value),
4286            Self::Match(value) => map.serialize_entry("match", value),
4287            Self::Prefix(value) => map.serialize_entry("prefix", value),
4288            Self::Range(value) => map.serialize_entry("range", value),
4289            Self::Regexp(value) => map.serialize_entry("regexp", value),
4290            Self::Wildcard(value) => map.serialize_entry("wildcard", value),
4291            Self::Raw(value) => match value {
4292                ::serde_json::Value::Object(entries) => {
4293                    for (key, value) in entries {
4294                        map.serialize_entry(key, value)?;
4295                    }
4296                    ::core::result::Result::Ok(())
4297                }
4298                _ => ::core::result::Result::Err(<M__::Error as ::serde::ser::Error>::custom(
4299                    "a raw variant must be an object",
4300                )),
4301            },
4302        }
4303    }
4304}
4305
4306impl ::serde::Serialize for IntervalsQueryVariant {
4307    fn serialize<S__: ::serde::Serializer>(
4308        &self,
4309        serializer: S__,
4310    ) -> ::core::result::Result<S__::Ok, S__::Error> {
4311        match self {
4312            Self::AllOf(value) => {
4313                ::oxsearch_core::__private::serialize_variant(serializer, "all_of", value)
4314            }
4315            Self::AnyOf(value) => {
4316                ::oxsearch_core::__private::serialize_variant(serializer, "any_of", value)
4317            }
4318            Self::Fuzzy(value) => {
4319                ::oxsearch_core::__private::serialize_variant(serializer, "fuzzy", value)
4320            }
4321            Self::Match(value) => {
4322                ::oxsearch_core::__private::serialize_variant(serializer, "match", value)
4323            }
4324            Self::Prefix(value) => {
4325                ::oxsearch_core::__private::serialize_variant(serializer, "prefix", value)
4326            }
4327            Self::Range(value) => {
4328                ::oxsearch_core::__private::serialize_variant(serializer, "range", value)
4329            }
4330            Self::Regexp(value) => {
4331                ::oxsearch_core::__private::serialize_variant(serializer, "regexp", value)
4332            }
4333            Self::Wildcard(value) => {
4334                ::oxsearch_core::__private::serialize_variant(serializer, "wildcard", value)
4335            }
4336            Self::Raw(value) => ::serde::Serialize::serialize(value, serializer),
4337        }
4338    }
4339}
4340
4341impl<'de> ::serde::Deserialize<'de> for IntervalsQueryVariant {
4342    fn deserialize<D__: ::serde::Deserializer<'de>>(
4343        deserializer: D__,
4344    ) -> ::core::result::Result<Self, D__::Error> {
4345        ::oxsearch_core::__private::deserialize_container(deserializer)
4346    }
4347}
4348
4349impl<'de> ::oxsearch_core::__private::Container<'de> for IntervalsQueryVariant {
4350    const NAME: &'static str = "IntervalsQueryVariant";
4351    fn variant<A__: ::serde::de::MapAccess<'de>>(
4352        key: &str,
4353        map: &mut A__,
4354    ) -> ::core::result::Result<Self, A__::Error> {
4355        ::core::result::Result::Ok(match key {
4356            "all_of" => Self::AllOf(map.next_value()?),
4357            "any_of" => Self::AnyOf(map.next_value()?),
4358            "fuzzy" => Self::Fuzzy(map.next_value()?),
4359            "match" => Self::Match(map.next_value()?),
4360            "prefix" => Self::Prefix(map.next_value()?),
4361            "range" => Self::Range(map.next_value()?),
4362            "regexp" => Self::Regexp(map.next_value()?),
4363            "wildcard" => Self::Wildcard(map.next_value()?),
4364            _ => Self::Raw(::oxsearch_core::__private::raw_variant(
4365                key,
4366                map.next_value()?,
4367            )),
4368        })
4369    }
4370}
4371
4372impl ::core::convert::From<crate::query_dsl::IntervalsAllOf> for IntervalsQueryVariant {
4373    fn from(value: crate::query_dsl::IntervalsAllOf) -> Self {
4374        Self::AllOf(value)
4375    }
4376}
4377
4378impl ::core::convert::From<crate::query_dsl::IntervalsAnyOf> for IntervalsQueryVariant {
4379    fn from(value: crate::query_dsl::IntervalsAnyOf) -> Self {
4380        Self::AnyOf(value)
4381    }
4382}
4383
4384impl ::core::convert::From<crate::query_dsl::IntervalsFuzzy> for IntervalsQueryVariant {
4385    fn from(value: crate::query_dsl::IntervalsFuzzy) -> Self {
4386        Self::Fuzzy(value)
4387    }
4388}
4389
4390impl ::core::convert::From<crate::query_dsl::IntervalsMatch> for IntervalsQueryVariant {
4391    fn from(value: crate::query_dsl::IntervalsMatch) -> Self {
4392        Self::Match(value)
4393    }
4394}
4395
4396impl ::core::convert::From<crate::query_dsl::IntervalsPrefix> for IntervalsQueryVariant {
4397    fn from(value: crate::query_dsl::IntervalsPrefix) -> Self {
4398        Self::Prefix(value)
4399    }
4400}
4401
4402impl ::core::convert::From<crate::query_dsl::IntervalsRange> for IntervalsQueryVariant {
4403    fn from(value: crate::query_dsl::IntervalsRange) -> Self {
4404        Self::Range(value)
4405    }
4406}
4407
4408impl ::core::convert::From<crate::query_dsl::IntervalsRegexp> for IntervalsQueryVariant {
4409    fn from(value: crate::query_dsl::IntervalsRegexp) -> Self {
4410        Self::Regexp(value)
4411    }
4412}
4413
4414impl ::core::convert::From<crate::query_dsl::IntervalsWildcard> for IntervalsQueryVariant {
4415    fn from(value: crate::query_dsl::IntervalsWildcard) -> Self {
4416        Self::Wildcard(value)
4417    }
4418}
4419
4420#[derive(Clone, Debug, PartialEq)]
4421#[non_exhaustive]
4422pub struct IntervalsQuery {
4423    /// Floating point number used to decrease or increase the relevance scores of the query.
4424    /// Boost values are relative to the default value of 1.0.
4425    /// A boost value between 0 and 1.0 decreases the relevance score.
4426    /// A value greater than 1.0 increases the relevance score.
4427    pub boost: ::core::option::Option<f32>,
4428    pub name: ::core::option::Option<::std::string::String>,
4429    /// The variant.
4430    pub variant: ::core::option::Option<crate::query_dsl::IntervalsQueryVariant>,
4431}
4432
4433impl IntervalsQuery {
4434    /// A `IntervalsQuery` with its required properties set.
4435    pub fn new() -> Self {
4436        Self {
4437            boost: ::core::option::Option::None,
4438            name: ::core::option::Option::None,
4439            variant: ::core::option::Option::None,
4440        }
4441    }
4442}
4443
4444impl IntervalsQuery {
4445    /// Sets `boost`.
4446    pub fn boost(mut self, value: f32) -> Self {
4447        self.boost = ::core::option::Option::Some(value.into());
4448        self
4449    }
4450    /// Sets `name`.
4451    pub fn name(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
4452        self.name = ::core::option::Option::Some(value.into());
4453        self
4454    }
4455    /// Sets `variant`.
4456    pub fn variant(
4457        mut self,
4458        value: impl ::core::convert::Into<crate::query_dsl::IntervalsQueryVariant>,
4459    ) -> Self {
4460        self.variant = ::core::option::Option::Some(value.into());
4461        self
4462    }
4463}
4464
4465impl ::serde::Serialize for IntervalsQuery {
4466    fn serialize<S__: ::serde::Serializer>(
4467        &self,
4468        serializer: S__,
4469    ) -> ::core::result::Result<S__::Ok, S__::Error> {
4470        use ::serde::ser::SerializeMap as _;
4471        let mut map = serializer.serialize_map(::core::option::Option::None)?;
4472        if let ::core::option::Option::Some(value) = &self.boost {
4473            map.serialize_entry("boost", value)?;
4474        }
4475        if let ::core::option::Option::Some(value) = &self.name {
4476            map.serialize_entry("_name", value)?;
4477        }
4478        if let ::core::option::Option::Some(variant) = &self.variant {
4479            variant.serialize_entry(&mut map)?;
4480        }
4481        map.end()
4482    }
4483}
4484
4485impl<'de> ::serde::Deserialize<'de> for IntervalsQuery {
4486    fn deserialize<D__: ::serde::Deserializer<'de>>(
4487        deserializer: D__,
4488    ) -> ::core::result::Result<Self, D__::Error> {
4489        struct Fields;
4490        impl<'de> ::serde::de::Visitor<'de> for Fields {
4491            type Value = IntervalsQuery;
4492            fn expecting(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
4493                f.write_str("a IntervalsQuery object")
4494            }
4495            fn visit_map<A__: ::serde::de::MapAccess<'de>>(
4496                self,
4497                mut map: A__,
4498            ) -> ::core::result::Result<IntervalsQuery, A__::Error> {
4499                let mut boost = ::core::option::Option::None;
4500                let mut name = ::core::option::Option::None;
4501                let mut variant__ = ::core::option::Option::None;
4502                while let ::core::option::Option::Some(key) =
4503                    map.next_key::<::std::string::String>()?
4504                {
4505                    match key.as_str() {
4506                        "boost" => boost = ::core::option::Option::Some(map.next_value()?),
4507                        "_name" => name = ::core::option::Option::Some(map.next_value()?),
4508                        _ => {
4509                            if variant__.is_some() {
4510                                return ::core::result::Result::Err(
4511                                    ::oxsearch_core::__private::two_variants(
4512                                        "IntervalsQuery",
4513                                        &key,
4514                                    ),
4515                                );
4516                            }
4517                            variant__ = ::core::option::Option::Some(
4518                                <IntervalsQueryVariant as ::oxsearch_core::__private::Container<
4519                                    'de,
4520                                >>::variant(&key, &mut map)?,
4521                            );
4522                        }
4523                    }
4524                }
4525                ::core::result::Result::Ok(IntervalsQuery {
4526                    boost,
4527                    name,
4528                    variant: variant__,
4529                })
4530            }
4531        }
4532        deserializer.deserialize_map(Fields)
4533    }
4534}
4535
4536#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
4537#[non_exhaustive]
4538pub struct IntervalsRange {
4539    /// Analyzer used to analyze the `prefix`.
4540    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
4541    pub analyzer: ::core::option::Option<::std::string::String>,
4542    /// Lower term, either gte or gt must be provided.
4543    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
4544    pub gte: ::core::option::Option<::std::string::String>,
4545    /// Lower term, either gte or gt must be provided.
4546    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
4547    pub gt: ::core::option::Option<::std::string::String>,
4548    /// Upper term, either lte or lt must be provided.
4549    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
4550    pub lte: ::core::option::Option<::std::string::String>,
4551    /// Upper term, either lte or lt must be provided.
4552    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
4553    pub lt: ::core::option::Option<::std::string::String>,
4554    /// If specified, match intervals from this field rather than the top-level field.
4555    /// The `prefix` is normalized using the search analyzer from this field, unless `analyzer` is specified separately.
4556    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
4557    pub use_field: ::core::option::Option<crate::Field>,
4558}
4559
4560impl IntervalsRange {
4561    /// A `IntervalsRange` with its required properties set.
4562    pub fn new() -> Self {
4563        Self {
4564            analyzer: ::core::option::Option::None,
4565            gte: ::core::option::Option::None,
4566            gt: ::core::option::Option::None,
4567            lte: ::core::option::Option::None,
4568            lt: ::core::option::Option::None,
4569            use_field: ::core::option::Option::None,
4570        }
4571    }
4572}
4573
4574impl IntervalsRange {
4575    /// Sets `analyzer`.
4576    pub fn analyzer(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
4577        self.analyzer = ::core::option::Option::Some(value.into());
4578        self
4579    }
4580    /// Sets `gte`.
4581    pub fn gte(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
4582        self.gte = ::core::option::Option::Some(value.into());
4583        self
4584    }
4585    /// Sets `gt`.
4586    pub fn gt(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
4587        self.gt = ::core::option::Option::Some(value.into());
4588        self
4589    }
4590    /// Sets `lte`.
4591    pub fn lte(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
4592        self.lte = ::core::option::Option::Some(value.into());
4593        self
4594    }
4595    /// Sets `lt`.
4596    pub fn lt(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
4597        self.lt = ::core::option::Option::Some(value.into());
4598        self
4599    }
4600    /// Sets `use_field`.
4601    pub fn use_field(mut self, value: impl ::core::convert::Into<crate::Field>) -> Self {
4602        self.use_field = ::core::option::Option::Some(value.into());
4603        self
4604    }
4605}
4606
4607#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
4608#[non_exhaustive]
4609pub struct IntervalsRegexp {
4610    /// Analyzer used to analyze the `prefix`.
4611    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
4612    pub analyzer: ::core::option::Option<::std::string::String>,
4613    /// Regex pattern.
4614    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
4615    pub pattern: ::core::option::Option<::std::string::String>,
4616    /// If specified, match intervals from this field rather than the top-level field.
4617    /// The `prefix` is normalized using the search analyzer from this field, unless `analyzer` is specified separately.
4618    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
4619    pub use_field: ::core::option::Option<crate::Field>,
4620}
4621
4622impl IntervalsRegexp {
4623    /// A `IntervalsRegexp` with its required properties set.
4624    pub fn new(pattern: impl ::core::convert::Into<::std::string::String>) -> Self {
4625        Self {
4626            analyzer: ::core::option::Option::None,
4627            pattern: ::core::option::Option::Some(pattern.into()),
4628            use_field: ::core::option::Option::None,
4629        }
4630    }
4631}
4632
4633impl IntervalsRegexp {
4634    /// Sets `analyzer`.
4635    pub fn analyzer(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
4636        self.analyzer = ::core::option::Option::Some(value.into());
4637        self
4638    }
4639    /// Sets `use_field`.
4640    pub fn use_field(mut self, value: impl ::core::convert::Into<crate::Field>) -> Self {
4641        self.use_field = ::core::option::Option::Some(value.into());
4642        self
4643    }
4644}
4645
4646#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
4647#[non_exhaustive]
4648pub struct IntervalsWildcard {
4649    /// Analyzer used to analyze the `pattern`.
4650    /// Defaults to the top-level field's analyzer.
4651    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
4652    pub analyzer: ::core::option::Option<::std::string::String>,
4653    /// Wildcard pattern used to find matching terms.
4654    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
4655    pub pattern: ::core::option::Option<::std::string::String>,
4656    /// If specified, match intervals from this field rather than the top-level field.
4657    /// The `pattern` is normalized using the search analyzer from this field, unless `analyzer` is specified separately.
4658    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
4659    pub use_field: ::core::option::Option<crate::Field>,
4660}
4661
4662impl IntervalsWildcard {
4663    /// A `IntervalsWildcard` with its required properties set.
4664    pub fn new(pattern: impl ::core::convert::Into<::std::string::String>) -> Self {
4665        Self {
4666            analyzer: ::core::option::Option::None,
4667            pattern: ::core::option::Option::Some(pattern.into()),
4668            use_field: ::core::option::Option::None,
4669        }
4670    }
4671}
4672
4673impl IntervalsWildcard {
4674    /// Sets `analyzer`.
4675    pub fn analyzer(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
4676        self.analyzer = ::core::option::Option::Some(value.into());
4677        self
4678    }
4679    /// Sets `use_field`.
4680    pub fn use_field(mut self, value: impl ::core::convert::Into<crate::Field>) -> Self {
4681        self.use_field = ::core::option::Option::Some(value.into());
4682        self
4683    }
4684}
4685
4686/// Returns documents matching a provided Kibana Query Language (KQL) expression.
4687/// The expression is parsed and rewritten into standard Query DSL.
4688#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
4689#[non_exhaustive]
4690pub struct KqlQuery {
4691    /// Floating point number used to decrease or increase the relevance scores of the query.
4692    /// Boost values are relative to the default value of 1.0.
4693    /// A boost value between 0 and 1.0 decreases the relevance score.
4694    /// A value greater than 1.0 increases the relevance score.
4695    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
4696    pub boost: ::core::option::Option<f32>,
4697    #[serde(
4698        rename = "_name",
4699        skip_serializing_if = "::core::option::Option::is_none"
4700    )]
4701    pub name: ::core::option::Option<::std::string::String>,
4702    /// If `true`, performs case-insensitive matching for field names and keyword or text terms.
4703    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
4704    pub case_insensitive: ::core::option::Option<bool>,
4705    /// Default field, or field pattern with wildcards, to target when a bare term does not specify a field.
4706    /// Defaults to the `index.query.default_field` index setting, which has a default value of `*`.
4707    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
4708    pub default_field: ::core::option::Option<crate::Field>,
4709    /// The KQL expression to parse.
4710    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
4711    pub query: ::core::option::Option<::std::string::String>,
4712    /// Coordinated Universal Time (UTC) offset or IANA time zone used to interpret date literals in the expression.
4713    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
4714    pub time_zone: ::core::option::Option<crate::TimeZone>,
4715}
4716
4717impl KqlQuery {
4718    /// A `KqlQuery` with its required properties set.
4719    pub fn new(query: impl ::core::convert::Into<::std::string::String>) -> Self {
4720        Self {
4721            boost: ::core::option::Option::None,
4722            name: ::core::option::Option::None,
4723            case_insensitive: ::core::option::Option::None,
4724            default_field: ::core::option::Option::None,
4725            query: ::core::option::Option::Some(query.into()),
4726            time_zone: ::core::option::Option::None,
4727        }
4728    }
4729}
4730
4731impl KqlQuery {
4732    /// Sets `boost`.
4733    pub fn boost(mut self, value: f32) -> Self {
4734        self.boost = ::core::option::Option::Some(value.into());
4735        self
4736    }
4737    /// Sets `name`.
4738    pub fn name(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
4739        self.name = ::core::option::Option::Some(value.into());
4740        self
4741    }
4742    /// Sets `case_insensitive`.
4743    pub fn case_insensitive(mut self, value: bool) -> Self {
4744        self.case_insensitive = ::core::option::Option::Some(value.into());
4745        self
4746    }
4747    /// Sets `default_field`.
4748    pub fn default_field(mut self, value: impl ::core::convert::Into<crate::Field>) -> Self {
4749        self.default_field = ::core::option::Option::Some(value.into());
4750        self
4751    }
4752    /// Sets `time_zone`.
4753    pub fn time_zone(mut self, value: impl ::core::convert::Into<crate::TimeZone>) -> Self {
4754        self.time_zone = ::core::option::Option::Some(value.into());
4755        self
4756    }
4757}
4758
4759/// Text that we want similar documents for or a lookup to a document's field for the text.
4760#[derive(Clone, Debug, PartialEq)]
4761#[non_exhaustive]
4762pub enum Like {
4763    /// A string.
4764    Text(::std::string::String),
4765    /// A object.
4766    Document(crate::query_dsl::LikeDocument),
4767}
4768
4769impl ::serde::Serialize for Like {
4770    fn serialize<S__: ::serde::Serializer>(
4771        &self,
4772        serializer: S__,
4773    ) -> ::core::result::Result<S__::Ok, S__::Error> {
4774        match self {
4775            Self::Text(value) => ::serde::Serialize::serialize(value, serializer),
4776            Self::Document(value) => ::serde::Serialize::serialize(value, serializer),
4777        }
4778    }
4779}
4780
4781impl<'de> ::serde::Deserialize<'de> for Like {
4782    fn deserialize<D__: ::serde::Deserializer<'de>>(
4783        deserializer: D__,
4784    ) -> ::core::result::Result<Self, D__::Error> {
4785        struct Shape;
4786        impl<'de> ::oxsearch_core::__private::ByKind<'de> for Shape {
4787            type Value = Like;
4788            const EXPECTING: &'static str = "Like: object or string";
4789            fn visit<V__: ::serde::Deserializer<'de>>(
4790                self,
4791                kind: ::oxsearch_core::__private::Kind,
4792                value: V__,
4793            ) -> ::core::result::Result<Self::Value, V__::Error> {
4794                match kind {
4795                    ::oxsearch_core::__private::Kind::String => {
4796                        <::std::string::String as ::serde::Deserialize>::deserialize(value)
4797                            .map(Like::Text)
4798                    }
4799                    ::oxsearch_core::__private::Kind::Object => {
4800                        <crate::query_dsl::LikeDocument as ::serde::Deserialize>::deserialize(value)
4801                            .map(Like::Document)
4802                    }
4803                    _ => ::core::result::Result::Err(<V__::Error as ::serde::de::Error>::custom(
4804                        format_args!("Like can't be {kind:?}"),
4805                    )),
4806                }
4807            }
4808        }
4809        ::oxsearch_core::__private::deserialize_by_kind(deserializer, Shape)
4810    }
4811}
4812
4813impl ::core::convert::From<::std::string::String> for Like {
4814    fn from(value: ::std::string::String) -> Self {
4815        Self::Text(value)
4816    }
4817}
4818
4819impl ::core::convert::From<crate::query_dsl::LikeDocument> for Like {
4820    fn from(value: crate::query_dsl::LikeDocument) -> Self {
4821        Self::Document(value)
4822    }
4823}
4824
4825impl ::core::convert::From<&str> for Like {
4826    fn from(value: &str) -> Self {
4827        Self::Text(::std::borrow::ToOwned::to_owned(value))
4828    }
4829}
4830
4831#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
4832#[non_exhaustive]
4833pub struct LikeDocument {
4834    /// A document not present in the index.
4835    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
4836    pub doc: ::core::option::Option<::serde_json::Value>,
4837    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
4838    pub fields: ::core::option::Option<::std::vec::Vec<crate::Field>>,
4839    /// ID of a document.
4840    #[serde(
4841        rename = "_id",
4842        skip_serializing_if = "::core::option::Option::is_none"
4843    )]
4844    pub id: ::core::option::Option<crate::Id>,
4845    /// Index of a document.
4846    #[serde(
4847        rename = "_index",
4848        skip_serializing_if = "::core::option::Option::is_none"
4849    )]
4850    pub index: ::core::option::Option<crate::IndexName>,
4851    /// Overrides the default analyzer.
4852    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
4853    pub per_field_analyzer:
4854        ::core::option::Option<::indexmap::IndexMap<crate::Field, ::std::string::String>>,
4855    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
4856    pub routing: ::core::option::Option<crate::Routing>,
4857    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
4858    pub version: ::core::option::Option<crate::VersionNumber>,
4859    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
4860    pub version_type: ::core::option::Option<crate::VersionType>,
4861}
4862
4863impl LikeDocument {
4864    /// A `LikeDocument` with its required properties set.
4865    pub fn new() -> Self {
4866        Self {
4867            doc: ::core::option::Option::None,
4868            fields: ::core::option::Option::None,
4869            id: ::core::option::Option::None,
4870            index: ::core::option::Option::None,
4871            per_field_analyzer: ::core::option::Option::None,
4872            routing: ::core::option::Option::None,
4873            version: ::core::option::Option::None,
4874            version_type: ::core::option::Option::None,
4875        }
4876    }
4877}
4878
4879impl LikeDocument {
4880    /// Sets `doc`.
4881    pub fn doc(mut self, value: impl ::core::convert::Into<::serde_json::Value>) -> Self {
4882        self.doc = ::core::option::Option::Some(value.into());
4883        self
4884    }
4885    /// Sets `fields`.
4886    pub fn fields(
4887        mut self,
4888        value: impl ::core::convert::Into<::std::vec::Vec<crate::Field>>,
4889    ) -> Self {
4890        self.fields = ::core::option::Option::Some(value.into());
4891        self
4892    }
4893    /// Sets `id`.
4894    pub fn id(mut self, value: impl ::core::convert::Into<crate::Id>) -> Self {
4895        self.id = ::core::option::Option::Some(value.into());
4896        self
4897    }
4898    /// Sets `index`.
4899    pub fn index(mut self, value: impl ::core::convert::Into<crate::IndexName>) -> Self {
4900        self.index = ::core::option::Option::Some(value.into());
4901        self
4902    }
4903    /// Sets `per_field_analyzer`.
4904    pub fn per_field_analyzer(
4905        mut self,
4906        value: impl ::core::convert::Into<::indexmap::IndexMap<crate::Field, ::std::string::String>>,
4907    ) -> Self {
4908        self.per_field_analyzer = ::core::option::Option::Some(value.into());
4909        self
4910    }
4911    /// Sets `routing`.
4912    pub fn routing(mut self, value: impl ::core::convert::Into<crate::Routing>) -> Self {
4913        self.routing = ::core::option::Option::Some(value.into());
4914        self
4915    }
4916    /// Sets `version`.
4917    pub fn version(mut self, value: impl ::core::convert::Into<crate::VersionNumber>) -> Self {
4918        self.version = ::core::option::Option::Some(value.into());
4919        self
4920    }
4921    /// Sets `version_type`.
4922    pub fn version_type(mut self, value: impl ::core::convert::Into<crate::VersionType>) -> Self {
4923        self.version_type = ::core::option::Option::Some(value.into());
4924        self
4925    }
4926}
4927
4928#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
4929#[non_exhaustive]
4930pub struct LongNumberRangeQuery {
4931    /// Floating point number used to decrease or increase the relevance scores of the query.
4932    /// Boost values are relative to the default value of 1.0.
4933    /// A boost value between 0 and 1.0 decreases the relevance score.
4934    /// A value greater than 1.0 increases the relevance score.
4935    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
4936    pub boost: ::core::option::Option<f32>,
4937    #[serde(
4938        rename = "_name",
4939        skip_serializing_if = "::core::option::Option::is_none"
4940    )]
4941    pub name: ::core::option::Option<::std::string::String>,
4942    /// Indicates how the range query matches values for `range` fields.
4943    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
4944    pub relation: ::core::option::Option<crate::query_dsl::RangeRelation>,
4945    /// Greater than.
4946    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
4947    pub gt: ::core::option::Option<i64>,
4948    /// Greater than or equal to.
4949    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
4950    pub gte: ::core::option::Option<i64>,
4951    /// Less than.
4952    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
4953    pub lt: ::core::option::Option<i64>,
4954    /// Less than or equal to.
4955    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
4956    pub lte: ::core::option::Option<i64>,
4957}
4958
4959impl LongNumberRangeQuery {
4960    /// A `LongNumberRangeQuery` with its required properties set.
4961    pub fn new() -> Self {
4962        Self {
4963            boost: ::core::option::Option::None,
4964            name: ::core::option::Option::None,
4965            relation: ::core::option::Option::None,
4966            gt: ::core::option::Option::None,
4967            gte: ::core::option::Option::None,
4968            lt: ::core::option::Option::None,
4969            lte: ::core::option::Option::None,
4970        }
4971    }
4972}
4973
4974impl LongNumberRangeQuery {
4975    /// Sets `boost`.
4976    pub fn boost(mut self, value: f32) -> Self {
4977        self.boost = ::core::option::Option::Some(value.into());
4978        self
4979    }
4980    /// Sets `name`.
4981    pub fn name(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
4982        self.name = ::core::option::Option::Some(value.into());
4983        self
4984    }
4985    /// Sets `relation`.
4986    pub fn relation(
4987        mut self,
4988        value: impl ::core::convert::Into<crate::query_dsl::RangeRelation>,
4989    ) -> Self {
4990        self.relation = ::core::option::Option::Some(value.into());
4991        self
4992    }
4993    /// Sets `gt`.
4994    pub fn gt(mut self, value: i64) -> Self {
4995        self.gt = ::core::option::Option::Some(value.into());
4996        self
4997    }
4998    /// Sets `gte`.
4999    pub fn gte(mut self, value: i64) -> Self {
5000        self.gte = ::core::option::Option::Some(value.into());
5001        self
5002    }
5003    /// Sets `lt`.
5004    pub fn lt(mut self, value: i64) -> Self {
5005        self.lt = ::core::option::Option::Some(value.into());
5006        self
5007    }
5008    /// Sets `lte`.
5009    pub fn lte(mut self, value: i64) -> Self {
5010        self.lte = ::core::option::Option::Some(value.into());
5011        self
5012    }
5013}
5014
5015#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
5016#[non_exhaustive]
5017pub struct MatchAllQuery {
5018    /// Floating point number used to decrease or increase the relevance scores of the query.
5019    /// Boost values are relative to the default value of 1.0.
5020    /// A boost value between 0 and 1.0 decreases the relevance score.
5021    /// A value greater than 1.0 increases the relevance score.
5022    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
5023    pub boost: ::core::option::Option<f32>,
5024    #[serde(
5025        rename = "_name",
5026        skip_serializing_if = "::core::option::Option::is_none"
5027    )]
5028    pub name: ::core::option::Option<::std::string::String>,
5029}
5030
5031impl MatchAllQuery {
5032    /// A `MatchAllQuery` with its required properties set.
5033    pub fn new() -> Self {
5034        Self {
5035            boost: ::core::option::Option::None,
5036            name: ::core::option::Option::None,
5037        }
5038    }
5039}
5040
5041impl MatchAllQuery {
5042    /// Sets `boost`.
5043    pub fn boost(mut self, value: f32) -> Self {
5044        self.boost = ::core::option::Option::Some(value.into());
5045        self
5046    }
5047    /// Sets `name`.
5048    pub fn name(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
5049        self.name = ::core::option::Option::Some(value.into());
5050        self
5051    }
5052}
5053
5054#[derive(Clone, Debug, PartialEq)]
5055#[non_exhaustive]
5056pub struct MatchBoolPrefixQuery {
5057    /// Floating point number used to decrease or increase the relevance scores of the query.
5058    /// Boost values are relative to the default value of 1.0.
5059    /// A boost value between 0 and 1.0 decreases the relevance score.
5060    /// A value greater than 1.0 increases the relevance score.
5061    pub boost: ::core::option::Option<f32>,
5062    pub name: ::core::option::Option<::std::string::String>,
5063    /// Analyzer used to convert the text in the query value into tokens.
5064    pub analyzer: ::core::option::Option<::std::string::String>,
5065    /// Maximum edit distance allowed for matching.
5066    /// Can be applied to the term subqueries constructed for all terms but the final term.
5067    pub fuzziness: ::core::option::Option<crate::Fuzziness>,
5068    /// Method used to rewrite the query.
5069    /// Can be applied to the term subqueries constructed for all terms but the final term.
5070    pub fuzzy_rewrite: ::core::option::Option<crate::MultiTermQueryRewrite>,
5071    /// If `true`, edits for fuzzy matching include transpositions of two adjacent characters (for example, `ab` to `ba`).
5072    /// Can be applied to the term subqueries constructed for all terms but the final term.
5073    pub fuzzy_transpositions: ::core::option::Option<bool>,
5074    /// Maximum number of terms to which the query will expand.
5075    /// Can be applied to the term subqueries constructed for all terms but the final term.
5076    pub max_expansions: ::core::option::Option<i32>,
5077    /// Minimum number of clauses that must match for a document to be returned.
5078    /// Applied to the constructed bool query.
5079    pub minimum_should_match: ::core::option::Option<crate::MinimumShouldMatch>,
5080    /// Boolean logic used to interpret text in the query value.
5081    /// Applied to the constructed bool query.
5082    pub operator: ::core::option::Option<crate::query_dsl::Operator>,
5083    /// Number of beginning characters left unchanged for fuzzy matching.
5084    /// Can be applied to the term subqueries constructed for all terms but the final term.
5085    pub prefix_length: ::core::option::Option<i32>,
5086    /// Terms you wish to find in the provided field.
5087    /// The last term is used in a prefix query.
5088    pub query: ::core::option::Option<::std::string::String>,
5089}
5090
5091impl MatchBoolPrefixQuery {
5092    /// A `MatchBoolPrefixQuery` with its required properties set.
5093    pub fn new(query: impl ::core::convert::Into<::std::string::String>) -> Self {
5094        Self {
5095            boost: ::core::option::Option::None,
5096            name: ::core::option::Option::None,
5097            analyzer: ::core::option::Option::None,
5098            fuzziness: ::core::option::Option::None,
5099            fuzzy_rewrite: ::core::option::Option::None,
5100            fuzzy_transpositions: ::core::option::Option::None,
5101            max_expansions: ::core::option::Option::None,
5102            minimum_should_match: ::core::option::Option::None,
5103            operator: ::core::option::Option::None,
5104            prefix_length: ::core::option::Option::None,
5105            query: ::core::option::Option::Some(query.into()),
5106        }
5107    }
5108}
5109
5110impl MatchBoolPrefixQuery {
5111    /// Sets `boost`.
5112    pub fn boost(mut self, value: f32) -> Self {
5113        self.boost = ::core::option::Option::Some(value.into());
5114        self
5115    }
5116    /// Sets `name`.
5117    pub fn name(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
5118        self.name = ::core::option::Option::Some(value.into());
5119        self
5120    }
5121    /// Sets `analyzer`.
5122    pub fn analyzer(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
5123        self.analyzer = ::core::option::Option::Some(value.into());
5124        self
5125    }
5126    /// Sets `fuzziness`.
5127    pub fn fuzziness(mut self, value: impl ::core::convert::Into<crate::Fuzziness>) -> Self {
5128        self.fuzziness = ::core::option::Option::Some(value.into());
5129        self
5130    }
5131    /// Sets `fuzzy_rewrite`.
5132    pub fn fuzzy_rewrite(
5133        mut self,
5134        value: impl ::core::convert::Into<crate::MultiTermQueryRewrite>,
5135    ) -> Self {
5136        self.fuzzy_rewrite = ::core::option::Option::Some(value.into());
5137        self
5138    }
5139    /// Sets `fuzzy_transpositions`.
5140    pub fn fuzzy_transpositions(mut self, value: bool) -> Self {
5141        self.fuzzy_transpositions = ::core::option::Option::Some(value.into());
5142        self
5143    }
5144    /// Sets `max_expansions`.
5145    pub fn max_expansions(mut self, value: i32) -> Self {
5146        self.max_expansions = ::core::option::Option::Some(value.into());
5147        self
5148    }
5149    /// Sets `minimum_should_match`.
5150    pub fn minimum_should_match(
5151        mut self,
5152        value: impl ::core::convert::Into<crate::MinimumShouldMatch>,
5153    ) -> Self {
5154        self.minimum_should_match = ::core::option::Option::Some(value.into());
5155        self
5156    }
5157    /// Sets `operator`.
5158    pub fn operator(
5159        mut self,
5160        value: impl ::core::convert::Into<crate::query_dsl::Operator>,
5161    ) -> Self {
5162        self.operator = ::core::option::Option::Some(value.into());
5163        self
5164    }
5165    /// Sets `prefix_length`.
5166    pub fn prefix_length(mut self, value: i32) -> Self {
5167        self.prefix_length = ::core::option::Option::Some(value.into());
5168        self
5169    }
5170}
5171
5172#[derive(::serde::Serialize, ::serde::Deserialize)]
5173#[serde(remote = "MatchBoolPrefixQuery")]
5174struct MatchBoolPrefixQueryDef {
5175    /// Floating point number used to decrease or increase the relevance scores of the query.
5176    /// Boost values are relative to the default value of 1.0.
5177    /// A boost value between 0 and 1.0 decreases the relevance score.
5178    /// A value greater than 1.0 increases the relevance score.
5179    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
5180    boost: ::core::option::Option<f32>,
5181    #[serde(
5182        rename = "_name",
5183        skip_serializing_if = "::core::option::Option::is_none"
5184    )]
5185    name: ::core::option::Option<::std::string::String>,
5186    /// Analyzer used to convert the text in the query value into tokens.
5187    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
5188    analyzer: ::core::option::Option<::std::string::String>,
5189    /// Maximum edit distance allowed for matching.
5190    /// Can be applied to the term subqueries constructed for all terms but the final term.
5191    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
5192    fuzziness: ::core::option::Option<crate::Fuzziness>,
5193    /// Method used to rewrite the query.
5194    /// Can be applied to the term subqueries constructed for all terms but the final term.
5195    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
5196    fuzzy_rewrite: ::core::option::Option<crate::MultiTermQueryRewrite>,
5197    /// If `true`, edits for fuzzy matching include transpositions of two adjacent characters (for example, `ab` to `ba`).
5198    /// Can be applied to the term subqueries constructed for all terms but the final term.
5199    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
5200    fuzzy_transpositions: ::core::option::Option<bool>,
5201    /// Maximum number of terms to which the query will expand.
5202    /// Can be applied to the term subqueries constructed for all terms but the final term.
5203    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
5204    max_expansions: ::core::option::Option<i32>,
5205    /// Minimum number of clauses that must match for a document to be returned.
5206    /// Applied to the constructed bool query.
5207    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
5208    minimum_should_match: ::core::option::Option<crate::MinimumShouldMatch>,
5209    /// Boolean logic used to interpret text in the query value.
5210    /// Applied to the constructed bool query.
5211    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
5212    operator: ::core::option::Option<crate::query_dsl::Operator>,
5213    /// Number of beginning characters left unchanged for fuzzy matching.
5214    /// Can be applied to the term subqueries constructed for all terms but the final term.
5215    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
5216    prefix_length: ::core::option::Option<i32>,
5217    /// Terms you wish to find in the provided field.
5218    /// The last term is used in a prefix query.
5219    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
5220    query: ::core::option::Option<::std::string::String>,
5221}
5222
5223impl ::serde::Serialize for MatchBoolPrefixQuery {
5224    fn serialize<S__: ::serde::Serializer>(
5225        &self,
5226        serializer: S__,
5227    ) -> ::core::result::Result<S__::Ok, S__::Error> {
5228        if let (::core::option::Option::Some(short), true) = (
5229            &self.query,
5230            self.boost.is_none()
5231                && self.name.is_none()
5232                && self.analyzer.is_none()
5233                && self.fuzziness.is_none()
5234                && self.fuzzy_rewrite.is_none()
5235                && self.fuzzy_transpositions.is_none()
5236                && self.max_expansions.is_none()
5237                && self.minimum_should_match.is_none()
5238                && self.operator.is_none()
5239                && self.prefix_length.is_none(),
5240        ) {
5241            return ::serde::Serialize::serialize(short, serializer);
5242        }
5243        MatchBoolPrefixQueryDef::serialize(self, serializer)
5244    }
5245}
5246
5247impl<'de> ::oxsearch_core::__private::Shorthand<'de> for MatchBoolPrefixQuery {
5248    type Short = ::std::string::String;
5249    fn from_short(short: ::std::string::String) -> Self {
5250        Self {
5251            boost: ::core::option::Option::None,
5252            name: ::core::option::Option::None,
5253            analyzer: ::core::option::Option::None,
5254            fuzziness: ::core::option::Option::None,
5255            fuzzy_rewrite: ::core::option::Option::None,
5256            fuzzy_transpositions: ::core::option::Option::None,
5257            max_expansions: ::core::option::Option::None,
5258            minimum_should_match: ::core::option::Option::None,
5259            operator: ::core::option::Option::None,
5260            prefix_length: ::core::option::Option::None,
5261            query: ::core::option::Option::Some(short),
5262        }
5263    }
5264    fn deserialize_full<D__: ::serde::Deserializer<'de>>(
5265        deserializer: D__,
5266    ) -> ::core::result::Result<Self, D__::Error> {
5267        MatchBoolPrefixQueryDef::deserialize(deserializer)
5268    }
5269}
5270
5271impl<'de> ::serde::Deserialize<'de> for MatchBoolPrefixQuery {
5272    fn deserialize<D__: ::serde::Deserializer<'de>>(
5273        deserializer: D__,
5274    ) -> ::core::result::Result<Self, D__::Error> {
5275        ::oxsearch_core::__private::deserialize_shorthand(deserializer)
5276    }
5277}
5278
5279#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
5280#[non_exhaustive]
5281pub struct MatchNoneQuery {
5282    /// Floating point number used to decrease or increase the relevance scores of the query.
5283    /// Boost values are relative to the default value of 1.0.
5284    /// A boost value between 0 and 1.0 decreases the relevance score.
5285    /// A value greater than 1.0 increases the relevance score.
5286    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
5287    pub boost: ::core::option::Option<f32>,
5288    #[serde(
5289        rename = "_name",
5290        skip_serializing_if = "::core::option::Option::is_none"
5291    )]
5292    pub name: ::core::option::Option<::std::string::String>,
5293}
5294
5295impl MatchNoneQuery {
5296    /// A `MatchNoneQuery` with its required properties set.
5297    pub fn new() -> Self {
5298        Self {
5299            boost: ::core::option::Option::None,
5300            name: ::core::option::Option::None,
5301        }
5302    }
5303}
5304
5305impl MatchNoneQuery {
5306    /// Sets `boost`.
5307    pub fn boost(mut self, value: f32) -> Self {
5308        self.boost = ::core::option::Option::Some(value.into());
5309        self
5310    }
5311    /// Sets `name`.
5312    pub fn name(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
5313        self.name = ::core::option::Option::Some(value.into());
5314        self
5315    }
5316}
5317
5318#[derive(Clone, Debug, PartialEq)]
5319#[non_exhaustive]
5320pub struct MatchPhrasePrefixQuery {
5321    /// Floating point number used to decrease or increase the relevance scores of the query.
5322    /// Boost values are relative to the default value of 1.0.
5323    /// A boost value between 0 and 1.0 decreases the relevance score.
5324    /// A value greater than 1.0 increases the relevance score.
5325    pub boost: ::core::option::Option<f32>,
5326    pub name: ::core::option::Option<::std::string::String>,
5327    /// Analyzer used to convert text in the query value into tokens.
5328    pub analyzer: ::core::option::Option<::std::string::String>,
5329    /// Maximum number of terms to which the last provided term of the query value will expand.
5330    pub max_expansions: ::core::option::Option<i32>,
5331    /// Text you wish to find in the provided field.
5332    pub query: ::core::option::Option<::std::string::String>,
5333    /// Maximum number of positions allowed between matching tokens.
5334    pub slop: ::core::option::Option<i32>,
5335    /// Indicates whether no documents are returned if the analyzer removes all tokens, such as when using a `stop` filter.
5336    pub zero_terms_query: ::core::option::Option<crate::query_dsl::ZeroTermsQuery>,
5337}
5338
5339impl MatchPhrasePrefixQuery {
5340    /// A `MatchPhrasePrefixQuery` with its required properties set.
5341    pub fn new(query: impl ::core::convert::Into<::std::string::String>) -> Self {
5342        Self {
5343            boost: ::core::option::Option::None,
5344            name: ::core::option::Option::None,
5345            analyzer: ::core::option::Option::None,
5346            max_expansions: ::core::option::Option::None,
5347            query: ::core::option::Option::Some(query.into()),
5348            slop: ::core::option::Option::None,
5349            zero_terms_query: ::core::option::Option::None,
5350        }
5351    }
5352}
5353
5354impl MatchPhrasePrefixQuery {
5355    /// Sets `boost`.
5356    pub fn boost(mut self, value: f32) -> Self {
5357        self.boost = ::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 `analyzer`.
5366    pub fn analyzer(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
5367        self.analyzer = ::core::option::Option::Some(value.into());
5368        self
5369    }
5370    /// Sets `max_expansions`.
5371    pub fn max_expansions(mut self, value: i32) -> Self {
5372        self.max_expansions = ::core::option::Option::Some(value.into());
5373        self
5374    }
5375    /// Sets `slop`.
5376    pub fn slop(mut self, value: i32) -> Self {
5377        self.slop = ::core::option::Option::Some(value.into());
5378        self
5379    }
5380    /// Sets `zero_terms_query`.
5381    pub fn zero_terms_query(
5382        mut self,
5383        value: impl ::core::convert::Into<crate::query_dsl::ZeroTermsQuery>,
5384    ) -> Self {
5385        self.zero_terms_query = ::core::option::Option::Some(value.into());
5386        self
5387    }
5388}
5389
5390#[derive(::serde::Serialize, ::serde::Deserialize)]
5391#[serde(remote = "MatchPhrasePrefixQuery")]
5392struct MatchPhrasePrefixQueryDef {
5393    /// Floating point number used to decrease or increase the relevance scores of the query.
5394    /// Boost values are relative to the default value of 1.0.
5395    /// A boost value between 0 and 1.0 decreases the relevance score.
5396    /// A value greater than 1.0 increases the relevance score.
5397    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
5398    boost: ::core::option::Option<f32>,
5399    #[serde(
5400        rename = "_name",
5401        skip_serializing_if = "::core::option::Option::is_none"
5402    )]
5403    name: ::core::option::Option<::std::string::String>,
5404    /// Analyzer used to convert text in the query value into tokens.
5405    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
5406    analyzer: ::core::option::Option<::std::string::String>,
5407    /// Maximum number of terms to which the last provided term of the query value will expand.
5408    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
5409    max_expansions: ::core::option::Option<i32>,
5410    /// Text you wish to find in the provided field.
5411    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
5412    query: ::core::option::Option<::std::string::String>,
5413    /// Maximum number of positions allowed between matching tokens.
5414    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
5415    slop: ::core::option::Option<i32>,
5416    /// Indicates whether no documents are returned if the analyzer removes all tokens, such as when using a `stop` filter.
5417    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
5418    zero_terms_query: ::core::option::Option<crate::query_dsl::ZeroTermsQuery>,
5419}
5420
5421impl ::serde::Serialize for MatchPhrasePrefixQuery {
5422    fn serialize<S__: ::serde::Serializer>(
5423        &self,
5424        serializer: S__,
5425    ) -> ::core::result::Result<S__::Ok, S__::Error> {
5426        if let (::core::option::Option::Some(short), true) = (
5427            &self.query,
5428            self.boost.is_none()
5429                && self.name.is_none()
5430                && self.analyzer.is_none()
5431                && self.max_expansions.is_none()
5432                && self.slop.is_none()
5433                && self.zero_terms_query.is_none(),
5434        ) {
5435            return ::serde::Serialize::serialize(short, serializer);
5436        }
5437        MatchPhrasePrefixQueryDef::serialize(self, serializer)
5438    }
5439}
5440
5441impl<'de> ::oxsearch_core::__private::Shorthand<'de> for MatchPhrasePrefixQuery {
5442    type Short = ::std::string::String;
5443    fn from_short(short: ::std::string::String) -> Self {
5444        Self {
5445            boost: ::core::option::Option::None,
5446            name: ::core::option::Option::None,
5447            analyzer: ::core::option::Option::None,
5448            max_expansions: ::core::option::Option::None,
5449            query: ::core::option::Option::Some(short),
5450            slop: ::core::option::Option::None,
5451            zero_terms_query: ::core::option::Option::None,
5452        }
5453    }
5454    fn deserialize_full<D__: ::serde::Deserializer<'de>>(
5455        deserializer: D__,
5456    ) -> ::core::result::Result<Self, D__::Error> {
5457        MatchPhrasePrefixQueryDef::deserialize(deserializer)
5458    }
5459}
5460
5461impl<'de> ::serde::Deserialize<'de> for MatchPhrasePrefixQuery {
5462    fn deserialize<D__: ::serde::Deserializer<'de>>(
5463        deserializer: D__,
5464    ) -> ::core::result::Result<Self, D__::Error> {
5465        ::oxsearch_core::__private::deserialize_shorthand(deserializer)
5466    }
5467}
5468
5469#[derive(Clone, Debug, PartialEq)]
5470#[non_exhaustive]
5471pub struct MatchPhraseQuery {
5472    /// Floating point number used to decrease or increase the relevance scores of the query.
5473    /// Boost values are relative to the default value of 1.0.
5474    /// A boost value between 0 and 1.0 decreases the relevance score.
5475    /// A value greater than 1.0 increases the relevance score.
5476    pub boost: ::core::option::Option<f32>,
5477    pub name: ::core::option::Option<::std::string::String>,
5478    /// Analyzer used to convert the text in the query value into tokens.
5479    pub analyzer: ::core::option::Option<::std::string::String>,
5480    /// Query terms that are analyzed and turned into a phrase query.
5481    pub query: ::core::option::Option<::std::string::String>,
5482    /// Maximum number of positions allowed between matching tokens.
5483    pub slop: ::core::option::Option<i32>,
5484    /// Indicates whether no documents are returned if the `analyzer` removes all tokens, such as when using a `stop` filter.
5485    pub zero_terms_query: ::core::option::Option<crate::query_dsl::ZeroTermsQuery>,
5486}
5487
5488impl MatchPhraseQuery {
5489    /// A `MatchPhraseQuery` with its required properties set.
5490    pub fn new(query: impl ::core::convert::Into<::std::string::String>) -> Self {
5491        Self {
5492            boost: ::core::option::Option::None,
5493            name: ::core::option::Option::None,
5494            analyzer: ::core::option::Option::None,
5495            query: ::core::option::Option::Some(query.into()),
5496            slop: ::core::option::Option::None,
5497            zero_terms_query: ::core::option::Option::None,
5498        }
5499    }
5500}
5501
5502impl MatchPhraseQuery {
5503    /// Sets `boost`.
5504    pub fn boost(mut self, value: f32) -> Self {
5505        self.boost = ::core::option::Option::Some(value.into());
5506        self
5507    }
5508    /// Sets `name`.
5509    pub fn name(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
5510        self.name = ::core::option::Option::Some(value.into());
5511        self
5512    }
5513    /// Sets `analyzer`.
5514    pub fn analyzer(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
5515        self.analyzer = ::core::option::Option::Some(value.into());
5516        self
5517    }
5518    /// Sets `slop`.
5519    pub fn slop(mut self, value: i32) -> Self {
5520        self.slop = ::core::option::Option::Some(value.into());
5521        self
5522    }
5523    /// Sets `zero_terms_query`.
5524    pub fn zero_terms_query(
5525        mut self,
5526        value: impl ::core::convert::Into<crate::query_dsl::ZeroTermsQuery>,
5527    ) -> Self {
5528        self.zero_terms_query = ::core::option::Option::Some(value.into());
5529        self
5530    }
5531}
5532
5533#[derive(::serde::Serialize, ::serde::Deserialize)]
5534#[serde(remote = "MatchPhraseQuery")]
5535struct MatchPhraseQueryDef {
5536    /// Floating point number used to decrease or increase the relevance scores of the query.
5537    /// Boost values are relative to the default value of 1.0.
5538    /// A boost value between 0 and 1.0 decreases the relevance score.
5539    /// A value greater than 1.0 increases the relevance score.
5540    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
5541    boost: ::core::option::Option<f32>,
5542    #[serde(
5543        rename = "_name",
5544        skip_serializing_if = "::core::option::Option::is_none"
5545    )]
5546    name: ::core::option::Option<::std::string::String>,
5547    /// Analyzer used to convert the text in the query value into tokens.
5548    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
5549    analyzer: ::core::option::Option<::std::string::String>,
5550    /// Query terms that are analyzed and turned into a phrase query.
5551    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
5552    query: ::core::option::Option<::std::string::String>,
5553    /// Maximum number of positions allowed between matching tokens.
5554    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
5555    slop: ::core::option::Option<i32>,
5556    /// Indicates whether no documents are returned if the `analyzer` removes all tokens, such as when using a `stop` filter.
5557    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
5558    zero_terms_query: ::core::option::Option<crate::query_dsl::ZeroTermsQuery>,
5559}
5560
5561impl ::serde::Serialize for MatchPhraseQuery {
5562    fn serialize<S__: ::serde::Serializer>(
5563        &self,
5564        serializer: S__,
5565    ) -> ::core::result::Result<S__::Ok, S__::Error> {
5566        if let (::core::option::Option::Some(short), true) = (
5567            &self.query,
5568            self.boost.is_none()
5569                && self.name.is_none()
5570                && self.analyzer.is_none()
5571                && self.slop.is_none()
5572                && self.zero_terms_query.is_none(),
5573        ) {
5574            return ::serde::Serialize::serialize(short, serializer);
5575        }
5576        MatchPhraseQueryDef::serialize(self, serializer)
5577    }
5578}
5579
5580impl<'de> ::oxsearch_core::__private::Shorthand<'de> for MatchPhraseQuery {
5581    type Short = ::std::string::String;
5582    fn from_short(short: ::std::string::String) -> Self {
5583        Self {
5584            boost: ::core::option::Option::None,
5585            name: ::core::option::Option::None,
5586            analyzer: ::core::option::Option::None,
5587            query: ::core::option::Option::Some(short),
5588            slop: ::core::option::Option::None,
5589            zero_terms_query: ::core::option::Option::None,
5590        }
5591    }
5592    fn deserialize_full<D__: ::serde::Deserializer<'de>>(
5593        deserializer: D__,
5594    ) -> ::core::result::Result<Self, D__::Error> {
5595        MatchPhraseQueryDef::deserialize(deserializer)
5596    }
5597}
5598
5599impl<'de> ::serde::Deserialize<'de> for MatchPhraseQuery {
5600    fn deserialize<D__: ::serde::Deserializer<'de>>(
5601        deserializer: D__,
5602    ) -> ::core::result::Result<Self, D__::Error> {
5603        ::oxsearch_core::__private::deserialize_shorthand(deserializer)
5604    }
5605}
5606
5607#[derive(Clone, Debug, PartialEq)]
5608#[non_exhaustive]
5609pub enum MatchQueryQuery {
5610    /// A string.
5611    String(::std::string::String),
5612    /// A number.
5613    Float(f32),
5614    /// A boolean.
5615    Bool(bool),
5616}
5617
5618impl ::serde::Serialize for MatchQueryQuery {
5619    fn serialize<S__: ::serde::Serializer>(
5620        &self,
5621        serializer: S__,
5622    ) -> ::core::result::Result<S__::Ok, S__::Error> {
5623        match self {
5624            Self::String(value) => ::serde::Serialize::serialize(value, serializer),
5625            Self::Float(value) => ::serde::Serialize::serialize(value, serializer),
5626            Self::Bool(value) => ::serde::Serialize::serialize(value, serializer),
5627        }
5628    }
5629}
5630
5631impl<'de> ::serde::Deserialize<'de> for MatchQueryQuery {
5632    fn deserialize<D__: ::serde::Deserializer<'de>>(
5633        deserializer: D__,
5634    ) -> ::core::result::Result<Self, D__::Error> {
5635        struct Shape;
5636        impl<'de> ::oxsearch_core::__private::ByKind<'de> for Shape {
5637            type Value = MatchQueryQuery;
5638            const EXPECTING: &'static str = "MatchQueryQuery: boolean or number or string";
5639            fn visit<V__: ::serde::Deserializer<'de>>(
5640                self,
5641                kind: ::oxsearch_core::__private::Kind,
5642                value: V__,
5643            ) -> ::core::result::Result<Self::Value, V__::Error> {
5644                match kind {
5645                    ::oxsearch_core::__private::Kind::Bool => {
5646                        <bool as ::serde::Deserialize>::deserialize(value)
5647                            .map(MatchQueryQuery::Bool)
5648                    }
5649                    ::oxsearch_core::__private::Kind::Number => {
5650                        <f32 as ::serde::Deserialize>::deserialize(value)
5651                            .map(MatchQueryQuery::Float)
5652                    }
5653                    ::oxsearch_core::__private::Kind::String => {
5654                        <::std::string::String as ::serde::Deserialize>::deserialize(value)
5655                            .map(MatchQueryQuery::String)
5656                    }
5657                    _ => ::core::result::Result::Err(<V__::Error as ::serde::de::Error>::custom(
5658                        format_args!("MatchQueryQuery can't be {kind:?}"),
5659                    )),
5660                }
5661            }
5662        }
5663        ::oxsearch_core::__private::deserialize_by_kind(deserializer, Shape)
5664    }
5665}
5666
5667impl ::core::convert::From<::std::string::String> for MatchQueryQuery {
5668    fn from(value: ::std::string::String) -> Self {
5669        Self::String(value)
5670    }
5671}
5672
5673impl ::core::convert::From<f32> for MatchQueryQuery {
5674    fn from(value: f32) -> Self {
5675        Self::Float(value)
5676    }
5677}
5678
5679impl ::core::convert::From<bool> for MatchQueryQuery {
5680    fn from(value: bool) -> Self {
5681        Self::Bool(value)
5682    }
5683}
5684
5685impl ::core::convert::From<&str> for MatchQueryQuery {
5686    fn from(value: &str) -> Self {
5687        Self::String(::std::borrow::ToOwned::to_owned(value))
5688    }
5689}
5690
5691#[derive(Clone, Debug, PartialEq)]
5692#[non_exhaustive]
5693pub struct MatchQuery {
5694    /// Floating point number used to decrease or increase the relevance scores of the query.
5695    /// Boost values are relative to the default value of 1.0.
5696    /// A boost value between 0 and 1.0 decreases the relevance score.
5697    /// A value greater than 1.0 increases the relevance score.
5698    pub boost: ::core::option::Option<f32>,
5699    pub name: ::core::option::Option<::std::string::String>,
5700    /// Analyzer used to convert the text in the query value into tokens.
5701    pub analyzer: ::core::option::Option<::std::string::String>,
5702    /// If `true`, match phrase queries are automatically created for multi-term synonyms.
5703    pub auto_generate_synonyms_phrase_query: ::core::option::Option<bool>,
5704    pub cutoff_frequency: ::core::option::Option<f64>,
5705    /// Maximum edit distance allowed for matching.
5706    pub fuzziness: ::core::option::Option<crate::Fuzziness>,
5707    /// Method used to rewrite the query.
5708    pub fuzzy_rewrite: ::core::option::Option<crate::MultiTermQueryRewrite>,
5709    /// If `true`, edits for fuzzy matching include transpositions of two adjacent characters (for example, `ab` to `ba`).
5710    pub fuzzy_transpositions: ::core::option::Option<bool>,
5711    /// If `true`, format-based errors, such as providing a text query value for a numeric field, are ignored.
5712    pub lenient: ::core::option::Option<bool>,
5713    /// Maximum number of terms to which the query will expand.
5714    pub max_expansions: ::core::option::Option<i32>,
5715    /// Minimum number of clauses that must match for a document to be returned.
5716    pub minimum_should_match: ::core::option::Option<crate::MinimumShouldMatch>,
5717    /// Boolean logic used to interpret text in the query value.
5718    pub operator: ::core::option::Option<crate::query_dsl::Operator>,
5719    /// Number of beginning characters left unchanged for fuzzy matching.
5720    pub prefix_length: ::core::option::Option<i32>,
5721    /// Text, number, boolean value or date you wish to find in the provided field.
5722    pub query: ::core::option::Option<crate::query_dsl::MatchQueryQuery>,
5723    /// Indicates whether no documents are returned if the `analyzer` removes all tokens, such as when using a `stop` filter.
5724    pub zero_terms_query: ::core::option::Option<crate::query_dsl::ZeroTermsQuery>,
5725}
5726
5727impl MatchQuery {
5728    /// A `MatchQuery` with its required properties set.
5729    pub fn new(query: impl ::core::convert::Into<crate::query_dsl::MatchQueryQuery>) -> Self {
5730        Self {
5731            boost: ::core::option::Option::None,
5732            name: ::core::option::Option::None,
5733            analyzer: ::core::option::Option::None,
5734            auto_generate_synonyms_phrase_query: ::core::option::Option::None,
5735            cutoff_frequency: ::core::option::Option::None,
5736            fuzziness: ::core::option::Option::None,
5737            fuzzy_rewrite: ::core::option::Option::None,
5738            fuzzy_transpositions: ::core::option::Option::None,
5739            lenient: ::core::option::Option::None,
5740            max_expansions: ::core::option::Option::None,
5741            minimum_should_match: ::core::option::Option::None,
5742            operator: ::core::option::Option::None,
5743            prefix_length: ::core::option::Option::None,
5744            query: ::core::option::Option::Some(query.into()),
5745            zero_terms_query: ::core::option::Option::None,
5746        }
5747    }
5748}
5749
5750impl MatchQuery {
5751    /// Sets `boost`.
5752    pub fn boost(mut self, value: f32) -> Self {
5753        self.boost = ::core::option::Option::Some(value.into());
5754        self
5755    }
5756    /// Sets `name`.
5757    pub fn name(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
5758        self.name = ::core::option::Option::Some(value.into());
5759        self
5760    }
5761    /// Sets `analyzer`.
5762    pub fn analyzer(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
5763        self.analyzer = ::core::option::Option::Some(value.into());
5764        self
5765    }
5766    /// Sets `auto_generate_synonyms_phrase_query`.
5767    pub fn auto_generate_synonyms_phrase_query(mut self, value: bool) -> Self {
5768        self.auto_generate_synonyms_phrase_query = ::core::option::Option::Some(value.into());
5769        self
5770    }
5771    /// Sets `cutoff_frequency`.
5772    pub fn cutoff_frequency(mut self, value: f64) -> Self {
5773        self.cutoff_frequency = ::core::option::Option::Some(value.into());
5774        self
5775    }
5776    /// Sets `fuzziness`.
5777    pub fn fuzziness(mut self, value: impl ::core::convert::Into<crate::Fuzziness>) -> Self {
5778        self.fuzziness = ::core::option::Option::Some(value.into());
5779        self
5780    }
5781    /// Sets `fuzzy_rewrite`.
5782    pub fn fuzzy_rewrite(
5783        mut self,
5784        value: impl ::core::convert::Into<crate::MultiTermQueryRewrite>,
5785    ) -> Self {
5786        self.fuzzy_rewrite = ::core::option::Option::Some(value.into());
5787        self
5788    }
5789    /// Sets `fuzzy_transpositions`.
5790    pub fn fuzzy_transpositions(mut self, value: bool) -> Self {
5791        self.fuzzy_transpositions = ::core::option::Option::Some(value.into());
5792        self
5793    }
5794    /// Sets `lenient`.
5795    pub fn lenient(mut self, value: bool) -> Self {
5796        self.lenient = ::core::option::Option::Some(value.into());
5797        self
5798    }
5799    /// Sets `max_expansions`.
5800    pub fn max_expansions(mut self, value: i32) -> Self {
5801        self.max_expansions = ::core::option::Option::Some(value.into());
5802        self
5803    }
5804    /// Sets `minimum_should_match`.
5805    pub fn minimum_should_match(
5806        mut self,
5807        value: impl ::core::convert::Into<crate::MinimumShouldMatch>,
5808    ) -> Self {
5809        self.minimum_should_match = ::core::option::Option::Some(value.into());
5810        self
5811    }
5812    /// Sets `operator`.
5813    pub fn operator(
5814        mut self,
5815        value: impl ::core::convert::Into<crate::query_dsl::Operator>,
5816    ) -> Self {
5817        self.operator = ::core::option::Option::Some(value.into());
5818        self
5819    }
5820    /// Sets `prefix_length`.
5821    pub fn prefix_length(mut self, value: i32) -> Self {
5822        self.prefix_length = ::core::option::Option::Some(value.into());
5823        self
5824    }
5825    /// Sets `zero_terms_query`.
5826    pub fn zero_terms_query(
5827        mut self,
5828        value: impl ::core::convert::Into<crate::query_dsl::ZeroTermsQuery>,
5829    ) -> Self {
5830        self.zero_terms_query = ::core::option::Option::Some(value.into());
5831        self
5832    }
5833}
5834
5835#[derive(::serde::Serialize, ::serde::Deserialize)]
5836#[serde(remote = "MatchQuery")]
5837struct MatchQueryDef {
5838    /// Floating point number used to decrease or increase the relevance scores of the query.
5839    /// Boost values are relative to the default value of 1.0.
5840    /// A boost value between 0 and 1.0 decreases the relevance score.
5841    /// A value greater than 1.0 increases the relevance score.
5842    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
5843    boost: ::core::option::Option<f32>,
5844    #[serde(
5845        rename = "_name",
5846        skip_serializing_if = "::core::option::Option::is_none"
5847    )]
5848    name: ::core::option::Option<::std::string::String>,
5849    /// Analyzer used to convert the text in the query value into tokens.
5850    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
5851    analyzer: ::core::option::Option<::std::string::String>,
5852    /// If `true`, match phrase queries are automatically created for multi-term synonyms.
5853    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
5854    auto_generate_synonyms_phrase_query: ::core::option::Option<bool>,
5855    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
5856    cutoff_frequency: ::core::option::Option<f64>,
5857    /// Maximum edit distance allowed for matching.
5858    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
5859    fuzziness: ::core::option::Option<crate::Fuzziness>,
5860    /// Method used to rewrite the query.
5861    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
5862    fuzzy_rewrite: ::core::option::Option<crate::MultiTermQueryRewrite>,
5863    /// If `true`, edits for fuzzy matching include transpositions of two adjacent characters (for example, `ab` to `ba`).
5864    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
5865    fuzzy_transpositions: ::core::option::Option<bool>,
5866    /// If `true`, format-based errors, such as providing a text query value for a numeric field, are ignored.
5867    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
5868    lenient: ::core::option::Option<bool>,
5869    /// Maximum number of terms to which the query will expand.
5870    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
5871    max_expansions: ::core::option::Option<i32>,
5872    /// Minimum number of clauses that must match for a document to be returned.
5873    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
5874    minimum_should_match: ::core::option::Option<crate::MinimumShouldMatch>,
5875    /// Boolean logic used to interpret text in the query value.
5876    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
5877    operator: ::core::option::Option<crate::query_dsl::Operator>,
5878    /// Number of beginning characters left unchanged for fuzzy matching.
5879    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
5880    prefix_length: ::core::option::Option<i32>,
5881    /// Text, number, boolean value or date you wish to find in the provided field.
5882    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
5883    query: ::core::option::Option<crate::query_dsl::MatchQueryQuery>,
5884    /// Indicates whether no documents are returned if the `analyzer` removes all tokens, such as when using a `stop` filter.
5885    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
5886    zero_terms_query: ::core::option::Option<crate::query_dsl::ZeroTermsQuery>,
5887}
5888
5889impl ::serde::Serialize for MatchQuery {
5890    fn serialize<S__: ::serde::Serializer>(
5891        &self,
5892        serializer: S__,
5893    ) -> ::core::result::Result<S__::Ok, S__::Error> {
5894        if let (::core::option::Option::Some(short), true) = (
5895            &self.query,
5896            self.boost.is_none()
5897                && self.name.is_none()
5898                && self.analyzer.is_none()
5899                && self.auto_generate_synonyms_phrase_query.is_none()
5900                && self.cutoff_frequency.is_none()
5901                && self.fuzziness.is_none()
5902                && self.fuzzy_rewrite.is_none()
5903                && self.fuzzy_transpositions.is_none()
5904                && self.lenient.is_none()
5905                && self.max_expansions.is_none()
5906                && self.minimum_should_match.is_none()
5907                && self.operator.is_none()
5908                && self.prefix_length.is_none()
5909                && self.zero_terms_query.is_none(),
5910        ) {
5911            return ::serde::Serialize::serialize(short, serializer);
5912        }
5913        MatchQueryDef::serialize(self, serializer)
5914    }
5915}
5916
5917impl<'de> ::oxsearch_core::__private::Shorthand<'de> for MatchQuery {
5918    type Short = crate::query_dsl::MatchQueryQuery;
5919    fn from_short(short: crate::query_dsl::MatchQueryQuery) -> Self {
5920        Self {
5921            boost: ::core::option::Option::None,
5922            name: ::core::option::Option::None,
5923            analyzer: ::core::option::Option::None,
5924            auto_generate_synonyms_phrase_query: ::core::option::Option::None,
5925            cutoff_frequency: ::core::option::Option::None,
5926            fuzziness: ::core::option::Option::None,
5927            fuzzy_rewrite: ::core::option::Option::None,
5928            fuzzy_transpositions: ::core::option::Option::None,
5929            lenient: ::core::option::Option::None,
5930            max_expansions: ::core::option::Option::None,
5931            minimum_should_match: ::core::option::Option::None,
5932            operator: ::core::option::Option::None,
5933            prefix_length: ::core::option::Option::None,
5934            query: ::core::option::Option::Some(short),
5935            zero_terms_query: ::core::option::Option::None,
5936        }
5937    }
5938    fn deserialize_full<D__: ::serde::Deserializer<'de>>(
5939        deserializer: D__,
5940    ) -> ::core::result::Result<Self, D__::Error> {
5941        MatchQueryDef::deserialize(deserializer)
5942    }
5943}
5944
5945impl<'de> ::serde::Deserialize<'de> for MatchQuery {
5946    fn deserialize<D__: ::serde::Deserializer<'de>>(
5947        deserializer: D__,
5948    ) -> ::core::result::Result<Self, D__::Error> {
5949        ::oxsearch_core::__private::deserialize_shorthand(deserializer)
5950    }
5951}
5952
5953#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
5954#[non_exhaustive]
5955pub struct MoreLikeThisQuery {
5956    /// Floating point number used to decrease or increase the relevance scores of the query.
5957    /// Boost values are relative to the default value of 1.0.
5958    /// A boost value between 0 and 1.0 decreases the relevance score.
5959    /// A value greater than 1.0 increases the relevance score.
5960    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
5961    pub boost: ::core::option::Option<f32>,
5962    #[serde(
5963        rename = "_name",
5964        skip_serializing_if = "::core::option::Option::is_none"
5965    )]
5966    pub name: ::core::option::Option<::std::string::String>,
5967    /// The analyzer that is used to analyze the free form text.
5968    /// Defaults to the analyzer associated with the first field in fields.
5969    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
5970    pub analyzer: ::core::option::Option<::std::string::String>,
5971    /// Each term in the formed query could be further boosted by their tf-idf score.
5972    /// This sets the boost factor to use when using this feature.
5973    /// Defaults to deactivated (0).
5974    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
5975    pub boost_terms: ::core::option::Option<f64>,
5976    /// Controls whether the query should fail (throw an exception) if any of the specified fields are not of the supported types (`text` or `keyword`).
5977    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
5978    pub fail_on_unsupported_field: ::core::option::Option<bool>,
5979    /// A list of fields to fetch and analyze the text from.
5980    /// Defaults to the `index.query.default_field` index setting, which has a default value of `*`.
5981    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
5982    pub fields: ::core::option::Option<::std::vec::Vec<crate::Field>>,
5983    /// Specifies whether the input documents should also be included in the search results returned.
5984    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
5985    pub include: ::core::option::Option<bool>,
5986    /// Specifies free form text and/or a single or multiple documents for which you want to find similar documents.
5987    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
5988    pub like: ::core::option::Option<::oxsearch_core::shapes::OneOrMany<crate::query_dsl::Like>>,
5989    /// The maximum document frequency above which the terms are ignored from the input document.
5990    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
5991    pub max_doc_freq: ::core::option::Option<i32>,
5992    /// The maximum number of query terms that can be selected.
5993    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
5994    pub max_query_terms: ::core::option::Option<i32>,
5995    /// The maximum word length above which the terms are ignored.
5996    /// Defaults to unbounded (`0`).
5997    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
5998    pub max_word_length: ::core::option::Option<i32>,
5999    /// The minimum document frequency below which the terms are ignored from the input document.
6000    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
6001    pub min_doc_freq: ::core::option::Option<i32>,
6002    /// After the disjunctive query has been formed, this parameter controls the number of terms that must match.
6003    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
6004    pub minimum_should_match: ::core::option::Option<crate::MinimumShouldMatch>,
6005    /// The minimum term frequency below which the terms are ignored from the input document.
6006    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
6007    pub min_term_freq: ::core::option::Option<i32>,
6008    /// The minimum word length below which the terms are ignored.
6009    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
6010    pub min_word_length: ::core::option::Option<i32>,
6011    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
6012    pub routing: ::core::option::Option<::std::string::String>,
6013    /// An array of stop words.
6014    /// Any word in this set is ignored.
6015    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
6016    pub stop_words: ::core::option::Option<crate::analysis::StopWords>,
6017    /// Used in combination with `like` to exclude documents that match a set of terms.
6018    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
6019    pub unlike: ::core::option::Option<::oxsearch_core::shapes::OneOrMany<crate::query_dsl::Like>>,
6020    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
6021    pub version: ::core::option::Option<crate::VersionNumber>,
6022    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
6023    pub version_type: ::core::option::Option<crate::VersionType>,
6024}
6025
6026impl MoreLikeThisQuery {
6027    /// A `MoreLikeThisQuery` with its required properties set.
6028    pub fn new(
6029        like: impl ::core::convert::Into<::oxsearch_core::shapes::OneOrMany<crate::query_dsl::Like>>,
6030    ) -> Self {
6031        Self {
6032            boost: ::core::option::Option::None,
6033            name: ::core::option::Option::None,
6034            analyzer: ::core::option::Option::None,
6035            boost_terms: ::core::option::Option::None,
6036            fail_on_unsupported_field: ::core::option::Option::None,
6037            fields: ::core::option::Option::None,
6038            include: ::core::option::Option::None,
6039            like: ::core::option::Option::Some(like.into()),
6040            max_doc_freq: ::core::option::Option::None,
6041            max_query_terms: ::core::option::Option::None,
6042            max_word_length: ::core::option::Option::None,
6043            min_doc_freq: ::core::option::Option::None,
6044            minimum_should_match: ::core::option::Option::None,
6045            min_term_freq: ::core::option::Option::None,
6046            min_word_length: ::core::option::Option::None,
6047            routing: ::core::option::Option::None,
6048            stop_words: ::core::option::Option::None,
6049            unlike: ::core::option::Option::None,
6050            version: ::core::option::Option::None,
6051            version_type: ::core::option::Option::None,
6052        }
6053    }
6054}
6055
6056impl MoreLikeThisQuery {
6057    /// Sets `boost`.
6058    pub fn boost(mut self, value: f32) -> Self {
6059        self.boost = ::core::option::Option::Some(value.into());
6060        self
6061    }
6062    /// Sets `name`.
6063    pub fn name(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
6064        self.name = ::core::option::Option::Some(value.into());
6065        self
6066    }
6067    /// Sets `analyzer`.
6068    pub fn analyzer(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
6069        self.analyzer = ::core::option::Option::Some(value.into());
6070        self
6071    }
6072    /// Sets `boost_terms`.
6073    pub fn boost_terms(mut self, value: f64) -> Self {
6074        self.boost_terms = ::core::option::Option::Some(value.into());
6075        self
6076    }
6077    /// Sets `fail_on_unsupported_field`.
6078    pub fn fail_on_unsupported_field(mut self, value: bool) -> Self {
6079        self.fail_on_unsupported_field = ::core::option::Option::Some(value.into());
6080        self
6081    }
6082    /// Sets `fields`.
6083    pub fn fields(
6084        mut self,
6085        value: impl ::core::convert::Into<::std::vec::Vec<crate::Field>>,
6086    ) -> Self {
6087        self.fields = ::core::option::Option::Some(value.into());
6088        self
6089    }
6090    /// Sets `include`.
6091    pub fn include(mut self, value: bool) -> Self {
6092        self.include = ::core::option::Option::Some(value.into());
6093        self
6094    }
6095    /// Sets `max_doc_freq`.
6096    pub fn max_doc_freq(mut self, value: i32) -> Self {
6097        self.max_doc_freq = ::core::option::Option::Some(value.into());
6098        self
6099    }
6100    /// Sets `max_query_terms`.
6101    pub fn max_query_terms(mut self, value: i32) -> Self {
6102        self.max_query_terms = ::core::option::Option::Some(value.into());
6103        self
6104    }
6105    /// Sets `max_word_length`.
6106    pub fn max_word_length(mut self, value: i32) -> Self {
6107        self.max_word_length = ::core::option::Option::Some(value.into());
6108        self
6109    }
6110    /// Sets `min_doc_freq`.
6111    pub fn min_doc_freq(mut self, value: i32) -> Self {
6112        self.min_doc_freq = ::core::option::Option::Some(value.into());
6113        self
6114    }
6115    /// Sets `minimum_should_match`.
6116    pub fn minimum_should_match(
6117        mut self,
6118        value: impl ::core::convert::Into<crate::MinimumShouldMatch>,
6119    ) -> Self {
6120        self.minimum_should_match = ::core::option::Option::Some(value.into());
6121        self
6122    }
6123    /// Sets `min_term_freq`.
6124    pub fn min_term_freq(mut self, value: i32) -> Self {
6125        self.min_term_freq = ::core::option::Option::Some(value.into());
6126        self
6127    }
6128    /// Sets `min_word_length`.
6129    pub fn min_word_length(mut self, value: i32) -> Self {
6130        self.min_word_length = ::core::option::Option::Some(value.into());
6131        self
6132    }
6133    /// Sets `routing`.
6134    pub fn routing(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
6135        self.routing = ::core::option::Option::Some(value.into());
6136        self
6137    }
6138    /// Sets `stop_words`.
6139    pub fn stop_words(
6140        mut self,
6141        value: impl ::core::convert::Into<crate::analysis::StopWords>,
6142    ) -> Self {
6143        self.stop_words = ::core::option::Option::Some(value.into());
6144        self
6145    }
6146    /// Sets `unlike`.
6147    pub fn unlike(
6148        mut self,
6149        value: impl ::core::convert::Into<::oxsearch_core::shapes::OneOrMany<crate::query_dsl::Like>>,
6150    ) -> Self {
6151        self.unlike = ::core::option::Option::Some(value.into());
6152        self
6153    }
6154    /// Sets `version`.
6155    pub fn version(mut self, value: impl ::core::convert::Into<crate::VersionNumber>) -> Self {
6156        self.version = ::core::option::Option::Some(value.into());
6157        self
6158    }
6159    /// Sets `version_type`.
6160    pub fn version_type(mut self, value: impl ::core::convert::Into<crate::VersionType>) -> Self {
6161        self.version_type = ::core::option::Option::Some(value.into());
6162        self
6163    }
6164}
6165
6166#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
6167#[non_exhaustive]
6168pub struct MultiMatchQuery {
6169    /// Floating point number used to decrease or increase the relevance scores of the query.
6170    /// Boost values are relative to the default value of 1.0.
6171    /// A boost value between 0 and 1.0 decreases the relevance score.
6172    /// A value greater than 1.0 increases the relevance score.
6173    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
6174    pub boost: ::core::option::Option<f32>,
6175    #[serde(
6176        rename = "_name",
6177        skip_serializing_if = "::core::option::Option::is_none"
6178    )]
6179    pub name: ::core::option::Option<::std::string::String>,
6180    /// Analyzer used to convert the text in the query value into tokens.
6181    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
6182    pub analyzer: ::core::option::Option<::std::string::String>,
6183    /// If `true`, match phrase queries are automatically created for multi-term synonyms.
6184    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
6185    pub auto_generate_synonyms_phrase_query: ::core::option::Option<bool>,
6186    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
6187    pub cutoff_frequency: ::core::option::Option<f64>,
6188    /// The fields to be queried.
6189    /// Defaults to the `index.query.default_field` index settings, which in turn defaults to `*`.
6190    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
6191    pub fields: ::core::option::Option<crate::Fields>,
6192    /// Maximum edit distance allowed for matching.
6193    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
6194    pub fuzziness: ::core::option::Option<crate::Fuzziness>,
6195    /// Method used to rewrite the query.
6196    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
6197    pub fuzzy_rewrite: ::core::option::Option<crate::MultiTermQueryRewrite>,
6198    /// If `true`, edits for fuzzy matching include transpositions of two adjacent characters (for example, `ab` to `ba`).
6199    /// Can be applied to the term subqueries constructed for all terms but the final term.
6200    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
6201    pub fuzzy_transpositions: ::core::option::Option<bool>,
6202    /// If `true`, format-based errors, such as providing a text query value for a numeric field, are ignored.
6203    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
6204    pub lenient: ::core::option::Option<bool>,
6205    /// Maximum number of terms to which the query will expand.
6206    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
6207    pub max_expansions: ::core::option::Option<i32>,
6208    /// Minimum number of clauses that must match for a document to be returned.
6209    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
6210    pub minimum_should_match: ::core::option::Option<crate::MinimumShouldMatch>,
6211    /// Boolean logic used to interpret text in the query value.
6212    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
6213    pub operator: ::core::option::Option<crate::query_dsl::Operator>,
6214    /// Number of beginning characters left unchanged for fuzzy matching.
6215    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
6216    pub prefix_length: ::core::option::Option<i32>,
6217    /// Text, number, boolean value or date you wish to find in the provided field.
6218    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
6219    pub query: ::core::option::Option<::std::string::String>,
6220    /// Maximum number of positions allowed between matching tokens.
6221    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
6222    pub slop: ::core::option::Option<i32>,
6223    /// Determines how scores for each per-term blended query and scores across groups are combined.
6224    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
6225    pub tie_breaker: ::core::option::Option<f64>,
6226    /// How `the` multi_match query is executed internally.
6227    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
6228    pub r#type: ::core::option::Option<crate::query_dsl::TextQueryType>,
6229    /// Indicates whether no documents are returned if the `analyzer` removes all tokens, such as when using a `stop` filter.
6230    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
6231    pub zero_terms_query: ::core::option::Option<crate::query_dsl::ZeroTermsQuery>,
6232}
6233
6234impl MultiMatchQuery {
6235    /// A `MultiMatchQuery` with its required properties set.
6236    pub fn new(query: impl ::core::convert::Into<::std::string::String>) -> Self {
6237        Self {
6238            boost: ::core::option::Option::None,
6239            name: ::core::option::Option::None,
6240            analyzer: ::core::option::Option::None,
6241            auto_generate_synonyms_phrase_query: ::core::option::Option::None,
6242            cutoff_frequency: ::core::option::Option::None,
6243            fields: ::core::option::Option::None,
6244            fuzziness: ::core::option::Option::None,
6245            fuzzy_rewrite: ::core::option::Option::None,
6246            fuzzy_transpositions: ::core::option::Option::None,
6247            lenient: ::core::option::Option::None,
6248            max_expansions: ::core::option::Option::None,
6249            minimum_should_match: ::core::option::Option::None,
6250            operator: ::core::option::Option::None,
6251            prefix_length: ::core::option::Option::None,
6252            query: ::core::option::Option::Some(query.into()),
6253            slop: ::core::option::Option::None,
6254            tie_breaker: ::core::option::Option::None,
6255            r#type: ::core::option::Option::None,
6256            zero_terms_query: ::core::option::Option::None,
6257        }
6258    }
6259}
6260
6261impl MultiMatchQuery {
6262    /// Sets `boost`.
6263    pub fn boost(mut self, value: f32) -> Self {
6264        self.boost = ::core::option::Option::Some(value.into());
6265        self
6266    }
6267    /// Sets `name`.
6268    pub fn name(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
6269        self.name = ::core::option::Option::Some(value.into());
6270        self
6271    }
6272    /// Sets `analyzer`.
6273    pub fn analyzer(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
6274        self.analyzer = ::core::option::Option::Some(value.into());
6275        self
6276    }
6277    /// Sets `auto_generate_synonyms_phrase_query`.
6278    pub fn auto_generate_synonyms_phrase_query(mut self, value: bool) -> Self {
6279        self.auto_generate_synonyms_phrase_query = ::core::option::Option::Some(value.into());
6280        self
6281    }
6282    /// Sets `cutoff_frequency`.
6283    pub fn cutoff_frequency(mut self, value: f64) -> Self {
6284        self.cutoff_frequency = ::core::option::Option::Some(value.into());
6285        self
6286    }
6287    /// Sets `fields`.
6288    pub fn fields(mut self, value: impl ::core::convert::Into<crate::Fields>) -> Self {
6289        self.fields = ::core::option::Option::Some(value.into());
6290        self
6291    }
6292    /// Sets `fuzziness`.
6293    pub fn fuzziness(mut self, value: impl ::core::convert::Into<crate::Fuzziness>) -> Self {
6294        self.fuzziness = ::core::option::Option::Some(value.into());
6295        self
6296    }
6297    /// Sets `fuzzy_rewrite`.
6298    pub fn fuzzy_rewrite(
6299        mut self,
6300        value: impl ::core::convert::Into<crate::MultiTermQueryRewrite>,
6301    ) -> Self {
6302        self.fuzzy_rewrite = ::core::option::Option::Some(value.into());
6303        self
6304    }
6305    /// Sets `fuzzy_transpositions`.
6306    pub fn fuzzy_transpositions(mut self, value: bool) -> Self {
6307        self.fuzzy_transpositions = ::core::option::Option::Some(value.into());
6308        self
6309    }
6310    /// Sets `lenient`.
6311    pub fn lenient(mut self, value: bool) -> Self {
6312        self.lenient = ::core::option::Option::Some(value.into());
6313        self
6314    }
6315    /// Sets `max_expansions`.
6316    pub fn max_expansions(mut self, value: i32) -> Self {
6317        self.max_expansions = ::core::option::Option::Some(value.into());
6318        self
6319    }
6320    /// Sets `minimum_should_match`.
6321    pub fn minimum_should_match(
6322        mut self,
6323        value: impl ::core::convert::Into<crate::MinimumShouldMatch>,
6324    ) -> Self {
6325        self.minimum_should_match = ::core::option::Option::Some(value.into());
6326        self
6327    }
6328    /// Sets `operator`.
6329    pub fn operator(
6330        mut self,
6331        value: impl ::core::convert::Into<crate::query_dsl::Operator>,
6332    ) -> Self {
6333        self.operator = ::core::option::Option::Some(value.into());
6334        self
6335    }
6336    /// Sets `prefix_length`.
6337    pub fn prefix_length(mut self, value: i32) -> Self {
6338        self.prefix_length = ::core::option::Option::Some(value.into());
6339        self
6340    }
6341    /// Sets `slop`.
6342    pub fn slop(mut self, value: i32) -> Self {
6343        self.slop = ::core::option::Option::Some(value.into());
6344        self
6345    }
6346    /// Sets `tie_breaker`.
6347    pub fn tie_breaker(mut self, value: f64) -> Self {
6348        self.tie_breaker = ::core::option::Option::Some(value.into());
6349        self
6350    }
6351    /// Sets `type`.
6352    pub fn r#type(
6353        mut self,
6354        value: impl ::core::convert::Into<crate::query_dsl::TextQueryType>,
6355    ) -> Self {
6356        self.r#type = ::core::option::Option::Some(value.into());
6357        self
6358    }
6359    /// Sets `zero_terms_query`.
6360    pub fn zero_terms_query(
6361        mut self,
6362        value: impl ::core::convert::Into<crate::query_dsl::ZeroTermsQuery>,
6363    ) -> Self {
6364        self.zero_terms_query = ::core::option::Option::Some(value.into());
6365        self
6366    }
6367}
6368
6369#[derive(Clone, Debug, PartialEq, Eq, Hash)]
6370#[non_exhaustive]
6371pub enum MultiValueMode {
6372    /// Distance is the minimum distance.
6373    Min,
6374    /// Distance is the maximum distance.
6375    Max,
6376    /// Distance is the average distance.
6377    Avg,
6378    /// Distance is the sum of all distances.
6379    Sum,
6380    /// A value this version of the specification doesn't list.
6381    Raw(::std::string::String),
6382}
6383
6384impl MultiValueMode {
6385    /// The value as Elasticsearch writes it.
6386    pub fn as_str(&self) -> &str {
6387        match self {
6388            Self::Min => "min",
6389            Self::Max => "max",
6390            Self::Avg => "avg",
6391            Self::Sum => "sum",
6392            Self::Raw(value) => value,
6393        }
6394    }
6395
6396    /// The listed value with this name, if there is one.
6397    pub fn from_known(value: &str) -> ::core::option::Option<Self> {
6398        match value {
6399            "min" => ::core::option::Option::Some(Self::Min),
6400            "max" => ::core::option::Option::Some(Self::Max),
6401            "avg" => ::core::option::Option::Some(Self::Avg),
6402            "sum" => ::core::option::Option::Some(Self::Sum),
6403            _ => ::core::option::Option::None,
6404        }
6405    }
6406}
6407
6408impl ::serde::Serialize for MultiValueMode {
6409    fn serialize<S__: ::serde::Serializer>(
6410        &self,
6411        serializer: S__,
6412    ) -> ::core::result::Result<S__::Ok, S__::Error> {
6413        serializer.serialize_str(self.as_str())
6414    }
6415}
6416
6417impl<'de> ::serde::Deserialize<'de> for MultiValueMode {
6418    fn deserialize<D__: ::serde::Deserializer<'de>>(
6419        deserializer: D__,
6420    ) -> ::core::result::Result<Self, D__::Error> {
6421        ::oxsearch_core::__private::deserialize_string_enum(
6422            deserializer,
6423            "MultiValueMode",
6424            |value| Self::from_known(value).unwrap_or_else(|| Self::Raw(value.to_owned())),
6425        )
6426    }
6427}
6428
6429#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
6430#[non_exhaustive]
6431pub struct NestedQuery {
6432    /// Floating point number used to decrease or increase the relevance scores of the query.
6433    /// Boost values are relative to the default value of 1.0.
6434    /// A boost value between 0 and 1.0 decreases the relevance score.
6435    /// A value greater than 1.0 increases the relevance score.
6436    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
6437    pub boost: ::core::option::Option<f32>,
6438    #[serde(
6439        rename = "_name",
6440        skip_serializing_if = "::core::option::Option::is_none"
6441    )]
6442    pub name: ::core::option::Option<::std::string::String>,
6443    /// Indicates whether to ignore an unmapped path and not return any documents instead of an error.
6444    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
6445    pub ignore_unmapped: ::core::option::Option<bool>,
6446    /// If defined, each search hit will contain inner hits.
6447    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
6448    pub inner_hits: ::core::option::Option<crate::search::InnerHits>,
6449    /// Path to the nested object you wish to search.
6450    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
6451    pub path: ::core::option::Option<crate::Field>,
6452    /// Query you wish to run on nested objects in the path.
6453    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
6454    pub query: ::core::option::Option<crate::query_dsl::QueryContainer>,
6455    /// How scores for matching child objects affect the root parent document’s relevance score.
6456    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
6457    pub score_mode: ::core::option::Option<crate::query_dsl::ChildScoreMode>,
6458}
6459
6460impl NestedQuery {
6461    /// A `NestedQuery` with its required properties set.
6462    pub fn new(
6463        path: impl ::core::convert::Into<crate::Field>,
6464        query: impl ::core::convert::Into<crate::query_dsl::QueryContainer>,
6465    ) -> Self {
6466        Self {
6467            boost: ::core::option::Option::None,
6468            name: ::core::option::Option::None,
6469            ignore_unmapped: ::core::option::Option::None,
6470            inner_hits: ::core::option::Option::None,
6471            path: ::core::option::Option::Some(path.into()),
6472            query: ::core::option::Option::Some(query.into()),
6473            score_mode: ::core::option::Option::None,
6474        }
6475    }
6476}
6477
6478impl NestedQuery {
6479    /// Sets `boost`.
6480    pub fn boost(mut self, value: f32) -> Self {
6481        self.boost = ::core::option::Option::Some(value.into());
6482        self
6483    }
6484    /// Sets `name`.
6485    pub fn name(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
6486        self.name = ::core::option::Option::Some(value.into());
6487        self
6488    }
6489    /// Sets `ignore_unmapped`.
6490    pub fn ignore_unmapped(mut self, value: bool) -> Self {
6491        self.ignore_unmapped = ::core::option::Option::Some(value.into());
6492        self
6493    }
6494    /// Sets `inner_hits`.
6495    pub fn inner_hits(
6496        mut self,
6497        value: impl ::core::convert::Into<crate::search::InnerHits>,
6498    ) -> Self {
6499        self.inner_hits = ::core::option::Option::Some(value.into());
6500        self
6501    }
6502    /// Sets `score_mode`.
6503    pub fn score_mode(
6504        mut self,
6505        value: impl ::core::convert::Into<crate::query_dsl::ChildScoreMode>,
6506    ) -> Self {
6507        self.score_mode = ::core::option::Option::Some(value.into());
6508        self
6509    }
6510}
6511
6512#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
6513#[non_exhaustive]
6514pub struct NumberRangeQuery {
6515    /// Floating point number used to decrease or increase the relevance scores of the query.
6516    /// Boost values are relative to the default value of 1.0.
6517    /// A boost value between 0 and 1.0 decreases the relevance score.
6518    /// A value greater than 1.0 increases the relevance score.
6519    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
6520    pub boost: ::core::option::Option<f32>,
6521    #[serde(
6522        rename = "_name",
6523        skip_serializing_if = "::core::option::Option::is_none"
6524    )]
6525    pub name: ::core::option::Option<::std::string::String>,
6526    /// Indicates how the range query matches values for `range` fields.
6527    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
6528    pub relation: ::core::option::Option<crate::query_dsl::RangeRelation>,
6529    /// Greater than.
6530    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
6531    pub gt: ::core::option::Option<f64>,
6532    /// Greater than or equal to.
6533    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
6534    pub gte: ::core::option::Option<f64>,
6535    /// Less than.
6536    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
6537    pub lt: ::core::option::Option<f64>,
6538    /// Less than or equal to.
6539    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
6540    pub lte: ::core::option::Option<f64>,
6541}
6542
6543impl NumberRangeQuery {
6544    /// A `NumberRangeQuery` with its required properties set.
6545    pub fn new() -> Self {
6546        Self {
6547            boost: ::core::option::Option::None,
6548            name: ::core::option::Option::None,
6549            relation: ::core::option::Option::None,
6550            gt: ::core::option::Option::None,
6551            gte: ::core::option::Option::None,
6552            lt: ::core::option::Option::None,
6553            lte: ::core::option::Option::None,
6554        }
6555    }
6556}
6557
6558impl NumberRangeQuery {
6559    /// Sets `boost`.
6560    pub fn boost(mut self, value: f32) -> Self {
6561        self.boost = ::core::option::Option::Some(value.into());
6562        self
6563    }
6564    /// Sets `name`.
6565    pub fn name(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
6566        self.name = ::core::option::Option::Some(value.into());
6567        self
6568    }
6569    /// Sets `relation`.
6570    pub fn relation(
6571        mut self,
6572        value: impl ::core::convert::Into<crate::query_dsl::RangeRelation>,
6573    ) -> Self {
6574        self.relation = ::core::option::Option::Some(value.into());
6575        self
6576    }
6577    /// Sets `gt`.
6578    pub fn gt(mut self, value: f64) -> Self {
6579        self.gt = ::core::option::Option::Some(value.into());
6580        self
6581    }
6582    /// Sets `gte`.
6583    pub fn gte(mut self, value: f64) -> Self {
6584        self.gte = ::core::option::Option::Some(value.into());
6585        self
6586    }
6587    /// Sets `lt`.
6588    pub fn lt(mut self, value: f64) -> Self {
6589        self.lt = ::core::option::Option::Some(value.into());
6590        self
6591    }
6592    /// Sets `lte`.
6593    pub fn lte(mut self, value: f64) -> Self {
6594        self.lte = ::core::option::Option::Some(value.into());
6595        self
6596    }
6597}
6598
6599#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
6600#[serde(
6601    try_from = "NumericDecayFunctionRepr",
6602    into = "NumericDecayFunctionRepr"
6603)]
6604#[non_exhaustive]
6605pub struct NumericDecayFunction {
6606    /// Determines how the distance is calculated when a field used for computing the decay contains multiple values.
6607    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
6608    pub multi_value_mode: ::core::option::Option<crate::query_dsl::MultiValueMode>,
6609    /// The name of the property that holds `placement`.
6610    pub field: crate::Field,
6611    /// The value under `field`.
6612    pub placement: crate::query_dsl::DecayPlacement<f64, f64>,
6613}
6614
6615impl NumericDecayFunction {
6616    /// A `NumericDecayFunction` with its required properties set.
6617    pub fn new(
6618        field: impl ::core::convert::Into<crate::Field>,
6619        placement: impl ::core::convert::Into<crate::query_dsl::DecayPlacement<f64, f64>>,
6620    ) -> Self {
6621        Self {
6622            multi_value_mode: ::core::option::Option::None,
6623            field: field.into(),
6624            placement: placement.into(),
6625        }
6626    }
6627}
6628
6629impl NumericDecayFunction {
6630    /// Sets `multi_value_mode`.
6631    pub fn multi_value_mode(
6632        mut self,
6633        value: impl ::core::convert::Into<crate::query_dsl::MultiValueMode>,
6634    ) -> Self {
6635        self.multi_value_mode = ::core::option::Option::Some(value.into());
6636        self
6637    }
6638}
6639
6640#[derive(::serde::Serialize, ::serde::Deserialize)]
6641struct NumericDecayFunctionRepr {
6642    /// Determines how the distance is calculated when a field used for computing the decay contains multiple values.
6643    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
6644    multi_value_mode: ::core::option::Option<crate::query_dsl::MultiValueMode>,
6645    #[serde(flatten)]
6646    keyed__: ::indexmap::IndexMap<crate::Field, crate::query_dsl::DecayPlacement<f64, f64>>,
6647}
6648
6649impl ::core::convert::TryFrom<NumericDecayFunctionRepr> for NumericDecayFunction {
6650    type Error = ::std::string::String;
6651    fn try_from(repr: NumericDecayFunctionRepr) -> ::core::result::Result<Self, Self::Error> {
6652        let mut keyed = repr.keyed__.into_iter();
6653        match (keyed.next(), keyed.next()) {
6654            (::core::option::Option::Some((field, placement)), ::core::option::Option::None) => {
6655                ::core::result::Result::Ok(Self {
6656                    multi_value_mode: repr.multi_value_mode,
6657                    field,
6658                    placement,
6659                })
6660            }
6661            _ => ::core::result::Result::Err(::std::string::String::from(
6662                "NumericDecayFunction needs exactly one property keyed by its field",
6663            )),
6664        }
6665    }
6666}
6667
6668impl ::core::convert::From<NumericDecayFunction> for NumericDecayFunctionRepr {
6669    fn from(value: NumericDecayFunction) -> Self {
6670        let mut keyed__ = ::indexmap::IndexMap::new();
6671        keyed__.insert(value.field, value.placement);
6672        Self {
6673            multi_value_mode: value.multi_value_mode,
6674            keyed__,
6675        }
6676    }
6677}
6678
6679#[derive(Clone, Debug, PartialEq, Eq, Hash)]
6680#[non_exhaustive]
6681pub enum Operator {
6682    /// `and`
6683    And,
6684    /// `or`
6685    Or,
6686    /// A value this version of the specification doesn't list.
6687    Raw(::std::string::String),
6688}
6689
6690impl Operator {
6691    /// The value as Elasticsearch writes it.
6692    pub fn as_str(&self) -> &str {
6693        match self {
6694            Self::And => "and",
6695            Self::Or => "or",
6696            Self::Raw(value) => value,
6697        }
6698    }
6699
6700    /// The listed value with this name, if there is one.
6701    pub fn from_known(value: &str) -> ::core::option::Option<Self> {
6702        match value {
6703            "and" | "AND" => ::core::option::Option::Some(Self::And),
6704            "or" | "OR" => ::core::option::Option::Some(Self::Or),
6705            _ => ::core::option::Option::None,
6706        }
6707    }
6708}
6709
6710impl ::serde::Serialize for Operator {
6711    fn serialize<S__: ::serde::Serializer>(
6712        &self,
6713        serializer: S__,
6714    ) -> ::core::result::Result<S__::Ok, S__::Error> {
6715        serializer.serialize_str(self.as_str())
6716    }
6717}
6718
6719impl<'de> ::serde::Deserialize<'de> for Operator {
6720    fn deserialize<D__: ::serde::Deserializer<'de>>(
6721        deserializer: D__,
6722    ) -> ::core::result::Result<Self, D__::Error> {
6723        ::oxsearch_core::__private::deserialize_string_enum(deserializer, "Operator", |value| {
6724            Self::from_known(value).unwrap_or_else(|| Self::Raw(value.to_owned()))
6725        })
6726    }
6727}
6728
6729#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
6730#[non_exhaustive]
6731pub struct ParentIdQuery {
6732    /// Floating point number used to decrease or increase the relevance scores of the query.
6733    /// Boost values are relative to the default value of 1.0.
6734    /// A boost value between 0 and 1.0 decreases the relevance score.
6735    /// A value greater than 1.0 increases the relevance score.
6736    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
6737    pub boost: ::core::option::Option<f32>,
6738    #[serde(
6739        rename = "_name",
6740        skip_serializing_if = "::core::option::Option::is_none"
6741    )]
6742    pub name: ::core::option::Option<::std::string::String>,
6743    /// ID of the parent document.
6744    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
6745    pub id: ::core::option::Option<crate::Id>,
6746    /// Indicates whether to ignore an unmapped `type` and not return any documents instead of an error.
6747    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
6748    pub ignore_unmapped: ::core::option::Option<bool>,
6749    /// Name of the child relationship mapped for the `join` field.
6750    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
6751    pub r#type: ::core::option::Option<crate::RelationName>,
6752}
6753
6754impl ParentIdQuery {
6755    /// A `ParentIdQuery` with its required properties set.
6756    pub fn new() -> Self {
6757        Self {
6758            boost: ::core::option::Option::None,
6759            name: ::core::option::Option::None,
6760            id: ::core::option::Option::None,
6761            ignore_unmapped: ::core::option::Option::None,
6762            r#type: ::core::option::Option::None,
6763        }
6764    }
6765}
6766
6767impl ParentIdQuery {
6768    /// Sets `boost`.
6769    pub fn boost(mut self, value: f32) -> Self {
6770        self.boost = ::core::option::Option::Some(value.into());
6771        self
6772    }
6773    /// Sets `name`.
6774    pub fn name(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
6775        self.name = ::core::option::Option::Some(value.into());
6776        self
6777    }
6778    /// Sets `id`.
6779    pub fn id(mut self, value: impl ::core::convert::Into<crate::Id>) -> Self {
6780        self.id = ::core::option::Option::Some(value.into());
6781        self
6782    }
6783    /// Sets `ignore_unmapped`.
6784    pub fn ignore_unmapped(mut self, value: bool) -> Self {
6785        self.ignore_unmapped = ::core::option::Option::Some(value.into());
6786        self
6787    }
6788    /// Sets `type`.
6789    pub fn r#type(mut self, value: impl ::core::convert::Into<crate::RelationName>) -> Self {
6790        self.r#type = ::core::option::Option::Some(value.into());
6791        self
6792    }
6793}
6794
6795#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
6796#[non_exhaustive]
6797pub struct PercolateQuery {
6798    /// Floating point number used to decrease or increase the relevance scores of the query.
6799    /// Boost values are relative to the default value of 1.0.
6800    /// A boost value between 0 and 1.0 decreases the relevance score.
6801    /// A value greater than 1.0 increases the relevance score.
6802    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
6803    pub boost: ::core::option::Option<f32>,
6804    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
6805    pub _name: ::core::option::Option<::std::string::String>,
6806    /// The source of the document being percolated.
6807    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
6808    pub document: ::core::option::Option<::serde_json::Value>,
6809    /// An array of sources of the documents being percolated.
6810    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
6811    pub documents: ::core::option::Option<::std::vec::Vec<::serde_json::Value>>,
6812    /// Field that holds the indexed queries. The field must use the `percolator` mapping type.
6813    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
6814    pub field: ::core::option::Option<crate::Field>,
6815    /// The ID of a stored document to percolate.
6816    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
6817    pub id: ::core::option::Option<crate::Id>,
6818    /// The index of a stored document to percolate.
6819    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
6820    pub index: ::core::option::Option<crate::IndexName>,
6821    /// The suffix used for the `_percolator_document_slot` field when multiple `percolate` queries are specified.
6822    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
6823    pub name: ::core::option::Option<::std::string::String>,
6824    /// Preference used to fetch document to percolate.
6825    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
6826    pub preference: ::core::option::Option<::std::string::String>,
6827    /// Routing used to fetch document to percolate.
6828    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
6829    pub routing: ::core::option::Option<::std::string::String>,
6830    /// The expected version of a stored document to percolate.
6831    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
6832    pub version: ::core::option::Option<crate::VersionNumber>,
6833}
6834
6835impl PercolateQuery {
6836    /// A `PercolateQuery` with its required properties set.
6837    pub fn new(field: impl ::core::convert::Into<crate::Field>) -> Self {
6838        Self {
6839            boost: ::core::option::Option::None,
6840            _name: ::core::option::Option::None,
6841            document: ::core::option::Option::None,
6842            documents: ::core::option::Option::None,
6843            field: ::core::option::Option::Some(field.into()),
6844            id: ::core::option::Option::None,
6845            index: ::core::option::Option::None,
6846            name: ::core::option::Option::None,
6847            preference: ::core::option::Option::None,
6848            routing: ::core::option::Option::None,
6849            version: ::core::option::Option::None,
6850        }
6851    }
6852}
6853
6854impl PercolateQuery {
6855    /// Sets `boost`.
6856    pub fn boost(mut self, value: f32) -> Self {
6857        self.boost = ::core::option::Option::Some(value.into());
6858        self
6859    }
6860    /// Sets `_name`.
6861    pub fn _name(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
6862        self._name = ::core::option::Option::Some(value.into());
6863        self
6864    }
6865    /// Sets `document`.
6866    pub fn document(mut self, value: impl ::core::convert::Into<::serde_json::Value>) -> Self {
6867        self.document = ::core::option::Option::Some(value.into());
6868        self
6869    }
6870    /// Sets `documents`.
6871    pub fn documents(
6872        mut self,
6873        value: impl ::core::convert::Into<::std::vec::Vec<::serde_json::Value>>,
6874    ) -> Self {
6875        self.documents = ::core::option::Option::Some(value.into());
6876        self
6877    }
6878    /// Sets `id`.
6879    pub fn id(mut self, value: impl ::core::convert::Into<crate::Id>) -> Self {
6880        self.id = ::core::option::Option::Some(value.into());
6881        self
6882    }
6883    /// Sets `index`.
6884    pub fn index(mut self, value: impl ::core::convert::Into<crate::IndexName>) -> Self {
6885        self.index = ::core::option::Option::Some(value.into());
6886        self
6887    }
6888    /// Sets `name`.
6889    pub fn name(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
6890        self.name = ::core::option::Option::Some(value.into());
6891        self
6892    }
6893    /// Sets `preference`.
6894    pub fn preference(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
6895        self.preference = ::core::option::Option::Some(value.into());
6896        self
6897    }
6898    /// Sets `routing`.
6899    pub fn routing(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
6900        self.routing = ::core::option::Option::Some(value.into());
6901        self
6902    }
6903    /// Sets `version`.
6904    pub fn version(mut self, value: impl ::core::convert::Into<crate::VersionNumber>) -> Self {
6905        self.version = ::core::option::Option::Some(value.into());
6906        self
6907    }
6908}
6909
6910#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
6911#[non_exhaustive]
6912pub struct PinnedDoc {
6913    /// The unique document ID.
6914    #[serde(
6915        rename = "_id",
6916        skip_serializing_if = "::core::option::Option::is_none"
6917    )]
6918    pub id: ::core::option::Option<crate::Id>,
6919    /// The index that contains the document.
6920    #[serde(
6921        rename = "_index",
6922        skip_serializing_if = "::core::option::Option::is_none"
6923    )]
6924    pub index: ::core::option::Option<crate::IndexName>,
6925}
6926
6927impl PinnedDoc {
6928    /// A `PinnedDoc` with its required properties set.
6929    pub fn new(id: impl ::core::convert::Into<crate::Id>) -> Self {
6930        Self {
6931            id: ::core::option::Option::Some(id.into()),
6932            index: ::core::option::Option::None,
6933        }
6934    }
6935}
6936
6937impl PinnedDoc {
6938    /// Sets `index`.
6939    pub fn index(mut self, value: impl ::core::convert::Into<crate::IndexName>) -> Self {
6940        self.index = ::core::option::Option::Some(value.into());
6941        self
6942    }
6943}
6944
6945/// The variants of [`PinnedQuery`].
6946#[derive(Clone, Debug, PartialEq)]
6947#[non_exhaustive]
6948pub enum PinnedQueryVariant {
6949    /// Document IDs listed in the order they are to appear in results.
6950    /// Required if `docs` is not specified.
6951    Ids(::std::vec::Vec<crate::Id>),
6952    /// Documents listed in the order they are to appear in results.
6953    /// Required if `ids` is not specified.
6954    Docs(::std::vec::Vec<crate::query_dsl::PinnedDoc>),
6955    /// Any variant, as JSON: an object with one property.
6956    Raw(::serde_json::Value),
6957}
6958
6959impl PinnedQueryVariant {
6960    /// Writes the variant as one entry of a map.
6961    pub fn serialize_entry<M__: ::serde::ser::SerializeMap>(
6962        &self,
6963        map: &mut M__,
6964    ) -> ::core::result::Result<(), M__::Error> {
6965        match self {
6966            Self::Ids(value) => map.serialize_entry("ids", value),
6967            Self::Docs(value) => map.serialize_entry("docs", value),
6968            Self::Raw(value) => match value {
6969                ::serde_json::Value::Object(entries) => {
6970                    for (key, value) in entries {
6971                        map.serialize_entry(key, value)?;
6972                    }
6973                    ::core::result::Result::Ok(())
6974                }
6975                _ => ::core::result::Result::Err(<M__::Error as ::serde::ser::Error>::custom(
6976                    "a raw variant must be an object",
6977                )),
6978            },
6979        }
6980    }
6981}
6982
6983impl ::serde::Serialize for PinnedQueryVariant {
6984    fn serialize<S__: ::serde::Serializer>(
6985        &self,
6986        serializer: S__,
6987    ) -> ::core::result::Result<S__::Ok, S__::Error> {
6988        match self {
6989            Self::Ids(value) => {
6990                ::oxsearch_core::__private::serialize_variant(serializer, "ids", value)
6991            }
6992            Self::Docs(value) => {
6993                ::oxsearch_core::__private::serialize_variant(serializer, "docs", value)
6994            }
6995            Self::Raw(value) => ::serde::Serialize::serialize(value, serializer),
6996        }
6997    }
6998}
6999
7000impl<'de> ::serde::Deserialize<'de> for PinnedQueryVariant {
7001    fn deserialize<D__: ::serde::Deserializer<'de>>(
7002        deserializer: D__,
7003    ) -> ::core::result::Result<Self, D__::Error> {
7004        ::oxsearch_core::__private::deserialize_container(deserializer)
7005    }
7006}
7007
7008impl<'de> ::oxsearch_core::__private::Container<'de> for PinnedQueryVariant {
7009    const NAME: &'static str = "PinnedQueryVariant";
7010    fn variant<A__: ::serde::de::MapAccess<'de>>(
7011        key: &str,
7012        map: &mut A__,
7013    ) -> ::core::result::Result<Self, A__::Error> {
7014        ::core::result::Result::Ok(match key {
7015            "ids" => Self::Ids(map.next_value()?),
7016            "docs" => Self::Docs(map.next_value()?),
7017            _ => Self::Raw(::oxsearch_core::__private::raw_variant(
7018                key,
7019                map.next_value()?,
7020            )),
7021        })
7022    }
7023}
7024
7025impl ::core::convert::From<::std::vec::Vec<crate::Id>> for PinnedQueryVariant {
7026    fn from(value: ::std::vec::Vec<crate::Id>) -> Self {
7027        Self::Ids(value)
7028    }
7029}
7030
7031impl ::core::convert::From<::std::vec::Vec<crate::query_dsl::PinnedDoc>> for PinnedQueryVariant {
7032    fn from(value: ::std::vec::Vec<crate::query_dsl::PinnedDoc>) -> Self {
7033        Self::Docs(value)
7034    }
7035}
7036
7037#[derive(Clone, Debug, PartialEq)]
7038#[non_exhaustive]
7039pub struct PinnedQuery {
7040    /// Floating point number used to decrease or increase the relevance scores of the query.
7041    /// Boost values are relative to the default value of 1.0.
7042    /// A boost value between 0 and 1.0 decreases the relevance score.
7043    /// A value greater than 1.0 increases the relevance score.
7044    pub boost: ::core::option::Option<f32>,
7045    pub name: ::core::option::Option<::std::string::String>,
7046    /// Any choice of query used to rank documents which will be ranked below the "pinned" documents.
7047    pub organic: ::core::option::Option<crate::query_dsl::QueryContainer>,
7048    /// The variant.
7049    pub variant: ::core::option::Option<crate::query_dsl::PinnedQueryVariant>,
7050}
7051
7052impl PinnedQuery {
7053    /// A `PinnedQuery` with its required properties set.
7054    pub fn new(organic: impl ::core::convert::Into<crate::query_dsl::QueryContainer>) -> Self {
7055        Self {
7056            boost: ::core::option::Option::None,
7057            name: ::core::option::Option::None,
7058            organic: ::core::option::Option::Some(organic.into()),
7059            variant: ::core::option::Option::None,
7060        }
7061    }
7062}
7063
7064impl PinnedQuery {
7065    /// Sets `boost`.
7066    pub fn boost(mut self, value: f32) -> Self {
7067        self.boost = ::core::option::Option::Some(value.into());
7068        self
7069    }
7070    /// Sets `name`.
7071    pub fn name(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
7072        self.name = ::core::option::Option::Some(value.into());
7073        self
7074    }
7075    /// Sets `variant`.
7076    pub fn variant(
7077        mut self,
7078        value: impl ::core::convert::Into<crate::query_dsl::PinnedQueryVariant>,
7079    ) -> Self {
7080        self.variant = ::core::option::Option::Some(value.into());
7081        self
7082    }
7083}
7084
7085impl ::serde::Serialize for PinnedQuery {
7086    fn serialize<S__: ::serde::Serializer>(
7087        &self,
7088        serializer: S__,
7089    ) -> ::core::result::Result<S__::Ok, S__::Error> {
7090        use ::serde::ser::SerializeMap as _;
7091        let mut map = serializer.serialize_map(::core::option::Option::None)?;
7092        if let ::core::option::Option::Some(value) = &self.boost {
7093            map.serialize_entry("boost", value)?;
7094        }
7095        if let ::core::option::Option::Some(value) = &self.name {
7096            map.serialize_entry("_name", value)?;
7097        }
7098        if let ::core::option::Option::Some(value) = &self.organic {
7099            map.serialize_entry("organic", value)?;
7100        }
7101        if let ::core::option::Option::Some(variant) = &self.variant {
7102            variant.serialize_entry(&mut map)?;
7103        }
7104        map.end()
7105    }
7106}
7107
7108impl<'de> ::serde::Deserialize<'de> for PinnedQuery {
7109    fn deserialize<D__: ::serde::Deserializer<'de>>(
7110        deserializer: D__,
7111    ) -> ::core::result::Result<Self, D__::Error> {
7112        struct Fields;
7113        impl<'de> ::serde::de::Visitor<'de> for Fields {
7114            type Value = PinnedQuery;
7115            fn expecting(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
7116                f.write_str("a PinnedQuery object")
7117            }
7118            fn visit_map<A__: ::serde::de::MapAccess<'de>>(
7119                self,
7120                mut map: A__,
7121            ) -> ::core::result::Result<PinnedQuery, A__::Error> {
7122                let mut boost = ::core::option::Option::None;
7123                let mut name = ::core::option::Option::None;
7124                let mut organic = ::core::option::Option::None;
7125                let mut variant__ = ::core::option::Option::None;
7126                while let ::core::option::Option::Some(key) =
7127                    map.next_key::<::std::string::String>()?
7128                {
7129                    match key.as_str() {
7130                        "boost" => boost = ::core::option::Option::Some(map.next_value()?),
7131                        "_name" => name = ::core::option::Option::Some(map.next_value()?),
7132                        "organic" => organic = ::core::option::Option::Some(map.next_value()?),
7133                        _ => {
7134                            if variant__.is_some() {
7135                                return ::core::result::Result::Err(
7136                                    ::oxsearch_core::__private::two_variants("PinnedQuery", &key),
7137                                );
7138                            }
7139                            variant__ = ::core::option::Option::Some(
7140                                <PinnedQueryVariant as ::oxsearch_core::__private::Container<
7141                                    'de,
7142                                >>::variant(&key, &mut map)?,
7143                            );
7144                        }
7145                    }
7146                }
7147                ::core::result::Result::Ok(PinnedQuery {
7148                    boost,
7149                    name,
7150                    organic,
7151                    variant: variant__,
7152                })
7153            }
7154        }
7155        deserializer.deserialize_map(Fields)
7156    }
7157}
7158
7159#[derive(Clone, Debug, PartialEq)]
7160#[non_exhaustive]
7161pub struct PrefixQuery {
7162    /// Floating point number used to decrease or increase the relevance scores of the query.
7163    /// Boost values are relative to the default value of 1.0.
7164    /// A boost value between 0 and 1.0 decreases the relevance score.
7165    /// A value greater than 1.0 increases the relevance score.
7166    pub boost: ::core::option::Option<f32>,
7167    pub name: ::core::option::Option<::std::string::String>,
7168    /// Method used to rewrite the query.
7169    pub rewrite: ::core::option::Option<crate::MultiTermQueryRewrite>,
7170    /// Beginning characters of terms you wish to find in the provided field.
7171    pub value: ::core::option::Option<::std::string::String>,
7172    /// Allows ASCII case insensitive matching of the value with the indexed field values when set to `true`.
7173    /// Default is `false` which means the case sensitivity of matching depends on the underlying field’s mapping.
7174    pub case_insensitive: ::core::option::Option<bool>,
7175}
7176
7177impl PrefixQuery {
7178    /// A `PrefixQuery` with its required properties set.
7179    pub fn new(value: impl ::core::convert::Into<::std::string::String>) -> Self {
7180        Self {
7181            boost: ::core::option::Option::None,
7182            name: ::core::option::Option::None,
7183            rewrite: ::core::option::Option::None,
7184            value: ::core::option::Option::Some(value.into()),
7185            case_insensitive: ::core::option::Option::None,
7186        }
7187    }
7188}
7189
7190impl PrefixQuery {
7191    /// Sets `boost`.
7192    pub fn boost(mut self, value: f32) -> Self {
7193        self.boost = ::core::option::Option::Some(value.into());
7194        self
7195    }
7196    /// Sets `name`.
7197    pub fn name(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
7198        self.name = ::core::option::Option::Some(value.into());
7199        self
7200    }
7201    /// Sets `rewrite`.
7202    pub fn rewrite(
7203        mut self,
7204        value: impl ::core::convert::Into<crate::MultiTermQueryRewrite>,
7205    ) -> Self {
7206        self.rewrite = ::core::option::Option::Some(value.into());
7207        self
7208    }
7209    /// Sets `case_insensitive`.
7210    pub fn case_insensitive(mut self, value: bool) -> Self {
7211        self.case_insensitive = ::core::option::Option::Some(value.into());
7212        self
7213    }
7214}
7215
7216#[derive(::serde::Serialize, ::serde::Deserialize)]
7217#[serde(remote = "PrefixQuery")]
7218struct PrefixQueryDef {
7219    /// Floating point number used to decrease or increase the relevance scores of the query.
7220    /// Boost values are relative to the default value of 1.0.
7221    /// A boost value between 0 and 1.0 decreases the relevance score.
7222    /// A value greater than 1.0 increases the relevance score.
7223    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
7224    boost: ::core::option::Option<f32>,
7225    #[serde(
7226        rename = "_name",
7227        skip_serializing_if = "::core::option::Option::is_none"
7228    )]
7229    name: ::core::option::Option<::std::string::String>,
7230    /// Method used to rewrite the query.
7231    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
7232    rewrite: ::core::option::Option<crate::MultiTermQueryRewrite>,
7233    /// Beginning characters of terms you wish to find in the provided field.
7234    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
7235    value: ::core::option::Option<::std::string::String>,
7236    /// Allows ASCII case insensitive matching of the value with the indexed field values when set to `true`.
7237    /// Default is `false` which means the case sensitivity of matching depends on the underlying field’s mapping.
7238    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
7239    case_insensitive: ::core::option::Option<bool>,
7240}
7241
7242impl ::serde::Serialize for PrefixQuery {
7243    fn serialize<S__: ::serde::Serializer>(
7244        &self,
7245        serializer: S__,
7246    ) -> ::core::result::Result<S__::Ok, S__::Error> {
7247        if let (::core::option::Option::Some(short), true) = (
7248            &self.value,
7249            self.boost.is_none()
7250                && self.name.is_none()
7251                && self.rewrite.is_none()
7252                && self.case_insensitive.is_none(),
7253        ) {
7254            return ::serde::Serialize::serialize(short, serializer);
7255        }
7256        PrefixQueryDef::serialize(self, serializer)
7257    }
7258}
7259
7260impl<'de> ::oxsearch_core::__private::Shorthand<'de> for PrefixQuery {
7261    type Short = ::std::string::String;
7262    fn from_short(short: ::std::string::String) -> Self {
7263        Self {
7264            boost: ::core::option::Option::None,
7265            name: ::core::option::Option::None,
7266            rewrite: ::core::option::Option::None,
7267            value: ::core::option::Option::Some(short),
7268            case_insensitive: ::core::option::Option::None,
7269        }
7270    }
7271    fn deserialize_full<D__: ::serde::Deserializer<'de>>(
7272        deserializer: D__,
7273    ) -> ::core::result::Result<Self, D__::Error> {
7274        PrefixQueryDef::deserialize(deserializer)
7275    }
7276}
7277
7278impl<'de> ::serde::Deserialize<'de> for PrefixQuery {
7279    fn deserialize<D__: ::serde::Deserializer<'de>>(
7280        deserializer: D__,
7281    ) -> ::core::result::Result<Self, D__::Error> {
7282        ::oxsearch_core::__private::deserialize_shorthand(deserializer)
7283    }
7284}
7285
7286#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
7287#[non_exhaustive]
7288pub struct QueryBase {
7289    /// Floating point number used to decrease or increase the relevance scores of the query.
7290    /// Boost values are relative to the default value of 1.0.
7291    /// A boost value between 0 and 1.0 decreases the relevance score.
7292    /// A value greater than 1.0 increases the relevance score.
7293    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
7294    pub boost: ::core::option::Option<f32>,
7295    #[serde(
7296        rename = "_name",
7297        skip_serializing_if = "::core::option::Option::is_none"
7298    )]
7299    pub name: ::core::option::Option<::std::string::String>,
7300}
7301
7302impl QueryBase {
7303    /// A `QueryBase` with its required properties set.
7304    pub fn new() -> Self {
7305        Self {
7306            boost: ::core::option::Option::None,
7307            name: ::core::option::Option::None,
7308        }
7309    }
7310}
7311
7312impl QueryBase {
7313    /// Sets `boost`.
7314    pub fn boost(mut self, value: f32) -> Self {
7315        self.boost = ::core::option::Option::Some(value.into());
7316        self
7317    }
7318    /// Sets `name`.
7319    pub fn name(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
7320        self.name = ::core::option::Option::Some(value.into());
7321        self
7322    }
7323}
7324
7325/// An Elasticsearch Query DSL (Domain Specific Language) object that defines a query.
7326#[derive(Clone, Debug, PartialEq)]
7327#[non_exhaustive]
7328pub enum QueryContainer {
7329    /// matches documents matching boolean combinations of other queries.
7330    Bool(::std::boxed::Box<crate::query_dsl::BoolQuery>),
7331    /// Returns documents matching a `positive` query while reducing the relevance score of documents that also match a `negative` query.
7332    Boosting(::std::boxed::Box<crate::query_dsl::BoostingQuery>),
7333    Common(::oxsearch_core::shapes::SingleKey<crate::Field, crate::query_dsl::CommonTermsQuery>),
7334    /// The `combined_fields` query supports searching multiple text fields as if their contents had been indexed into one combined field.
7335    CombinedFields(crate::query_dsl::CombinedFieldsQuery),
7336    /// Wraps a filter query and returns every matching document with a relevance score equal to the `boost` parameter value.
7337    ConstantScore(::std::boxed::Box<crate::query_dsl::ConstantScoreQuery>),
7338    /// Returns documents matching one or more wrapped queries, called query clauses or clauses.
7339    /// If a returned document matches multiple query clauses, the `dis_max` query assigns the document the highest relevance score from any matching clause, plus a tie breaking increment for any additional matching subqueries.
7340    DisMax(crate::query_dsl::DisMaxQuery),
7341    /// Boosts the relevance score of documents closer to a provided origin date or point.
7342    /// For example, you can use this query to give more weight to documents closer to a certain date or location.
7343    DistanceFeature(crate::query_dsl::DistanceFeatureQuery),
7344    /// Returns documents that contain an indexed value for a field.
7345    Exists(crate::query_dsl::ExistsQuery),
7346    /// The `function_score` enables you to modify the score of documents that are retrieved by a query.
7347    FunctionScore(::std::boxed::Box<crate::query_dsl::FunctionScoreQuery>),
7348    /// Returns documents that contain terms similar to the search term, as measured by a Levenshtein edit distance.
7349    Fuzzy(::oxsearch_core::shapes::SingleKey<crate::Field, crate::query_dsl::FuzzyQuery>),
7350    /// Matches geo_point and geo_shape values that intersect a bounding box.
7351    GeoBoundingBox(crate::query_dsl::GeoBoundingBoxQuery),
7352    /// Matches `geo_point` and `geo_shape` values within a given distance of a geopoint.
7353    GeoDistance(crate::query_dsl::GeoDistanceQuery),
7354    /// Matches `geo_point` and `geo_shape` values that intersect a grid cell from a GeoGrid aggregation.
7355    GeoGrid(::oxsearch_core::shapes::SingleKey<crate::Field, crate::query_dsl::GeoGridQuery>),
7356    GeoPolygon(crate::query_dsl::GeoPolygonQuery),
7357    /// Filter documents indexed using either the `geo_shape` or the `geo_point` type.
7358    GeoShape(crate::query_dsl::GeoShapeQuery),
7359    /// Returns parent documents whose joined child documents match a provided query.
7360    HasChild(::std::boxed::Box<crate::query_dsl::HasChildQuery>),
7361    /// Returns child documents whose joined parent document matches a provided query.
7362    HasParent(::std::boxed::Box<crate::query_dsl::HasParentQuery>),
7363    /// Returns documents based on their IDs.
7364    /// This query uses document IDs stored in the `_id` field.
7365    Ids(crate::query_dsl::IdsQuery),
7366    /// Returns documents based on the order and proximity of matching terms.
7367    Intervals(::oxsearch_core::shapes::SingleKey<crate::Field, crate::query_dsl::IntervalsQuery>),
7368    /// Finds the k nearest vectors to a query vector, as measured by a similarity
7369    /// metric. knn query finds nearest vectors through approximate search on indexed
7370    /// dense_vectors.
7371    Knn(::std::boxed::Box<crate::KnnQuery>),
7372    /// Returns documents matching a provided Kibana Query Language (KQL) expression.
7373    /// The expression is parsed and rewritten into standard Query DSL.
7374    Kql(crate::query_dsl::KqlQuery),
7375    /// Returns documents that match a provided text, number, date or boolean value.
7376    /// The provided text is analyzed before matching.
7377    Match(::oxsearch_core::shapes::SingleKey<crate::Field, crate::query_dsl::MatchQuery>),
7378    /// Matches all documents, giving them all a `_score` of 1.0.
7379    MatchAll(crate::query_dsl::MatchAllQuery),
7380    /// Analyzes its input and constructs a `bool` query from the terms.
7381    /// Each term except the last is used in a `term` query.
7382    /// The last term is used in a prefix query.
7383    MatchBoolPrefix(
7384        ::oxsearch_core::shapes::SingleKey<crate::Field, crate::query_dsl::MatchBoolPrefixQuery>,
7385    ),
7386    /// Matches no documents.
7387    MatchNone(crate::query_dsl::MatchNoneQuery),
7388    /// Analyzes the text and creates a phrase query out of the analyzed text.
7389    MatchPhrase(
7390        ::oxsearch_core::shapes::SingleKey<crate::Field, crate::query_dsl::MatchPhraseQuery>,
7391    ),
7392    /// Returns documents that contain the words of a provided text, in the same order as provided.
7393    /// The last term of the provided text is treated as a prefix, matching any words that begin with that term.
7394    MatchPhrasePrefix(
7395        ::oxsearch_core::shapes::SingleKey<crate::Field, crate::query_dsl::MatchPhrasePrefixQuery>,
7396    ),
7397    /// Returns documents that are "like" a given set of documents.
7398    MoreLikeThis(crate::query_dsl::MoreLikeThisQuery),
7399    /// Enables you to search for a provided text, number, date or boolean value across multiple fields.
7400    /// The provided text is analyzed before matching.
7401    MultiMatch(crate::query_dsl::MultiMatchQuery),
7402    /// Wraps another query to search nested fields.
7403    /// If an object matches the search, the nested query returns the root parent document.
7404    Nested(::std::boxed::Box<crate::query_dsl::NestedQuery>),
7405    /// Returns child documents joined to a specific parent document.
7406    ParentId(crate::query_dsl::ParentIdQuery),
7407    /// Matches queries stored in an index.
7408    Percolate(crate::query_dsl::PercolateQuery),
7409    /// Promotes selected documents to rank higher than those matching a given query.
7410    Pinned(::std::boxed::Box<crate::query_dsl::PinnedQuery>),
7411    /// Returns documents that contain a specific prefix in a provided field.
7412    Prefix(::oxsearch_core::shapes::SingleKey<crate::Field, crate::query_dsl::PrefixQuery>),
7413    /// Returns documents based on a provided query string, using a parser with a strict syntax.
7414    QueryString(crate::query_dsl::QueryStringQuery),
7415    /// Returns documents that contain terms within a provided range.
7416    Range(::oxsearch_core::shapes::SingleKey<crate::Field, crate::query_dsl::RangeQuery>),
7417    /// Boosts the relevance score of documents based on the numeric value of a `rank_feature` or `rank_features` field.
7418    RankFeature(crate::query_dsl::RankFeatureQuery),
7419    /// Returns documents that contain terms matching a regular expression.
7420    Regexp(::oxsearch_core::shapes::SingleKey<crate::Field, crate::query_dsl::RegexpQuery>),
7421    Rule(::std::boxed::Box<crate::query_dsl::RuleQuery>),
7422    /// Filters documents based on a provided script.
7423    /// The script query is typically used in a filter context.
7424    Script(crate::query_dsl::ScriptQuery),
7425    /// Uses a script to provide a custom score for returned documents.
7426    ScriptScore(::std::boxed::Box<crate::query_dsl::ScriptScoreQuery>),
7427    /// A semantic query to semantic_text field types
7428    Semantic(crate::query_dsl::SemanticQuery),
7429    /// Queries documents that contain fields indexed using the `shape` type.
7430    Shape(crate::query_dsl::ShapeQuery),
7431    /// Returns documents based on a provided query string, using a parser with a limited but fault-tolerant syntax.
7432    SimpleQueryString(crate::query_dsl::SimpleQueryStringQuery),
7433    /// Returns matches which enclose another span query.
7434    SpanContaining(::std::boxed::Box<crate::query_dsl::SpanContainingQuery>),
7435    /// Wrapper to allow span queries to participate in composite single-field span queries by _lying_ about their search field.
7436    SpanFieldMasking(::std::boxed::Box<crate::query_dsl::SpanFieldMaskingQuery>),
7437    /// Matches spans near the beginning of a field.
7438    SpanFirst(::std::boxed::Box<crate::query_dsl::SpanFirstQuery>),
7439    /// Allows you to wrap a multi term query (one of `wildcard`, `fuzzy`, `prefix`, `range`, or `regexp` query) as a `span` query, so it can be nested.
7440    SpanMulti(::std::boxed::Box<crate::query_dsl::SpanMultiTermQuery>),
7441    /// Matches spans which are near one another.
7442    /// You can specify `slop`, the maximum number of intervening unmatched positions, as well as whether matches are required to be in-order.
7443    SpanNear(crate::query_dsl::SpanNearQuery),
7444    /// Removes matches which overlap with another span query or which are within x tokens before (controlled by the parameter `pre`) or y tokens after (controlled by the parameter `post`) another span query.
7445    SpanNot(::std::boxed::Box<crate::query_dsl::SpanNotQuery>),
7446    /// Matches the union of its span clauses.
7447    SpanOr(crate::query_dsl::SpanOrQuery),
7448    /// Matches spans containing a term.
7449    SpanTerm(::oxsearch_core::shapes::SingleKey<crate::Field, crate::query_dsl::SpanTermQuery>),
7450    /// Returns matches which are enclosed inside another span query.
7451    SpanWithin(::std::boxed::Box<crate::query_dsl::SpanWithinQuery>),
7452    /// Using input query vectors or a natural language processing model to convert a query into a list of token-weight pairs, queries against a sparse vector field.
7453    SparseVector(crate::query_dsl::SparseVectorQuery),
7454    /// Returns documents that contain an exact term in a provided field.
7455    /// To return a document, the query term must exactly match the queried field's value, including whitespace and capitalization.
7456    Term(::oxsearch_core::shapes::SingleKey<crate::Field, crate::query_dsl::TermQuery>),
7457    /// Returns documents that contain one or more exact terms in a provided field.
7458    /// To return a document, one or more terms must exactly match a field value, including whitespace and capitalization.
7459    Terms(crate::query_dsl::TermsQuery),
7460    /// Returns documents that contain a minimum number of exact terms in a provided field.
7461    /// To return a document, a required number of terms must exactly match the field values, including whitespace and capitalization.
7462    TermsSet(::oxsearch_core::shapes::SingleKey<crate::Field, crate::query_dsl::TermsSetQuery>),
7463    /// Uses a natural language processing model to convert the query text into a list of token-weight pairs which are then used in a query against a sparse vector or rank features field.
7464    TextExpansion(
7465        ::oxsearch_core::shapes::SingleKey<crate::Field, crate::query_dsl::TextExpansionQuery>,
7466    ),
7467    /// Supports returning text_expansion query results by sending in precomputed tokens with the query.
7468    WeightedTokens(
7469        ::oxsearch_core::shapes::SingleKey<crate::Field, crate::query_dsl::WeightedTokensQuery>,
7470    ),
7471    /// Returns documents that contain terms matching a wildcard pattern.
7472    Wildcard(::oxsearch_core::shapes::SingleKey<crate::Field, crate::query_dsl::WildcardQuery>),
7473    /// A query that accepts any other query as base64 encoded string.
7474    Wrapper(crate::query_dsl::WrapperQuery),
7475    Type(crate::query_dsl::TypeQuery),
7476    /// Any variant, as JSON: an object with one property.
7477    Raw(::serde_json::Value),
7478}
7479
7480impl QueryContainer {
7481    /// Writes the variant as one entry of a map.
7482    pub fn serialize_entry<M__: ::serde::ser::SerializeMap>(
7483        &self,
7484        map: &mut M__,
7485    ) -> ::core::result::Result<(), M__::Error> {
7486        match self {
7487            Self::Bool(value) => map.serialize_entry("bool", value),
7488            Self::Boosting(value) => map.serialize_entry("boosting", value),
7489            Self::Common(value) => map.serialize_entry("common", value),
7490            Self::CombinedFields(value) => map.serialize_entry("combined_fields", value),
7491            Self::ConstantScore(value) => map.serialize_entry("constant_score", value),
7492            Self::DisMax(value) => map.serialize_entry("dis_max", value),
7493            Self::DistanceFeature(value) => map.serialize_entry("distance_feature", value),
7494            Self::Exists(value) => map.serialize_entry("exists", value),
7495            Self::FunctionScore(value) => map.serialize_entry("function_score", value),
7496            Self::Fuzzy(value) => map.serialize_entry("fuzzy", value),
7497            Self::GeoBoundingBox(value) => map.serialize_entry("geo_bounding_box", value),
7498            Self::GeoDistance(value) => map.serialize_entry("geo_distance", value),
7499            Self::GeoGrid(value) => map.serialize_entry("geo_grid", value),
7500            Self::GeoPolygon(value) => map.serialize_entry("geo_polygon", value),
7501            Self::GeoShape(value) => map.serialize_entry("geo_shape", value),
7502            Self::HasChild(value) => map.serialize_entry("has_child", value),
7503            Self::HasParent(value) => map.serialize_entry("has_parent", value),
7504            Self::Ids(value) => map.serialize_entry("ids", value),
7505            Self::Intervals(value) => map.serialize_entry("intervals", value),
7506            Self::Knn(value) => map.serialize_entry("knn", value),
7507            Self::Kql(value) => map.serialize_entry("kql", value),
7508            Self::Match(value) => map.serialize_entry("match", value),
7509            Self::MatchAll(value) => map.serialize_entry("match_all", value),
7510            Self::MatchBoolPrefix(value) => map.serialize_entry("match_bool_prefix", value),
7511            Self::MatchNone(value) => map.serialize_entry("match_none", value),
7512            Self::MatchPhrase(value) => map.serialize_entry("match_phrase", value),
7513            Self::MatchPhrasePrefix(value) => map.serialize_entry("match_phrase_prefix", value),
7514            Self::MoreLikeThis(value) => map.serialize_entry("more_like_this", value),
7515            Self::MultiMatch(value) => map.serialize_entry("multi_match", value),
7516            Self::Nested(value) => map.serialize_entry("nested", value),
7517            Self::ParentId(value) => map.serialize_entry("parent_id", value),
7518            Self::Percolate(value) => map.serialize_entry("percolate", value),
7519            Self::Pinned(value) => map.serialize_entry("pinned", value),
7520            Self::Prefix(value) => map.serialize_entry("prefix", value),
7521            Self::QueryString(value) => map.serialize_entry("query_string", value),
7522            Self::Range(value) => map.serialize_entry("range", value),
7523            Self::RankFeature(value) => map.serialize_entry("rank_feature", value),
7524            Self::Regexp(value) => map.serialize_entry("regexp", value),
7525            Self::Rule(value) => map.serialize_entry("rule", value),
7526            Self::Script(value) => map.serialize_entry("script", value),
7527            Self::ScriptScore(value) => map.serialize_entry("script_score", value),
7528            Self::Semantic(value) => map.serialize_entry("semantic", value),
7529            Self::Shape(value) => map.serialize_entry("shape", value),
7530            Self::SimpleQueryString(value) => map.serialize_entry("simple_query_string", value),
7531            Self::SpanContaining(value) => map.serialize_entry("span_containing", value),
7532            Self::SpanFieldMasking(value) => map.serialize_entry("span_field_masking", value),
7533            Self::SpanFirst(value) => map.serialize_entry("span_first", value),
7534            Self::SpanMulti(value) => map.serialize_entry("span_multi", value),
7535            Self::SpanNear(value) => map.serialize_entry("span_near", value),
7536            Self::SpanNot(value) => map.serialize_entry("span_not", value),
7537            Self::SpanOr(value) => map.serialize_entry("span_or", value),
7538            Self::SpanTerm(value) => map.serialize_entry("span_term", value),
7539            Self::SpanWithin(value) => map.serialize_entry("span_within", value),
7540            Self::SparseVector(value) => map.serialize_entry("sparse_vector", value),
7541            Self::Term(value) => map.serialize_entry("term", value),
7542            Self::Terms(value) => map.serialize_entry("terms", value),
7543            Self::TermsSet(value) => map.serialize_entry("terms_set", value),
7544            Self::TextExpansion(value) => map.serialize_entry("text_expansion", value),
7545            Self::WeightedTokens(value) => map.serialize_entry("weighted_tokens", value),
7546            Self::Wildcard(value) => map.serialize_entry("wildcard", value),
7547            Self::Wrapper(value) => map.serialize_entry("wrapper", value),
7548            Self::Type(value) => map.serialize_entry("type", value),
7549            Self::Raw(value) => match value {
7550                ::serde_json::Value::Object(entries) => {
7551                    for (key, value) in entries {
7552                        map.serialize_entry(key, value)?;
7553                    }
7554                    ::core::result::Result::Ok(())
7555                }
7556                _ => ::core::result::Result::Err(<M__::Error as ::serde::ser::Error>::custom(
7557                    "a raw variant must be an object",
7558                )),
7559            },
7560        }
7561    }
7562}
7563
7564impl ::serde::Serialize for QueryContainer {
7565    fn serialize<S__: ::serde::Serializer>(
7566        &self,
7567        serializer: S__,
7568    ) -> ::core::result::Result<S__::Ok, S__::Error> {
7569        match self {
7570            Self::Bool(value) => {
7571                ::oxsearch_core::__private::serialize_variant(serializer, "bool", value)
7572            }
7573            Self::Boosting(value) => {
7574                ::oxsearch_core::__private::serialize_variant(serializer, "boosting", value)
7575            }
7576            Self::Common(value) => {
7577                ::oxsearch_core::__private::serialize_variant(serializer, "common", value)
7578            }
7579            Self::CombinedFields(value) => {
7580                ::oxsearch_core::__private::serialize_variant(serializer, "combined_fields", value)
7581            }
7582            Self::ConstantScore(value) => {
7583                ::oxsearch_core::__private::serialize_variant(serializer, "constant_score", value)
7584            }
7585            Self::DisMax(value) => {
7586                ::oxsearch_core::__private::serialize_variant(serializer, "dis_max", value)
7587            }
7588            Self::DistanceFeature(value) => {
7589                ::oxsearch_core::__private::serialize_variant(serializer, "distance_feature", value)
7590            }
7591            Self::Exists(value) => {
7592                ::oxsearch_core::__private::serialize_variant(serializer, "exists", value)
7593            }
7594            Self::FunctionScore(value) => {
7595                ::oxsearch_core::__private::serialize_variant(serializer, "function_score", value)
7596            }
7597            Self::Fuzzy(value) => {
7598                ::oxsearch_core::__private::serialize_variant(serializer, "fuzzy", value)
7599            }
7600            Self::GeoBoundingBox(value) => {
7601                ::oxsearch_core::__private::serialize_variant(serializer, "geo_bounding_box", value)
7602            }
7603            Self::GeoDistance(value) => {
7604                ::oxsearch_core::__private::serialize_variant(serializer, "geo_distance", value)
7605            }
7606            Self::GeoGrid(value) => {
7607                ::oxsearch_core::__private::serialize_variant(serializer, "geo_grid", value)
7608            }
7609            Self::GeoPolygon(value) => {
7610                ::oxsearch_core::__private::serialize_variant(serializer, "geo_polygon", value)
7611            }
7612            Self::GeoShape(value) => {
7613                ::oxsearch_core::__private::serialize_variant(serializer, "geo_shape", value)
7614            }
7615            Self::HasChild(value) => {
7616                ::oxsearch_core::__private::serialize_variant(serializer, "has_child", value)
7617            }
7618            Self::HasParent(value) => {
7619                ::oxsearch_core::__private::serialize_variant(serializer, "has_parent", value)
7620            }
7621            Self::Ids(value) => {
7622                ::oxsearch_core::__private::serialize_variant(serializer, "ids", value)
7623            }
7624            Self::Intervals(value) => {
7625                ::oxsearch_core::__private::serialize_variant(serializer, "intervals", value)
7626            }
7627            Self::Knn(value) => {
7628                ::oxsearch_core::__private::serialize_variant(serializer, "knn", value)
7629            }
7630            Self::Kql(value) => {
7631                ::oxsearch_core::__private::serialize_variant(serializer, "kql", value)
7632            }
7633            Self::Match(value) => {
7634                ::oxsearch_core::__private::serialize_variant(serializer, "match", value)
7635            }
7636            Self::MatchAll(value) => {
7637                ::oxsearch_core::__private::serialize_variant(serializer, "match_all", value)
7638            }
7639            Self::MatchBoolPrefix(value) => ::oxsearch_core::__private::serialize_variant(
7640                serializer,
7641                "match_bool_prefix",
7642                value,
7643            ),
7644            Self::MatchNone(value) => {
7645                ::oxsearch_core::__private::serialize_variant(serializer, "match_none", value)
7646            }
7647            Self::MatchPhrase(value) => {
7648                ::oxsearch_core::__private::serialize_variant(serializer, "match_phrase", value)
7649            }
7650            Self::MatchPhrasePrefix(value) => ::oxsearch_core::__private::serialize_variant(
7651                serializer,
7652                "match_phrase_prefix",
7653                value,
7654            ),
7655            Self::MoreLikeThis(value) => {
7656                ::oxsearch_core::__private::serialize_variant(serializer, "more_like_this", value)
7657            }
7658            Self::MultiMatch(value) => {
7659                ::oxsearch_core::__private::serialize_variant(serializer, "multi_match", value)
7660            }
7661            Self::Nested(value) => {
7662                ::oxsearch_core::__private::serialize_variant(serializer, "nested", value)
7663            }
7664            Self::ParentId(value) => {
7665                ::oxsearch_core::__private::serialize_variant(serializer, "parent_id", value)
7666            }
7667            Self::Percolate(value) => {
7668                ::oxsearch_core::__private::serialize_variant(serializer, "percolate", value)
7669            }
7670            Self::Pinned(value) => {
7671                ::oxsearch_core::__private::serialize_variant(serializer, "pinned", value)
7672            }
7673            Self::Prefix(value) => {
7674                ::oxsearch_core::__private::serialize_variant(serializer, "prefix", value)
7675            }
7676            Self::QueryString(value) => {
7677                ::oxsearch_core::__private::serialize_variant(serializer, "query_string", value)
7678            }
7679            Self::Range(value) => {
7680                ::oxsearch_core::__private::serialize_variant(serializer, "range", value)
7681            }
7682            Self::RankFeature(value) => {
7683                ::oxsearch_core::__private::serialize_variant(serializer, "rank_feature", value)
7684            }
7685            Self::Regexp(value) => {
7686                ::oxsearch_core::__private::serialize_variant(serializer, "regexp", value)
7687            }
7688            Self::Rule(value) => {
7689                ::oxsearch_core::__private::serialize_variant(serializer, "rule", value)
7690            }
7691            Self::Script(value) => {
7692                ::oxsearch_core::__private::serialize_variant(serializer, "script", value)
7693            }
7694            Self::ScriptScore(value) => {
7695                ::oxsearch_core::__private::serialize_variant(serializer, "script_score", value)
7696            }
7697            Self::Semantic(value) => {
7698                ::oxsearch_core::__private::serialize_variant(serializer, "semantic", value)
7699            }
7700            Self::Shape(value) => {
7701                ::oxsearch_core::__private::serialize_variant(serializer, "shape", value)
7702            }
7703            Self::SimpleQueryString(value) => ::oxsearch_core::__private::serialize_variant(
7704                serializer,
7705                "simple_query_string",
7706                value,
7707            ),
7708            Self::SpanContaining(value) => {
7709                ::oxsearch_core::__private::serialize_variant(serializer, "span_containing", value)
7710            }
7711            Self::SpanFieldMasking(value) => ::oxsearch_core::__private::serialize_variant(
7712                serializer,
7713                "span_field_masking",
7714                value,
7715            ),
7716            Self::SpanFirst(value) => {
7717                ::oxsearch_core::__private::serialize_variant(serializer, "span_first", value)
7718            }
7719            Self::SpanMulti(value) => {
7720                ::oxsearch_core::__private::serialize_variant(serializer, "span_multi", value)
7721            }
7722            Self::SpanNear(value) => {
7723                ::oxsearch_core::__private::serialize_variant(serializer, "span_near", value)
7724            }
7725            Self::SpanNot(value) => {
7726                ::oxsearch_core::__private::serialize_variant(serializer, "span_not", value)
7727            }
7728            Self::SpanOr(value) => {
7729                ::oxsearch_core::__private::serialize_variant(serializer, "span_or", value)
7730            }
7731            Self::SpanTerm(value) => {
7732                ::oxsearch_core::__private::serialize_variant(serializer, "span_term", value)
7733            }
7734            Self::SpanWithin(value) => {
7735                ::oxsearch_core::__private::serialize_variant(serializer, "span_within", value)
7736            }
7737            Self::SparseVector(value) => {
7738                ::oxsearch_core::__private::serialize_variant(serializer, "sparse_vector", value)
7739            }
7740            Self::Term(value) => {
7741                ::oxsearch_core::__private::serialize_variant(serializer, "term", value)
7742            }
7743            Self::Terms(value) => {
7744                ::oxsearch_core::__private::serialize_variant(serializer, "terms", value)
7745            }
7746            Self::TermsSet(value) => {
7747                ::oxsearch_core::__private::serialize_variant(serializer, "terms_set", value)
7748            }
7749            Self::TextExpansion(value) => {
7750                ::oxsearch_core::__private::serialize_variant(serializer, "text_expansion", value)
7751            }
7752            Self::WeightedTokens(value) => {
7753                ::oxsearch_core::__private::serialize_variant(serializer, "weighted_tokens", value)
7754            }
7755            Self::Wildcard(value) => {
7756                ::oxsearch_core::__private::serialize_variant(serializer, "wildcard", value)
7757            }
7758            Self::Wrapper(value) => {
7759                ::oxsearch_core::__private::serialize_variant(serializer, "wrapper", value)
7760            }
7761            Self::Type(value) => {
7762                ::oxsearch_core::__private::serialize_variant(serializer, "type", value)
7763            }
7764            Self::Raw(value) => ::serde::Serialize::serialize(value, serializer),
7765        }
7766    }
7767}
7768
7769impl<'de> ::serde::Deserialize<'de> for QueryContainer {
7770    fn deserialize<D__: ::serde::Deserializer<'de>>(
7771        deserializer: D__,
7772    ) -> ::core::result::Result<Self, D__::Error> {
7773        ::oxsearch_core::__private::deserialize_container(deserializer)
7774    }
7775}
7776
7777impl<'de> ::oxsearch_core::__private::Container<'de> for QueryContainer {
7778    const NAME: &'static str = "QueryContainer";
7779    fn variant<A__: ::serde::de::MapAccess<'de>>(
7780        key: &str,
7781        map: &mut A__,
7782    ) -> ::core::result::Result<Self, A__::Error> {
7783        ::core::result::Result::Ok(match key {
7784            "bool" => Self::Bool(map.next_value()?),
7785            "boosting" => Self::Boosting(map.next_value()?),
7786            "common" => Self::Common(map.next_value()?),
7787            "combined_fields" => Self::CombinedFields(map.next_value()?),
7788            "constant_score" => Self::ConstantScore(map.next_value()?),
7789            "dis_max" => Self::DisMax(map.next_value()?),
7790            "distance_feature" => Self::DistanceFeature(map.next_value()?),
7791            "exists" => Self::Exists(map.next_value()?),
7792            "function_score" => Self::FunctionScore(map.next_value()?),
7793            "fuzzy" => Self::Fuzzy(map.next_value()?),
7794            "geo_bounding_box" => Self::GeoBoundingBox(map.next_value()?),
7795            "geo_distance" => Self::GeoDistance(map.next_value()?),
7796            "geo_grid" => Self::GeoGrid(map.next_value()?),
7797            "geo_polygon" => Self::GeoPolygon(map.next_value()?),
7798            "geo_shape" => Self::GeoShape(map.next_value()?),
7799            "has_child" => Self::HasChild(map.next_value()?),
7800            "has_parent" => Self::HasParent(map.next_value()?),
7801            "ids" => Self::Ids(map.next_value()?),
7802            "intervals" => Self::Intervals(map.next_value()?),
7803            "knn" => Self::Knn(map.next_value()?),
7804            "kql" => Self::Kql(map.next_value()?),
7805            "match" => Self::Match(map.next_value()?),
7806            "match_all" => Self::MatchAll(map.next_value()?),
7807            "match_bool_prefix" => Self::MatchBoolPrefix(map.next_value()?),
7808            "match_none" => Self::MatchNone(map.next_value()?),
7809            "match_phrase" => Self::MatchPhrase(map.next_value()?),
7810            "match_phrase_prefix" => Self::MatchPhrasePrefix(map.next_value()?),
7811            "more_like_this" => Self::MoreLikeThis(map.next_value()?),
7812            "multi_match" => Self::MultiMatch(map.next_value()?),
7813            "nested" => Self::Nested(map.next_value()?),
7814            "parent_id" => Self::ParentId(map.next_value()?),
7815            "percolate" => Self::Percolate(map.next_value()?),
7816            "pinned" => Self::Pinned(map.next_value()?),
7817            "prefix" => Self::Prefix(map.next_value()?),
7818            "query_string" => Self::QueryString(map.next_value()?),
7819            "range" => Self::Range(map.next_value()?),
7820            "rank_feature" => Self::RankFeature(map.next_value()?),
7821            "regexp" => Self::Regexp(map.next_value()?),
7822            "rule" => Self::Rule(map.next_value()?),
7823            "script" => Self::Script(map.next_value()?),
7824            "script_score" => Self::ScriptScore(map.next_value()?),
7825            "semantic" => Self::Semantic(map.next_value()?),
7826            "shape" => Self::Shape(map.next_value()?),
7827            "simple_query_string" => Self::SimpleQueryString(map.next_value()?),
7828            "span_containing" => Self::SpanContaining(map.next_value()?),
7829            "span_field_masking" => Self::SpanFieldMasking(map.next_value()?),
7830            "span_first" => Self::SpanFirst(map.next_value()?),
7831            "span_multi" => Self::SpanMulti(map.next_value()?),
7832            "span_near" => Self::SpanNear(map.next_value()?),
7833            "span_not" => Self::SpanNot(map.next_value()?),
7834            "span_or" => Self::SpanOr(map.next_value()?),
7835            "span_term" => Self::SpanTerm(map.next_value()?),
7836            "span_within" => Self::SpanWithin(map.next_value()?),
7837            "sparse_vector" => Self::SparseVector(map.next_value()?),
7838            "term" => Self::Term(map.next_value()?),
7839            "terms" => Self::Terms(map.next_value()?),
7840            "terms_set" => Self::TermsSet(map.next_value()?),
7841            "text_expansion" => Self::TextExpansion(map.next_value()?),
7842            "weighted_tokens" => Self::WeightedTokens(map.next_value()?),
7843            "wildcard" => Self::Wildcard(map.next_value()?),
7844            "wrapper" => Self::Wrapper(map.next_value()?),
7845            "type" => Self::Type(map.next_value()?),
7846            _ => Self::Raw(::oxsearch_core::__private::raw_variant(
7847                key,
7848                map.next_value()?,
7849            )),
7850        })
7851    }
7852}
7853
7854impl ::core::convert::From<crate::query_dsl::BoolQuery> for QueryContainer {
7855    fn from(value: crate::query_dsl::BoolQuery) -> Self {
7856        Self::Bool(::std::boxed::Box::new(value))
7857    }
7858}
7859
7860impl ::core::convert::From<crate::query_dsl::BoostingQuery> for QueryContainer {
7861    fn from(value: crate::query_dsl::BoostingQuery) -> Self {
7862        Self::Boosting(::std::boxed::Box::new(value))
7863    }
7864}
7865
7866impl
7867    ::core::convert::From<
7868        ::oxsearch_core::shapes::SingleKey<crate::Field, crate::query_dsl::CommonTermsQuery>,
7869    > for QueryContainer
7870{
7871    fn from(
7872        value: ::oxsearch_core::shapes::SingleKey<crate::Field, crate::query_dsl::CommonTermsQuery>,
7873    ) -> Self {
7874        Self::Common(value)
7875    }
7876}
7877
7878impl ::core::convert::From<crate::query_dsl::CombinedFieldsQuery> for QueryContainer {
7879    fn from(value: crate::query_dsl::CombinedFieldsQuery) -> Self {
7880        Self::CombinedFields(value)
7881    }
7882}
7883
7884impl ::core::convert::From<crate::query_dsl::ConstantScoreQuery> for QueryContainer {
7885    fn from(value: crate::query_dsl::ConstantScoreQuery) -> Self {
7886        Self::ConstantScore(::std::boxed::Box::new(value))
7887    }
7888}
7889
7890impl ::core::convert::From<crate::query_dsl::DisMaxQuery> for QueryContainer {
7891    fn from(value: crate::query_dsl::DisMaxQuery) -> Self {
7892        Self::DisMax(value)
7893    }
7894}
7895
7896impl ::core::convert::From<crate::query_dsl::DistanceFeatureQuery> for QueryContainer {
7897    fn from(value: crate::query_dsl::DistanceFeatureQuery) -> Self {
7898        Self::DistanceFeature(value)
7899    }
7900}
7901
7902impl ::core::convert::From<crate::query_dsl::ExistsQuery> for QueryContainer {
7903    fn from(value: crate::query_dsl::ExistsQuery) -> Self {
7904        Self::Exists(value)
7905    }
7906}
7907
7908impl ::core::convert::From<crate::query_dsl::FunctionScoreQuery> for QueryContainer {
7909    fn from(value: crate::query_dsl::FunctionScoreQuery) -> Self {
7910        Self::FunctionScore(::std::boxed::Box::new(value))
7911    }
7912}
7913
7914impl
7915    ::core::convert::From<
7916        ::oxsearch_core::shapes::SingleKey<crate::Field, crate::query_dsl::FuzzyQuery>,
7917    > for QueryContainer
7918{
7919    fn from(
7920        value: ::oxsearch_core::shapes::SingleKey<crate::Field, crate::query_dsl::FuzzyQuery>,
7921    ) -> Self {
7922        Self::Fuzzy(value)
7923    }
7924}
7925
7926impl ::core::convert::From<crate::query_dsl::GeoBoundingBoxQuery> for QueryContainer {
7927    fn from(value: crate::query_dsl::GeoBoundingBoxQuery) -> Self {
7928        Self::GeoBoundingBox(value)
7929    }
7930}
7931
7932impl ::core::convert::From<crate::query_dsl::GeoDistanceQuery> for QueryContainer {
7933    fn from(value: crate::query_dsl::GeoDistanceQuery) -> Self {
7934        Self::GeoDistance(value)
7935    }
7936}
7937
7938impl
7939    ::core::convert::From<
7940        ::oxsearch_core::shapes::SingleKey<crate::Field, crate::query_dsl::GeoGridQuery>,
7941    > for QueryContainer
7942{
7943    fn from(
7944        value: ::oxsearch_core::shapes::SingleKey<crate::Field, crate::query_dsl::GeoGridQuery>,
7945    ) -> Self {
7946        Self::GeoGrid(value)
7947    }
7948}
7949
7950impl ::core::convert::From<crate::query_dsl::GeoPolygonQuery> for QueryContainer {
7951    fn from(value: crate::query_dsl::GeoPolygonQuery) -> Self {
7952        Self::GeoPolygon(value)
7953    }
7954}
7955
7956impl ::core::convert::From<crate::query_dsl::GeoShapeQuery> for QueryContainer {
7957    fn from(value: crate::query_dsl::GeoShapeQuery) -> Self {
7958        Self::GeoShape(value)
7959    }
7960}
7961
7962impl ::core::convert::From<crate::query_dsl::HasChildQuery> for QueryContainer {
7963    fn from(value: crate::query_dsl::HasChildQuery) -> Self {
7964        Self::HasChild(::std::boxed::Box::new(value))
7965    }
7966}
7967
7968impl ::core::convert::From<crate::query_dsl::HasParentQuery> for QueryContainer {
7969    fn from(value: crate::query_dsl::HasParentQuery) -> Self {
7970        Self::HasParent(::std::boxed::Box::new(value))
7971    }
7972}
7973
7974impl ::core::convert::From<crate::query_dsl::IdsQuery> for QueryContainer {
7975    fn from(value: crate::query_dsl::IdsQuery) -> Self {
7976        Self::Ids(value)
7977    }
7978}
7979
7980impl
7981    ::core::convert::From<
7982        ::oxsearch_core::shapes::SingleKey<crate::Field, crate::query_dsl::IntervalsQuery>,
7983    > for QueryContainer
7984{
7985    fn from(
7986        value: ::oxsearch_core::shapes::SingleKey<crate::Field, crate::query_dsl::IntervalsQuery>,
7987    ) -> Self {
7988        Self::Intervals(value)
7989    }
7990}
7991
7992impl ::core::convert::From<crate::KnnQuery> for QueryContainer {
7993    fn from(value: crate::KnnQuery) -> Self {
7994        Self::Knn(::std::boxed::Box::new(value))
7995    }
7996}
7997
7998impl ::core::convert::From<crate::query_dsl::KqlQuery> for QueryContainer {
7999    fn from(value: crate::query_dsl::KqlQuery) -> Self {
8000        Self::Kql(value)
8001    }
8002}
8003
8004impl
8005    ::core::convert::From<
8006        ::oxsearch_core::shapes::SingleKey<crate::Field, crate::query_dsl::MatchQuery>,
8007    > for QueryContainer
8008{
8009    fn from(
8010        value: ::oxsearch_core::shapes::SingleKey<crate::Field, crate::query_dsl::MatchQuery>,
8011    ) -> Self {
8012        Self::Match(value)
8013    }
8014}
8015
8016impl ::core::convert::From<crate::query_dsl::MatchAllQuery> for QueryContainer {
8017    fn from(value: crate::query_dsl::MatchAllQuery) -> Self {
8018        Self::MatchAll(value)
8019    }
8020}
8021
8022impl
8023    ::core::convert::From<
8024        ::oxsearch_core::shapes::SingleKey<crate::Field, crate::query_dsl::MatchBoolPrefixQuery>,
8025    > for QueryContainer
8026{
8027    fn from(
8028        value: ::oxsearch_core::shapes::SingleKey<
8029            crate::Field,
8030            crate::query_dsl::MatchBoolPrefixQuery,
8031        >,
8032    ) -> Self {
8033        Self::MatchBoolPrefix(value)
8034    }
8035}
8036
8037impl ::core::convert::From<crate::query_dsl::MatchNoneQuery> for QueryContainer {
8038    fn from(value: crate::query_dsl::MatchNoneQuery) -> Self {
8039        Self::MatchNone(value)
8040    }
8041}
8042
8043impl
8044    ::core::convert::From<
8045        ::oxsearch_core::shapes::SingleKey<crate::Field, crate::query_dsl::MatchPhraseQuery>,
8046    > for QueryContainer
8047{
8048    fn from(
8049        value: ::oxsearch_core::shapes::SingleKey<crate::Field, crate::query_dsl::MatchPhraseQuery>,
8050    ) -> Self {
8051        Self::MatchPhrase(value)
8052    }
8053}
8054
8055impl
8056    ::core::convert::From<
8057        ::oxsearch_core::shapes::SingleKey<crate::Field, crate::query_dsl::MatchPhrasePrefixQuery>,
8058    > for QueryContainer
8059{
8060    fn from(
8061        value: ::oxsearch_core::shapes::SingleKey<
8062            crate::Field,
8063            crate::query_dsl::MatchPhrasePrefixQuery,
8064        >,
8065    ) -> Self {
8066        Self::MatchPhrasePrefix(value)
8067    }
8068}
8069
8070impl ::core::convert::From<crate::query_dsl::MoreLikeThisQuery> for QueryContainer {
8071    fn from(value: crate::query_dsl::MoreLikeThisQuery) -> Self {
8072        Self::MoreLikeThis(value)
8073    }
8074}
8075
8076impl ::core::convert::From<crate::query_dsl::MultiMatchQuery> for QueryContainer {
8077    fn from(value: crate::query_dsl::MultiMatchQuery) -> Self {
8078        Self::MultiMatch(value)
8079    }
8080}
8081
8082impl ::core::convert::From<crate::query_dsl::NestedQuery> for QueryContainer {
8083    fn from(value: crate::query_dsl::NestedQuery) -> Self {
8084        Self::Nested(::std::boxed::Box::new(value))
8085    }
8086}
8087
8088impl ::core::convert::From<crate::query_dsl::ParentIdQuery> for QueryContainer {
8089    fn from(value: crate::query_dsl::ParentIdQuery) -> Self {
8090        Self::ParentId(value)
8091    }
8092}
8093
8094impl ::core::convert::From<crate::query_dsl::PercolateQuery> for QueryContainer {
8095    fn from(value: crate::query_dsl::PercolateQuery) -> Self {
8096        Self::Percolate(value)
8097    }
8098}
8099
8100impl ::core::convert::From<crate::query_dsl::PinnedQuery> for QueryContainer {
8101    fn from(value: crate::query_dsl::PinnedQuery) -> Self {
8102        Self::Pinned(::std::boxed::Box::new(value))
8103    }
8104}
8105
8106impl
8107    ::core::convert::From<
8108        ::oxsearch_core::shapes::SingleKey<crate::Field, crate::query_dsl::PrefixQuery>,
8109    > for QueryContainer
8110{
8111    fn from(
8112        value: ::oxsearch_core::shapes::SingleKey<crate::Field, crate::query_dsl::PrefixQuery>,
8113    ) -> Self {
8114        Self::Prefix(value)
8115    }
8116}
8117
8118impl ::core::convert::From<crate::query_dsl::QueryStringQuery> for QueryContainer {
8119    fn from(value: crate::query_dsl::QueryStringQuery) -> Self {
8120        Self::QueryString(value)
8121    }
8122}
8123
8124impl
8125    ::core::convert::From<
8126        ::oxsearch_core::shapes::SingleKey<crate::Field, crate::query_dsl::RangeQuery>,
8127    > for QueryContainer
8128{
8129    fn from(
8130        value: ::oxsearch_core::shapes::SingleKey<crate::Field, crate::query_dsl::RangeQuery>,
8131    ) -> Self {
8132        Self::Range(value)
8133    }
8134}
8135
8136impl ::core::convert::From<crate::query_dsl::RankFeatureQuery> for QueryContainer {
8137    fn from(value: crate::query_dsl::RankFeatureQuery) -> Self {
8138        Self::RankFeature(value)
8139    }
8140}
8141
8142impl
8143    ::core::convert::From<
8144        ::oxsearch_core::shapes::SingleKey<crate::Field, crate::query_dsl::RegexpQuery>,
8145    > for QueryContainer
8146{
8147    fn from(
8148        value: ::oxsearch_core::shapes::SingleKey<crate::Field, crate::query_dsl::RegexpQuery>,
8149    ) -> Self {
8150        Self::Regexp(value)
8151    }
8152}
8153
8154impl ::core::convert::From<crate::query_dsl::RuleQuery> for QueryContainer {
8155    fn from(value: crate::query_dsl::RuleQuery) -> Self {
8156        Self::Rule(::std::boxed::Box::new(value))
8157    }
8158}
8159
8160impl ::core::convert::From<crate::query_dsl::ScriptQuery> for QueryContainer {
8161    fn from(value: crate::query_dsl::ScriptQuery) -> Self {
8162        Self::Script(value)
8163    }
8164}
8165
8166impl ::core::convert::From<crate::query_dsl::ScriptScoreQuery> for QueryContainer {
8167    fn from(value: crate::query_dsl::ScriptScoreQuery) -> Self {
8168        Self::ScriptScore(::std::boxed::Box::new(value))
8169    }
8170}
8171
8172impl ::core::convert::From<crate::query_dsl::SemanticQuery> for QueryContainer {
8173    fn from(value: crate::query_dsl::SemanticQuery) -> Self {
8174        Self::Semantic(value)
8175    }
8176}
8177
8178impl ::core::convert::From<crate::query_dsl::ShapeQuery> for QueryContainer {
8179    fn from(value: crate::query_dsl::ShapeQuery) -> Self {
8180        Self::Shape(value)
8181    }
8182}
8183
8184impl ::core::convert::From<crate::query_dsl::SimpleQueryStringQuery> for QueryContainer {
8185    fn from(value: crate::query_dsl::SimpleQueryStringQuery) -> Self {
8186        Self::SimpleQueryString(value)
8187    }
8188}
8189
8190impl ::core::convert::From<crate::query_dsl::SpanContainingQuery> for QueryContainer {
8191    fn from(value: crate::query_dsl::SpanContainingQuery) -> Self {
8192        Self::SpanContaining(::std::boxed::Box::new(value))
8193    }
8194}
8195
8196impl ::core::convert::From<crate::query_dsl::SpanFieldMaskingQuery> for QueryContainer {
8197    fn from(value: crate::query_dsl::SpanFieldMaskingQuery) -> Self {
8198        Self::SpanFieldMasking(::std::boxed::Box::new(value))
8199    }
8200}
8201
8202impl ::core::convert::From<crate::query_dsl::SpanFirstQuery> for QueryContainer {
8203    fn from(value: crate::query_dsl::SpanFirstQuery) -> Self {
8204        Self::SpanFirst(::std::boxed::Box::new(value))
8205    }
8206}
8207
8208impl ::core::convert::From<crate::query_dsl::SpanMultiTermQuery> for QueryContainer {
8209    fn from(value: crate::query_dsl::SpanMultiTermQuery) -> Self {
8210        Self::SpanMulti(::std::boxed::Box::new(value))
8211    }
8212}
8213
8214impl ::core::convert::From<crate::query_dsl::SpanNearQuery> for QueryContainer {
8215    fn from(value: crate::query_dsl::SpanNearQuery) -> Self {
8216        Self::SpanNear(value)
8217    }
8218}
8219
8220impl ::core::convert::From<crate::query_dsl::SpanNotQuery> for QueryContainer {
8221    fn from(value: crate::query_dsl::SpanNotQuery) -> Self {
8222        Self::SpanNot(::std::boxed::Box::new(value))
8223    }
8224}
8225
8226impl ::core::convert::From<crate::query_dsl::SpanOrQuery> for QueryContainer {
8227    fn from(value: crate::query_dsl::SpanOrQuery) -> Self {
8228        Self::SpanOr(value)
8229    }
8230}
8231
8232impl
8233    ::core::convert::From<
8234        ::oxsearch_core::shapes::SingleKey<crate::Field, crate::query_dsl::SpanTermQuery>,
8235    > for QueryContainer
8236{
8237    fn from(
8238        value: ::oxsearch_core::shapes::SingleKey<crate::Field, crate::query_dsl::SpanTermQuery>,
8239    ) -> Self {
8240        Self::SpanTerm(value)
8241    }
8242}
8243
8244impl ::core::convert::From<crate::query_dsl::SpanWithinQuery> for QueryContainer {
8245    fn from(value: crate::query_dsl::SpanWithinQuery) -> Self {
8246        Self::SpanWithin(::std::boxed::Box::new(value))
8247    }
8248}
8249
8250impl ::core::convert::From<crate::query_dsl::SparseVectorQuery> for QueryContainer {
8251    fn from(value: crate::query_dsl::SparseVectorQuery) -> Self {
8252        Self::SparseVector(value)
8253    }
8254}
8255
8256impl
8257    ::core::convert::From<
8258        ::oxsearch_core::shapes::SingleKey<crate::Field, crate::query_dsl::TermQuery>,
8259    > for QueryContainer
8260{
8261    fn from(
8262        value: ::oxsearch_core::shapes::SingleKey<crate::Field, crate::query_dsl::TermQuery>,
8263    ) -> Self {
8264        Self::Term(value)
8265    }
8266}
8267
8268impl ::core::convert::From<crate::query_dsl::TermsQuery> for QueryContainer {
8269    fn from(value: crate::query_dsl::TermsQuery) -> Self {
8270        Self::Terms(value)
8271    }
8272}
8273
8274impl
8275    ::core::convert::From<
8276        ::oxsearch_core::shapes::SingleKey<crate::Field, crate::query_dsl::TermsSetQuery>,
8277    > for QueryContainer
8278{
8279    fn from(
8280        value: ::oxsearch_core::shapes::SingleKey<crate::Field, crate::query_dsl::TermsSetQuery>,
8281    ) -> Self {
8282        Self::TermsSet(value)
8283    }
8284}
8285
8286impl
8287    ::core::convert::From<
8288        ::oxsearch_core::shapes::SingleKey<crate::Field, crate::query_dsl::TextExpansionQuery>,
8289    > for QueryContainer
8290{
8291    fn from(
8292        value: ::oxsearch_core::shapes::SingleKey<
8293            crate::Field,
8294            crate::query_dsl::TextExpansionQuery,
8295        >,
8296    ) -> Self {
8297        Self::TextExpansion(value)
8298    }
8299}
8300
8301impl
8302    ::core::convert::From<
8303        ::oxsearch_core::shapes::SingleKey<crate::Field, crate::query_dsl::WeightedTokensQuery>,
8304    > for QueryContainer
8305{
8306    fn from(
8307        value: ::oxsearch_core::shapes::SingleKey<
8308            crate::Field,
8309            crate::query_dsl::WeightedTokensQuery,
8310        >,
8311    ) -> Self {
8312        Self::WeightedTokens(value)
8313    }
8314}
8315
8316impl
8317    ::core::convert::From<
8318        ::oxsearch_core::shapes::SingleKey<crate::Field, crate::query_dsl::WildcardQuery>,
8319    > for QueryContainer
8320{
8321    fn from(
8322        value: ::oxsearch_core::shapes::SingleKey<crate::Field, crate::query_dsl::WildcardQuery>,
8323    ) -> Self {
8324        Self::Wildcard(value)
8325    }
8326}
8327
8328impl ::core::convert::From<crate::query_dsl::WrapperQuery> for QueryContainer {
8329    fn from(value: crate::query_dsl::WrapperQuery) -> Self {
8330        Self::Wrapper(value)
8331    }
8332}
8333
8334impl ::core::convert::From<crate::query_dsl::TypeQuery> for QueryContainer {
8335    fn from(value: crate::query_dsl::TypeQuery) -> Self {
8336        Self::Type(value)
8337    }
8338}
8339
8340#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
8341#[non_exhaustive]
8342pub struct QueryStringQuery {
8343    /// Floating point number used to decrease or increase the relevance scores of the query.
8344    /// Boost values are relative to the default value of 1.0.
8345    /// A boost value between 0 and 1.0 decreases the relevance score.
8346    /// A value greater than 1.0 increases the relevance score.
8347    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
8348    pub boost: ::core::option::Option<f32>,
8349    #[serde(
8350        rename = "_name",
8351        skip_serializing_if = "::core::option::Option::is_none"
8352    )]
8353    pub name: ::core::option::Option<::std::string::String>,
8354    /// If `true`, the wildcard characters `*` and `?` are allowed as the first character of the query string.
8355    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
8356    pub allow_leading_wildcard: ::core::option::Option<bool>,
8357    /// Analyzer used to convert text in the query string into tokens.
8358    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
8359    pub analyzer: ::core::option::Option<::std::string::String>,
8360    /// If `true`, the query attempts to analyze wildcard terms in the query string.
8361    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
8362    pub analyze_wildcard: ::core::option::Option<bool>,
8363    /// If `true`, match phrase queries are automatically created for multi-term synonyms.
8364    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
8365    pub auto_generate_synonyms_phrase_query: ::core::option::Option<bool>,
8366    /// Default field to search if no field is provided in the query string.
8367    /// Supports wildcards (`*`).
8368    /// Defaults to the `index.query.default_field` index setting, which has a default value of `*`.
8369    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
8370    pub default_field: ::core::option::Option<crate::Field>,
8371    /// Default boolean logic used to interpret text in the query string if no operators are specified.
8372    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
8373    pub default_operator: ::core::option::Option<crate::query_dsl::Operator>,
8374    /// If `true`, enable position increments in queries constructed from a `query_string` search.
8375    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
8376    pub enable_position_increments: ::core::option::Option<bool>,
8377    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
8378    pub escape: ::core::option::Option<bool>,
8379    /// Array of fields to search. Supports wildcards (`*`).
8380    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
8381    pub fields: ::core::option::Option<::std::vec::Vec<crate::Field>>,
8382    /// Maximum edit distance allowed for fuzzy matching.
8383    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
8384    pub fuzziness: ::core::option::Option<crate::Fuzziness>,
8385    /// Maximum number of terms to which the query expands for fuzzy matching.
8386    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
8387    pub fuzzy_max_expansions: ::core::option::Option<i32>,
8388    /// Number of beginning characters left unchanged for fuzzy matching.
8389    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
8390    pub fuzzy_prefix_length: ::core::option::Option<i32>,
8391    /// Method used to rewrite the query.
8392    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
8393    pub fuzzy_rewrite: ::core::option::Option<crate::MultiTermQueryRewrite>,
8394    /// If `true`, edits for fuzzy matching include transpositions of two adjacent characters (for example, `ab` to `ba`).
8395    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
8396    pub fuzzy_transpositions: ::core::option::Option<bool>,
8397    /// If `true`, format-based errors, such as providing a text value for a numeric field, are ignored.
8398    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
8399    pub lenient: ::core::option::Option<bool>,
8400    /// Maximum number of automaton states required for the query.
8401    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
8402    pub max_determinized_states: ::core::option::Option<i32>,
8403    /// Minimum number of clauses that must match for a document to be returned.
8404    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
8405    pub minimum_should_match: ::core::option::Option<crate::MinimumShouldMatch>,
8406    /// Maximum number of positions allowed between matching tokens for phrases.
8407    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
8408    pub phrase_slop: ::core::option::Option<f64>,
8409    /// Query string you wish to parse and use for search.
8410    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
8411    pub query: ::core::option::Option<::std::string::String>,
8412    /// Analyzer used to convert quoted text in the query string into tokens.
8413    /// For quoted text, this parameter overrides the analyzer specified in the `analyzer` parameter.
8414    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
8415    pub quote_analyzer: ::core::option::Option<::std::string::String>,
8416    /// Suffix appended to quoted text in the query string.
8417    /// You can use this suffix to use a different analysis method for exact matches.
8418    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
8419    pub quote_field_suffix: ::core::option::Option<::std::string::String>,
8420    /// Method used to rewrite the query.
8421    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
8422    pub rewrite: ::core::option::Option<crate::MultiTermQueryRewrite>,
8423    /// How to combine the queries generated from the individual search terms in the resulting `dis_max` query.
8424    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
8425    pub tie_breaker: ::core::option::Option<f64>,
8426    /// Coordinated Universal Time (UTC) offset or IANA time zone used to convert date values in the query string to UTC.
8427    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
8428    pub time_zone: ::core::option::Option<crate::TimeZone>,
8429    /// Determines how the query matches and scores documents.
8430    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
8431    pub r#type: ::core::option::Option<crate::query_dsl::TextQueryType>,
8432}
8433
8434impl QueryStringQuery {
8435    /// A `QueryStringQuery` with its required properties set.
8436    pub fn new(query: impl ::core::convert::Into<::std::string::String>) -> Self {
8437        Self {
8438            boost: ::core::option::Option::None,
8439            name: ::core::option::Option::None,
8440            allow_leading_wildcard: ::core::option::Option::None,
8441            analyzer: ::core::option::Option::None,
8442            analyze_wildcard: ::core::option::Option::None,
8443            auto_generate_synonyms_phrase_query: ::core::option::Option::None,
8444            default_field: ::core::option::Option::None,
8445            default_operator: ::core::option::Option::None,
8446            enable_position_increments: ::core::option::Option::None,
8447            escape: ::core::option::Option::None,
8448            fields: ::core::option::Option::None,
8449            fuzziness: ::core::option::Option::None,
8450            fuzzy_max_expansions: ::core::option::Option::None,
8451            fuzzy_prefix_length: ::core::option::Option::None,
8452            fuzzy_rewrite: ::core::option::Option::None,
8453            fuzzy_transpositions: ::core::option::Option::None,
8454            lenient: ::core::option::Option::None,
8455            max_determinized_states: ::core::option::Option::None,
8456            minimum_should_match: ::core::option::Option::None,
8457            phrase_slop: ::core::option::Option::None,
8458            query: ::core::option::Option::Some(query.into()),
8459            quote_analyzer: ::core::option::Option::None,
8460            quote_field_suffix: ::core::option::Option::None,
8461            rewrite: ::core::option::Option::None,
8462            tie_breaker: ::core::option::Option::None,
8463            time_zone: ::core::option::Option::None,
8464            r#type: ::core::option::Option::None,
8465        }
8466    }
8467}
8468
8469impl QueryStringQuery {
8470    /// Sets `boost`.
8471    pub fn boost(mut self, value: f32) -> Self {
8472        self.boost = ::core::option::Option::Some(value.into());
8473        self
8474    }
8475    /// Sets `name`.
8476    pub fn name(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
8477        self.name = ::core::option::Option::Some(value.into());
8478        self
8479    }
8480    /// Sets `allow_leading_wildcard`.
8481    pub fn allow_leading_wildcard(mut self, value: bool) -> Self {
8482        self.allow_leading_wildcard = ::core::option::Option::Some(value.into());
8483        self
8484    }
8485    /// Sets `analyzer`.
8486    pub fn analyzer(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
8487        self.analyzer = ::core::option::Option::Some(value.into());
8488        self
8489    }
8490    /// Sets `analyze_wildcard`.
8491    pub fn analyze_wildcard(mut self, value: bool) -> Self {
8492        self.analyze_wildcard = ::core::option::Option::Some(value.into());
8493        self
8494    }
8495    /// Sets `auto_generate_synonyms_phrase_query`.
8496    pub fn auto_generate_synonyms_phrase_query(mut self, value: bool) -> Self {
8497        self.auto_generate_synonyms_phrase_query = ::core::option::Option::Some(value.into());
8498        self
8499    }
8500    /// Sets `default_field`.
8501    pub fn default_field(mut self, value: impl ::core::convert::Into<crate::Field>) -> Self {
8502        self.default_field = ::core::option::Option::Some(value.into());
8503        self
8504    }
8505    /// Sets `default_operator`.
8506    pub fn default_operator(
8507        mut self,
8508        value: impl ::core::convert::Into<crate::query_dsl::Operator>,
8509    ) -> Self {
8510        self.default_operator = ::core::option::Option::Some(value.into());
8511        self
8512    }
8513    /// Sets `enable_position_increments`.
8514    pub fn enable_position_increments(mut self, value: bool) -> Self {
8515        self.enable_position_increments = ::core::option::Option::Some(value.into());
8516        self
8517    }
8518    /// Sets `escape`.
8519    pub fn escape(mut self, value: bool) -> Self {
8520        self.escape = ::core::option::Option::Some(value.into());
8521        self
8522    }
8523    /// Sets `fields`.
8524    pub fn fields(
8525        mut self,
8526        value: impl ::core::convert::Into<::std::vec::Vec<crate::Field>>,
8527    ) -> Self {
8528        self.fields = ::core::option::Option::Some(value.into());
8529        self
8530    }
8531    /// Sets `fuzziness`.
8532    pub fn fuzziness(mut self, value: impl ::core::convert::Into<crate::Fuzziness>) -> Self {
8533        self.fuzziness = ::core::option::Option::Some(value.into());
8534        self
8535    }
8536    /// Sets `fuzzy_max_expansions`.
8537    pub fn fuzzy_max_expansions(mut self, value: i32) -> Self {
8538        self.fuzzy_max_expansions = ::core::option::Option::Some(value.into());
8539        self
8540    }
8541    /// Sets `fuzzy_prefix_length`.
8542    pub fn fuzzy_prefix_length(mut self, value: i32) -> Self {
8543        self.fuzzy_prefix_length = ::core::option::Option::Some(value.into());
8544        self
8545    }
8546    /// Sets `fuzzy_rewrite`.
8547    pub fn fuzzy_rewrite(
8548        mut self,
8549        value: impl ::core::convert::Into<crate::MultiTermQueryRewrite>,
8550    ) -> Self {
8551        self.fuzzy_rewrite = ::core::option::Option::Some(value.into());
8552        self
8553    }
8554    /// Sets `fuzzy_transpositions`.
8555    pub fn fuzzy_transpositions(mut self, value: bool) -> Self {
8556        self.fuzzy_transpositions = ::core::option::Option::Some(value.into());
8557        self
8558    }
8559    /// Sets `lenient`.
8560    pub fn lenient(mut self, value: bool) -> Self {
8561        self.lenient = ::core::option::Option::Some(value.into());
8562        self
8563    }
8564    /// Sets `max_determinized_states`.
8565    pub fn max_determinized_states(mut self, value: i32) -> Self {
8566        self.max_determinized_states = ::core::option::Option::Some(value.into());
8567        self
8568    }
8569    /// Sets `minimum_should_match`.
8570    pub fn minimum_should_match(
8571        mut self,
8572        value: impl ::core::convert::Into<crate::MinimumShouldMatch>,
8573    ) -> Self {
8574        self.minimum_should_match = ::core::option::Option::Some(value.into());
8575        self
8576    }
8577    /// Sets `phrase_slop`.
8578    pub fn phrase_slop(mut self, value: f64) -> Self {
8579        self.phrase_slop = ::core::option::Option::Some(value.into());
8580        self
8581    }
8582    /// Sets `quote_analyzer`.
8583    pub fn quote_analyzer(
8584        mut self,
8585        value: impl ::core::convert::Into<::std::string::String>,
8586    ) -> Self {
8587        self.quote_analyzer = ::core::option::Option::Some(value.into());
8588        self
8589    }
8590    /// Sets `quote_field_suffix`.
8591    pub fn quote_field_suffix(
8592        mut self,
8593        value: impl ::core::convert::Into<::std::string::String>,
8594    ) -> Self {
8595        self.quote_field_suffix = ::core::option::Option::Some(value.into());
8596        self
8597    }
8598    /// Sets `rewrite`.
8599    pub fn rewrite(
8600        mut self,
8601        value: impl ::core::convert::Into<crate::MultiTermQueryRewrite>,
8602    ) -> Self {
8603        self.rewrite = ::core::option::Option::Some(value.into());
8604        self
8605    }
8606    /// Sets `tie_breaker`.
8607    pub fn tie_breaker(mut self, value: f64) -> Self {
8608        self.tie_breaker = ::core::option::Option::Some(value.into());
8609        self
8610    }
8611    /// Sets `time_zone`.
8612    pub fn time_zone(mut self, value: impl ::core::convert::Into<crate::TimeZone>) -> Self {
8613        self.time_zone = ::core::option::Option::Some(value.into());
8614        self
8615    }
8616    /// Sets `type`.
8617    pub fn r#type(
8618        mut self,
8619        value: impl ::core::convert::Into<crate::query_dsl::TextQueryType>,
8620    ) -> Self {
8621        self.r#type = ::core::option::Option::Some(value.into());
8622        self
8623    }
8624}
8625
8626#[derive(Clone, Debug, PartialEq)]
8627#[non_exhaustive]
8628pub enum RandomScoreFunctionSeed {
8629    /// A number.
8630    Long(i64),
8631    /// A string.
8632    String(::std::string::String),
8633}
8634
8635impl ::serde::Serialize for RandomScoreFunctionSeed {
8636    fn serialize<S__: ::serde::Serializer>(
8637        &self,
8638        serializer: S__,
8639    ) -> ::core::result::Result<S__::Ok, S__::Error> {
8640        match self {
8641            Self::Long(value) => ::serde::Serialize::serialize(value, serializer),
8642            Self::String(value) => ::serde::Serialize::serialize(value, serializer),
8643        }
8644    }
8645}
8646
8647impl<'de> ::serde::Deserialize<'de> for RandomScoreFunctionSeed {
8648    fn deserialize<D__: ::serde::Deserializer<'de>>(
8649        deserializer: D__,
8650    ) -> ::core::result::Result<Self, D__::Error> {
8651        struct Shape;
8652        impl<'de> ::oxsearch_core::__private::ByKind<'de> for Shape {
8653            type Value = RandomScoreFunctionSeed;
8654            const EXPECTING: &'static str = "RandomScoreFunctionSeed: number or string";
8655            fn visit<V__: ::serde::Deserializer<'de>>(
8656                self,
8657                kind: ::oxsearch_core::__private::Kind,
8658                value: V__,
8659            ) -> ::core::result::Result<Self::Value, V__::Error> {
8660                match kind {
8661                    ::oxsearch_core::__private::Kind::Number => {
8662                        <i64 as ::serde::Deserialize>::deserialize(value)
8663                            .map(RandomScoreFunctionSeed::Long)
8664                    }
8665                    ::oxsearch_core::__private::Kind::String => {
8666                        <::std::string::String as ::serde::Deserialize>::deserialize(value)
8667                            .map(RandomScoreFunctionSeed::String)
8668                    }
8669                    _ => ::core::result::Result::Err(<V__::Error as ::serde::de::Error>::custom(
8670                        format_args!("RandomScoreFunctionSeed can't be {kind:?}"),
8671                    )),
8672                }
8673            }
8674        }
8675        ::oxsearch_core::__private::deserialize_by_kind(deserializer, Shape)
8676    }
8677}
8678
8679impl ::core::convert::From<i64> for RandomScoreFunctionSeed {
8680    fn from(value: i64) -> Self {
8681        Self::Long(value)
8682    }
8683}
8684
8685impl ::core::convert::From<::std::string::String> for RandomScoreFunctionSeed {
8686    fn from(value: ::std::string::String) -> Self {
8687        Self::String(value)
8688    }
8689}
8690
8691impl ::core::convert::From<&str> for RandomScoreFunctionSeed {
8692    fn from(value: &str) -> Self {
8693        Self::String(::std::borrow::ToOwned::to_owned(value))
8694    }
8695}
8696
8697#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
8698#[non_exhaustive]
8699pub struct RandomScoreFunction {
8700    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
8701    pub field: ::core::option::Option<crate::Field>,
8702    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
8703    pub seed: ::core::option::Option<crate::query_dsl::RandomScoreFunctionSeed>,
8704}
8705
8706impl RandomScoreFunction {
8707    /// A `RandomScoreFunction` with its required properties set.
8708    pub fn new() -> Self {
8709        Self {
8710            field: ::core::option::Option::None,
8711            seed: ::core::option::Option::None,
8712        }
8713    }
8714}
8715
8716impl RandomScoreFunction {
8717    /// Sets `field`.
8718    pub fn field(mut self, value: impl ::core::convert::Into<crate::Field>) -> Self {
8719        self.field = ::core::option::Option::Some(value.into());
8720        self
8721    }
8722    /// Sets `seed`.
8723    pub fn seed(
8724        mut self,
8725        value: impl ::core::convert::Into<crate::query_dsl::RandomScoreFunctionSeed>,
8726    ) -> Self {
8727        self.seed = ::core::option::Option::Some(value.into());
8728        self
8729    }
8730}
8731
8732#[derive(Clone, Debug, PartialEq)]
8733#[non_exhaustive]
8734pub enum RangeQuery {
8735    /// `untyped_range_query`.
8736    Untyped(crate::query_dsl::UntypedRangeQuery),
8737    /// `date_range_query`.
8738    Date(crate::query_dsl::DateRangeQuery),
8739    /// `number_range_query`.
8740    Number(crate::query_dsl::NumberRangeQuery),
8741    /// `long_number_range_query`.
8742    LongNumber(crate::query_dsl::LongNumberRangeQuery),
8743    /// `term_range_query`.
8744    Term(crate::query_dsl::TermRangeQuery),
8745}
8746
8747impl ::serde::Serialize for RangeQuery {
8748    fn serialize<S__: ::serde::Serializer>(
8749        &self,
8750        serializer: S__,
8751    ) -> ::core::result::Result<S__::Ok, S__::Error> {
8752        match self {
8753            Self::Untyped(value) => ::serde::Serialize::serialize(value, serializer),
8754            Self::Date(value) => ::serde::Serialize::serialize(value, serializer),
8755            Self::Number(value) => ::serde::Serialize::serialize(value, serializer),
8756            Self::LongNumber(value) => ::serde::Serialize::serialize(value, serializer),
8757            Self::Term(value) => ::serde::Serialize::serialize(value, serializer),
8758        }
8759    }
8760}
8761
8762impl<'de> ::serde::Deserialize<'de> for RangeQuery {
8763    /// Always the untyped member, which keeps every property.
8764    fn deserialize<D__: ::serde::Deserializer<'de>>(
8765        deserializer: D__,
8766    ) -> ::core::result::Result<Self, D__::Error> {
8767        ::serde::Deserialize::deserialize(deserializer).map(Self::Untyped)
8768    }
8769}
8770
8771impl ::core::convert::From<crate::query_dsl::UntypedRangeQuery> for RangeQuery {
8772    fn from(value: crate::query_dsl::UntypedRangeQuery) -> Self {
8773        Self::Untyped(value)
8774    }
8775}
8776
8777impl ::core::convert::From<crate::query_dsl::DateRangeQuery> for RangeQuery {
8778    fn from(value: crate::query_dsl::DateRangeQuery) -> Self {
8779        Self::Date(value)
8780    }
8781}
8782
8783impl ::core::convert::From<crate::query_dsl::NumberRangeQuery> for RangeQuery {
8784    fn from(value: crate::query_dsl::NumberRangeQuery) -> Self {
8785        Self::Number(value)
8786    }
8787}
8788
8789impl ::core::convert::From<crate::query_dsl::LongNumberRangeQuery> for RangeQuery {
8790    fn from(value: crate::query_dsl::LongNumberRangeQuery) -> Self {
8791        Self::LongNumber(value)
8792    }
8793}
8794
8795impl ::core::convert::From<crate::query_dsl::TermRangeQuery> for RangeQuery {
8796    fn from(value: crate::query_dsl::TermRangeQuery) -> Self {
8797        Self::Term(value)
8798    }
8799}
8800
8801#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
8802#[non_exhaustive]
8803pub struct RangeQueryBase<T = ::serde_json::Value> {
8804    /// Floating point number used to decrease or increase the relevance scores of the query.
8805    /// Boost values are relative to the default value of 1.0.
8806    /// A boost value between 0 and 1.0 decreases the relevance score.
8807    /// A value greater than 1.0 increases the relevance score.
8808    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
8809    pub boost: ::core::option::Option<f32>,
8810    #[serde(
8811        rename = "_name",
8812        skip_serializing_if = "::core::option::Option::is_none"
8813    )]
8814    pub name: ::core::option::Option<::std::string::String>,
8815    /// Indicates how the range query matches values for `range` fields.
8816    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
8817    pub relation: ::core::option::Option<crate::query_dsl::RangeRelation>,
8818    /// Greater than.
8819    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
8820    pub gt: ::core::option::Option<T>,
8821    /// Greater than or equal to.
8822    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
8823    pub gte: ::core::option::Option<T>,
8824    /// Less than.
8825    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
8826    pub lt: ::core::option::Option<T>,
8827    /// Less than or equal to.
8828    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
8829    pub lte: ::core::option::Option<T>,
8830}
8831
8832impl RangeQueryBase<::serde_json::Value> {
8833    /// A `RangeQueryBase` with its required properties set.
8834    pub fn new() -> Self {
8835        Self {
8836            boost: ::core::option::Option::None,
8837            name: ::core::option::Option::None,
8838            relation: ::core::option::Option::None,
8839            gt: ::core::option::Option::None,
8840            gte: ::core::option::Option::None,
8841            lt: ::core::option::Option::None,
8842            lte: ::core::option::Option::None,
8843        }
8844    }
8845}
8846
8847impl<T> RangeQueryBase<T> {
8848    /// Sets `boost`.
8849    pub fn boost(mut self, value: f32) -> Self {
8850        self.boost = ::core::option::Option::Some(value.into());
8851        self
8852    }
8853    /// Sets `name`.
8854    pub fn name(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
8855        self.name = ::core::option::Option::Some(value.into());
8856        self
8857    }
8858    /// Sets `relation`.
8859    pub fn relation(
8860        mut self,
8861        value: impl ::core::convert::Into<crate::query_dsl::RangeRelation>,
8862    ) -> Self {
8863        self.relation = ::core::option::Option::Some(value.into());
8864        self
8865    }
8866    /// Sets `gt`.
8867    pub fn gt(mut self, value: T) -> Self {
8868        self.gt = ::core::option::Option::Some(value.into());
8869        self
8870    }
8871    /// Sets `gte`.
8872    pub fn gte(mut self, value: T) -> Self {
8873        self.gte = ::core::option::Option::Some(value.into());
8874        self
8875    }
8876    /// Sets `lt`.
8877    pub fn lt(mut self, value: T) -> Self {
8878        self.lt = ::core::option::Option::Some(value.into());
8879        self
8880    }
8881    /// Sets `lte`.
8882    pub fn lte(mut self, value: T) -> Self {
8883        self.lte = ::core::option::Option::Some(value.into());
8884        self
8885    }
8886}
8887
8888#[derive(Clone, Debug, PartialEq, Eq, Hash)]
8889#[non_exhaustive]
8890pub enum RangeRelation {
8891    /// Matches documents with a range field value entirely within the query’s range.
8892    Within,
8893    /// Matches documents with a range field value that entirely contains the query’s range.
8894    Contains,
8895    /// Matches documents with a range field value that intersects the query’s range.
8896    Intersects,
8897    /// A value this version of the specification doesn't list.
8898    Raw(::std::string::String),
8899}
8900
8901impl RangeRelation {
8902    /// The value as Elasticsearch writes it.
8903    pub fn as_str(&self) -> &str {
8904        match self {
8905            Self::Within => "within",
8906            Self::Contains => "contains",
8907            Self::Intersects => "intersects",
8908            Self::Raw(value) => value,
8909        }
8910    }
8911
8912    /// The listed value with this name, if there is one.
8913    pub fn from_known(value: &str) -> ::core::option::Option<Self> {
8914        match value {
8915            "within" => ::core::option::Option::Some(Self::Within),
8916            "contains" => ::core::option::Option::Some(Self::Contains),
8917            "intersects" => ::core::option::Option::Some(Self::Intersects),
8918            _ => ::core::option::Option::None,
8919        }
8920    }
8921}
8922
8923impl ::serde::Serialize for RangeRelation {
8924    fn serialize<S__: ::serde::Serializer>(
8925        &self,
8926        serializer: S__,
8927    ) -> ::core::result::Result<S__::Ok, S__::Error> {
8928        serializer.serialize_str(self.as_str())
8929    }
8930}
8931
8932impl<'de> ::serde::Deserialize<'de> for RangeRelation {
8933    fn deserialize<D__: ::serde::Deserializer<'de>>(
8934        deserializer: D__,
8935    ) -> ::core::result::Result<Self, D__::Error> {
8936        ::oxsearch_core::__private::deserialize_string_enum(
8937            deserializer,
8938            "RangeRelation",
8939            |value| Self::from_known(value).unwrap_or_else(|| Self::Raw(value.to_owned())),
8940        )
8941    }
8942}
8943
8944#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
8945#[non_exhaustive]
8946pub struct RankFeatureFunction {}
8947
8948impl RankFeatureFunction {
8949    /// A `RankFeatureFunction` with its required properties set.
8950    pub fn new() -> Self {
8951        Self {}
8952    }
8953}
8954
8955impl RankFeatureFunction {}
8956
8957#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
8958#[non_exhaustive]
8959pub struct RankFeatureFunctionLinear {}
8960
8961impl RankFeatureFunctionLinear {
8962    /// A `RankFeatureFunctionLinear` with its required properties set.
8963    pub fn new() -> Self {
8964        Self {}
8965    }
8966}
8967
8968impl RankFeatureFunctionLinear {}
8969
8970#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
8971#[non_exhaustive]
8972pub struct RankFeatureFunctionLogarithm {
8973    /// Configurable scaling factor.
8974    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
8975    pub scaling_factor: ::core::option::Option<f32>,
8976}
8977
8978impl RankFeatureFunctionLogarithm {
8979    /// A `RankFeatureFunctionLogarithm` with its required properties set.
8980    pub fn new(scaling_factor: f32) -> Self {
8981        Self {
8982            scaling_factor: ::core::option::Option::Some(scaling_factor.into()),
8983        }
8984    }
8985}
8986
8987impl RankFeatureFunctionLogarithm {}
8988
8989#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
8990#[non_exhaustive]
8991pub struct RankFeatureFunctionSaturation {
8992    /// Configurable pivot value so that the result will be less than 0.5.
8993    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
8994    pub pivot: ::core::option::Option<f32>,
8995}
8996
8997impl RankFeatureFunctionSaturation {
8998    /// A `RankFeatureFunctionSaturation` with its required properties set.
8999    pub fn new() -> Self {
9000        Self {
9001            pivot: ::core::option::Option::None,
9002        }
9003    }
9004}
9005
9006impl RankFeatureFunctionSaturation {
9007    /// Sets `pivot`.
9008    pub fn pivot(mut self, value: f32) -> Self {
9009        self.pivot = ::core::option::Option::Some(value.into());
9010        self
9011    }
9012}
9013
9014#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
9015#[non_exhaustive]
9016pub struct RankFeatureFunctionSigmoid {
9017    /// Configurable pivot value so that the result will be less than 0.5.
9018    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
9019    pub pivot: ::core::option::Option<f32>,
9020    /// Configurable Exponent.
9021    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
9022    pub exponent: ::core::option::Option<f32>,
9023}
9024
9025impl RankFeatureFunctionSigmoid {
9026    /// A `RankFeatureFunctionSigmoid` with its required properties set.
9027    pub fn new(pivot: f32, exponent: f32) -> Self {
9028        Self {
9029            pivot: ::core::option::Option::Some(pivot.into()),
9030            exponent: ::core::option::Option::Some(exponent.into()),
9031        }
9032    }
9033}
9034
9035impl RankFeatureFunctionSigmoid {}
9036
9037#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
9038#[non_exhaustive]
9039pub struct RankFeatureQuery {
9040    /// Floating point number used to decrease or increase the relevance scores of the query.
9041    /// Boost values are relative to the default value of 1.0.
9042    /// A boost value between 0 and 1.0 decreases the relevance score.
9043    /// A value greater than 1.0 increases the relevance score.
9044    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
9045    pub boost: ::core::option::Option<f32>,
9046    #[serde(
9047        rename = "_name",
9048        skip_serializing_if = "::core::option::Option::is_none"
9049    )]
9050    pub name: ::core::option::Option<::std::string::String>,
9051    /// `rank_feature` or `rank_features` field used to boost relevance scores.
9052    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
9053    pub field: ::core::option::Option<crate::Field>,
9054    /// Saturation function used to boost relevance scores based on the value of the rank feature `field`.
9055    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
9056    pub saturation: ::core::option::Option<crate::query_dsl::RankFeatureFunctionSaturation>,
9057    /// Logarithmic function used to boost relevance scores based on the value of the rank feature `field`.
9058    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
9059    pub log: ::core::option::Option<crate::query_dsl::RankFeatureFunctionLogarithm>,
9060    /// Linear function used to boost relevance scores based on the value of the rank feature `field`.
9061    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
9062    pub linear: ::core::option::Option<crate::query_dsl::RankFeatureFunctionLinear>,
9063    /// Sigmoid function used to boost relevance scores based on the value of the rank feature `field`.
9064    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
9065    pub sigmoid: ::core::option::Option<crate::query_dsl::RankFeatureFunctionSigmoid>,
9066}
9067
9068impl RankFeatureQuery {
9069    /// A `RankFeatureQuery` with its required properties set.
9070    pub fn new(field: impl ::core::convert::Into<crate::Field>) -> Self {
9071        Self {
9072            boost: ::core::option::Option::None,
9073            name: ::core::option::Option::None,
9074            field: ::core::option::Option::Some(field.into()),
9075            saturation: ::core::option::Option::None,
9076            log: ::core::option::Option::None,
9077            linear: ::core::option::Option::None,
9078            sigmoid: ::core::option::Option::None,
9079        }
9080    }
9081}
9082
9083impl RankFeatureQuery {
9084    /// Sets `boost`.
9085    pub fn boost(mut self, value: f32) -> Self {
9086        self.boost = ::core::option::Option::Some(value.into());
9087        self
9088    }
9089    /// Sets `name`.
9090    pub fn name(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
9091        self.name = ::core::option::Option::Some(value.into());
9092        self
9093    }
9094    /// Sets `saturation`.
9095    pub fn saturation(
9096        mut self,
9097        value: impl ::core::convert::Into<crate::query_dsl::RankFeatureFunctionSaturation>,
9098    ) -> Self {
9099        self.saturation = ::core::option::Option::Some(value.into());
9100        self
9101    }
9102    /// Sets `log`.
9103    pub fn log(
9104        mut self,
9105        value: impl ::core::convert::Into<crate::query_dsl::RankFeatureFunctionLogarithm>,
9106    ) -> Self {
9107        self.log = ::core::option::Option::Some(value.into());
9108        self
9109    }
9110    /// Sets `linear`.
9111    pub fn linear(
9112        mut self,
9113        value: impl ::core::convert::Into<crate::query_dsl::RankFeatureFunctionLinear>,
9114    ) -> Self {
9115        self.linear = ::core::option::Option::Some(value.into());
9116        self
9117    }
9118    /// Sets `sigmoid`.
9119    pub fn sigmoid(
9120        mut self,
9121        value: impl ::core::convert::Into<crate::query_dsl::RankFeatureFunctionSigmoid>,
9122    ) -> Self {
9123        self.sigmoid = ::core::option::Option::Some(value.into());
9124        self
9125    }
9126}
9127
9128#[derive(Clone, Debug, PartialEq)]
9129#[non_exhaustive]
9130pub struct RegexpQuery {
9131    /// Floating point number used to decrease or increase the relevance scores of the query.
9132    /// Boost values are relative to the default value of 1.0.
9133    /// A boost value between 0 and 1.0 decreases the relevance score.
9134    /// A value greater than 1.0 increases the relevance score.
9135    pub boost: ::core::option::Option<f32>,
9136    pub name: ::core::option::Option<::std::string::String>,
9137    /// Allows case insensitive matching of the regular expression value with the indexed field values when set to `true`.
9138    /// When `false`, case sensitivity of matching depends on the underlying field’s mapping.
9139    pub case_insensitive: ::core::option::Option<bool>,
9140    /// Enables optional operators for the regular expression.
9141    pub flags: ::core::option::Option<::std::string::String>,
9142    /// Maximum number of automaton states required for the query.
9143    pub max_determinized_states: ::core::option::Option<i32>,
9144    /// Method used to rewrite the query.
9145    pub rewrite: ::core::option::Option<crate::MultiTermQueryRewrite>,
9146    /// Regular expression for terms you wish to find in the provided field.
9147    pub value: ::core::option::Option<::std::string::String>,
9148}
9149
9150impl RegexpQuery {
9151    /// A `RegexpQuery` with its required properties set.
9152    pub fn new(value: impl ::core::convert::Into<::std::string::String>) -> Self {
9153        Self {
9154            boost: ::core::option::Option::None,
9155            name: ::core::option::Option::None,
9156            case_insensitive: ::core::option::Option::None,
9157            flags: ::core::option::Option::None,
9158            max_determinized_states: ::core::option::Option::None,
9159            rewrite: ::core::option::Option::None,
9160            value: ::core::option::Option::Some(value.into()),
9161        }
9162    }
9163}
9164
9165impl RegexpQuery {
9166    /// Sets `boost`.
9167    pub fn boost(mut self, value: f32) -> Self {
9168        self.boost = ::core::option::Option::Some(value.into());
9169        self
9170    }
9171    /// Sets `name`.
9172    pub fn name(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
9173        self.name = ::core::option::Option::Some(value.into());
9174        self
9175    }
9176    /// Sets `case_insensitive`.
9177    pub fn case_insensitive(mut self, value: bool) -> Self {
9178        self.case_insensitive = ::core::option::Option::Some(value.into());
9179        self
9180    }
9181    /// Sets `flags`.
9182    pub fn flags(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
9183        self.flags = ::core::option::Option::Some(value.into());
9184        self
9185    }
9186    /// Sets `max_determinized_states`.
9187    pub fn max_determinized_states(mut self, value: i32) -> Self {
9188        self.max_determinized_states = ::core::option::Option::Some(value.into());
9189        self
9190    }
9191    /// Sets `rewrite`.
9192    pub fn rewrite(
9193        mut self,
9194        value: impl ::core::convert::Into<crate::MultiTermQueryRewrite>,
9195    ) -> Self {
9196        self.rewrite = ::core::option::Option::Some(value.into());
9197        self
9198    }
9199}
9200
9201#[derive(::serde::Serialize, ::serde::Deserialize)]
9202#[serde(remote = "RegexpQuery")]
9203struct RegexpQueryDef {
9204    /// Floating point number used to decrease or increase the relevance scores of the query.
9205    /// Boost values are relative to the default value of 1.0.
9206    /// A boost value between 0 and 1.0 decreases the relevance score.
9207    /// A value greater than 1.0 increases the relevance score.
9208    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
9209    boost: ::core::option::Option<f32>,
9210    #[serde(
9211        rename = "_name",
9212        skip_serializing_if = "::core::option::Option::is_none"
9213    )]
9214    name: ::core::option::Option<::std::string::String>,
9215    /// Allows case insensitive matching of the regular expression value with the indexed field values when set to `true`.
9216    /// When `false`, case sensitivity of matching depends on the underlying field’s mapping.
9217    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
9218    case_insensitive: ::core::option::Option<bool>,
9219    /// Enables optional operators for the regular expression.
9220    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
9221    flags: ::core::option::Option<::std::string::String>,
9222    /// Maximum number of automaton states required for the query.
9223    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
9224    max_determinized_states: ::core::option::Option<i32>,
9225    /// Method used to rewrite the query.
9226    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
9227    rewrite: ::core::option::Option<crate::MultiTermQueryRewrite>,
9228    /// Regular expression for terms you wish to find in the provided field.
9229    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
9230    value: ::core::option::Option<::std::string::String>,
9231}
9232
9233impl ::serde::Serialize for RegexpQuery {
9234    fn serialize<S__: ::serde::Serializer>(
9235        &self,
9236        serializer: S__,
9237    ) -> ::core::result::Result<S__::Ok, S__::Error> {
9238        if let (::core::option::Option::Some(short), true) = (
9239            &self.value,
9240            self.boost.is_none()
9241                && self.name.is_none()
9242                && self.case_insensitive.is_none()
9243                && self.flags.is_none()
9244                && self.max_determinized_states.is_none()
9245                && self.rewrite.is_none(),
9246        ) {
9247            return ::serde::Serialize::serialize(short, serializer);
9248        }
9249        RegexpQueryDef::serialize(self, serializer)
9250    }
9251}
9252
9253impl<'de> ::oxsearch_core::__private::Shorthand<'de> for RegexpQuery {
9254    type Short = ::std::string::String;
9255    fn from_short(short: ::std::string::String) -> Self {
9256        Self {
9257            boost: ::core::option::Option::None,
9258            name: ::core::option::Option::None,
9259            case_insensitive: ::core::option::Option::None,
9260            flags: ::core::option::Option::None,
9261            max_determinized_states: ::core::option::Option::None,
9262            rewrite: ::core::option::Option::None,
9263            value: ::core::option::Option::Some(short),
9264        }
9265    }
9266    fn deserialize_full<D__: ::serde::Deserializer<'de>>(
9267        deserializer: D__,
9268    ) -> ::core::result::Result<Self, D__::Error> {
9269        RegexpQueryDef::deserialize(deserializer)
9270    }
9271}
9272
9273impl<'de> ::serde::Deserialize<'de> for RegexpQuery {
9274    fn deserialize<D__: ::serde::Deserializer<'de>>(
9275        deserializer: D__,
9276    ) -> ::core::result::Result<Self, D__::Error> {
9277        ::oxsearch_core::__private::deserialize_shorthand(deserializer)
9278    }
9279}
9280
9281#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
9282#[non_exhaustive]
9283pub struct RuleQuery {
9284    /// Floating point number used to decrease or increase the relevance scores of the query.
9285    /// Boost values are relative to the default value of 1.0.
9286    /// A boost value between 0 and 1.0 decreases the relevance score.
9287    /// A value greater than 1.0 increases the relevance score.
9288    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
9289    pub boost: ::core::option::Option<f32>,
9290    #[serde(
9291        rename = "_name",
9292        skip_serializing_if = "::core::option::Option::is_none"
9293    )]
9294    pub name: ::core::option::Option<::std::string::String>,
9295    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
9296    pub organic: ::core::option::Option<crate::query_dsl::QueryContainer>,
9297    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
9298    pub ruleset_ids: ::core::option::Option<::oxsearch_core::shapes::OneOrMany<crate::Id>>,
9299    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
9300    pub ruleset_id: ::core::option::Option<::std::string::String>,
9301    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
9302    pub match_criteria: ::core::option::Option<::serde_json::Value>,
9303}
9304
9305impl RuleQuery {
9306    /// A `RuleQuery` with its required properties set.
9307    pub fn new(
9308        organic: impl ::core::convert::Into<crate::query_dsl::QueryContainer>,
9309        match_criteria: impl ::core::convert::Into<::serde_json::Value>,
9310    ) -> Self {
9311        Self {
9312            boost: ::core::option::Option::None,
9313            name: ::core::option::Option::None,
9314            organic: ::core::option::Option::Some(organic.into()),
9315            ruleset_ids: ::core::option::Option::None,
9316            ruleset_id: ::core::option::Option::None,
9317            match_criteria: ::core::option::Option::Some(match_criteria.into()),
9318        }
9319    }
9320}
9321
9322impl RuleQuery {
9323    /// Sets `boost`.
9324    pub fn boost(mut self, value: f32) -> Self {
9325        self.boost = ::core::option::Option::Some(value.into());
9326        self
9327    }
9328    /// Sets `name`.
9329    pub fn name(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
9330        self.name = ::core::option::Option::Some(value.into());
9331        self
9332    }
9333    /// Sets `ruleset_ids`.
9334    pub fn ruleset_ids(
9335        mut self,
9336        value: impl ::core::convert::Into<::oxsearch_core::shapes::OneOrMany<crate::Id>>,
9337    ) -> Self {
9338        self.ruleset_ids = ::core::option::Option::Some(value.into());
9339        self
9340    }
9341    /// Sets `ruleset_id`.
9342    pub fn ruleset_id(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
9343        self.ruleset_id = ::core::option::Option::Some(value.into());
9344        self
9345    }
9346}
9347
9348#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
9349#[non_exhaustive]
9350pub struct ScriptQuery {
9351    /// Floating point number used to decrease or increase the relevance scores of the query.
9352    /// Boost values are relative to the default value of 1.0.
9353    /// A boost value between 0 and 1.0 decreases the relevance score.
9354    /// A value greater than 1.0 increases the relevance score.
9355    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
9356    pub boost: ::core::option::Option<f32>,
9357    #[serde(
9358        rename = "_name",
9359        skip_serializing_if = "::core::option::Option::is_none"
9360    )]
9361    pub name: ::core::option::Option<::std::string::String>,
9362    /// Contains a script to run as a query.
9363    /// This script must return a boolean value, `true` or `false`.
9364    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
9365    pub script: ::core::option::Option<crate::Script>,
9366}
9367
9368impl ScriptQuery {
9369    /// A `ScriptQuery` with its required properties set.
9370    pub fn new(script: impl ::core::convert::Into<crate::Script>) -> Self {
9371        Self {
9372            boost: ::core::option::Option::None,
9373            name: ::core::option::Option::None,
9374            script: ::core::option::Option::Some(script.into()),
9375        }
9376    }
9377}
9378
9379impl ScriptQuery {
9380    /// Sets `boost`.
9381    pub fn boost(mut self, value: f32) -> Self {
9382        self.boost = ::core::option::Option::Some(value.into());
9383        self
9384    }
9385    /// Sets `name`.
9386    pub fn name(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
9387        self.name = ::core::option::Option::Some(value.into());
9388        self
9389    }
9390}
9391
9392#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
9393#[non_exhaustive]
9394pub struct ScriptScoreFunction {
9395    /// A script that computes a score.
9396    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
9397    pub script: ::core::option::Option<crate::Script>,
9398}
9399
9400impl ScriptScoreFunction {
9401    /// A `ScriptScoreFunction` with its required properties set.
9402    pub fn new(script: impl ::core::convert::Into<crate::Script>) -> Self {
9403        Self {
9404            script: ::core::option::Option::Some(script.into()),
9405        }
9406    }
9407}
9408
9409impl ScriptScoreFunction {}
9410
9411#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
9412#[non_exhaustive]
9413pub struct ScriptScoreQuery {
9414    /// Floating point number used to decrease or increase the relevance scores of the query.
9415    /// Boost values are relative to the default value of 1.0.
9416    /// A boost value between 0 and 1.0 decreases the relevance score.
9417    /// A value greater than 1.0 increases the relevance score.
9418    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
9419    pub boost: ::core::option::Option<f32>,
9420    #[serde(
9421        rename = "_name",
9422        skip_serializing_if = "::core::option::Option::is_none"
9423    )]
9424    pub name: ::core::option::Option<::std::string::String>,
9425    /// Documents with a score lower than this floating point number are excluded from the search results.
9426    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
9427    pub min_score: ::core::option::Option<f32>,
9428    /// Query used to return documents.
9429    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
9430    pub query: ::core::option::Option<crate::query_dsl::QueryContainer>,
9431    /// Script used to compute the score of documents returned by the query.
9432    /// Important: final relevance scores from the `script_score` query cannot be negative.
9433    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
9434    pub script: ::core::option::Option<crate::Script>,
9435}
9436
9437impl ScriptScoreQuery {
9438    /// A `ScriptScoreQuery` with its required properties set.
9439    pub fn new(
9440        query: impl ::core::convert::Into<crate::query_dsl::QueryContainer>,
9441        script: impl ::core::convert::Into<crate::Script>,
9442    ) -> Self {
9443        Self {
9444            boost: ::core::option::Option::None,
9445            name: ::core::option::Option::None,
9446            min_score: ::core::option::Option::None,
9447            query: ::core::option::Option::Some(query.into()),
9448            script: ::core::option::Option::Some(script.into()),
9449        }
9450    }
9451}
9452
9453impl ScriptScoreQuery {
9454    /// Sets `boost`.
9455    pub fn boost(mut self, value: f32) -> Self {
9456        self.boost = ::core::option::Option::Some(value.into());
9457        self
9458    }
9459    /// Sets `name`.
9460    pub fn name(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
9461        self.name = ::core::option::Option::Some(value.into());
9462        self
9463    }
9464    /// Sets `min_score`.
9465    pub fn min_score(mut self, value: f32) -> Self {
9466        self.min_score = ::core::option::Option::Some(value.into());
9467        self
9468    }
9469}
9470
9471#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
9472#[non_exhaustive]
9473pub struct SemanticQuery {
9474    /// Floating point number used to decrease or increase the relevance scores of the query.
9475    /// Boost values are relative to the default value of 1.0.
9476    /// A boost value between 0 and 1.0 decreases the relevance score.
9477    /// A value greater than 1.0 increases the relevance score.
9478    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
9479    pub boost: ::core::option::Option<f32>,
9480    #[serde(
9481        rename = "_name",
9482        skip_serializing_if = "::core::option::Option::is_none"
9483    )]
9484    pub name: ::core::option::Option<::std::string::String>,
9485    /// The field to query, which must be a semantic_text field type
9486    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
9487    pub field: ::core::option::Option<::std::string::String>,
9488    /// The query text
9489    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
9490    pub query: ::core::option::Option<::std::string::String>,
9491}
9492
9493impl SemanticQuery {
9494    /// A `SemanticQuery` with its required properties set.
9495    pub fn new(
9496        field: impl ::core::convert::Into<::std::string::String>,
9497        query: impl ::core::convert::Into<::std::string::String>,
9498    ) -> Self {
9499        Self {
9500            boost: ::core::option::Option::None,
9501            name: ::core::option::Option::None,
9502            field: ::core::option::Option::Some(field.into()),
9503            query: ::core::option::Option::Some(query.into()),
9504        }
9505    }
9506}
9507
9508impl SemanticQuery {
9509    /// Sets `boost`.
9510    pub fn boost(mut self, value: f32) -> Self {
9511        self.boost = ::core::option::Option::Some(value.into());
9512        self
9513    }
9514    /// Sets `name`.
9515    pub fn name(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
9516        self.name = ::core::option::Option::Some(value.into());
9517        self
9518    }
9519}
9520
9521#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
9522#[non_exhaustive]
9523pub struct ShapeFieldQuery {
9524    /// Queries using a pre-indexed shape.
9525    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
9526    pub indexed_shape: ::core::option::Option<crate::query_dsl::FieldLookup>,
9527    /// Spatial relation between the query shape and the document shape.
9528    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
9529    pub relation: ::core::option::Option<crate::GeoShapeRelation>,
9530    /// Queries using an inline shape definition in GeoJSON or Well Known Text (WKT) format.
9531    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
9532    pub shape: ::core::option::Option<crate::GeoShape>,
9533}
9534
9535impl ShapeFieldQuery {
9536    /// A `ShapeFieldQuery` with its required properties set.
9537    pub fn new() -> Self {
9538        Self {
9539            indexed_shape: ::core::option::Option::None,
9540            relation: ::core::option::Option::None,
9541            shape: ::core::option::Option::None,
9542        }
9543    }
9544}
9545
9546impl ShapeFieldQuery {
9547    /// Sets `indexed_shape`.
9548    pub fn indexed_shape(
9549        mut self,
9550        value: impl ::core::convert::Into<crate::query_dsl::FieldLookup>,
9551    ) -> Self {
9552        self.indexed_shape = ::core::option::Option::Some(value.into());
9553        self
9554    }
9555    /// Sets `relation`.
9556    pub fn relation(mut self, value: impl ::core::convert::Into<crate::GeoShapeRelation>) -> Self {
9557        self.relation = ::core::option::Option::Some(value.into());
9558        self
9559    }
9560    /// Sets `shape`.
9561    pub fn shape(mut self, value: impl ::core::convert::Into<crate::GeoShape>) -> Self {
9562        self.shape = ::core::option::Option::Some(value.into());
9563        self
9564    }
9565}
9566
9567#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
9568#[serde(try_from = "ShapeQueryRepr", into = "ShapeQueryRepr")]
9569#[non_exhaustive]
9570pub struct ShapeQuery {
9571    /// Floating point number used to decrease or increase the relevance scores of the query.
9572    /// Boost values are relative to the default value of 1.0.
9573    /// A boost value between 0 and 1.0 decreases the relevance score.
9574    /// A value greater than 1.0 increases the relevance score.
9575    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
9576    pub boost: ::core::option::Option<f32>,
9577    #[serde(
9578        rename = "_name",
9579        skip_serializing_if = "::core::option::Option::is_none"
9580    )]
9581    pub name: ::core::option::Option<::std::string::String>,
9582    /// When set to `true` the query ignores an unmapped field and will not match any documents.
9583    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
9584    pub ignore_unmapped: ::core::option::Option<bool>,
9585    /// The name of the property that holds `shape`.
9586    pub field: crate::Field,
9587    /// The value under `field`.
9588    pub shape: crate::query_dsl::ShapeFieldQuery,
9589}
9590
9591impl ShapeQuery {
9592    /// A `ShapeQuery` with its required properties set.
9593    pub fn new(
9594        field: impl ::core::convert::Into<crate::Field>,
9595        shape: impl ::core::convert::Into<crate::query_dsl::ShapeFieldQuery>,
9596    ) -> Self {
9597        Self {
9598            boost: ::core::option::Option::None,
9599            name: ::core::option::Option::None,
9600            ignore_unmapped: ::core::option::Option::None,
9601            field: field.into(),
9602            shape: shape.into(),
9603        }
9604    }
9605}
9606
9607impl ShapeQuery {
9608    /// Sets `boost`.
9609    pub fn boost(mut self, value: f32) -> Self {
9610        self.boost = ::core::option::Option::Some(value.into());
9611        self
9612    }
9613    /// Sets `name`.
9614    pub fn name(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
9615        self.name = ::core::option::Option::Some(value.into());
9616        self
9617    }
9618    /// Sets `ignore_unmapped`.
9619    pub fn ignore_unmapped(mut self, value: bool) -> Self {
9620        self.ignore_unmapped = ::core::option::Option::Some(value.into());
9621        self
9622    }
9623}
9624
9625#[derive(::serde::Serialize, ::serde::Deserialize)]
9626struct ShapeQueryRepr {
9627    /// Floating point number used to decrease or increase the relevance scores of the query.
9628    /// Boost values are relative to the default value of 1.0.
9629    /// A boost value between 0 and 1.0 decreases the relevance score.
9630    /// A value greater than 1.0 increases the relevance score.
9631    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
9632    boost: ::core::option::Option<f32>,
9633    #[serde(
9634        rename = "_name",
9635        skip_serializing_if = "::core::option::Option::is_none"
9636    )]
9637    name: ::core::option::Option<::std::string::String>,
9638    /// When set to `true` the query ignores an unmapped field and will not match any documents.
9639    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
9640    ignore_unmapped: ::core::option::Option<bool>,
9641    #[serde(flatten)]
9642    keyed__: ::indexmap::IndexMap<crate::Field, crate::query_dsl::ShapeFieldQuery>,
9643}
9644
9645impl ::core::convert::TryFrom<ShapeQueryRepr> for ShapeQuery {
9646    type Error = ::std::string::String;
9647    fn try_from(repr: ShapeQueryRepr) -> ::core::result::Result<Self, Self::Error> {
9648        let mut keyed = repr.keyed__.into_iter();
9649        match (keyed.next(), keyed.next()) {
9650            (::core::option::Option::Some((field, shape)), ::core::option::Option::None) => {
9651                ::core::result::Result::Ok(Self {
9652                    boost: repr.boost,
9653                    name: repr.name,
9654                    ignore_unmapped: repr.ignore_unmapped,
9655                    field,
9656                    shape,
9657                })
9658            }
9659            _ => ::core::result::Result::Err(::std::string::String::from(
9660                "ShapeQuery needs exactly one property keyed by its field",
9661            )),
9662        }
9663    }
9664}
9665
9666impl ::core::convert::From<ShapeQuery> for ShapeQueryRepr {
9667    fn from(value: ShapeQuery) -> Self {
9668        let mut keyed__ = ::indexmap::IndexMap::new();
9669        keyed__.insert(value.field, value.shape);
9670        Self {
9671            boost: value.boost,
9672            name: value.name,
9673            ignore_unmapped: value.ignore_unmapped,
9674            keyed__,
9675        }
9676    }
9677}
9678
9679#[derive(Clone, Debug, PartialEq, Eq, Hash)]
9680#[non_exhaustive]
9681pub enum SimpleQueryStringFlag {
9682    /// Disables all operators.
9683    None,
9684    /// Enables the `+` AND operator.
9685    And,
9686    /// Enables the `-` NOT operator.
9687    Not,
9688    /// Enables the `\|` OR operator.
9689    Or,
9690    /// Enables the `*` prefix operator.
9691    Prefix,
9692    /// Enables the `"` quotes operator used to search for phrases.
9693    Phrase,
9694    /// Enables the `(` and `)` operators to control operator precedence.
9695    Precedence,
9696    /// Enables `\` as an escape character.
9697    Escape,
9698    /// Enables whitespace as split characters.
9699    Whitespace,
9700    /// Enables the `~N` operator after a word, where `N` is an integer denoting the allowed edit distance for matching.
9701    Fuzzy,
9702    /// Enables the `~N` operator, after a phrase where `N` is the maximum number of positions allowed between matching tokens.
9703    /// Synonymous to `SLOP`.
9704    Near,
9705    /// Enables the `~N` operator, after a phrase where `N` is maximum number of positions allowed between matching tokens.
9706    /// Synonymous to `NEAR`.
9707    Slop,
9708    /// Enables all optional operators.
9709    All,
9710    /// A value this version of the specification doesn't list.
9711    Raw(::std::string::String),
9712}
9713
9714impl SimpleQueryStringFlag {
9715    /// The value as Elasticsearch writes it.
9716    pub fn as_str(&self) -> &str {
9717        match self {
9718            Self::None => "NONE",
9719            Self::And => "AND",
9720            Self::Not => "NOT",
9721            Self::Or => "OR",
9722            Self::Prefix => "PREFIX",
9723            Self::Phrase => "PHRASE",
9724            Self::Precedence => "PRECEDENCE",
9725            Self::Escape => "ESCAPE",
9726            Self::Whitespace => "WHITESPACE",
9727            Self::Fuzzy => "FUZZY",
9728            Self::Near => "NEAR",
9729            Self::Slop => "SLOP",
9730            Self::All => "ALL",
9731            Self::Raw(value) => value,
9732        }
9733    }
9734
9735    /// The listed value with this name, if there is one.
9736    pub fn from_known(value: &str) -> ::core::option::Option<Self> {
9737        match value {
9738            "NONE" => ::core::option::Option::Some(Self::None),
9739            "AND" => ::core::option::Option::Some(Self::And),
9740            "NOT" => ::core::option::Option::Some(Self::Not),
9741            "OR" => ::core::option::Option::Some(Self::Or),
9742            "PREFIX" => ::core::option::Option::Some(Self::Prefix),
9743            "PHRASE" => ::core::option::Option::Some(Self::Phrase),
9744            "PRECEDENCE" => ::core::option::Option::Some(Self::Precedence),
9745            "ESCAPE" => ::core::option::Option::Some(Self::Escape),
9746            "WHITESPACE" => ::core::option::Option::Some(Self::Whitespace),
9747            "FUZZY" => ::core::option::Option::Some(Self::Fuzzy),
9748            "NEAR" => ::core::option::Option::Some(Self::Near),
9749            "SLOP" => ::core::option::Option::Some(Self::Slop),
9750            "ALL" => ::core::option::Option::Some(Self::All),
9751            _ => ::core::option::Option::None,
9752        }
9753    }
9754}
9755
9756impl ::serde::Serialize for SimpleQueryStringFlag {
9757    fn serialize<S__: ::serde::Serializer>(
9758        &self,
9759        serializer: S__,
9760    ) -> ::core::result::Result<S__::Ok, S__::Error> {
9761        serializer.serialize_str(self.as_str())
9762    }
9763}
9764
9765impl<'de> ::serde::Deserialize<'de> for SimpleQueryStringFlag {
9766    fn deserialize<D__: ::serde::Deserializer<'de>>(
9767        deserializer: D__,
9768    ) -> ::core::result::Result<Self, D__::Error> {
9769        ::oxsearch_core::__private::deserialize_string_enum(
9770            deserializer,
9771            "SimpleQueryStringFlag",
9772            |value| Self::from_known(value).unwrap_or_else(|| Self::Raw(value.to_owned())),
9773        )
9774    }
9775}
9776
9777/// Query flags can be either a single flag or a combination of flags, e.g. `OR|AND|PREFIX`
9778pub type SimpleQueryStringFlags =
9779    ::oxsearch_core::shapes::PipeSeparatedFlags<crate::query_dsl::SimpleQueryStringFlag>;
9780
9781#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
9782#[non_exhaustive]
9783pub struct SimpleQueryStringQuery {
9784    /// Floating point number used to decrease or increase the relevance scores of the query.
9785    /// Boost values are relative to the default value of 1.0.
9786    /// A boost value between 0 and 1.0 decreases the relevance score.
9787    /// A value greater than 1.0 increases the relevance score.
9788    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
9789    pub boost: ::core::option::Option<f32>,
9790    #[serde(
9791        rename = "_name",
9792        skip_serializing_if = "::core::option::Option::is_none"
9793    )]
9794    pub name: ::core::option::Option<::std::string::String>,
9795    /// Analyzer used to convert text in the query string into tokens.
9796    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
9797    pub analyzer: ::core::option::Option<::std::string::String>,
9798    /// If `true`, the query attempts to analyze wildcard terms in the query string.
9799    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
9800    pub analyze_wildcard: ::core::option::Option<bool>,
9801    /// If `true`, the parser creates a match_phrase query for each multi-position token.
9802    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
9803    pub auto_generate_synonyms_phrase_query: ::core::option::Option<bool>,
9804    /// Default boolean logic used to interpret text in the query string if no operators are specified.
9805    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
9806    pub default_operator: ::core::option::Option<crate::query_dsl::Operator>,
9807    /// Array of fields you wish to search.
9808    /// Accepts wildcard expressions.
9809    /// You also can boost relevance scores for matches to particular fields using a caret (`^`) notation.
9810    /// Defaults to the `index.query.default_field index` setting, which has a default value of `*`.
9811    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
9812    pub fields: ::core::option::Option<::std::vec::Vec<crate::Field>>,
9813    /// List of enabled operators for the simple query string syntax.
9814    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
9815    pub flags: ::core::option::Option<crate::query_dsl::SimpleQueryStringFlags>,
9816    /// Maximum number of terms to which the query expands for fuzzy matching.
9817    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
9818    pub fuzzy_max_expansions: ::core::option::Option<i32>,
9819    /// Number of beginning characters left unchanged for fuzzy matching.
9820    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
9821    pub fuzzy_prefix_length: ::core::option::Option<i32>,
9822    /// If `true`, edits for fuzzy matching include transpositions of two adjacent characters (for example, `ab` to `ba`).
9823    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
9824    pub fuzzy_transpositions: ::core::option::Option<bool>,
9825    /// If `true`, format-based errors, such as providing a text value for a numeric field, are ignored.
9826    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
9827    pub lenient: ::core::option::Option<bool>,
9828    /// Minimum number of clauses that must match for a document to be returned.
9829    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
9830    pub minimum_should_match: ::core::option::Option<crate::MinimumShouldMatch>,
9831    /// Query string in the simple query string syntax you wish to parse and use for search.
9832    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
9833    pub query: ::core::option::Option<::std::string::String>,
9834    /// Suffix appended to quoted text in the query string.
9835    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
9836    pub quote_field_suffix: ::core::option::Option<::std::string::String>,
9837}
9838
9839impl SimpleQueryStringQuery {
9840    /// A `SimpleQueryStringQuery` with its required properties set.
9841    pub fn new(query: impl ::core::convert::Into<::std::string::String>) -> Self {
9842        Self {
9843            boost: ::core::option::Option::None,
9844            name: ::core::option::Option::None,
9845            analyzer: ::core::option::Option::None,
9846            analyze_wildcard: ::core::option::Option::None,
9847            auto_generate_synonyms_phrase_query: ::core::option::Option::None,
9848            default_operator: ::core::option::Option::None,
9849            fields: ::core::option::Option::None,
9850            flags: ::core::option::Option::None,
9851            fuzzy_max_expansions: ::core::option::Option::None,
9852            fuzzy_prefix_length: ::core::option::Option::None,
9853            fuzzy_transpositions: ::core::option::Option::None,
9854            lenient: ::core::option::Option::None,
9855            minimum_should_match: ::core::option::Option::None,
9856            query: ::core::option::Option::Some(query.into()),
9857            quote_field_suffix: ::core::option::Option::None,
9858        }
9859    }
9860}
9861
9862impl SimpleQueryStringQuery {
9863    /// Sets `boost`.
9864    pub fn boost(mut self, value: f32) -> Self {
9865        self.boost = ::core::option::Option::Some(value.into());
9866        self
9867    }
9868    /// Sets `name`.
9869    pub fn name(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
9870        self.name = ::core::option::Option::Some(value.into());
9871        self
9872    }
9873    /// Sets `analyzer`.
9874    pub fn analyzer(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
9875        self.analyzer = ::core::option::Option::Some(value.into());
9876        self
9877    }
9878    /// Sets `analyze_wildcard`.
9879    pub fn analyze_wildcard(mut self, value: bool) -> Self {
9880        self.analyze_wildcard = ::core::option::Option::Some(value.into());
9881        self
9882    }
9883    /// Sets `auto_generate_synonyms_phrase_query`.
9884    pub fn auto_generate_synonyms_phrase_query(mut self, value: bool) -> Self {
9885        self.auto_generate_synonyms_phrase_query = ::core::option::Option::Some(value.into());
9886        self
9887    }
9888    /// Sets `default_operator`.
9889    pub fn default_operator(
9890        mut self,
9891        value: impl ::core::convert::Into<crate::query_dsl::Operator>,
9892    ) -> Self {
9893        self.default_operator = ::core::option::Option::Some(value.into());
9894        self
9895    }
9896    /// Sets `fields`.
9897    pub fn fields(
9898        mut self,
9899        value: impl ::core::convert::Into<::std::vec::Vec<crate::Field>>,
9900    ) -> Self {
9901        self.fields = ::core::option::Option::Some(value.into());
9902        self
9903    }
9904    /// Sets `flags`.
9905    pub fn flags(
9906        mut self,
9907        value: impl ::core::convert::Into<crate::query_dsl::SimpleQueryStringFlags>,
9908    ) -> Self {
9909        self.flags = ::core::option::Option::Some(value.into());
9910        self
9911    }
9912    /// Sets `fuzzy_max_expansions`.
9913    pub fn fuzzy_max_expansions(mut self, value: i32) -> Self {
9914        self.fuzzy_max_expansions = ::core::option::Option::Some(value.into());
9915        self
9916    }
9917    /// Sets `fuzzy_prefix_length`.
9918    pub fn fuzzy_prefix_length(mut self, value: i32) -> Self {
9919        self.fuzzy_prefix_length = ::core::option::Option::Some(value.into());
9920        self
9921    }
9922    /// Sets `fuzzy_transpositions`.
9923    pub fn fuzzy_transpositions(mut self, value: bool) -> Self {
9924        self.fuzzy_transpositions = ::core::option::Option::Some(value.into());
9925        self
9926    }
9927    /// Sets `lenient`.
9928    pub fn lenient(mut self, value: bool) -> Self {
9929        self.lenient = ::core::option::Option::Some(value.into());
9930        self
9931    }
9932    /// Sets `minimum_should_match`.
9933    pub fn minimum_should_match(
9934        mut self,
9935        value: impl ::core::convert::Into<crate::MinimumShouldMatch>,
9936    ) -> Self {
9937        self.minimum_should_match = ::core::option::Option::Some(value.into());
9938        self
9939    }
9940    /// Sets `quote_field_suffix`.
9941    pub fn quote_field_suffix(
9942        mut self,
9943        value: impl ::core::convert::Into<::std::string::String>,
9944    ) -> Self {
9945        self.quote_field_suffix = ::core::option::Option::Some(value.into());
9946        self
9947    }
9948}
9949
9950#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
9951#[non_exhaustive]
9952pub struct SpanContainingQuery {
9953    /// Floating point number used to decrease or increase the relevance scores of the query.
9954    /// Boost values are relative to the default value of 1.0.
9955    /// A boost value between 0 and 1.0 decreases the relevance score.
9956    /// A value greater than 1.0 increases the relevance score.
9957    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
9958    pub boost: ::core::option::Option<f32>,
9959    #[serde(
9960        rename = "_name",
9961        skip_serializing_if = "::core::option::Option::is_none"
9962    )]
9963    pub name: ::core::option::Option<::std::string::String>,
9964    /// Can be any span query.
9965    /// Matching spans from `big` that contain matches from `little` are returned.
9966    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
9967    pub big: ::core::option::Option<crate::query_dsl::SpanQuery>,
9968    /// Can be any span query.
9969    /// Matching spans from `big` that contain matches from `little` are returned.
9970    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
9971    pub little: ::core::option::Option<crate::query_dsl::SpanQuery>,
9972}
9973
9974impl SpanContainingQuery {
9975    /// A `SpanContainingQuery` with its required properties set.
9976    pub fn new(
9977        big: impl ::core::convert::Into<crate::query_dsl::SpanQuery>,
9978        little: impl ::core::convert::Into<crate::query_dsl::SpanQuery>,
9979    ) -> Self {
9980        Self {
9981            boost: ::core::option::Option::None,
9982            name: ::core::option::Option::None,
9983            big: ::core::option::Option::Some(big.into()),
9984            little: ::core::option::Option::Some(little.into()),
9985        }
9986    }
9987}
9988
9989impl SpanContainingQuery {
9990    /// Sets `boost`.
9991    pub fn boost(mut self, value: f32) -> Self {
9992        self.boost = ::core::option::Option::Some(value.into());
9993        self
9994    }
9995    /// Sets `name`.
9996    pub fn name(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
9997        self.name = ::core::option::Option::Some(value.into());
9998        self
9999    }
10000}
10001
10002#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
10003#[non_exhaustive]
10004pub struct SpanFieldMaskingQuery {
10005    /// Floating point number used to decrease or increase the relevance scores of the query.
10006    /// Boost values are relative to the default value of 1.0.
10007    /// A boost value between 0 and 1.0 decreases the relevance score.
10008    /// A value greater than 1.0 increases the relevance score.
10009    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
10010    pub boost: ::core::option::Option<f32>,
10011    #[serde(
10012        rename = "_name",
10013        skip_serializing_if = "::core::option::Option::is_none"
10014    )]
10015    pub name: ::core::option::Option<::std::string::String>,
10016    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
10017    pub field: ::core::option::Option<crate::Field>,
10018    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
10019    pub query: ::core::option::Option<crate::query_dsl::SpanQuery>,
10020}
10021
10022impl SpanFieldMaskingQuery {
10023    /// A `SpanFieldMaskingQuery` with its required properties set.
10024    pub fn new(
10025        field: impl ::core::convert::Into<crate::Field>,
10026        query: impl ::core::convert::Into<crate::query_dsl::SpanQuery>,
10027    ) -> Self {
10028        Self {
10029            boost: ::core::option::Option::None,
10030            name: ::core::option::Option::None,
10031            field: ::core::option::Option::Some(field.into()),
10032            query: ::core::option::Option::Some(query.into()),
10033        }
10034    }
10035}
10036
10037impl SpanFieldMaskingQuery {
10038    /// Sets `boost`.
10039    pub fn boost(mut self, value: f32) -> Self {
10040        self.boost = ::core::option::Option::Some(value.into());
10041        self
10042    }
10043    /// Sets `name`.
10044    pub fn name(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
10045        self.name = ::core::option::Option::Some(value.into());
10046        self
10047    }
10048}
10049
10050#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
10051#[non_exhaustive]
10052pub struct SpanFirstQuery {
10053    /// Floating point number used to decrease or increase the relevance scores of the query.
10054    /// Boost values are relative to the default value of 1.0.
10055    /// A boost value between 0 and 1.0 decreases the relevance score.
10056    /// A value greater than 1.0 increases the relevance score.
10057    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
10058    pub boost: ::core::option::Option<f32>,
10059    #[serde(
10060        rename = "_name",
10061        skip_serializing_if = "::core::option::Option::is_none"
10062    )]
10063    pub name: ::core::option::Option<::std::string::String>,
10064    /// Controls the maximum end position permitted in a match.
10065    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
10066    pub end: ::core::option::Option<i32>,
10067    /// Can be any other span type query.
10068    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
10069    pub r#match: ::core::option::Option<crate::query_dsl::SpanQuery>,
10070}
10071
10072impl SpanFirstQuery {
10073    /// A `SpanFirstQuery` with its required properties set.
10074    pub fn new(end: i32, r#match: impl ::core::convert::Into<crate::query_dsl::SpanQuery>) -> Self {
10075        Self {
10076            boost: ::core::option::Option::None,
10077            name: ::core::option::Option::None,
10078            end: ::core::option::Option::Some(end.into()),
10079            r#match: ::core::option::Option::Some(r#match.into()),
10080        }
10081    }
10082}
10083
10084impl SpanFirstQuery {
10085    /// Sets `boost`.
10086    pub fn boost(mut self, value: f32) -> Self {
10087        self.boost = ::core::option::Option::Some(value.into());
10088        self
10089    }
10090    /// Sets `name`.
10091    pub fn name(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
10092        self.name = ::core::option::Option::Some(value.into());
10093        self
10094    }
10095}
10096
10097/// Can only be used as a clause in a span_near query.
10098pub type SpanGapQuery = ::oxsearch_core::shapes::SingleKey<crate::Field, i32>;
10099
10100#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
10101#[non_exhaustive]
10102pub struct SpanMultiTermQuery {
10103    /// Floating point number used to decrease or increase the relevance scores of the query.
10104    /// Boost values are relative to the default value of 1.0.
10105    /// A boost value between 0 and 1.0 decreases the relevance score.
10106    /// A value greater than 1.0 increases the relevance score.
10107    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
10108    pub boost: ::core::option::Option<f32>,
10109    #[serde(
10110        rename = "_name",
10111        skip_serializing_if = "::core::option::Option::is_none"
10112    )]
10113    pub name: ::core::option::Option<::std::string::String>,
10114    /// Should be a multi term query (one of `wildcard`, `fuzzy`, `prefix`, `range`, or `regexp` query).
10115    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
10116    pub r#match: ::core::option::Option<crate::query_dsl::QueryContainer>,
10117}
10118
10119impl SpanMultiTermQuery {
10120    /// A `SpanMultiTermQuery` with its required properties set.
10121    pub fn new(r#match: impl ::core::convert::Into<crate::query_dsl::QueryContainer>) -> Self {
10122        Self {
10123            boost: ::core::option::Option::None,
10124            name: ::core::option::Option::None,
10125            r#match: ::core::option::Option::Some(r#match.into()),
10126        }
10127    }
10128}
10129
10130impl SpanMultiTermQuery {
10131    /// Sets `boost`.
10132    pub fn boost(mut self, value: f32) -> Self {
10133        self.boost = ::core::option::Option::Some(value.into());
10134        self
10135    }
10136    /// Sets `name`.
10137    pub fn name(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
10138        self.name = ::core::option::Option::Some(value.into());
10139        self
10140    }
10141}
10142
10143#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
10144#[non_exhaustive]
10145pub struct SpanNearQuery {
10146    /// Floating point number used to decrease or increase the relevance scores of the query.
10147    /// Boost values are relative to the default value of 1.0.
10148    /// A boost value between 0 and 1.0 decreases the relevance score.
10149    /// A value greater than 1.0 increases the relevance score.
10150    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
10151    pub boost: ::core::option::Option<f32>,
10152    #[serde(
10153        rename = "_name",
10154        skip_serializing_if = "::core::option::Option::is_none"
10155    )]
10156    pub name: ::core::option::Option<::std::string::String>,
10157    /// Array of one or more other span type queries.
10158    #[serde(default = "::core::default::Default::default")]
10159    pub clauses: ::std::vec::Vec<crate::query_dsl::SpanQuery>,
10160    /// Controls whether matches are required to be in-order.
10161    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
10162    pub in_order: ::core::option::Option<bool>,
10163    /// Controls the maximum number of intervening unmatched positions permitted.
10164    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
10165    pub slop: ::core::option::Option<i32>,
10166}
10167
10168impl SpanNearQuery {
10169    /// A `SpanNearQuery` with its required properties set.
10170    pub fn new(
10171        clauses: impl ::core::convert::Into<::std::vec::Vec<crate::query_dsl::SpanQuery>>,
10172    ) -> Self {
10173        Self {
10174            boost: ::core::option::Option::None,
10175            name: ::core::option::Option::None,
10176            clauses: clauses.into(),
10177            in_order: ::core::option::Option::None,
10178            slop: ::core::option::Option::None,
10179        }
10180    }
10181}
10182
10183impl SpanNearQuery {
10184    /// Sets `boost`.
10185    pub fn boost(mut self, value: f32) -> Self {
10186        self.boost = ::core::option::Option::Some(value.into());
10187        self
10188    }
10189    /// Sets `name`.
10190    pub fn name(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
10191        self.name = ::core::option::Option::Some(value.into());
10192        self
10193    }
10194    /// Sets `in_order`.
10195    pub fn in_order(mut self, value: bool) -> Self {
10196        self.in_order = ::core::option::Option::Some(value.into());
10197        self
10198    }
10199    /// Sets `slop`.
10200    pub fn slop(mut self, value: i32) -> Self {
10201        self.slop = ::core::option::Option::Some(value.into());
10202        self
10203    }
10204}
10205
10206#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
10207#[non_exhaustive]
10208pub struct SpanNotQuery {
10209    /// Floating point number used to decrease or increase the relevance scores of the query.
10210    /// Boost values are relative to the default value of 1.0.
10211    /// A boost value between 0 and 1.0 decreases the relevance score.
10212    /// A value greater than 1.0 increases the relevance score.
10213    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
10214    pub boost: ::core::option::Option<f32>,
10215    #[serde(
10216        rename = "_name",
10217        skip_serializing_if = "::core::option::Option::is_none"
10218    )]
10219    pub name: ::core::option::Option<::std::string::String>,
10220    /// The number of tokens from within the include span that can’t have overlap with the exclude span.
10221    /// Equivalent to setting both `pre` and `post`.
10222    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
10223    pub dist: ::core::option::Option<i32>,
10224    /// Span query whose matches must not overlap those returned.
10225    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
10226    pub exclude: ::core::option::Option<crate::query_dsl::SpanQuery>,
10227    /// Span query whose matches are filtered.
10228    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
10229    pub include: ::core::option::Option<crate::query_dsl::SpanQuery>,
10230    /// The number of tokens after the include span that can’t have overlap with the exclude span.
10231    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
10232    pub post: ::core::option::Option<i32>,
10233    /// The number of tokens before the include span that can’t have overlap with the exclude span.
10234    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
10235    pub pre: ::core::option::Option<i32>,
10236}
10237
10238impl SpanNotQuery {
10239    /// A `SpanNotQuery` with its required properties set.
10240    pub fn new(
10241        exclude: impl ::core::convert::Into<crate::query_dsl::SpanQuery>,
10242        include: impl ::core::convert::Into<crate::query_dsl::SpanQuery>,
10243    ) -> Self {
10244        Self {
10245            boost: ::core::option::Option::None,
10246            name: ::core::option::Option::None,
10247            dist: ::core::option::Option::None,
10248            exclude: ::core::option::Option::Some(exclude.into()),
10249            include: ::core::option::Option::Some(include.into()),
10250            post: ::core::option::Option::None,
10251            pre: ::core::option::Option::None,
10252        }
10253    }
10254}
10255
10256impl SpanNotQuery {
10257    /// Sets `boost`.
10258    pub fn boost(mut self, value: f32) -> Self {
10259        self.boost = ::core::option::Option::Some(value.into());
10260        self
10261    }
10262    /// Sets `name`.
10263    pub fn name(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
10264        self.name = ::core::option::Option::Some(value.into());
10265        self
10266    }
10267    /// Sets `dist`.
10268    pub fn dist(mut self, value: i32) -> Self {
10269        self.dist = ::core::option::Option::Some(value.into());
10270        self
10271    }
10272    /// Sets `post`.
10273    pub fn post(mut self, value: i32) -> Self {
10274        self.post = ::core::option::Option::Some(value.into());
10275        self
10276    }
10277    /// Sets `pre`.
10278    pub fn pre(mut self, value: i32) -> Self {
10279        self.pre = ::core::option::Option::Some(value.into());
10280        self
10281    }
10282}
10283
10284#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
10285#[non_exhaustive]
10286pub struct SpanOrQuery {
10287    /// Floating point number used to decrease or increase the relevance scores of the query.
10288    /// Boost values are relative to the default value of 1.0.
10289    /// A boost value between 0 and 1.0 decreases the relevance score.
10290    /// A value greater than 1.0 increases the relevance score.
10291    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
10292    pub boost: ::core::option::Option<f32>,
10293    #[serde(
10294        rename = "_name",
10295        skip_serializing_if = "::core::option::Option::is_none"
10296    )]
10297    pub name: ::core::option::Option<::std::string::String>,
10298    /// Array of one or more other span type queries.
10299    #[serde(default = "::core::default::Default::default")]
10300    pub clauses: ::std::vec::Vec<crate::query_dsl::SpanQuery>,
10301}
10302
10303impl SpanOrQuery {
10304    /// A `SpanOrQuery` with its required properties set.
10305    pub fn new(
10306        clauses: impl ::core::convert::Into<::std::vec::Vec<crate::query_dsl::SpanQuery>>,
10307    ) -> Self {
10308        Self {
10309            boost: ::core::option::Option::None,
10310            name: ::core::option::Option::None,
10311            clauses: clauses.into(),
10312        }
10313    }
10314}
10315
10316impl SpanOrQuery {
10317    /// Sets `boost`.
10318    pub fn boost(mut self, value: f32) -> Self {
10319        self.boost = ::core::option::Option::Some(value.into());
10320        self
10321    }
10322    /// Sets `name`.
10323    pub fn name(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
10324        self.name = ::core::option::Option::Some(value.into());
10325        self
10326    }
10327}
10328
10329#[derive(Clone, Debug, PartialEq)]
10330#[non_exhaustive]
10331pub enum SpanQuery {
10332    /// Accepts a list of span queries, but only returns those spans which also match a second span query.
10333    SpanContaining(::std::boxed::Box<crate::query_dsl::SpanContainingQuery>),
10334    /// Allows queries like `span_near` or `span_or` across different fields.
10335    SpanFieldMasking(::std::boxed::Box<crate::query_dsl::SpanFieldMaskingQuery>),
10336    /// Accepts another span query whose matches must appear within the first N positions of the field.
10337    SpanFirst(::std::boxed::Box<crate::query_dsl::SpanFirstQuery>),
10338    SpanGap(crate::query_dsl::SpanGapQuery),
10339    /// Wraps a `term`, `range`, `prefix`, `wildcard`, `regexp`, or `fuzzy` query.
10340    SpanMulti(::std::boxed::Box<crate::query_dsl::SpanMultiTermQuery>),
10341    /// Accepts multiple span queries whose matches must be within the specified distance of each other, and possibly in the same order.
10342    SpanNear(crate::query_dsl::SpanNearQuery),
10343    /// Wraps another span query, and excludes any documents which match that query.
10344    SpanNot(::std::boxed::Box<crate::query_dsl::SpanNotQuery>),
10345    /// Combines multiple span queries and returns documents which match any of the specified queries.
10346    SpanOr(crate::query_dsl::SpanOrQuery),
10347    /// The equivalent of the `term` query but for use with other span queries.
10348    SpanTerm(::oxsearch_core::shapes::SingleKey<crate::Field, crate::query_dsl::SpanTermQuery>),
10349    /// The result from a single span query is returned as long is its span falls within the spans returned by a list of other span queries.
10350    SpanWithin(::std::boxed::Box<crate::query_dsl::SpanWithinQuery>),
10351    /// Any variant, as JSON: an object with one property.
10352    Raw(::serde_json::Value),
10353}
10354
10355impl SpanQuery {
10356    /// Writes the variant as one entry of a map.
10357    pub fn serialize_entry<M__: ::serde::ser::SerializeMap>(
10358        &self,
10359        map: &mut M__,
10360    ) -> ::core::result::Result<(), M__::Error> {
10361        match self {
10362            Self::SpanContaining(value) => map.serialize_entry("span_containing", value),
10363            Self::SpanFieldMasking(value) => map.serialize_entry("span_field_masking", value),
10364            Self::SpanFirst(value) => map.serialize_entry("span_first", value),
10365            Self::SpanGap(value) => map.serialize_entry("span_gap", value),
10366            Self::SpanMulti(value) => map.serialize_entry("span_multi", value),
10367            Self::SpanNear(value) => map.serialize_entry("span_near", value),
10368            Self::SpanNot(value) => map.serialize_entry("span_not", value),
10369            Self::SpanOr(value) => map.serialize_entry("span_or", value),
10370            Self::SpanTerm(value) => map.serialize_entry("span_term", value),
10371            Self::SpanWithin(value) => map.serialize_entry("span_within", value),
10372            Self::Raw(value) => match value {
10373                ::serde_json::Value::Object(entries) => {
10374                    for (key, value) in entries {
10375                        map.serialize_entry(key, value)?;
10376                    }
10377                    ::core::result::Result::Ok(())
10378                }
10379                _ => ::core::result::Result::Err(<M__::Error as ::serde::ser::Error>::custom(
10380                    "a raw variant must be an object",
10381                )),
10382            },
10383        }
10384    }
10385}
10386
10387impl ::serde::Serialize for SpanQuery {
10388    fn serialize<S__: ::serde::Serializer>(
10389        &self,
10390        serializer: S__,
10391    ) -> ::core::result::Result<S__::Ok, S__::Error> {
10392        match self {
10393            Self::SpanContaining(value) => {
10394                ::oxsearch_core::__private::serialize_variant(serializer, "span_containing", value)
10395            }
10396            Self::SpanFieldMasking(value) => ::oxsearch_core::__private::serialize_variant(
10397                serializer,
10398                "span_field_masking",
10399                value,
10400            ),
10401            Self::SpanFirst(value) => {
10402                ::oxsearch_core::__private::serialize_variant(serializer, "span_first", value)
10403            }
10404            Self::SpanGap(value) => {
10405                ::oxsearch_core::__private::serialize_variant(serializer, "span_gap", value)
10406            }
10407            Self::SpanMulti(value) => {
10408                ::oxsearch_core::__private::serialize_variant(serializer, "span_multi", value)
10409            }
10410            Self::SpanNear(value) => {
10411                ::oxsearch_core::__private::serialize_variant(serializer, "span_near", value)
10412            }
10413            Self::SpanNot(value) => {
10414                ::oxsearch_core::__private::serialize_variant(serializer, "span_not", value)
10415            }
10416            Self::SpanOr(value) => {
10417                ::oxsearch_core::__private::serialize_variant(serializer, "span_or", value)
10418            }
10419            Self::SpanTerm(value) => {
10420                ::oxsearch_core::__private::serialize_variant(serializer, "span_term", value)
10421            }
10422            Self::SpanWithin(value) => {
10423                ::oxsearch_core::__private::serialize_variant(serializer, "span_within", value)
10424            }
10425            Self::Raw(value) => ::serde::Serialize::serialize(value, serializer),
10426        }
10427    }
10428}
10429
10430impl<'de> ::serde::Deserialize<'de> for SpanQuery {
10431    fn deserialize<D__: ::serde::Deserializer<'de>>(
10432        deserializer: D__,
10433    ) -> ::core::result::Result<Self, D__::Error> {
10434        ::oxsearch_core::__private::deserialize_container(deserializer)
10435    }
10436}
10437
10438impl<'de> ::oxsearch_core::__private::Container<'de> for SpanQuery {
10439    const NAME: &'static str = "SpanQuery";
10440    fn variant<A__: ::serde::de::MapAccess<'de>>(
10441        key: &str,
10442        map: &mut A__,
10443    ) -> ::core::result::Result<Self, A__::Error> {
10444        ::core::result::Result::Ok(match key {
10445            "span_containing" => Self::SpanContaining(map.next_value()?),
10446            "span_field_masking" => Self::SpanFieldMasking(map.next_value()?),
10447            "span_first" => Self::SpanFirst(map.next_value()?),
10448            "span_gap" => Self::SpanGap(map.next_value()?),
10449            "span_multi" => Self::SpanMulti(map.next_value()?),
10450            "span_near" => Self::SpanNear(map.next_value()?),
10451            "span_not" => Self::SpanNot(map.next_value()?),
10452            "span_or" => Self::SpanOr(map.next_value()?),
10453            "span_term" => Self::SpanTerm(map.next_value()?),
10454            "span_within" => Self::SpanWithin(map.next_value()?),
10455            _ => Self::Raw(::oxsearch_core::__private::raw_variant(
10456                key,
10457                map.next_value()?,
10458            )),
10459        })
10460    }
10461}
10462
10463impl ::core::convert::From<crate::query_dsl::SpanContainingQuery> for SpanQuery {
10464    fn from(value: crate::query_dsl::SpanContainingQuery) -> Self {
10465        Self::SpanContaining(::std::boxed::Box::new(value))
10466    }
10467}
10468
10469impl ::core::convert::From<crate::query_dsl::SpanFieldMaskingQuery> for SpanQuery {
10470    fn from(value: crate::query_dsl::SpanFieldMaskingQuery) -> Self {
10471        Self::SpanFieldMasking(::std::boxed::Box::new(value))
10472    }
10473}
10474
10475impl ::core::convert::From<crate::query_dsl::SpanFirstQuery> for SpanQuery {
10476    fn from(value: crate::query_dsl::SpanFirstQuery) -> Self {
10477        Self::SpanFirst(::std::boxed::Box::new(value))
10478    }
10479}
10480
10481impl ::core::convert::From<crate::query_dsl::SpanGapQuery> for SpanQuery {
10482    fn from(value: crate::query_dsl::SpanGapQuery) -> Self {
10483        Self::SpanGap(value)
10484    }
10485}
10486
10487impl ::core::convert::From<crate::query_dsl::SpanMultiTermQuery> for SpanQuery {
10488    fn from(value: crate::query_dsl::SpanMultiTermQuery) -> Self {
10489        Self::SpanMulti(::std::boxed::Box::new(value))
10490    }
10491}
10492
10493impl ::core::convert::From<crate::query_dsl::SpanNearQuery> for SpanQuery {
10494    fn from(value: crate::query_dsl::SpanNearQuery) -> Self {
10495        Self::SpanNear(value)
10496    }
10497}
10498
10499impl ::core::convert::From<crate::query_dsl::SpanNotQuery> for SpanQuery {
10500    fn from(value: crate::query_dsl::SpanNotQuery) -> Self {
10501        Self::SpanNot(::std::boxed::Box::new(value))
10502    }
10503}
10504
10505impl ::core::convert::From<crate::query_dsl::SpanOrQuery> for SpanQuery {
10506    fn from(value: crate::query_dsl::SpanOrQuery) -> Self {
10507        Self::SpanOr(value)
10508    }
10509}
10510
10511impl
10512    ::core::convert::From<
10513        ::oxsearch_core::shapes::SingleKey<crate::Field, crate::query_dsl::SpanTermQuery>,
10514    > for SpanQuery
10515{
10516    fn from(
10517        value: ::oxsearch_core::shapes::SingleKey<crate::Field, crate::query_dsl::SpanTermQuery>,
10518    ) -> Self {
10519        Self::SpanTerm(value)
10520    }
10521}
10522
10523impl ::core::convert::From<crate::query_dsl::SpanWithinQuery> for SpanQuery {
10524    fn from(value: crate::query_dsl::SpanWithinQuery) -> Self {
10525        Self::SpanWithin(::std::boxed::Box::new(value))
10526    }
10527}
10528
10529#[derive(Clone, Debug, PartialEq)]
10530#[non_exhaustive]
10531pub struct SpanTermQuery {
10532    /// Floating point number used to decrease or increase the relevance scores of the query.
10533    /// Boost values are relative to the default value of 1.0.
10534    /// A boost value between 0 and 1.0 decreases the relevance score.
10535    /// A value greater than 1.0 increases the relevance score.
10536    pub boost: ::core::option::Option<f32>,
10537    pub name: ::core::option::Option<::std::string::String>,
10538    pub value: ::core::option::Option<crate::FieldValue>,
10539}
10540
10541impl SpanTermQuery {
10542    /// A `SpanTermQuery` with its required properties set.
10543    pub fn new(value: impl ::core::convert::Into<crate::FieldValue>) -> Self {
10544        Self {
10545            boost: ::core::option::Option::None,
10546            name: ::core::option::Option::None,
10547            value: ::core::option::Option::Some(value.into()),
10548        }
10549    }
10550}
10551
10552impl SpanTermQuery {
10553    /// Sets `boost`.
10554    pub fn boost(mut self, value: f32) -> Self {
10555        self.boost = ::core::option::Option::Some(value.into());
10556        self
10557    }
10558    /// Sets `name`.
10559    pub fn name(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
10560        self.name = ::core::option::Option::Some(value.into());
10561        self
10562    }
10563}
10564
10565#[derive(::serde::Serialize, ::serde::Deserialize)]
10566#[serde(remote = "SpanTermQuery")]
10567struct SpanTermQueryDef {
10568    /// Floating point number used to decrease or increase the relevance scores of the query.
10569    /// Boost values are relative to the default value of 1.0.
10570    /// A boost value between 0 and 1.0 decreases the relevance score.
10571    /// A value greater than 1.0 increases the relevance score.
10572    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
10573    boost: ::core::option::Option<f32>,
10574    #[serde(
10575        rename = "_name",
10576        skip_serializing_if = "::core::option::Option::is_none"
10577    )]
10578    name: ::core::option::Option<::std::string::String>,
10579    #[serde(
10580        alias = "term",
10581        skip_serializing_if = "::core::option::Option::is_none"
10582    )]
10583    value: ::core::option::Option<crate::FieldValue>,
10584}
10585
10586impl ::serde::Serialize for SpanTermQuery {
10587    fn serialize<S__: ::serde::Serializer>(
10588        &self,
10589        serializer: S__,
10590    ) -> ::core::result::Result<S__::Ok, S__::Error> {
10591        if let (::core::option::Option::Some(short), true) =
10592            (&self.value, self.boost.is_none() && self.name.is_none())
10593        {
10594            return ::serde::Serialize::serialize(short, serializer);
10595        }
10596        SpanTermQueryDef::serialize(self, serializer)
10597    }
10598}
10599
10600impl<'de> ::oxsearch_core::__private::Shorthand<'de> for SpanTermQuery {
10601    type Short = crate::FieldValue;
10602    fn from_short(short: crate::FieldValue) -> Self {
10603        Self {
10604            boost: ::core::option::Option::None,
10605            name: ::core::option::Option::None,
10606            value: ::core::option::Option::Some(short),
10607        }
10608    }
10609    fn deserialize_full<D__: ::serde::Deserializer<'de>>(
10610        deserializer: D__,
10611    ) -> ::core::result::Result<Self, D__::Error> {
10612        SpanTermQueryDef::deserialize(deserializer)
10613    }
10614}
10615
10616impl<'de> ::serde::Deserialize<'de> for SpanTermQuery {
10617    fn deserialize<D__: ::serde::Deserializer<'de>>(
10618        deserializer: D__,
10619    ) -> ::core::result::Result<Self, D__::Error> {
10620        ::oxsearch_core::__private::deserialize_shorthand(deserializer)
10621    }
10622}
10623
10624#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
10625#[non_exhaustive]
10626pub struct SpanWithinQuery {
10627    /// Floating point number used to decrease or increase the relevance scores of the query.
10628    /// Boost values are relative to the default value of 1.0.
10629    /// A boost value between 0 and 1.0 decreases the relevance score.
10630    /// A value greater than 1.0 increases the relevance score.
10631    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
10632    pub boost: ::core::option::Option<f32>,
10633    #[serde(
10634        rename = "_name",
10635        skip_serializing_if = "::core::option::Option::is_none"
10636    )]
10637    pub name: ::core::option::Option<::std::string::String>,
10638    /// Can be any span query.
10639    /// Matching spans from `little` that are enclosed within `big` are returned.
10640    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
10641    pub big: ::core::option::Option<crate::query_dsl::SpanQuery>,
10642    /// Can be any span query.
10643    /// Matching spans from `little` that are enclosed within `big` are returned.
10644    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
10645    pub little: ::core::option::Option<crate::query_dsl::SpanQuery>,
10646}
10647
10648impl SpanWithinQuery {
10649    /// A `SpanWithinQuery` with its required properties set.
10650    pub fn new(
10651        big: impl ::core::convert::Into<crate::query_dsl::SpanQuery>,
10652        little: impl ::core::convert::Into<crate::query_dsl::SpanQuery>,
10653    ) -> Self {
10654        Self {
10655            boost: ::core::option::Option::None,
10656            name: ::core::option::Option::None,
10657            big: ::core::option::Option::Some(big.into()),
10658            little: ::core::option::Option::Some(little.into()),
10659        }
10660    }
10661}
10662
10663impl SpanWithinQuery {
10664    /// Sets `boost`.
10665    pub fn boost(mut self, value: f32) -> Self {
10666        self.boost = ::core::option::Option::Some(value.into());
10667        self
10668    }
10669    /// Sets `name`.
10670    pub fn name(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
10671        self.name = ::core::option::Option::Some(value.into());
10672        self
10673    }
10674}
10675
10676/// The variants of [`SparseVectorQuery`].
10677#[derive(Clone, Debug, PartialEq)]
10678#[non_exhaustive]
10679pub enum SparseVectorQueryVariant {
10680    /// Dictionary of precomputed sparse vectors and their associated weights.
10681    /// Only one of inference_id or query_vector may be supplied in a request.
10682    QueryVector(::indexmap::IndexMap<::std::string::String, f32>),
10683    /// The inference ID to use to convert the query text into token-weight pairs.
10684    /// It must be the same inference ID that was used to create the tokens from the input text.
10685    /// Only one of inference_id and query_vector is allowed.
10686    /// If inference_id is specified, query must also be specified.
10687    /// Only one of inference_id or query_vector may be supplied in a request.
10688    InferenceId(crate::Id),
10689    /// Any variant, as JSON: an object with one property.
10690    Raw(::serde_json::Value),
10691}
10692
10693impl SparseVectorQueryVariant {
10694    /// Writes the variant as one entry of a map.
10695    pub fn serialize_entry<M__: ::serde::ser::SerializeMap>(
10696        &self,
10697        map: &mut M__,
10698    ) -> ::core::result::Result<(), M__::Error> {
10699        match self {
10700            Self::QueryVector(value) => map.serialize_entry("query_vector", value),
10701            Self::InferenceId(value) => map.serialize_entry("inference_id", value),
10702            Self::Raw(value) => match value {
10703                ::serde_json::Value::Object(entries) => {
10704                    for (key, value) in entries {
10705                        map.serialize_entry(key, value)?;
10706                    }
10707                    ::core::result::Result::Ok(())
10708                }
10709                _ => ::core::result::Result::Err(<M__::Error as ::serde::ser::Error>::custom(
10710                    "a raw variant must be an object",
10711                )),
10712            },
10713        }
10714    }
10715}
10716
10717impl ::serde::Serialize for SparseVectorQueryVariant {
10718    fn serialize<S__: ::serde::Serializer>(
10719        &self,
10720        serializer: S__,
10721    ) -> ::core::result::Result<S__::Ok, S__::Error> {
10722        match self {
10723            Self::QueryVector(value) => {
10724                ::oxsearch_core::__private::serialize_variant(serializer, "query_vector", value)
10725            }
10726            Self::InferenceId(value) => {
10727                ::oxsearch_core::__private::serialize_variant(serializer, "inference_id", value)
10728            }
10729            Self::Raw(value) => ::serde::Serialize::serialize(value, serializer),
10730        }
10731    }
10732}
10733
10734impl<'de> ::serde::Deserialize<'de> for SparseVectorQueryVariant {
10735    fn deserialize<D__: ::serde::Deserializer<'de>>(
10736        deserializer: D__,
10737    ) -> ::core::result::Result<Self, D__::Error> {
10738        ::oxsearch_core::__private::deserialize_container(deserializer)
10739    }
10740}
10741
10742impl<'de> ::oxsearch_core::__private::Container<'de> for SparseVectorQueryVariant {
10743    const NAME: &'static str = "SparseVectorQueryVariant";
10744    fn variant<A__: ::serde::de::MapAccess<'de>>(
10745        key: &str,
10746        map: &mut A__,
10747    ) -> ::core::result::Result<Self, A__::Error> {
10748        ::core::result::Result::Ok(match key {
10749            "query_vector" => Self::QueryVector(map.next_value()?),
10750            "inference_id" => Self::InferenceId(map.next_value()?),
10751            _ => Self::Raw(::oxsearch_core::__private::raw_variant(
10752                key,
10753                map.next_value()?,
10754            )),
10755        })
10756    }
10757}
10758
10759impl ::core::convert::From<::indexmap::IndexMap<::std::string::String, f32>>
10760    for SparseVectorQueryVariant
10761{
10762    fn from(value: ::indexmap::IndexMap<::std::string::String, f32>) -> Self {
10763        Self::QueryVector(value)
10764    }
10765}
10766
10767impl ::core::convert::From<crate::Id> for SparseVectorQueryVariant {
10768    fn from(value: crate::Id) -> Self {
10769        Self::InferenceId(value)
10770    }
10771}
10772
10773impl ::core::convert::From<&str> for SparseVectorQueryVariant {
10774    fn from(value: &str) -> Self {
10775        Self::InferenceId(::std::borrow::ToOwned::to_owned(value))
10776    }
10777}
10778
10779#[derive(Clone, Debug, PartialEq)]
10780#[non_exhaustive]
10781pub struct SparseVectorQuery {
10782    /// Floating point number used to decrease or increase the relevance scores of the query.
10783    /// Boost values are relative to the default value of 1.0.
10784    /// A boost value between 0 and 1.0 decreases the relevance score.
10785    /// A value greater than 1.0 increases the relevance score.
10786    pub boost: ::core::option::Option<f32>,
10787    pub name: ::core::option::Option<::std::string::String>,
10788    /// The name of the field that contains the token-weight pairs to be searched against.
10789    /// This field must be a mapped sparse_vector field.
10790    pub field: ::core::option::Option<crate::Field>,
10791    /// The query text you want to use for search.
10792    /// If inference_id is specified, query must also be specified.
10793    pub query: ::core::option::Option<::std::string::String>,
10794    /// Whether to perform pruning, omitting the non-significant tokens from the query to improve query performance.
10795    /// If prune is true but the pruning_config is not specified, pruning will occur but default values will be used.
10796    /// Default: false
10797    pub prune: ::core::option::Option<bool>,
10798    /// Optional pruning configuration.
10799    /// If enabled, this will omit non-significant tokens from the query in order to improve query performance.
10800    /// This is only used if prune is set to true.
10801    /// If prune is set to true but pruning_config is not specified, default values will be used.
10802    pub pruning_config: ::core::option::Option<crate::TokenPruningConfig>,
10803    /// The variant.
10804    pub variant: ::core::option::Option<crate::query_dsl::SparseVectorQueryVariant>,
10805}
10806
10807impl SparseVectorQuery {
10808    /// A `SparseVectorQuery` with its required properties set.
10809    pub fn new(field: impl ::core::convert::Into<crate::Field>) -> Self {
10810        Self {
10811            boost: ::core::option::Option::None,
10812            name: ::core::option::Option::None,
10813            field: ::core::option::Option::Some(field.into()),
10814            query: ::core::option::Option::None,
10815            prune: ::core::option::Option::None,
10816            pruning_config: ::core::option::Option::None,
10817            variant: ::core::option::Option::None,
10818        }
10819    }
10820}
10821
10822impl SparseVectorQuery {
10823    /// Sets `boost`.
10824    pub fn boost(mut self, value: f32) -> Self {
10825        self.boost = ::core::option::Option::Some(value.into());
10826        self
10827    }
10828    /// Sets `name`.
10829    pub fn name(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
10830        self.name = ::core::option::Option::Some(value.into());
10831        self
10832    }
10833    /// Sets `query`.
10834    pub fn query(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
10835        self.query = ::core::option::Option::Some(value.into());
10836        self
10837    }
10838    /// Sets `prune`.
10839    pub fn prune(mut self, value: bool) -> Self {
10840        self.prune = ::core::option::Option::Some(value.into());
10841        self
10842    }
10843    /// Sets `pruning_config`.
10844    pub fn pruning_config(
10845        mut self,
10846        value: impl ::core::convert::Into<crate::TokenPruningConfig>,
10847    ) -> Self {
10848        self.pruning_config = ::core::option::Option::Some(value.into());
10849        self
10850    }
10851    /// Sets `variant`.
10852    pub fn variant(
10853        mut self,
10854        value: impl ::core::convert::Into<crate::query_dsl::SparseVectorQueryVariant>,
10855    ) -> Self {
10856        self.variant = ::core::option::Option::Some(value.into());
10857        self
10858    }
10859}
10860
10861impl ::serde::Serialize for SparseVectorQuery {
10862    fn serialize<S__: ::serde::Serializer>(
10863        &self,
10864        serializer: S__,
10865    ) -> ::core::result::Result<S__::Ok, S__::Error> {
10866        use ::serde::ser::SerializeMap as _;
10867        let mut map = serializer.serialize_map(::core::option::Option::None)?;
10868        if let ::core::option::Option::Some(value) = &self.boost {
10869            map.serialize_entry("boost", value)?;
10870        }
10871        if let ::core::option::Option::Some(value) = &self.name {
10872            map.serialize_entry("_name", value)?;
10873        }
10874        if let ::core::option::Option::Some(value) = &self.field {
10875            map.serialize_entry("field", value)?;
10876        }
10877        if let ::core::option::Option::Some(value) = &self.query {
10878            map.serialize_entry("query", value)?;
10879        }
10880        if let ::core::option::Option::Some(value) = &self.prune {
10881            map.serialize_entry("prune", value)?;
10882        }
10883        if let ::core::option::Option::Some(value) = &self.pruning_config {
10884            map.serialize_entry("pruning_config", value)?;
10885        }
10886        if let ::core::option::Option::Some(variant) = &self.variant {
10887            variant.serialize_entry(&mut map)?;
10888        }
10889        map.end()
10890    }
10891}
10892
10893impl<'de> ::serde::Deserialize<'de> for SparseVectorQuery {
10894    fn deserialize<D__: ::serde::Deserializer<'de>>(
10895        deserializer: D__,
10896    ) -> ::core::result::Result<Self, D__::Error> {
10897        struct Fields;
10898        impl<'de> ::serde::de::Visitor<'de> for Fields {
10899            type Value = SparseVectorQuery;
10900            fn expecting(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
10901                f.write_str("a SparseVectorQuery object")
10902            }
10903            fn visit_map<A__: ::serde::de::MapAccess<'de>>(
10904                self,
10905                mut map: A__,
10906            ) -> ::core::result::Result<SparseVectorQuery, A__::Error> {
10907                let mut boost = ::core::option::Option::None;
10908                let mut name = ::core::option::Option::None;
10909                let mut field = ::core::option::Option::None;
10910                let mut query = ::core::option::Option::None;
10911                let mut prune = ::core::option::Option::None;
10912                let mut pruning_config = ::core::option::Option::None;
10913                let mut variant__ = ::core::option::Option::None;
10914                while let ::core::option::Option::Some(key) =
10915                    map.next_key::<::std::string::String>()?
10916                {
10917                    match key.as_str() {
10918                        "boost" => boost = ::core::option::Option::Some(map.next_value()?),
10919                        "_name" => name = ::core::option::Option::Some(map.next_value()?),
10920                        "field" => field = ::core::option::Option::Some(map.next_value()?),
10921                        "query" => query = ::core::option::Option::Some(map.next_value()?),
10922                        "prune" => prune = ::core::option::Option::Some(map.next_value()?),
10923                        "pruning_config" => {
10924                            pruning_config = ::core::option::Option::Some(map.next_value()?)
10925                        }
10926                        _ => {
10927                            if variant__.is_some() {
10928                                return ::core::result::Result::Err(
10929                                    ::oxsearch_core::__private::two_variants(
10930                                        "SparseVectorQuery",
10931                                        &key,
10932                                    ),
10933                                );
10934                            }
10935                            variant__ = ::core::option::Option::Some(<SparseVectorQueryVariant as ::oxsearch_core::__private::Container<'de>>::variant(&key, &mut map)?);
10936                        }
10937                    }
10938                }
10939                ::core::result::Result::Ok(SparseVectorQuery {
10940                    boost,
10941                    name,
10942                    field,
10943                    query,
10944                    prune,
10945                    pruning_config,
10946                    variant: variant__,
10947                })
10948            }
10949        }
10950        deserializer.deserialize_map(Fields)
10951    }
10952}
10953
10954#[derive(Clone, Debug, PartialEq)]
10955#[non_exhaustive]
10956pub struct TermQuery {
10957    /// Floating point number used to decrease or increase the relevance scores of the query.
10958    /// Boost values are relative to the default value of 1.0.
10959    /// A boost value between 0 and 1.0 decreases the relevance score.
10960    /// A value greater than 1.0 increases the relevance score.
10961    pub boost: ::core::option::Option<f32>,
10962    pub name: ::core::option::Option<::std::string::String>,
10963    /// Term you wish to find in the provided field.
10964    pub value: ::core::option::Option<crate::FieldValue>,
10965    /// Allows ASCII case insensitive matching of the value with the indexed field values when set to `true`.
10966    /// When `false`, the case sensitivity of matching depends on the underlying field’s mapping.
10967    pub case_insensitive: ::core::option::Option<bool>,
10968}
10969
10970impl TermQuery {
10971    /// A `TermQuery` with its required properties set.
10972    pub fn new(value: impl ::core::convert::Into<crate::FieldValue>) -> Self {
10973        Self {
10974            boost: ::core::option::Option::None,
10975            name: ::core::option::Option::None,
10976            value: ::core::option::Option::Some(value.into()),
10977            case_insensitive: ::core::option::Option::None,
10978        }
10979    }
10980}
10981
10982impl TermQuery {
10983    /// Sets `boost`.
10984    pub fn boost(mut self, value: f32) -> Self {
10985        self.boost = ::core::option::Option::Some(value.into());
10986        self
10987    }
10988    /// Sets `name`.
10989    pub fn name(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
10990        self.name = ::core::option::Option::Some(value.into());
10991        self
10992    }
10993    /// Sets `case_insensitive`.
10994    pub fn case_insensitive(mut self, value: bool) -> Self {
10995        self.case_insensitive = ::core::option::Option::Some(value.into());
10996        self
10997    }
10998}
10999
11000#[derive(::serde::Serialize, ::serde::Deserialize)]
11001#[serde(remote = "TermQuery")]
11002struct TermQueryDef {
11003    /// Floating point number used to decrease or increase the relevance scores of the query.
11004    /// Boost values are relative to the default value of 1.0.
11005    /// A boost value between 0 and 1.0 decreases the relevance score.
11006    /// A value greater than 1.0 increases the relevance score.
11007    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
11008    boost: ::core::option::Option<f32>,
11009    #[serde(
11010        rename = "_name",
11011        skip_serializing_if = "::core::option::Option::is_none"
11012    )]
11013    name: ::core::option::Option<::std::string::String>,
11014    /// Term you wish to find in the provided field.
11015    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
11016    value: ::core::option::Option<crate::FieldValue>,
11017    /// Allows ASCII case insensitive matching of the value with the indexed field values when set to `true`.
11018    /// When `false`, the case sensitivity of matching depends on the underlying field’s mapping.
11019    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
11020    case_insensitive: ::core::option::Option<bool>,
11021}
11022
11023impl ::serde::Serialize for TermQuery {
11024    fn serialize<S__: ::serde::Serializer>(
11025        &self,
11026        serializer: S__,
11027    ) -> ::core::result::Result<S__::Ok, S__::Error> {
11028        if let (::core::option::Option::Some(short), true) = (
11029            &self.value,
11030            self.boost.is_none() && self.name.is_none() && self.case_insensitive.is_none(),
11031        ) {
11032            return ::serde::Serialize::serialize(short, serializer);
11033        }
11034        TermQueryDef::serialize(self, serializer)
11035    }
11036}
11037
11038impl<'de> ::oxsearch_core::__private::Shorthand<'de> for TermQuery {
11039    type Short = crate::FieldValue;
11040    fn from_short(short: crate::FieldValue) -> Self {
11041        Self {
11042            boost: ::core::option::Option::None,
11043            name: ::core::option::Option::None,
11044            value: ::core::option::Option::Some(short),
11045            case_insensitive: ::core::option::Option::None,
11046        }
11047    }
11048    fn deserialize_full<D__: ::serde::Deserializer<'de>>(
11049        deserializer: D__,
11050    ) -> ::core::result::Result<Self, D__::Error> {
11051        TermQueryDef::deserialize(deserializer)
11052    }
11053}
11054
11055impl<'de> ::serde::Deserialize<'de> for TermQuery {
11056    fn deserialize<D__: ::serde::Deserializer<'de>>(
11057        deserializer: D__,
11058    ) -> ::core::result::Result<Self, D__::Error> {
11059        ::oxsearch_core::__private::deserialize_shorthand(deserializer)
11060    }
11061}
11062
11063#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
11064#[non_exhaustive]
11065pub struct TermRangeQuery {
11066    /// Floating point number used to decrease or increase the relevance scores of the query.
11067    /// Boost values are relative to the default value of 1.0.
11068    /// A boost value between 0 and 1.0 decreases the relevance score.
11069    /// A value greater than 1.0 increases the relevance score.
11070    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
11071    pub boost: ::core::option::Option<f32>,
11072    #[serde(
11073        rename = "_name",
11074        skip_serializing_if = "::core::option::Option::is_none"
11075    )]
11076    pub name: ::core::option::Option<::std::string::String>,
11077    /// Indicates how the range query matches values for `range` fields.
11078    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
11079    pub relation: ::core::option::Option<crate::query_dsl::RangeRelation>,
11080    /// Greater than.
11081    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
11082    pub gt: ::core::option::Option<::std::string::String>,
11083    /// Greater than or equal to.
11084    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
11085    pub gte: ::core::option::Option<::std::string::String>,
11086    /// Less than.
11087    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
11088    pub lt: ::core::option::Option<::std::string::String>,
11089    /// Less than or equal to.
11090    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
11091    pub lte: ::core::option::Option<::std::string::String>,
11092}
11093
11094impl TermRangeQuery {
11095    /// A `TermRangeQuery` with its required properties set.
11096    pub fn new() -> Self {
11097        Self {
11098            boost: ::core::option::Option::None,
11099            name: ::core::option::Option::None,
11100            relation: ::core::option::Option::None,
11101            gt: ::core::option::Option::None,
11102            gte: ::core::option::Option::None,
11103            lt: ::core::option::Option::None,
11104            lte: ::core::option::Option::None,
11105        }
11106    }
11107}
11108
11109impl TermRangeQuery {
11110    /// Sets `boost`.
11111    pub fn boost(mut self, value: f32) -> Self {
11112        self.boost = ::core::option::Option::Some(value.into());
11113        self
11114    }
11115    /// Sets `name`.
11116    pub fn name(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
11117        self.name = ::core::option::Option::Some(value.into());
11118        self
11119    }
11120    /// Sets `relation`.
11121    pub fn relation(
11122        mut self,
11123        value: impl ::core::convert::Into<crate::query_dsl::RangeRelation>,
11124    ) -> Self {
11125        self.relation = ::core::option::Option::Some(value.into());
11126        self
11127    }
11128    /// Sets `gt`.
11129    pub fn gt(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
11130        self.gt = ::core::option::Option::Some(value.into());
11131        self
11132    }
11133    /// Sets `gte`.
11134    pub fn gte(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
11135        self.gte = ::core::option::Option::Some(value.into());
11136        self
11137    }
11138    /// Sets `lt`.
11139    pub fn lt(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
11140        self.lt = ::core::option::Option::Some(value.into());
11141        self
11142    }
11143    /// Sets `lte`.
11144    pub fn lte(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
11145        self.lte = ::core::option::Option::Some(value.into());
11146        self
11147    }
11148}
11149
11150#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
11151#[non_exhaustive]
11152pub struct TermsLookup {
11153    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
11154    pub index: ::core::option::Option<crate::IndexName>,
11155    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
11156    pub id: ::core::option::Option<crate::Id>,
11157    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
11158    pub path: ::core::option::Option<crate::Field>,
11159    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
11160    pub routing: ::core::option::Option<::std::string::String>,
11161}
11162
11163impl TermsLookup {
11164    /// A `TermsLookup` with its required properties set.
11165    pub fn new(
11166        index: impl ::core::convert::Into<crate::IndexName>,
11167        id: impl ::core::convert::Into<crate::Id>,
11168        path: impl ::core::convert::Into<crate::Field>,
11169    ) -> Self {
11170        Self {
11171            index: ::core::option::Option::Some(index.into()),
11172            id: ::core::option::Option::Some(id.into()),
11173            path: ::core::option::Option::Some(path.into()),
11174            routing: ::core::option::Option::None,
11175        }
11176    }
11177}
11178
11179impl TermsLookup {
11180    /// Sets `routing`.
11181    pub fn routing(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
11182        self.routing = ::core::option::Option::Some(value.into());
11183        self
11184    }
11185}
11186
11187#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
11188#[serde(try_from = "TermsQueryRepr", into = "TermsQueryRepr")]
11189#[non_exhaustive]
11190pub struct TermsQuery {
11191    /// Floating point number used to decrease or increase the relevance scores of the query.
11192    /// Boost values are relative to the default value of 1.0.
11193    /// A boost value between 0 and 1.0 decreases the relevance score.
11194    /// A value greater than 1.0 increases the relevance score.
11195    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
11196    pub boost: ::core::option::Option<f32>,
11197    #[serde(
11198        rename = "_name",
11199        skip_serializing_if = "::core::option::Option::is_none"
11200    )]
11201    pub name: ::core::option::Option<::std::string::String>,
11202    /// The name of the property that holds `terms`.
11203    pub field: crate::Field,
11204    /// The value under `field`.
11205    pub terms: crate::query_dsl::TermsQueryField,
11206}
11207
11208impl TermsQuery {
11209    /// A `TermsQuery` with its required properties set.
11210    pub fn new(
11211        field: impl ::core::convert::Into<crate::Field>,
11212        terms: impl ::core::convert::Into<crate::query_dsl::TermsQueryField>,
11213    ) -> Self {
11214        Self {
11215            boost: ::core::option::Option::None,
11216            name: ::core::option::Option::None,
11217            field: field.into(),
11218            terms: terms.into(),
11219        }
11220    }
11221}
11222
11223impl TermsQuery {
11224    /// Sets `boost`.
11225    pub fn boost(mut self, value: f32) -> Self {
11226        self.boost = ::core::option::Option::Some(value.into());
11227        self
11228    }
11229    /// Sets `name`.
11230    pub fn name(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
11231        self.name = ::core::option::Option::Some(value.into());
11232        self
11233    }
11234}
11235
11236#[derive(::serde::Serialize, ::serde::Deserialize)]
11237struct TermsQueryRepr {
11238    /// Floating point number used to decrease or increase the relevance scores of the query.
11239    /// Boost values are relative to the default value of 1.0.
11240    /// A boost value between 0 and 1.0 decreases the relevance score.
11241    /// A value greater than 1.0 increases the relevance score.
11242    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
11243    boost: ::core::option::Option<f32>,
11244    #[serde(
11245        rename = "_name",
11246        skip_serializing_if = "::core::option::Option::is_none"
11247    )]
11248    name: ::core::option::Option<::std::string::String>,
11249    #[serde(flatten)]
11250    keyed__: ::indexmap::IndexMap<crate::Field, crate::query_dsl::TermsQueryField>,
11251}
11252
11253impl ::core::convert::TryFrom<TermsQueryRepr> for TermsQuery {
11254    type Error = ::std::string::String;
11255    fn try_from(repr: TermsQueryRepr) -> ::core::result::Result<Self, Self::Error> {
11256        let mut keyed = repr.keyed__.into_iter();
11257        match (keyed.next(), keyed.next()) {
11258            (::core::option::Option::Some((field, terms)), ::core::option::Option::None) => {
11259                ::core::result::Result::Ok(Self {
11260                    boost: repr.boost,
11261                    name: repr.name,
11262                    field,
11263                    terms,
11264                })
11265            }
11266            _ => ::core::result::Result::Err(::std::string::String::from(
11267                "TermsQuery needs exactly one property keyed by its field",
11268            )),
11269        }
11270    }
11271}
11272
11273impl ::core::convert::From<TermsQuery> for TermsQueryRepr {
11274    fn from(value: TermsQuery) -> Self {
11275        let mut keyed__ = ::indexmap::IndexMap::new();
11276        keyed__.insert(value.field, value.terms);
11277        Self {
11278            boost: value.boost,
11279            name: value.name,
11280            keyed__,
11281        }
11282    }
11283}
11284
11285#[derive(Clone, Debug, PartialEq)]
11286#[non_exhaustive]
11287pub enum TermsQueryField {
11288    /// A array.
11289    Value(::std::vec::Vec<crate::FieldValue>),
11290    /// A object.
11291    Lookup(crate::query_dsl::TermsLookup),
11292}
11293
11294impl ::serde::Serialize for TermsQueryField {
11295    fn serialize<S__: ::serde::Serializer>(
11296        &self,
11297        serializer: S__,
11298    ) -> ::core::result::Result<S__::Ok, S__::Error> {
11299        match self {
11300            Self::Value(value) => ::serde::Serialize::serialize(value, serializer),
11301            Self::Lookup(value) => ::serde::Serialize::serialize(value, serializer),
11302        }
11303    }
11304}
11305
11306impl<'de> ::serde::Deserialize<'de> for TermsQueryField {
11307    fn deserialize<D__: ::serde::Deserializer<'de>>(
11308        deserializer: D__,
11309    ) -> ::core::result::Result<Self, D__::Error> {
11310        struct Shape;
11311        impl<'de> ::oxsearch_core::__private::ByKind<'de> for Shape {
11312            type Value = TermsQueryField;
11313            const EXPECTING: &'static str = "TermsQueryField: array or object";
11314            fn visit<V__: ::serde::Deserializer<'de>>(
11315                self,
11316                kind: ::oxsearch_core::__private::Kind,
11317                value: V__,
11318            ) -> ::core::result::Result<Self::Value, V__::Error> {
11319                match kind {
11320                    ::oxsearch_core::__private::Kind::Array => {
11321                        <::std::vec::Vec<crate::FieldValue> as ::serde::Deserialize>::deserialize(
11322                            value,
11323                        )
11324                        .map(TermsQueryField::Value)
11325                    }
11326                    ::oxsearch_core::__private::Kind::Object => {
11327                        <crate::query_dsl::TermsLookup as ::serde::Deserialize>::deserialize(value)
11328                            .map(TermsQueryField::Lookup)
11329                    }
11330                    _ => ::core::result::Result::Err(<V__::Error as ::serde::de::Error>::custom(
11331                        format_args!("TermsQueryField can't be {kind:?}"),
11332                    )),
11333                }
11334            }
11335        }
11336        ::oxsearch_core::__private::deserialize_by_kind(deserializer, Shape)
11337    }
11338}
11339
11340impl ::core::convert::From<::std::vec::Vec<crate::FieldValue>> for TermsQueryField {
11341    fn from(value: ::std::vec::Vec<crate::FieldValue>) -> Self {
11342        Self::Value(value)
11343    }
11344}
11345
11346impl ::core::convert::From<crate::query_dsl::TermsLookup> for TermsQueryField {
11347    fn from(value: crate::query_dsl::TermsLookup) -> Self {
11348        Self::Lookup(value)
11349    }
11350}
11351
11352#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
11353#[non_exhaustive]
11354pub struct TermsSetQuery {
11355    /// Floating point number used to decrease or increase the relevance scores of the query.
11356    /// Boost values are relative to the default value of 1.0.
11357    /// A boost value between 0 and 1.0 decreases the relevance score.
11358    /// A value greater than 1.0 increases the relevance score.
11359    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
11360    pub boost: ::core::option::Option<f32>,
11361    #[serde(
11362        rename = "_name",
11363        skip_serializing_if = "::core::option::Option::is_none"
11364    )]
11365    pub name: ::core::option::Option<::std::string::String>,
11366    /// Specification describing number of matching terms required to return a document.
11367    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
11368    pub minimum_should_match: ::core::option::Option<crate::MinimumShouldMatch>,
11369    /// Numeric field containing the number of matching terms required to return a document.
11370    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
11371    pub minimum_should_match_field: ::core::option::Option<crate::Field>,
11372    /// Custom script containing the number of matching terms required to return a document.
11373    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
11374    pub minimum_should_match_script: ::core::option::Option<crate::Script>,
11375    /// Array of terms you wish to find in the provided field.
11376    #[serde(default = "::core::default::Default::default")]
11377    pub terms: ::std::vec::Vec<crate::FieldValue>,
11378}
11379
11380impl TermsSetQuery {
11381    /// A `TermsSetQuery` with its required properties set.
11382    pub fn new(terms: impl ::core::convert::Into<::std::vec::Vec<crate::FieldValue>>) -> Self {
11383        Self {
11384            boost: ::core::option::Option::None,
11385            name: ::core::option::Option::None,
11386            minimum_should_match: ::core::option::Option::None,
11387            minimum_should_match_field: ::core::option::Option::None,
11388            minimum_should_match_script: ::core::option::Option::None,
11389            terms: terms.into(),
11390        }
11391    }
11392}
11393
11394impl TermsSetQuery {
11395    /// Sets `boost`.
11396    pub fn boost(mut self, value: f32) -> Self {
11397        self.boost = ::core::option::Option::Some(value.into());
11398        self
11399    }
11400    /// Sets `name`.
11401    pub fn name(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
11402        self.name = ::core::option::Option::Some(value.into());
11403        self
11404    }
11405    /// Sets `minimum_should_match`.
11406    pub fn minimum_should_match(
11407        mut self,
11408        value: impl ::core::convert::Into<crate::MinimumShouldMatch>,
11409    ) -> Self {
11410        self.minimum_should_match = ::core::option::Option::Some(value.into());
11411        self
11412    }
11413    /// Sets `minimum_should_match_field`.
11414    pub fn minimum_should_match_field(
11415        mut self,
11416        value: impl ::core::convert::Into<crate::Field>,
11417    ) -> Self {
11418        self.minimum_should_match_field = ::core::option::Option::Some(value.into());
11419        self
11420    }
11421    /// Sets `minimum_should_match_script`.
11422    pub fn minimum_should_match_script(
11423        mut self,
11424        value: impl ::core::convert::Into<crate::Script>,
11425    ) -> Self {
11426        self.minimum_should_match_script = ::core::option::Option::Some(value.into());
11427        self
11428    }
11429}
11430
11431#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
11432#[non_exhaustive]
11433pub struct TextExpansionQuery {
11434    /// Floating point number used to decrease or increase the relevance scores of the query.
11435    /// Boost values are relative to the default value of 1.0.
11436    /// A boost value between 0 and 1.0 decreases the relevance score.
11437    /// A value greater than 1.0 increases the relevance score.
11438    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
11439    pub boost: ::core::option::Option<f32>,
11440    #[serde(
11441        rename = "_name",
11442        skip_serializing_if = "::core::option::Option::is_none"
11443    )]
11444    pub name: ::core::option::Option<::std::string::String>,
11445    /// The text expansion NLP model to use
11446    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
11447    pub model_id: ::core::option::Option<::std::string::String>,
11448    /// The query text
11449    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
11450    pub model_text: ::core::option::Option<::std::string::String>,
11451    /// Token pruning configurations
11452    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
11453    pub pruning_config: ::core::option::Option<crate::TokenPruningConfig>,
11454}
11455
11456impl TextExpansionQuery {
11457    /// A `TextExpansionQuery` with its required properties set.
11458    pub fn new(
11459        model_id: impl ::core::convert::Into<::std::string::String>,
11460        model_text: impl ::core::convert::Into<::std::string::String>,
11461    ) -> Self {
11462        Self {
11463            boost: ::core::option::Option::None,
11464            name: ::core::option::Option::None,
11465            model_id: ::core::option::Option::Some(model_id.into()),
11466            model_text: ::core::option::Option::Some(model_text.into()),
11467            pruning_config: ::core::option::Option::None,
11468        }
11469    }
11470}
11471
11472impl TextExpansionQuery {
11473    /// Sets `boost`.
11474    pub fn boost(mut self, value: f32) -> Self {
11475        self.boost = ::core::option::Option::Some(value.into());
11476        self
11477    }
11478    /// Sets `name`.
11479    pub fn name(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
11480        self.name = ::core::option::Option::Some(value.into());
11481        self
11482    }
11483    /// Sets `pruning_config`.
11484    pub fn pruning_config(
11485        mut self,
11486        value: impl ::core::convert::Into<crate::TokenPruningConfig>,
11487    ) -> Self {
11488        self.pruning_config = ::core::option::Option::Some(value.into());
11489        self
11490    }
11491}
11492
11493#[derive(Clone, Debug, PartialEq, Eq, Hash)]
11494#[non_exhaustive]
11495pub enum TextQueryType {
11496    /// Finds documents that match any field, but uses the `_score` from the best field.
11497    BestFields,
11498    /// Finds documents that match any field and combines the `_score` from each field.
11499    MostFields,
11500    /// Treats fields with the same analyzer as though they were one big field.
11501    /// Looks for each word in any field.
11502    CrossFields,
11503    /// Runs a `match_phrase` query on each field and uses the `_score` from the best field.
11504    Phrase,
11505    /// Runs a `match_phrase_prefix` query on each field and uses the `_score` from the best field.
11506    PhrasePrefix,
11507    /// Creates a `match_bool_prefix` query on each field and combines the `_score` from each field.
11508    BoolPrefix,
11509    /// A value this version of the specification doesn't list.
11510    Raw(::std::string::String),
11511}
11512
11513impl TextQueryType {
11514    /// The value as Elasticsearch writes it.
11515    pub fn as_str(&self) -> &str {
11516        match self {
11517            Self::BestFields => "best_fields",
11518            Self::MostFields => "most_fields",
11519            Self::CrossFields => "cross_fields",
11520            Self::Phrase => "phrase",
11521            Self::PhrasePrefix => "phrase_prefix",
11522            Self::BoolPrefix => "bool_prefix",
11523            Self::Raw(value) => value,
11524        }
11525    }
11526
11527    /// The listed value with this name, if there is one.
11528    pub fn from_known(value: &str) -> ::core::option::Option<Self> {
11529        match value {
11530            "best_fields" => ::core::option::Option::Some(Self::BestFields),
11531            "most_fields" => ::core::option::Option::Some(Self::MostFields),
11532            "cross_fields" => ::core::option::Option::Some(Self::CrossFields),
11533            "phrase" => ::core::option::Option::Some(Self::Phrase),
11534            "phrase_prefix" => ::core::option::Option::Some(Self::PhrasePrefix),
11535            "bool_prefix" => ::core::option::Option::Some(Self::BoolPrefix),
11536            _ => ::core::option::Option::None,
11537        }
11538    }
11539}
11540
11541impl ::serde::Serialize for TextQueryType {
11542    fn serialize<S__: ::serde::Serializer>(
11543        &self,
11544        serializer: S__,
11545    ) -> ::core::result::Result<S__::Ok, S__::Error> {
11546        serializer.serialize_str(self.as_str())
11547    }
11548}
11549
11550impl<'de> ::serde::Deserialize<'de> for TextQueryType {
11551    fn deserialize<D__: ::serde::Deserializer<'de>>(
11552        deserializer: D__,
11553    ) -> ::core::result::Result<Self, D__::Error> {
11554        ::oxsearch_core::__private::deserialize_string_enum(
11555            deserializer,
11556            "TextQueryType",
11557            |value| Self::from_known(value).unwrap_or_else(|| Self::Raw(value.to_owned())),
11558        )
11559    }
11560}
11561
11562#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
11563#[non_exhaustive]
11564pub struct TypeQuery {
11565    /// Floating point number used to decrease or increase the relevance scores of the query.
11566    /// Boost values are relative to the default value of 1.0.
11567    /// A boost value between 0 and 1.0 decreases the relevance score.
11568    /// A value greater than 1.0 increases the relevance score.
11569    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
11570    pub boost: ::core::option::Option<f32>,
11571    #[serde(
11572        rename = "_name",
11573        skip_serializing_if = "::core::option::Option::is_none"
11574    )]
11575    pub name: ::core::option::Option<::std::string::String>,
11576    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
11577    pub value: ::core::option::Option<::std::string::String>,
11578}
11579
11580impl TypeQuery {
11581    /// A `TypeQuery` with its required properties set.
11582    pub fn new(value: impl ::core::convert::Into<::std::string::String>) -> Self {
11583        Self {
11584            boost: ::core::option::Option::None,
11585            name: ::core::option::Option::None,
11586            value: ::core::option::Option::Some(value.into()),
11587        }
11588    }
11589}
11590
11591impl TypeQuery {
11592    /// Sets `boost`.
11593    pub fn boost(mut self, value: f32) -> Self {
11594        self.boost = ::core::option::Option::Some(value.into());
11595        self
11596    }
11597    /// Sets `name`.
11598    pub fn name(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
11599        self.name = ::core::option::Option::Some(value.into());
11600        self
11601    }
11602}
11603
11604#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
11605#[serde(
11606    try_from = "UntypedDecayFunctionRepr",
11607    into = "UntypedDecayFunctionRepr"
11608)]
11609#[non_exhaustive]
11610pub struct UntypedDecayFunction {
11611    /// Determines how the distance is calculated when a field used for computing the decay contains multiple values.
11612    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
11613    pub multi_value_mode: ::core::option::Option<crate::query_dsl::MultiValueMode>,
11614    /// The name of the property that holds `placement`.
11615    pub field: crate::Field,
11616    /// The value under `field`.
11617    pub placement: crate::query_dsl::DecayPlacement<::serde_json::Value, ::serde_json::Value>,
11618}
11619
11620impl UntypedDecayFunction {
11621    /// A `UntypedDecayFunction` with its required properties set.
11622    pub fn new(
11623        field: impl ::core::convert::Into<crate::Field>,
11624        placement: impl ::core::convert::Into<
11625            crate::query_dsl::DecayPlacement<::serde_json::Value, ::serde_json::Value>,
11626        >,
11627    ) -> Self {
11628        Self {
11629            multi_value_mode: ::core::option::Option::None,
11630            field: field.into(),
11631            placement: placement.into(),
11632        }
11633    }
11634}
11635
11636impl UntypedDecayFunction {
11637    /// Sets `multi_value_mode`.
11638    pub fn multi_value_mode(
11639        mut self,
11640        value: impl ::core::convert::Into<crate::query_dsl::MultiValueMode>,
11641    ) -> Self {
11642        self.multi_value_mode = ::core::option::Option::Some(value.into());
11643        self
11644    }
11645}
11646
11647#[derive(::serde::Serialize, ::serde::Deserialize)]
11648struct UntypedDecayFunctionRepr {
11649    /// Determines how the distance is calculated when a field used for computing the decay contains multiple values.
11650    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
11651    multi_value_mode: ::core::option::Option<crate::query_dsl::MultiValueMode>,
11652    #[serde(flatten)]
11653    keyed__: ::indexmap::IndexMap<
11654        crate::Field,
11655        crate::query_dsl::DecayPlacement<::serde_json::Value, ::serde_json::Value>,
11656    >,
11657}
11658
11659impl ::core::convert::TryFrom<UntypedDecayFunctionRepr> for UntypedDecayFunction {
11660    type Error = ::std::string::String;
11661    fn try_from(repr: UntypedDecayFunctionRepr) -> ::core::result::Result<Self, Self::Error> {
11662        let mut keyed = repr.keyed__.into_iter();
11663        match (keyed.next(), keyed.next()) {
11664            (::core::option::Option::Some((field, placement)), ::core::option::Option::None) => {
11665                ::core::result::Result::Ok(Self {
11666                    multi_value_mode: repr.multi_value_mode,
11667                    field,
11668                    placement,
11669                })
11670            }
11671            _ => ::core::result::Result::Err(::std::string::String::from(
11672                "UntypedDecayFunction needs exactly one property keyed by its field",
11673            )),
11674        }
11675    }
11676}
11677
11678impl ::core::convert::From<UntypedDecayFunction> for UntypedDecayFunctionRepr {
11679    fn from(value: UntypedDecayFunction) -> Self {
11680        let mut keyed__ = ::indexmap::IndexMap::new();
11681        keyed__.insert(value.field, value.placement);
11682        Self {
11683            multi_value_mode: value.multi_value_mode,
11684            keyed__,
11685        }
11686    }
11687}
11688
11689#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
11690#[non_exhaustive]
11691pub struct UntypedDistanceFeatureQuery {
11692    /// Floating point number used to decrease or increase the relevance scores of the query.
11693    /// Boost values are relative to the default value of 1.0.
11694    /// A boost value between 0 and 1.0 decreases the relevance score.
11695    /// A value greater than 1.0 increases the relevance score.
11696    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
11697    pub boost: ::core::option::Option<f32>,
11698    #[serde(
11699        rename = "_name",
11700        skip_serializing_if = "::core::option::Option::is_none"
11701    )]
11702    pub name: ::core::option::Option<::std::string::String>,
11703    /// Date or point of origin used to calculate distances.
11704    /// If the `field` value is a `date` or `date_nanos` field, the `origin` value must be a date.
11705    /// Date Math, such as `now-1h`, is supported.
11706    /// If the field value is a `geo_point` field, the `origin` value must be a geopoint.
11707    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
11708    pub origin: ::core::option::Option<::serde_json::Value>,
11709    /// Distance from the `origin` at which relevance scores receive half of the `boost` value.
11710    /// If the `field` value is a `date` or `date_nanos` field, the `pivot` value must be a time unit, such as `1h` or `10d`. If the `field` value is a `geo_point` field, the `pivot` value must be a distance unit, such as `1km` or `12m`.
11711    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
11712    pub pivot: ::core::option::Option<::serde_json::Value>,
11713    /// Name of the field used to calculate distances. This field must meet the following criteria:
11714    /// be a `date`, `date_nanos` or `geo_point` field;
11715    /// have an `index` mapping parameter value of `true`, which is the default;
11716    /// have an `doc_values` mapping parameter value of `true`, which is the default.
11717    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
11718    pub field: ::core::option::Option<crate::Field>,
11719}
11720
11721impl UntypedDistanceFeatureQuery {
11722    /// A `UntypedDistanceFeatureQuery` with its required properties set.
11723    pub fn new(
11724        origin: impl ::core::convert::Into<::serde_json::Value>,
11725        pivot: impl ::core::convert::Into<::serde_json::Value>,
11726        field: impl ::core::convert::Into<crate::Field>,
11727    ) -> Self {
11728        Self {
11729            boost: ::core::option::Option::None,
11730            name: ::core::option::Option::None,
11731            origin: ::core::option::Option::Some(origin.into()),
11732            pivot: ::core::option::Option::Some(pivot.into()),
11733            field: ::core::option::Option::Some(field.into()),
11734        }
11735    }
11736}
11737
11738impl UntypedDistanceFeatureQuery {
11739    /// Sets `boost`.
11740    pub fn boost(mut self, value: f32) -> Self {
11741        self.boost = ::core::option::Option::Some(value.into());
11742        self
11743    }
11744    /// Sets `name`.
11745    pub fn name(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
11746        self.name = ::core::option::Option::Some(value.into());
11747        self
11748    }
11749}
11750
11751#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
11752#[non_exhaustive]
11753pub struct UntypedRangeQuery {
11754    /// Floating point number used to decrease or increase the relevance scores of the query.
11755    /// Boost values are relative to the default value of 1.0.
11756    /// A boost value between 0 and 1.0 decreases the relevance score.
11757    /// A value greater than 1.0 increases the relevance score.
11758    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
11759    pub boost: ::core::option::Option<f32>,
11760    #[serde(
11761        rename = "_name",
11762        skip_serializing_if = "::core::option::Option::is_none"
11763    )]
11764    pub name: ::core::option::Option<::std::string::String>,
11765    /// Indicates how the range query matches values for `range` fields.
11766    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
11767    pub relation: ::core::option::Option<crate::query_dsl::RangeRelation>,
11768    /// Greater than.
11769    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
11770    pub gt: ::core::option::Option<::serde_json::Value>,
11771    /// Greater than or equal to.
11772    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
11773    pub gte: ::core::option::Option<::serde_json::Value>,
11774    /// Less than.
11775    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
11776    pub lt: ::core::option::Option<::serde_json::Value>,
11777    /// Less than or equal to.
11778    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
11779    pub lte: ::core::option::Option<::serde_json::Value>,
11780    /// Date format used to convert `date` values in the query.
11781    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
11782    pub format: ::core::option::Option<crate::DateFormat>,
11783    /// Coordinated Universal Time (UTC) offset or IANA time zone used to convert `date` values in the query to UTC.
11784    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
11785    pub time_zone: ::core::option::Option<crate::TimeZone>,
11786}
11787
11788impl UntypedRangeQuery {
11789    /// A `UntypedRangeQuery` with its required properties set.
11790    pub fn new() -> Self {
11791        Self {
11792            boost: ::core::option::Option::None,
11793            name: ::core::option::Option::None,
11794            relation: ::core::option::Option::None,
11795            gt: ::core::option::Option::None,
11796            gte: ::core::option::Option::None,
11797            lt: ::core::option::Option::None,
11798            lte: ::core::option::Option::None,
11799            format: ::core::option::Option::None,
11800            time_zone: ::core::option::Option::None,
11801        }
11802    }
11803}
11804
11805impl UntypedRangeQuery {
11806    /// Sets `boost`.
11807    pub fn boost(mut self, value: f32) -> Self {
11808        self.boost = ::core::option::Option::Some(value.into());
11809        self
11810    }
11811    /// Sets `name`.
11812    pub fn name(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
11813        self.name = ::core::option::Option::Some(value.into());
11814        self
11815    }
11816    /// Sets `relation`.
11817    pub fn relation(
11818        mut self,
11819        value: impl ::core::convert::Into<crate::query_dsl::RangeRelation>,
11820    ) -> Self {
11821        self.relation = ::core::option::Option::Some(value.into());
11822        self
11823    }
11824    /// Sets `gt`.
11825    pub fn gt(mut self, value: impl ::core::convert::Into<::serde_json::Value>) -> Self {
11826        self.gt = ::core::option::Option::Some(value.into());
11827        self
11828    }
11829    /// Sets `gte`.
11830    pub fn gte(mut self, value: impl ::core::convert::Into<::serde_json::Value>) -> Self {
11831        self.gte = ::core::option::Option::Some(value.into());
11832        self
11833    }
11834    /// Sets `lt`.
11835    pub fn lt(mut self, value: impl ::core::convert::Into<::serde_json::Value>) -> Self {
11836        self.lt = ::core::option::Option::Some(value.into());
11837        self
11838    }
11839    /// Sets `lte`.
11840    pub fn lte(mut self, value: impl ::core::convert::Into<::serde_json::Value>) -> Self {
11841        self.lte = ::core::option::Option::Some(value.into());
11842        self
11843    }
11844    /// Sets `format`.
11845    pub fn format(mut self, value: impl ::core::convert::Into<crate::DateFormat>) -> Self {
11846        self.format = ::core::option::Option::Some(value.into());
11847        self
11848    }
11849    /// Sets `time_zone`.
11850    pub fn time_zone(mut self, value: impl ::core::convert::Into<crate::TimeZone>) -> Self {
11851        self.time_zone = ::core::option::Option::Some(value.into());
11852        self
11853    }
11854}
11855
11856#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
11857#[non_exhaustive]
11858pub struct WeightedTokensQuery {
11859    /// Floating point number used to decrease or increase the relevance scores of the query.
11860    /// Boost values are relative to the default value of 1.0.
11861    /// A boost value between 0 and 1.0 decreases the relevance score.
11862    /// A value greater than 1.0 increases the relevance score.
11863    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
11864    pub boost: ::core::option::Option<f32>,
11865    #[serde(
11866        rename = "_name",
11867        skip_serializing_if = "::core::option::Option::is_none"
11868    )]
11869    pub name: ::core::option::Option<::std::string::String>,
11870    /// The tokens representing this query
11871    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
11872    pub tokens: ::core::option::Option<
11873        ::oxsearch_core::shapes::OneOrMany<::indexmap::IndexMap<::std::string::String, f32>>,
11874    >,
11875    /// Token pruning configurations
11876    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
11877    pub pruning_config: ::core::option::Option<crate::TokenPruningConfig>,
11878}
11879
11880impl WeightedTokensQuery {
11881    /// A `WeightedTokensQuery` with its required properties set.
11882    pub fn new(
11883        tokens: impl ::core::convert::Into<
11884            ::oxsearch_core::shapes::OneOrMany<::indexmap::IndexMap<::std::string::String, f32>>,
11885        >,
11886    ) -> Self {
11887        Self {
11888            boost: ::core::option::Option::None,
11889            name: ::core::option::Option::None,
11890            tokens: ::core::option::Option::Some(tokens.into()),
11891            pruning_config: ::core::option::Option::None,
11892        }
11893    }
11894}
11895
11896impl WeightedTokensQuery {
11897    /// Sets `boost`.
11898    pub fn boost(mut self, value: f32) -> Self {
11899        self.boost = ::core::option::Option::Some(value.into());
11900        self
11901    }
11902    /// Sets `name`.
11903    pub fn name(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
11904        self.name = ::core::option::Option::Some(value.into());
11905        self
11906    }
11907    /// Sets `pruning_config`.
11908    pub fn pruning_config(
11909        mut self,
11910        value: impl ::core::convert::Into<crate::TokenPruningConfig>,
11911    ) -> Self {
11912        self.pruning_config = ::core::option::Option::Some(value.into());
11913        self
11914    }
11915}
11916
11917#[derive(Clone, Debug, PartialEq)]
11918#[non_exhaustive]
11919pub struct WildcardQuery {
11920    /// Floating point number used to decrease or increase the relevance scores of the query.
11921    /// Boost values are relative to the default value of 1.0.
11922    /// A boost value between 0 and 1.0 decreases the relevance score.
11923    /// A value greater than 1.0 increases the relevance score.
11924    pub boost: ::core::option::Option<f32>,
11925    pub name: ::core::option::Option<::std::string::String>,
11926    /// Allows case insensitive matching of the pattern with the indexed field values when set to true. Default is false which means the case sensitivity of matching depends on the underlying field’s mapping.
11927    pub case_insensitive: ::core::option::Option<bool>,
11928    /// Method used to rewrite the query.
11929    pub rewrite: ::core::option::Option<crate::MultiTermQueryRewrite>,
11930    /// Wildcard pattern for terms you wish to find in the provided field. Required, when wildcard is not set.
11931    pub value: ::core::option::Option<::std::string::String>,
11932    /// Wildcard pattern for terms you wish to find in the provided field. Required, when value is not set.
11933    pub wildcard: ::core::option::Option<::std::string::String>,
11934}
11935
11936impl WildcardQuery {
11937    /// A `WildcardQuery` with its required properties set.
11938    pub fn new() -> Self {
11939        Self {
11940            boost: ::core::option::Option::None,
11941            name: ::core::option::Option::None,
11942            case_insensitive: ::core::option::Option::None,
11943            rewrite: ::core::option::Option::None,
11944            value: ::core::option::Option::None,
11945            wildcard: ::core::option::Option::None,
11946        }
11947    }
11948}
11949
11950impl WildcardQuery {
11951    /// Sets `boost`.
11952    pub fn boost(mut self, value: f32) -> Self {
11953        self.boost = ::core::option::Option::Some(value.into());
11954        self
11955    }
11956    /// Sets `name`.
11957    pub fn name(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
11958        self.name = ::core::option::Option::Some(value.into());
11959        self
11960    }
11961    /// Sets `case_insensitive`.
11962    pub fn case_insensitive(mut self, value: bool) -> Self {
11963        self.case_insensitive = ::core::option::Option::Some(value.into());
11964        self
11965    }
11966    /// Sets `rewrite`.
11967    pub fn rewrite(
11968        mut self,
11969        value: impl ::core::convert::Into<crate::MultiTermQueryRewrite>,
11970    ) -> Self {
11971        self.rewrite = ::core::option::Option::Some(value.into());
11972        self
11973    }
11974    /// Sets `value`.
11975    pub fn value(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
11976        self.value = ::core::option::Option::Some(value.into());
11977        self
11978    }
11979    /// Sets `wildcard`.
11980    pub fn wildcard(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
11981        self.wildcard = ::core::option::Option::Some(value.into());
11982        self
11983    }
11984}
11985
11986#[derive(::serde::Serialize, ::serde::Deserialize)]
11987#[serde(remote = "WildcardQuery")]
11988struct WildcardQueryDef {
11989    /// Floating point number used to decrease or increase the relevance scores of the query.
11990    /// Boost values are relative to the default value of 1.0.
11991    /// A boost value between 0 and 1.0 decreases the relevance score.
11992    /// A value greater than 1.0 increases the relevance score.
11993    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
11994    boost: ::core::option::Option<f32>,
11995    #[serde(
11996        rename = "_name",
11997        skip_serializing_if = "::core::option::Option::is_none"
11998    )]
11999    name: ::core::option::Option<::std::string::String>,
12000    /// Allows case insensitive matching of the pattern with the indexed field values when set to true. Default is false which means the case sensitivity of matching depends on the underlying field’s mapping.
12001    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
12002    case_insensitive: ::core::option::Option<bool>,
12003    /// Method used to rewrite the query.
12004    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
12005    rewrite: ::core::option::Option<crate::MultiTermQueryRewrite>,
12006    /// Wildcard pattern for terms you wish to find in the provided field. Required, when wildcard is not set.
12007    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
12008    value: ::core::option::Option<::std::string::String>,
12009    /// Wildcard pattern for terms you wish to find in the provided field. Required, when value is not set.
12010    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
12011    wildcard: ::core::option::Option<::std::string::String>,
12012}
12013
12014impl ::serde::Serialize for WildcardQuery {
12015    fn serialize<S__: ::serde::Serializer>(
12016        &self,
12017        serializer: S__,
12018    ) -> ::core::result::Result<S__::Ok, S__::Error> {
12019        if let (::core::option::Option::Some(short), true) = (
12020            &self.value,
12021            self.boost.is_none()
12022                && self.name.is_none()
12023                && self.case_insensitive.is_none()
12024                && self.rewrite.is_none()
12025                && self.wildcard.is_none(),
12026        ) {
12027            return ::serde::Serialize::serialize(short, serializer);
12028        }
12029        WildcardQueryDef::serialize(self, serializer)
12030    }
12031}
12032
12033impl<'de> ::oxsearch_core::__private::Shorthand<'de> for WildcardQuery {
12034    type Short = ::std::string::String;
12035    fn from_short(short: ::std::string::String) -> Self {
12036        Self {
12037            boost: ::core::option::Option::None,
12038            name: ::core::option::Option::None,
12039            case_insensitive: ::core::option::Option::None,
12040            rewrite: ::core::option::Option::None,
12041            value: ::core::option::Option::Some(short),
12042            wildcard: ::core::option::Option::None,
12043        }
12044    }
12045    fn deserialize_full<D__: ::serde::Deserializer<'de>>(
12046        deserializer: D__,
12047    ) -> ::core::result::Result<Self, D__::Error> {
12048        WildcardQueryDef::deserialize(deserializer)
12049    }
12050}
12051
12052impl<'de> ::serde::Deserialize<'de> for WildcardQuery {
12053    fn deserialize<D__: ::serde::Deserializer<'de>>(
12054        deserializer: D__,
12055    ) -> ::core::result::Result<Self, D__::Error> {
12056        ::oxsearch_core::__private::deserialize_shorthand(deserializer)
12057    }
12058}
12059
12060#[derive(Clone, Debug, PartialEq, ::serde::Serialize, ::serde::Deserialize)]
12061#[non_exhaustive]
12062pub struct WrapperQuery {
12063    /// Floating point number used to decrease or increase the relevance scores of the query.
12064    /// Boost values are relative to the default value of 1.0.
12065    /// A boost value between 0 and 1.0 decreases the relevance score.
12066    /// A value greater than 1.0 increases the relevance score.
12067    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
12068    pub boost: ::core::option::Option<f32>,
12069    #[serde(
12070        rename = "_name",
12071        skip_serializing_if = "::core::option::Option::is_none"
12072    )]
12073    pub name: ::core::option::Option<::std::string::String>,
12074    /// A base64 encoded query.
12075    /// The binary data format can be any of JSON, YAML, CBOR or SMILE encodings
12076    #[serde(skip_serializing_if = "::core::option::Option::is_none")]
12077    pub query: ::core::option::Option<::std::string::String>,
12078}
12079
12080impl WrapperQuery {
12081    /// A `WrapperQuery` with its required properties set.
12082    pub fn new(query: impl ::core::convert::Into<::std::string::String>) -> Self {
12083        Self {
12084            boost: ::core::option::Option::None,
12085            name: ::core::option::Option::None,
12086            query: ::core::option::Option::Some(query.into()),
12087        }
12088    }
12089}
12090
12091impl WrapperQuery {
12092    /// Sets `boost`.
12093    pub fn boost(mut self, value: f32) -> Self {
12094        self.boost = ::core::option::Option::Some(value.into());
12095        self
12096    }
12097    /// Sets `name`.
12098    pub fn name(mut self, value: impl ::core::convert::Into<::std::string::String>) -> Self {
12099        self.name = ::core::option::Option::Some(value.into());
12100        self
12101    }
12102}
12103
12104#[derive(Clone, Debug, PartialEq, Eq, Hash)]
12105#[non_exhaustive]
12106pub enum ZeroTermsQuery {
12107    /// Returns all documents, similar to a `match_all` query.
12108    All,
12109    /// No documents are returned if the `analyzer` removes all tokens.
12110    None,
12111    /// A value this version of the specification doesn't list.
12112    Raw(::std::string::String),
12113}
12114
12115impl ZeroTermsQuery {
12116    /// The value as Elasticsearch writes it.
12117    pub fn as_str(&self) -> &str {
12118        match self {
12119            Self::All => "all",
12120            Self::None => "none",
12121            Self::Raw(value) => value,
12122        }
12123    }
12124
12125    /// The listed value with this name, if there is one.
12126    pub fn from_known(value: &str) -> ::core::option::Option<Self> {
12127        match value {
12128            "all" => ::core::option::Option::Some(Self::All),
12129            "none" => ::core::option::Option::Some(Self::None),
12130            _ => ::core::option::Option::None,
12131        }
12132    }
12133}
12134
12135impl ::serde::Serialize for ZeroTermsQuery {
12136    fn serialize<S__: ::serde::Serializer>(
12137        &self,
12138        serializer: S__,
12139    ) -> ::core::result::Result<S__::Ok, S__::Error> {
12140        serializer.serialize_str(self.as_str())
12141    }
12142}
12143
12144impl<'de> ::serde::Deserialize<'de> for ZeroTermsQuery {
12145    fn deserialize<D__: ::serde::Deserializer<'de>>(
12146        deserializer: D__,
12147    ) -> ::core::result::Result<Self, D__::Error> {
12148        ::oxsearch_core::__private::deserialize_string_enum(
12149            deserializer,
12150            "ZeroTermsQuery",
12151            |value| Self::from_known(value).unwrap_or_else(|| Self::Raw(value.to_owned())),
12152        )
12153    }
12154}