You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/reference/elasticsearch/mapping-reference/sparse-vector.md
+30-1Lines changed: 30 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -17,7 +17,14 @@ PUT my-index
17
17
"mappings": {
18
18
"properties": {
19
19
"text.tokens": {
20
-
"type": "sparse_vector"
20
+
"type": "sparse_vector",
21
+
"index_options": {
22
+
"prune": true,
23
+
"pruning_config": {
24
+
"tokens_freq_ratio_threshold": 5,
25
+
"tokens_weight_threshold: 0.4
26
+
}
27
+
}
21
28
}
22
29
}
23
30
}
@@ -36,6 +43,28 @@ The following parameters are accepted by `sparse_vector` fields:
36
43
* Exclude the field from [_source](/reference/elasticsearch/rest-apis/retrieve-selected-fields.md#source-filtering).
37
44
* Use [synthetic `_source`](/reference/elasticsearch/mapping-reference/mapping-source-field.md#synthetic-source).
38
45
46
+
[index_options](...)
47
+
: (Optional, object) You can set index options for your `sparse_vector` field to determine if you should prune tokens, and the parameter configurations for the token pruning. If the pruning options are not set for your `sparse_query` vector on the field, Elasticsearch will use the defaults if set here for the field. The available options for the index options are:
48
+
49
+
Parameters for `index_options` are:
50
+
51
+
`prune`
52
+
: (Optional, boolean) [preview] 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.
53
+
54
+
`pruning_config`
55
+
: (Optional, object) [preview] 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.
56
+
57
+
Parameters for `pruning_config` include:
58
+
59
+
`tokens_freq_ratio_threshold`
60
+
: (Optional, integer) [preview] Tokens whose frequency is more than `tokens_freq_ratio_threshold` times the average frequency of all tokens in the specified field are considered outliers and pruned. This value must between 1 and 100. Default: `5`.
61
+
62
+
`tokens_weight_threshold`
63
+
: (Optional, float) [preview] Tokens whose weight is less than `tokens_weight_threshold` are considered insignificant and pruned. This value must be between 0 and 1. Default: `0.4`.
64
+
65
+
::::{note}
66
+
The default values for `tokens_freq_ratio_threshold` and `tokens_weight_threshold` were chosen based on tests using ELSERv2 that provided the most optimal results.
0 commit comments