Skip to content

Commit

Permalink
Auto-generated API code
Browse files Browse the repository at this point in the history
  • Loading branch information
elasticmachine committed May 9, 2024
1 parent aeda5cc commit 9f613f1
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 10 deletions.
7 changes: 3 additions & 4 deletions docs/reference.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -2814,19 +2813,19 @@ Executes an ESQL request
{ref}/esql-rest.html[Endpoint documentation]
[source,ts]
----
client.esql.query({ query, version })
client.esql.query({ query })
----

[discrete]
==== Arguments

* *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.

Expand Down Expand Up @@ -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<string, { type } | { boost, fielddata, index, null_value, type } | { type, enabled, null_value, boost, coerce, script, on_script_error, ignore_malformed, time_series_metric, analyzer, eager_global_ordinals, index, index_options, index_phrases, index_prefixes, norms, position_increment_gap, search_analyzer, search_quote_analyzer, term_vector, format, precision_step, locale } | { relations, eager_global_ordinals, type } | { boost, eager_global_ordinals, index, index_options, normalizer, norms, null_value, split_queries_on_whitespace, time_series_dimension, type } | { type, fields, meta, copy_to } | { type } | { positive_score_impact, type } | { positive_score_impact, type } | { analyzer, index, index_options, max_shingle_size, norms, search_analyzer, search_quote_analyzer, term_vector, type } | { analyzer, boost, eager_global_ordinals, fielddata, fielddata_frequency_filter, index, index_options, index_phrases, index_prefixes, norms, position_increment_gap, search_analyzer, search_quote_analyzer, term_vector, type } | { type } | { type, null_value } | { boost, format, ignore_malformed, index, null_value, precision_step, type } | { boost, fielddata, format, ignore_malformed, index, null_value, precision_step, locale, type } | { type, default_metric, metrics, time_series_metric } | { type, dims, similarity, index, index_options } | { type } | { boost, depth_limit, doc_values, eager_global_ordinals, index, index_options, null_value, similarity, split_queries_on_whitespace, type } | { enabled, include_in_parent, include_in_root, type } | { enabled, subobjects, type } | { analyzer, contexts, max_input_length, preserve_position_increments, preserve_separators, search_analyzer, type } | { value, type } | { path, type } | { ignore_malformed, type } | { boost, index, ignore_malformed, null_value, on_script_error, script, time_series_dimension, type } | { type } | { analyzer, boost, index, null_value, enable_position_increments, type } | { ignore_malformed, ignore_z_value, null_value, index, on_script_error, script, type } | { coerce, ignore_malformed, ignore_z_value, orientation, strategy, type } | { ignore_malformed, ignore_z_value, null_value, type } | { coerce, ignore_malformed, ignore_z_value, orientation, type } | { type, null_value } | { type, null_value } | { type, null_value } | { type, null_value } | { type, null_value } | { type, null_value } | { type, null_value, scaling_factor } | { type, null_value } | { type, null_value } | { format, type } | { type } | { type } | { type } | { type } | { type }>)*: Mapping for a field. For new fields, this mapping can include:
** *`properties` (Optional, Record<string, { type } | { boost, fielddata, index, null_value, type } | { type, enabled, null_value, boost, coerce, script, on_script_error, ignore_malformed, time_series_metric, analyzer, eager_global_ordinals, index, index_options, index_phrases, index_prefixes, norms, position_increment_gap, search_analyzer, search_quote_analyzer, term_vector, format, precision_step, locale } | { relations, eager_global_ordinals, type } | { boost, eager_global_ordinals, index, index_options, normalizer, norms, null_value, split_queries_on_whitespace, time_series_dimension, type } | { type, fields, meta, copy_to } | { type } | { positive_score_impact, type } | { positive_score_impact, type } | { analyzer, index, index_options, max_shingle_size, norms, search_analyzer, search_quote_analyzer, term_vector, type } | { analyzer, boost, eager_global_ordinals, fielddata, fielddata_frequency_filter, index, index_options, index_phrases, index_prefixes, norms, position_increment_gap, search_analyzer, search_quote_analyzer, term_vector, type } | { type } | { type, null_value } | { boost, format, ignore_malformed, index, null_value, precision_step, type } | { boost, fielddata, format, ignore_malformed, index, null_value, precision_step, locale, type } | { type, default_metric, metrics, time_series_metric } | { type, element_type, dims, similarity, index, index_options } | { type } | { boost, depth_limit, doc_values, eager_global_ordinals, index, index_options, null_value, similarity, split_queries_on_whitespace, type } | { enabled, include_in_parent, include_in_root, type } | { enabled, subobjects, type } | { analyzer, contexts, max_input_length, preserve_position_increments, preserve_separators, search_analyzer, type } | { value, type } | { path, type } | { ignore_malformed, type } | { boost, index, ignore_malformed, null_value, on_script_error, script, time_series_dimension, type } | { type } | { analyzer, boost, index, null_value, enable_position_increments, type } | { ignore_malformed, ignore_z_value, null_value, index, on_script_error, script, type } | { coerce, ignore_malformed, ignore_z_value, orientation, strategy, type } | { ignore_malformed, ignore_z_value, null_value, type } | { coerce, ignore_malformed, ignore_z_value, orientation, type } | { type, null_value } | { type, null_value } | { type, null_value } | { type, null_value } | { type, null_value } | { type, null_value } | { type, null_value, scaling_factor } | { type, null_value } | { type, null_value } | { format, type } | { type } | { type } | { type } | { type } | { type }>)*: Mapping for a field. For new fields, this mapping can include:

