diff --git a/CHANGELOG.md b/CHANGELOG.md index 39e986483..e2e082a95 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -52,6 +52,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) - Fixed `fields` in `Hit` allowing primitive arrays ([#699](https://github.com/opensearch-project/opensearch-api-specification/pull/699)) - Added missing `repository` query parameter to `/_cat/snapshots` ([#700](https://github.com/opensearch-project/opensearch-api-specification/pull/700)) - Fixed `hits` in `rank_eval` allowing numbers ([#704](https://github.com/opensearch-project/opensearch-api-specification/pull/704)) +- Fixed query DSL schemas ([#706](https://github.com/opensearch-project/opensearch-api-specification/pull/706)) ### Changed - Changed `tasks._common:TaskInfo` and `tasks._common:TaskGroup` to be composed of a `tasks._common:TaskInfoBase` ([#683](https://github.com/opensearch-project/opensearch-api-specification/pull/683)) diff --git a/spec/namespaces/indices.yaml b/spec/namespaces/indices.yaml index 442021c5b..90393c87f 100644 --- a/spec/namespaces/indices.yaml +++ b/spec/namespaces/indices.yaml @@ -2146,12 +2146,12 @@ components: Templates with lower 'order' values are merged first. Templates with higher 'order' values are merged later, overriding templates with lower values. - type: number + type: integer + format: int32 settings: description: Configuration options for the index. type: object - additionalProperties: - type: object + additionalProperties: true version: $ref: '../schemas/_common.yaml#/components/schemas/VersionNumber' description: The template definition diff --git a/spec/schemas/_common.mapping.yaml b/spec/schemas/_common.mapping.yaml index 771955942..201fb9cf9 100644 --- a/spec/schemas/_common.mapping.yaml +++ b/spec/schemas/_common.mapping.yaml @@ -105,6 +105,55 @@ components: type: string unmatch: type: string + FieldType: + type: string + enum: + - aggregate_metric_double + - alias + - binary + - boolean + - byte + - completion + - constant_keyword + - date + - date_nanos + - date_range + - double + - double_range + - flat_object + - float + - float_range + - geo_point + - geo_shape + - half_float + - histogram + - icu_collation_keyword + - integer + - integer_range + - ip + - ip_range + - join + - keyword + - knn_vector + - long + - long_range + - match_only_text + - murmur3 + - nested + - object + - percolator + - rank_feature + - rank_features + - scaled_float + - search_as_you_type + - short + - text + - token_count + - unsigned_long + - version + - wildcard + - xy_point + - xy_shape Property: type: object discriminator: diff --git a/spec/schemas/_common.query_dsl.yaml b/spec/schemas/_common.query_dsl.yaml index 34206b155..a2910c42e 100644 --- a/spec/schemas/_common.query_dsl.yaml +++ b/spec/schemas/_common.query_dsl.yaml @@ -9,8 +9,12 @@ components: Operator: type: string enum: + # eslint-disable yml/sort-sequence-values - and + - AND - or + - OR + # eslint-enable yml/sort-sequence-values QueryContainer: type: object properties: @@ -21,6 +25,8 @@ components: common: deprecated: true type: object + propertyNames: + $ref: '_common.yaml#/components/schemas/Field' additionalProperties: $ref: '#/components/schemas/CommonTermsQuery' minProperties: 1 @@ -40,6 +46,8 @@ components: fuzzy: description: Returns documents that contain terms similar to the search term, as measured by a Levenshtein edit distance. type: object + propertyNames: + $ref: '_common.yaml#/components/schemas/Field' additionalProperties: $ref: '#/components/schemas/FuzzyQuery' minProperties: 1 @@ -56,26 +64,36 @@ components: $ref: '#/components/schemas/HasChildQuery' has_parent: $ref: '#/components/schemas/HasParentQuery' + hybrid: + $ref: '#/components/schemas/HybridQuery' ids: $ref: '#/components/schemas/IdsQuery' intervals: description: Returns documents based on the order and proximity of matching terms. type: object + propertyNames: + $ref: '_common.yaml#/components/schemas/Field' additionalProperties: $ref: '#/components/schemas/IntervalsQuery' minProperties: 1 maxProperties: 1 knn: - $ref: '#/components/schemas/KnnQuery' + type: object + propertyNames: + $ref: '_common.yaml#/components/schemas/Field' + additionalProperties: + $ref: '#/components/schemas/KnnQuery' + minProperties: 1 + maxProperties: 1 match: description: |- Returns documents that match a provided text, number, date or Boolean value. The provided text is analyzed before matching. type: object + propertyNames: + $ref: '_common.yaml#/components/schemas/Field' additionalProperties: - anyOf: - - $ref: '#/components/schemas/MatchQuery' - - { } + $ref: '#/components/schemas/MatchQuery' minProperties: 1 maxProperties: 1 match_all: @@ -86,6 +104,8 @@ components: Each term except the last is used in a `term` query. The last term is used in a prefix query. type: object + propertyNames: + $ref: '_common.yaml#/components/schemas/Field' additionalProperties: $ref: '#/components/schemas/MatchBoolPrefixQuery' minProperties: 1 @@ -95,6 +115,8 @@ components: match_phrase: description: Analyzes the text and creates a phrase query out of the analyzed text. type: object + propertyNames: + $ref: '_common.yaml#/components/schemas/Field' additionalProperties: $ref: '#/components/schemas/MatchPhraseQuery' minProperties: 1 @@ -104,6 +126,8 @@ components: Returns documents that contain the words of a provided text, in the same order as provided. The last term of the provided text is treated as a prefix, matching any words that begin with that term. type: object + propertyNames: + $ref: '_common.yaml#/components/schemas/Field' additionalProperties: $ref: '#/components/schemas/MatchPhrasePrefixQuery' minProperties: 1 @@ -115,7 +139,13 @@ components: nested: $ref: '#/components/schemas/NestedQuery' neural: - $ref: '#/components/schemas/NeuralQuery' + type: object + propertyNames: + $ref: '_common.yaml#/components/schemas/Field' + additionalProperties: + $ref: '#/components/schemas/NeuralQuery' + minProperties: 1 + maxProperties: 1 parent_id: $ref: '#/components/schemas/ParentIdQuery' percolate: @@ -125,6 +155,8 @@ components: prefix: description: Returns documents that contain a specific prefix in a provided field. type: object + propertyNames: + $ref: '_common.yaml#/components/schemas/Field' additionalProperties: $ref: '#/components/schemas/PrefixQuery' minProperties: 1 @@ -134,6 +166,8 @@ components: range: description: Returns documents that contain terms within a provided range. type: object + propertyNames: + $ref: '_common.yaml#/components/schemas/Field' additionalProperties: $ref: '#/components/schemas/RangeQuery' minProperties: 1 @@ -143,12 +177,12 @@ components: regexp: description: Returns documents that contain terms matching a regular expression. type: object + propertyNames: + $ref: '_common.yaml#/components/schemas/Field' additionalProperties: $ref: '#/components/schemas/RegexpQuery' minProperties: 1 maxProperties: 1 - rule_query: - $ref: '#/components/schemas/RuleQuery' script: $ref: '#/components/schemas/ScriptQuery' script_score: @@ -172,6 +206,8 @@ components: span_term: description: Matches spans containing a term. type: object + propertyNames: + $ref: '_common.yaml#/components/schemas/Field' additionalProperties: $ref: '#/components/schemas/SpanTermQuery' minProperties: 1 @@ -183,44 +219,34 @@ components: Returns documents that contain an exact term in a provided field. To return a document, the query term must exactly match the queried field's value, including white space and capitalization. type: object + propertyNames: + $ref: '_common.yaml#/components/schemas/Field' additionalProperties: - anyOf: - - $ref: '#/components/schemas/TermQuery' - - $ref: '_common.yaml#/components/schemas/FieldValue' + $ref: '#/components/schemas/TermQuery' minProperties: 1 maxProperties: 1 terms: description: |- Returns documents that contain one or more exact terms in a provided field. - $ref: '#/components/schemas/TermsQueryField' + $ref: '#/components/schemas/TermsQuery' terms_set: description: |- Returns documents that contain a minimum number of exact terms in a provided field. To return a document, a required number of terms must exactly match the field values, including white space and capitalization. type: object + propertyNames: + $ref: '_common.yaml#/components/schemas/Field' additionalProperties: $ref: '#/components/schemas/TermsSetQuery' minProperties: 1 maxProperties: 1 - text_expansion: - description: 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. - type: object - additionalProperties: - $ref: '#/components/schemas/TextExpansionQuery' - minProperties: 1 - maxProperties: 1 type: $ref: '#/components/schemas/TypeQuery' - weighted_tokens: - description: Supports returning `text_expansion` query results by sending in precomputed tokens with the query. - type: object - additionalProperties: - $ref: '#/components/schemas/WeightedTokensQuery' - minProperties: 1 - maxProperties: 1 wildcard: description: Returns documents that contain terms matching a wildcard pattern. type: object + propertyNames: + $ref: '_common.yaml#/components/schemas/Field' additionalProperties: $ref: '#/components/schemas/WildcardQuery' minProperties: 1 @@ -308,25 +334,28 @@ components: - negative_boost - positive CommonTermsQuery: - allOf: - - $ref: '#/components/schemas/QueryBase' - - type: object - properties: - analyzer: - type: string - cutoff_frequency: - type: number - format: float - high_freq_operator: - $ref: '#/components/schemas/Operator' - low_freq_operator: - $ref: '#/components/schemas/Operator' - minimum_should_match: - $ref: '_common.yaml#/components/schemas/MinimumShouldMatch' - query: - type: string - required: - - query + oneOf: + - title: query + type: string + - allOf: + - $ref: '#/components/schemas/QueryBase' + - type: object + properties: + analyzer: + type: string + cutoff_frequency: + type: number + format: float + high_freq_operator: + $ref: '#/components/schemas/Operator' + low_freq_operator: + $ref: '#/components/schemas/Operator' + minimum_should_match: + $ref: '_common.yaml#/components/schemas/MinimumShouldMatch' + query: + type: string + required: + - query CombinedFieldsQuery: allOf: - $ref: '#/components/schemas/QueryBase' @@ -589,33 +618,33 @@ components: - multiply - sum FuzzyQuery: - allOf: - - $ref: '#/components/schemas/QueryBase' - - type: object - properties: - max_expansions: - description: Maximum number of variations created. - type: integer - format: int32 - prefix_length: - description: Number of beginning characters left unchanged when creating expansions. - type: integer - format: int32 - rewrite: - $ref: '_common.yaml#/components/schemas/MultiTermQueryRewrite' - transpositions: - description: Indicates whether edits include transpositions of two adjacent characters (for example, `ab` to `ba`). - type: boolean - fuzziness: - $ref: '_common.yaml#/components/schemas/Fuzziness' - value: - description: Term you wish to find in the provided field. - oneOf: - - type: string - - type: number - - type: boolean - required: - - value + oneOf: + - title: value + $ref: '_common.yaml#/components/schemas/FieldValue' + - allOf: + - $ref: '#/components/schemas/QueryBase' + - type: object + properties: + max_expansions: + description: Maximum number of variations created. + type: integer + format: int32 + prefix_length: + description: Number of beginning characters left unchanged when creating expansions. + type: integer + format: int32 + rewrite: + $ref: '_common.yaml#/components/schemas/MultiTermQueryRewrite' + transpositions: + description: Indicates whether edits include transpositions of two adjacent characters (for example, `ab` to `ba`). + type: boolean + fuzziness: + $ref: '_common.yaml#/components/schemas/Fuzziness' + value: + description: Term you wish to find in the provided field. + $ref: '_common.yaml#/components/schemas/FieldValue' + required: + - value IgnoreUnmapped: type: boolean default: false @@ -732,17 +761,20 @@ components: - query - type FieldAndFormat: - type: object - properties: - field: + oneOf: + - title: field $ref: '_common.yaml#/components/schemas/Field' - format: - description: Format in which the values are returned. - type: string - include_unmapped: - type: boolean - required: - - field + - type: object + properties: + field: + $ref: '_common.yaml#/components/schemas/Field' + format: + description: Format in which the values are returned. + type: string + include_unmapped: + type: boolean + required: + - field ChildScoreMode: type: string enum: @@ -773,6 +805,15 @@ components: required: - parent_type - query + HybridQuery: + allOf: + - $ref: '#/components/schemas/QueryBase' + - type: object + properties: + queries: + type: array + items: + $ref: '#/components/schemas/QueryContainer' IdsQuery: allOf: - $ref: '#/components/schemas/QueryBase' @@ -946,152 +987,205 @@ components: $ref: '_common.yaml#/components/schemas/Field' required: - pattern + QueryVector: + type: array + items: + type: number + format: float KnnQuery: - type: object - additionalProperties: - $ref: '_common.yaml#/components/schemas/KnnField' - minProperties: 1 - maxProperties: 1 - MatchQuery: allOf: - $ref: '#/components/schemas/QueryBase' - type: object properties: - analyzer: - description: Analyzer used to convert the text in the query value into tokens. - type: string - auto_generate_synonyms_phrase_query: - description: If `true`, match phrase queries are automatically created for multi-term synonyms. - type: boolean - cutoff_frequency: - deprecated: true - type: number - format: float - fuzziness: - $ref: '_common.yaml#/components/schemas/Fuzziness' - fuzzy_rewrite: - $ref: '_common.yaml#/components/schemas/MultiTermQueryRewrite' - fuzzy_transpositions: - description: If `true`, edits for fuzzy matching include transpositions of two adjacent characters (for example, `ab` to `ba`). - type: boolean - lenient: - description: If `true`, format-based errors, such as providing a text query value for a numeric field, are ignored. - type: boolean - max_expansions: - description: Maximum number of terms to which the query will expand. + vector: + $ref: '#/components/schemas/QueryVector' + k: + description: The total number of nearest neighbors to return as top hits. type: integer format: int32 - minimum_should_match: - $ref: '_common.yaml#/components/schemas/MinimumShouldMatch' - operator: - $ref: '#/components/schemas/Operator' - prefix_length: - description: Number of beginning characters left unchanged for fuzzy matching. - type: integer - format: int32 - query: - description: Text, number, Boolean value or date you wish to find in the provided field. + min_score: + description: The minimum similarity score required in order for a neighbor to be considered a hit. + type: number + format: float + x-version-added: '2.14' + max_distance: + description: The maximum physical vector space distance required in order for a neighbor to be considered a hit. + type: number + format: float + x-version-added: '2.14' + filter: + description: The filters for the k-NN search query. oneOf: - - type: string - - type: number - - type: boolean - zero_terms_query: - $ref: '#/components/schemas/ZeroTermsQuery' + - $ref: '_common.query_dsl.yaml#/components/schemas/QueryContainer' + - type: array + items: + $ref: '_common.query_dsl.yaml#/components/schemas/QueryContainer' + method_parameters: + type: object + x-version-added: '2.16' + additionalProperties: + type: integer + format: int32 + rescore: + type: object + x-version-added: '2.17' + additionalProperties: + type: number + format: float required: - - query + - vector + MatchQuery: + oneOf: + - title: query + $ref: '_common.yaml#/components/schemas/FieldValue' + - allOf: + - $ref: '#/components/schemas/QueryBase' + - type: object + properties: + analyzer: + description: Analyzer used to convert the text in the query value into tokens. + type: string + auto_generate_synonyms_phrase_query: + description: If `true`, match phrase queries are automatically created for multi-term synonyms. + type: boolean + cutoff_frequency: + deprecated: true + type: number + format: float + fuzziness: + $ref: '_common.yaml#/components/schemas/Fuzziness' + fuzzy_rewrite: + $ref: '_common.yaml#/components/schemas/MultiTermQueryRewrite' + fuzzy_transpositions: + description: If `true`, edits for fuzzy matching include transpositions of two adjacent characters (for example, `ab` to `ba`). + type: boolean + lenient: + description: If `true`, format-based errors, such as providing a text query value for a numeric field, are ignored. + type: boolean + max_expansions: + description: Maximum number of terms to which the query will expand. + type: integer + format: int32 + minimum_should_match: + $ref: '_common.yaml#/components/schemas/MinimumShouldMatch' + operator: + $ref: '#/components/schemas/Operator' + prefix_length: + description: Number of beginning characters left unchanged for fuzzy matching. + type: integer + format: int32 + query: + description: Text, number, Boolean value or date you wish to find in the provided field. + $ref: '_common.yaml#/components/schemas/FieldValue' + zero_terms_query: + $ref: '#/components/schemas/ZeroTermsQuery' + required: + - query ZeroTermsQuery: type: string enum: - all - none MatchAllQuery: - $ref: '#/components/schemas/QueryBase' - MatchBoolPrefixQuery: allOf: - $ref: '#/components/schemas/QueryBase' - type: object - properties: - analyzer: - description: Analyzer used to convert the text in the query value into tokens. - type: string - fuzziness: - $ref: '_common.yaml#/components/schemas/Fuzziness' - fuzzy_rewrite: - $ref: '_common.yaml#/components/schemas/MultiTermQueryRewrite' - fuzzy_transpositions: - description: |- - If `true`, edits for fuzzy matching include transpositions of two adjacent characters (for example, `ab` to `ba`). - Can be applied to the term subqueries constructed for all terms but the final term. - type: boolean - max_expansions: - description: |- - Maximum number of terms to which the query will expand. - Can be applied to the term subqueries constructed for all terms but the final term. - type: integer - format: int32 - minimum_should_match: - $ref: '_common.yaml#/components/schemas/MinimumShouldMatch' - operator: - $ref: '#/components/schemas/Operator' - prefix_length: - description: |- - Number of beginning characters left unchanged for fuzzy matching. - Can be applied to the term subqueries constructed for all terms but the final term. - type: integer - format: int32 - query: - description: |- - Terms you wish to find in the provided field. - The last term is used in a prefix query. - type: string - required: - - query + properties: {} + MatchBoolPrefixQuery: + oneOf: + - title: query + type: string + - allOf: + - $ref: '#/components/schemas/QueryBase' + - type: object + properties: + analyzer: + description: Analyzer used to convert the text in the query value into tokens. + type: string + fuzziness: + $ref: '_common.yaml#/components/schemas/Fuzziness' + fuzzy_rewrite: + $ref: '_common.yaml#/components/schemas/MultiTermQueryRewrite' + fuzzy_transpositions: + description: |- + If `true`, edits for fuzzy matching include transpositions of two adjacent characters (for example, `ab` to `ba`). + Can be applied to the term subqueries constructed for all terms but the final term. + type: boolean + max_expansions: + description: |- + Maximum number of terms to which the query will expand. + Can be applied to the term subqueries constructed for all terms but the final term. + type: integer + format: int32 + minimum_should_match: + $ref: '_common.yaml#/components/schemas/MinimumShouldMatch' + operator: + $ref: '#/components/schemas/Operator' + prefix_length: + description: |- + Number of beginning characters left unchanged for fuzzy matching. + Can be applied to the term subqueries constructed for all terms but the final term. + type: integer + format: int32 + query: + description: |- + Terms you wish to find in the provided field. + The last term is used in a prefix query. + type: string + required: + - query MatchNoneQuery: allOf: - $ref: '#/components/schemas/QueryBase' - type: object MatchPhraseQuery: - allOf: - - $ref: '#/components/schemas/QueryBase' - - type: object - properties: - analyzer: - description: Analyzer used to convert the text in the query value into tokens. - type: string - query: - description: Query terms that are analyzed and turned into a phrase query. - type: string - slop: - description: Maximum number of positions allowed between matching tokens. - type: integer - format: int32 - zero_terms_query: - $ref: '#/components/schemas/ZeroTermsQuery' - required: - - query + oneOf: + - title: query + type: string + - allOf: + - $ref: '#/components/schemas/QueryBase' + - type: object + properties: + analyzer: + description: Analyzer used to convert the text in the query value into tokens. + type: string + query: + description: Query terms that are analyzed and turned into a phrase query. + type: string + slop: + description: Maximum number of positions allowed between matching tokens. + type: integer + format: int32 + zero_terms_query: + $ref: '#/components/schemas/ZeroTermsQuery' + required: + - query MatchPhrasePrefixQuery: - allOf: - - $ref: '#/components/schemas/QueryBase' - - type: object - properties: - analyzer: - description: Analyzer used to convert text in the query value into tokens. - type: string - max_expansions: - description: Maximum number of terms to which the last provided term of the query value will expand. - type: integer - format: int32 - query: - description: Text you wish to find in the provided field. - type: string - slop: - description: Maximum number of positions allowed between matching tokens. - type: integer - format: int32 - zero_terms_query: - $ref: '#/components/schemas/ZeroTermsQuery' - required: - - query + oneOf: + - title: query + type: string + - allOf: + - $ref: '#/components/schemas/QueryBase' + - type: object + properties: + analyzer: + description: Analyzer used to convert text in the query value into tokens. + type: string + max_expansions: + description: Maximum number of terms to which the last provided term of the query value will expand. + type: integer + format: int32 + query: + description: Text you wish to find in the provided field. + type: string + slop: + description: Maximum number of positions allowed between matching tokens. + type: integer + format: int32 + zero_terms_query: + $ref: '#/components/schemas/ZeroTermsQuery' + required: + - query MoreLikeThisQuery: allOf: - $ref: '#/components/schemas/QueryBase' @@ -1182,14 +1276,15 @@ components: Like: description: Text that we want similar documents for or a lookup to a document's field for the text. oneOf: - - type: string - - $ref: '#/components/schemas/LikeDocument' + - title: text + type: string + - title: document + $ref: '#/components/schemas/LikeDocument' LikeDocument: type: object properties: doc: description: A document not present in the index. - type: object fields: type: array items: @@ -1198,6 +1293,8 @@ components: $ref: '_common.yaml#/components/schemas/Id' _index: $ref: '_common.yaml#/components/schemas/IndexName' + _type: + $ref: '_common.yaml#/components/schemas/Type' per_field_analyzer: type: object additionalProperties: @@ -1298,28 +1395,24 @@ components: allOf: - $ref: '#/components/schemas/QueryBase' - type: object - additionalProperties: - $ref: '#/components/schemas/NeuralQueryVectorField' - NeuralQueryVectorField: - type: object - properties: - query_text: - type: string - query_image: - type: string - contentEncoding: base64 - model_id: - type: string - k: - type: integer - min_score: - type: number - format: float - max_distance: - type: number - format: float - filter: - $ref: '#/components/schemas/QueryContainer' + properties: + query_text: + type: string + query_image: + type: string + contentEncoding: base64 + model_id: + type: string + k: + type: integer + min_score: + type: number + format: float + max_distance: + type: number + format: float + filter: + $ref: '#/components/schemas/QueryContainer' ParentIdQuery: allOf: - $ref: '#/components/schemas/QueryBase' @@ -1339,12 +1432,10 @@ components: properties: document: description: The source of the document being percolated. - type: object documents: description: An array of sources of the documents being percolated. type: array - items: - type: object + items: {} field: $ref: '_common.yaml#/components/schemas/Field' id: @@ -1402,22 +1493,25 @@ components: - _id - _index PrefixQuery: - allOf: - - $ref: '#/components/schemas/QueryBase' - - type: object - properties: - rewrite: - $ref: '_common.yaml#/components/schemas/MultiTermQueryRewrite' - value: - description: Beginning characters of terms you wish to find in the provided field. - type: string - case_insensitive: - description: |- - Allows ASCII case insensitive matching of the value 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. - type: boolean - required: - - value + oneOf: + - title: value + type: string + - allOf: + - $ref: '#/components/schemas/QueryBase' + - type: object + properties: + rewrite: + $ref: '_common.yaml#/components/schemas/MultiTermQueryRewrite' + value: + description: Beginning characters of terms you wish to find in the provided field. + type: string + case_insensitive: + description: |- + Allows ASCII case insensitive matching of the value 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. + type: boolean + required: + - value QueryStringQuery: allOf: - $ref: '#/components/schemas/QueryBase' @@ -1625,44 +1719,32 @@ components: - exponent - pivot RegexpQuery: - allOf: - - $ref: '#/components/schemas/QueryBase' - - type: object - properties: - case_insensitive: - description: |- - Allows case insensitive matching of the regular expression value with the indexed field values when set to `true`. - When `false`, case sensitivity of matching depends on the underlying field's mapping. - type: boolean - flags: - description: Enables optional operators for the regular expression. - type: string - max_determinized_states: - description: Maximum number of automaton states required for the query. - type: integer - format: int32 - rewrite: - $ref: '_common.yaml#/components/schemas/MultiTermQueryRewrite' - value: - description: Regular expression for terms you wish to find in the provided field. - type: string - required: - - value - RuleQuery: - allOf: - - $ref: '#/components/schemas/QueryBase' - - type: object - properties: - organic: - $ref: '#/components/schemas/QueryContainer' - ruleset_id: - $ref: '_common.yaml#/components/schemas/Id' - match_criteria: - type: object - required: - - match_criteria - - organic - - ruleset_id + oneOf: + - title: value + type: string + - allOf: + - $ref: '#/components/schemas/QueryBase' + - type: object + properties: + case_insensitive: + description: |- + Allows case insensitive matching of the regular expression value with the indexed field values when set to `true`. + When `false`, case sensitivity of matching depends on the underlying field's mapping. + type: boolean + flags: + description: Enables optional operators for the regular expression. + type: string + max_determinized_states: + description: Maximum number of automaton states required for the query. + type: integer + format: int32 + rewrite: + $ref: '_common.yaml#/components/schemas/MultiTermQueryRewrite' + value: + description: Regular expression for terms you wish to find in the provided field. + type: string + required: + - value ScriptQuery: allOf: - $ref: '#/components/schemas/QueryBase' @@ -1741,8 +1823,11 @@ components: - query SimpleQueryStringFlags: description: Query flags can be either a single flag or a combination of flags (e.g. `OR|AND|PREFIX`). - allOf: - - $ref: '_common.yaml#/components/schemas/PipeSeparatedFlagsSimpleQueryStringFlag' + oneOf: + - title: single + $ref: '_common.query_dsl.yaml#/components/schemas/SimpleQueryStringFlag' + - title: multiple + type: string SimpleQueryStringFlag: type: string enum: @@ -1902,14 +1987,17 @@ components: required: - clauses SpanTermQuery: - allOf: - - $ref: '#/components/schemas/QueryBase' - - type: object - properties: - value: - type: string - required: - - value + oneOf: + - title: value + type: string + - allOf: + - $ref: '#/components/schemas/QueryBase' + - type: object + properties: + value: + type: string + required: + - value SpanWithinQuery: allOf: - $ref: '#/components/schemas/QueryBase' @@ -1923,38 +2011,41 @@ components: - big - little TermQuery: + oneOf: + - title: value + $ref: '_common.yaml#/components/schemas/FieldValue' + - allOf: + - $ref: '#/components/schemas/QueryBase' + - type: object + properties: + value: + $ref: '_common.yaml#/components/schemas/FieldValue' + case_insensitive: + description: |- + Allows ASCII case insensitive matching of the value with the indexed field values when set to `true`. + When `false`, the case sensitivity of matching depends on the underlying field's mapping. + type: boolean + required: + - value + TermsQuery: allOf: - $ref: '#/components/schemas/QueryBase' - type: object properties: - value: - $ref: '_common.yaml#/components/schemas/FieldValue' - case_insensitive: - description: |- - Allows ASCII case insensitive matching of the value with the indexed field values when set to `true`. - When `false`, the case sensitivity of matching depends on the underlying field's mapping. - type: boolean - required: - - value - + _name: {} + boost: {} + additionalProperties: + $ref: '#/components/schemas/TermsQueryField' + minProperties: 1 TermsQueryField: - type: object - properties: - boost: - description: - |- - A floating-point value that specifies the weight of this field toward the relevance score. - Values above 1.0 increase the field’s relevance. Values between 0.0 and 1.0 decrease the field’s relevance. - Default is 1.0. - type: number - format: float - additionalProperties: - oneOf: - - $ref: '#/components/schemas/TermsLookupField' - - type: array - items: - type: string - TermsLookupField: + oneOf: + - title: value + type: array + items: + $ref: '_common.yaml#/components/schemas/FieldValue' + - title: lookup + $ref: '#/components/schemas/TermsLookup' + TermsLookup: type: object properties: index: @@ -1980,34 +2071,6 @@ components: type: string required: - terms - TextExpansionQuery: - allOf: - - $ref: '#/components/schemas/QueryBase' - - type: object - properties: - model_id: - description: The text expansion NLP model to use - type: string - model_text: - description: The query text - type: string - pruning_config: - $ref: '#/components/schemas/TokenPruningConfig' - required: - - model_id - - model_text - TokenPruningConfig: - type: object - properties: - tokens_freq_ratio_threshold: - description: Tokens whose frequency is more than this threshold times the average frequency of all tokens in the specified field are considered outliers and pruned. - type: number - tokens_weight_threshold: - description: Tokens whose weight is less than this threshold are considered nonsignificant and pruned. - type: number - only_score_pruned_tokens: - description: Whether to only score pruned tokens, vs only scoring kept tokens. - type: boolean TypeQuery: allOf: - $ref: '#/components/schemas/QueryBase' @@ -2016,37 +2079,26 @@ components: value: type: string required: - - value - WeightedTokensQuery: - allOf: - - $ref: '#/components/schemas/QueryBase' - - type: object - properties: - tokens: - description: The tokens representing this query - type: object - additionalProperties: - type: number - pruning_config: - $ref: '#/components/schemas/TokenPruningConfig' - required: - - tokens + - value WildcardQuery: - allOf: - - $ref: '#/components/schemas/QueryBase' - - type: object - properties: - case_insensitive: - description: 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. - type: boolean - rewrite: - $ref: '_common.yaml#/components/schemas/MultiTermQueryRewrite' - value: - description: Wildcard pattern for terms you wish to find in the provided field. Required, when wildcard is not set. - type: string - wildcard: - description: Wildcard pattern for terms you wish to find in the provided field. Required, when value is not set. - type: string + oneOf: + - title: value + type: string + - allOf: + - $ref: '#/components/schemas/QueryBase' + - type: object + properties: + case_insensitive: + description: 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. + type: boolean + rewrite: + $ref: '_common.yaml#/components/schemas/MultiTermQueryRewrite' + value: + description: Wildcard pattern for terms you wish to find in the provided field. Required, when wildcard is not set. + type: string + wildcard: + description: Wildcard pattern for terms you wish to find in the provided field. Required, when value is not set. + type: string WrapperQuery: allOf: - $ref: '#/components/schemas/QueryBase' diff --git a/spec/schemas/_common.yaml b/spec/schemas/_common.yaml index 6c5b04e77..e28625a07 100644 --- a/spec/schemas/_common.yaml +++ b/spec/schemas/_common.yaml @@ -202,7 +202,6 @@ components: - boolean - 'null' - number - - object - string Void: description: |- @@ -519,14 +518,14 @@ components: required: - id MultiTermQueryRewrite: - type: string - enum: - - constant_score - - constant_score_boolean - - scoring_boolean - - top_terms_N - - top_terms_blended_freqs_N - - top_terms_boost_N + oneOf: + - type: string + enum: + - constant_score + - constant_score_boolean + - scoring_boolean + - type: string + pattern: top_terms(_blended_freqs|_boost)?_\d+ Fuzziness: oneOf: - type: string @@ -550,41 +549,76 @@ components: - script Sort: oneOf: - - $ref: '#/components/schemas/SortCombinations' + - $ref: '#/components/schemas/SortOptions' - type: array items: - $ref: '#/components/schemas/SortCombinations' - SortCombinations: - oneOf: - - title: field - $ref: '#/components/schemas/Field' - - title: field_with_direction - $ref: '#/components/schemas/FieldWithDirection' - - title: field_with_order - $ref: '#/components/schemas/FieldWithOrder' - - title: options - $ref: '#/components/schemas/SortOptions' - FieldWithDirection: - type: object - additionalProperties: - $ref: '#/components/schemas/SortOrder' - FieldWithOrder: - type: object - additionalProperties: - $ref: '#/components/schemas/ScoreSort' + $ref: '#/components/schemas/SortOptions' SortOptions: - type: object - properties: - _score: - $ref: '#/components/schemas/ScoreSort' - _doc: - $ref: '#/components/schemas/ScoreSort' - _geo_distance: - $ref: '#/components/schemas/GeoDistanceSort' - _script: - $ref: '#/components/schemas/ScriptSort' - minProperties: 1 - maxProperties: 1 + oneOf: + - type: string + const: _score + - type: string + const: _doc + - type: string + not: + type: string + enum: + - _doc + - _score + - type: object + properties: + _score: + $ref: '#/components/schemas/ScoreSort' + _doc: + $ref: '#/components/schemas/ScoreSort' + _geo_distance: + $ref: '#/components/schemas/GeoDistanceSort' + _script: + $ref: '#/components/schemas/ScriptSort' + minProperties: 1 + maxProperties: 1 + - type: object + propertyNames: + allOf: + - $ref: '#/components/schemas/Field' + - not: + type: string + enum: + - _doc + - _geo_distance + - _score + - _script + additionalProperties: + $ref: '#/components/schemas/FieldSort' + minProperties: 1 + maxProperties: 1 + FieldSort: + oneOf: + - title: order + $ref: '#/components/schemas/SortOrder' + - type: object + properties: + missing: + $ref: '#/components/schemas/FieldValue' + mode: + $ref: '#/components/schemas/SortMode' + nested: + $ref: '#/components/schemas/NestedSortValue' + order: + $ref: '#/components/schemas/SortOrder' + unmapped_type: + $ref: '_common.mapping.yaml#/components/schemas/FieldType' + numeric_type: + $ref: '#/components/schemas/FieldSortNumericType' + format: + type: string + FieldSortNumericType: + type: string + enum: + - date + - date_nanos + - double + - long ScoreSort: type: object properties: @@ -617,17 +651,34 @@ components: - min - sum DistanceUnit: - type: string - enum: - - cm - - ft - - in - - km - - m - - mi - - mm - - nmi - - yd + oneOf: + - title: centimeters + type: string + const: cm + - title: feet + type: string + const: ft + - title: inches + type: string + const: in + - title: kilometers + type: string + const: km + - title: meters + type: string + const: m + - title: miles + type: string + const: mi + - title: millimeters + type: string + const: mm + - title: nautical miles + type: string + const: nmi + - title: yards + type: string + const: yd ScriptSort: type: object properties: @@ -682,16 +733,6 @@ components: type: string DateFormat: type: string - PipeSeparatedFlagsSimpleQueryStringFlag: - description: |- - A set of flags represented as a single enum value or a set of values that are encoded - as a pipe-separated string. - - Depending on the target language, code generators can use this hint to generate language specific - flags enum constructs and the corresponding (de-)serialization code. - oneOf: - - $ref: '_common.query_dsl.yaml#/components/schemas/SimpleQueryStringFlag' - - type: string GeoHashPrecision: description: The level of geohash precision, which can be expressed as a geohash length between 1 and 12 or as a distance measure, such as "1km" or "10m". oneOf: @@ -702,55 +743,6 @@ components: type: number EmptyObject: type: object - KnnField: - type: object - properties: - vector: - $ref: '#/components/schemas/QueryVector' - k: - description: The total number of nearest neighbors to return as top hits. - type: integer - format: int32 - min_score: - description: The minimum similarity score required in order for a neighbor to be considered a hit. - type: number - format: float - x-version-added: '2.14' - max_distance: - description: The maximum physical vector space distance required in order for a neighbor to be considered a hit. - type: number - format: float - x-version-added: '2.14' - filter: - description: The filters for the k-NN search query. - oneOf: - - $ref: '_common.query_dsl.yaml#/components/schemas/QueryContainer' - - type: array - items: - $ref: '_common.query_dsl.yaml#/components/schemas/QueryContainer' - boost: - description: The boost value applied to k-NN scores. - type: number - format: float - method_parameters: - type: object - x-version-added: '2.16' - additionalProperties: - type: integer - format: int32 - rescore: - type: object - x-version-added: '2.17' - additionalProperties: - type: number - format: float - required: - - vector - QueryVector: - type: array - items: - type: number - format: float SlicedScroll: type: object properties: diff --git a/spec/schemas/_core.search.yaml b/spec/schemas/_core.search.yaml index 77cc3b234..1dbef6a1d 100644 --- a/spec/schemas/_core.search.yaml +++ b/spec/schemas/_core.search.yaml @@ -690,7 +690,7 @@ components: $ref: '_common.yaml#/components/schemas/Sort' _source: $ref: '#/components/schemas/SourceConfig' - stored_field: + stored_fields: $ref: '_common.yaml#/components/schemas/Fields' track_scores: type: boolean @@ -736,9 +736,6 @@ components: - $ref: '#/components/schemas/HighlightBase' - type: object properties: - fragment_offset: - type: integer - format: int32 matched_fields: $ref: '_common.yaml#/components/schemas/Fields' analyzer: @@ -767,6 +764,9 @@ components: type: boolean fragmenter: $ref: '#/components/schemas/HighlighterFragmenter' + fragment_offset: + type: integer + format: int32 fragment_size: description: The size of the highlighted fragment in characters. type: integer @@ -778,11 +778,11 @@ components: max_fragment_length: type: integer format: int32 - max_analyzed_offset: + max_analyzer_offset: description: |- If set to a non-negative value, highlighting stops at this defined maximum limit. The rest of the text is not processed or highlighted, and no error is returned. - The `max_analyzed_offset` query setting does not override the `index.highlight.max_analyzed_offset` setting, which takes precedence when it is set to a lower value than the query setting. + The `max_analyzer_offset` query setting does not override the `index.highlight.max_analyzed_offset` setting, which takes precedence when it is set to a lower value than the query setting. type: integer format: int32 no_match_size: @@ -840,11 +840,14 @@ components: - title: custom type: string BuiltinHighlighterType: - type: string - enum: - - fvh - - plain - - unified + oneOf: + - type: string + const: plain + - title: fast_vector + type: string + const: fvh + - type: string + const: unified BoundaryScanner: type: string enum: @@ -869,19 +872,18 @@ components: oneOf: - title: fetch type: boolean - - title: includes - type: array - items: - $ref: '_common.yaml#/components/schemas/Field' - title: filter $ref: '#/components/schemas/SourceFilter' SourceFilter: - type: object - properties: - excludes: - $ref: '_common.yaml#/components/schemas/Fields' - includes: + oneOf: + - title: includes $ref: '_common.yaml#/components/schemas/Fields' + - type: object + properties: + excludes: + $ref: '_common.yaml#/components/schemas/Fields' + includes: + $ref: '_common.yaml#/components/schemas/Fields' Rescore: type: object properties: diff --git a/spec/schemas/indices._common.yaml b/spec/schemas/indices._common.yaml index 316cba4e3..a8dee812f 100644 --- a/spec/schemas/indices._common.yaml +++ b/spec/schemas/indices._common.yaml @@ -1131,11 +1131,11 @@ components: mappings: $ref: '_common.mapping.yaml#/components/schemas/TypeMapping' order: - type: number + type: integer + format: int32 settings: type: object - additionalProperties: - type: object + additionalProperties: true version: $ref: '_common.yaml#/components/schemas/VersionNumber' required: diff --git a/spec/schemas/nodes.info.yaml b/spec/schemas/nodes.info.yaml index 789efa969..f53c43ff2 100644 --- a/spec/schemas/nodes.info.yaml +++ b/spec/schemas/nodes.info.yaml @@ -620,8 +620,7 @@ components: type: string NodeInfoSettingsPlugins: type: object - additionalProperties: - $ref: '_common.yaml#/components/schemas/FieldValue' + additionalProperties: true NodeThreadPoolInfo: type: object properties: