From 3893113d4ebc06b3e28505a3a020ef94cd4a805f Mon Sep 17 00:00:00 2001 From: Quentin Pradet Date: Tue, 7 Nov 2023 19:13:50 +0400 Subject: [PATCH] Revert "Allow single fields in fields and _source parameters (#2317)" (#2341) This reverts commit 9f40be8b64f80a8602c362aae25ff27be71e1b9a. --- .../elasticsearch-serverless-openapi.json | 39 +------ output/schema/schema.json | 108 +++++------------- output/typescript/types.ts | 10 +- specification/_global/msearch/types.ts | 5 +- specification/_global/search/SearchRequest.ts | 4 +- .../_global/search/_types/SourceFilter.ts | 4 +- 6 files changed, 41 insertions(+), 129 deletions(-) diff --git a/output/openapi/elasticsearch-serverless-openapi.json b/output/openapi/elasticsearch-serverless-openapi.json index 1ee2465747..559c8b5978 100644 --- a/output/openapi/elasticsearch-serverless-openapi.json +++ b/output/openapi/elasticsearch-serverless-openapi.json @@ -26307,14 +26307,7 @@ "description": "Array of wildcard (`*`) patterns.\nThe request returns doc values for field names matching these patterns in the `hits.fields` property of the response.", "type": "array", "items": { - "oneOf": [ - { - "$ref": "#/components/schemas/_types:Field" - }, - { - "$ref": "#/components/schemas/_types.query_dsl:FieldAndFormat" - } - ] + "$ref": "#/components/schemas/_types.query_dsl:FieldAndFormat" } }, "knn": { @@ -26389,14 +26382,7 @@ "description": "Array of wildcard (`*`) patterns.\nThe request returns values for field names matching these patterns in the `hits.fields` property of the response.", "type": "array", "items": { - "oneOf": [ - { - "$ref": "#/components/schemas/_types.query_dsl:FieldAndFormat" - }, - { - "$ref": "#/components/schemas/_types:Field" - } - ] + "$ref": "#/components/schemas/_types.query_dsl:FieldAndFormat" } }, "suggest": { @@ -34082,9 +34068,6 @@ { "type": "boolean" }, - { - "$ref": "#/components/schemas/_types:Fields" - }, { "$ref": "#/components/schemas/_global.search._types:SourceFilter" } @@ -54996,14 +54979,7 @@ "description": "Array of wildcard (*) patterns. The request returns doc values for field\nnames matching these patterns in the hits.fields property of the response.", "type": "array", "items": { - "oneOf": [ - { - "$ref": "#/components/schemas/_types:Field" - }, - { - "$ref": "#/components/schemas/_types.query_dsl:FieldAndFormat" - } - ] + "$ref": "#/components/schemas/_types.query_dsl:FieldAndFormat" } }, "knn": { @@ -55084,14 +55060,7 @@ "description": "Array of wildcard (*) patterns. The request returns values for field names\nmatching these patterns in the hits.fields property of the response.", "type": "array", "items": { - "oneOf": [ - { - "$ref": "#/components/schemas/_types:Field" - }, - { - "$ref": "#/components/schemas/_types.query_dsl:FieldAndFormat" - } - ] + "$ref": "#/components/schemas/_types.query_dsl:FieldAndFormat" } }, "terminate_after": { diff --git a/output/schema/schema.json b/output/schema/schema.json index 2f282f1501..139e8ec5a9 100644 --- a/output/schema/schema.json +++ b/output/schema/schema.json @@ -26213,7 +26213,7 @@ } } ], - "specLocation": "_global/msearch/types.ts#L215-L218" + "specLocation": "_global/msearch/types.ts#L214-L217" }, { "generics": [ @@ -26263,7 +26263,7 @@ } } ], - "specLocation": "_global/msearch/types.ts#L205-L208" + "specLocation": "_global/msearch/types.ts#L204-L207" }, { "kind": "interface", @@ -26371,23 +26371,11 @@ "type": { "kind": "array_of", "value": { - "items": [ - { - "kind": "instance_of", - "type": { - "name": "Field", - "namespace": "_types" - } - }, - { - "kind": "instance_of", - "type": { - "name": "FieldAndFormat", - "namespace": "_types.query_dsl" - } - } - ], - "kind": "union_of" + "kind": "instance_of", + "type": { + "name": "FieldAndFormat", + "namespace": "_types.query_dsl" + } } } }, @@ -26614,23 +26602,11 @@ "type": { "kind": "array_of", "value": { - "items": [ - { - "kind": "instance_of", - "type": { - "name": "Field", - "namespace": "_types" - } - }, - { - "kind": "instance_of", - "type": { - "name": "FieldAndFormat", - "namespace": "_types.query_dsl" - } - } - ], - "kind": "union_of" + "kind": "instance_of", + "type": { + "name": "FieldAndFormat", + "namespace": "_types.query_dsl" + } } } }, @@ -26760,7 +26736,7 @@ } } ], - "specLocation": "_global/msearch/types.ts#L72-L203" + "specLocation": "_global/msearch/types.ts#L71-L202" }, { "description": "Contains parameters used to limit or change the subsequent search body request.", @@ -26892,7 +26868,7 @@ } } ], - "specLocation": "_global/msearch/types.ts#L54-L69" + "specLocation": "_global/msearch/types.ts#L53-L68" }, { "attachedBehaviors": [ @@ -27103,7 +27079,7 @@ "name": "RequestItem", "namespace": "_global.msearch" }, - "specLocation": "_global/msearch/types.ts#L49-L52", + "specLocation": "_global/msearch/types.ts#L48-L51", "type": { "items": [ { @@ -27173,7 +27149,7 @@ "name": "ResponseItem", "namespace": "_global.msearch" }, - "specLocation": "_global/msearch/types.ts#L210-L213", + "specLocation": "_global/msearch/types.ts#L209-L212", "type": { "items": [ { @@ -30700,23 +30676,11 @@ "type": { "kind": "array_of", "value": { - "items": [ - { - "kind": "instance_of", - "type": { - "name": "Field", - "namespace": "_types" - } - }, - { - "kind": "instance_of", - "type": { - "name": "FieldAndFormat", - "namespace": "_types.query_dsl" - } - } - ], - "kind": "union_of" + "kind": "instance_of", + "type": { + "name": "FieldAndFormat", + "namespace": "_types.query_dsl" + } } } }, @@ -30942,23 +30906,11 @@ "type": { "kind": "array_of", "value": { - "items": [ - { - "kind": "instance_of", - "type": { - "name": "FieldAndFormat", - "namespace": "_types.query_dsl" - } - }, - { - "kind": "instance_of", - "type": { - "name": "Field", - "namespace": "_types" - } - } - ], - "kind": "union_of" + "kind": "instance_of", + "type": { + "name": "FieldAndFormat", + "namespace": "_types.query_dsl" + } } } }, @@ -35827,7 +35779,6 @@ { "codegenNames": [ "fetch", - "fields", "filter" ], "description": "Defines how to fetch a source. Fetching can be disabled entirely, or the source can be filtered.", @@ -35846,13 +35797,6 @@ "namespace": "_builtins" } }, - { - "kind": "instance_of", - "type": { - "name": "Fields", - "namespace": "_types" - } - }, { "kind": "instance_of", "type": { diff --git a/output/typescript/types.ts b/output/typescript/types.ts index 3ad46c00a9..2efbfbc87b 100644 --- a/output/typescript/types.ts +++ b/output/typescript/types.ts @@ -728,7 +728,7 @@ export interface MsearchMultisearchBody { explain?: boolean ext?: Record stored_fields?: Fields - docvalue_fields?: (Field | QueryDslFieldAndFormat | Field)[] + docvalue_fields?: (QueryDslFieldAndFormat | Field)[] knn?: KnnQuery | KnnQuery[] from?: integer highlight?: SearchHighlight @@ -742,7 +742,7 @@ export interface MsearchMultisearchBody { size?: integer sort?: Sort _source?: SearchSourceConfig - fields?: (Field | QueryDslFieldAndFormat | Field)[] + fields?: (QueryDslFieldAndFormat | Field)[] terminate_after?: long stats?: string[] timeout?: string @@ -1194,7 +1194,7 @@ export interface SearchRequest extends RequestBase { highlight?: SearchHighlight track_total_hits?: SearchTrackHits indices_boost?: Record[] - docvalue_fields?: (Field | QueryDslFieldAndFormat | Field)[] + docvalue_fields?: (QueryDslFieldAndFormat | Field)[] knn?: KnnQuery | KnnQuery[] rank?: RankContainer min_score?: double @@ -1208,7 +1208,7 @@ export interface SearchRequest extends RequestBase { slice?: SlicedScroll sort?: Sort _source?: SearchSourceConfig - fields?: (QueryDslFieldAndFormat | Field | Field)[] + fields?: (QueryDslFieldAndFormat | Field)[] suggest?: SearchSuggester terminate_after?: long timeout?: string @@ -1632,7 +1632,7 @@ export interface SearchSmoothingModelContainer { stupid_backoff?: SearchStupidBackoffSmoothingModel } -export type SearchSourceConfig = boolean | Fields | SearchSourceFilter | Fields +export type SearchSourceConfig = boolean | SearchSourceFilter | Fields export type SearchSourceConfigParam = boolean | Fields diff --git a/specification/_global/msearch/types.ts b/specification/_global/msearch/types.ts index 47c382d1b9..46934beba4 100644 --- a/specification/_global/msearch/types.ts +++ b/specification/_global/msearch/types.ts @@ -23,7 +23,6 @@ import { Dictionary } from '@spec_utils/Dictionary' import { AggregationContainer } from '@_types/aggregations/AggregationContainer' import { ExpandWildcards, - Field, Fields, IndexName, Indices, @@ -97,7 +96,7 @@ export class MultisearchBody { * Array of wildcard (*) patterns. The request returns doc values for field * names matching these patterns in the hits.fields property of the response. */ - docvalue_fields?: Array + docvalue_fields?: FieldAndFormat[] /** * Defines the approximate kNN search to run. * @availability stack since=8.4.0 @@ -147,7 +146,7 @@ export class MultisearchBody { * Array of wildcard (*) patterns. The request returns values for field names * matching these patterns in the hits.fields property of the response. */ - fields?: Array + fields?: Array /** * Maximum number of documents to collect for each shard. If a query reaches this * limit, Elasticsearch terminates the query early. Elasticsearch collects documents diff --git a/specification/_global/search/SearchRequest.ts b/specification/_global/search/SearchRequest.ts index bdbf484422..2ef86e22a0 100644 --- a/specification/_global/search/SearchRequest.ts +++ b/specification/_global/search/SearchRequest.ts @@ -371,7 +371,7 @@ export interface Request extends RequestBase { * Array of wildcard (`*`) patterns. * The request returns doc values for field names matching these patterns in the `hits.fields` property of the response. */ - docvalue_fields?: Array + docvalue_fields?: FieldAndFormat[] /** * Defines the approximate kNN search to run. * @availability stack since=8.4.0 @@ -442,7 +442,7 @@ export interface Request extends RequestBase { * Array of wildcard (`*`) patterns. * The request returns values for field names matching these patterns in the `hits.fields` property of the response. */ - fields?: Array + fields?: Array /** * Defines a suggester that provides similar looking terms based on a provided text. */ diff --git a/specification/_global/search/_types/SourceFilter.ts b/specification/_global/search/_types/SourceFilter.ts index b2b2c05071..6b48c59f79 100644 --- a/specification/_global/search/_types/SourceFilter.ts +++ b/specification/_global/search/_types/SourceFilter.ts @@ -32,9 +32,9 @@ export class SourceFilter { /** * Defines how to fetch a source. Fetching can be disabled entirely, or the source can be filtered. - * @codegen_names fetch, fields, filter + * @codegen_names fetch, filter */ -export type SourceConfig = boolean | Fields | SourceFilter +export type SourceConfig = boolean | SourceFilter /** * Defines how to fetch a source. Fetching can be disabled entirely, or the source can be filtered.