From 9e5aa7d4f718703940887fa083ad1aad3a0c9f65 Mon Sep 17 00:00:00 2001 From: Sylvain Wallez Date: Tue, 23 Nov 2021 16:11:15 +0100 Subject: [PATCH 1/2] Unify ScoreMode & MatrixStatsMode, ChildScoreMode & NestedScoreMode. Move sort to common types --- output/schema/schema.json | 1495 ++++++++--------- output/typescript/types.ts | 213 ++- specification/_global/reindex/types.ts | 2 +- specification/_global/search/SearchRequest.ts | 2 +- specification/_global/search/_types/hits.ts | 2 +- .../_global/search_mvt/SearchMvtRequest.ts | 2 +- specification/_types/Result.ts | 1 - specification/_types/aggregations/bucket.ts | 2 +- specification/_types/aggregations/matrix.ts | 11 +- specification/_types/aggregations/metric.ts | 2 +- specification/_types/aggregations/pipeline.ts | 2 +- specification/_types/common.ts | 29 + specification/_types/query_dsl/joining.ts | 18 +- .../_types => _types/query_dsl}/sort.ts | 3 + .../submit/AsyncSearchSubmitRequest.ts | 2 +- specification/ingest/_types/Processors.ts | 2 +- specification/ml/_types/Datafeed.ts | 32 +- .../ml/put_datafeed/MlPutDatafeedRequest.ts | 10 +- .../ml/put_datafeed/MlPutDatafeedResponse.ts | 10 +- .../MlUpdateDatafeedRequest.ts | 10 +- .../MlUpdateDatafeedResponse.ts | 10 +- .../sql/translate/TranslateSqlResponse.ts | 2 +- specification/watcher/_types/Input.ts | 8 +- .../WatcherQueryWatchesRequest.ts | 2 +- specification/watcher/stats/types.ts | 1 + 25 files changed, 869 insertions(+), 1004 deletions(-) rename specification/{_global/search/_types => _types/query_dsl}/sort.ts (96%) diff --git a/output/schema/schema.json b/output/schema/schema.json index f2f1a8ce43..05b738ad0e 100644 --- a/output/schema/schema.json +++ b/output/schema/schema.json @@ -20759,7 +20759,7 @@ "kind": "instance_of", "type": { "name": "Sort", - "namespace": "_global.search._types" + "namespace": "_types.query_dsl" } } }, @@ -21765,7 +21765,7 @@ "kind": "instance_of", "type": { "name": "SortResults", - "namespace": "_global.search._types" + "namespace": "_types.query_dsl" } } }, @@ -21801,7 +21801,7 @@ "kind": "instance_of", "type": { "name": "Sort", - "namespace": "_global.search._types" + "namespace": "_types.query_dsl" } } }, @@ -24149,114 +24149,6 @@ } ] }, - { - "kind": "interface", - "name": { - "name": "FieldSort", - "namespace": "_global.search._types" - }, - "properties": [ - { - "name": "missing", - "required": false, - "type": { - "kind": "instance_of", - "type": { - "name": "Missing", - "namespace": "_types.aggregations" - } - } - }, - { - "name": "mode", - "required": false, - "type": { - "kind": "instance_of", - "type": { - "name": "SortMode", - "namespace": "_global.search._types" - } - } - }, - { - "name": "nested", - "required": false, - "type": { - "kind": "instance_of", - "type": { - "name": "NestedSortValue", - "namespace": "_global.search._types" - } - } - }, - { - "name": "order", - "required": false, - "type": { - "kind": "instance_of", - "type": { - "name": "SortOrder", - "namespace": "_global.search._types" - } - } - }, - { - "name": "unmapped_type", - "required": false, - "type": { - "kind": "instance_of", - "type": { - "name": "FieldType", - "namespace": "_types.mapping" - } - } - }, - { - "name": "numeric_type", - "required": false, - "type": { - "kind": "instance_of", - "type": { - "name": "FieldSortNumericType", - "namespace": "_global.search._types" - } - } - }, - { - "name": "format", - "required": false, - "type": { - "kind": "instance_of", - "type": { - "name": "string", - "namespace": "internal" - } - } - } - ], - "shortcutProperty": "order" - }, - { - "kind": "enum", - "members": [ - { - "name": "long" - }, - { - "name": "double" - }, - { - "name": "date" - }, - { - "name": "date_nanos" - } - ], - "name": { - "name": "FieldSortNumericType", - "namespace": "_global.search._types" - } - }, { "kind": "interface", "name": { @@ -24335,112 +24227,6 @@ "kind": "container" } }, - { - "attachedBehaviors": [ - "AdditionalProperty" - ], - "behaviors": [ - { - "generics": [ - { - "kind": "instance_of", - "type": { - "name": "Field", - "namespace": "_types" - } - }, - { - "items": [ - { - "kind": "instance_of", - "type": { - "name": "GeoLocation", - "namespace": "_types" - } - }, - { - "kind": "array_of", - "value": { - "kind": "instance_of", - "type": { - "name": "GeoLocation", - "namespace": "_types" - } - } - } - ], - "kind": "union_of" - } - ], - "type": { - "name": "AdditionalProperty", - "namespace": "_spec_utils" - } - } - ], - "kind": "interface", - "name": { - "name": "GeoDistanceSort", - "namespace": "_global.search._types" - }, - "properties": [ - { - "name": "mode", - "required": false, - "type": { - "kind": "instance_of", - "type": { - "name": "SortMode", - "namespace": "_global.search._types" - } - } - }, - { - "name": "distance_type", - "required": false, - "type": { - "kind": "instance_of", - "type": { - "name": "GeoDistanceType", - "namespace": "_types" - } - } - }, - { - "name": "ignore_unmapped", - "required": false, - "type": { - "kind": "instance_of", - "type": { - "name": "boolean", - "namespace": "internal" - } - } - }, - { - "name": "order", - "required": false, - "type": { - "kind": "instance_of", - "type": { - "name": "SortOrder", - "namespace": "_global.search._types" - } - } - }, - { - "name": "unit", - "required": false, - "type": { - "kind": "instance_of", - "type": { - "name": "DistanceUnit", - "namespace": "_types" - } - } - } - ] - }, { "kind": "interface", "name": { @@ -25285,7 +25071,7 @@ "kind": "instance_of", "type": { "name": "SortResults", - "namespace": "_global.search._types" + "namespace": "_types.query_dsl" } } } @@ -25512,7 +25298,7 @@ "kind": "instance_of", "type": { "name": "Sort", - "namespace": "_global.search._types" + "namespace": "_types.query_dsl" } } }, @@ -25692,59 +25478,6 @@ } ] }, - { - "kind": "interface", - "name": { - "name": "NestedSortValue", - "namespace": "_global.search._types" - }, - "properties": [ - { - "name": "filter", - "required": false, - "type": { - "kind": "instance_of", - "type": { - "name": "QueryContainer", - "namespace": "_types.query_dsl" - } - } - }, - { - "name": "max_children", - "required": false, - "type": { - "kind": "instance_of", - "type": { - "name": "integer", - "namespace": "_types" - } - } - }, - { - "name": "nested", - "required": false, - "type": { - "kind": "instance_of", - "type": { - "name": "NestedSortValue", - "namespace": "_global.search._types" - } - } - }, - { - "name": "path", - "required": true, - "type": { - "kind": "instance_of", - "type": { - "name": "Field", - "namespace": "_types" - } - } - } - ] - }, { "kind": "interface", "name": { @@ -26496,105 +26229,6 @@ "namespace": "_global.search._types" } }, - { - "kind": "interface", - "name": { - "name": "ScoreSort", - "namespace": "_global.search._types" - }, - "properties": [ - { - "name": "order", - "required": false, - "type": { - "kind": "instance_of", - "type": { - "name": "SortOrder", - "namespace": "_global.search._types" - } - } - } - ] - }, - { - "kind": "interface", - "name": { - "name": "ScriptSort", - "namespace": "_global.search._types" - }, - "properties": [ - { - "name": "order", - "required": false, - "type": { - "kind": "instance_of", - "type": { - "name": "SortOrder", - "namespace": "_global.search._types" - } - } - }, - { - "name": "script", - "required": true, - "type": { - "kind": "instance_of", - "type": { - "name": "Script", - "namespace": "_types" - } - } - }, - { - "name": "type", - "required": false, - "type": { - "kind": "instance_of", - "type": { - "name": "ScriptSortType", - "namespace": "_global.search._types" - } - } - }, - { - "name": "mode", - "required": false, - "type": { - "kind": "instance_of", - "type": { - "name": "SortMode", - "namespace": "_global.search._types" - } - } - }, - { - "name": "nested", - "required": false, - "type": { - "kind": "instance_of", - "type": { - "name": "NestedSortValue", - "namespace": "_global.search._types" - } - } - } - ] - }, - { - "kind": "enum", - "members": [ - { - "name": "string" - }, - { - "name": "number" - } - ], - "name": { - "name": "ScriptSortType", - "namespace": "_global.search._types" - } - }, { "kind": "interface", "name": { @@ -26747,231 +26381,6 @@ "kind": "container" } }, - { - "kind": "type_alias", - "name": { - "name": "Sort", - "namespace": "_global.search._types" - }, - "type": { - "items": [ - { - "kind": "instance_of", - "type": { - "name": "SortCombinations", - "namespace": "_global.search._types" - } - }, - { - "kind": "array_of", - "value": { - "kind": "instance_of", - "type": { - "name": "SortCombinations", - "namespace": "_global.search._types" - } - } - } - ], - "kind": "union_of" - } - }, - { - "codegenNames": [ - "field", - "options" - ], - "kind": "type_alias", - "name": { - "name": "SortCombinations", - "namespace": "_global.search._types" - }, - "type": { - "items": [ - { - "kind": "instance_of", - "type": { - "name": "Field", - "namespace": "_types" - } - }, - { - "kind": "instance_of", - "type": { - "name": "SortOptions", - "namespace": "_global.search._types" - } - } - ], - "kind": "union_of" - } - }, - { - "kind": "enum", - "members": [ - { - "name": "min" - }, - { - "name": "max" - }, - { - "name": "sum" - }, - { - "name": "avg" - }, - { - "name": "median" - } - ], - "name": { - "name": "SortMode", - "namespace": "_global.search._types" - } - }, - { - "attachedBehaviors": [ - "AdditionalProperty" - ], - "behaviors": [ - { - "generics": [ - { - "kind": "instance_of", - "type": { - "name": "Field", - "namespace": "_types" - } - }, - { - "kind": "instance_of", - "type": { - "name": "FieldSort", - "namespace": "_global.search._types" - } - } - ], - "type": { - "name": "AdditionalProperty", - "namespace": "_spec_utils" - } - } - ], - "docUrl": "https://www.elastic.co/guide/en/elasticsearch/reference/current/sort-search-results.html", - "kind": "interface", - "name": { - "name": "SortOptions", - "namespace": "_global.search._types" - }, - "properties": [ - { - "name": "_score", - "required": false, - "type": { - "kind": "instance_of", - "type": { - "name": "ScoreSort", - "namespace": "_global.search._types" - } - } - }, - { - "name": "_doc", - "required": false, - "type": { - "kind": "instance_of", - "type": { - "name": "ScoreSort", - "namespace": "_global.search._types" - } - } - }, - { - "name": "_geo_distance", - "required": false, - "type": { - "kind": "instance_of", - "type": { - "name": "GeoDistanceSort", - "namespace": "_global.search._types" - } - } - }, - { - "name": "_script", - "required": false, - "type": { - "kind": "instance_of", - "type": { - "name": "ScriptSort", - "namespace": "_global.search._types" - } - } - } - ], - "variants": { - "kind": "container" - } - }, - { - "kind": "enum", - "members": [ - { - "name": "asc" - }, - { - "name": "desc" - } - ], - "name": { - "name": "SortOrder", - "namespace": "_global.search._types" - } - }, - { - "kind": "type_alias", - "name": { - "name": "SortResults", - "namespace": "_global.search._types" - }, - "type": { - "kind": "array_of", - "value": { - "items": [ - { - "kind": "instance_of", - "type": { - "name": "long", - "namespace": "_types" - } - }, - { - "kind": "instance_of", - "type": { - "name": "double", - "namespace": "_types" - } - }, - { - "kind": "instance_of", - "type": { - "name": "string", - "namespace": "internal" - } - }, - { - "kind": "instance_of", - "type": { - "name": "null", - "namespace": "internal" - } - } - ], - "kind": "union_of" - } - } - }, { "codegenNames": [ "fetch", @@ -27816,7 +27225,7 @@ "kind": "instance_of", "type": { "name": "Sort", - "namespace": "_global.search._types" + "namespace": "_types.query_dsl" } } } @@ -32736,6 +32145,66 @@ "kind": "union_of" } }, + { + "description": "Controls how to deal with unavailable concrete indices (closed or missing), how wildcard expressions are expanded\nto actual indices (all, closed or open indices) and how to deal with wildcard expressions that resolve to no indices.", + "kind": "interface", + "name": { + "name": "IndicesOptions", + "namespace": "_types" + }, + "properties": [ + { + "description": "If false, the request returns an error if any wildcard expression, index alias, or `_all` value targets only\nmissing or closed indices. This behavior applies even if the request targets other open indices. For example,\na request targeting `foo*,bar*` returns an error if an index starts with `foo` but no index starts with `bar`.", + "name": "allow_no_indices", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "boolean", + "namespace": "internal" + } + } + }, + { + "description": "Type of index that wildcard patterns can match. If the request can target data streams, this argument\ndetermines whether wildcard expressions match hidden data streams. Supports comma-separated values,\nsuch as `open,hidden`.", + "name": "expand_wildcards", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "ExpandWildcards", + "namespace": "_types" + } + } + }, + { + "description": "If true, missing or closed indices are not included in the response.", + "name": "ignore_unavailable", + "required": false, + "serverDefault": false, + "type": { + "kind": "instance_of", + "type": { + "name": "boolean", + "namespace": "internal" + } + } + }, + { + "description": "If true, concrete, expanded or aliased indices are ignored when frozen.", + "name": "ignore_throttled", + "required": false, + "serverDefault": true, + "type": { + "kind": "instance_of", + "type": { + "name": "boolean", + "namespace": "internal" + } + } + } + ] + }, { "inherits": { "type": { @@ -34307,9 +33776,6 @@ { "kind": "enum", "members": [ - { - "name": "Error" - }, { "name": "created" }, @@ -38414,7 +37880,7 @@ "kind": "instance_of", "type": { "name": "Sort", - "namespace": "_global.search._types" + "namespace": "_types.query_dsl" } } } @@ -40715,7 +40181,7 @@ "kind": "instance_of", "type": { "name": "SortOrder", - "namespace": "_global.search._types" + "namespace": "_types.query_dsl" } } }, @@ -41226,7 +40692,7 @@ "kind": "instance_of", "type": { "name": "SortOrder", - "namespace": "_global.search._types" + "namespace": "_types.query_dsl" } } }, @@ -41237,7 +40703,7 @@ "kind": "instance_of", "type": { "name": "SortOrder", - "namespace": "_global.search._types" + "namespace": "_types.query_dsl" } } } @@ -42173,8 +41639,8 @@ "type": { "kind": "instance_of", "type": { - "name": "MatrixStatsMode", - "namespace": "_types.aggregations" + "name": "SortMode", + "namespace": "_types.query_dsl" } } } @@ -42299,30 +41765,6 @@ } ] }, - { - "kind": "enum", - "members": [ - { - "name": "avg" - }, - { - "name": "min" - }, - { - "name": "max" - }, - { - "name": "sum" - }, - { - "name": "median" - } - ], - "name": { - "name": "MatrixStatsMode", - "namespace": "_types.aggregations" - } - }, { "inherits": { "type": { @@ -46013,7 +45455,7 @@ "kind": "instance_of", "type": { "name": "SortOrder", - "namespace": "_global.search._types" + "namespace": "_types.query_dsl" } } }, @@ -46033,7 +45475,7 @@ "kind": "instance_of", "type": { "name": "SortOrder", - "namespace": "_global.search._types" + "namespace": "_types.query_dsl" } } } @@ -46347,7 +45789,7 @@ "kind": "instance_of", "type": { "name": "Sort", - "namespace": "_global.search._types" + "namespace": "_types.query_dsl" } } }, @@ -46558,7 +46000,7 @@ "kind": "instance_of", "type": { "name": "Sort", - "namespace": "_global.search._types" + "namespace": "_types.query_dsl" } } } @@ -58171,6 +57613,114 @@ } ] }, + { + "kind": "interface", + "name": { + "name": "FieldSort", + "namespace": "_types.query_dsl" + }, + "properties": [ + { + "name": "missing", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "Missing", + "namespace": "_types.aggregations" + } + } + }, + { + "name": "mode", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "SortMode", + "namespace": "_types.query_dsl" + } + } + }, + { + "name": "nested", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "NestedSortValue", + "namespace": "_types.query_dsl" + } + } + }, + { + "name": "order", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "SortOrder", + "namespace": "_types.query_dsl" + } + } + }, + { + "name": "unmapped_type", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "FieldType", + "namespace": "_types.mapping" + } + } + }, + { + "name": "numeric_type", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "FieldSortNumericType", + "namespace": "_types.query_dsl" + } + } + }, + { + "name": "format", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "string", + "namespace": "internal" + } + } + } + ], + "shortcutProperty": "order" + }, + { + "kind": "enum", + "members": [ + { + "name": "long" + }, + { + "name": "double" + }, + { + "name": "date" + }, + { + "name": "date_nanos" + } + ], + "name": { + "name": "FieldSortNumericType", + "namespace": "_types.query_dsl" + } + }, { "kind": "enum", "members": [ @@ -58854,6 +58404,112 @@ } ] }, + { + "attachedBehaviors": [ + "AdditionalProperty" + ], + "behaviors": [ + { + "generics": [ + { + "kind": "instance_of", + "type": { + "name": "Field", + "namespace": "_types" + } + }, + { + "items": [ + { + "kind": "instance_of", + "type": { + "name": "GeoLocation", + "namespace": "_types" + } + }, + { + "kind": "array_of", + "value": { + "kind": "instance_of", + "type": { + "name": "GeoLocation", + "namespace": "_types" + } + } + } + ], + "kind": "union_of" + } + ], + "type": { + "name": "AdditionalProperty", + "namespace": "_spec_utils" + } + } + ], + "kind": "interface", + "name": { + "name": "GeoDistanceSort", + "namespace": "_types.query_dsl" + }, + "properties": [ + { + "name": "mode", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "SortMode", + "namespace": "_types.query_dsl" + } + } + }, + { + "name": "distance_type", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "GeoDistanceType", + "namespace": "_types" + } + } + }, + { + "name": "ignore_unmapped", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "boolean", + "namespace": "internal" + } + } + }, + { + "name": "order", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "SortOrder", + "namespace": "_types.query_dsl" + } + } + }, + { + "name": "unit", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "DistanceUnit", + "namespace": "_types" + } + } + } + ] + }, { "kind": "enum", "members": [ @@ -61058,7 +60714,7 @@ "type": { "kind": "instance_of", "type": { - "name": "NestedScoreMode", + "name": "ChildScoreMode", "namespace": "_types.query_dsl" } } @@ -61066,28 +60722,57 @@ ] }, { - "kind": "enum", - "members": [ - { - "name": "avg" - }, + "kind": "interface", + "name": { + "name": "NestedSortValue", + "namespace": "_types.query_dsl" + }, + "properties": [ { - "name": "sum" + "name": "filter", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "QueryContainer", + "namespace": "_types.query_dsl" + } + } }, { - "name": "min" + "name": "max_children", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "integer", + "namespace": "_types" + } + } }, { - "name": "max" + "name": "nested", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "NestedSortValue", + "namespace": "_types.query_dsl" + } + } }, { - "name": "none" + "name": "path", + "required": true, + "type": { + "kind": "instance_of", + "type": { + "name": "Field", + "namespace": "_types" + } + } } - ], - "name": { - "name": "NestedScoreMode", - "namespace": "_types.query_dsl" - } + ] }, { "inherits": { @@ -63048,6 +62733,26 @@ } ] }, + { + "kind": "interface", + "name": { + "name": "ScoreSort", + "namespace": "_types.query_dsl" + }, + "properties": [ + { + "name": "order", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "SortOrder", + "namespace": "_types.query_dsl" + } + } + } + ] + }, { "inherits": { "type": { @@ -63148,6 +62853,85 @@ } ] }, + { + "kind": "interface", + "name": { + "name": "ScriptSort", + "namespace": "_types.query_dsl" + }, + "properties": [ + { + "name": "order", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "SortOrder", + "namespace": "_types.query_dsl" + } + } + }, + { + "name": "script", + "required": true, + "type": { + "kind": "instance_of", + "type": { + "name": "Script", + "namespace": "_types" + } + } + }, + { + "name": "type", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "ScriptSortType", + "namespace": "_types.query_dsl" + } + } + }, + { + "name": "mode", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "SortMode", + "namespace": "_types.query_dsl" + } + } + }, + { + "name": "nested", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "NestedSortValue", + "namespace": "_types.query_dsl" + } + } + } + ] + }, + { + "kind": "enum", + "members": [ + { + "name": "string" + }, + { + "name": "number" + } + ], + "name": { + "name": "ScriptSortType", + "namespace": "_types.query_dsl" + } + }, { "kind": "interface", "name": { @@ -63488,6 +63272,231 @@ } ] }, + { + "kind": "type_alias", + "name": { + "name": "Sort", + "namespace": "_types.query_dsl" + }, + "type": { + "items": [ + { + "kind": "instance_of", + "type": { + "name": "SortCombinations", + "namespace": "_types.query_dsl" + } + }, + { + "kind": "array_of", + "value": { + "kind": "instance_of", + "type": { + "name": "SortCombinations", + "namespace": "_types.query_dsl" + } + } + } + ], + "kind": "union_of" + } + }, + { + "codegenNames": [ + "field", + "options" + ], + "kind": "type_alias", + "name": { + "name": "SortCombinations", + "namespace": "_types.query_dsl" + }, + "type": { + "items": [ + { + "kind": "instance_of", + "type": { + "name": "Field", + "namespace": "_types" + } + }, + { + "kind": "instance_of", + "type": { + "name": "SortOptions", + "namespace": "_types.query_dsl" + } + } + ], + "kind": "union_of" + } + }, + { + "kind": "enum", + "members": [ + { + "name": "min" + }, + { + "name": "max" + }, + { + "name": "sum" + }, + { + "name": "avg" + }, + { + "name": "median" + } + ], + "name": { + "name": "SortMode", + "namespace": "_types.query_dsl" + } + }, + { + "attachedBehaviors": [ + "AdditionalProperty" + ], + "behaviors": [ + { + "generics": [ + { + "kind": "instance_of", + "type": { + "name": "Field", + "namespace": "_types" + } + }, + { + "kind": "instance_of", + "type": { + "name": "FieldSort", + "namespace": "_types.query_dsl" + } + } + ], + "type": { + "name": "AdditionalProperty", + "namespace": "_spec_utils" + } + } + ], + "docUrl": "https://www.elastic.co/guide/en/elasticsearch/reference/current/sort-search-results.html", + "kind": "interface", + "name": { + "name": "SortOptions", + "namespace": "_types.query_dsl" + }, + "properties": [ + { + "name": "_score", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "ScoreSort", + "namespace": "_types.query_dsl" + } + } + }, + { + "name": "_doc", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "ScoreSort", + "namespace": "_types.query_dsl" + } + } + }, + { + "name": "_geo_distance", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "GeoDistanceSort", + "namespace": "_types.query_dsl" + } + } + }, + { + "name": "_script", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "ScriptSort", + "namespace": "_types.query_dsl" + } + } + } + ], + "variants": { + "kind": "container" + } + }, + { + "kind": "enum", + "members": [ + { + "name": "asc" + }, + { + "name": "desc" + } + ], + "name": { + "name": "SortOrder", + "namespace": "_types.query_dsl" + } + }, + { + "kind": "type_alias", + "name": { + "name": "SortResults", + "namespace": "_types.query_dsl" + }, + "type": { + "kind": "array_of", + "value": { + "items": [ + { + "kind": "instance_of", + "type": { + "name": "long", + "namespace": "_types" + } + }, + { + "kind": "instance_of", + "type": { + "name": "double", + "namespace": "_types" + } + }, + { + "kind": "instance_of", + "type": { + "name": "string", + "namespace": "internal" + } + }, + { + "kind": "instance_of", + "type": { + "name": "null", + "namespace": "internal" + } + } + ], + "kind": "union_of" + } + } + }, { "inherits": { "type": { @@ -65147,7 +65156,7 @@ "kind": "instance_of", "type": { "name": "SortResults", - "namespace": "_global.search._types" + "namespace": "_types.query_dsl" } } }, @@ -65183,7 +65192,7 @@ "kind": "instance_of", "type": { "name": "Sort", - "namespace": "_global.search._types" + "namespace": "_types.query_dsl" } } }, @@ -104807,7 +104816,7 @@ "kind": "instance_of", "type": { "name": "SortOrder", - "namespace": "_global.search._types" + "namespace": "_types.query_dsl" } } }, @@ -109449,8 +109458,8 @@ "type": { "kind": "instance_of", "type": { - "name": "DatafeedIndicesOptions", - "namespace": "ml._types" + "name": "IndicesOptions", + "namespace": "_types" } } } @@ -109573,8 +109582,8 @@ "type": { "kind": "instance_of", "type": { - "name": "DatafeedIndicesOptions", - "namespace": "ml._types" + "name": "IndicesOptions", + "namespace": "_types" } } }, @@ -109675,65 +109684,6 @@ } ] }, - { - "kind": "interface", - "name": { - "name": "DatafeedIndicesOptions", - "namespace": "ml._types" - }, - "properties": [ - { - "description": "If false, the request returns an error if any wildcard expression, index alias, or `_all` value targets only\nmissing or closed indices. This behavior applies even if the request targets other open indices. For example,\na request targeting `foo*,bar*` returns an error if an index starts with `foo` but no index starts with `bar`.", - "name": "allow_no_indices", - "required": false, - "type": { - "kind": "instance_of", - "type": { - "name": "boolean", - "namespace": "internal" - } - } - }, - { - "description": "Type of index that wildcard patterns can match. If the request can target data streams, this argument\ndetermines whether wildcard expressions match hidden data streams. Supports comma-separated values,\nsuch as `open,hidden`.", - "name": "expand_wildcards", - "required": false, - "type": { - "kind": "instance_of", - "type": { - "name": "ExpandWildcards", - "namespace": "_types" - } - } - }, - { - "description": "If true, missing or closed indices are not included in the response.", - "name": "ignore_unavailable", - "required": false, - "serverDefault": false, - "type": { - "kind": "instance_of", - "type": { - "name": "boolean", - "namespace": "internal" - } - } - }, - { - "description": "If true, concrete, expanded or aliased indices are ignored when frozen.", - "name": "ignore_throttled", - "required": false, - "serverDefault": true, - "type": { - "kind": "instance_of", - "type": { - "name": "boolean", - "namespace": "internal" - } - } - } - ] - }, { "kind": "enum", "members": [ @@ -121652,8 +121602,8 @@ "type": { "kind": "instance_of", "type": { - "name": "DatafeedIndicesOptions", - "namespace": "ml._types" + "name": "IndicesOptions", + "namespace": "_types" } } }, @@ -121942,8 +121892,8 @@ "type": { "kind": "instance_of", "type": { - "name": "DatafeedIndicesOptions", - "namespace": "ml._types" + "name": "IndicesOptions", + "namespace": "_types" } } }, @@ -124460,8 +124410,8 @@ "type": { "kind": "instance_of", "type": { - "name": "DatafeedIndicesOptions", - "namespace": "ml._types" + "name": "IndicesOptions", + "namespace": "_types" } } }, @@ -124738,8 +124688,8 @@ "type": { "kind": "instance_of", "type": { - "name": "DatafeedIndicesOptions", - "namespace": "ml._types" + "name": "IndicesOptions", + "namespace": "_types" } } }, @@ -143603,7 +143553,7 @@ "kind": "instance_of", "type": { "name": "Sort", - "namespace": "_global.search._types" + "namespace": "_types.query_dsl" } } } @@ -149057,59 +149007,6 @@ } ] }, - { - "kind": "interface", - "name": { - "name": "IndicesOptions", - "namespace": "watcher._types" - }, - "properties": [ - { - "name": "allow_no_indices", - "required": false, - "type": { - "kind": "instance_of", - "type": { - "name": "boolean", - "namespace": "internal" - } - } - }, - { - "name": "expand_wildcards", - "required": false, - "type": { - "kind": "instance_of", - "type": { - "name": "ExpandWildcards", - "namespace": "_types" - } - } - }, - { - "name": "ignore_unavailable", - "required": false, - "type": { - "kind": "instance_of", - "type": { - "name": "boolean", - "namespace": "internal" - } - } - }, - { - "name": "ignore_throttled", - "required": false, - "type": { - "kind": "instance_of", - "type": { - "name": "boolean", - "namespace": "internal" - } - } - } - ] - }, { "kind": "interface", "name": { @@ -149933,7 +149830,7 @@ "kind": "instance_of", "type": { "name": "IndicesOptions", - "namespace": "watcher._types" + "namespace": "_types" } } }, @@ -151863,7 +151760,7 @@ "kind": "instance_of", "type": { "name": "Sort", - "namespace": "_global.search._types" + "namespace": "_types.query_dsl" } } }, @@ -151875,7 +151772,7 @@ "kind": "instance_of", "type": { "name": "SortResults", - "namespace": "_global.search._types" + "namespace": "_types.query_dsl" } } } @@ -156259,25 +156156,6 @@ } ] }, - { - "description": "In some places in the specification an object consists of a static set of properties and a single additional property\nwith an arbitrary name but a statically defined type. This is typically used for configurations associated\nto a single field. Meaning that object should theoretically extend SingleKeyDictionary but expose\na set of known keys. And possibly the object might already be part of an object graph and have a parent class.\nThis puts it into a bind that needs a client specific solution.\nWe therefore document the requirement to accept a single unknown property with this interface.", - "generics": [ - { - "name": "TKey", - "namespace": "_spec_utils" - }, - { - "name": "TValue", - "namespace": "_spec_utils" - } - ], - "kind": "interface", - "name": { - "name": "AdditionalProperty", - "namespace": "_spec_utils" - }, - "properties": [] - }, { "description": "In some places in the specification an object consists of the union of a set of known properties\nand a set of runtime injected properties. Meaning that object should theoretically extend Dictionary but expose\na set of known keys and possibly. The object might already be part of an object graph and have a parent class.\nThis puts it into a bind that needs a client specific solution.\nWe therefore document the requirement to behave like a dictionary for unknown properties with this interface.", "generics": [ @@ -156373,6 +156251,25 @@ } ] }, + { + "description": "In some places in the specification an object consists of a static set of properties and a single additional property\nwith an arbitrary name but a statically defined type. This is typically used for configurations associated\nto a single field. Meaning that object should theoretically extend SingleKeyDictionary but expose\na set of known keys. And possibly the object might already be part of an object graph and have a parent class.\nThis puts it into a bind that needs a client specific solution.\nWe therefore document the requirement to accept a single unknown property with this interface.", + "generics": [ + { + "name": "TKey", + "namespace": "_spec_utils" + }, + { + "name": "TValue", + "namespace": "_spec_utils" + } + ], + "kind": "interface", + "name": { + "name": "AdditionalProperty", + "namespace": "_spec_utils" + }, + "properties": [] + }, { "description": "Implements a set of common query parameters all Cat API's support.\nSince these can break the request structure these are listed explicitly as a behavior.", "kind": "interface", diff --git a/output/typescript/types.ts b/output/typescript/types.ts index d476b72a78..ab18a41c7c 100644 --- a/output/typescript/types.ts +++ b/output/typescript/types.ts @@ -858,7 +858,7 @@ export interface ReindexSource { remote?: ReindexRemoteSource size?: integer slice?: SlicedScroll - sort?: SearchSort + sort?: QueryDslSort _source?: Fields runtime_mappings?: MappingRuntimeFields } @@ -1008,10 +1008,10 @@ export interface SearchRequest extends RequestBase { query?: QueryDslQueryContainer rescore?: SearchRescore | SearchRescore[] script_fields?: Record - search_after?: SearchSortResults + search_after?: QueryDslSortResults size?: integer slice?: SlicedScroll - sort?: SearchSort + sort?: QueryDslSort _source?: SearchSourceConfig fields?: (QueryDslFieldAndFormat | Field)[] suggest?: SearchSuggester @@ -1193,18 +1193,6 @@ export interface SearchFieldCollapse { max_concurrent_group_searches?: integer } -export interface SearchFieldSort { - missing?: AggregationsMissing - mode?: SearchSortMode - nested?: SearchNestedSortValue - order?: SearchSortOrder - unmapped_type?: MappingFieldType - numeric_type?: SearchFieldSortNumericType - format?: string -} - -export type SearchFieldSortNumericType = 'long' | 'double' | 'date' | 'date_nanos' - export interface SearchFieldSuggester { completion?: SearchCompletionSuggester phrase?: SearchPhraseSuggester @@ -1214,16 +1202,6 @@ export interface SearchFieldSuggester { text?: string } -export interface SearchGeoDistanceSortKeys { - mode?: SearchSortMode - distance_type?: GeoDistanceType - ignore_unmapped?: boolean - order?: SearchSortOrder - unit?: DistanceUnit -} -export type SearchGeoDistanceSort = SearchGeoDistanceSortKeys - & { [property: string]: GeoLocation | GeoLocation[] | SearchSortMode | GeoDistanceType | boolean | SearchSortOrder | DistanceUnit } - export interface SearchHighlight { fields: Record type?: SearchHighlighterType @@ -1300,7 +1278,7 @@ export interface SearchHit { _seq_no?: SequenceNumber _primary_term?: long _version?: VersionNumber - sort?: SearchSortResults + sort?: QueryDslSortResults } export interface SearchHitsMetadata { @@ -1321,7 +1299,7 @@ export interface SearchInnerHits { script_fields?: Record seq_no_primary_term?: boolean fields?: Fields - sort?: SearchSort + sort?: QueryDslSort _source?: SearchSourceConfig stored_field?: Fields track_scores?: boolean @@ -1348,13 +1326,6 @@ export interface SearchNestedIdentity { _nested?: SearchNestedIdentity } -export interface SearchNestedSortValue { - filter?: QueryDslQueryContainer - max_children?: integer - nested?: SearchNestedSortValue - path: Field -} - export interface SearchPhraseSuggestCollate { params?: Record prune?: boolean @@ -1445,20 +1416,6 @@ export interface SearchRescoreQuery { export type SearchScoreMode = 'avg' | 'max' | 'min' | 'multiply' | 'total' -export interface SearchScoreSort { - order?: SearchSortOrder -} - -export interface SearchScriptSort { - order?: SearchSortOrder - script: Script - type?: SearchScriptSortType - mode?: SearchSortMode - nested?: SearchNestedSortValue -} - -export type SearchScriptSortType = 'string' | 'number' - export interface SearchSearchProfile { collector: SearchCollector[] query: SearchQueryProfile[] @@ -1478,25 +1435,6 @@ export interface SearchSmoothingModelContainer { stupid_backoff?: SearchStupidBackoffSmoothingModel } -export type SearchSort = SearchSortCombinations | SearchSortCombinations[] - -export type SearchSortCombinations = Field | SearchSortOptions - -export type SearchSortMode = 'min' | 'max' | 'sum' | 'avg' | 'median' - -export interface SearchSortOptionsKeys { - _score?: SearchScoreSort - _doc?: SearchScoreSort - _geo_distance?: SearchGeoDistanceSort - _script?: SearchScriptSort -} -export type SearchSortOptions = SearchSortOptionsKeys - & { [property: string]: SearchFieldSort | SearchSortOrder | SearchScoreSort | SearchGeoDistanceSort | SearchScriptSort } - -export type SearchSortOrder = 'asc' | 'desc' - -export type SearchSortResults = (long | double | string | null)[] - export type SearchSourceConfig = boolean | SearchSourceFilter | Fields export type SearchSourceConfigParam = boolean | Fields @@ -1596,7 +1534,7 @@ export interface SearchMvtRequest extends RequestBase { query?: QueryDslQueryContainer runtime_mappings?: MappingRuntimeFields size?: integer - sort?: SearchSort + sort?: QueryDslSort } } @@ -2093,6 +2031,13 @@ export interface IndexingStats { export type Indices = IndexName | IndexName[] +export interface IndicesOptions { + allow_no_indices?: boolean + expand_wildcards?: ExpandWildcards + ignore_unavailable?: boolean + ignore_throttled?: boolean +} + export interface IndicesResponseBase extends AcknowledgedResponseBase { _shards?: ShardStatistics } @@ -2262,7 +2207,7 @@ export interface RequestCacheStats { miss_count: long } -export type Result = 'Error' | 'created' | 'updated' | 'deleted' | 'not_found' | 'noop' +export type Result = 'created' | 'updated' | 'deleted' | 'not_found' | 'noop' export interface Retries { bulk: long @@ -2676,7 +2621,7 @@ export interface AggregationsBucketSortAggregation extends AggregationsAggregati from?: integer gap_policy?: AggregationsGapPolicy size?: integer - sort?: SearchSort + sort?: QueryDslSort } export type AggregationsBuckets = Record | TBucket[] @@ -2950,7 +2895,7 @@ export interface AggregationsGeoLineAggregation { point: AggregationsGeoLinePoint sort: AggregationsGeoLineSort include_sort?: boolean - sort_order?: SearchSortOrder + sort_order?: QueryDslSortOrder size?: integer } @@ -3024,8 +2969,8 @@ export type AggregationsHistogramBucket = AggregationsHistogramBucketKeys & { [property: string]: AggregationsAggregate | string | double | long } export interface AggregationsHistogramOrder { - _count?: SearchSortOrder - _key?: SearchSortOrder + _count?: QueryDslSortOrder + _key?: QueryDslSortOrder } export interface AggregationsHoltLinearModelSettings { @@ -3149,7 +3094,7 @@ export interface AggregationsMatrixStatsAggregate extends AggregationsAggregateB } export interface AggregationsMatrixStatsAggregation extends AggregationsMatrixAggregation { - mode?: AggregationsMatrixStatsMode + mode?: QueryDslSortMode } export interface AggregationsMatrixStatsFields { @@ -3163,8 +3108,6 @@ export interface AggregationsMatrixStatsFields { correlation: Record } -export type AggregationsMatrixStatsMode = 'avg' | 'min' | 'max' | 'sum' | 'median' - export interface AggregationsMaxAggregate extends AggregationsSingleMetricAggregateBase { } @@ -3608,7 +3551,7 @@ export type AggregationsTermsAggregationCollectMode = 'depth_first' | 'breadth_f export type AggregationsTermsAggregationExecutionHint = 'map' | 'global_ordinals' | 'global_ordinals_hash' | 'global_ordinals_low_cardinality' -export type AggregationsTermsAggregationOrder = Record | Record[] +export type AggregationsTermsAggregationOrder = Record | Record[] export interface AggregationsTermsBucketBase extends AggregationsMultiBucketBase { doc_count_error?: long @@ -3640,7 +3583,7 @@ export interface AggregationsTopHitsAggregation extends AggregationsMetricAggreg highlight?: SearchHighlight script_fields?: Record size?: integer - sort?: SearchSort + sort?: QueryDslSort _source?: SearchSourceConfig stored_fields?: Fields track_scores?: boolean @@ -3659,7 +3602,7 @@ export interface AggregationsTopMetricsAggregate extends AggregationsMultiBucket export interface AggregationsTopMetricsAggregation extends AggregationsMetricAggregationBase { metrics?: AggregationsTopMetricsValue | AggregationsTopMetricsValue[] size?: integer - sort?: SearchSort + sort?: QueryDslSort } export interface AggregationsTopMetricsBucketKeys extends AggregationsMultiBucketBase { @@ -4924,6 +4867,18 @@ export interface QueryDslFieldLookup { routing?: Routing } +export interface QueryDslFieldSort { + missing?: AggregationsMissing + mode?: QueryDslSortMode + nested?: QueryDslNestedSortValue + order?: QueryDslSortOrder + unmapped_type?: MappingFieldType + numeric_type?: QueryDslFieldSortNumericType + format?: string +} + +export type QueryDslFieldSortNumericType = 'long' | 'double' | 'date' | 'date_nanos' + export type QueryDslFieldValueFactorModifier = 'none' | 'log' | 'log1p' | 'log2p' | 'ln' | 'ln1p' | 'ln2p' | 'square' | 'sqrt' | 'reciprocal' export interface QueryDslFieldValueFactorScoreFunction extends QueryDslScoreFunctionBase { @@ -4990,6 +4945,16 @@ export interface QueryDslGeoDistanceQueryKeys extends QueryDslQueryBase { export type QueryDslGeoDistanceQuery = QueryDslGeoDistanceQueryKeys & { [property: string]: GeoLocation | Distance | GeoDistanceType | QueryDslGeoValidationMethod | float | string } +export interface QueryDslGeoDistanceSortKeys { + mode?: QueryDslSortMode + distance_type?: GeoDistanceType + ignore_unmapped?: boolean + order?: QueryDslSortOrder + unit?: DistanceUnit +} +export type QueryDslGeoDistanceSort = QueryDslGeoDistanceSortKeys + & { [property: string]: GeoLocation | GeoLocation[] | QueryDslSortMode | GeoDistanceType | boolean | QueryDslSortOrder | DistanceUnit } + export type QueryDslGeoExecution = 'memory' | 'indexed' export interface QueryDslGeoPolygonPoints { @@ -5223,10 +5188,15 @@ export interface QueryDslNestedQuery extends QueryDslQueryBase { inner_hits?: SearchInnerHits path: Field query: QueryDslQueryContainer - score_mode?: QueryDslNestedScoreMode + score_mode?: QueryDslChildScoreMode } -export type QueryDslNestedScoreMode = 'avg' | 'sum' | 'min' | 'max' | 'none' +export interface QueryDslNestedSortValue { + filter?: QueryDslQueryContainer + max_children?: integer + nested?: QueryDslNestedSortValue + path: Field +} export interface QueryDslNumberRangeQuery extends QueryDslRangeQueryBase { gt?: double @@ -5423,6 +5393,10 @@ export interface QueryDslScoreFunctionBase { weight?: double } +export interface QueryDslScoreSort { + order?: QueryDslSortOrder +} + export interface QueryDslScriptQuery extends QueryDslQueryBase { script: Script } @@ -5437,6 +5411,16 @@ export interface QueryDslScriptScoreQuery extends QueryDslQueryBase { script: Script } +export interface QueryDslScriptSort { + order?: QueryDslSortOrder + script: Script + type?: QueryDslScriptSortType + mode?: QueryDslSortMode + nested?: QueryDslNestedSortValue +} + +export type QueryDslScriptSortType = 'string' | 'number' + export interface QueryDslShapeFieldQuery { indexed_shape?: QueryDslFieldLookup relation?: GeoShapeRelation @@ -5469,6 +5453,25 @@ export interface QueryDslSimpleQueryStringQuery extends QueryDslQueryBase { quote_field_suffix?: string } +export type QueryDslSort = QueryDslSortCombinations | QueryDslSortCombinations[] + +export type QueryDslSortCombinations = Field | QueryDslSortOptions + +export type QueryDslSortMode = 'min' | 'max' | 'sum' | 'avg' | 'median' + +export interface QueryDslSortOptionsKeys { + _score?: QueryDslScoreSort + _doc?: QueryDslScoreSort + _geo_distance?: QueryDslGeoDistanceSort + _script?: QueryDslScriptSort +} +export type QueryDslSortOptions = QueryDslSortOptionsKeys + & { [property: string]: QueryDslFieldSort | QueryDslSortOrder | QueryDslScoreSort | QueryDslGeoDistanceSort | QueryDslScriptSort } + +export type QueryDslSortOrder = 'asc' | 'desc' + +export type QueryDslSortResults = (long | double | string | null)[] + export interface QueryDslSpanContainingQuery extends QueryDslQueryBase { big: QueryDslSpanQuery little: QueryDslSpanQuery @@ -5689,10 +5692,10 @@ export interface AsyncSearchSubmitRequest extends RequestBase { query?: QueryDslQueryContainer rescore?: SearchRescore | SearchRescore[] script_fields?: Record - search_after?: SearchSortResults + search_after?: QueryDslSortResults size?: integer slice?: SlicedScroll - sort?: SearchSort + sort?: QueryDslSort _source?: SearchSourceConfig fields?: (QueryDslFieldAndFormat | Field)[] suggest?: SearchSuggester @@ -10558,7 +10561,7 @@ export type IngestShapeType = 'geo_shape' | 'shape' export interface IngestSortProcessor extends IngestProcessorBase { field: Field - order: SearchSortOrder + order: QueryDslSortOrder target_field: Field } @@ -11067,7 +11070,7 @@ export interface MlDatafeed { scroll_size?: integer delayed_data_check_config: MlDelayedDataCheckConfig runtime_mappings?: MappingRuntimeFields - indices_options?: MlDatafeedIndicesOptions + indices_options?: IndicesOptions } export interface MlDatafeedConfig { @@ -11079,7 +11082,7 @@ export interface MlDatafeedConfig { frequency?: Timestamp indexes?: string[] indices: string[] - indices_options?: MlDatafeedIndicesOptions + indices_options?: IndicesOptions job_id?: Id max_empty_searches?: integer query: QueryDslQueryContainer @@ -11089,13 +11092,6 @@ export interface MlDatafeedConfig { scroll_size?: integer } -export interface MlDatafeedIndicesOptions { - allow_no_indices?: boolean - expand_wildcards?: ExpandWildcards - ignore_unavailable?: boolean - ignore_throttled?: boolean -} - export type MlDatafeedState = 'started' | 'stopped' | 'starting' | 'stopping' export interface MlDatafeedStats { @@ -12450,7 +12446,7 @@ export interface MlPutDatafeedRequest extends RequestBase { frequency?: Time indices?: string[] indexes?: string[] - indices_options?: MlDatafeedIndicesOptions + indices_options?: IndicesOptions job_id?: Id max_empty_searches?: integer query?: QueryDslQueryContainer @@ -12469,7 +12465,7 @@ export interface MlPutDatafeedResponse { frequency: Time indices: string[] job_id: Id - indices_options?: MlDatafeedIndicesOptions + indices_options?: IndicesOptions max_empty_searches: integer query: QueryDslQueryContainer query_delay: Time @@ -12757,7 +12753,7 @@ export interface MlUpdateDatafeedRequest extends RequestBase { frequency?: Time indices?: string[] indexes?: string[] - indices_options?: MlDatafeedIndicesOptions + indices_options?: IndicesOptions max_empty_searches?: integer query?: QueryDslQueryContainer query_delay?: Time @@ -12775,7 +12771,7 @@ export interface MlUpdateDatafeedResponse { frequency: Time indices: string[] job_id: Id - indices_options?: MlDatafeedIndicesOptions + indices_options?: IndicesOptions max_empty_searches: integer query: QueryDslQueryContainer query_delay: Time @@ -14942,7 +14938,7 @@ export interface SqlTranslateResponse { size: long _source: SearchSourceConfig fields: Record[] - sort: SearchSort + sort: QueryDslSort } export interface SslCertificatesCertificateInformation { @@ -15564,13 +15560,6 @@ export interface WatcherIndexResultSummary { type?: Type } -export interface WatcherIndicesOptions { - allow_no_indices?: boolean - expand_wildcards?: ExpandWildcards - ignore_unavailable?: boolean - ignore_throttled?: boolean -} - export interface WatcherInputContainer { chain?: WatcherChainInput http?: WatcherHttpInput @@ -15674,7 +15663,7 @@ export interface WatcherSearchInputRequestBody { export interface WatcherSearchInputRequestDefinition { body?: WatcherSearchInputRequestBody indices?: IndexName[] - indices_options?: WatcherIndicesOptions + indices_options?: IndicesOptions search_type?: SearchType template?: SearchTemplateRequest rest_total_hits_as_int?: boolean @@ -15903,8 +15892,8 @@ export interface WatcherQueryWatchesRequest extends RequestBase { from?: integer size?: integer query?: QueryDslQueryContainer - sort?: SearchSort - search_after?: SearchSortResults + sort?: QueryDslSort + search_after?: QueryDslSortResults } } @@ -16427,10 +16416,6 @@ export interface XpackUsageWatcherWatchTriggerSchedule extends XpackUsageCounter _all: XpackUsageCounter } -export interface SpecUtilsAdditionalProperty { - [key: string]: never -} - export interface SpecUtilsAdditionalProperties { [key: string]: never } @@ -16442,6 +16427,10 @@ export interface SpecUtilsCommonQueryParameters { pretty?: boolean } +export interface SpecUtilsAdditionalProperty { + [key: string]: never +} + export interface SpecUtilsCommonCatQueryParameters { format?: string h?: Names diff --git a/specification/_global/reindex/types.ts b/specification/_global/reindex/types.ts index 9e4c5e12ed..e4f5847d8c 100644 --- a/specification/_global/reindex/types.ts +++ b/specification/_global/reindex/types.ts @@ -17,7 +17,7 @@ * under the License. */ -import { Sort } from '@global/search/_types/sort' +import { Sort } from '@_types/query_dsl/sort' import { Fields, IndexName, diff --git a/specification/_global/search/SearchRequest.ts b/specification/_global/search/SearchRequest.ts index b1cee660e7..f6029d7e96 100644 --- a/specification/_global/search/SearchRequest.ts +++ b/specification/_global/search/SearchRequest.ts @@ -41,11 +41,11 @@ import { FieldCollapse } from './_types/FieldCollapse' import { Highlight } from './_types/highlighting' import { PointInTimeReference } from './_types/PointInTimeReference' import { Rescore } from './_types/rescoring' -import { Sort, SortResults } from './_types/sort' import { SourceConfigParam, SourceConfig } from './_types/SourceFilter' import { Suggester } from './_types/suggester' import { TrackHits } from '@global/search/_types/hits' import { Operator } from '@_types/query_dsl/Operator' +import { Sort, SortResults } from '@_types/query_dsl/sort' /** * @rest_spec_name search diff --git a/specification/_global/search/_types/hits.ts b/specification/_global/search/_types/hits.ts index b00361cfdc..7e9da8539b 100644 --- a/specification/_global/search/_types/hits.ts +++ b/specification/_global/search/_types/hits.ts @@ -34,9 +34,9 @@ import { double, integer, long } from '@_types/Numeric' import { ScriptField } from '@_types/Scripting' import { FieldCollapse } from './FieldCollapse' import { Highlight } from './highlighting' -import { Sort, SortResults } from './sort' import { SourceConfig } from './SourceFilter' import { FieldAndFormat } from '@_types/query_dsl/abstractions' +import { Sort, SortResults } from '@_types/query_dsl/sort' export class Hit { _index: IndexName diff --git a/specification/_global/search_mvt/SearchMvtRequest.ts b/specification/_global/search_mvt/SearchMvtRequest.ts index 244edfce87..554fc8b701 100644 --- a/specification/_global/search_mvt/SearchMvtRequest.ts +++ b/specification/_global/search_mvt/SearchMvtRequest.ts @@ -23,7 +23,7 @@ import { Field, Fields, Indices } from '@_types/common' import { AggregationContainer } from '@_types/aggregations/AggregationContainer' import { GridType } from './_types/GridType' import { Coordinate } from './_types/Coordinate' -import { Sort } from '@global/search/_types/sort' +import { Sort } from '@_types/query_dsl/sort' import { QueryContainer } from '@_types/query_dsl/abstractions' import { RuntimeFields } from '@_types/mapping/RuntimeFields' import { integer } from '@_types/Numeric' diff --git a/specification/_types/Result.ts b/specification/_types/Result.ts index eace2cb526..200791b166 100644 --- a/specification/_types/Result.ts +++ b/specification/_types/Result.ts @@ -18,7 +18,6 @@ */ export enum Result { - Error = 0, created = 1, updated = 2, deleted = 3, diff --git a/specification/_types/aggregations/bucket.ts b/specification/_types/aggregations/bucket.ts index 8394cc1c90..d99a23dbe7 100644 --- a/specification/_types/aggregations/bucket.ts +++ b/specification/_types/aggregations/bucket.ts @@ -17,7 +17,7 @@ * under the License. */ -import { SortOrder } from '@global/search/_types/sort' +import { SortOrder } from '@_types/query_dsl/sort' import { Dictionary } from '@spec_utils/Dictionary' import { UserDefinedValue } from '@spec_utils/UserDefinedValue' import { Field, RelationName, Fields } from '@_types/common' diff --git a/specification/_types/aggregations/matrix.ts b/specification/_types/aggregations/matrix.ts index 9626b6aae6..42dcff9386 100644 --- a/specification/_types/aggregations/matrix.ts +++ b/specification/_types/aggregations/matrix.ts @@ -21,6 +21,7 @@ import { Dictionary } from '@spec_utils/Dictionary' import { Fields, Field } from '@_types/common' import { double } from '@_types/Numeric' import { Aggregation } from './Aggregation' +import { SortMode } from '@_types/query_dsl/sort' export class MatrixAggregation extends Aggregation { fields?: Fields @@ -28,13 +29,5 @@ export class MatrixAggregation extends Aggregation { } export class MatrixStatsAggregation extends MatrixAggregation { - mode?: MatrixStatsMode -} - -export enum MatrixStatsMode { - avg = 0, - min = 1, - max = 2, - sum = 3, - median = 4 + mode?: SortMode } diff --git a/specification/_types/aggregations/metric.ts b/specification/_types/aggregations/metric.ts index 2aedf9b7b2..89ffd7a9be 100644 --- a/specification/_types/aggregations/metric.ts +++ b/specification/_types/aggregations/metric.ts @@ -18,7 +18,7 @@ */ import { Highlight } from '@global/search/_types/highlighting' -import { SortOrder, Sort } from '@global/search/_types/sort' +import { SortOrder, Sort } from '@_types/query_dsl/sort' import { SourceConfig } from '@global/search/_types/SourceFilter' import { Dictionary } from '@spec_utils/Dictionary' import { UserDefinedValue } from '@spec_utils/UserDefinedValue' diff --git a/specification/_types/aggregations/pipeline.ts b/specification/_types/aggregations/pipeline.ts index 05744e62ed..fd1f9d17f2 100644 --- a/specification/_types/aggregations/pipeline.ts +++ b/specification/_types/aggregations/pipeline.ts @@ -17,7 +17,7 @@ * under the License. */ -import { Sort } from '@global/search/_types/sort' +import { Sort } from '@_types/query_dsl/sort' import { Dictionary } from '@spec_utils/Dictionary' import { Name, Field, EmptyObject } from '@_types/common' import { integer, double, float } from '@_types/Numeric' diff --git a/specification/_types/common.ts b/specification/_types/common.ts index 8fbfd166db..3f3add2130 100644 --- a/specification/_types/common.ts +++ b/specification/_types/common.ts @@ -284,3 +284,32 @@ export class InlineGet _routing?: Routing _source: TDocument } + +/** + * Controls how to deal with unavailable concrete indices (closed or missing), how wildcard expressions are expanded + * to actual indices (all, closed or open indices) and how to deal with wildcard expressions that resolve to no indices. + */ +export class IndicesOptions { + /** + * If false, the request returns an error if any wildcard expression, index alias, or `_all` value targets only + * missing or closed indices. This behavior applies even if the request targets other open indices. For example, + * a request targeting `foo*,bar*` returns an error if an index starts with `foo` but no index starts with `bar`. + */ + allow_no_indices?: boolean + /** + * Type of index that wildcard patterns can match. If the request can target data streams, this argument + * determines whether wildcard expressions match hidden data streams. Supports comma-separated values, + * such as `open,hidden`. + */ + expand_wildcards?: ExpandWildcards + /** + * If true, missing or closed indices are not included in the response. + * @server_default false + */ + ignore_unavailable?: boolean + /** + * If true, concrete, expanded or aliased indices are ignored when frozen. + * @server_default true + */ + ignore_throttled?: boolean +} diff --git a/specification/_types/query_dsl/joining.ts b/specification/_types/query_dsl/joining.ts index fe60976d66..ca5ced6b99 100644 --- a/specification/_types/query_dsl/joining.ts +++ b/specification/_types/query_dsl/joining.ts @@ -22,11 +22,19 @@ import { Field, Id, RelationName } from '@_types/common' import { integer } from '@_types/Numeric' import { QueryBase, QueryContainer } from './abstractions' +/** + * How to aggregate multiple child hit scores into a single parent score. + */ export enum ChildScoreMode { + /* Do no scoring. */ none = 0, + /* Parent hit's score is the average of all child scores. */ avg = 1, + /* Parent hit's score is the max of all child scores. */ sum = 2, + /* Parent hit's score is the sum of all child scores. */ max = 3, + /* Parent hit's score is the min of all child scores. */ min = 4 } @@ -59,15 +67,7 @@ export class NestedQuery extends QueryBase { path: Field query: QueryContainer /** @server_default 'avg' */ - score_mode?: NestedScoreMode -} - -export enum NestedScoreMode { - avg = 0, - sum = 1, - min = 2, - max = 3, - none = 4 + score_mode?: ChildScoreMode } export class ParentIdQuery extends QueryBase { diff --git a/specification/_global/search/_types/sort.ts b/specification/_types/query_dsl/sort.ts similarity index 96% rename from specification/_global/search/_types/sort.ts rename to specification/_types/query_dsl/sort.ts index 2394aff99f..77b483001c 100644 --- a/specification/_global/search/_types/sort.ts +++ b/specification/_types/query_dsl/sort.ts @@ -98,6 +98,9 @@ export type Sort = SortCombinations | SortCombinations[] export type SortResults = Array +/** + * Defines what values to pick in the case a document contains multiple values for a particular field. + */ export enum SortMode { min = 0, max = 1, diff --git a/specification/async_search/submit/AsyncSearchSubmitRequest.ts b/specification/async_search/submit/AsyncSearchSubmitRequest.ts index f6fe0a47a4..56cc36e12d 100644 --- a/specification/async_search/submit/AsyncSearchSubmitRequest.ts +++ b/specification/async_search/submit/AsyncSearchSubmitRequest.ts @@ -41,7 +41,7 @@ import { FieldCollapse } from '@global/search/_types/FieldCollapse' import { Highlight } from '@global/search/_types/highlighting' import { PointInTimeReference } from '@global/search/_types/PointInTimeReference' import { Rescore } from '@global/search/_types/rescoring' -import { Sort, SortResults } from '@global/search/_types/sort' +import { Sort, SortResults } from '@_types/query_dsl/sort' import { SourceConfigParam, SourceConfig diff --git a/specification/ingest/_types/Processors.ts b/specification/ingest/_types/Processors.ts index b046b0cffd..79ec4d2ebe 100644 --- a/specification/ingest/_types/Processors.ts +++ b/specification/ingest/_types/Processors.ts @@ -17,7 +17,7 @@ * under the License. */ -import { SortOrder } from '@global/search/_types/sort' +import { SortOrder } from '@_types/query_dsl/sort' import { Dictionary } from '@spec_utils/Dictionary' import { UserDefinedValue } from '@spec_utils/UserDefinedValue' import { Field, Fields, Id, Name } from '@_types/common' diff --git a/specification/ml/_types/Datafeed.ts b/specification/ml/_types/Datafeed.ts index 509fd5b5b2..9daaddd56d 100644 --- a/specification/ml/_types/Datafeed.ts +++ b/specification/ml/_types/Datafeed.ts @@ -19,7 +19,7 @@ import { Dictionary } from '@spec_utils/Dictionary' import { AggregationContainer } from '@_types/aggregations/AggregationContainer' -import { ExpandWildcards, Id, Indices } from '@_types/common' +import { ExpandWildcards, Id, Indices, IndicesOptions } from '@_types/common' import { RuntimeFields } from '@_types/mapping/RuntimeFields' import { double, integer, long } from '@_types/Numeric' import { QueryContainer } from '@_types/query_dsl/abstractions' @@ -43,7 +43,7 @@ export class Datafeed { scroll_size?: integer delayed_data_check_config: DelayedDataCheckConfig runtime_mappings?: RuntimeFields - indices_options?: DatafeedIndicesOptions + indices_options?: IndicesOptions } export class DatafeedConfig { @@ -76,7 +76,7 @@ export class DatafeedConfig { /** * Specifies index expansion options that are used during search. */ - indices_options?: DatafeedIndicesOptions + indices_options?: IndicesOptions job_id?: Id /** * If a real-time datafeed has never seen any data (including during any initial training period) then it will automatically stop itself and close its associated job after this many real-time searches that return no documents. In other words, it will stop after `frequency` times `max_empty_searches` of real-time operation. If not set then a datafeed with no end time that sees no data will remain started until it is explicitly stopped. @@ -118,6 +118,7 @@ export class DelayedDataCheckConfig { enabled: boolean } +// Identical to WatcherState, but kept separate as they're different enums in ES export enum DatafeedState { started = 0, stopped = 1, @@ -161,28 +162,3 @@ export class ChunkingConfig { * @server_default 3h */ time_span?: Time } - -export class DatafeedIndicesOptions { - /** - * If false, the request returns an error if any wildcard expression, index alias, or `_all` value targets only - * missing or closed indices. This behavior applies even if the request targets other open indices. For example, - * a request targeting `foo*,bar*` returns an error if an index starts with `foo` but no index starts with `bar`. - */ - allow_no_indices?: boolean - /** - * Type of index that wildcard patterns can match. If the request can target data streams, this argument - * determines whether wildcard expressions match hidden data streams. Supports comma-separated values, - * such as `open,hidden`. - */ - expand_wildcards?: ExpandWildcards - /** - * If true, missing or closed indices are not included in the response. - * @server_default false - */ - ignore_unavailable?: boolean - /** - * If true, concrete, expanded or aliased indices are ignored when frozen. - * @server_default true - */ - ignore_throttled?: boolean -} diff --git a/specification/ml/put_datafeed/MlPutDatafeedRequest.ts b/specification/ml/put_datafeed/MlPutDatafeedRequest.ts index a5e3260ef3..292d64af10 100644 --- a/specification/ml/put_datafeed/MlPutDatafeedRequest.ts +++ b/specification/ml/put_datafeed/MlPutDatafeedRequest.ts @@ -17,15 +17,11 @@ * under the License. */ -import { - ChunkingConfig, - DatafeedIndicesOptions, - DelayedDataCheckConfig -} from '@ml/_types/Datafeed' +import { ChunkingConfig, DelayedDataCheckConfig } from '@ml/_types/Datafeed' import { Dictionary } from '@spec_utils/Dictionary' import { AggregationContainer } from '@_types/aggregations/AggregationContainer' import { RequestBase } from '@_types/Base' -import { ExpandWildcards, Id, Indices } from '@_types/common' +import { ExpandWildcards, Id, Indices, IndicesOptions } from '@_types/common' import { RuntimeFields } from '@_types/mapping/RuntimeFields' import { integer } from '@_types/Numeric' import { QueryContainer } from '@_types/query_dsl/abstractions' @@ -120,7 +116,7 @@ export interface Request extends RequestBase { /** * Specifies index expansion options that are used during search */ - indices_options?: DatafeedIndicesOptions + indices_options?: IndicesOptions /** * Identifier for the anomaly detection job. */ diff --git a/specification/ml/put_datafeed/MlPutDatafeedResponse.ts b/specification/ml/put_datafeed/MlPutDatafeedResponse.ts index 57638a3cea..2f1108315b 100644 --- a/specification/ml/put_datafeed/MlPutDatafeedResponse.ts +++ b/specification/ml/put_datafeed/MlPutDatafeedResponse.ts @@ -17,14 +17,10 @@ * under the License. */ -import { - ChunkingConfig, - DatafeedIndicesOptions, - DelayedDataCheckConfig -} from '@ml/_types/Datafeed' +import { ChunkingConfig, DelayedDataCheckConfig } from '@ml/_types/Datafeed' import { Dictionary } from '@spec_utils/Dictionary' import { AggregationContainer } from '@_types/aggregations/AggregationContainer' -import { Id, Indices } from '@_types/common' +import { Id, Indices, IndicesOptions } from '@_types/common' import { RuntimeFields } from '@_types/mapping/RuntimeFields' import { integer } from '@_types/Numeric' import { QueryContainer } from '@_types/query_dsl/abstractions' @@ -40,7 +36,7 @@ export class Response { frequency: Time indices: string[] job_id: Id - indices_options?: DatafeedIndicesOptions + indices_options?: IndicesOptions max_empty_searches: integer query: QueryContainer query_delay: Time diff --git a/specification/ml/update_datafeed/MlUpdateDatafeedRequest.ts b/specification/ml/update_datafeed/MlUpdateDatafeedRequest.ts index 4c5eed27d2..6adce1da69 100644 --- a/specification/ml/update_datafeed/MlUpdateDatafeedRequest.ts +++ b/specification/ml/update_datafeed/MlUpdateDatafeedRequest.ts @@ -18,14 +18,10 @@ */ import { RequestBase } from '@_types/Base' -import { ExpandWildcards, Id } from '@_types/common' +import { ExpandWildcards, Id, IndicesOptions } from '@_types/common' import { Dictionary } from '@spec_utils/Dictionary' import { AggregationContainer } from '@_types/aggregations/AggregationContainer' -import { - ChunkingConfig, - DatafeedIndicesOptions, - DelayedDataCheckConfig -} from '@ml/_types/Datafeed' +import { ChunkingConfig, DelayedDataCheckConfig } from '@ml/_types/Datafeed' import { Time } from '@_types/Time' import { integer } from '@_types/Numeric' import { QueryContainer } from '@_types/query_dsl/abstractions' @@ -120,7 +116,7 @@ export interface Request extends RequestBase { /** * Specifies index expansion options that are used during search. */ - indices_options?: DatafeedIndicesOptions + indices_options?: IndicesOptions /** * If a real-time datafeed has never seen any data (including during any initial training period), it automatically * stops and closes the associated job after this many real-time searches return no documents. In other words, diff --git a/specification/ml/update_datafeed/MlUpdateDatafeedResponse.ts b/specification/ml/update_datafeed/MlUpdateDatafeedResponse.ts index 57638a3cea..3efcbf0be7 100644 --- a/specification/ml/update_datafeed/MlUpdateDatafeedResponse.ts +++ b/specification/ml/update_datafeed/MlUpdateDatafeedResponse.ts @@ -17,14 +17,10 @@ * under the License. */ -import { - ChunkingConfig, - DatafeedIndicesOptions, - DelayedDataCheckConfig -} from '@ml/_types/Datafeed' +import { ChunkingConfig, DelayedDataCheckConfig } from '@ml/_types/Datafeed' import { Dictionary } from '@spec_utils/Dictionary' import { AggregationContainer } from '@_types/aggregations/AggregationContainer' -import { Id, Indices } from '@_types/common' +import { Id, IndicesOptions } from '@_types/common' import { RuntimeFields } from '@_types/mapping/RuntimeFields' import { integer } from '@_types/Numeric' import { QueryContainer } from '@_types/query_dsl/abstractions' @@ -40,7 +36,7 @@ export class Response { frequency: Time indices: string[] job_id: Id - indices_options?: DatafeedIndicesOptions + indices_options?: IndicesOptions max_empty_searches: integer query: QueryContainer query_delay: Time diff --git a/specification/sql/translate/TranslateSqlResponse.ts b/specification/sql/translate/TranslateSqlResponse.ts index 1f48184a6b..2fc1ae24e6 100644 --- a/specification/sql/translate/TranslateSqlResponse.ts +++ b/specification/sql/translate/TranslateSqlResponse.ts @@ -17,7 +17,7 @@ * under the License. */ -import { Sort } from '@global/search/_types/sort' +import { Sort } from '@_types/query_dsl/sort' import { SourceConfig } from '@global/search/_types/SourceFilter' import { Dictionary } from '@spec_utils/Dictionary' import { Field, Fields } from '@_types/common' diff --git a/specification/watcher/_types/Input.ts b/specification/watcher/_types/Input.ts index e48199882a..e4354a3d1d 100644 --- a/specification/watcher/_types/Input.ts +++ b/specification/watcher/_types/Input.ts @@ -23,6 +23,7 @@ import { UserDefinedValue } from '@spec_utils/UserDefinedValue' import { ExpandWildcards, IndexName, + IndicesOptions, Password, SearchType, Username @@ -86,13 +87,6 @@ export class HttpInputRequestDefinition { url?: string } -export class IndicesOptions { - allow_no_indices?: boolean - expand_wildcards?: ExpandWildcards - ignore_unavailable?: boolean - ignore_throttled?: boolean -} - export class Input {} /** diff --git a/specification/watcher/query_watches/WatcherQueryWatchesRequest.ts b/specification/watcher/query_watches/WatcherQueryWatchesRequest.ts index 549282f02d..afa22a3532 100644 --- a/specification/watcher/query_watches/WatcherQueryWatchesRequest.ts +++ b/specification/watcher/query_watches/WatcherQueryWatchesRequest.ts @@ -17,7 +17,7 @@ * under the License. */ -import { Sort, SortResults } from '@global/search/_types/sort' +import { Sort, SortResults } from '@_types/query_dsl/sort' import { RequestBase } from '@_types/Base' import { integer } from '@_types/Numeric' import { QueryContainer } from '@_types/query_dsl/abstractions' diff --git a/specification/watcher/stats/types.ts b/specification/watcher/stats/types.ts index bd4367030b..12c26cda07 100644 --- a/specification/watcher/stats/types.ts +++ b/specification/watcher/stats/types.ts @@ -22,6 +22,7 @@ import { Id } from '@_types/common' import { long } from '@_types/Numeric' import { DateString } from '@_types/Time' +// Identical to DatafeedState, but kept separate as they're different enums in ES export enum WatcherState { stopped = 0, starting = 1, From 7e1213bc1c05e30d396503236cb630b224a1129a Mon Sep 17 00:00:00 2001 From: Sylvain Wallez Date: Tue, 23 Nov 2021 16:26:02 +0100 Subject: [PATCH 2/2] Move sort out of query_dsl --- output/schema/schema.json | 1262 ++++++++--------- output/typescript/types.ts | 172 +-- specification/_global/reindex/types.ts | 2 +- specification/_global/search/SearchRequest.ts | 2 +- specification/_global/search/_types/hits.ts | 2 +- .../_global/search_mvt/SearchMvtRequest.ts | 2 +- specification/_types/aggregations/bucket.ts | 2 +- specification/_types/aggregations/matrix.ts | 2 +- specification/_types/aggregations/metric.ts | 2 +- specification/_types/aggregations/pipeline.ts | 2 +- specification/_types/{query_dsl => }/sort.ts | 0 .../submit/AsyncSearchSubmitRequest.ts | 2 +- specification/ingest/_types/Processors.ts | 2 +- .../sql/translate/TranslateSqlResponse.ts | 2 +- .../WatcherQueryWatchesRequest.ts | 2 +- 15 files changed, 729 insertions(+), 729 deletions(-) rename specification/_types/{query_dsl => }/sort.ts (100%) diff --git a/output/schema/schema.json b/output/schema/schema.json index 05b738ad0e..c6375b5bb8 100644 --- a/output/schema/schema.json +++ b/output/schema/schema.json @@ -20759,7 +20759,7 @@ "kind": "instance_of", "type": { "name": "Sort", - "namespace": "_types.query_dsl" + "namespace": "_types" } } }, @@ -21765,7 +21765,7 @@ "kind": "instance_of", "type": { "name": "SortResults", - "namespace": "_types.query_dsl" + "namespace": "_types" } } }, @@ -21801,7 +21801,7 @@ "kind": "instance_of", "type": { "name": "Sort", - "namespace": "_types.query_dsl" + "namespace": "_types" } } }, @@ -25071,7 +25071,7 @@ "kind": "instance_of", "type": { "name": "SortResults", - "namespace": "_types.query_dsl" + "namespace": "_types" } } } @@ -25298,7 +25298,7 @@ "kind": "instance_of", "type": { "name": "Sort", - "namespace": "_types.query_dsl" + "namespace": "_types" } } }, @@ -27225,7 +27225,7 @@ "kind": "instance_of", "type": { "name": "Sort", - "namespace": "_types.query_dsl" + "namespace": "_types" } } } @@ -31140,6 +31140,114 @@ } ] }, + { + "kind": "interface", + "name": { + "name": "FieldSort", + "namespace": "_types" + }, + "properties": [ + { + "name": "missing", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "Missing", + "namespace": "_types.aggregations" + } + } + }, + { + "name": "mode", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "SortMode", + "namespace": "_types" + } + } + }, + { + "name": "nested", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "NestedSortValue", + "namespace": "_types" + } + } + }, + { + "name": "order", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "SortOrder", + "namespace": "_types" + } + } + }, + { + "name": "unmapped_type", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "FieldType", + "namespace": "_types.mapping" + } + } + }, + { + "name": "numeric_type", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "FieldSortNumericType", + "namespace": "_types" + } + } + }, + { + "name": "format", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "string", + "namespace": "internal" + } + } + } + ], + "shortcutProperty": "order" + }, + { + "kind": "enum", + "members": [ + { + "name": "long" + }, + { + "name": "double" + }, + { + "name": "date" + }, + { + "name": "date_nanos" + } + ], + "name": { + "name": "FieldSortNumericType", + "namespace": "_types" + } + }, { "codegenNames": [ "long", @@ -31406,6 +31514,112 @@ "kind": "union_of" } }, + { + "attachedBehaviors": [ + "AdditionalProperty" + ], + "behaviors": [ + { + "generics": [ + { + "kind": "instance_of", + "type": { + "name": "Field", + "namespace": "_types" + } + }, + { + "items": [ + { + "kind": "instance_of", + "type": { + "name": "GeoLocation", + "namespace": "_types" + } + }, + { + "kind": "array_of", + "value": { + "kind": "instance_of", + "type": { + "name": "GeoLocation", + "namespace": "_types" + } + } + } + ], + "kind": "union_of" + } + ], + "type": { + "name": "AdditionalProperty", + "namespace": "_spec_utils" + } + } + ], + "kind": "interface", + "name": { + "name": "GeoDistanceSort", + "namespace": "_types" + }, + "properties": [ + { + "name": "mode", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "SortMode", + "namespace": "_types" + } + } + }, + { + "name": "distance_type", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "GeoDistanceType", + "namespace": "_types" + } + } + }, + { + "name": "ignore_unmapped", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "boolean", + "namespace": "internal" + } + } + }, + { + "name": "order", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "SortOrder", + "namespace": "_types" + } + } + }, + { + "name": "unit", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "DistanceUnit", + "namespace": "_types" + } + } + } + ] + }, { "kind": "enum", "members": [ @@ -32832,6 +33046,59 @@ } } }, + { + "kind": "interface", + "name": { + "name": "NestedSortValue", + "namespace": "_types" + }, + "properties": [ + { + "name": "filter", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "QueryContainer", + "namespace": "_types.query_dsl" + } + } + }, + { + "name": "max_children", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "integer", + "namespace": "_types" + } + } + }, + { + "name": "nested", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "NestedSortValue", + "namespace": "_types" + } + } + }, + { + "name": "path", + "required": true, + "type": { + "kind": "instance_of", + "type": { + "name": "Field", + "namespace": "_types" + } + } + } + ] + }, { "kind": "interface", "name": { @@ -33843,6 +34110,26 @@ } } }, + { + "kind": "interface", + "name": { + "name": "ScoreSort", + "namespace": "_types" + }, + "properties": [ + { + "name": "order", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "SortOrder", + "namespace": "_types" + } + } + } + ] + }, { "codegenNames": [ "inline", @@ -33962,6 +34249,85 @@ "kind": "union_of" } }, + { + "kind": "interface", + "name": { + "name": "ScriptSort", + "namespace": "_types" + }, + "properties": [ + { + "name": "order", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "SortOrder", + "namespace": "_types" + } + } + }, + { + "name": "script", + "required": true, + "type": { + "kind": "instance_of", + "type": { + "name": "Script", + "namespace": "_types" + } + } + }, + { + "name": "type", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "ScriptSortType", + "namespace": "_types" + } + } + }, + { + "name": "mode", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "SortMode", + "namespace": "_types" + } + } + }, + { + "name": "nested", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "NestedSortValue", + "namespace": "_types" + } + } + } + ] + }, + { + "kind": "enum", + "members": [ + { + "name": "string" + }, + { + "name": "number" + } + ], + "name": { + "name": "ScriptSortType", + "namespace": "_types" + } + }, { "kind": "interface", "name": { @@ -34741,6 +35107,231 @@ } ] }, + { + "kind": "type_alias", + "name": { + "name": "Sort", + "namespace": "_types" + }, + "type": { + "items": [ + { + "kind": "instance_of", + "type": { + "name": "SortCombinations", + "namespace": "_types" + } + }, + { + "kind": "array_of", + "value": { + "kind": "instance_of", + "type": { + "name": "SortCombinations", + "namespace": "_types" + } + } + } + ], + "kind": "union_of" + } + }, + { + "codegenNames": [ + "field", + "options" + ], + "kind": "type_alias", + "name": { + "name": "SortCombinations", + "namespace": "_types" + }, + "type": { + "items": [ + { + "kind": "instance_of", + "type": { + "name": "Field", + "namespace": "_types" + } + }, + { + "kind": "instance_of", + "type": { + "name": "SortOptions", + "namespace": "_types" + } + } + ], + "kind": "union_of" + } + }, + { + "kind": "enum", + "members": [ + { + "name": "min" + }, + { + "name": "max" + }, + { + "name": "sum" + }, + { + "name": "avg" + }, + { + "name": "median" + } + ], + "name": { + "name": "SortMode", + "namespace": "_types" + } + }, + { + "attachedBehaviors": [ + "AdditionalProperty" + ], + "behaviors": [ + { + "generics": [ + { + "kind": "instance_of", + "type": { + "name": "Field", + "namespace": "_types" + } + }, + { + "kind": "instance_of", + "type": { + "name": "FieldSort", + "namespace": "_types" + } + } + ], + "type": { + "name": "AdditionalProperty", + "namespace": "_spec_utils" + } + } + ], + "docUrl": "https://www.elastic.co/guide/en/elasticsearch/reference/current/sort-search-results.html", + "kind": "interface", + "name": { + "name": "SortOptions", + "namespace": "_types" + }, + "properties": [ + { + "name": "_score", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "ScoreSort", + "namespace": "_types" + } + } + }, + { + "name": "_doc", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "ScoreSort", + "namespace": "_types" + } + } + }, + { + "name": "_geo_distance", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "GeoDistanceSort", + "namespace": "_types" + } + } + }, + { + "name": "_script", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "ScriptSort", + "namespace": "_types" + } + } + } + ], + "variants": { + "kind": "container" + } + }, + { + "kind": "enum", + "members": [ + { + "name": "asc" + }, + { + "name": "desc" + } + ], + "name": { + "name": "SortOrder", + "namespace": "_types" + } + }, + { + "kind": "type_alias", + "name": { + "name": "SortResults", + "namespace": "_types" + }, + "type": { + "kind": "array_of", + "value": { + "items": [ + { + "kind": "instance_of", + "type": { + "name": "long", + "namespace": "_types" + } + }, + { + "kind": "instance_of", + "type": { + "name": "double", + "namespace": "_types" + } + }, + { + "kind": "instance_of", + "type": { + "name": "string", + "namespace": "internal" + } + }, + { + "kind": "instance_of", + "type": { + "name": "null", + "namespace": "internal" + } + } + ], + "kind": "union_of" + } + } + }, { "kind": "interface", "name": { @@ -37880,7 +38471,7 @@ "kind": "instance_of", "type": { "name": "Sort", - "namespace": "_types.query_dsl" + "namespace": "_types" } } } @@ -40181,7 +40772,7 @@ "kind": "instance_of", "type": { "name": "SortOrder", - "namespace": "_types.query_dsl" + "namespace": "_types" } } }, @@ -40692,7 +41283,7 @@ "kind": "instance_of", "type": { "name": "SortOrder", - "namespace": "_types.query_dsl" + "namespace": "_types" } } }, @@ -40703,7 +41294,7 @@ "kind": "instance_of", "type": { "name": "SortOrder", - "namespace": "_types.query_dsl" + "namespace": "_types" } } } @@ -41640,7 +42231,7 @@ "kind": "instance_of", "type": { "name": "SortMode", - "namespace": "_types.query_dsl" + "namespace": "_types" } } } @@ -45455,7 +46046,7 @@ "kind": "instance_of", "type": { "name": "SortOrder", - "namespace": "_types.query_dsl" + "namespace": "_types" } } }, @@ -45475,7 +46066,7 @@ "kind": "instance_of", "type": { "name": "SortOrder", - "namespace": "_types.query_dsl" + "namespace": "_types" } } } @@ -45789,7 +46380,7 @@ "kind": "instance_of", "type": { "name": "Sort", - "namespace": "_types.query_dsl" + "namespace": "_types" } } }, @@ -46000,7 +46591,7 @@ "kind": "instance_of", "type": { "name": "Sort", - "namespace": "_types.query_dsl" + "namespace": "_types" } } } @@ -57613,114 +58204,6 @@ } ] }, - { - "kind": "interface", - "name": { - "name": "FieldSort", - "namespace": "_types.query_dsl" - }, - "properties": [ - { - "name": "missing", - "required": false, - "type": { - "kind": "instance_of", - "type": { - "name": "Missing", - "namespace": "_types.aggregations" - } - } - }, - { - "name": "mode", - "required": false, - "type": { - "kind": "instance_of", - "type": { - "name": "SortMode", - "namespace": "_types.query_dsl" - } - } - }, - { - "name": "nested", - "required": false, - "type": { - "kind": "instance_of", - "type": { - "name": "NestedSortValue", - "namespace": "_types.query_dsl" - } - } - }, - { - "name": "order", - "required": false, - "type": { - "kind": "instance_of", - "type": { - "name": "SortOrder", - "namespace": "_types.query_dsl" - } - } - }, - { - "name": "unmapped_type", - "required": false, - "type": { - "kind": "instance_of", - "type": { - "name": "FieldType", - "namespace": "_types.mapping" - } - } - }, - { - "name": "numeric_type", - "required": false, - "type": { - "kind": "instance_of", - "type": { - "name": "FieldSortNumericType", - "namespace": "_types.query_dsl" - } - } - }, - { - "name": "format", - "required": false, - "type": { - "kind": "instance_of", - "type": { - "name": "string", - "namespace": "internal" - } - } - } - ], - "shortcutProperty": "order" - }, - { - "kind": "enum", - "members": [ - { - "name": "long" - }, - { - "name": "double" - }, - { - "name": "date" - }, - { - "name": "date_nanos" - } - ], - "name": { - "name": "FieldSortNumericType", - "namespace": "_types.query_dsl" - } - }, { "kind": "enum", "members": [ @@ -58404,112 +58887,6 @@ } ] }, - { - "attachedBehaviors": [ - "AdditionalProperty" - ], - "behaviors": [ - { - "generics": [ - { - "kind": "instance_of", - "type": { - "name": "Field", - "namespace": "_types" - } - }, - { - "items": [ - { - "kind": "instance_of", - "type": { - "name": "GeoLocation", - "namespace": "_types" - } - }, - { - "kind": "array_of", - "value": { - "kind": "instance_of", - "type": { - "name": "GeoLocation", - "namespace": "_types" - } - } - } - ], - "kind": "union_of" - } - ], - "type": { - "name": "AdditionalProperty", - "namespace": "_spec_utils" - } - } - ], - "kind": "interface", - "name": { - "name": "GeoDistanceSort", - "namespace": "_types.query_dsl" - }, - "properties": [ - { - "name": "mode", - "required": false, - "type": { - "kind": "instance_of", - "type": { - "name": "SortMode", - "namespace": "_types.query_dsl" - } - } - }, - { - "name": "distance_type", - "required": false, - "type": { - "kind": "instance_of", - "type": { - "name": "GeoDistanceType", - "namespace": "_types" - } - } - }, - { - "name": "ignore_unmapped", - "required": false, - "type": { - "kind": "instance_of", - "type": { - "name": "boolean", - "namespace": "internal" - } - } - }, - { - "name": "order", - "required": false, - "type": { - "kind": "instance_of", - "type": { - "name": "SortOrder", - "namespace": "_types.query_dsl" - } - } - }, - { - "name": "unit", - "required": false, - "type": { - "kind": "instance_of", - "type": { - "name": "DistanceUnit", - "namespace": "_types" - } - } - } - ] - }, { "kind": "enum", "members": [ @@ -60721,59 +61098,6 @@ } ] }, - { - "kind": "interface", - "name": { - "name": "NestedSortValue", - "namespace": "_types.query_dsl" - }, - "properties": [ - { - "name": "filter", - "required": false, - "type": { - "kind": "instance_of", - "type": { - "name": "QueryContainer", - "namespace": "_types.query_dsl" - } - } - }, - { - "name": "max_children", - "required": false, - "type": { - "kind": "instance_of", - "type": { - "name": "integer", - "namespace": "_types" - } - } - }, - { - "name": "nested", - "required": false, - "type": { - "kind": "instance_of", - "type": { - "name": "NestedSortValue", - "namespace": "_types.query_dsl" - } - } - }, - { - "name": "path", - "required": true, - "type": { - "kind": "instance_of", - "type": { - "name": "Field", - "namespace": "_types" - } - } - } - ] - }, { "inherits": { "type": { @@ -62733,26 +63057,6 @@ } ] }, - { - "kind": "interface", - "name": { - "name": "ScoreSort", - "namespace": "_types.query_dsl" - }, - "properties": [ - { - "name": "order", - "required": false, - "type": { - "kind": "instance_of", - "type": { - "name": "SortOrder", - "namespace": "_types.query_dsl" - } - } - } - ] - }, { "inherits": { "type": { @@ -62853,85 +63157,6 @@ } ] }, - { - "kind": "interface", - "name": { - "name": "ScriptSort", - "namespace": "_types.query_dsl" - }, - "properties": [ - { - "name": "order", - "required": false, - "type": { - "kind": "instance_of", - "type": { - "name": "SortOrder", - "namespace": "_types.query_dsl" - } - } - }, - { - "name": "script", - "required": true, - "type": { - "kind": "instance_of", - "type": { - "name": "Script", - "namespace": "_types" - } - } - }, - { - "name": "type", - "required": false, - "type": { - "kind": "instance_of", - "type": { - "name": "ScriptSortType", - "namespace": "_types.query_dsl" - } - } - }, - { - "name": "mode", - "required": false, - "type": { - "kind": "instance_of", - "type": { - "name": "SortMode", - "namespace": "_types.query_dsl" - } - } - }, - { - "name": "nested", - "required": false, - "type": { - "kind": "instance_of", - "type": { - "name": "NestedSortValue", - "namespace": "_types.query_dsl" - } - } - } - ] - }, - { - "kind": "enum", - "members": [ - { - "name": "string" - }, - { - "name": "number" - } - ], - "name": { - "name": "ScriptSortType", - "namespace": "_types.query_dsl" - } - }, { "kind": "interface", "name": { @@ -63272,231 +63497,6 @@ } ] }, - { - "kind": "type_alias", - "name": { - "name": "Sort", - "namespace": "_types.query_dsl" - }, - "type": { - "items": [ - { - "kind": "instance_of", - "type": { - "name": "SortCombinations", - "namespace": "_types.query_dsl" - } - }, - { - "kind": "array_of", - "value": { - "kind": "instance_of", - "type": { - "name": "SortCombinations", - "namespace": "_types.query_dsl" - } - } - } - ], - "kind": "union_of" - } - }, - { - "codegenNames": [ - "field", - "options" - ], - "kind": "type_alias", - "name": { - "name": "SortCombinations", - "namespace": "_types.query_dsl" - }, - "type": { - "items": [ - { - "kind": "instance_of", - "type": { - "name": "Field", - "namespace": "_types" - } - }, - { - "kind": "instance_of", - "type": { - "name": "SortOptions", - "namespace": "_types.query_dsl" - } - } - ], - "kind": "union_of" - } - }, - { - "kind": "enum", - "members": [ - { - "name": "min" - }, - { - "name": "max" - }, - { - "name": "sum" - }, - { - "name": "avg" - }, - { - "name": "median" - } - ], - "name": { - "name": "SortMode", - "namespace": "_types.query_dsl" - } - }, - { - "attachedBehaviors": [ - "AdditionalProperty" - ], - "behaviors": [ - { - "generics": [ - { - "kind": "instance_of", - "type": { - "name": "Field", - "namespace": "_types" - } - }, - { - "kind": "instance_of", - "type": { - "name": "FieldSort", - "namespace": "_types.query_dsl" - } - } - ], - "type": { - "name": "AdditionalProperty", - "namespace": "_spec_utils" - } - } - ], - "docUrl": "https://www.elastic.co/guide/en/elasticsearch/reference/current/sort-search-results.html", - "kind": "interface", - "name": { - "name": "SortOptions", - "namespace": "_types.query_dsl" - }, - "properties": [ - { - "name": "_score", - "required": false, - "type": { - "kind": "instance_of", - "type": { - "name": "ScoreSort", - "namespace": "_types.query_dsl" - } - } - }, - { - "name": "_doc", - "required": false, - "type": { - "kind": "instance_of", - "type": { - "name": "ScoreSort", - "namespace": "_types.query_dsl" - } - } - }, - { - "name": "_geo_distance", - "required": false, - "type": { - "kind": "instance_of", - "type": { - "name": "GeoDistanceSort", - "namespace": "_types.query_dsl" - } - } - }, - { - "name": "_script", - "required": false, - "type": { - "kind": "instance_of", - "type": { - "name": "ScriptSort", - "namespace": "_types.query_dsl" - } - } - } - ], - "variants": { - "kind": "container" - } - }, - { - "kind": "enum", - "members": [ - { - "name": "asc" - }, - { - "name": "desc" - } - ], - "name": { - "name": "SortOrder", - "namespace": "_types.query_dsl" - } - }, - { - "kind": "type_alias", - "name": { - "name": "SortResults", - "namespace": "_types.query_dsl" - }, - "type": { - "kind": "array_of", - "value": { - "items": [ - { - "kind": "instance_of", - "type": { - "name": "long", - "namespace": "_types" - } - }, - { - "kind": "instance_of", - "type": { - "name": "double", - "namespace": "_types" - } - }, - { - "kind": "instance_of", - "type": { - "name": "string", - "namespace": "internal" - } - }, - { - "kind": "instance_of", - "type": { - "name": "null", - "namespace": "internal" - } - } - ], - "kind": "union_of" - } - } - }, { "inherits": { "type": { @@ -65156,7 +65156,7 @@ "kind": "instance_of", "type": { "name": "SortResults", - "namespace": "_types.query_dsl" + "namespace": "_types" } } }, @@ -65192,7 +65192,7 @@ "kind": "instance_of", "type": { "name": "Sort", - "namespace": "_types.query_dsl" + "namespace": "_types" } } }, @@ -104816,7 +104816,7 @@ "kind": "instance_of", "type": { "name": "SortOrder", - "namespace": "_types.query_dsl" + "namespace": "_types" } } }, @@ -143553,7 +143553,7 @@ "kind": "instance_of", "type": { "name": "Sort", - "namespace": "_types.query_dsl" + "namespace": "_types" } } } @@ -151760,7 +151760,7 @@ "kind": "instance_of", "type": { "name": "Sort", - "namespace": "_types.query_dsl" + "namespace": "_types" } } }, @@ -151772,7 +151772,7 @@ "kind": "instance_of", "type": { "name": "SortResults", - "namespace": "_types.query_dsl" + "namespace": "_types" } } } @@ -156175,6 +156175,25 @@ }, "properties": [] }, + { + "description": "In some places in the specification an object consists of a static set of properties and a single additional property\nwith an arbitrary name but a statically defined type. This is typically used for configurations associated\nto a single field. Meaning that object should theoretically extend SingleKeyDictionary but expose\na set of known keys. And possibly the object might already be part of an object graph and have a parent class.\nThis puts it into a bind that needs a client specific solution.\nWe therefore document the requirement to accept a single unknown property with this interface.", + "generics": [ + { + "name": "TKey", + "namespace": "_spec_utils" + }, + { + "name": "TValue", + "namespace": "_spec_utils" + } + ], + "kind": "interface", + "name": { + "name": "AdditionalProperty", + "namespace": "_spec_utils" + }, + "properties": [] + }, { "description": "Implements a set of common query parameters all API's support.\nSince these can break the request structure these are listed explicitly as a behavior.\nIts up to individual clients to define support although `error_trace` and `pretty` are\nrecommended as a minimum.", "kind": "interface", @@ -156251,25 +156270,6 @@ } ] }, - { - "description": "In some places in the specification an object consists of a static set of properties and a single additional property\nwith an arbitrary name but a statically defined type. This is typically used for configurations associated\nto a single field. Meaning that object should theoretically extend SingleKeyDictionary but expose\na set of known keys. And possibly the object might already be part of an object graph and have a parent class.\nThis puts it into a bind that needs a client specific solution.\nWe therefore document the requirement to accept a single unknown property with this interface.", - "generics": [ - { - "name": "TKey", - "namespace": "_spec_utils" - }, - { - "name": "TValue", - "namespace": "_spec_utils" - } - ], - "kind": "interface", - "name": { - "name": "AdditionalProperty", - "namespace": "_spec_utils" - }, - "properties": [] - }, { "description": "Implements a set of common query parameters all Cat API's support.\nSince these can break the request structure these are listed explicitly as a behavior.", "kind": "interface", diff --git a/output/typescript/types.ts b/output/typescript/types.ts index ab18a41c7c..194376884e 100644 --- a/output/typescript/types.ts +++ b/output/typescript/types.ts @@ -858,7 +858,7 @@ export interface ReindexSource { remote?: ReindexRemoteSource size?: integer slice?: SlicedScroll - sort?: QueryDslSort + sort?: Sort _source?: Fields runtime_mappings?: MappingRuntimeFields } @@ -1008,10 +1008,10 @@ export interface SearchRequest extends RequestBase { query?: QueryDslQueryContainer rescore?: SearchRescore | SearchRescore[] script_fields?: Record - search_after?: QueryDslSortResults + search_after?: SortResults size?: integer slice?: SlicedScroll - sort?: QueryDslSort + sort?: Sort _source?: SearchSourceConfig fields?: (QueryDslFieldAndFormat | Field)[] suggest?: SearchSuggester @@ -1278,7 +1278,7 @@ export interface SearchHit { _seq_no?: SequenceNumber _primary_term?: long _version?: VersionNumber - sort?: QueryDslSortResults + sort?: SortResults } export interface SearchHitsMetadata { @@ -1299,7 +1299,7 @@ export interface SearchInnerHits { script_fields?: Record seq_no_primary_term?: boolean fields?: Fields - sort?: QueryDslSort + sort?: Sort _source?: SearchSourceConfig stored_field?: Fields track_scores?: boolean @@ -1534,7 +1534,7 @@ export interface SearchMvtRequest extends RequestBase { query?: QueryDslQueryContainer runtime_mappings?: MappingRuntimeFields size?: integer - sort?: QueryDslSort + sort?: Sort } } @@ -1934,6 +1934,18 @@ export interface FieldSizeUsage { size_in_bytes: long } +export interface FieldSort { + missing?: AggregationsMissing + mode?: SortMode + nested?: NestedSortValue + order?: SortOrder + unmapped_type?: MappingFieldType + numeric_type?: FieldSortNumericType + format?: string +} + +export type FieldSortNumericType = 'long' | 'double' | 'date' | 'date_nanos' + export type FieldValue = long | double | string | boolean export interface FielddataStats { @@ -1956,6 +1968,16 @@ export type Fuzziness = string | integer export type GeoBounds = CoordsGeoBounds | TopLeftBottomRightGeoBounds | TopRightBottomLeftGeoBounds | WktGeoBounds +export interface GeoDistanceSortKeys { + mode?: SortMode + distance_type?: GeoDistanceType + ignore_unmapped?: boolean + order?: SortOrder + unit?: DistanceUnit +} +export type GeoDistanceSort = GeoDistanceSortKeys + & { [property: string]: GeoLocation | GeoLocation[] | SortMode | GeoDistanceType | boolean | SortOrder | DistanceUnit } + export type GeoDistanceType = 'arc' | 'plane' export type GeoHash = string @@ -2105,6 +2127,13 @@ export type Names = Name | Name[] export type Namespace = string +export interface NestedSortValue { + filter?: QueryDslQueryContainer + max_children?: integer + nested?: NestedSortValue + path: Field +} + export interface NodeAttributes { attributes: Record ephemeral_id: Id @@ -2216,6 +2245,10 @@ export interface Retries { export type Routing = string +export interface ScoreSort { + order?: SortOrder +} + export type Script = InlineScript | string | StoredScriptId export interface ScriptBase { @@ -2229,6 +2262,16 @@ export interface ScriptField { export type ScriptLanguage = BuiltinScriptLanguage | string +export interface ScriptSort { + order?: SortOrder + script: Script + type?: ScriptSortType + mode?: SortMode + nested?: NestedSortValue +} + +export type ScriptSortType = 'string' | 'number' + export interface ScriptTransform { lang: string params: Record @@ -2317,6 +2360,25 @@ export interface SlicedScroll { max: integer } +export type Sort = SortCombinations | SortCombinations[] + +export type SortCombinations = Field | SortOptions + +export type SortMode = 'min' | 'max' | 'sum' | 'avg' | 'median' + +export interface SortOptionsKeys { + _score?: ScoreSort + _doc?: ScoreSort + _geo_distance?: GeoDistanceSort + _script?: ScriptSort +} +export type SortOptions = SortOptionsKeys + & { [property: string]: FieldSort | SortOrder | ScoreSort | GeoDistanceSort | ScriptSort } + +export type SortOrder = 'asc' | 'desc' + +export type SortResults = (long | double | string | null)[] + export interface StoreStats { size?: ByteSize size_in_bytes: integer @@ -2621,7 +2683,7 @@ export interface AggregationsBucketSortAggregation extends AggregationsAggregati from?: integer gap_policy?: AggregationsGapPolicy size?: integer - sort?: QueryDslSort + sort?: Sort } export type AggregationsBuckets = Record | TBucket[] @@ -2895,7 +2957,7 @@ export interface AggregationsGeoLineAggregation { point: AggregationsGeoLinePoint sort: AggregationsGeoLineSort include_sort?: boolean - sort_order?: QueryDslSortOrder + sort_order?: SortOrder size?: integer } @@ -2969,8 +3031,8 @@ export type AggregationsHistogramBucket = AggregationsHistogramBucketKeys & { [property: string]: AggregationsAggregate | string | double | long } export interface AggregationsHistogramOrder { - _count?: QueryDslSortOrder - _key?: QueryDslSortOrder + _count?: SortOrder + _key?: SortOrder } export interface AggregationsHoltLinearModelSettings { @@ -3094,7 +3156,7 @@ export interface AggregationsMatrixStatsAggregate extends AggregationsAggregateB } export interface AggregationsMatrixStatsAggregation extends AggregationsMatrixAggregation { - mode?: QueryDslSortMode + mode?: SortMode } export interface AggregationsMatrixStatsFields { @@ -3551,7 +3613,7 @@ export type AggregationsTermsAggregationCollectMode = 'depth_first' | 'breadth_f export type AggregationsTermsAggregationExecutionHint = 'map' | 'global_ordinals' | 'global_ordinals_hash' | 'global_ordinals_low_cardinality' -export type AggregationsTermsAggregationOrder = Record | Record[] +export type AggregationsTermsAggregationOrder = Record | Record[] export interface AggregationsTermsBucketBase extends AggregationsMultiBucketBase { doc_count_error?: long @@ -3583,7 +3645,7 @@ export interface AggregationsTopHitsAggregation extends AggregationsMetricAggreg highlight?: SearchHighlight script_fields?: Record size?: integer - sort?: QueryDslSort + sort?: Sort _source?: SearchSourceConfig stored_fields?: Fields track_scores?: boolean @@ -3602,7 +3664,7 @@ export interface AggregationsTopMetricsAggregate extends AggregationsMultiBucket export interface AggregationsTopMetricsAggregation extends AggregationsMetricAggregationBase { metrics?: AggregationsTopMetricsValue | AggregationsTopMetricsValue[] size?: integer - sort?: QueryDslSort + sort?: Sort } export interface AggregationsTopMetricsBucketKeys extends AggregationsMultiBucketBase { @@ -4867,18 +4929,6 @@ export interface QueryDslFieldLookup { routing?: Routing } -export interface QueryDslFieldSort { - missing?: AggregationsMissing - mode?: QueryDslSortMode - nested?: QueryDslNestedSortValue - order?: QueryDslSortOrder - unmapped_type?: MappingFieldType - numeric_type?: QueryDslFieldSortNumericType - format?: string -} - -export type QueryDslFieldSortNumericType = 'long' | 'double' | 'date' | 'date_nanos' - export type QueryDslFieldValueFactorModifier = 'none' | 'log' | 'log1p' | 'log2p' | 'ln' | 'ln1p' | 'ln2p' | 'square' | 'sqrt' | 'reciprocal' export interface QueryDslFieldValueFactorScoreFunction extends QueryDslScoreFunctionBase { @@ -4945,16 +4995,6 @@ export interface QueryDslGeoDistanceQueryKeys extends QueryDslQueryBase { export type QueryDslGeoDistanceQuery = QueryDslGeoDistanceQueryKeys & { [property: string]: GeoLocation | Distance | GeoDistanceType | QueryDslGeoValidationMethod | float | string } -export interface QueryDslGeoDistanceSortKeys { - mode?: QueryDslSortMode - distance_type?: GeoDistanceType - ignore_unmapped?: boolean - order?: QueryDslSortOrder - unit?: DistanceUnit -} -export type QueryDslGeoDistanceSort = QueryDslGeoDistanceSortKeys - & { [property: string]: GeoLocation | GeoLocation[] | QueryDslSortMode | GeoDistanceType | boolean | QueryDslSortOrder | DistanceUnit } - export type QueryDslGeoExecution = 'memory' | 'indexed' export interface QueryDslGeoPolygonPoints { @@ -5191,13 +5231,6 @@ export interface QueryDslNestedQuery extends QueryDslQueryBase { score_mode?: QueryDslChildScoreMode } -export interface QueryDslNestedSortValue { - filter?: QueryDslQueryContainer - max_children?: integer - nested?: QueryDslNestedSortValue - path: Field -} - export interface QueryDslNumberRangeQuery extends QueryDslRangeQueryBase { gt?: double gte?: double @@ -5393,10 +5426,6 @@ export interface QueryDslScoreFunctionBase { weight?: double } -export interface QueryDslScoreSort { - order?: QueryDslSortOrder -} - export interface QueryDslScriptQuery extends QueryDslQueryBase { script: Script } @@ -5411,16 +5440,6 @@ export interface QueryDslScriptScoreQuery extends QueryDslQueryBase { script: Script } -export interface QueryDslScriptSort { - order?: QueryDslSortOrder - script: Script - type?: QueryDslScriptSortType - mode?: QueryDslSortMode - nested?: QueryDslNestedSortValue -} - -export type QueryDslScriptSortType = 'string' | 'number' - export interface QueryDslShapeFieldQuery { indexed_shape?: QueryDslFieldLookup relation?: GeoShapeRelation @@ -5453,25 +5472,6 @@ export interface QueryDslSimpleQueryStringQuery extends QueryDslQueryBase { quote_field_suffix?: string } -export type QueryDslSort = QueryDslSortCombinations | QueryDslSortCombinations[] - -export type QueryDslSortCombinations = Field | QueryDslSortOptions - -export type QueryDslSortMode = 'min' | 'max' | 'sum' | 'avg' | 'median' - -export interface QueryDslSortOptionsKeys { - _score?: QueryDslScoreSort - _doc?: QueryDslScoreSort - _geo_distance?: QueryDslGeoDistanceSort - _script?: QueryDslScriptSort -} -export type QueryDslSortOptions = QueryDslSortOptionsKeys - & { [property: string]: QueryDslFieldSort | QueryDslSortOrder | QueryDslScoreSort | QueryDslGeoDistanceSort | QueryDslScriptSort } - -export type QueryDslSortOrder = 'asc' | 'desc' - -export type QueryDslSortResults = (long | double | string | null)[] - export interface QueryDslSpanContainingQuery extends QueryDslQueryBase { big: QueryDslSpanQuery little: QueryDslSpanQuery @@ -5692,10 +5692,10 @@ export interface AsyncSearchSubmitRequest extends RequestBase { query?: QueryDslQueryContainer rescore?: SearchRescore | SearchRescore[] script_fields?: Record - search_after?: QueryDslSortResults + search_after?: SortResults size?: integer slice?: SlicedScroll - sort?: QueryDslSort + sort?: Sort _source?: SearchSourceConfig fields?: (QueryDslFieldAndFormat | Field)[] suggest?: SearchSuggester @@ -10561,7 +10561,7 @@ export type IngestShapeType = 'geo_shape' | 'shape' export interface IngestSortProcessor extends IngestProcessorBase { field: Field - order: QueryDslSortOrder + order: SortOrder target_field: Field } @@ -14938,7 +14938,7 @@ export interface SqlTranslateResponse { size: long _source: SearchSourceConfig fields: Record[] - sort: QueryDslSort + sort: Sort } export interface SslCertificatesCertificateInformation { @@ -15892,8 +15892,8 @@ export interface WatcherQueryWatchesRequest extends RequestBase { from?: integer size?: integer query?: QueryDslQueryContainer - sort?: QueryDslSort - search_after?: QueryDslSortResults + sort?: Sort + search_after?: SortResults } } @@ -16420,6 +16420,10 @@ export interface SpecUtilsAdditionalProperties [key: string]: never } +export interface SpecUtilsAdditionalProperty { + [key: string]: never +} + export interface SpecUtilsCommonQueryParameters { error_trace?: boolean filter_path?: string | string[] @@ -16427,10 +16431,6 @@ export interface SpecUtilsCommonQueryParameters { pretty?: boolean } -export interface SpecUtilsAdditionalProperty { - [key: string]: never -} - export interface SpecUtilsCommonCatQueryParameters { format?: string h?: Names diff --git a/specification/_global/reindex/types.ts b/specification/_global/reindex/types.ts index e4f5847d8c..b637ff44fb 100644 --- a/specification/_global/reindex/types.ts +++ b/specification/_global/reindex/types.ts @@ -17,7 +17,7 @@ * under the License. */ -import { Sort } from '@_types/query_dsl/sort' +import { Sort } from '@_types/sort' import { Fields, IndexName, diff --git a/specification/_global/search/SearchRequest.ts b/specification/_global/search/SearchRequest.ts index f6029d7e96..84050aa4f0 100644 --- a/specification/_global/search/SearchRequest.ts +++ b/specification/_global/search/SearchRequest.ts @@ -45,7 +45,7 @@ import { SourceConfigParam, SourceConfig } from './_types/SourceFilter' import { Suggester } from './_types/suggester' import { TrackHits } from '@global/search/_types/hits' import { Operator } from '@_types/query_dsl/Operator' -import { Sort, SortResults } from '@_types/query_dsl/sort' +import { Sort, SortResults } from '@_types/sort' /** * @rest_spec_name search diff --git a/specification/_global/search/_types/hits.ts b/specification/_global/search/_types/hits.ts index 7e9da8539b..f82475b304 100644 --- a/specification/_global/search/_types/hits.ts +++ b/specification/_global/search/_types/hits.ts @@ -36,7 +36,7 @@ import { FieldCollapse } from './FieldCollapse' import { Highlight } from './highlighting' import { SourceConfig } from './SourceFilter' import { FieldAndFormat } from '@_types/query_dsl/abstractions' -import { Sort, SortResults } from '@_types/query_dsl/sort' +import { Sort, SortResults } from '@_types/sort' export class Hit { _index: IndexName diff --git a/specification/_global/search_mvt/SearchMvtRequest.ts b/specification/_global/search_mvt/SearchMvtRequest.ts index 554fc8b701..b0738f0e92 100644 --- a/specification/_global/search_mvt/SearchMvtRequest.ts +++ b/specification/_global/search_mvt/SearchMvtRequest.ts @@ -23,7 +23,7 @@ import { Field, Fields, Indices } from '@_types/common' import { AggregationContainer } from '@_types/aggregations/AggregationContainer' import { GridType } from './_types/GridType' import { Coordinate } from './_types/Coordinate' -import { Sort } from '@_types/query_dsl/sort' +import { Sort } from '@_types/sort' import { QueryContainer } from '@_types/query_dsl/abstractions' import { RuntimeFields } from '@_types/mapping/RuntimeFields' import { integer } from '@_types/Numeric' diff --git a/specification/_types/aggregations/bucket.ts b/specification/_types/aggregations/bucket.ts index d99a23dbe7..fbb481a13c 100644 --- a/specification/_types/aggregations/bucket.ts +++ b/specification/_types/aggregations/bucket.ts @@ -17,7 +17,7 @@ * under the License. */ -import { SortOrder } from '@_types/query_dsl/sort' +import { SortOrder } from '@_types/sort' import { Dictionary } from '@spec_utils/Dictionary' import { UserDefinedValue } from '@spec_utils/UserDefinedValue' import { Field, RelationName, Fields } from '@_types/common' diff --git a/specification/_types/aggregations/matrix.ts b/specification/_types/aggregations/matrix.ts index 42dcff9386..0ea8bcdb99 100644 --- a/specification/_types/aggregations/matrix.ts +++ b/specification/_types/aggregations/matrix.ts @@ -21,7 +21,7 @@ import { Dictionary } from '@spec_utils/Dictionary' import { Fields, Field } from '@_types/common' import { double } from '@_types/Numeric' import { Aggregation } from './Aggregation' -import { SortMode } from '@_types/query_dsl/sort' +import { SortMode } from '@_types/sort' export class MatrixAggregation extends Aggregation { fields?: Fields diff --git a/specification/_types/aggregations/metric.ts b/specification/_types/aggregations/metric.ts index 89ffd7a9be..223e85886b 100644 --- a/specification/_types/aggregations/metric.ts +++ b/specification/_types/aggregations/metric.ts @@ -18,7 +18,7 @@ */ import { Highlight } from '@global/search/_types/highlighting' -import { SortOrder, Sort } from '@_types/query_dsl/sort' +import { SortOrder, Sort } from '@_types/sort' import { SourceConfig } from '@global/search/_types/SourceFilter' import { Dictionary } from '@spec_utils/Dictionary' import { UserDefinedValue } from '@spec_utils/UserDefinedValue' diff --git a/specification/_types/aggregations/pipeline.ts b/specification/_types/aggregations/pipeline.ts index fd1f9d17f2..ad6efde1dc 100644 --- a/specification/_types/aggregations/pipeline.ts +++ b/specification/_types/aggregations/pipeline.ts @@ -17,7 +17,7 @@ * under the License. */ -import { Sort } from '@_types/query_dsl/sort' +import { Sort } from '@_types/sort' import { Dictionary } from '@spec_utils/Dictionary' import { Name, Field, EmptyObject } from '@_types/common' import { integer, double, float } from '@_types/Numeric' diff --git a/specification/_types/query_dsl/sort.ts b/specification/_types/sort.ts similarity index 100% rename from specification/_types/query_dsl/sort.ts rename to specification/_types/sort.ts diff --git a/specification/async_search/submit/AsyncSearchSubmitRequest.ts b/specification/async_search/submit/AsyncSearchSubmitRequest.ts index 56cc36e12d..2191c83d01 100644 --- a/specification/async_search/submit/AsyncSearchSubmitRequest.ts +++ b/specification/async_search/submit/AsyncSearchSubmitRequest.ts @@ -41,7 +41,7 @@ import { FieldCollapse } from '@global/search/_types/FieldCollapse' import { Highlight } from '@global/search/_types/highlighting' import { PointInTimeReference } from '@global/search/_types/PointInTimeReference' import { Rescore } from '@global/search/_types/rescoring' -import { Sort, SortResults } from '@_types/query_dsl/sort' +import { Sort, SortResults } from '@_types/sort' import { SourceConfigParam, SourceConfig diff --git a/specification/ingest/_types/Processors.ts b/specification/ingest/_types/Processors.ts index 79ec4d2ebe..0a9022a6ad 100644 --- a/specification/ingest/_types/Processors.ts +++ b/specification/ingest/_types/Processors.ts @@ -17,7 +17,7 @@ * under the License. */ -import { SortOrder } from '@_types/query_dsl/sort' +import { SortOrder } from '@_types/sort' import { Dictionary } from '@spec_utils/Dictionary' import { UserDefinedValue } from '@spec_utils/UserDefinedValue' import { Field, Fields, Id, Name } from '@_types/common' diff --git a/specification/sql/translate/TranslateSqlResponse.ts b/specification/sql/translate/TranslateSqlResponse.ts index 2fc1ae24e6..7aa353c29a 100644 --- a/specification/sql/translate/TranslateSqlResponse.ts +++ b/specification/sql/translate/TranslateSqlResponse.ts @@ -17,7 +17,7 @@ * under the License. */ -import { Sort } from '@_types/query_dsl/sort' +import { Sort } from '@_types/sort' import { SourceConfig } from '@global/search/_types/SourceFilter' import { Dictionary } from '@spec_utils/Dictionary' import { Field, Fields } from '@_types/common' diff --git a/specification/watcher/query_watches/WatcherQueryWatchesRequest.ts b/specification/watcher/query_watches/WatcherQueryWatchesRequest.ts index afa22a3532..41eca74426 100644 --- a/specification/watcher/query_watches/WatcherQueryWatchesRequest.ts +++ b/specification/watcher/query_watches/WatcherQueryWatchesRequest.ts @@ -17,7 +17,7 @@ * under the License. */ -import { Sort, SortResults } from '@_types/query_dsl/sort' +import { Sort, SortResults } from '@_types/sort' import { RequestBase } from '@_types/Base' import { integer } from '@_types/Numeric' import { QueryContainer } from '@_types/query_dsl/abstractions'