From 6180ad4e9ebe0d2a2e191f41f89266b1c56794bf Mon Sep 17 00:00:00 2001 From: Quentin Pradet Date: Wed, 10 Jul 2024 17:11:31 +0400 Subject: [PATCH] Fix most esql.query request types (#2671) --- output/openapi/elasticsearch-openapi.json | 15 +++++++++- .../elasticsearch-serverless-openapi.json | 15 +++++++++- output/schema/schema-serverless.json | 28 +++++++++++++++++-- output/schema/schema.json | 28 +++++++++++++++++-- output/schema/validation-errors.json | 4 +-- output/typescript/types.ts | 4 ++- specification/_doc_ids/table.csv | 1 + specification/esql/query/QueryRequest.ts | 15 ++++++++-- 8 files changed, 98 insertions(+), 12 deletions(-) diff --git a/output/openapi/elasticsearch-openapi.json b/output/openapi/elasticsearch-openapi.json index 66495ab241..36528ee2ed 100644 --- a/output/openapi/elasticsearch-openapi.json +++ b/output/openapi/elasticsearch-openapi.json @@ -8018,6 +8018,16 @@ "type": "string" }, "style": "form" + }, + { + "in": "query", + "name": "drop_null_columns", + "description": "Should columns that are entirely `null` be removed from the `columns` and `values` portion of the results?\nDefaults to `false`. If `true` then the response will include an extra section under the name `all_columns` which has the name of all columns.", + "deprecated": false, + "schema": { + "type": "boolean" + }, + "style": "form" } ], "requestBody": { @@ -8043,9 +8053,12 @@ "description": "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.", "type": "array", "items": { - "$ref": "#/components/schemas/_types:ScalarValue" + "$ref": "#/components/schemas/_types:FieldValue" } }, + "profile": { + "type": "boolean" + }, "query": { "description": "The ES|QL query API accepts an ES|QL query string in the query parameter, runs it, and returns the results.", "type": "string" diff --git a/output/openapi/elasticsearch-serverless-openapi.json b/output/openapi/elasticsearch-serverless-openapi.json index 82c035668b..a13f7881b5 100644 --- a/output/openapi/elasticsearch-serverless-openapi.json +++ b/output/openapi/elasticsearch-serverless-openapi.json @@ -5340,6 +5340,16 @@ "type": "string" }, "style": "form" + }, + { + "in": "query", + "name": "drop_null_columns", + "description": "Should columns that are entirely `null` be removed from the `columns` and `values` portion of the results?\nDefaults to `false`. If `true` then the response will include an extra section under the name `all_columns` which has the name of all columns.", + "deprecated": false, + "schema": { + "type": "boolean" + }, + "style": "form" } ], "requestBody": { @@ -5365,9 +5375,12 @@ "description": "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.", "type": "array", "items": { - "$ref": "#/components/schemas/_types:ScalarValue" + "$ref": "#/components/schemas/_types:FieldValue" } }, + "profile": { + "type": "boolean" + }, "query": { "description": "The ES|QL query API accepts an ES|QL query string in the query parameter, runs it, and returns the results.", "type": "string" diff --git a/output/schema/schema-serverless.json b/output/schema/schema-serverless.json index fda40b4110..6a0af2891a 100644 --- a/output/schema/schema-serverless.json +++ b/output/schema/schema-serverless.json @@ -17839,12 +17839,23 @@ "value": { "kind": "instance_of", "type": { - "name": "ScalarValue", + "name": "FieldValue", "namespace": "_types" } } } }, + { + "name": "profile", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "boolean", + "namespace": "_builtins" + } + } + }, { "description": "The ES|QL query API accepts an ES|QL query string in the query parameter, runs it, and returns the results.", "name": "query", @@ -17896,9 +17907,22 @@ "namespace": "_builtins" } } + }, + { + "description": "Should columns that are entirely `null` be removed from the `columns` and `values` portion of the results?\nDefaults to `false`. If `true` then the response will include an extra section under the name `all_columns` which has the name of all columns.", + "name": "drop_null_columns", + "required": false, + "serverDefault": false, + "type": { + "kind": "instance_of", + "type": { + "name": "boolean", + "namespace": "_builtins" + } + } } ], - "specLocation": "esql/query/QueryRequest.ts#L24-L65" + "specLocation": "esql/query/QueryRequest.ts#L24-L76" }, { "body": { diff --git a/output/schema/schema.json b/output/schema/schema.json index d52959ca76..eecd35babf 100644 --- a/output/schema/schema.json +++ b/output/schema/schema.json @@ -112739,12 +112739,23 @@ "value": { "kind": "instance_of", "type": { - "name": "ScalarValue", + "name": "FieldValue", "namespace": "_types" } } } }, + { + "name": "profile", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "boolean", + "namespace": "_builtins" + } + } + }, { "description": "The ES|QL query API accepts an ES|QL query string in the query parameter, runs it, and returns the results.", "name": "query", @@ -112796,9 +112807,22 @@ "namespace": "_builtins" } } + }, + { + "description": "Should columns that are entirely `null` be removed from the `columns` and `values` portion of the results?\nDefaults to `false`. If `true` then the response will include an extra section under the name `all_columns` which has the name of all columns.", + "name": "drop_null_columns", + "required": false, + "serverDefault": false, + "type": { + "kind": "instance_of", + "type": { + "name": "boolean", + "namespace": "_builtins" + } + } } ], - "specLocation": "esql/query/QueryRequest.ts#L24-L65" + "specLocation": "esql/query/QueryRequest.ts#L24-L76" }, { "body": { diff --git a/output/schema/validation-errors.json b/output/schema/validation-errors.json index c38a3e01af..8e534b8888 100644 --- a/output/schema/validation-errors.json +++ b/output/schema/validation-errors.json @@ -652,9 +652,7 @@ "response": [] }, "esql.query": { - "request": [ - "Request: missing json spec query parameter 'drop_null_columns'" - ], + "request": [], "response": [ "type_alias definition _types:EsqlColumns / instance_of - No type definition for '_builtins:binary'" ] diff --git a/output/typescript/types.ts b/output/typescript/types.ts index 33a4181a7d..db98c6d11a 100644 --- a/output/typescript/types.ts +++ b/output/typescript/types.ts @@ -9886,11 +9886,13 @@ export type EqlSearchResultPosition = 'tail' | 'head' export interface EsqlQueryRequest extends RequestBase { format?: string delimiter?: string + drop_null_columns?: boolean body?: { columnar?: boolean filter?: QueryDslQueryContainer locale?: string - params?: ScalarValue[] + params?: FieldValue[] + profile?: boolean query: string } } diff --git a/specification/_doc_ids/table.csv b/specification/_doc_ids/table.csv index def9c4b73f..63879dec52 100644 --- a/specification/_doc_ids/table.csv +++ b/specification/_doc_ids/table.csv @@ -148,6 +148,7 @@ eql-syntax,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/eql- eql,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/eql.html esql-query,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/esql-rest.html esql-query-params,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/esql-rest.html#esql-rest-params +esql-returning-localized-results,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/esql-rest.html#esql-locale-param evaluate-dfanalytics,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/evaluate-dfanalytics.html execute-enrich-policy-api,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/execute-enrich-policy-api.html expected-reciprocal,https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/search-rank-eval.html#_expected_reciprocal_rank_err diff --git a/specification/esql/query/QueryRequest.ts b/specification/esql/query/QueryRequest.ts index fe4e8d2308..a9eae673b6 100644 --- a/specification/esql/query/QueryRequest.ts +++ b/specification/esql/query/QueryRequest.ts @@ -19,7 +19,7 @@ import { RequestBase } from '@_types/Base' import { QueryContainer } from '@_types/query_dsl/abstractions' -import { ScalarValue } from '@_types/common' +import { FieldValue } from '@_types/common' /** * Executes an ES|QL request @@ -38,6 +38,12 @@ export interface Request extends RequestBase { * The character to use between values within a CSV row. Only valid for the CSV format. */ delimiter?: string + /** + * Should columns that are entirely `null` be removed from the `columns` and `values` portion of the results? + * Defaults to `false`. If `true` then the response will include an extra section under the name `all_columns` which has the name of all columns. + * @server_default false + */ + drop_null_columns?: boolean } /** * Use the `query` element to start a query. Use `time_zone` to specify an execution time zone and `columnar` to format the answer. @@ -51,12 +57,17 @@ export interface Request extends RequestBase { * Specify a Query DSL query in the filter parameter to filter the set of documents that an ES|QL query runs on. */ filter?: QueryContainer + /* + * Returns results (especially dates) formatted per the conventions of the locale. + * @doc_id esql-returning-localized-results + */ locale?: string /** * 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. * @doc_id esql-query-params */ - params?: Array + params?: Array + profile?: boolean /** * The ES|QL query API accepts an ES|QL query string in the query parameter, runs it, and returns the results. */