From de646deb5fed95dbf2d7a23dd8419cad5717fc69 Mon Sep 17 00:00:00 2001 From: Quentin Pradet Date: Thu, 5 Sep 2024 15:22:48 +0400 Subject: [PATCH] Fix Open Point in time API (#2829) --- output/openapi/elasticsearch-openapi.json | 18 +++++++++++ .../elasticsearch-serverless-openapi.json | 18 +++++++++++ output/schema/schema-serverless.json | 32 +++++++++++++++++-- output/schema/schema.json | 32 +++++++++++++++++-- output/typescript/types.ts | 4 +++ .../OpenPointInTimeRequest.ts | 7 ++++ .../OpenPointInTimeResponse.ts | 7 +++- 7 files changed, 111 insertions(+), 7 deletions(-) diff --git a/output/openapi/elasticsearch-openapi.json b/output/openapi/elasticsearch-openapi.json index 152520550a..1ebd361a12 100644 --- a/output/openapi/elasticsearch-openapi.json +++ b/output/openapi/elasticsearch-openapi.json @@ -25216,6 +25216,20 @@ "style": "form" } ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "index_filter": { + "$ref": "#/components/schemas/_types.query_dsl:QueryContainer" + } + } + } + } + } + }, "responses": { "200": { "description": "", @@ -25224,11 +25238,15 @@ "schema": { "type": "object", "properties": { + "_shards": { + "$ref": "#/components/schemas/_types:ShardStatistics" + }, "id": { "$ref": "#/components/schemas/_types:Id" } }, "required": [ + "_shards", "id" ] } diff --git a/output/openapi/elasticsearch-serverless-openapi.json b/output/openapi/elasticsearch-serverless-openapi.json index 1e0e6897b1..25fe3971b2 100644 --- a/output/openapi/elasticsearch-serverless-openapi.json +++ b/output/openapi/elasticsearch-serverless-openapi.json @@ -15441,6 +15441,20 @@ "style": "form" } ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "index_filter": { + "$ref": "#/components/schemas/_types.query_dsl:QueryContainer" + } + } + } + } + } + }, "responses": { "200": { "description": "", @@ -15449,11 +15463,15 @@ "schema": { "type": "object", "properties": { + "_shards": { + "$ref": "#/components/schemas/_types:ShardStatistics" + }, "id": { "$ref": "#/components/schemas/_types:Id" } }, "required": [ + "_shards", "id" ] } diff --git a/output/schema/schema-serverless.json b/output/schema/schema-serverless.json index ef7f4fbec9..412056969a 100644 --- a/output/schema/schema-serverless.json +++ b/output/schema/schema-serverless.json @@ -34400,7 +34400,21 @@ "CommonQueryParameters" ], "body": { - "kind": "no_body" + "kind": "properties", + "properties": [ + { + "description": "Allows to filter indices if the provided query rewrites to `match_none` on every shard.", + "name": "index_filter", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "QueryContainer", + "namespace": "_types.query_dsl" + } + } + } + ] }, "description": "A search request by default executes against the most recent visible data of the target indices,\nwhich is called point in time. Elasticsearch pit (point in time) is a lightweight view into the\nstate of the data as it existed when initiated. In some cases, it’s preferred to perform multiple\nsearch requests using the same point in time. For example, if refreshes happen between\n`search_after` requests, then the results of those requests might not be consistent as changes happening\nbetween searches are only visible to the more recent point in time.", "inherits": { @@ -34492,12 +34506,24 @@ } } ], - "specLocation": "_global/open_point_in_time/OpenPointInTimeRequest.ts#L24-L68" + "specLocation": "_global/open_point_in_time/OpenPointInTimeRequest.ts#L25-L75" }, { "body": { "kind": "properties", "properties": [ + { + "description": "Shards used to create the PIT", + "name": "_shards", + "required": true, + "type": { + "kind": "instance_of", + "type": { + "name": "ShardStatistics", + "namespace": "_types" + } + } + }, { "name": "id", "required": true, @@ -34516,7 +34542,7 @@ "name": "Response", "namespace": "_global.open_point_in_time" }, - "specLocation": "_global/open_point_in_time/OpenPointInTimeResponse.ts#L22-L24" + "specLocation": "_global/open_point_in_time/OpenPointInTimeResponse.ts#L23-L29" }, { "attachedBehaviors": [ diff --git a/output/schema/schema.json b/output/schema/schema.json index 046ca2603b..b16fbce0db 100644 --- a/output/schema/schema.json +++ b/output/schema/schema.json @@ -29067,7 +29067,21 @@ "CommonQueryParameters" ], "body": { - "kind": "no_body" + "kind": "properties", + "properties": [ + { + "description": "Allows to filter indices if the provided query rewrites to `match_none` on every shard.", + "name": "index_filter", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "QueryContainer", + "namespace": "_types.query_dsl" + } + } + } + ] }, "description": "A search request by default executes against the most recent visible data of the target indices,\nwhich is called point in time. Elasticsearch pit (point in time) is a lightweight view into the\nstate of the data as it existed when initiated. In some cases, it’s preferred to perform multiple\nsearch requests using the same point in time. For example, if refreshes happen between\n`search_after` requests, then the results of those requests might not be consistent as changes happening\nbetween searches are only visible to the more recent point in time.", "inherits": { @@ -29158,13 +29172,25 @@ } } ], - "specLocation": "_global/open_point_in_time/OpenPointInTimeRequest.ts#L24-L68" + "specLocation": "_global/open_point_in_time/OpenPointInTimeRequest.ts#L25-L75" }, { "kind": "response", "body": { "kind": "properties", "properties": [ + { + "description": "Shards used to create the PIT", + "name": "_shards", + "required": true, + "type": { + "kind": "instance_of", + "type": { + "name": "ShardStatistics", + "namespace": "_types" + } + } + }, { "name": "id", "required": true, @@ -29182,7 +29208,7 @@ "name": "Response", "namespace": "_global.open_point_in_time" }, - "specLocation": "_global/open_point_in_time/OpenPointInTimeResponse.ts#L22-L24" + "specLocation": "_global/open_point_in_time/OpenPointInTimeResponse.ts#L23-L29" }, { "kind": "request", diff --git a/output/typescript/types.ts b/output/typescript/types.ts index 5eb90cb4f6..220328b618 100644 --- a/output/typescript/types.ts +++ b/output/typescript/types.ts @@ -895,9 +895,13 @@ export interface OpenPointInTimeRequest extends RequestBase { preference?: string routing?: Routing expand_wildcards?: ExpandWildcards + body?: { + index_filter?: QueryDslQueryContainer + } } export interface OpenPointInTimeResponse { + _shards: ShardStatistics id: Id } diff --git a/specification/_global/open_point_in_time/OpenPointInTimeRequest.ts b/specification/_global/open_point_in_time/OpenPointInTimeRequest.ts index 20a2123f28..d00475396d 100644 --- a/specification/_global/open_point_in_time/OpenPointInTimeRequest.ts +++ b/specification/_global/open_point_in_time/OpenPointInTimeRequest.ts @@ -20,6 +20,7 @@ import { RequestBase } from '@_types/Base' import { ExpandWildcards, Indices, Routing } from '@_types/common' import { Duration } from '@_types/Time' +import { QueryContainer } from '@_types/query_dsl/abstractions' /** * A search request by default executes against the most recent visible data of the target indices, @@ -65,4 +66,10 @@ export interface Request extends RequestBase { */ expand_wildcards?: ExpandWildcards } + body: { + /** + * Allows to filter indices if the provided query rewrites to `match_none` on every shard. + */ + index_filter?: QueryContainer + } } diff --git a/specification/_global/open_point_in_time/OpenPointInTimeResponse.ts b/specification/_global/open_point_in_time/OpenPointInTimeResponse.ts index 940b4c9971..0d7f46c5a3 100644 --- a/specification/_global/open_point_in_time/OpenPointInTimeResponse.ts +++ b/specification/_global/open_point_in_time/OpenPointInTimeResponse.ts @@ -18,7 +18,12 @@ */ import { Id } from '@_types/common' +import { ShardStatistics } from '@_types/Stats' export class Response { - body: { id: Id } + body: { + /** Shards used to create the PIT */ + _shards: ShardStatistics + id: Id + } }