diff --git a/docs/reference.asciidoc b/docs/reference.asciidoc index cf81b5988..174a46c4b 100644 --- a/docs/reference.asciidoc +++ b/docs/reference.asciidoc @@ -2483,7 +2483,6 @@ that uses deprecated components, Elasticsearch will emit a deprecation warning. ** *`create` (Optional, boolean)*: If `true`, this request cannot replace or update existing component templates. ** *`master_timeout` (Optional, string | -1 | 0)*: Period to wait for a connection to the master node. If no response is received before the timeout expires, the request fails and returns an error. -** *`cause` (Optional, string)* [discrete] ==== put_settings @@ -2814,7 +2813,7 @@ Executes an ESQL request {ref}/esql-rest.html[Endpoint documentation] [source,ts] ---- -client.esql.query({ query, version }) +client.esql.query({ query }) ---- [discrete] @@ -2822,11 +2821,11 @@ client.esql.query({ query, version }) * *Request (object):* ** *`query` (string)*: The ES|QL query API accepts an ES|QL query string in the query parameter, runs it, and returns the results. -** *`version` (Enum("2024.04.01"))*: The version of the ES|QL language in which the "query" field was written. ** *`columnar` (Optional, boolean)*: By default, ES|QL returns results as rows. For example, FROM returns each individual document as one row. For the JSON, YAML, CBOR and smile formats, ES|QL can return the results in a columnar fashion where one row represents all the values of a certain column in the results. ** *`filter` (Optional, { bool, boosting, common, combined_fields, 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, text_expansion, weighted_tokens, 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. @@ -4253,7 +4252,7 @@ a new date field is added instead of string. not used at all by Elasticsearch, but can be used to store application-specific metadata. ** *`numeric_detection` (Optional, boolean)*: Automatically map strings into numeric data types for all fields. -** *`properties` (Optional, Record)*: Mapping for a field. For new fields, this mapping can include: +** *`properties` (Optional, Record)*: Mapping for a field. For new fields, this mapping can include: - Field name - Field data type diff --git a/src/api/api/esql.ts b/src/api/api/esql.ts index 62a4925b8..fa6af3b3d 100644 --- a/src/api/api/esql.ts +++ b/src/api/api/esql.ts @@ -63,6 +63,12 @@ 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 897ce242a..727cf64e0 100644 --- a/src/api/types.ts +++ b/src/api/types.ts @@ -2760,7 +2760,7 @@ export interface WriteResponseBase { _index: IndexName _primary_term?: long result: Result - _seq_no: SequenceNumber + _seq_no?: SequenceNumber _shards: ShardStatistics _version: VersionNumber forced_refresh?: boolean @@ -2787,6 +2787,7 @@ export interface AggregationsAdjacencyMatrixAggregate extends AggregationsMultiB export interface AggregationsAdjacencyMatrixAggregation extends AggregationsBucketAggregationBase { filters?: Record + separator?: string } export interface AggregationsAdjacencyMatrixBucketKeys extends AggregationsMultiBucketBase { @@ -4901,6 +4902,7 @@ export interface MappingDenseVectorIndexOptions { export interface MappingDenseVectorProperty extends MappingPropertyBase { type: 'dense_vector' + element_type?: string dims?: integer similarity?: string index?: boolean @@ -8584,7 +8586,6 @@ export interface ClusterPutComponentTemplateRequest extends RequestBase { name: Name create?: boolean master_timeout?: Duration - cause?: string template: IndicesIndexState version?: VersionNumber _meta?: Metadata @@ -9662,7 +9663,7 @@ export interface EsqlQueryRequest extends RequestBase { locale?: string params?: ScalarValue[] query: string - version: EsqlEsqlVersion + version?: EsqlEsqlVersion } export type EsqlQueryResponse = EsqlColumns @@ -12186,6 +12187,7 @@ export interface IngestProcessorContainer { export interface IngestRemoveProcessor extends IngestProcessorBase { field: Fields + keep?: Fields ignore_missing?: boolean } diff --git a/src/api/typesWithBodyKey.ts b/src/api/typesWithBodyKey.ts index 46603df9a..d81f07d6b 100644 --- a/src/api/typesWithBodyKey.ts +++ b/src/api/typesWithBodyKey.ts @@ -2833,7 +2833,7 @@ export interface WriteResponseBase { _index: IndexName _primary_term?: long result: Result - _seq_no: SequenceNumber + _seq_no?: SequenceNumber _shards: ShardStatistics _version: VersionNumber forced_refresh?: boolean @@ -2860,6 +2860,7 @@ export interface AggregationsAdjacencyMatrixAggregate extends AggregationsMultiB export interface AggregationsAdjacencyMatrixAggregation extends AggregationsBucketAggregationBase { filters?: Record + separator?: string } export interface AggregationsAdjacencyMatrixBucketKeys extends AggregationsMultiBucketBase { @@ -4974,6 +4975,7 @@ export interface MappingDenseVectorIndexOptions { export interface MappingDenseVectorProperty extends MappingPropertyBase { type: 'dense_vector' + element_type?: string dims?: integer similarity?: string index?: boolean @@ -8676,7 +8678,6 @@ export interface ClusterPutComponentTemplateRequest extends RequestBase { name: Name create?: boolean master_timeout?: Duration - cause?: string /** @deprecated The use of the 'body' key has been deprecated, move the nested keys to the top level object. */ body?: { template: IndicesIndexState @@ -9819,7 +9820,7 @@ export interface EsqlQueryRequest extends RequestBase { locale?: string params?: ScalarValue[] query: string - version: EsqlEsqlVersion + version?: EsqlEsqlVersion } } @@ -12411,6 +12412,7 @@ export interface IngestProcessorContainer { export interface IngestRemoveProcessor extends IngestProcessorBase { field: Fields + keep?: Fields ignore_missing?: boolean }