From f4904eeb8017b044940d48bba725d41d8594e031 Mon Sep 17 00:00:00 2001 From: Luigi Dell'Aquila Date: Wed, 18 Dec 2024 09:57:38 +0100 Subject: [PATCH 1/2] Add spec for EQL allow_partial_search_results (#3342) (cherry picked from commit 5987f79aed121f3657fc75769e494b26404d512b) --- output/openapi/elasticsearch-openapi.json | 38 ++++++++++++++ .../elasticsearch-serverless-openapi.json | 38 ++++++++++++++ output/schema/schema-serverless.json | 50 ++++++++++++++++++- output/schema/schema.json | 50 ++++++++++++++++++- output/schema/validation-errors.json | 2 + output/typescript/types.ts | 4 ++ package-lock.json | 2 +- specification/eql/search/EqlSearchRequest.ts | 13 +++++ 8 files changed, 194 insertions(+), 3 deletions(-) diff --git a/output/openapi/elasticsearch-openapi.json b/output/openapi/elasticsearch-openapi.json index 51dd1e2a9d..9a55b17a6e 100644 --- a/output/openapi/elasticsearch-openapi.json +++ b/output/openapi/elasticsearch-openapi.json @@ -8244,6 +8244,12 @@ { "$ref": "#/components/parameters/eql.search#allow_no_indices" }, + { + "$ref": "#/components/parameters/eql.search#allow_partial_search_results" + }, + { + "$ref": "#/components/parameters/eql.search#allow_partial_sequence_results" + }, { "$ref": "#/components/parameters/eql.search#expand_wildcards" }, @@ -8287,6 +8293,12 @@ { "$ref": "#/components/parameters/eql.search#allow_no_indices" }, + { + "$ref": "#/components/parameters/eql.search#allow_partial_search_results" + }, + { + "$ref": "#/components/parameters/eql.search#allow_partial_sequence_results" + }, { "$ref": "#/components/parameters/eql.search#expand_wildcards" }, @@ -96479,6 +96491,26 @@ }, "style": "form" }, + "eql.search#allow_partial_search_results": { + "in": "query", + "name": "allow_partial_search_results", + "description": "If true, returns partial results if there are shard failures. If false, returns an error with no partial results.", + "deprecated": false, + "schema": { + "type": "boolean" + }, + "style": "form" + }, + "eql.search#allow_partial_sequence_results": { + "in": "query", + "name": "allow_partial_sequence_results", + "description": "If true, sequence queries will return partial results in case of shard failures. If false, they will return no results at all.\nThis flag has effect only if allow_partial_search_results is true.", + "deprecated": false, + "schema": { + "type": "boolean" + }, + "style": "form" + }, "eql.search#expand_wildcards": { "in": "query", "name": "expand_wildcards", @@ -104316,6 +104348,12 @@ "wait_for_completion_timeout": { "$ref": "#/components/schemas/_types:Duration" }, + "allow_partial_search_results": { + "type": "boolean" + }, + "allow_partial_sequence_results": { + "type": "boolean" + }, "size": { "$ref": "#/components/schemas/_types:uint" }, diff --git a/output/openapi/elasticsearch-serverless-openapi.json b/output/openapi/elasticsearch-serverless-openapi.json index 53b10bd877..9a0976c494 100644 --- a/output/openapi/elasticsearch-serverless-openapi.json +++ b/output/openapi/elasticsearch-serverless-openapi.json @@ -5014,6 +5014,12 @@ { "$ref": "#/components/parameters/eql.search#allow_no_indices" }, + { + "$ref": "#/components/parameters/eql.search#allow_partial_search_results" + }, + { + "$ref": "#/components/parameters/eql.search#allow_partial_sequence_results" + }, { "$ref": "#/components/parameters/eql.search#expand_wildcards" }, @@ -5057,6 +5063,12 @@ { "$ref": "#/components/parameters/eql.search#allow_no_indices" }, + { + "$ref": "#/components/parameters/eql.search#allow_partial_search_results" + }, + { + "$ref": "#/components/parameters/eql.search#allow_partial_sequence_results" + }, { "$ref": "#/components/parameters/eql.search#expand_wildcards" }, @@ -58702,6 +58714,26 @@ }, "style": "form" }, + "eql.search#allow_partial_search_results": { + "in": "query", + "name": "allow_partial_search_results", + "description": "If true, returns partial results if there are shard failures. If false, returns an error with no partial results.", + "deprecated": false, + "schema": { + "type": "boolean" + }, + "style": "form" + }, + "eql.search#allow_partial_sequence_results": { + "in": "query", + "name": "allow_partial_sequence_results", + "description": "If true, sequence queries will return partial results in case of shard failures. If false, they will return no results at all.\nThis flag has effect only if allow_partial_search_results is true.", + "deprecated": false, + "schema": { + "type": "boolean" + }, + "style": "form" + }, "eql.search#expand_wildcards": { "in": "query", "name": "expand_wildcards", @@ -62853,6 +62885,12 @@ "wait_for_completion_timeout": { "$ref": "#/components/schemas/_types:Duration" }, + "allow_partial_search_results": { + "type": "boolean" + }, + "allow_partial_sequence_results": { + "type": "boolean" + }, "size": { "$ref": "#/components/schemas/_types:uint" }, diff --git a/output/schema/schema-serverless.json b/output/schema/schema-serverless.json index 5080ca0016..cb28840ad3 100644 --- a/output/schema/schema-serverless.json +++ b/output/schema/schema-serverless.json @@ -17534,6 +17534,28 @@ } } }, + { + "name": "allow_partial_search_results", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "boolean", + "namespace": "_builtins" + } + } + }, + { + "name": "allow_partial_sequence_results", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "boolean", + "namespace": "_builtins" + } + } + }, { "description": "For basic queries, the maximum number of matching events to return. Defaults to 10", "docId": "eql-basic-syntax", @@ -17645,6 +17667,32 @@ } } }, + { + "description": "If true, returns partial results if there are shard failures. If false, returns an error with no partial results.", + "name": "allow_partial_search_results", + "required": false, + "serverDefault": false, + "type": { + "kind": "instance_of", + "type": { + "name": "boolean", + "namespace": "_builtins" + } + } + }, + { + "description": "If true, sequence queries will return partial results in case of shard failures. If false, they will return no results at all.\nThis flag has effect only if allow_partial_search_results is true.", + "name": "allow_partial_sequence_results", + "required": false, + "serverDefault": false, + "type": { + "kind": "instance_of", + "type": { + "name": "boolean", + "namespace": "_builtins" + } + } + }, { "name": "expand_wildcards", "required": false, @@ -17709,7 +17757,7 @@ } } ], - "specLocation": "eql/search/EqlSearchRequest.ts#L28-L122" + "specLocation": "eql/search/EqlSearchRequest.ts#L28-L135" }, { "body": { diff --git a/output/schema/schema.json b/output/schema/schema.json index 2e418b2b45..e582ef22de 100644 --- a/output/schema/schema.json +++ b/output/schema/schema.json @@ -118784,6 +118784,28 @@ } } }, + { + "name": "allow_partial_search_results", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "boolean", + "namespace": "_builtins" + } + } + }, + { + "name": "allow_partial_sequence_results", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "boolean", + "namespace": "_builtins" + } + } + }, { "description": "For basic queries, the maximum number of matching events to return. Defaults to 10", "docId": "eql-basic-syntax", @@ -118894,6 +118916,32 @@ } } }, + { + "description": "If true, returns partial results if there are shard failures. If false, returns an error with no partial results.", + "name": "allow_partial_search_results", + "required": false, + "serverDefault": false, + "type": { + "kind": "instance_of", + "type": { + "name": "boolean", + "namespace": "_builtins" + } + } + }, + { + "description": "If true, sequence queries will return partial results in case of shard failures. If false, they will return no results at all.\nThis flag has effect only if allow_partial_search_results is true.", + "name": "allow_partial_sequence_results", + "required": false, + "serverDefault": false, + "type": { + "kind": "instance_of", + "type": { + "name": "boolean", + "namespace": "_builtins" + } + } + }, { "name": "expand_wildcards", "required": false, @@ -118958,7 +119006,7 @@ } } ], - "specLocation": "eql/search/EqlSearchRequest.ts#L28-L122" + "specLocation": "eql/search/EqlSearchRequest.ts#L28-L135" }, { "kind": "response", diff --git a/output/schema/validation-errors.json b/output/schema/validation-errors.json index 4b30c5e771..ce971775f8 100644 --- a/output/schema/validation-errors.json +++ b/output/schema/validation-errors.json @@ -394,6 +394,8 @@ "eql.search": { "request": [ "Request: query parameter 'allow_no_indices' does not exist in the json spec", + "Request: query parameter 'allow_partial_search_results' does not exist in the json spec", + "Request: query parameter 'allow_partial_sequence_results' does not exist in the json spec", "Request: query parameter 'expand_wildcards' does not exist in the json spec", "Request: query parameter 'ignore_unavailable' does not exist in the json spec" ], diff --git a/output/typescript/types.ts b/output/typescript/types.ts index e7b7d9c566..8c3eb60864 100644 --- a/output/typescript/types.ts +++ b/output/typescript/types.ts @@ -10396,6 +10396,8 @@ export interface EqlGetStatusResponse { export interface EqlSearchRequest extends RequestBase { index: Indices allow_no_indices?: boolean + allow_partial_search_results?: boolean + allow_partial_sequence_results?: boolean expand_wildcards?: ExpandWildcards ignore_unavailable?: boolean keep_alive?: Duration @@ -10412,6 +10414,8 @@ export interface EqlSearchRequest extends RequestBase { keep_alive?: Duration keep_on_completion?: boolean wait_for_completion_timeout?: Duration + allow_partial_search_results?: boolean + allow_partial_sequence_results?: boolean size?: uint fields?: QueryDslFieldAndFormat | Field | (QueryDslFieldAndFormat | Field)[] result_position?: EqlSearchResultPosition diff --git a/package-lock.json b/package-lock.json index eb5922e739..88470238cc 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,5 +1,5 @@ { - "name": "elasticsearch-specification", + "name": "backport-8.x", "lockfileVersion": 3, "requires": true, "packages": { diff --git a/specification/eql/search/EqlSearchRequest.ts b/specification/eql/search/EqlSearchRequest.ts index 87c5c3293f..e3a6c7c050 100644 --- a/specification/eql/search/EqlSearchRequest.ts +++ b/specification/eql/search/EqlSearchRequest.ts @@ -43,6 +43,17 @@ export interface Request extends RequestBase { * @server_default true */ allow_no_indices?: boolean + /** + * If true, returns partial results if there are shard failures. If false, returns an error with no partial results. + * @server_default false + */ + allow_partial_search_results?: boolean + /** + * If true, sequence queries will return partial results in case of shard failures. If false, they will return no results at all. + * This flag has effect only if allow_partial_search_results is true. + * @server_default false + */ + allow_partial_sequence_results?: boolean /** * @server_default open */ @@ -100,6 +111,8 @@ export interface Request extends RequestBase { keep_alive?: Duration keep_on_completion?: boolean wait_for_completion_timeout?: Duration + allow_partial_search_results?: boolean + allow_partial_sequence_results?: boolean /** * For basic queries, the maximum number of matching events to return. Defaults to 10 * @doc_id eql-basic-syntax From 4def748dddfda2c612a3053c2c5b789077a17392 Mon Sep 17 00:00:00 2001 From: Luigi DellAquila Date: Thu, 19 Dec 2024 15:17:27 +0100 Subject: [PATCH 2/2] Add shard_failures to the response --- output/openapi/elasticsearch-openapi.json | 7 +++++++ .../elasticsearch-serverless-openapi.json | 7 +++++++ output/schema/schema-serverless.json | 17 ++++++++++++++++- output/schema/schema.json | 17 ++++++++++++++++- output/typescript/types.ts | 1 + .../eql/_types/EqlSearchResponseBase.ts | 5 +++++ 6 files changed, 52 insertions(+), 2 deletions(-) diff --git a/output/openapi/elasticsearch-openapi.json b/output/openapi/elasticsearch-openapi.json index 9a55b17a6e..38936c33e7 100644 --- a/output/openapi/elasticsearch-openapi.json +++ b/output/openapi/elasticsearch-openapi.json @@ -66371,6 +66371,13 @@ }, "hits": { "$ref": "#/components/schemas/eql._types:EqlHits" + }, + "shard_failures": { + "description": "Contains information about shard failures (if any), in case allow_partial_search_results=true", + "type": "array", + "items": { + "$ref": "#/components/schemas/_types:ShardFailure" + } } }, "required": [ diff --git a/output/openapi/elasticsearch-serverless-openapi.json b/output/openapi/elasticsearch-serverless-openapi.json index 9a0976c494..1badb71eb5 100644 --- a/output/openapi/elasticsearch-serverless-openapi.json +++ b/output/openapi/elasticsearch-serverless-openapi.json @@ -44487,6 +44487,13 @@ }, "hits": { "$ref": "#/components/schemas/eql._types:EqlHits" + }, + "shard_failures": { + "description": "Contains information about shard failures (if any), in case allow_partial_search_results=true", + "type": "array", + "items": { + "$ref": "#/components/schemas/_types:ShardFailure" + } } }, "required": [ diff --git a/output/schema/schema-serverless.json b/output/schema/schema-serverless.json index cb28840ad3..99608360b2 100644 --- a/output/schema/schema-serverless.json +++ b/output/schema/schema-serverless.json @@ -117902,9 +117902,24 @@ "namespace": "eql._types" } } + }, + { + "description": "Contains information about shard failures (if any), in case allow_partial_search_results=true", + "name": "shard_failures", + "required": false, + "type": { + "kind": "array_of", + "value": { + "kind": "instance_of", + "type": { + "name": "ShardFailure", + "namespace": "_types" + } + } + } } ], - "specLocation": "eql/_types/EqlSearchResponseBase.ts#L24-L49" + "specLocation": "eql/_types/EqlSearchResponseBase.ts#L25-L54" }, { "generics": [ diff --git a/output/schema/schema.json b/output/schema/schema.json index e582ef22de..1343674085 100644 --- a/output/schema/schema.json +++ b/output/schema/schema.json @@ -118208,9 +118208,24 @@ "namespace": "eql._types" } } + }, + { + "description": "Contains information about shard failures (if any), in case allow_partial_search_results=true", + "name": "shard_failures", + "required": false, + "type": { + "kind": "array_of", + "value": { + "kind": "instance_of", + "type": { + "name": "ShardFailure", + "namespace": "_types" + } + } + } } ], - "specLocation": "eql/_types/EqlSearchResponseBase.ts#L24-L49" + "specLocation": "eql/_types/EqlSearchResponseBase.ts#L25-L54" }, { "kind": "interface", diff --git a/output/typescript/types.ts b/output/typescript/types.ts index 8c3eb60864..b0a6acdc17 100644 --- a/output/typescript/types.ts +++ b/output/typescript/types.ts @@ -10351,6 +10351,7 @@ export interface EqlEqlSearchResponseBase { took?: DurationValue timed_out?: boolean hits: EqlEqlHits + shard_failures?: ShardFailure[] } export interface EqlHitsEvent { diff --git a/specification/eql/_types/EqlSearchResponseBase.ts b/specification/eql/_types/EqlSearchResponseBase.ts index f296ffd6bf..6789a5471d 100644 --- a/specification/eql/_types/EqlSearchResponseBase.ts +++ b/specification/eql/_types/EqlSearchResponseBase.ts @@ -18,6 +18,7 @@ */ import { Id } from '@_types/common' +import { ShardFailure } from '@_types/Errors' import { DurationValue, UnitMillis } from '@_types/Time' import { EqlHits } from './EqlHits' @@ -46,4 +47,8 @@ export class EqlSearchResponseBase { * Contains matching events and sequences. Also contains related metadata. */ hits: EqlHits + /** + * Contains information about shard failures (if any), in case allow_partial_search_results=true + */ + shard_failures?: ShardFailure[] }