From 5e9c9675baf026975b13dc7baafcff400978ec25 Mon Sep 17 00:00:00 2001 From: Quentin Pradet Date: Thu, 14 Nov 2024 09:59:06 +0400 Subject: [PATCH] Fix Fleet APIs --- output/openapi/elasticsearch-openapi.json | 164 ++++++++-- output/schema/schema-serverless.json | 213 +++++++++++- output/schema/schema.json | 308 +++++++++++++++--- output/schema/validation-errors.json | 4 +- output/typescript/types.ts | 28 +- .../fleet/msearch/MultiSearchRequest.ts | 44 ++- .../fleet/msearch/MultiSearchResponse.ts | 6 +- specification/fleet/search/SearchRequest.ts | 10 +- 8 files changed, 681 insertions(+), 96 deletions(-) diff --git a/output/openapi/elasticsearch-openapi.json b/output/openapi/elasticsearch-openapi.json index 60c66ad20..fcef130bf 100644 --- a/output/openapi/elasticsearch-openapi.json +++ b/output/openapi/elasticsearch-openapi.json @@ -8644,6 +8644,9 @@ { "$ref": "#/components/parameters/fleet.msearch#wait_for_checkpoints" }, + { + "$ref": "#/components/parameters/fleet.msearch#wait_for_checkpoints_timeout" + }, { "$ref": "#/components/parameters/fleet.msearch#allow_partial_search_results" } @@ -8702,6 +8705,9 @@ { "$ref": "#/components/parameters/fleet.msearch#wait_for_checkpoints" }, + { + "$ref": "#/components/parameters/fleet.msearch#wait_for_checkpoints_timeout" + }, { "$ref": "#/components/parameters/fleet.msearch#allow_partial_search_results" } @@ -8765,6 +8771,9 @@ { "$ref": "#/components/parameters/fleet.msearch#wait_for_checkpoints" }, + { + "$ref": "#/components/parameters/fleet.msearch#wait_for_checkpoints_timeout" + }, { "$ref": "#/components/parameters/fleet.msearch#allow_partial_search_results" } @@ -8826,6 +8835,9 @@ { "$ref": "#/components/parameters/fleet.msearch#wait_for_checkpoints" }, + { + "$ref": "#/components/parameters/fleet.msearch#wait_for_checkpoints_timeout" + }, { "$ref": "#/components/parameters/fleet.msearch#allow_partial_search_results" } @@ -8979,6 +8991,9 @@ { "$ref": "#/components/parameters/fleet.search#wait_for_checkpoints" }, + { + "$ref": "#/components/parameters/fleet.search#wait_for_checkpoints_timeout" + }, { "$ref": "#/components/parameters/fleet.search#allow_partial_search_results" } @@ -9130,6 +9145,9 @@ { "$ref": "#/components/parameters/fleet.search#wait_for_checkpoints" }, + { + "$ref": "#/components/parameters/fleet.search#wait_for_checkpoints_timeout" + }, { "$ref": "#/components/parameters/fleet.search#allow_partial_search_results" } @@ -65235,17 +65253,17 @@ "fleet._types:Checkpoint": { "type": "number" }, - "_global.msearch:RequestItem": { + "fleet.msearch:FleetRequestItem": { "oneOf": [ { - "$ref": "#/components/schemas/_global.msearch:MultisearchHeader" + "$ref": "#/components/schemas/fleet.msearch:FleetMultisearchHeader" }, { "$ref": "#/components/schemas/_global.msearch:MultisearchBody" } ] }, - "_global.msearch:MultisearchHeader": { + "fleet.msearch:FleetMultisearchHeader": { "type": "object", "properties": { "allow_no_indices": { @@ -65280,6 +65298,23 @@ }, "ignore_throttled": { "type": "boolean" + }, + "wait_for_checkpoints": { + "description": "A comma separated list of checkpoints. When configured, the search API will only be executed on a shard\nafter the relevant checkpoint has become visible for search. Defaults to an empty list which will cause\nElasticsearch to immediately execute the search.", + "oneOf": [ + { + "$ref": "#/components/schemas/fleet._types:Checkpoint" + }, + { + "type": "array", + "items": { + "$ref": "#/components/schemas/fleet._types:Checkpoint" + } + } + ] + }, + "wait_for_checkpoints_timeout": { + "$ref": "#/components/schemas/_types:Duration" } } }, @@ -65444,6 +65479,24 @@ } } }, + "_global.msearch:MultiSearchResult": { + "type": "object", + "properties": { + "took": { + "type": "number" + }, + "responses": { + "type": "array", + "items": { + "$ref": "#/components/schemas/_global.msearch:ResponseItem" + } + } + }, + "required": [ + "took", + "responses" + ] + }, "_global.msearch:ResponseItem": { "oneOf": [ { @@ -77232,23 +77285,53 @@ "model_memory_limit" ] }, - "_global.msearch:MultiSearchResult": { + "_global.msearch:RequestItem": { + "oneOf": [ + { + "$ref": "#/components/schemas/_global.msearch:MultisearchHeader" + }, + { + "$ref": "#/components/schemas/_global.msearch:MultisearchBody" + } + ] + }, + "_global.msearch:MultisearchHeader": { "type": "object", "properties": { - "took": { - "type": "number" + "allow_no_indices": { + "type": "boolean" }, - "responses": { - "type": "array", - "items": { - "$ref": "#/components/schemas/_global.msearch:ResponseItem" - } + "expand_wildcards": { + "$ref": "#/components/schemas/_types:ExpandWildcards" + }, + "ignore_unavailable": { + "type": "boolean" + }, + "index": { + "$ref": "#/components/schemas/_types:Indices" + }, + "preference": { + "type": "string" + }, + "request_cache": { + "type": "boolean" + }, + "routing": { + "$ref": "#/components/schemas/_types:Routing" + }, + "search_type": { + "$ref": "#/components/schemas/_types:SearchType" + }, + "ccs_minimize_roundtrips": { + "type": "boolean" + }, + "allow_partial_search_results": { + "type": "boolean" + }, + "ignore_throttled": { + "type": "boolean" } - }, - "required": [ - "took", - "responses" - ] + } }, "_global.msearch_template:RequestItem": { "oneOf": [ @@ -89367,18 +89450,7 @@ "content": { "application/json": { "schema": { - "type": "object", - "properties": { - "docs": { - "type": "array", - "items": { - "$ref": "#/components/schemas/_global.msearch:ResponseItem" - } - } - }, - "required": [ - "docs" - ] + "$ref": "#/components/schemas/_global.msearch:MultiSearchResult" } } } @@ -94682,6 +94754,15 @@ }, "style": "form" }, + "fleet.msearch#wait_for_checkpoints_timeout": { + "in": "query", + "name": "wait_for_checkpoints_timeout", + "deprecated": false, + "schema": { + "$ref": "#/components/schemas/_types:Duration" + }, + "style": "form" + }, "fleet.msearch#allow_partial_search_results": { "in": "query", "name": "allow_partial_search_results", @@ -95100,10 +95181,27 @@ "description": "A comma separated list of checkpoints. When configured, the search API will only be executed on a shard\nafter the relevant checkpoint has become visible for search. Defaults to an empty list which will cause\nElasticsearch to immediately execute the search.", "deprecated": false, "schema": { - "type": "array", - "items": { - "$ref": "#/components/schemas/fleet._types:Checkpoint" - } + "oneOf": [ + { + "$ref": "#/components/schemas/fleet._types:Checkpoint" + }, + { + "type": "array", + "items": { + "$ref": "#/components/schemas/fleet._types:Checkpoint" + } + } + ] + }, + "style": "form" + }, + "fleet.search#wait_for_checkpoints_timeout": { + "in": "query", + "name": "wait_for_checkpoints_timeout", + "description": "Explicit wait_for_checkpoints timeout", + "deprecated": false, + "schema": { + "$ref": "#/components/schemas/_types:Duration" }, "style": "form" }, @@ -101979,7 +102077,7 @@ "schema": { "type": "array", "items": { - "$ref": "#/components/schemas/_global.msearch:RequestItem" + "$ref": "#/components/schemas/fleet.msearch:FleetRequestItem" } } } diff --git a/output/schema/schema-serverless.json b/output/schema/schema-serverless.json index b4f72f149..60f3bdfb8 100644 --- a/output/schema/schema-serverless.json +++ b/output/schema/schema-serverless.json @@ -45219,7 +45219,7 @@ "name": "RequestItem", "namespace": "_global.msearch" }, - "specLocation": "_global/msearch/types.ts#L47-L50", + "specLocation": "_global/msearch/types.ts#L49-L52", "type": { "items": [ { @@ -45370,7 +45370,7 @@ } } ], - "specLocation": "_global/msearch/types.ts#L52-L67" + "specLocation": "_global/msearch/types.ts#L54-L69" }, { "kind": "type_alias", @@ -45967,7 +45967,7 @@ } } ], - "specLocation": "_global/msearch/types.ts#L70-L204" + "specLocation": "_global/msearch/types.ts#L72-L206" }, { "kind": "interface", @@ -67877,7 +67877,7 @@ "name": "ResponseItem", "namespace": "_global.msearch" }, - "specLocation": "_global/msearch/types.ts#L211-L214", + "specLocation": "_global/msearch/types.ts#L213-L216", "type": { "items": [ { @@ -67947,7 +67947,7 @@ } } ], - "specLocation": "_global/msearch/types.ts#L216-L219" + "specLocation": "_global/msearch/types.ts#L218-L221" }, { "generics": [ @@ -93248,6 +93248,207 @@ } } }, + { + "codegenNames": [ + "header", + "body" + ], + "kind": "type_alias", + "name": { + "name": "FleetRequestItem", + "namespace": "fleet.msearch" + }, + "specLocation": "fleet/msearch/MultiSearchRequest.ts#L123-L126", + "type": { + "items": [ + { + "kind": "instance_of", + "type": { + "name": "FleetMultisearchHeader", + "namespace": "fleet.msearch" + } + }, + { + "kind": "instance_of", + "type": { + "name": "MultisearchBody", + "namespace": "_global.msearch" + } + } + ], + "kind": "union_of" + } + }, + { + "description": "Contains parameters used to limit or change the subsequent search body request.", + "kind": "interface", + "name": { + "name": "FleetMultisearchHeader", + "namespace": "fleet.msearch" + }, + "properties": [ + { + "name": "allow_no_indices", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "boolean", + "namespace": "_builtins" + } + } + }, + { + "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": "_builtins" + } + } + }, + { + "name": "index", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "Indices", + "namespace": "_types" + } + } + }, + { + "name": "preference", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "string", + "namespace": "_builtins" + } + } + }, + { + "name": "request_cache", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "boolean", + "namespace": "_builtins" + } + } + }, + { + "name": "routing", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "Routing", + "namespace": "_types" + } + } + }, + { + "name": "search_type", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "SearchType", + "namespace": "_types" + } + } + }, + { + "name": "ccs_minimize_roundtrips", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "boolean", + "namespace": "_builtins" + } + } + }, + { + "name": "allow_partial_search_results", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "boolean", + "namespace": "_builtins" + } + } + }, + { + "name": "ignore_throttled", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "boolean", + "namespace": "_builtins" + } + } + }, + { + "description": "A comma separated list of checkpoints. When configured, the search API will only be executed on a shard\nafter the relevant checkpoint has become visible for search. Defaults to an empty list which will cause\nElasticsearch to immediately execute the search.", + "name": "wait_for_checkpoints", + "required": false, + "type": { + "items": [ + { + "kind": "instance_of", + "type": { + "name": "Checkpoint", + "namespace": "fleet._types" + } + }, + { + "kind": "array_of", + "value": { + "kind": "instance_of", + "type": { + "name": "Checkpoint", + "namespace": "fleet._types" + } + } + } + ], + "kind": "union_of" + } + }, + { + "name": "wait_for_checkpoints_timeout", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "Duration", + "namespace": "_types" + } + } + } + ], + "specLocation": "fleet/msearch/MultiSearchRequest.ts#L128-L154" + }, { "kind": "type_alias", "name": { @@ -136852,7 +137053,7 @@ } } ], - "specLocation": "_global/msearch/types.ts#L206-L209" + "specLocation": "_global/msearch/types.ts#L208-L211" }, { "kind": "interface", diff --git a/output/schema/schema.json b/output/schema/schema.json index 7395844be..fc48c2270 100644 --- a/output/schema/schema.json +++ b/output/schema/schema.json @@ -27620,7 +27620,7 @@ } } ], - "specLocation": "_global/msearch/types.ts#L216-L219" + "specLocation": "_global/msearch/types.ts#L218-L221" }, { "kind": "interface", @@ -27670,7 +27670,7 @@ } } ], - "specLocation": "_global/msearch/types.ts#L206-L209" + "specLocation": "_global/msearch/types.ts#L208-L211" }, { "kind": "interface", @@ -28144,7 +28144,7 @@ } } ], - "specLocation": "_global/msearch/types.ts#L70-L204" + "specLocation": "_global/msearch/types.ts#L72-L206" }, { "kind": "interface", @@ -28276,7 +28276,7 @@ } } ], - "specLocation": "_global/msearch/types.ts#L52-L67" + "specLocation": "_global/msearch/types.ts#L54-L69" }, { "kind": "request", @@ -28500,7 +28500,7 @@ "name": "RequestItem", "namespace": "_global.msearch" }, - "specLocation": "_global/msearch/types.ts#L47-L50", + "specLocation": "_global/msearch/types.ts#L49-L52", "type": { "kind": "union_of", "items": [ @@ -28570,7 +28570,7 @@ "name": "ResponseItem", "namespace": "_global.msearch" }, - "specLocation": "_global/msearch/types.ts#L211-L214", + "specLocation": "_global/msearch/types.ts#L213-L216", "type": { "kind": "union_of", "items": [ @@ -118607,6 +118607,207 @@ }, "specLocation": "fleet/global_checkpoints/GlobalCheckpointsResponse.ts#L22-L27" }, + { + "kind": "interface", + "description": "Contains parameters used to limit or change the subsequent search body request.", + "name": { + "name": "FleetMultisearchHeader", + "namespace": "fleet.msearch" + }, + "properties": [ + { + "name": "allow_no_indices", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "boolean", + "namespace": "_builtins" + } + } + }, + { + "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": "_builtins" + } + } + }, + { + "name": "index", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "Indices", + "namespace": "_types" + } + } + }, + { + "name": "preference", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "string", + "namespace": "_builtins" + } + } + }, + { + "name": "request_cache", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "boolean", + "namespace": "_builtins" + } + } + }, + { + "name": "routing", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "Routing", + "namespace": "_types" + } + } + }, + { + "name": "search_type", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "SearchType", + "namespace": "_types" + } + } + }, + { + "name": "ccs_minimize_roundtrips", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "boolean", + "namespace": "_builtins" + } + } + }, + { + "name": "allow_partial_search_results", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "boolean", + "namespace": "_builtins" + } + } + }, + { + "name": "ignore_throttled", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "boolean", + "namespace": "_builtins" + } + } + }, + { + "description": "A comma separated list of checkpoints. When configured, the search API will only be executed on a shard\nafter the relevant checkpoint has become visible for search. Defaults to an empty list which will cause\nElasticsearch to immediately execute the search.", + "name": "wait_for_checkpoints", + "required": false, + "type": { + "kind": "union_of", + "items": [ + { + "kind": "instance_of", + "type": { + "name": "Checkpoint", + "namespace": "fleet._types" + } + }, + { + "kind": "array_of", + "value": { + "kind": "instance_of", + "type": { + "name": "Checkpoint", + "namespace": "fleet._types" + } + } + } + ] + } + }, + { + "name": "wait_for_checkpoints_timeout", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "Duration", + "namespace": "_types" + } + } + } + ], + "specLocation": "fleet/msearch/MultiSearchRequest.ts#L128-L154" + }, + { + "kind": "type_alias", + "codegenNames": [ + "header", + "body" + ], + "name": { + "name": "FleetRequestItem", + "namespace": "fleet.msearch" + }, + "specLocation": "fleet/msearch/MultiSearchRequest.ts#L123-L126", + "type": { + "kind": "union_of", + "items": [ + { + "kind": "instance_of", + "type": { + "name": "FleetMultisearchHeader", + "namespace": "fleet.msearch" + } + }, + { + "kind": "instance_of", + "type": { + "name": "MultisearchBody", + "namespace": "_global.msearch" + } + } + ] + } + }, { "kind": "request", "attachedBehaviors": [ @@ -118620,8 +118821,8 @@ "value": { "kind": "instance_of", "type": { - "name": "RequestItem", - "namespace": "_global.msearch" + "name": "FleetRequestItem", + "namespace": "fleet.msearch" } } } @@ -118819,6 +119020,17 @@ } } }, + { + "name": "wait_for_checkpoints_timeout", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "Duration", + "namespace": "_types" + } + } + }, { "description": "If true, returns partial results if there are shard request timeouts or [shard failures](https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-replication.html#shard-failures). If false, returns\nan error with no partial results. Defaults to the configured cluster setting `search.default_allow_partial_results`\nwhich is true by default.", "name": "allow_partial_search_results", @@ -118832,37 +119044,28 @@ } } ], - "specLocation": "fleet/msearch/MultiSearchRequest.ts#L31-L114" + "specLocation": "fleet/msearch/MultiSearchRequest.ts#L34-L121" }, { "kind": "response", "body": { - "kind": "properties", - "properties": [ - { - "name": "docs", - "required": true, - "type": { - "kind": "array_of", - "value": { - "kind": "instance_of", - "generics": [ - { - "kind": "instance_of", - "type": { - "name": "TDocument", - "namespace": "fleet.msearch.Response" - } - } - ], - "type": { - "name": "ResponseItem", - "namespace": "_global.msearch" - } + "kind": "value", + "value": { + "kind": "instance_of", + "generics": [ + { + "kind": "instance_of", + "type": { + "name": "TDocument", + "namespace": "fleet.msearch.Response" } } + ], + "type": { + "name": "MultiSearchResult", + "namespace": "_global.msearch" } - ] + } }, "generics": [ { @@ -118874,7 +119077,7 @@ "name": "Response", "namespace": "fleet.msearch" }, - "specLocation": "fleet/msearch/MultiSearchResponse.ts#L25-L29" + "specLocation": "fleet/msearch/MultiSearchResponse.ts#L25-L27" }, { "kind": "request", @@ -119839,15 +120042,38 @@ "description": "A comma separated list of checkpoints. When configured, the search API will only be executed on a shard\nafter the relevant checkpoint has become visible for search. Defaults to an empty list which will cause\nElasticsearch to immediately execute the search.", "name": "wait_for_checkpoints", "required": false, - "serverDefault": [], "type": { - "kind": "array_of", - "value": { - "kind": "instance_of", - "type": { - "name": "Checkpoint", - "namespace": "fleet._types" + "kind": "union_of", + "items": [ + { + "kind": "instance_of", + "type": { + "name": "Checkpoint", + "namespace": "fleet._types" + } + }, + { + "kind": "array_of", + "value": { + "kind": "instance_of", + "type": { + "name": "Checkpoint", + "namespace": "fleet._types" + } + } } + ] + } + }, + { + "description": "Explicit wait_for_checkpoints timeout", + "name": "wait_for_checkpoints_timeout", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "Duration", + "namespace": "_types" } } }, @@ -119864,7 +120090,7 @@ } } ], - "specLocation": "fleet/search/SearchRequest.ts#L54-L258" + "specLocation": "fleet/search/SearchRequest.ts#L54-L262" }, { "kind": "response", diff --git a/output/schema/validation-errors.json b/output/schema/validation-errors.json index 9c6cbcafe..87f2cfa27 100644 --- a/output/schema/validation-errors.json +++ b/output/schema/validation-errors.json @@ -680,6 +680,7 @@ "Request: query parameter 'rest_total_hits_as_int' does not exist in the json spec", "Request: query parameter 'typed_keys' does not exist in the json spec", "Request: query parameter 'wait_for_checkpoints' does not exist in the json spec", + "Request: query parameter 'wait_for_checkpoints_timeout' does not exist in the json spec", "Request: query parameter 'allow_partial_search_results' does not exist in the json spec" ], "response": [ @@ -734,8 +735,7 @@ "Request: query parameter 'q' does not exist in the json spec", "Request: query parameter 'size' does not exist in the json spec", "Request: query parameter 'from' does not exist in the json spec", - "Request: query parameter 'sort' does not exist in the json spec", - "Request: missing json spec query parameter 'wait_for_checkpoints_timeout'" + "Request: query parameter 'sort' does not exist in the json spec" ], "response": [] }, diff --git a/output/typescript/types.ts b/output/typescript/types.ts index 4e1be9944..3ab2114d5 100644 --- a/output/typescript/types.ts +++ b/output/typescript/types.ts @@ -10428,6 +10428,24 @@ export interface FleetGlobalCheckpointsResponse { timed_out: boolean } +export interface FleetMsearchFleetMultisearchHeader { + allow_no_indices?: boolean + expand_wildcards?: ExpandWildcards + ignore_unavailable?: boolean + index?: Indices + preference?: string + request_cache?: boolean + routing?: Routing + search_type?: SearchType + ccs_minimize_roundtrips?: boolean + allow_partial_search_results?: boolean + ignore_throttled?: boolean + wait_for_checkpoints?: FleetCheckpoint | FleetCheckpoint[] + wait_for_checkpoints_timeout?: Duration +} + +export type FleetMsearchFleetRequestItem = FleetMsearchFleetMultisearchHeader | MsearchMultisearchBody + export interface FleetMsearchRequest extends RequestBase { index?: IndexName | IndexAlias allow_no_indices?: boolean @@ -10442,13 +10460,12 @@ export interface FleetMsearchRequest extends RequestBase { rest_total_hits_as_int?: boolean typed_keys?: boolean wait_for_checkpoints?: FleetCheckpoint[] + wait_for_checkpoints_timeout?: Duration allow_partial_search_results?: boolean - body?: MsearchRequestItem[] + body?: FleetMsearchFleetRequestItem[] } -export interface FleetMsearchResponse { - docs: MsearchResponseItem[] -} +export type FleetMsearchResponse = MsearchMultiSearchResult export interface FleetSearchRequest extends RequestBase { index: IndexName | IndexAlias @@ -10493,7 +10510,8 @@ export interface FleetSearchRequest extends RequestBase { size?: integer from?: integer sort?: string | string[] - wait_for_checkpoints?: FleetCheckpoint[] + wait_for_checkpoints?: FleetCheckpoint | FleetCheckpoint[] + wait_for_checkpoints_timeout?: Duration allow_partial_search_results?: boolean body?: { aggregations?: Record diff --git a/specification/fleet/msearch/MultiSearchRequest.ts b/specification/fleet/msearch/MultiSearchRequest.ts index 188da0e43..12a463816 100644 --- a/specification/fleet/msearch/MultiSearchRequest.ts +++ b/specification/fleet/msearch/MultiSearchRequest.ts @@ -17,15 +17,18 @@ * under the License. */ -import { RequestItem } from '@global/msearch/types' +import { MultisearchBody } from '@global/msearch/types' import { RequestBase } from '@_types/Base' import { ExpandWildcards, IndexAlias, IndexName, + Indices, + Routing, SearchType } from '@_types/common' import { long } from '@_types/Numeric' +import { Duration } from '@_types/Time' import { Checkpoint } from '../_types/Checkpoints' /** @@ -102,6 +105,10 @@ export interface Request extends RequestBase { * @server_default [] */ wait_for_checkpoints?: Checkpoint[] + /* + * @server_default 30s + */ + wait_for_checkpoints_timeout?: Duration /** * If true, returns partial results if there are shard request timeouts or [shard failures](https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-replication.html#shard-failures). If false, returns * an error with no partial results. Defaults to the configured cluster setting `search.default_allow_partial_results` @@ -110,5 +117,38 @@ export interface Request extends RequestBase { allow_partial_search_results?: boolean } /** @codegen_name searches */ - body: Array + body: Array +} + +/** + * @codegen_names header, body + */ +export type FleetRequestItem = FleetMultisearchHeader | MultisearchBody + +/** + * Contains parameters used to limit or change the subsequent search body request. + */ +export class FleetMultisearchHeader { + allow_no_indices?: boolean + expand_wildcards?: ExpandWildcards + ignore_unavailable?: boolean + index?: Indices + preference?: string + request_cache?: boolean + routing?: Routing + search_type?: SearchType + ccs_minimize_roundtrips?: boolean + allow_partial_search_results?: boolean + ignore_throttled?: boolean + /** + * A comma separated list of checkpoints. When configured, the search API will only be executed on a shard + * after the relevant checkpoint has become visible for search. Defaults to an empty list which will cause + * Elasticsearch to immediately execute the search. + */ + wait_for_checkpoints?: Checkpoint | Checkpoint[] + /* + * Time to wait for the checkpoints to become visible for search. + * @server_default 30s + */ + wait_for_checkpoints_timeout?: Duration } diff --git a/specification/fleet/msearch/MultiSearchResponse.ts b/specification/fleet/msearch/MultiSearchResponse.ts index 1a9c3164e..45ce7c1da 100644 --- a/specification/fleet/msearch/MultiSearchResponse.ts +++ b/specification/fleet/msearch/MultiSearchResponse.ts @@ -17,13 +17,11 @@ * under the License. */ -import { ResponseItem } from '_global/msearch/types' +import { MultiSearchResult } from '_global/msearch/types' // Keep changes in sync with: // - msearch // - fleet.msearch export class Response { - body: { - docs: ResponseItem[] - } + body: MultiSearchResult } diff --git a/specification/fleet/search/SearchRequest.ts b/specification/fleet/search/SearchRequest.ts index 36f015976..7d104abe7 100644 --- a/specification/fleet/search/SearchRequest.ts +++ b/specification/fleet/search/SearchRequest.ts @@ -115,12 +115,16 @@ export interface Request extends RequestBase { from?: integer sort?: string | string[] /** - * A comma separated list of checkpoints. When configured, the search API will only be executed on a shard + * A comma separated list of checkpoints. When configured, the search API will only be executed on a shard * after the relevant checkpoint has become visible for search. Defaults to an empty list which will cause * Elasticsearch to immediately execute the search. - * @server_default [] */ - wait_for_checkpoints?: Checkpoint[] + wait_for_checkpoints?: Checkpoint | Checkpoint[] + /* + * Time to wait for the checkpoints to become visible for search. + * @server_default 30s + */ + wait_for_checkpoints_timeout?: Duration /** * If true, returns partial results if there are shard request timeouts or [shard failures](https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-replication.html#shard-failures). If false, returns * an error with no partial results. Defaults to the configured cluster setting `search.default_allow_partial_results`