Skip to content

Commit 24fa939

Browse files
fix: ES|QL queries no longer require a version (#64)
Auto-generated API code
1 parent 6ce1ff1 commit 24fa939

File tree

4 files changed

+3
-24
lines changed

4 files changed

+3
-24
lines changed

docs/reference.asciidoc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1874,7 +1874,6 @@ client.esql.query({ query })
18741874
** *`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.
18751875
** *`locale` (Optional, string)*
18761876
** *`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.
1877-
** *`version` (Optional, Enum("2024.04.01"))*: The version of the ES|QL language in which the "query" field was written.
18781877
** *`format` (Optional, string)*: A short version of the Accept header, e.g. json, yaml.
18791878
** *`delimiter` (Optional, string)*: The character to use between values within a CSV row. Only valid for the CSV format.
18801879

src/api/api/esql.ts

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ export default class Esql {
5252
async query (this: That, params: T.EsqlQueryRequest | TB.EsqlQueryRequest, options?: TransportRequestOptions): Promise<T.EsqlQueryResponse>
5353
async query (this: That, params: T.EsqlQueryRequest | TB.EsqlQueryRequest, options?: TransportRequestOptions): Promise<any> {
5454
const acceptedPath: string[] = []
55-
const acceptedBody: string[] = ['columnar', 'filter', 'locale', 'params', 'query', 'version']
55+
const acceptedBody: string[] = ['columnar', 'filter', 'locale', 'params', 'query']
5656
const querystring: Record<string, any> = {}
5757
// @ts-expect-error
5858
const userBody: any = params?.body
@@ -63,12 +63,6 @@ export default class Esql {
6363
body = userBody != null ? { ...userBody } : undefined
6464
}
6565

66-
// a version number is required for all ES|QL queries.
67-
// inject a default value if none is provided.
68-
if (typeof body === 'object' && body.version == null) {
69-
body.version = '2024.04.01'
70-
}
71-
7266
for (const key in params) {
7367
if (acceptedBody.includes(key)) {
7468
body = body ?? {}

src/api/types.ts

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9646,12 +9646,6 @@ export type EqlSearchResponse<TEvent = unknown> = EqlEqlSearchResponseBase<TEven
96469646

96479647
export type EqlSearchResultPosition = 'tail' | 'head'
96489648

9649-
export type EsqlBaseServerlessEsqlVersion = '2024.04.01'
9650-
9651-
export type EsqlBaseStatefulEsqlVersion = '2024.04.01'
9652-
9653-
export type EsqlEsqlVersion = '2024.04.01'
9654-
96559649
export interface EsqlQueryRequest extends RequestBase {
96569650
format?: string
96579651
delimiter?: string
@@ -9660,7 +9654,6 @@ export interface EsqlQueryRequest extends RequestBase {
96609654
locale?: string
96619655
params?: ScalarValue[]
96629656
query: string
9663-
version?: EsqlEsqlVersion
96649657
}
96659658

96669659
export type EsqlQueryResponse = EsqlColumns
@@ -10502,7 +10495,7 @@ export interface IndicesStorage {
1050210495
allow_mmap?: boolean
1050310496
}
1050410497

10505-
export type IndicesStorageType = 'fs' | '' | 'niofs' | 'mmapfs' | 'hybridfs' | string
10498+
export type IndicesStorageType = 'fs' | 'niofs' | 'mmapfs' | 'hybridfs' | string
1050610499

1050710500
export interface IndicesTemplateMapping {
1050810501
aliases: Record<IndexName, IndicesAlias>

src/api/typesWithBodyKey.ts

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9801,12 +9801,6 @@ export type EqlSearchResponse<TEvent = unknown> = EqlEqlSearchResponseBase<TEven
98019801

98029802
export type EqlSearchResultPosition = 'tail' | 'head'
98039803

9804-
export type EsqlBaseServerlessEsqlVersion = '2024.04.01'
9805-
9806-
export type EsqlBaseStatefulEsqlVersion = '2024.04.01'
9807-
9808-
export type EsqlEsqlVersion = '2024.04.01'
9809-
98109804
export interface EsqlQueryRequest extends RequestBase {
98119805
format?: string
98129806
delimiter?: string
@@ -9817,7 +9811,6 @@ export interface EsqlQueryRequest extends RequestBase {
98179811
locale?: string
98189812
params?: ScalarValue[]
98199813
query: string
9820-
version?: EsqlEsqlVersion
98219814
}
98229815
}
98239816

@@ -10676,7 +10669,7 @@ export interface IndicesStorage {
1067610669
allow_mmap?: boolean
1067710670
}
1067810671

10679-
export type IndicesStorageType = 'fs' | '' | 'niofs' | 'mmapfs' | 'hybridfs' | string
10672+
export type IndicesStorageType = 'fs' | 'niofs' | 'mmapfs' | 'hybridfs' | string
1068010673

1068110674
export interface IndicesTemplateMapping {
1068210675
aliases: Record<IndexName, IndicesAlias>

0 commit comments

Comments
 (0)