Skip to content

Commit d586a30

Browse files
committed
Add Sparse Vector Index Options for Token Pruning to Specification (#4761)
* add sparse vector index options to specification # Conflicts: # output/schema/schema.json * move TokenPruningConfig to base _types level (cherry picked from commit 0c77ae9) # Conflicts: # output/schema/schema.json # specification/_types/mapping/core.ts
1 parent 301a7af commit d586a30

File tree

10 files changed

+1368
-140
lines changed

10 files changed

+1368
-140
lines changed

output/openapi/elasticsearch-openapi.json

Lines changed: 331 additions & 16 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

output/openapi/elasticsearch-serverless-openapi.json

Lines changed: 30 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

output/schema/schema.json

Lines changed: 929 additions & 104 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

output/typescript/types.ts

Lines changed: 25 additions & 11 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
/*
2+
* Licensed to Elasticsearch B.V. under one or more contributor
3+
* license agreements. See the NOTICE file distributed with
4+
* this work for additional information regarding copyright
5+
* ownership. Elasticsearch B.V. licenses this file to you under
6+
* the Apache License, Version 2.0 (the "License"); you may
7+
* not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations
17+
* under the License.
18+
*/
19+
20+
import { TokenPruningConfig } from '@_types/TokenPruningConfig'
21+
22+
export class SparseVectorIndexOptions {
23+
/**
24+
* Whether to perform pruning, omitting the non-significant tokens from the query to improve query performance.
25+
* If prune is true but the pruning_config is not specified, pruning will occur but default values will be used.
26+
* Default: false
27+
* @availability stack since=8.19.0
28+
* @availability serverless
29+
* @variant container_property
30+
*/
31+
prune?: boolean
32+
/**
33+
* Optional pruning configuration.
34+
* If enabled, this will omit non-significant tokens from the query in order to improve query performance.
35+
* This is only used if prune is set to true.
36+
* If prune is set to true but pruning_config is not specified, default values will be used.
37+
* @availability stack since=8.19.0
38+
* @availability serverless
39+
* @variant container_property
40+
*/
41+
pruning_config?: TokenPruningConfig
42+
}

specification/_types/mapping/core.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ import { NumericFielddata } from '@indices/_types/NumericFielddata'
4040
import { Dictionary } from '@spec_utils/Dictionary'
4141
import { ChunkingSettings } from './ChunkingSettings'
4242
import { Property, PropertyBase } from './Property'
43+
import { SparseVectorIndexOptions } from './SparseVectorIndexOptions'
4344
import { TermVectorOption } from './TermVectorOption'
4445
import { TimeSeriesMetricType } from './TimeSeriesMetricType'
4546

@@ -225,6 +226,13 @@ export class RankVectorProperty extends PropertyBase {
225226
export class SparseVectorProperty extends PropertyBase {
226227
store?: boolean
227228
type: 'sparse_vector'
229+
/**
230+
* Additional index options for the sparse vector field that controls the
231+
* token pruning behavior of the sparse vector field.
232+
* @availability stack since=8.19.0
233+
* @availability serverless
234+
*/
235+
index_options?: SparseVectorIndexOptions
228236
}
229237

230238
export class SemanticTextProperty {

specification/_types/query_dsl/SparseVectorQuery.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@
2020
import { Field, Id } from '@_types/common'
2121
import { float } from '@_types/Numeric'
2222
import { Dictionary } from '@spec_utils/Dictionary'
23+
import { TokenPruningConfig } from '../TokenPruningConfig'
2324
import { QueryBase } from './abstractions'
24-
import { TokenPruningConfig } from './TokenPruningConfig'
2525

2626
/**
2727
* @variants container

specification/_types/query_dsl/TextExpansionQuery.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717
* under the License.
1818
*/
1919

20+
import { TokenPruningConfig } from '../TokenPruningConfig'
2021
import { QueryBase } from './abstractions'
21-
import { TokenPruningConfig } from './TokenPruningConfig'
2222

2323
/**
2424
* @ext_doc_id query-dsl-text-expansion-query

specification/_types/query_dsl/WeightedTokensQuery.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@
1919

2020
import { float } from '@_types/Numeric'
2121
import { Dictionary } from '@spec_utils/Dictionary'
22+
import { TokenPruningConfig } from '../TokenPruningConfig'
2223
import { QueryBase } from './abstractions'
23-
import { TokenPruningConfig } from './TokenPruningConfig'
2424

2525
/**
2626
* @ext_doc_id query-dsl-weighted-tokens-query

0 commit comments

Comments
 (0)