- Field name
- Field data type
Expand Down
6 changes: 6 additions & 0 deletions src/api/api/esql.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 ?? {}
Expand Down
8 changes: 5 additions & 3 deletions src/api/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -2787,6 +2787,7 @@ export interface AggregationsAdjacencyMatrixAggregate extends AggregationsMultiB

export interface AggregationsAdjacencyMatrixAggregation extends AggregationsBucketAggregationBase {
filters?: Record<string, QueryDslQueryContainer>
separator?: string
}

export interface AggregationsAdjacencyMatrixBucketKeys extends AggregationsMultiBucketBase {
Expand Down Expand Up @@ -4901,6 +4902,7 @@ export interface MappingDenseVectorIndexOptions {

export interface MappingDenseVectorProperty extends MappingPropertyBase {
type: 'dense_vector'
element_type?: string
dims?: integer
similarity?: string
index?: boolean
Expand Down Expand Up @@ -8584,7 +8586,6 @@ export interface ClusterPutComponentTemplateRequest extends RequestBase {
name: Name
create?: boolean
master_timeout?: Duration
cause?: string
template: IndicesIndexState
version?: VersionNumber
_meta?: Metadata
Expand Down Expand Up @@ -9662,7 +9663,7 @@ export interface EsqlQueryRequest extends RequestBase {
locale?: string
params?: ScalarValue[]
query: string
version: EsqlEsqlVersion
version?: EsqlEsqlVersion
}

export type EsqlQueryResponse = EsqlColumns
Expand Down Expand Up @@ -12186,6 +12187,7 @@ export interface IngestProcessorContainer {

export interface IngestRemoveProcessor extends IngestProcessorBase {
field: Fields
keep?: Fields
ignore_missing?: boolean
}

Expand Down
8 changes: 5 additions & 3 deletions src/api/typesWithBodyKey.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -2860,6 +2860,7 @@ export interface AggregationsAdjacencyMatrixAggregate extends AggregationsMultiB

export interface AggregationsAdjacencyMatrixAggregation extends AggregationsBucketAggregationBase {
filters?: Record<string, QueryDslQueryContainer>
separator?: string
}

export interface AggregationsAdjacencyMatrixBucketKeys extends AggregationsMultiBucketBase {
Expand Down Expand Up @@ -4974,6 +4975,7 @@ export interface MappingDenseVectorIndexOptions {

export interface MappingDenseVectorProperty extends MappingPropertyBase {
type: 'dense_vector'
element_type?: string
dims?: integer
similarity?: string
index?: boolean
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -9819,7 +9820,7 @@ export interface EsqlQueryRequest extends RequestBase {
locale?: string
params?: ScalarValue[]
query: string
version: EsqlEsqlVersion
version?: EsqlEsqlVersion
}
}

Expand Down Expand Up @@ -12411,6 +12412,7 @@ export interface IngestProcessorContainer {

export interface IngestRemoveProcessor extends IngestProcessorBase {
field: Fields
keep?: Fields
ignore_missing?: boolean
}

Expand Down

0 comments on commit 9f613f1

Please sign in to comment.