diff --git a/output/schema/schema.json b/output/schema/schema.json index 7c74a74733..09b4f3dc17 100644 --- a/output/schema/schema.json +++ b/output/schema/schema.json @@ -42065,7 +42065,7 @@ }, { "name": "_score", - "required": true, + "required": false, "type": { "kind": "union_of", "items": [ @@ -42409,7 +42409,7 @@ }, { "name": "max_score", - "required": true, + "required": false, "type": { "kind": "union_of", "items": [ diff --git a/output/typescript/types.ts b/output/typescript/types.ts index 0dc811c6f4..24ca7bb232 100644 --- a/output/typescript/types.ts +++ b/output/typescript/types.ts @@ -1480,7 +1480,7 @@ export type SearchHighlighterType = 'plain' | 'fvh' | 'unified'| string export interface SearchHit { _index: IndexName _id?: Id - _score: double | null + _score?: double | null _explanation?: ExplainExplanation fields?: Record highlight?: Record @@ -1503,7 +1503,7 @@ export interface SearchHit { export interface SearchHitsMetadata { total?: SearchTotalHits | long hits: SearchHit[] - max_score: double | null + max_score?: double | null } export interface SearchInnerHits { diff --git a/specification/_global/search/_types/hits.ts b/specification/_global/search/_types/hits.ts index 331244c7b2..17c7291618 100644 --- a/specification/_global/search/_types/hits.ts +++ b/specification/_global/search/_types/hits.ts @@ -44,7 +44,10 @@ export class Hit { * on a search request. Otherwise the field is always present on hits. */ _id?: Id - _score: double | null + // While _score is always returned by Elasticsearch, making it required + // breaks downstream JavaScript users for little added benefit + // See https://github.com/elastic/elasticsearch-specification/pull/5248 + _score?: double | null _explanation?: Explanation fields?: Dictionary highlight?: Dictionary @@ -69,7 +72,10 @@ export class HitsMetadata { total?: TotalHits | long hits: Hit[] - max_score: double | null + // While max_score is always returned by Elasticsearch, making it required + // breaks downstream JavaScript users for little added benefit + // See https://github.com/elastic/elasticsearch-specification/pull/5248 + max_score?: double | null } export class HitMetadata {