From 7b334ef8edf0f4452136c043fe7eb08cb2b5e701 Mon Sep 17 00:00:00 2001 From: Quentin Pradet Date: Tue, 7 Nov 2023 15:28:59 +0400 Subject: [PATCH] Revert "[7.17] Allow single fields in fields and _source parameters (#2332)" (#2340) This reverts commit dc674ea863d27db05ef82a9463d274934efd0d9a. --- output/schema/schema.json | 111 +++++------------- output/typescript/types.ts | 10 +- specification/_global/msearch/types.ts | 5 +- specification/_global/search/SearchRequest.ts | 7 +- .../_global/search/_types/SourceFilter.ts | 4 +- 5 files changed, 38 insertions(+), 99 deletions(-) diff --git a/output/schema/schema.json b/output/schema/schema.json index f490ef18fc..59bb69f964 100644 --- a/output/schema/schema.json +++ b/output/schema/schema.json @@ -18709,7 +18709,7 @@ } } ], - "specLocation": "_global/msearch/types.ts#L208-L211" + "specLocation": "_global/msearch/types.ts#L207-L210" }, { "generics": [ @@ -18759,7 +18759,7 @@ } } ], - "specLocation": "_global/msearch/types.ts#L198-L201" + "specLocation": "_global/msearch/types.ts#L197-L200" }, { "kind": "interface", @@ -18867,23 +18867,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" + } } } }, @@ -19075,23 +19063,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" + } } } }, @@ -19221,7 +19197,7 @@ } } ], - "specLocation": "_global/msearch/types.ts#L71-L196" + "specLocation": "_global/msearch/types.ts#L70-L195" }, { "description": "Contains parameters used to limit or change the subsequent search body request.", @@ -19353,7 +19329,7 @@ } } ], - "specLocation": "_global/msearch/types.ts#L53-L68" + "specLocation": "_global/msearch/types.ts#L52-L67" }, { "attachedBehaviors": [ @@ -19575,7 +19551,7 @@ "name": "RequestItem", "namespace": "_global.msearch" }, - "specLocation": "_global/msearch/types.ts#L48-L51", + "specLocation": "_global/msearch/types.ts#L47-L50", "type": { "items": [ { @@ -19645,7 +19621,7 @@ "name": "ResponseItem", "namespace": "_global.msearch" }, - "specLocation": "_global/msearch/types.ts#L203-L206", + "specLocation": "_global/msearch/types.ts#L202-L205", "type": { "items": [ { @@ -22974,23 +22950,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" + } } } }, @@ -23155,28 +23119,15 @@ "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" + } } } }, { - "description": "Defines a suggester that provides similar looking terms based on a provided text.", "name": "suggest", "required": false, "type": { @@ -23877,7 +23828,7 @@ } } ], - "specLocation": "_global/search/SearchRequest.ts#L51-L243" + "specLocation": "_global/search/SearchRequest.ts#L51-L240" }, { "body": { @@ -27833,7 +27784,6 @@ { "codegenNames": [ "fetch", - "fields", "filter" ], "description": "Defines how to fetch a source. Fetching can be disabled entirely, or the source can be filtered.", @@ -27852,13 +27802,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 d8773b239d..c352776067 100644 --- a/output/typescript/types.ts +++ b/output/typescript/types.ts @@ -553,7 +553,7 @@ export interface MsearchMultisearchBody { explain?: boolean ext?: Record stored_fields?: Fields - docvalue_fields?: (Field | QueryDslFieldAndFormat | Field)[] + docvalue_fields?: (QueryDslFieldAndFormat | Field)[] from?: integer highlight?: SearchHighlight indices_boost?: Record[] @@ -566,7 +566,7 @@ export interface MsearchMultisearchBody { size?: integer sort?: Sort _source?: SearchSourceConfig - fields?: (Field | QueryDslFieldAndFormat | Field)[] + fields?: (QueryDslFieldAndFormat | Field)[] terminate_after?: long stats?: string[] timeout?: string @@ -1018,7 +1018,7 @@ export interface SearchRequest extends RequestBase { highlight?: SearchHighlight track_total_hits?: SearchTrackHits indices_boost?: Record[] - docvalue_fields?: (Field | QueryDslFieldAndFormat | Field)[] + docvalue_fields?: (QueryDslFieldAndFormat | Field)[] min_score?: double post_filter?: QueryDslQueryContainer profile?: boolean @@ -1030,7 +1030,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 @@ -1455,7 +1455,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 41f2c4f556..fe3bce08cf 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, @@ -96,7 +95,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[] /** * Starting document offset. By default, you cannot page through more than 10,000 * hits using the from and size parameters. To page through more hits, use the @@ -140,7 +139,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 bcabb28327..428d92bdba 100644 --- a/specification/_global/search/SearchRequest.ts +++ b/specification/_global/search/SearchRequest.ts @@ -146,7 +146,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[] /** * Minimum _score for matching documents. Documents with a lower _score are * not included in the search results. @@ -183,10 +183,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 - /** - * Defines a suggester that provides similar looking terms based on a provided text. - */ + fields?: Array suggest?: Suggester /** * Maximum number of documents to collect for each shard. If a query reaches this 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.