From db835ddb297652330535dd424f39136e1cf0cd6e Mon Sep 17 00:00:00 2001 From: Florian Bernd Date: Fri, 8 Dec 2023 16:22:36 +0100 Subject: [PATCH 01/12] Fix definition of `ManagedBy` (#2364) --- specification/_types/common.ts | 5 ----- specification/indices/_types/DataStream.ts | 7 ++++++- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/specification/_types/common.ts b/specification/_types/common.ts index 732150a2a6..05be05220c 100644 --- a/specification/_types/common.ts +++ b/specification/_types/common.ts @@ -77,11 +77,6 @@ export type Metrics = string | string[] export type ClusterAlias = string -export type ManagedBy = - | 'Index Lifecycle Management' - | 'Data stream lifecycle' - | 'Unmanaged' - export type Name = string export type Names = Name | Name[] diff --git a/specification/indices/_types/DataStream.ts b/specification/indices/_types/DataStream.ts index b508bc5aa0..aeb9b20fbe 100644 --- a/specification/indices/_types/DataStream.ts +++ b/specification/indices/_types/DataStream.ts @@ -22,7 +22,6 @@ import { Field, HealthStatus, IndexName, - ManagedBy, Metadata, Name, Uuid @@ -30,6 +29,12 @@ import { import { integer } from '@_types/Numeric' import { DataStreamLifecycleWithRollover } from '@indices/_types/DataStreamLifecycle' +enum ManagedBy { + 'Index Lifecycle Management', + 'Data stream lifecycle', + 'Unmanaged' +} + export class DataStream { /** * Custom metadata for the stream, copied from the `_meta` object of the stream’s matching index template. From de45840a75007025ae7ee19cb93930cc74cdc561 Mon Sep 17 00:00:00 2001 From: Elastic Machine Date: Fri, 8 Dec 2023 15:23:26 +0000 Subject: [PATCH 02/12] Update specification output --- .../elasticsearch-serverless-openapi.json | 30 +--- output/schema/schema.json | 154 +++++++++--------- output/typescript/types.ts | 8 +- 3 files changed, 86 insertions(+), 106 deletions(-) diff --git a/output/openapi/elasticsearch-serverless-openapi.json b/output/openapi/elasticsearch-serverless-openapi.json index cb216e8cd2..b0a8df86d6 100644 --- a/output/openapi/elasticsearch-serverless-openapi.json +++ b/output/openapi/elasticsearch-serverless-openapi.json @@ -48512,7 +48512,7 @@ "$ref": "#/components/schemas/_types:Name" }, "next_generation_managed_by": { - "$ref": "#/components/schemas/_types:ManagedBy" + "$ref": "#/components/schemas/indices._types:ManagedBy" }, "prefer_ilm": { "description": "Indicates if ILM should take precedence over DSL in case both are configured to managed this data stream.", @@ -48561,26 +48561,12 @@ "timestamp_field" ] }, - "_types:ManagedBy": { - "oneOf": [ - { - "type": "string", - "enum": [ - "Index Lifecycle Management" - ] - }, - { - "type": "string", - "enum": [ - "Data stream lifecycle" - ] - }, - { - "type": "string", - "enum": [ - "Unmanaged" - ] - } + "indices._types:ManagedBy": { + "type": "string", + "enum": [ + "Index Lifecycle Management", + "Data stream lifecycle", + "Unmanaged" ] }, "indices._types:DataStreamIndex": { @@ -48596,7 +48582,7 @@ "$ref": "#/components/schemas/_types:Name" }, "managed_by": { - "$ref": "#/components/schemas/_types:ManagedBy" + "$ref": "#/components/schemas/indices._types:ManagedBy" }, "prefer_ilm": { "description": "Indicates if ILM should take precedence over DSL in case both are configured to manage this index.", diff --git a/output/schema/schema.json b/output/schema/schema.json index af1ae3d844..1303d3db2d 100644 --- a/output/schema/schema.json +++ b/output/schema/schema.json @@ -40293,7 +40293,7 @@ "name": "AggregateName", "namespace": "_types" }, - "specLocation": "_types/common.ts#L150-L154", + "specLocation": "_types/common.ts#L145-L149", "type": { "kind": "instance_of", "type": { @@ -40502,7 +40502,7 @@ "name": "ByteSize", "namespace": "_types" }, - "specLocation": "_types/common.ts#L101-L102", + "specLocation": "_types/common.ts#L96-L97", "type": { "items": [ { @@ -40555,7 +40555,7 @@ "name": "Bytes", "namespace": "_types" }, - "specLocation": "_types/common.ts#L174-L192" + "specLocation": "_types/common.ts#L169-L187" }, { "kind": "type_alias", @@ -40698,7 +40698,7 @@ "name": "ClusterInfoTarget", "namespace": "_types" }, - "specLocation": "_types/common.ts#L389-L395" + "specLocation": "_types/common.ts#L384-L390" }, { "kind": "type_alias", @@ -40706,7 +40706,7 @@ "name": "ClusterInfoTargets", "namespace": "_types" }, - "specLocation": "_types/common.ts#L397-L397", + "specLocation": "_types/common.ts#L392-L392", "type": { "items": [ { @@ -40925,7 +40925,7 @@ "name": "Conflicts", "namespace": "_types" }, - "specLocation": "_types/common.ts#L194-L203" + "specLocation": "_types/common.ts#L189-L198" }, { "kind": "interface", @@ -41058,7 +41058,7 @@ "name": "DataStreamName", "namespace": "_types" }, - "specLocation": "_types/common.ts#L96-L97", + "specLocation": "_types/common.ts#L91-L92", "type": { "kind": "instance_of", "type": { @@ -41073,7 +41073,7 @@ "name": "DataStreamNames", "namespace": "_types" }, - "specLocation": "_types/common.ts#L99-L99", + "specLocation": "_types/common.ts#L94-L94", "type": { "items": [ { @@ -41446,7 +41446,7 @@ "namespace": "_types" }, "properties": [], - "specLocation": "_types/common.ts#L165-L166" + "specLocation": "_types/common.ts#L160-L161" }, { "generics": [ @@ -41654,7 +41654,7 @@ "name": "ExpandWildcard", "namespace": "_types" }, - "specLocation": "_types/common.ts#L212-L226" + "specLocation": "_types/common.ts#L207-L221" }, { "kind": "type_alias", @@ -41662,7 +41662,7 @@ "name": "ExpandWildcards", "namespace": "_types" }, - "specLocation": "_types/common.ts#L228-L228", + "specLocation": "_types/common.ts#L223-L223", "type": { "items": [ { @@ -41693,7 +41693,7 @@ "name": "Field", "namespace": "_types" }, - "specLocation": "_types/common.ts#L143-L144", + "specLocation": "_types/common.ts#L138-L139", "type": { "kind": "instance_of", "type": { @@ -42007,7 +42007,7 @@ "name": "Fields", "namespace": "_types" }, - "specLocation": "_types/common.ts#L145-L145", + "specLocation": "_types/common.ts#L140-L140", "type": { "items": [ { @@ -42102,7 +42102,7 @@ "name": "Fuzziness", "namespace": "_types" }, - "specLocation": "_types/common.ts#L138-L139", + "specLocation": "_types/common.ts#L133-L134", "type": { "items": [ { @@ -42717,7 +42717,7 @@ "name": "HealthStatus", "namespace": "_types" }, - "specLocation": "_types/common.ts#L230-L250" + "specLocation": "_types/common.ts#L225-L245" }, { "kind": "type_alias", @@ -42740,7 +42740,7 @@ "name": "HttpHeaders", "namespace": "_types" }, - "specLocation": "_types/common.ts#L163-L163", + "specLocation": "_types/common.ts#L158-L158", "type": { "key": { "kind": "instance_of", @@ -43217,7 +43217,7 @@ } } ], - "specLocation": "_types/common.ts#L343-L370" + "specLocation": "_types/common.ts#L338-L365" }, { "inherits": { @@ -43356,7 +43356,7 @@ } } ], - "specLocation": "_types/common.ts#L332-L341" + "specLocation": "_types/common.ts#L327-L336" }, { "inherits": { @@ -43609,7 +43609,7 @@ "name": "Level", "namespace": "_types" }, - "specLocation": "_types/common.ts#L260-L264" + "specLocation": "_types/common.ts#L255-L259" }, { "kind": "enum", @@ -43630,31 +43630,6 @@ }, "specLocation": "_types/Lifecycle.ts#L20-L24" }, - { - "kind": "type_alias", - "name": { - "name": "ManagedBy", - "namespace": "_types" - }, - "specLocation": "_types/common.ts#L80-L83", - "type": { - "items": [ - { - "kind": "literal_value", - "value": "Index Lifecycle Management" - }, - { - "kind": "literal_value", - "value": "Data stream lifecycle" - }, - { - "kind": "literal_value", - "value": "Unmanaged" - } - ], - "kind": "union_of" - } - }, { "kind": "type_alias", "name": { @@ -43889,7 +43864,7 @@ "name": "Metadata", "namespace": "_types" }, - "specLocation": "_types/common.ts#L104-L104", + "specLocation": "_types/common.ts#L99-L99", "type": { "key": { "kind": "instance_of", @@ -43944,7 +43919,7 @@ "name": "MinimumShouldMatch", "namespace": "_types" }, - "specLocation": "_types/common.ts#L168-L172", + "specLocation": "_types/common.ts#L163-L167", "type": { "items": [ { @@ -43973,7 +43948,7 @@ "name": "MultiTermQueryRewrite", "namespace": "_types" }, - "specLocation": "_types/common.ts#L140-L141", + "specLocation": "_types/common.ts#L135-L136", "type": { "kind": "instance_of", "type": { @@ -43988,7 +43963,7 @@ "name": "Name", "namespace": "_types" }, - "specLocation": "_types/common.ts#L85-L85", + "specLocation": "_types/common.ts#L80-L80", "type": { "kind": "instance_of", "type": { @@ -44003,7 +43978,7 @@ "name": "Names", "namespace": "_types" }, - "specLocation": "_types/common.ts#L86-L86", + "specLocation": "_types/common.ts#L81-L81", "type": { "items": [ { @@ -44033,7 +44008,7 @@ "name": "Namespace", "namespace": "_types" }, - "specLocation": "_types/common.ts#L88-L88", + "specLocation": "_types/common.ts#L83-L83", "type": { "kind": "instance_of", "type": { @@ -44259,7 +44234,7 @@ "name": "NodeName", "namespace": "_types" }, - "specLocation": "_types/common.ts#L93-L94", + "specLocation": "_types/common.ts#L88-L89", "type": { "kind": "instance_of", "type": { @@ -44595,7 +44570,7 @@ "name": "OpType", "namespace": "_types" }, - "specLocation": "_types/common.ts#L266-L275" + "specLocation": "_types/common.ts#L261-L270" }, { "kind": "type_alias", @@ -44603,7 +44578,7 @@ "name": "Password", "namespace": "_types" }, - "specLocation": "_types/common.ts#L206-L206", + "specLocation": "_types/common.ts#L201-L201", "type": { "kind": "instance_of", "type": { @@ -44645,7 +44620,7 @@ "name": "PipelineName", "namespace": "_types" }, - "specLocation": "_types/common.ts#L91-L91", + "specLocation": "_types/common.ts#L86-L86", "type": { "kind": "instance_of", "type": { @@ -44772,7 +44747,7 @@ "name": "PropertyName", "namespace": "_types" }, - "specLocation": "_types/common.ts#L135-L135", + "specLocation": "_types/common.ts#L130-L130", "type": { "kind": "instance_of", "type": { @@ -45044,7 +45019,7 @@ "name": "Refresh", "namespace": "_types" }, - "specLocation": "_types/common.ts#L277-L284" + "specLocation": "_types/common.ts#L272-L279" }, { "kind": "interface", @@ -45146,7 +45121,7 @@ "name": "RelationName", "namespace": "_types" }, - "specLocation": "_types/common.ts#L136-L136", + "specLocation": "_types/common.ts#L131-L131", "type": { "kind": "instance_of", "type": { @@ -46064,7 +46039,7 @@ "name": "SearchType", "namespace": "_types" }, - "specLocation": "_types/common.ts#L286-L291" + "specLocation": "_types/common.ts#L281-L286" }, { "kind": "interface", @@ -46379,7 +46354,7 @@ "name": "SequenceNumber", "namespace": "_types" }, - "specLocation": "_types/common.ts#L133-L133", + "specLocation": "_types/common.ts#L128-L128", "type": { "kind": "instance_of", "type": { @@ -46394,7 +46369,7 @@ "name": "Service", "namespace": "_types" }, - "specLocation": "_types/common.ts#L89-L89", + "specLocation": "_types/common.ts#L84-L84", "type": { "kind": "instance_of", "type": { @@ -46613,7 +46588,7 @@ "name": "Slices", "namespace": "_types" }, - "specLocation": "_types/common.ts#L372-L377", + "specLocation": "_types/common.ts#L367-L372", "type": { "items": [ { @@ -46646,7 +46621,7 @@ "name": "SlicesCalculation", "namespace": "_types" }, - "specLocation": "_types/common.ts#L379-L387" + "specLocation": "_types/common.ts#L374-L382" }, { "kind": "type_alias", @@ -47042,7 +47017,7 @@ "name": "SuggestMode", "namespace": "_types" }, - "specLocation": "_types/common.ts#L293-L306" + "specLocation": "_types/common.ts#L288-L301" }, { "description": "The suggestion name as returned from the server. Depending whether typed_keys is specified this could come back\nin the form of `name#type` instead of simply `name`", @@ -47051,7 +47026,7 @@ "name": "SuggestionName", "namespace": "_types" }, - "specLocation": "_types/common.ts#L156-L160", + "specLocation": "_types/common.ts#L151-L155", "type": { "kind": "instance_of", "type": { @@ -47120,7 +47095,7 @@ "name": "TaskId", "namespace": "_types" }, - "specLocation": "_types/common.ts#L137-L137", + "specLocation": "_types/common.ts#L132-L132", "type": { "items": [ { @@ -47196,7 +47171,7 @@ "name": "ThreadType", "namespace": "_types" }, - "specLocation": "_types/common.ts#L308-L314" + "specLocation": "_types/common.ts#L303-L309" }, { "description": "Time of day, expressed as HH:MM:SS", @@ -47552,7 +47527,7 @@ "name": "Username", "namespace": "_types" }, - "specLocation": "_types/common.ts#L205-L205", + "specLocation": "_types/common.ts#L200-L200", "type": { "kind": "instance_of", "type": { @@ -47567,7 +47542,7 @@ "name": "Uuid", "namespace": "_types" }, - "specLocation": "_types/common.ts#L130-L130", + "specLocation": "_types/common.ts#L125-L125", "type": { "kind": "instance_of", "type": { @@ -47582,7 +47557,7 @@ "name": "VersionNumber", "namespace": "_types" }, - "specLocation": "_types/common.ts#L107-L107", + "specLocation": "_types/common.ts#L102-L102", "type": { "kind": "instance_of", "type": { @@ -47597,7 +47572,7 @@ "name": "VersionString", "namespace": "_types" }, - "specLocation": "_types/common.ts#L109-L109", + "specLocation": "_types/common.ts#L104-L104", "type": { "kind": "instance_of", "type": { @@ -47629,7 +47604,7 @@ "name": "VersionType", "namespace": "_types" }, - "specLocation": "_types/common.ts#L111-L127" + "specLocation": "_types/common.ts#L106-L122" }, { "kind": "enum", @@ -47645,7 +47620,7 @@ "name": "WaitForActiveShardOptions", "namespace": "_types" }, - "specLocation": "_types/common.ts#L316-L320" + "specLocation": "_types/common.ts#L311-L315" }, { "codegenNames": [ @@ -47657,7 +47632,7 @@ "name": "WaitForActiveShards", "namespace": "_types" }, - "specLocation": "_types/common.ts#L147-L148", + "specLocation": "_types/common.ts#L142-L143", "type": { "items": [ { @@ -47704,7 +47679,7 @@ "name": "WaitForEvents", "namespace": "_types" }, - "specLocation": "_types/common.ts#L322-L329" + "specLocation": "_types/common.ts#L317-L324" }, { "kind": "interface", @@ -110679,7 +110654,7 @@ "kind": "instance_of", "type": { "name": "ManagedBy", - "namespace": "_types" + "namespace": "indices._types" } } }, @@ -110813,7 +110788,7 @@ } } ], - "specLocation": "indices/_types/DataStream.ts#L33-L105" + "specLocation": "indices/_types/DataStream.ts#L38-L110" }, { "kind": "interface", @@ -110866,7 +110841,7 @@ "kind": "instance_of", "type": { "name": "ManagedBy", - "namespace": "_types" + "namespace": "indices._types" } } }, @@ -110883,7 +110858,7 @@ } } ], - "specLocation": "indices/_types/DataStream.ts#L114-L135" + "specLocation": "indices/_types/DataStream.ts#L119-L140" }, { "description": "Data lifecycle denotes that a data stream is managed by the data stream lifecycle and contains the configuration.", @@ -111130,7 +111105,7 @@ } } ], - "specLocation": "indices/_types/DataStream.ts#L107-L112" + "specLocation": "indices/_types/DataStream.ts#L112-L117" }, { "kind": "interface", @@ -111151,7 +111126,7 @@ } } ], - "specLocation": "indices/_types/DataStream.ts#L137-L139" + "specLocation": "indices/_types/DataStream.ts#L142-L144" }, { "kind": "interface", @@ -113265,6 +113240,25 @@ ], "specLocation": "indices/_types/IndexSettings.ts#L554-L561" }, + { + "kind": "enum", + "members": [ + { + "name": "Index Lifecycle Management" + }, + { + "name": "Data stream lifecycle" + }, + { + "name": "Unmanaged" + } + ], + "name": { + "name": "ManagedBy", + "namespace": "indices._types" + }, + "specLocation": "indices/_types/DataStream.ts#L32-L36" + }, { "description": "Mapping Limit Settings", "docId": "mapping-settings-limit", diff --git a/output/typescript/types.ts b/output/typescript/types.ts index 4bc6d799f3..10754b57d8 100644 --- a/output/typescript/types.ts +++ b/output/typescript/types.ts @@ -2356,8 +2356,6 @@ export type Level = 'cluster' | 'indices' | 'shards' export type LifecycleOperationMode = 'RUNNING' | 'STOPPING' | 'STOPPED' -export type ManagedBy = 'Index Lifecycle Management' | 'Data stream lifecycle' | 'Unmanaged' - export type MapboxVectorTiles = ArrayBuffer export interface MergesStats { @@ -9682,7 +9680,7 @@ export interface IndicesDataStream { generation: integer hidden: boolean ilm_policy?: Name - next_generation_managed_by: ManagedBy + next_generation_managed_by: IndicesManagedBy prefer_ilm: boolean indices: IndicesDataStreamIndex[] lifecycle?: IndicesDataStreamLifecycleWithRollover @@ -9698,7 +9696,7 @@ export interface IndicesDataStreamIndex { index_name: IndexName index_uuid: Uuid ilm_policy?: Name - managed_by: ManagedBy + managed_by: IndicesManagedBy prefer_ilm: boolean } @@ -9947,6 +9945,8 @@ export interface IndicesIndexingSlowlogTresholds { index?: IndicesSlowlogTresholdLevels } +export type IndicesManagedBy = 'Index Lifecycle Management' | 'Data stream lifecycle' | 'Unmanaged' + export interface IndicesMappingLimitSettings { coerce?: boolean total_fields?: IndicesMappingLimitSettingsTotalFields From 55a7114227b94f9e0c773103d2461008c333bdbc Mon Sep 17 00:00:00 2001 From: Sylvain Wallez Date: Tue, 12 Dec 2023 15:34:07 +0100 Subject: [PATCH 03/12] Add codegen_name annotations to ManagedBy (#2368) --- .github/workflows/validate-pr.yml | 2 +- output/schema/schema.json | 13 ++++++++----- specification/indices/_types/DataStream.ts | 3 +++ 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/.github/workflows/validate-pr.yml b/.github/workflows/validate-pr.yml index a66deb73eb..57ede75691 100644 --- a/.github/workflows/validate-pr.yml +++ b/.github/workflows/validate-pr.yml @@ -18,7 +18,7 @@ jobs: if: github.repository_owner == 'elastic' # this action will fail if executed from a fork runs-on: ubuntu-latest env: - STACK_VERSION: 8.10-SNAPSHOT + STACK_VERSION: 8.13-SNAPSHOT steps: - uses: actions/checkout@v2 diff --git a/output/schema/schema.json b/output/schema/schema.json index 1303d3db2d..1cc9c55053 100644 --- a/output/schema/schema.json +++ b/output/schema/schema.json @@ -110788,7 +110788,7 @@ } } ], - "specLocation": "indices/_types/DataStream.ts#L38-L110" + "specLocation": "indices/_types/DataStream.ts#L41-L113" }, { "kind": "interface", @@ -110858,7 +110858,7 @@ } } ], - "specLocation": "indices/_types/DataStream.ts#L119-L140" + "specLocation": "indices/_types/DataStream.ts#L122-L143" }, { "description": "Data lifecycle denotes that a data stream is managed by the data stream lifecycle and contains the configuration.", @@ -111105,7 +111105,7 @@ } } ], - "specLocation": "indices/_types/DataStream.ts#L112-L117" + "specLocation": "indices/_types/DataStream.ts#L115-L120" }, { "kind": "interface", @@ -111126,7 +111126,7 @@ } } ], - "specLocation": "indices/_types/DataStream.ts#L142-L144" + "specLocation": "indices/_types/DataStream.ts#L145-L147" }, { "kind": "interface", @@ -113244,12 +113244,15 @@ "kind": "enum", "members": [ { + "codegenName": "ilm", "name": "Index Lifecycle Management" }, { + "codegenName": "datastream", "name": "Data stream lifecycle" }, { + "codegenName": "unmanaged", "name": "Unmanaged" } ], @@ -113257,7 +113260,7 @@ "name": "ManagedBy", "namespace": "indices._types" }, - "specLocation": "indices/_types/DataStream.ts#L32-L36" + "specLocation": "indices/_types/DataStream.ts#L32-L39" }, { "description": "Mapping Limit Settings", diff --git a/specification/indices/_types/DataStream.ts b/specification/indices/_types/DataStream.ts index aeb9b20fbe..d8f2514853 100644 --- a/specification/indices/_types/DataStream.ts +++ b/specification/indices/_types/DataStream.ts @@ -30,8 +30,11 @@ import { integer } from '@_types/Numeric' import { DataStreamLifecycleWithRollover } from '@indices/_types/DataStreamLifecycle' enum ManagedBy { + /** @codegen_name ilm */ 'Index Lifecycle Management', + /** @codegen_name datastream */ 'Data stream lifecycle', + /** @codegen_name unmanaged */ 'Unmanaged' } From 6764a72a5367baa291caf70715089b93dfd72b22 Mon Sep 17 00:00:00 2001 From: Laura Trotta <153528055+l-trotta@users.noreply.github.com> Date: Wed, 13 Dec 2023 12:18:30 +0100 Subject: [PATCH 04/12] added note for known typo (#2369) * added note for known typo * fixed comment structure * fixed comment style * dot --- specification/indices/_types/DataStream.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/specification/indices/_types/DataStream.ts b/specification/indices/_types/DataStream.ts index d8f2514853..dfca2e64d2 100644 --- a/specification/indices/_types/DataStream.ts +++ b/specification/indices/_types/DataStream.ts @@ -33,6 +33,8 @@ enum ManagedBy { /** @codegen_name ilm */ 'Index Lifecycle Management', /** @codegen_name datastream */ + // This should have been written with capital letters, it's a known typo and should not be corrected, + // since the test cases have already been written. 'Data stream lifecycle', /** @codegen_name unmanaged */ 'Unmanaged' @@ -42,7 +44,8 @@ export class DataStream { /** * Custom metadata for the stream, copied from the `_meta` object of the stream’s matching index template. * If empty, the response omits this property. - * @doc_id mapping-meta-field */ + * @doc_id mapping-meta-field + */ _meta?: Metadata /** * If `true`, the data stream allows custom routing on write request. From 0fea13ac4bd5cf49e249f9406b8d996e11d1fe01 Mon Sep 17 00:00:00 2001 From: Elastic Machine Date: Wed, 13 Dec 2023 11:19:10 +0000 Subject: [PATCH 05/12] Update specification output --- output/schema/schema.json | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/output/schema/schema.json b/output/schema/schema.json index 1cc9c55053..d1bc583c51 100644 --- a/output/schema/schema.json +++ b/output/schema/schema.json @@ -110788,7 +110788,7 @@ } } ], - "specLocation": "indices/_types/DataStream.ts#L41-L113" + "specLocation": "indices/_types/DataStream.ts#L43-L116" }, { "kind": "interface", @@ -110858,7 +110858,7 @@ } } ], - "specLocation": "indices/_types/DataStream.ts#L122-L143" + "specLocation": "indices/_types/DataStream.ts#L125-L146" }, { "description": "Data lifecycle denotes that a data stream is managed by the data stream lifecycle and contains the configuration.", @@ -111105,7 +111105,7 @@ } } ], - "specLocation": "indices/_types/DataStream.ts#L115-L120" + "specLocation": "indices/_types/DataStream.ts#L118-L123" }, { "kind": "interface", @@ -111126,7 +111126,7 @@ } } ], - "specLocation": "indices/_types/DataStream.ts#L145-L147" + "specLocation": "indices/_types/DataStream.ts#L148-L150" }, { "kind": "interface", @@ -113260,7 +113260,7 @@ "name": "ManagedBy", "namespace": "indices._types" }, - "specLocation": "indices/_types/DataStream.ts#L32-L39" + "specLocation": "indices/_types/DataStream.ts#L32-L41" }, { "description": "Mapping Limit Settings", From c9a3d56e28df3d2a547b7c81053e363891e07d41 Mon Sep 17 00:00:00 2001 From: Kathleen DeRusso Date: Thu, 14 Dec 2023 00:39:21 -0500 Subject: [PATCH 06/12] Mark Synonyms API as stable (#2366) --- output/schema/schema.json | 42 +++++++++---------- .../_json_spec/synonyms.delete_synonym.json | 2 +- .../synonyms.delete_synonym_rule.json | 2 +- .../_json_spec/synonyms.get_synonym.json | 2 +- .../_json_spec/synonyms.get_synonym_rule.json | 2 +- .../synonyms.get_synonyms_sets.json | 2 +- .../_json_spec/synonyms.put_synonym.json | 2 +- .../_json_spec/synonyms.put_synonym_rule.json | 2 +- .../delete_synonym/SynonymsDeleteRequest.ts | 4 +- .../SynonymRuleDeleteRequest.ts | 4 +- .../get_synonym/SynonymsGetRequest.ts | 4 +- .../get_synonym_rule/SynonymRuleGetRequest.ts | 4 +- .../SynonymsSetsGetRequest.ts | 4 +- .../put_synonym/SynonymsPutRequest.ts | 4 +- .../put_synonym_rule/SynonymRulePutRequest.ts | 4 +- 15 files changed, 42 insertions(+), 42 deletions(-) diff --git a/output/schema/schema.json b/output/schema/schema.json index d1bc583c51..101cf97acf 100644 --- a/output/schema/schema.json +++ b/output/schema/schema.json @@ -17771,12 +17771,12 @@ { "availability": { "serverless": { - "stability": "experimental", + "stability": "stable", "visibility": "public" }, "stack": { "since": "8.10.0", - "stability": "experimental" + "stability": "stable" } }, "description": "Deletes a synonym set", @@ -17795,7 +17795,7 @@ "application/json" ], "since": "8.10.0", - "stability": "experimental", + "stability": "stable", "urls": [ { "methods": [ @@ -17809,12 +17809,12 @@ { "availability": { "serverless": { - "stability": "experimental", + "stability": "stable", "visibility": "public" }, "stack": { "since": "8.10.0", - "stability": "experimental" + "stability": "stable" } }, "description": "Deletes a synonym rule in a synonym set", @@ -17836,7 +17836,7 @@ "application/json" ], "since": "8.10.0", - "stability": "experimental", + "stability": "stable", "urls": [ { "methods": [ @@ -17850,12 +17850,12 @@ { "availability": { "serverless": { - "stability": "experimental", + "stability": "stable", "visibility": "public" }, "stack": { "since": "8.10.0", - "stability": "experimental" + "stability": "stable" } }, "description": "Retrieves a synonym set", @@ -17874,7 +17874,7 @@ "application/json" ], "since": "8.10.0", - "stability": "experimental", + "stability": "stable", "urls": [ { "methods": [ @@ -17888,12 +17888,12 @@ { "availability": { "serverless": { - "stability": "experimental", + "stability": "stable", "visibility": "public" }, "stack": { "since": "8.10.0", - "stability": "experimental" + "stability": "stable" } }, "description": "Retrieves a synonym rule from a synonym set", @@ -17915,7 +17915,7 @@ "application/json" ], "since": "8.10.0", - "stability": "experimental", + "stability": "stable", "urls": [ { "methods": [ @@ -17929,12 +17929,12 @@ { "availability": { "serverless": { - "stability": "experimental", + "stability": "stable", "visibility": "public" }, "stack": { "since": "8.10.0", - "stability": "experimental" + "stability": "stable" } }, "description": "Retrieves a summary of all defined synonym sets", @@ -17953,7 +17953,7 @@ "application/json" ], "since": "8.10.0", - "stability": "experimental", + "stability": "stable", "urls": [ { "methods": [ @@ -17967,12 +17967,12 @@ { "availability": { "serverless": { - "stability": "experimental", + "stability": "stable", "visibility": "public" }, "stack": { "since": "8.10.0", - "stability": "experimental" + "stability": "stable" } }, "description": "Creates or updates a synonyms set", @@ -17994,7 +17994,7 @@ "application/json" ], "since": "8.10.0", - "stability": "experimental", + "stability": "stable", "urls": [ { "methods": [ @@ -18008,12 +18008,12 @@ { "availability": { "serverless": { - "stability": "experimental", + "stability": "stable", "visibility": "public" }, "stack": { "since": "8.10.0", - "stability": "experimental" + "stability": "stable" } }, "description": "Creates or updates a synonym rule in a synonym set", @@ -18035,7 +18035,7 @@ "application/json" ], "since": "8.10.0", - "stability": "experimental", + "stability": "stable", "urls": [ { "methods": [ diff --git a/specification/_json_spec/synonyms.delete_synonym.json b/specification/_json_spec/synonyms.delete_synonym.json index 9756f4923e..32604b9bf2 100644 --- a/specification/_json_spec/synonyms.delete_synonym.json +++ b/specification/_json_spec/synonyms.delete_synonym.json @@ -4,7 +4,7 @@ "url": "https://www.elastic.co/guide/en/elasticsearch/reference/master/delete-synonyms-set.html", "description": "Deletes a synonym set" }, - "stability": "experimental", + "stability": "stable", "visibility": "public", "headers": { "accept": ["application/json"] diff --git a/specification/_json_spec/synonyms.delete_synonym_rule.json b/specification/_json_spec/synonyms.delete_synonym_rule.json index e70ff261f8..fcf1cf4b48 100644 --- a/specification/_json_spec/synonyms.delete_synonym_rule.json +++ b/specification/_json_spec/synonyms.delete_synonym_rule.json @@ -4,7 +4,7 @@ "url": "https://www.elastic.co/guide/en/elasticsearch/reference/master/delete-synonym-rule.html", "description": "Deletes a synonym rule in a synonym set" }, - "stability": "experimental", + "stability": "stable", "visibility": "public", "headers": { "accept": ["application/json"], diff --git a/specification/_json_spec/synonyms.get_synonym.json b/specification/_json_spec/synonyms.get_synonym.json index 9679fcfd96..37d2881a50 100644 --- a/specification/_json_spec/synonyms.get_synonym.json +++ b/specification/_json_spec/synonyms.get_synonym.json @@ -4,7 +4,7 @@ "url": "https://www.elastic.co/guide/en/elasticsearch/reference/master/get-synonyms-set.html", "description": "Retrieves a synonym set" }, - "stability": "experimental", + "stability": "stable", "visibility": "public", "headers": { "accept": ["application/json"] diff --git a/specification/_json_spec/synonyms.get_synonym_rule.json b/specification/_json_spec/synonyms.get_synonym_rule.json index 6eff1d841f..3f15f77bcf 100644 --- a/specification/_json_spec/synonyms.get_synonym_rule.json +++ b/specification/_json_spec/synonyms.get_synonym_rule.json @@ -4,7 +4,7 @@ "url": "https://www.elastic.co/guide/en/elasticsearch/reference/master/get-synonym-rule.html", "description": "Retrieves a synonym rule from a synonym set" }, - "stability": "experimental", + "stability": "stable", "visibility": "public", "headers": { "accept": ["application/json"], diff --git a/specification/_json_spec/synonyms.get_synonyms_sets.json b/specification/_json_spec/synonyms.get_synonyms_sets.json index 62f160dea9..9da5296a59 100644 --- a/specification/_json_spec/synonyms.get_synonyms_sets.json +++ b/specification/_json_spec/synonyms.get_synonyms_sets.json @@ -4,7 +4,7 @@ "url": "https://www.elastic.co/guide/en/elasticsearch/reference/master/list-synonyms-sets.html", "description": "Retrieves a summary of all defined synonym sets" }, - "stability": "experimental", + "stability": "stable", "visibility": "public", "headers": { "accept": ["application/json"] diff --git a/specification/_json_spec/synonyms.put_synonym.json b/specification/_json_spec/synonyms.put_synonym.json index 2aab7e5f48..b29d7670f9 100644 --- a/specification/_json_spec/synonyms.put_synonym.json +++ b/specification/_json_spec/synonyms.put_synonym.json @@ -4,7 +4,7 @@ "url": "https://www.elastic.co/guide/en/elasticsearch/reference/master/put-synonyms-set.html", "description": "Creates or updates a synonyms set" }, - "stability": "experimental", + "stability": "stable", "visibility": "public", "headers": { "accept": ["application/json"], diff --git a/specification/_json_spec/synonyms.put_synonym_rule.json b/specification/_json_spec/synonyms.put_synonym_rule.json index 05ce8234c6..116a705574 100644 --- a/specification/_json_spec/synonyms.put_synonym_rule.json +++ b/specification/_json_spec/synonyms.put_synonym_rule.json @@ -4,7 +4,7 @@ "url": "https://www.elastic.co/guide/en/elasticsearch/reference/master/put-synonym-rule.html", "description": "Creates or updates a synonym rule in a synonym set" }, - "stability": "experimental", + "stability": "stable", "visibility": "public", "headers": { "accept": ["application/json"], diff --git a/specification/synonyms/delete_synonym/SynonymsDeleteRequest.ts b/specification/synonyms/delete_synonym/SynonymsDeleteRequest.ts index cc781f8745..6e6aeeb3ad 100644 --- a/specification/synonyms/delete_synonym/SynonymsDeleteRequest.ts +++ b/specification/synonyms/delete_synonym/SynonymsDeleteRequest.ts @@ -22,8 +22,8 @@ import { Id } from '@_types/common' /** * Deletes a synonym set * @rest_spec_name synonyms.delete_synonym - * @availability stack since=8.10.0 stability=experimental - * @availability serverless stability=experimental visibility=public + * @availability stack since=8.10.0 stability=stable + * @availability serverless stability=stable visibility=public */ export interface Request extends RequestBase { path_parts: { diff --git a/specification/synonyms/delete_synonym_rule/SynonymRuleDeleteRequest.ts b/specification/synonyms/delete_synonym_rule/SynonymRuleDeleteRequest.ts index 7a9c87ff98..ec2af20641 100644 --- a/specification/synonyms/delete_synonym_rule/SynonymRuleDeleteRequest.ts +++ b/specification/synonyms/delete_synonym_rule/SynonymRuleDeleteRequest.ts @@ -22,8 +22,8 @@ import { Id } from '@_types/common' /** * Deletes a synonym rule in a synonym set * @rest_spec_name synonyms.delete_synonym_rule - * @availability stack since=8.10.0 stability=experimental - * @availability serverless stability=experimental visibility=public + * @availability stack since=8.10.0 stability=stable + * @availability serverless stability=stable visibility=public */ export interface Request extends RequestBase { path_parts: { diff --git a/specification/synonyms/get_synonym/SynonymsGetRequest.ts b/specification/synonyms/get_synonym/SynonymsGetRequest.ts index 6bb218b075..10490a7b04 100644 --- a/specification/synonyms/get_synonym/SynonymsGetRequest.ts +++ b/specification/synonyms/get_synonym/SynonymsGetRequest.ts @@ -23,8 +23,8 @@ import { integer } from '@_types/Numeric' /** * Retrieves a synonym set * @rest_spec_name synonyms.get_synonym - * @availability stack since=8.10.0 stability=experimental - * @availability serverless stability=experimental visibility=public + * @availability stack since=8.10.0 stability=stable + * @availability serverless stability=stable visibility=public */ export interface Request extends RequestBase { path_parts: { diff --git a/specification/synonyms/get_synonym_rule/SynonymRuleGetRequest.ts b/specification/synonyms/get_synonym_rule/SynonymRuleGetRequest.ts index 77b752724f..5f2116dc59 100644 --- a/specification/synonyms/get_synonym_rule/SynonymRuleGetRequest.ts +++ b/specification/synonyms/get_synonym_rule/SynonymRuleGetRequest.ts @@ -22,8 +22,8 @@ import { Id } from '@_types/common' /** * Retrieves a synonym rule from a synonym set * @rest_spec_name synonyms.get_synonym_rule - * @availability stack since=8.10.0 stability=experimental - * @availability serverless stability=experimental visibility=public + * @availability stack since=8.10.0 stability=stable + * @availability serverless stability=stable visibility=public */ export interface Request extends RequestBase { path_parts: { diff --git a/specification/synonyms/get_synonyms_sets/SynonymsSetsGetRequest.ts b/specification/synonyms/get_synonyms_sets/SynonymsSetsGetRequest.ts index 6b0c034bf1..49a7e518b3 100644 --- a/specification/synonyms/get_synonyms_sets/SynonymsSetsGetRequest.ts +++ b/specification/synonyms/get_synonyms_sets/SynonymsSetsGetRequest.ts @@ -22,8 +22,8 @@ import { integer } from '@_types/Numeric' /** * Retrieves a summary of all defined synonym sets * @rest_spec_name synonyms.get_synonyms_sets - * @availability stack since=8.10.0 stability=experimental - * @availability serverless stability=experimental visibility=public + * @availability stack since=8.10.0 stability=stable + * @availability serverless stability=stable visibility=public */ export interface Request extends RequestBase { query_parameters: { diff --git a/specification/synonyms/put_synonym/SynonymsPutRequest.ts b/specification/synonyms/put_synonym/SynonymsPutRequest.ts index e0b5e9c57c..2032a21fa3 100644 --- a/specification/synonyms/put_synonym/SynonymsPutRequest.ts +++ b/specification/synonyms/put_synonym/SynonymsPutRequest.ts @@ -23,8 +23,8 @@ import { SynonymRule } from '../_types/SynonymRule' /** * Creates or updates a synonym set. * @rest_spec_name synonyms.put_synonym - * @availability stack since=8.10.0 stability=experimental - * @availability serverless stability=experimental visibility=public + * @availability stack since=8.10.0 stability=stable + * @availability serverless stability=stable visibility=public */ export interface Request extends RequestBase { path_parts: { diff --git a/specification/synonyms/put_synonym_rule/SynonymRulePutRequest.ts b/specification/synonyms/put_synonym_rule/SynonymRulePutRequest.ts index 30bb5374d6..bae6a60ae1 100644 --- a/specification/synonyms/put_synonym_rule/SynonymRulePutRequest.ts +++ b/specification/synonyms/put_synonym_rule/SynonymRulePutRequest.ts @@ -23,8 +23,8 @@ import { SynonymString } from '../_types/SynonymRule' /** * Creates or updates a synonym rule in a synonym set * @rest_spec_name synonyms.put_synonym_rule - * @availability stack since=8.10.0 stability=experimental - * @availability serverless stability=experimental visibility=public + * @availability stack since=8.10.0 stability=stable + * @availability serverless stability=stable visibility=public */ export interface Request extends RequestBase { path_parts: { From 85c0494c3f80e50c6db194b9eb7f2d88b7b4f43a Mon Sep 17 00:00:00 2001 From: Josh Mock Date: Thu, 14 Dec 2023 09:53:38 -0600 Subject: [PATCH 07/12] Enrich policy query should be a QueryContainer (#2347) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * query should be a QueryContainer https://github.com/elastic/elasticsearch-js/issues/2074 * Update specification/enrich/_types/Policy.ts Co-authored-by: Laurent Saint-Félix --------- Co-authored-by: Laurent Saint-Félix --- specification/enrich/_types/Policy.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/specification/enrich/_types/Policy.ts b/specification/enrich/_types/Policy.ts index aad7b99c37..7c41c7a907 100644 --- a/specification/enrich/_types/Policy.ts +++ b/specification/enrich/_types/Policy.ts @@ -18,6 +18,7 @@ */ import { Field, Fields, Indices, Name } from '@_types/common' +import { QueryContainer } from '@_types/query_dsl/abstractions' import { SingleKeyDictionary } from '@spec_utils/Dictionary' export class Summary { @@ -34,7 +35,7 @@ export class Policy { enrich_fields: Fields indices: Indices match_field: Field - query?: string + query?: QueryContainer name?: Name elasticsearch_version?: string } From 5c8fed5fe577b0d5e9fde34fb13795c5a66fe9fe Mon Sep 17 00:00:00 2001 From: Elastic Machine Date: Thu, 14 Dec 2023 15:54:23 +0000 Subject: [PATCH 08/12] Update specification output --- output/openapi/elasticsearch-serverless-openapi.json | 2 +- output/schema/schema.json | 10 +++++----- output/typescript/types.ts | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/output/openapi/elasticsearch-serverless-openapi.json b/output/openapi/elasticsearch-serverless-openapi.json index b0a8df86d6..7df370f195 100644 --- a/output/openapi/elasticsearch-serverless-openapi.json +++ b/output/openapi/elasticsearch-serverless-openapi.json @@ -47579,7 +47579,7 @@ "$ref": "#/components/schemas/_types:Field" }, "query": { - "type": "string" + "$ref": "#/components/schemas/_types.query_dsl:QueryContainer" }, "name": { "$ref": "#/components/schemas/_types:Name" diff --git a/output/schema/schema.json b/output/schema/schema.json index 101cf97acf..e69370bd58 100644 --- a/output/schema/schema.json +++ b/output/schema/schema.json @@ -104563,8 +104563,8 @@ "type": { "kind": "instance_of", "type": { - "name": "string", - "namespace": "_builtins" + "name": "QueryContainer", + "namespace": "_types.query_dsl" } } }, @@ -104591,7 +104591,7 @@ } } ], - "specLocation": "enrich/_types/Policy.ts#L33-L40" + "specLocation": "enrich/_types/Policy.ts#L34-L41" }, { "kind": "enum", @@ -104610,7 +104610,7 @@ "name": "PolicyType", "namespace": "enrich._types" }, - "specLocation": "enrich/_types/Policy.ts#L27-L31" + "specLocation": "enrich/_types/Policy.ts#L28-L32" }, { "kind": "interface", @@ -104642,7 +104642,7 @@ } } ], - "specLocation": "enrich/_types/Policy.ts#L23-L25" + "specLocation": "enrich/_types/Policy.ts#L24-L26" }, { "attachedBehaviors": [ diff --git a/output/typescript/types.ts b/output/typescript/types.ts index 10754b57d8..304a26c4a3 100644 --- a/output/typescript/types.ts +++ b/output/typescript/types.ts @@ -9062,7 +9062,7 @@ export interface EnrichPolicy { enrich_fields: Fields indices: Indices match_field: Field - query?: string + query?: QueryDslQueryContainer name?: Name elasticsearch_version?: string } From 6d9c9c8d6ce3d43dc50df7f3a26270db87215875 Mon Sep 17 00:00:00 2001 From: Kathleen DeRusso Date: Thu, 21 Dec 2023 12:30:34 -0500 Subject: [PATCH 09/12] Add token pruning to clients for text expansion query (#2370) * Add pruning config to text_expansion query * Add weighted tokens query * Linting * PR feedback - float to int * PR feedback - omit value * Revise comment * PR feedback, remove additional property * Linting --- output/schema/schema.json | 172 +++++++++++++++++- output/typescript/types.ts | 13 ++ .../_types/query_dsl/TextExpansionQuery.ts | 6 + .../_types/query_dsl/TokenPruningConfig.ts | 35 ++++ .../_types/query_dsl/WeightedTokensQuery.ts | 32 ++++ .../_types/query_dsl/abstractions.ts | 8 + 6 files changed, 257 insertions(+), 9 deletions(-) create mode 100644 specification/_types/query_dsl/TokenPruningConfig.ts create mode 100644 specification/_types/query_dsl/WeightedTokensQuery.ts diff --git a/output/schema/schema.json b/output/schema/schema.json index e69370bd58..598fa8e769 100644 --- a/output/schema/schema.json +++ b/output/schema/schema.json @@ -72046,7 +72046,7 @@ "name": "CombinedFieldsOperator", "namespace": "_types.query_dsl" }, - "specLocation": "_types/query_dsl/abstractions.ts#L473-L476" + "specLocation": "_types/query_dsl/abstractions.ts#L481-L484" }, { "inherits": { @@ -72142,7 +72142,7 @@ } } ], - "specLocation": "_types/query_dsl/abstractions.ts#L429-L463" + "specLocation": "_types/query_dsl/abstractions.ts#L437-L471" }, { "kind": "enum", @@ -72160,7 +72160,7 @@ "name": "CombinedFieldsZeroTerms", "namespace": "_types.query_dsl" }, - "specLocation": "_types/query_dsl/abstractions.ts#L478-L487" + "specLocation": "_types/query_dsl/abstractions.ts#L486-L495" }, { "inherits": { @@ -72838,7 +72838,7 @@ } ], "shortcutProperty": "field", - "specLocation": "_types/query_dsl/abstractions.ts#L489-L503" + "specLocation": "_types/query_dsl/abstractions.ts#L497-L511" }, { "kind": "interface", @@ -72896,7 +72896,7 @@ } } ], - "specLocation": "_types/query_dsl/abstractions.ts#L393-L410" + "specLocation": "_types/query_dsl/abstractions.ts#L401-L418" }, { "kind": "enum", @@ -76634,7 +76634,7 @@ } } ], - "specLocation": "_types/query_dsl/abstractions.ts#L416-L427" + "specLocation": "_types/query_dsl/abstractions.ts#L424-L435" }, { "docId": "query-dsl", @@ -77550,6 +77550,37 @@ } } }, + { + "availability": { + "serverless": {}, + "stack": { + "since": "8.13.0" + } + }, + "description": "Supports returning text_expansion query results by sending in precomputed tokens with the query.", + "docId": "query-dsl-weighted-tokens-query", + "name": "weighted_tokens", + "required": false, + "since": "8.13.0", + "type": { + "key": { + "kind": "instance_of", + "type": { + "name": "Field", + "namespace": "_types" + } + }, + "kind": "dictionary_of", + "singleKey": true, + "value": { + "kind": "instance_of", + "type": { + "name": "WeightedTokensQuery", + "namespace": "_types.query_dsl" + } + } + } + }, { "description": "Returns documents that contain terms matching a wildcard pattern.", "docId": "query-dsl-wildcard-query", @@ -77605,7 +77636,7 @@ } } ], - "specLocation": "_types/query_dsl/abstractions.ts#L98-L391", + "specLocation": "_types/query_dsl/abstractions.ts#L99-L399", "variants": { "kind": "container", "nonExhaustive": true @@ -79707,9 +79738,32 @@ "namespace": "_builtins" } } + }, + { + "availability": { + "serverless": { + "stability": "experimental" + }, + "stack": { + "since": "8.13.0", + "stability": "experimental" + } + }, + "description": "Token pruning configurations", + "name": "pruning_config", + "required": false, + "since": "8.13.0", + "stability": "experimental", + "type": { + "kind": "instance_of", + "type": { + "name": "TokenPruningConfig", + "namespace": "_types.query_dsl" + } + } } ], - "specLocation": "_types/query_dsl/TextExpansionQuery.ts#L22-L27" + "specLocation": "_types/query_dsl/TextExpansionQuery.ts#L23-L33" }, { "kind": "enum", @@ -79745,6 +79799,55 @@ }, "specLocation": "_types/query_dsl/fulltext.ts#L541-L567" }, + { + "kind": "interface", + "name": { + "name": "TokenPruningConfig", + "namespace": "_types.query_dsl" + }, + "properties": [ + { + "description": "Tokens whose frequency is more than this threshold times the average frequency of all tokens in the specified field are considered outliers and pruned.", + "name": "tokens_freq_ratio_threshold", + "required": false, + "serverDefault": 5, + "type": { + "kind": "instance_of", + "type": { + "name": "integer", + "namespace": "_types" + } + } + }, + { + "description": "Tokens whose weight is less than this threshold are considered nonsignificant and pruned.", + "name": "tokens_weight_threshold", + "required": false, + "serverDefault": 0.4, + "type": { + "kind": "instance_of", + "type": { + "name": "float", + "namespace": "_types" + } + } + }, + { + "description": "Whether to only score pruned tokens, vs only scoring kept tokens.", + "name": "only_score_pruned_tokens", + "required": false, + "serverDefault": false, + "type": { + "kind": "instance_of", + "type": { + "name": "boolean", + "namespace": "_builtins" + } + } + } + ], + "specLocation": "_types/query_dsl/TokenPruningConfig.ts#L22-L35" + }, { "inherits": { "type": { @@ -79772,6 +79875,57 @@ ], "specLocation": "_types/query_dsl/term.ts#L264-L266" }, + { + "inherits": { + "type": { + "name": "QueryBase", + "namespace": "_types.query_dsl" + } + }, + "kind": "interface", + "name": { + "name": "WeightedTokensQuery", + "namespace": "_types.query_dsl" + }, + "properties": [ + { + "description": "The tokens representing this query", + "name": "tokens", + "required": true, + "type": { + "key": { + "kind": "instance_of", + "type": { + "name": "string", + "namespace": "_builtins" + } + }, + "kind": "dictionary_of", + "singleKey": false, + "value": { + "kind": "instance_of", + "type": { + "name": "float", + "namespace": "_types" + } + } + } + }, + { + "description": "Token pruning configurations", + "name": "pruning_config", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "TokenPruningConfig", + "namespace": "_types.query_dsl" + } + } + } + ], + "specLocation": "_types/query_dsl/WeightedTokensQuery.ts#L27-L34" + }, { "inherits": { "type": { @@ -79872,7 +80026,7 @@ } } ], - "specLocation": "_types/query_dsl/abstractions.ts#L465-L471" + "specLocation": "_types/query_dsl/abstractions.ts#L473-L479" }, { "kind": "enum", diff --git a/output/typescript/types.ts b/output/typescript/types.ts index 304a26c4a3..3e949e4ff1 100644 --- a/output/typescript/types.ts +++ b/output/typescript/types.ts @@ -5857,6 +5857,7 @@ export interface QueryDslQueryContainer { terms?: QueryDslTermsQuery terms_set?: Partial> text_expansion?: Partial> + weighted_tokens?: Partial> wildcard?: Partial> wrapper?: QueryDslWrapperQuery type?: QueryDslTypeQuery @@ -6081,14 +6082,26 @@ export interface QueryDslTermsSetQuery extends QueryDslQueryBase { export interface QueryDslTextExpansionQuery extends QueryDslQueryBase { model_id: string model_text: string + pruning_config?: QueryDslTokenPruningConfig } export type QueryDslTextQueryType = 'best_fields' | 'most_fields' | 'cross_fields' | 'phrase' | 'phrase_prefix' | 'bool_prefix' +export interface QueryDslTokenPruningConfig { + tokens_freq_ratio_threshold?: integer + tokens_weight_threshold?: float + only_score_pruned_tokens?: boolean +} + export interface QueryDslTypeQuery extends QueryDslQueryBase { value: string } +export interface QueryDslWeightedTokensQuery extends QueryDslQueryBase { + tokens: Record + pruning_config?: QueryDslTokenPruningConfig +} + export interface QueryDslWildcardQuery extends QueryDslQueryBase { case_insensitive?: boolean rewrite?: MultiTermQueryRewrite diff --git a/specification/_types/query_dsl/TextExpansionQuery.ts b/specification/_types/query_dsl/TextExpansionQuery.ts index b9edb9096f..c5de55bfcb 100644 --- a/specification/_types/query_dsl/TextExpansionQuery.ts +++ b/specification/_types/query_dsl/TextExpansionQuery.ts @@ -17,6 +17,7 @@ * under the License. */ +import { TokenPruningConfig } from './TokenPruningConfig' import { QueryBase } from './abstractions' export class TextExpansionQuery extends QueryBase { @@ -24,4 +25,9 @@ export class TextExpansionQuery extends QueryBase { model_id: string /** The query text */ model_text: string + /** Token pruning configurations + * @availability stack since=8.13.0 stability=experimental + * @availability serverless stability=experimental + */ + pruning_config?: TokenPruningConfig } diff --git a/specification/_types/query_dsl/TokenPruningConfig.ts b/specification/_types/query_dsl/TokenPruningConfig.ts new file mode 100644 index 0000000000..424f535464 --- /dev/null +++ b/specification/_types/query_dsl/TokenPruningConfig.ts @@ -0,0 +1,35 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import { float, integer } from '@_types/Numeric' + +export class TokenPruningConfig { + /** Tokens whose frequency is more than this threshold times the average frequency of all tokens in the specified field are considered outliers and pruned. + * @server_default 5 + */ + tokens_freq_ratio_threshold?: integer + /** Tokens whose weight is less than this threshold are considered nonsignificant and pruned. + * @server_default 0.4 + */ + tokens_weight_threshold?: float + /** Whether to only score pruned tokens, vs only scoring kept tokens. + * @server_default false + */ + only_score_pruned_tokens?: boolean +} diff --git a/specification/_types/query_dsl/WeightedTokensQuery.ts b/specification/_types/query_dsl/WeightedTokensQuery.ts new file mode 100644 index 0000000000..31a073ad24 --- /dev/null +++ b/specification/_types/query_dsl/WeightedTokensQuery.ts @@ -0,0 +1,32 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import { AdditionalProperty } from '@spec_utils/behaviors' +import { TokenPruningConfig } from './TokenPruningConfig' +import { QueryBase } from './abstractions' +import { Field, FieldValue } from '@_types/common' +import { Dictionary } from '@spec_utils/Dictionary' +import { float } from '@_types/Numeric' + +export class WeightedTokensQuery extends QueryBase { + /** The tokens representing this query */ + tokens: Dictionary + /** Token pruning configurations */ + pruning_config?: TokenPruningConfig +} diff --git a/specification/_types/query_dsl/abstractions.ts b/specification/_types/query_dsl/abstractions.ts index f89828fc0a..ef4bd0fc37 100644 --- a/specification/_types/query_dsl/abstractions.ts +++ b/specification/_types/query_dsl/abstractions.ts @@ -94,6 +94,7 @@ import { WildcardQuery } from './term' import { TextExpansionQuery } from './TextExpansionQuery' +import { WeightedTokensQuery } from './WeightedTokensQuery' /** * @variants container @@ -373,6 +374,13 @@ export class QueryContainer { * @doc_id query-dsl-text-expansion-query */ text_expansion?: SingleKeyDictionary + /** + * Supports returning text_expansion query results by sending in precomputed tokens with the query. + * @availability stack since=8.13.0 + * @availability serverless + * @doc_id query-dsl-weighted-tokens-query + */ + weighted_tokens?: SingleKeyDictionary /** * Returns documents that contain terms matching a wildcard pattern. * @doc_id query-dsl-wildcard-query From e16324dcde9297dd1149c1ef3d6d58afe272e646 Mon Sep 17 00:00:00 2001 From: Elastic Machine Date: Thu, 21 Dec 2023 17:31:17 +0000 Subject: [PATCH 10/12] Update specification output --- .../elasticsearch-serverless-openapi.json | 54 +++++++++++++++++++ output/schema/schema.json | 2 +- 2 files changed, 55 insertions(+), 1 deletion(-) diff --git a/output/openapi/elasticsearch-serverless-openapi.json b/output/openapi/elasticsearch-serverless-openapi.json index 7df370f195..bb5ca73e07 100644 --- a/output/openapi/elasticsearch-serverless-openapi.json +++ b/output/openapi/elasticsearch-serverless-openapi.json @@ -32226,6 +32226,15 @@ "minProperties": 1, "maxProperties": 1 }, + "weighted_tokens": { + "description": "Supports returning text_expansion query results by sending in precomputed tokens with the query.", + "type": "object", + "additionalProperties": { + "$ref": "#/components/schemas/_types.query_dsl:WeightedTokensQuery" + }, + "minProperties": 1, + "maxProperties": 1 + }, "wildcard": { "externalDocs": { "url": "https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-wildcard-query.html" @@ -36022,6 +36031,9 @@ "model_text": { "description": "The query text", "type": "string" + }, + "pruning_config": { + "$ref": "#/components/schemas/_types.query_dsl:TokenPruningConfig" } }, "required": [ @@ -36031,6 +36043,48 @@ } ] }, + "_types.query_dsl:TokenPruningConfig": { + "type": "object", + "properties": { + "tokens_freq_ratio_threshold": { + "description": "Tokens whose frequency is more than this threshold times the average frequency of all tokens in the specified field are considered outliers and pruned.", + "type": "number" + }, + "tokens_weight_threshold": { + "description": "Tokens whose weight is less than this threshold are considered nonsignificant and pruned.", + "type": "number" + }, + "only_score_pruned_tokens": { + "description": "Whether to only score pruned tokens, vs only scoring kept tokens.", + "type": "boolean" + } + } + }, + "_types.query_dsl:WeightedTokensQuery": { + "allOf": [ + { + "$ref": "#/components/schemas/_types.query_dsl:QueryBase" + }, + { + "type": "object", + "properties": { + "tokens": { + "description": "The tokens representing this query", + "type": "object", + "additionalProperties": { + "type": "number" + } + }, + "pruning_config": { + "$ref": "#/components/schemas/_types.query_dsl:TokenPruningConfig" + } + }, + "required": [ + "tokens" + ] + } + ] + }, "_types.query_dsl:WildcardQuery": { "allOf": [ { diff --git a/output/schema/schema.json b/output/schema/schema.json index 598fa8e769..c0cbfc318f 100644 --- a/output/schema/schema.json +++ b/output/schema/schema.json @@ -79924,7 +79924,7 @@ } } ], - "specLocation": "_types/query_dsl/WeightedTokensQuery.ts#L27-L34" + "specLocation": "_types/query_dsl/WeightedTokensQuery.ts#L27-L32" }, { "inherits": { From da3953930dd160c3591a524af6cd552d388c3836 Mon Sep 17 00:00:00 2001 From: Nikolaj Volgushev Date: Fri, 22 Dec 2023 16:04:35 +0100 Subject: [PATCH 11/12] Add `active_only` flag definition to Get API key spec (#2371) --- .../security/get_api_key/SecurityGetApiKeyRequest.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/specification/security/get_api_key/SecurityGetApiKeyRequest.ts b/specification/security/get_api_key/SecurityGetApiKeyRequest.ts index 10fee95bda..84ef1f8ce3 100644 --- a/specification/security/get_api_key/SecurityGetApiKeyRequest.ts +++ b/specification/security/get_api_key/SecurityGetApiKeyRequest.ts @@ -68,5 +68,12 @@ export interface Request extends RequestBase { * @availability serverless */ with_limited_by?: boolean + /** + * A boolean flag that can be used to query API keys that are currently active. An API key is considered active if it is neither invalidated, nor expired at query time. You can specify this together with other parameters such as `owner` or `name`. If `active_only` is false, the response will include both active and inactive (expired or invalidated) keys. + * @server_default false + * @availability stack since=8.10.0 + * @availability serverless + */ + active_only?: boolean } } From 02708373c6a3df38f81bf6be39c23f6f916ae5e9 Mon Sep 17 00:00:00 2001 From: Elastic Machine Date: Fri, 22 Dec 2023 15:05:18 +0000 Subject: [PATCH 12/12] Update specification output --- .../elasticsearch-serverless-openapi.json | 10 +++++++++ output/schema/schema.json | 22 ++++++++++++++++++- output/schema/validation-errors.json | 6 +++++ output/typescript/types.ts | 1 + 4 files changed, 38 insertions(+), 1 deletion(-) diff --git a/output/openapi/elasticsearch-serverless-openapi.json b/output/openapi/elasticsearch-serverless-openapi.json index bb5ca73e07..3ffcbb3d11 100644 --- a/output/openapi/elasticsearch-serverless-openapi.json +++ b/output/openapi/elasticsearch-serverless-openapi.json @@ -15605,6 +15605,16 @@ "type": "boolean" }, "style": "form" + }, + { + "in": "query", + "name": "active_only", + "description": "A boolean flag that can be used to query API keys that are currently active. An API key is considered active if it is neither invalidated, nor expired at query time. You can specify this together with other parameters such as `owner` or `name`. If `active_only` is false, the response will include both active and inactive (expired or invalidated) keys.", + "deprecated": false, + "schema": { + "type": "boolean" + }, + "style": "form" } ], "responses": { diff --git a/output/schema/schema.json b/output/schema/schema.json index c0cbfc318f..9e994b62af 100644 --- a/output/schema/schema.json +++ b/output/schema/schema.json @@ -174950,9 +174950,29 @@ "namespace": "_builtins" } } + }, + { + "availability": { + "serverless": {}, + "stack": { + "since": "8.10.0" + } + }, + "description": "A boolean flag that can be used to query API keys that are currently active. An API key is considered active if it is neither invalidated, nor expired at query time. You can specify this together with other parameters such as `owner` or `name`. If `active_only` is false, the response will include both active and inactive (expired or invalidated) keys.", + "name": "active_only", + "required": false, + "serverDefault": false, + "since": "8.10.0", + "type": { + "kind": "instance_of", + "type": { + "name": "boolean", + "namespace": "_builtins" + } + } } ], - "specLocation": "security/get_api_key/SecurityGetApiKeyRequest.ts#L23-L72" + "specLocation": "security/get_api_key/SecurityGetApiKeyRequest.ts#L23-L79" }, { "body": { diff --git a/output/schema/validation-errors.json b/output/schema/validation-errors.json index c894b6ea49..06f921e197 100644 --- a/output/schema/validation-errors.json +++ b/output/schema/validation-errors.json @@ -1258,6 +1258,12 @@ "response definition security.enable_user_profile:Response / body / instance_of - Non-leaf type cannot be used here: '_types:AcknowledgedResponseBase'" ] }, + "security.get_api_key": { + "request": [ + "Request: query parameter 'active_only' does not exist in the json spec" + ], + "response": [] + }, "security.get_settings": { "request": [ "Missing request & response" diff --git a/output/typescript/types.ts b/output/typescript/types.ts index 3e949e4ff1..041a210e1e 100644 --- a/output/typescript/types.ts +++ b/output/typescript/types.ts @@ -16482,6 +16482,7 @@ export interface SecurityGetApiKeyRequest extends RequestBase { realm_name?: Name username?: Username with_limited_by?: boolean + active_only?: boolean } export interface SecurityGetApiKeyResponse {