Skip to content

Commit 9f40be8

Browse files
authored
Allow single fields in fields and _source parameters (#2317)
1 parent 2d07ba2 commit 9f40be8

File tree

6 files changed

+129
-41
lines changed

6 files changed

+129
-41
lines changed

output/openapi/elasticsearch-serverless-openapi.json

Lines changed: 35 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26307,7 +26307,14 @@
2630726307
"description": "Array of wildcard (`*`) patterns.\nThe request returns doc values for field names matching these patterns in the `hits.fields` property of the response.",
2630826308
"type": "array",
2630926309
"items": {
26310-
"$ref": "#/components/schemas/_types.query_dsl:FieldAndFormat"
26310+
"oneOf": [
26311+
{
26312+
"$ref": "#/components/schemas/_types:Field"
26313+
},
26314+
{
26315+
"$ref": "#/components/schemas/_types.query_dsl:FieldAndFormat"
26316+
}
26317+
]
2631126318
}
2631226319
},
2631326320
"knn": {
@@ -26382,7 +26389,14 @@
2638226389
"description": "Array of wildcard (`*`) patterns.\nThe request returns values for field names matching these patterns in the `hits.fields` property of the response.",
2638326390
"type": "array",
2638426391
"items": {
26385-
"$ref": "#/components/schemas/_types.query_dsl:FieldAndFormat"
26392+
"oneOf": [
26393+
{
26394+
"$ref": "#/components/schemas/_types.query_dsl:FieldAndFormat"
26395+
},
26396+
{
26397+
"$ref": "#/components/schemas/_types:Field"
26398+
}
26399+
]
2638626400
}
2638726401
},
2638826402
"suggest": {
@@ -34068,6 +34082,9 @@
3406834082
{
3406934083
"type": "boolean"
3407034084
},
34085+
{
34086+
"$ref": "#/components/schemas/_types:Fields"
34087+
},
3407134088
{
3407234089
"$ref": "#/components/schemas/_global.search._types:SourceFilter"
3407334090
}
@@ -54979,7 +54996,14 @@
5497954996
"description": "Array of wildcard (*) patterns. The request returns doc values for field\nnames matching these patterns in the hits.fields property of the response.",
5498054997
"type": "array",
5498154998
"items": {
54982-
"$ref": "#/components/schemas/_types.query_dsl:FieldAndFormat"
54999+
"oneOf": [
55000+
{
55001+
"$ref": "#/components/schemas/_types:Field"
55002+
},
55003+
{
55004+
"$ref": "#/components/schemas/_types.query_dsl:FieldAndFormat"
55005+
}
55006+
]
5498355007
}
5498455008
},
5498555009
"knn": {
@@ -55060,7 +55084,14 @@
5506055084
"description": "Array of wildcard (*) patterns. The request returns values for field names\nmatching these patterns in the hits.fields property of the response.",
5506155085
"type": "array",
5506255086
"items": {
55063-
"$ref": "#/components/schemas/_types.query_dsl:FieldAndFormat"
55087+
"oneOf": [
55088+
{
55089+
"$ref": "#/components/schemas/_types:Field"
55090+
},
55091+
{
55092+
"$ref": "#/components/schemas/_types.query_dsl:FieldAndFormat"
55093+
}
55094+
]
5506455095
}
5506555096
},
5506655097
"terminate_after": {

output/schema/schema.json

Lines changed: 82 additions & 26 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

output/typescript/types.ts

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

specification/_global/msearch/types.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import { Dictionary } from '@spec_utils/Dictionary'
2323
import { AggregationContainer } from '@_types/aggregations/AggregationContainer'
2424
import {
2525
ExpandWildcards,
26+
Field,
2627
Fields,
2728
IndexName,
2829
Indices,
@@ -96,7 +97,7 @@ export class MultisearchBody {
9697
* Array of wildcard (*) patterns. The request returns doc values for field
9798
* names matching these patterns in the hits.fields property of the response.
9899
*/
99-
docvalue_fields?: FieldAndFormat[]
100+
docvalue_fields?: Array<Field | FieldAndFormat>
100101
/**
101102
* Defines the approximate kNN search to run.
102103
* @availability stack since=8.4.0
@@ -146,7 +147,7 @@ export class MultisearchBody {
146147
* Array of wildcard (*) patterns. The request returns values for field names
147148
* matching these patterns in the hits.fields property of the response.
148149
*/
149-
fields?: Array<FieldAndFormat>
150+
fields?: Array<Field | FieldAndFormat>
150151
/**
151152
* Maximum number of documents to collect for each shard. If a query reaches this
152153
* limit, Elasticsearch terminates the query early. Elasticsearch collects documents

specification/_global/search/SearchRequest.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -371,7 +371,7 @@ export interface Request extends RequestBase {
371371
* Array of wildcard (`*`) patterns.
372372
* The request returns doc values for field names matching these patterns in the `hits.fields` property of the response.
373373
*/
374-
docvalue_fields?: FieldAndFormat[]
374+
docvalue_fields?: Array<Field | FieldAndFormat>
375375
/**
376376
* Defines the approximate kNN search to run.
377377
* @availability stack since=8.4.0
@@ -442,7 +442,7 @@ export interface Request extends RequestBase {
442442
* Array of wildcard (`*`) patterns.
443443
* The request returns values for field names matching these patterns in the `hits.fields` property of the response.
444444
*/
445-
fields?: Array<FieldAndFormat>
445+
fields?: Array<FieldAndFormat | Field>
446446
/**
447447
* Defines a suggester that provides similar looking terms based on a provided text.
448448
*/

specification/_global/search/_types/SourceFilter.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,9 @@ export class SourceFilter {
3232

3333
/**
3434
* Defines how to fetch a source. Fetching can be disabled entirely, or the source can be filtered.
35-
* @codegen_names fetch, filter
35+
* @codegen_names fetch, fields, filter
3636
*/
37-
export type SourceConfig = boolean | SourceFilter
37+
export type SourceConfig = boolean | Fields | SourceFilter
3838

3939
/**
4040
* Defines how to fetch a source. Fetching can be disabled entirely, or the source can be filtered.

0 commit comments

Comments
 (0)