From 24fa9398d7e5592c341f2e183aeca71760f372ae Mon Sep 17 00:00:00 2001 From: Elastic Machine Date: Thu, 23 May 2024 16:36:24 +0100 Subject: [PATCH] fix: ES|QL queries no longer require a version (#64) Auto-generated API code --- docs/reference.asciidoc | 1 - src/api/api/esql.ts | 8 +------- src/api/types.ts | 9 +-------- src/api/typesWithBodyKey.ts | 9 +-------- 4 files changed, 3 insertions(+), 24 deletions(-) diff --git a/docs/reference.asciidoc b/docs/reference.asciidoc index ca28d96..15c5858 100644 --- a/docs/reference.asciidoc +++ b/docs/reference.asciidoc @@ -1874,7 +1874,6 @@ client.esql.query({ query }) ** *`filter` (Optional, { bool, boosting, common, constant_score, dis_max, distance_feature, exists, function_score, fuzzy, geo_bounding_box, geo_distance, geo_polygon, geo_shape, has_child, has_parent, ids, intervals, knn, match, match_all, match_bool_prefix, match_none, match_phrase, match_phrase_prefix, more_like_this, multi_match, nested, parent_id, percolate, pinned, prefix, query_string, range, rank_feature, regexp, rule_query, script, script_score, shape, simple_query_string, span_containing, field_masking_span, span_first, span_multi, span_near, span_not, span_or, span_term, span_within, term, terms, terms_set, wildcard, wrapper, type })*: Specify a Query DSL query in the filter parameter to filter the set of documents that an ES|QL query runs on. ** *`locale` (Optional, string)* ** *`params` (Optional, number | number | string | boolean | null[])*: To avoid any attempts of hacking or code injection, extract the values in a separate list of parameters. Use question mark placeholders (?) in the query string for each of the parameters. -** *`version` (Optional, Enum("2024.04.01"))*: The version of the ES|QL language in which the "query" field was written. ** *`format` (Optional, string)*: A short version of the Accept header, e.g. json, yaml. ** *`delimiter` (Optional, string)*: The character to use between values within a CSV row. Only valid for the CSV format. diff --git a/src/api/api/esql.ts b/src/api/api/esql.ts index a4029c1..4d211a1 100644 --- a/src/api/api/esql.ts +++ b/src/api/api/esql.ts @@ -52,7 +52,7 @@ export default class Esql { async query (this: That, params: T.EsqlQueryRequest | TB.EsqlQueryRequest, options?: TransportRequestOptions): Promise async query (this: That, params: T.EsqlQueryRequest | TB.EsqlQueryRequest, options?: TransportRequestOptions): Promise { const acceptedPath: string[] = [] - const acceptedBody: string[] = ['columnar', 'filter', 'locale', 'params', 'query', 'version'] + const acceptedBody: string[] = ['columnar', 'filter', 'locale', 'params', 'query'] const querystring: Record = {} // @ts-expect-error const userBody: any = params?.body @@ -63,12 +63,6 @@ export default class Esql { body = userBody != null ? { ...userBody } : undefined } - // a version number is required for all ES|QL queries. - // inject a default value if none is provided. - if (typeof body === 'object' && body.version == null) { - body.version = '2024.04.01' - } - for (const key in params) { if (acceptedBody.includes(key)) { body = body ?? {} diff --git a/src/api/types.ts b/src/api/types.ts index 6483c16..3afcc08 100644 --- a/src/api/types.ts +++ b/src/api/types.ts @@ -9646,12 +9646,6 @@ export type EqlSearchResponse = EqlEqlSearchResponseBase diff --git a/src/api/typesWithBodyKey.ts b/src/api/typesWithBodyKey.ts index a887731..adb5a73 100644 --- a/src/api/typesWithBodyKey.ts +++ b/src/api/typesWithBodyKey.ts @@ -9801,12 +9801,6 @@ export type EqlSearchResponse = EqlEqlSearchResponseBase