From e2d5c739455d722cb02430388f45c2770f3b754a Mon Sep 17 00:00:00 2001 From: Quentin Pradet Date: Tue, 26 Nov 2024 21:43:20 +0400 Subject: [PATCH] Fix watcher.put_watcher API --- output/openapi/elasticsearch-openapi.json | 16 +++-- output/schema/schema-serverless.json | 8 +-- output/schema/schema.json | 71 ++++++++++++++++++----- output/typescript/types.ts | 5 +- specification/watcher/_types/Input.ts | 16 ++++- 5 files changed, 89 insertions(+), 27 deletions(-) diff --git a/output/openapi/elasticsearch-openapi.json b/output/openapi/elasticsearch-openapi.json index 4f7aa86093..883b8e895f 100644 --- a/output/openapi/elasticsearch-openapi.json +++ b/output/openapi/elasticsearch-openapi.json @@ -86008,11 +86008,19 @@ "properties": { "query": { "$ref": "#/components/schemas/_types.query_dsl:QueryContainer" + }, + "aggregations": { + "description": "Defines the aggregations that are run as part of the search request.", + "type": "object", + "additionalProperties": { + "$ref": "#/components/schemas/_types.aggregations:AggregationContainer" + } + }, + "size": { + "description": "The number of hits to return.\nBy default, you cannot page through more than 10,000 hits using the `from` and `size` parameters.\nTo page through more hits, use the `search_after` parameter.", + "type": "number" } - }, - "required": [ - "query" - ] + } }, "watcher._types:SearchTemplateRequestBody": { "type": "object", diff --git a/output/schema/schema-serverless.json b/output/schema/schema-serverless.json index eb557fa737..7a3df8d87f 100644 --- a/output/schema/schema-serverless.json +++ b/output/schema/schema-serverless.json @@ -105125,7 +105125,7 @@ "name": "ConnectionScheme", "namespace": "watcher._types" }, - "specLocation": "watcher/_types/Input.ts#L39-L42" + "specLocation": "watcher/_types/Input.ts#L40-L43" }, { "docId": "cron-expressions", @@ -105307,7 +105307,7 @@ "name": "HttpInputMethod", "namespace": "watcher._types" }, - "specLocation": "watcher/_types/Input.ts#L59-L65" + "specLocation": "watcher/_types/Input.ts#L60-L66" }, { "kind": "enum", @@ -105326,7 +105326,7 @@ "name": "InputType", "namespace": "watcher._types" }, - "specLocation": "watcher/_types/Input.ts#L100-L104" + "specLocation": "watcher/_types/Input.ts#L101-L105" }, { "kind": "enum", @@ -105442,7 +105442,7 @@ "name": "ResponseContentType", "namespace": "watcher._types" }, - "specLocation": "watcher/_types/Input.ts#L106-L110" + "specLocation": "watcher/_types/Input.ts#L107-L111" }, { "codegenNames": [ diff --git a/output/schema/schema.json b/output/schema/schema.json index 3ff4a3f601..036910fe9d 100644 --- a/output/schema/schema.json +++ b/output/schema/schema.json @@ -211040,7 +211040,7 @@ } } ], - "specLocation": "watcher/_types/Input.ts#L35-L37" + "specLocation": "watcher/_types/Input.ts#L36-L38" }, { "kind": "interface", @@ -211210,7 +211210,7 @@ "name": "ConnectionScheme", "namespace": "watcher._types" }, - "specLocation": "watcher/_types/Input.ts#L39-L42" + "specLocation": "watcher/_types/Input.ts#L40-L43" }, { "kind": "type_alias", @@ -212229,7 +212229,7 @@ } } ], - "specLocation": "watcher/_types/Input.ts#L44-L48" + "specLocation": "watcher/_types/Input.ts#L45-L49" }, { "kind": "interface", @@ -212250,7 +212250,7 @@ } } ], - "specLocation": "watcher/_types/Input.ts#L50-L52" + "specLocation": "watcher/_types/Input.ts#L51-L53" }, { "kind": "interface", @@ -212282,7 +212282,7 @@ } } ], - "specLocation": "watcher/_types/Input.ts#L54-L57" + "specLocation": "watcher/_types/Input.ts#L55-L58" }, { "kind": "enum", @@ -212307,7 +212307,7 @@ "name": "HttpInputMethod", "namespace": "watcher._types" }, - "specLocation": "watcher/_types/Input.ts#L59-L65" + "specLocation": "watcher/_types/Input.ts#L60-L66" }, { "kind": "interface", @@ -212339,7 +212339,7 @@ } } ], - "specLocation": "watcher/_types/Input.ts#L67-L70" + "specLocation": "watcher/_types/Input.ts#L68-L71" }, { "kind": "interface", @@ -212514,7 +212514,7 @@ } } ], - "specLocation": "watcher/_types/Input.ts#L72-L86" + "specLocation": "watcher/_types/Input.ts#L73-L87" }, { "kind": "interface", @@ -212797,7 +212797,7 @@ } } ], - "specLocation": "watcher/_types/Input.ts#L90-L98", + "specLocation": "watcher/_types/Input.ts#L91-L99", "variants": { "kind": "container" } @@ -212819,7 +212819,7 @@ "name": "InputType", "namespace": "watcher._types" }, - "specLocation": "watcher/_types/Input.ts#L100-L104" + "specLocation": "watcher/_types/Input.ts#L101-L105" }, { "kind": "interface", @@ -213400,7 +213400,7 @@ "name": "ResponseContentType", "namespace": "watcher._types" }, - "specLocation": "watcher/_types/Input.ts#L106-L110" + "specLocation": "watcher/_types/Input.ts#L107-L111" }, { "kind": "interface", @@ -213707,7 +213707,7 @@ } } ], - "specLocation": "watcher/_types/Input.ts#L112-L116" + "specLocation": "watcher/_types/Input.ts#L113-L117" }, { "kind": "interface", @@ -213718,7 +213718,7 @@ "properties": [ { "name": "query", - "required": true, + "required": false, "type": { "kind": "instance_of", "type": { @@ -213726,9 +213726,48 @@ "namespace": "_types.query_dsl" } } + }, + { + "aliases": [ + "aggs" + ], + "description": "Defines the aggregations that are run as part of the search request.", + "name": "aggregations", + "required": false, + "type": { + "kind": "dictionary_of", + "key": { + "kind": "instance_of", + "type": { + "name": "string", + "namespace": "_builtins" + } + }, + "singleKey": false, + "value": { + "kind": "instance_of", + "type": { + "name": "AggregationContainer", + "namespace": "_types.aggregations" + } + } + } + }, + { + "description": "The number of hits to return.\nBy default, you cannot page through more than 10,000 hits using the `from` and `size` parameters.\nTo page through more hits, use the `search_after` parameter.", + "name": "size", + "required": false, + "serverDefault": 10, + "type": { + "kind": "instance_of", + "type": { + "name": "integer", + "namespace": "_types" + } + } } ], - "specLocation": "watcher/_types/Input.ts#L147-L149" + "specLocation": "watcher/_types/Input.ts#L148-L161" }, { "kind": "interface", @@ -213807,7 +213846,7 @@ } } ], - "specLocation": "watcher/_types/Input.ts#L118-L125" + "specLocation": "watcher/_types/Input.ts#L119-L126" }, { "kind": "interface", @@ -213883,7 +213922,7 @@ } } ], - "specLocation": "watcher/_types/Input.ts#L128-L145" + "specLocation": "watcher/_types/Input.ts#L129-L146" }, { "kind": "interface", diff --git a/output/typescript/types.ts b/output/typescript/types.ts index 51b260f56a..ad8bd2697c 100644 --- a/output/typescript/types.ts +++ b/output/typescript/types.ts @@ -20375,7 +20375,10 @@ export interface WatcherSearchInput { } export interface WatcherSearchInputRequestBody { - query: QueryDslQueryContainer + query?: QueryDslQueryContainer + aggregations?: Record + aggs?: Record + size?: integer } export interface WatcherSearchInputRequestDefinition { diff --git a/specification/watcher/_types/Input.ts b/specification/watcher/_types/Input.ts index 7504ab6c9e..943fcb45fb 100644 --- a/specification/watcher/_types/Input.ts +++ b/specification/watcher/_types/Input.ts @@ -19,6 +19,7 @@ import { Dictionary, SingleKeyDictionary } from '@spec_utils/Dictionary' import { UserDefinedValue } from '@spec_utils/UserDefinedValue' +import { AggregationContainer } from '@_types/aggregations/AggregationContainer' import { Id, IndexName, @@ -28,7 +29,7 @@ import { Username } from '@_types/common' import { Host } from '@_types/Networking' -import { uint } from '@_types/Numeric' +import { integer, uint } from '@_types/Numeric' import { QueryContainer } from '@_types/query_dsl/abstractions' import { Duration } from '@_types/Time' @@ -145,7 +146,18 @@ export class SearchTemplateRequestBody { } export class SearchInputRequestBody { - query: QueryContainer + query?: QueryContainer + /** + * Defines the aggregations that are run as part of the search request. + * @aliases aggs */ // ES uses "aggregations" in serialization + aggregations?: Dictionary + /** + * The number of hits to return. + * By default, you cannot page through more than 10,000 hits using the `from` and `size` parameters. + * To page through more hits, use the `search_after` parameter. + * @server_default 10 + */ + size?: integer } export class SimpleInput {