diff --git a/output/openapi/elasticsearch-openapi.json b/output/openapi/elasticsearch-openapi.json index ba8611effc..da6965c918 100644 --- a/output/openapi/elasticsearch-openapi.json +++ b/output/openapi/elasticsearch-openapi.json @@ -56286,7 +56286,7 @@ "type": "boolean" }, "pruning_config": { - "$ref": "#/components/schemas/_types.query_dsl.TokenPruningConfig" + "$ref": "#/components/schemas/_types.TokenPruningConfig" } }, "required": [ @@ -56314,7 +56314,7 @@ } ] }, - "_types.query_dsl.TokenPruningConfig": { + "_types.TokenPruningConfig": { "type": "object", "properties": { "tokens_freq_ratio_threshold": { @@ -56412,7 +56412,7 @@ "type": "string" }, "pruning_config": { - "$ref": "#/components/schemas/_types.query_dsl.TokenPruningConfig" + "$ref": "#/components/schemas/_types.TokenPruningConfig" } }, "required": [ @@ -56451,7 +56451,7 @@ ] }, "pruning_config": { - "$ref": "#/components/schemas/_types.query_dsl.TokenPruningConfig" + "$ref": "#/components/schemas/_types.TokenPruningConfig" } }, "required": [ @@ -72272,6 +72272,9 @@ "enum": [ "sparse_vector" ] + }, + "index_options": { + "$ref": "#/components/schemas/_types.mapping.SparseVectorIndexOptions" } }, "required": [ @@ -72280,6 +72283,19 @@ } ] }, + "_types.mapping.SparseVectorIndexOptions": { + "type": "object", + "properties": { + "prune": { + "description": "Whether to perform pruning, omitting the non-significant tokens from the query to improve query performance.\nIf prune is true but the pruning_config is not specified, pruning will occur but default values will be used.\nDefault: false", + "x-state": "Generally available; Added in 8.19.0", + "type": "boolean" + }, + "pruning_config": { + "$ref": "#/components/schemas/_types.TokenPruningConfig" + } + } + }, "_types.mapping.CompletionProperty": { "allOf": [ { diff --git a/output/openapi/elasticsearch-serverless-openapi.json b/output/openapi/elasticsearch-serverless-openapi.json index de0ec42750..60e31eb566 100644 --- a/output/openapi/elasticsearch-serverless-openapi.json +++ b/output/openapi/elasticsearch-serverless-openapi.json @@ -34940,7 +34940,7 @@ "type": "boolean" }, "pruning_config": { - "$ref": "#/components/schemas/_types.query_dsl.TokenPruningConfig" + "$ref": "#/components/schemas/_types.TokenPruningConfig" } }, "required": [ @@ -34968,7 +34968,7 @@ } ] }, - "_types.query_dsl.TokenPruningConfig": { + "_types.TokenPruningConfig": { "type": "object", "properties": { "tokens_freq_ratio_threshold": { @@ -35066,7 +35066,7 @@ "type": "string" }, "pruning_config": { - "$ref": "#/components/schemas/_types.query_dsl.TokenPruningConfig" + "$ref": "#/components/schemas/_types.TokenPruningConfig" } }, "required": [ @@ -35105,7 +35105,7 @@ ] }, "pruning_config": { - "$ref": "#/components/schemas/_types.query_dsl.TokenPruningConfig" + "$ref": "#/components/schemas/_types.TokenPruningConfig" } }, "required": [ @@ -47973,6 +47973,9 @@ "enum": [ "sparse_vector" ] + }, + "index_options": { + "$ref": "#/components/schemas/_types.mapping.SparseVectorIndexOptions" } }, "required": [ @@ -47981,6 +47984,19 @@ } ] }, + "_types.mapping.SparseVectorIndexOptions": { + "type": "object", + "properties": { + "prune": { + "description": "Whether to perform pruning, omitting the non-significant tokens from the query to improve query performance.\nIf prune is true but the pruning_config is not specified, pruning will occur but default values will be used.\nDefault: false", + "x-state": "Generally available", + "type": "boolean" + }, + "pruning_config": { + "$ref": "#/components/schemas/_types.TokenPruningConfig" + } + } + }, "_types.mapping.CompletionProperty": { "allOf": [ { diff --git a/output/schema/schema.json b/output/schema/schema.json index 39eb756f7f..dacdb63730 100644 --- a/output/schema/schema.json +++ b/output/schema/schema.json @@ -57999,6 +57999,55 @@ } } }, + { + "kind": "interface", + "name": { + "name": "TokenPruningConfig", + "namespace": "_types" + }, + "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/TokenPruningConfig.ts#L22-L35" + }, { "kind": "interface", "name": { @@ -81642,7 +81691,7 @@ } } ], - "specLocation": "_types/mapping/core.ts#L56-L58" + "specLocation": "_types/mapping/core.ts#L57-L59" }, { "kind": "interface", @@ -81763,7 +81812,7 @@ } } ], - "specLocation": "_types/mapping/core.ts#L60-L75" + "specLocation": "_types/mapping/core.ts#L61-L76" }, { "kind": "interface", @@ -81798,7 +81847,7 @@ } } ], - "specLocation": "_types/mapping/core.ts#L187-L190" + "specLocation": "_types/mapping/core.ts#L188-L191" }, { "kind": "interface", @@ -82063,7 +82112,7 @@ } } ], - "specLocation": "_types/mapping/core.ts#L47-L50" + "specLocation": "_types/mapping/core.ts#L48-L51" }, { "kind": "interface", @@ -82231,7 +82280,7 @@ } } ], - "specLocation": "_types/mapping/core.ts#L91-L101" + "specLocation": "_types/mapping/core.ts#L92-L102" }, { "kind": "interface", @@ -82365,7 +82414,7 @@ } } ], - "specLocation": "_types/mapping/core.ts#L77-L89" + "specLocation": "_types/mapping/core.ts#L78-L90" }, { "kind": "interface", @@ -82697,7 +82746,7 @@ } } ], - "specLocation": "_types/mapping/core.ts#L52-L54" + "specLocation": "_types/mapping/core.ts#L53-L55" }, { "kind": "interface", @@ -82732,7 +82781,7 @@ } } ], - "specLocation": "_types/mapping/core.ts#L167-L170" + "specLocation": "_types/mapping/core.ts#L168-L171" }, { "kind": "interface", @@ -83057,7 +83106,7 @@ } } ], - "specLocation": "_types/mapping/core.ts#L352-L383" + "specLocation": "_types/mapping/core.ts#L360-L391" }, { "kind": "interface", @@ -83691,7 +83740,7 @@ } } ], - "specLocation": "_types/mapping/core.ts#L157-L160" + "specLocation": "_types/mapping/core.ts#L158-L161" }, { "kind": "interface", @@ -84005,7 +84054,7 @@ } } ], - "specLocation": "_types/mapping/core.ts#L162-L165" + "specLocation": "_types/mapping/core.ts#L163-L166" }, { "kind": "interface", @@ -84285,7 +84334,7 @@ "name": "IndexOptions", "namespace": "_types.mapping" }, - "specLocation": "_types/mapping/core.ts#L308-L313" + "specLocation": "_types/mapping/core.ts#L316-L321" }, { "kind": "interface", @@ -84320,7 +84369,7 @@ } } ], - "specLocation": "_types/mapping/core.ts#L172-L175" + "specLocation": "_types/mapping/core.ts#L173-L176" }, { "kind": "interface", @@ -84550,7 +84599,7 @@ } } ], - "specLocation": "_types/mapping/core.ts#L103-L107" + "specLocation": "_types/mapping/core.ts#L104-L108" }, { "kind": "interface", @@ -84727,7 +84776,7 @@ } } ], - "specLocation": "_types/mapping/core.ts#L109-L128" + "specLocation": "_types/mapping/core.ts#L110-L129" }, { "kind": "interface", @@ -84762,7 +84811,7 @@ } } ], - "specLocation": "_types/mapping/core.ts#L177-L180" + "specLocation": "_types/mapping/core.ts#L178-L181" }, { "kind": "interface", @@ -84867,7 +84916,7 @@ } } ], - "specLocation": "_types/mapping/core.ts#L281-L306" + "specLocation": "_types/mapping/core.ts#L289-L314" }, { "kind": "enum", @@ -85087,7 +85136,7 @@ } } ], - "specLocation": "_types/mapping/core.ts#L130-L150" + "specLocation": "_types/mapping/core.ts#L131-L151" }, { "kind": "interface", @@ -85149,7 +85198,7 @@ "name": "OnScriptError", "namespace": "_types.mapping" }, - "specLocation": "_types/mapping/core.ts#L152-L155" + "specLocation": "_types/mapping/core.ts#L153-L156" }, { "kind": "interface", @@ -85230,7 +85279,7 @@ } } ], - "specLocation": "_types/mapping/core.ts#L203-L205" + "specLocation": "_types/mapping/core.ts#L204-L206" }, { "kind": "interface", @@ -85866,7 +85915,7 @@ } } ], - "specLocation": "_types/mapping/core.ts#L207-L210" + "specLocation": "_types/mapping/core.ts#L208-L211" }, { "kind": "interface", @@ -85901,7 +85950,7 @@ } } ], - "specLocation": "_types/mapping/core.ts#L212-L215" + "specLocation": "_types/mapping/core.ts#L213-L216" }, { "kind": "enum", @@ -85920,7 +85969,7 @@ "name": "RankVectorElementType", "namespace": "_types.mapping" }, - "specLocation": "_types/mapping/core.ts#L385-L389" + "specLocation": "_types/mapping/core.ts#L393-L397" }, { "kind": "interface", @@ -85967,7 +86016,7 @@ } } ], - "specLocation": "_types/mapping/core.ts#L217-L224" + "specLocation": "_types/mapping/core.ts#L218-L225" }, { "kind": "interface", @@ -86255,7 +86304,7 @@ } } ], - "specLocation": "_types/mapping/core.ts#L197-L201" + "specLocation": "_types/mapping/core.ts#L198-L202" }, { "kind": "interface", @@ -86390,7 +86439,7 @@ } } ], - "specLocation": "_types/mapping/core.ts#L262-L273" + "specLocation": "_types/mapping/core.ts#L270-L281" }, { "kind": "interface", @@ -86500,7 +86549,7 @@ } } ], - "specLocation": "_types/mapping/core.ts#L231-L260" + "specLocation": "_types/mapping/core.ts#L239-L268" }, { "kind": "interface", @@ -86606,7 +86655,7 @@ } } ], - "specLocation": "_types/mapping/core.ts#L182-L185" + "specLocation": "_types/mapping/core.ts#L183-L186" }, { "kind": "interface", @@ -86731,6 +86780,54 @@ }, "specLocation": "_types/mapping/meta-fields.ts#L67-L75" }, + { + "kind": "interface", + "name": { + "name": "SparseVectorIndexOptions", + "namespace": "_types.mapping" + }, + "properties": [ + { + "availability": { + "serverless": {}, + "stack": { + "since": "8.19.0" + } + }, + "containerProperty": true, + "description": "Whether to perform pruning, omitting the non-significant tokens from the query to improve query performance.\nIf prune is true but the pruning_config is not specified, pruning will occur but default values will be used.\nDefault: false", + "name": "prune", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "boolean", + "namespace": "_builtins" + } + } + }, + { + "availability": { + "serverless": {}, + "stack": { + "since": "8.19.0" + } + }, + "containerProperty": true, + "description": "Optional pruning configuration.\nIf enabled, this will omit non-significant tokens from the query in order to improve query performance.\nThis is only used if prune is set to true.\nIf prune is set to true but pruning_config is not specified, default values will be used.", + "name": "pruning_config", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "TokenPruningConfig", + "namespace": "_types" + } + } + } + ], + "specLocation": "_types/mapping/SparseVectorIndexOptions.ts#L22-L42" + }, { "kind": "interface", "inherits": { @@ -86762,9 +86859,27 @@ "kind": "literal_value", "value": "sparse_vector" } + }, + { + "availability": { + "serverless": {}, + "stack": { + "since": "8.19.0" + } + }, + "description": "Additional index options for the sparse vector field that controls the\ntoken pruning behavior of the sparse vector field.", + "name": "index_options", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "SparseVectorIndexOptions", + "namespace": "_types.mapping" + } + } } ], - "specLocation": "_types/mapping/core.ts#L226-L229" + "specLocation": "_types/mapping/core.ts#L227-L237" }, { "kind": "enum", @@ -86942,7 +87057,7 @@ } } ], - "specLocation": "_types/mapping/core.ts#L315-L318" + "specLocation": "_types/mapping/core.ts#L323-L326" }, { "kind": "interface", @@ -87155,7 +87270,7 @@ } } ], - "specLocation": "_types/mapping/core.ts#L320-L337" + "specLocation": "_types/mapping/core.ts#L328-L345" }, { "kind": "enum", @@ -87538,7 +87653,7 @@ } } ], - "specLocation": "_types/mapping/core.ts#L192-L195" + "specLocation": "_types/mapping/core.ts#L193-L196" }, { "kind": "interface", @@ -87562,7 +87677,7 @@ } } ], - "specLocation": "_types/mapping/core.ts#L339-L341" + "specLocation": "_types/mapping/core.ts#L347-L349" }, { "kind": "interface", @@ -87603,7 +87718,7 @@ } } ], - "specLocation": "_types/mapping/core.ts#L343-L350" + "specLocation": "_types/mapping/core.ts#L351-L358" }, { "kind": "interface", @@ -95777,7 +95892,7 @@ "kind": "instance_of", "type": { "name": "TokenPruningConfig", - "namespace": "_types.query_dsl" + "namespace": "_types" } } } @@ -96128,7 +96243,7 @@ "kind": "instance_of", "type": { "name": "TokenPruningConfig", - "namespace": "_types.query_dsl" + "namespace": "_types" } } } @@ -96169,55 +96284,6 @@ }, "specLocation": "_types/query_dsl/fulltext.ts#L610-L636" }, - { - "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" - }, { "kind": "interface", "inherits": { @@ -96411,7 +96477,7 @@ "kind": "instance_of", "type": { "name": "TokenPruningConfig", - "namespace": "_types.query_dsl" + "namespace": "_types" } } } diff --git a/output/typescript/types.ts b/output/typescript/types.ts index 6886c9aae0..b954626aeb 100644 --- a/output/typescript/types.ts +++ b/output/typescript/types.ts @@ -2987,6 +2987,12 @@ export type TimeUnit = 'nanos' | 'micros' | 'ms' | 's' | 'm' | 'h' | 'd' export type TimeZone = string +export interface TokenPruningConfig { + tokens_freq_ratio_threshold?: integer + tokens_weight_threshold?: float + only_score_pruned_tokens?: boolean +} + export interface TopLeftBottomRightGeoBounds { top_left: GeoLocation bottom_right: GeoLocation @@ -6022,9 +6028,15 @@ export interface MappingSourceField { export type MappingSourceFieldMode = 'disabled' | 'stored' | 'synthetic' +export interface MappingSparseVectorIndexOptions { + prune?: boolean + pruning_config?: TokenPruningConfig +} + export interface MappingSparseVectorProperty extends MappingPropertyBase { store?: boolean type: 'sparse_vector' + index_options?: MappingSparseVectorIndexOptions } export type MappingSubobjects = boolean | 'true' | 'false' | 'auto' @@ -6855,7 +6867,7 @@ export interface QueryDslSparseVectorQuery extends QueryDslQueryBase { inference_id?: Id query?: string prune?: boolean - pruning_config?: QueryDslTokenPruningConfig + pruning_config?: TokenPruningConfig } export interface QueryDslTermQuery extends QueryDslQueryBase { @@ -6890,17 +6902,11 @@ export interface QueryDslTermsSetQuery extends QueryDslQueryBase { export interface QueryDslTextExpansionQuery extends QueryDslQueryBase { model_id: string model_text: string - pruning_config?: QueryDslTokenPruningConfig + pruning_config?: TokenPruningConfig } 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 } @@ -6920,7 +6926,7 @@ export interface QueryDslUntypedRangeQuery extends QueryDslRangeQueryBase { export interface QueryDslWeightedTokensQuery extends QueryDslQueryBase { tokens: Record | Record[] - pruning_config?: QueryDslTokenPruningConfig + pruning_config?: TokenPruningConfig } export interface QueryDslWildcardQuery extends QueryDslQueryBase { diff --git a/specification/_types/query_dsl/TokenPruningConfig.ts b/specification/_types/TokenPruningConfig.ts similarity index 100% rename from specification/_types/query_dsl/TokenPruningConfig.ts rename to specification/_types/TokenPruningConfig.ts diff --git a/specification/_types/mapping/SparseVectorIndexOptions.ts b/specification/_types/mapping/SparseVectorIndexOptions.ts new file mode 100644 index 0000000000..e7a650a3a2 --- /dev/null +++ b/specification/_types/mapping/SparseVectorIndexOptions.ts @@ -0,0 +1,42 @@ +/* + * 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 { TokenPruningConfig } from '@_types/TokenPruningConfig' + +export class SparseVectorIndexOptions { + /** + * Whether to perform pruning, omitting the non-significant tokens from the query to improve query performance. + * If prune is true but the pruning_config is not specified, pruning will occur but default values will be used. + * Default: false + * @availability stack since=8.19.0 + * @availability serverless + * @variant container_property + */ + prune?: boolean + /** + * Optional pruning configuration. + * If enabled, this will omit non-significant tokens from the query in order to improve query performance. + * This is only used if prune is set to true. + * If prune is set to true but pruning_config is not specified, default values will be used. + * @availability stack since=8.19.0 + * @availability serverless + * @variant container_property + */ + pruning_config?: TokenPruningConfig +} diff --git a/specification/_types/mapping/core.ts b/specification/_types/mapping/core.ts index 08bf088956..6a178c2ba5 100644 --- a/specification/_types/mapping/core.ts +++ b/specification/_types/mapping/core.ts @@ -41,6 +41,7 @@ import { Dictionary } from '@spec_utils/Dictionary' import { ChunkingSettings } from './ChunkingSettings' import { Property, PropertyBase } from './Property' import { SemanticTextIndexOptions } from './SemanticTextIndexOptions' +import { SparseVectorIndexOptions } from './SparseVectorIndexOptions' import { TermVectorOption } from './TermVectorOption' import { TimeSeriesMetricType } from './TimeSeriesMetricType' @@ -226,6 +227,13 @@ export class RankVectorProperty extends PropertyBase { export class SparseVectorProperty extends PropertyBase { store?: boolean type: 'sparse_vector' + /** + * Additional index options for the sparse vector field that controls the + * token pruning behavior of the sparse vector field. + * @availability stack since=8.19.0 + * @availability serverless + */ + index_options?: SparseVectorIndexOptions } export class SemanticTextProperty { diff --git a/specification/_types/query_dsl/SparseVectorQuery.ts b/specification/_types/query_dsl/SparseVectorQuery.ts index c2164bb3db..b1a6129754 100644 --- a/specification/_types/query_dsl/SparseVectorQuery.ts +++ b/specification/_types/query_dsl/SparseVectorQuery.ts @@ -20,8 +20,8 @@ import { Field, Id } from '@_types/common' import { float } from '@_types/Numeric' import { Dictionary } from '@spec_utils/Dictionary' +import { TokenPruningConfig } from '../TokenPruningConfig' import { QueryBase } from './abstractions' -import { TokenPruningConfig } from './TokenPruningConfig' /** * @variants container diff --git a/specification/_types/query_dsl/TextExpansionQuery.ts b/specification/_types/query_dsl/TextExpansionQuery.ts index 238c079349..7d55520c5e 100644 --- a/specification/_types/query_dsl/TextExpansionQuery.ts +++ b/specification/_types/query_dsl/TextExpansionQuery.ts @@ -17,8 +17,8 @@ * under the License. */ +import { TokenPruningConfig } from '../TokenPruningConfig' import { QueryBase } from './abstractions' -import { TokenPruningConfig } from './TokenPruningConfig' /** * @ext_doc_id query-dsl-text-expansion-query diff --git a/specification/_types/query_dsl/WeightedTokensQuery.ts b/specification/_types/query_dsl/WeightedTokensQuery.ts index 17f965510f..42fc4ab205 100644 --- a/specification/_types/query_dsl/WeightedTokensQuery.ts +++ b/specification/_types/query_dsl/WeightedTokensQuery.ts @@ -19,8 +19,8 @@ import { float } from '@_types/Numeric' import { Dictionary } from '@spec_utils/Dictionary' +import { TokenPruningConfig } from '../TokenPruningConfig' import { QueryBase } from './abstractions' -import { TokenPruningConfig } from './TokenPruningConfig' /** * @ext_doc_id query-dsl-weighted-tokens-query