Skip to content

Commit 9b02911

Browse files
committed
Merge branch 'main' of https://github.com/elastic/elasticsearch into filters_on_inlinestats
2 parents 0ee6737 + b46e0ce commit 9b02911

File tree

116 files changed

+1404
-448
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

116 files changed

+1404
-448
lines changed

benchmarks/src/main/java/org/elasticsearch/benchmark/_nightly/esql/QueryPlanningBenchmark.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,8 @@ public void setup() {
9292
var fields = 10_000;
9393
var mapping = LinkedHashMap.<String, EsField>newLinkedHashMap(fields);
9494
for (int i = 0; i < fields; i++) {
95-
mapping.put("field" + i, new EsField("field-" + i, TEXT, emptyMap(), true));
95+
// We're creating a standard index, so none of these fields should be marked as dimensions.
96+
mapping.put("field" + i, new EsField("field-" + i, TEXT, emptyMap(), true, EsField.TimeSeriesFieldType.NONE));
9697
}
9798

9899
var esIndex = new EsIndex("test", mapping, Map.of("test", IndexMode.STANDARD));

benchmarks/src/main/java/org/elasticsearch/benchmark/compute/operator/EvalBenchmark.java

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ private static EvalOperator.ExpressionEvaluator evaluator(String operation) {
212212
FieldAttribute timestamp = new FieldAttribute(
213213
Source.EMPTY,
214214
"timestamp",
215-
new EsField("timestamp", DataType.DATETIME, Map.of(), true)
215+
new EsField("timestamp", DataType.DATETIME, Map.of(), true, EsField.TimeSeriesFieldType.NONE)
216216
);
217217
yield EvalMapper.toEvaluator(
218218
FOLD_CONTEXT,
@@ -321,19 +321,35 @@ private static EvalOperator.ExpressionEvaluator evaluator(String operation) {
321321
}
322322

323323
private static FieldAttribute longField() {
324-
return new FieldAttribute(Source.EMPTY, "long", new EsField("long", DataType.LONG, Map.of(), true));
324+
return new FieldAttribute(
325+
Source.EMPTY,
326+
"long",
327+
new EsField("long", DataType.LONG, Map.of(), true, EsField.TimeSeriesFieldType.NONE)
328+
);
325329
}
326330

327331
private static FieldAttribute doubleField() {
328-
return new FieldAttribute(Source.EMPTY, "double", new EsField("double", DataType.DOUBLE, Map.of(), true));
332+
return new FieldAttribute(
333+
Source.EMPTY,
334+
"double",
335+
new EsField("double", DataType.DOUBLE, Map.of(), true, EsField.TimeSeriesFieldType.NONE)
336+
);
329337
}
330338

331339
private static FieldAttribute intField() {
332-
return new FieldAttribute(Source.EMPTY, "int", new EsField("int", DataType.INTEGER, Map.of(), true));
340+
return new FieldAttribute(
341+
Source.EMPTY,
342+
"int",
343+
new EsField("int", DataType.INTEGER, Map.of(), true, EsField.TimeSeriesFieldType.NONE)
344+
);
333345
}
334346

335347
private static FieldAttribute keywordField() {
336-
return new FieldAttribute(Source.EMPTY, "keyword", new EsField("keyword", DataType.KEYWORD, Map.of(), true));
348+
return new FieldAttribute(
349+
Source.EMPTY,
350+
"keyword",
351+
new EsField("keyword", DataType.KEYWORD, Map.of(), true, EsField.TimeSeriesFieldType.NONE)
352+
);
337353
}
338354

339355
private static Configuration configuration() {

docs/changelog/131907.yaml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
pr: 131907
2+
summary: Enable `exclude_source_vectors` by default for new indices
3+
area: Vector Search
4+
type: breaking
5+
issues: []
6+
breaking:
7+
title: Enable `exclude_source_vectors` by default for new indices
8+
area: Search
9+
details: |-
10+
The `exclude_source_vectors` setting is now enabled by default for newly created indices.
11+
This means that vector fields (e.g., `dense_vector`) are no longer stored in the `_source` field
12+
by default, although they remain fully accessible through search and retrieval operations.
13+
14+
Instead of being persisted in `_source`, vectors are now rehydrated on demand from the underlying
15+
index structures when needed. This reduces index size and improves performance for typical vector
16+
search workloads where the original vector values do not need to be part of the `_source`.
17+
18+
If your use case requires vector fields to be stored in `_source`, you can disable this behavior by
19+
setting `exclude_source_vectors: false` at index creation time.
20+
impact: |-
21+
Vector fields will no longer be stored in `_source` by default for new indices. Applications or tools
22+
that expect to see vector fields in `_source` (for raw document inspection)
23+
may need to be updated or configured to explicitly retain vectors using `exclude_source_vectors: false`.
24+
25+
Retrieval of vector fields via search or the `_source` API remains fully supported.
26+
notable: true

docs/changelog/132766.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
pr: 132766
2+
summary: Change `reporting_user` role to leverage reserved kibana privileges
3+
area: Authorization
4+
type: deprecation
5+
issues: []
6+
deprecation:
7+
title: Deprecate the built-in `reporting_user` role.
8+
area: Authorization
9+
details: The `reporting_user` role is deprecated. Administrators should manage access to Kibana's reporting features via custom roles which grant the necessary privileges.
10+
impact: This role will be removed in a future version. Administrators should migrate to custom roles to avoid interruption.

docs/changelog/132845.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
pr: 132845
2+
summary: Expose existing DLS cache x-pack usage statistics
3+
area: Authorization
4+
type: enhancement
5+
issues: []

docs/changelog/132858.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
pr: 132858
2+
summary: Add index mode to resolve index response
3+
area: Indices APIs
4+
type: feature
5+
issues: []

docs/changelog/132945.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
pr: 132945
2+
summary: Disable child span for streaming tasks
3+
area: Machine Learning
4+
type: bug
5+
issues: []

docs/reference/elasticsearch-plugins/plugin-management.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ If Elasticsearch was installed using the deb or rpm package then run `/usr/share
116116

117117
For detailed instructions on installing, managing, and configuring plugins, see the following:
118118

119-
* [Intalling Plugings](./installation.md)
119+
* [Installing Plugins](./installation.md)
120120
* [Custom URL or file system](./plugin-management-custom-url.md)
121121
* [Installing multiple plugins](./installing-multiple-plugins.md)
122122
* [Mandatory plugins](./mandatory-plugins.md)
Lines changed: 162 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,162 @@
1+
---
2+
navigation_title: Better Binary Quantization (BBQ)
3+
applies_to:
4+
stack: all
5+
serverless: all
6+
---
7+
8+
# Better Binary Quantization (BBQ) [bbq]
9+
10+
Better Binary Quantization (BBQ) is an advanced vector quantization method, designed for large-scale similarity search. BBQ is a form of lossy compression for [`dense_vector` fields](https://www.elastic.co/docs/reference/elasticsearch/mapping-reference/dense-vector) that enables efficient storage and retrieval of large numbers of vectors, while keeping results close to those from the original uncompressed vectors.
11+
12+
BBQ offers significant improvements over scalar quantization by relying on optimized `bit` level computations to reduce memory usage and computational costs while maintaining high search relevance using pre-computed corrective factors. BBQ is designed to work in combination with [oversampling](#bbq-oversampling) and reranking, and is compatible with various [vector search algorithms](#bbq-vector-search-algorithms), such as [HNSW](#bbq-hnsw) and [brute force (flat)](#bbq-flat).
13+
14+
## How BBQ works [bbq-how-it-works]
15+
16+
BBQ retains the original vector’s dimensionality but transforms the datatype of the dimensions from the original `float32` to `bit` effectively compressing each vector by 32x plus an additional 14 bytes of corrective data per vector. BBQ uses these pre-computed corrective factors as partial distance calculations to help realize impressively robust approximations of the original vector.
17+
18+
Measuring vector similarity with BBQ vectors requires much less computing effort, allowing more candidates to be considered when using the HNSW algorithm. This often results in better ranking quality and improved relevance compared to the original `float32` vectors.
19+
20+
## Supported vector search algorithms [bbq-vector-search-algorithms]
21+
22+
BBQ currently supports two vector search algorithms, each suited to different scenarios. You can configure them by setting the dense vector field’s `index_type`.
23+
24+
### `bbq_hnsw` [bbq-hnsw]
25+
26+
When you set a dense vector field’s `index_options` parameter to `type: bbq_hnsw`, {{es}} uses the HNSW algorithm for fast [kNN search](https://www.elastic.co/docs//solutions/search/vector/knn) on compressed vectors. With the default [oversampling](#bbq-oversampling) applied, it delivers better cost efficiency, lower latency, and improved relevance ranking, making it the best choice for large-scale similarity search.
27+
28+
:::{note}
29+
Starting in version 9.1, `bbq_hnsw` is the default indexing method for new `dense_vector` fields with greater than 384 dimensions, so you typically don’t need to specify it explicitly when creating an index.
30+
31+
Datasets with less than 384 dimensions may see less accuracy and incur a higher overhead cost related to the corrective factors, but we have observed some production datasets perform well even at fairly low dimensions including [tests on e5-small](https://www.elastic.co/search-labs/blog/better-binary-quantization-lucene-elasticsearch).
32+
:::
33+
34+
The following example creates an index with a `dense_vector` field configured to use the `bbq_hnsw` algorithm.
35+
36+
```console
37+
PUT bbq_hnsw-index
38+
{
39+
"mappings": {
40+
"properties": {
41+
"my_vector": {
42+
"type": "dense_vector",
43+
"dims": 64,
44+
"index": true,
45+
"index_options": {
46+
"type": "bbq_hnsw"
47+
}
48+
}
49+
}
50+
}
51+
}
52+
```
53+
54+
To change an existing index to use `bbq_hnsw`, update the field mapping:
55+
56+
```console
57+
PUT bbq_hnsw-index/_mapping
58+
{
59+
"properties": {
60+
"my_vector": {
61+
"type": "dense_vector",
62+
"dims": 64,
63+
"index": true,
64+
"index_options": {
65+
"type": "bbq_hnsw"
66+
}
67+
}
68+
}
69+
}
70+
```
71+
72+
After this change, all newly created segments will use the `bbq_hnsw` algorithm. As you add or update documents, the index will gradually convert to `bbq_hnsw`.
73+
74+
To apply `bbq_hnsw` to all vectors at once, reindex them into a new index where the `index_options` parameter's `type` is set to `bbq_hnsw`:
75+
76+
:::::{stepper}
77+
::::{step} Create a destination index
78+
```console
79+
PUT my-index-bbq
80+
{
81+
"mappings": {
82+
"properties": {
83+
"my_vector": {
84+
"type": "dense_vector",
85+
"dims": 64,
86+
"index": true,
87+
"index_options": {
88+
"type": "bbq_hnsw"
89+
}
90+
}
91+
}
92+
}
93+
}
94+
```
95+
::::
96+
97+
::::{step} Reindex the data
98+
```console
99+
POST _reindex
100+
{
101+
"source": { "index": "my-index" }, <1>
102+
"dest": { "index": "my-index-bbq" }
103+
}
104+
```
105+
1. The existing index to be reindexed into the newly created index with the `bbq_hnsw` algorithm.
106+
::::
107+
108+
:::::
109+
110+
### `bbq_flat` [bbq-flat]
111+
112+
When you set a dense vector field’s `index_options` parameter to `type: bbq_flat`, {{es}} uses the BBQ algorithm without HNSW. This option generally requires fewer computing resources and works best when the number of vectors being searched is relatively low.
113+
114+
The following example creates an index with a `dense_vector` field configured to use the `bbq_flat` algorithm.
115+
116+
```console
117+
PUT bbq_flat-index
118+
{
119+
"mappings": {
120+
"properties": {
121+
"my_vector": {
122+
"type": "dense_vector",
123+
"dims": 64,
124+
"index": true,
125+
"index_options": {
126+
"type": "bbq_flat"
127+
}
128+
}
129+
}
130+
}
131+
}
132+
```
133+
134+
## Oversampling [bbq-oversampling]
135+
136+
Oversampling is a technique used with BBQ searches to reduce the accuracy loss from compression. Compression lowers the memory footprint by over 95% and improves query latency, at the cost of decreased result accuracy. This decrease can be mitigated by oversampling during query time and reranking the top results using the full vector.
137+
138+
When you run a kNN search on a BBQ-indexed field, {{es}} automatically retrieves more candidate vectors than the number of results you request. This oversampling improves accuracy by giving the system more vectors to re-rank using their full-precision values before returning the top results.
139+
140+
```console
141+
GET bbq-index/_search
142+
{
143+
"knn": {
144+
"field": "my_vector",
145+
"query_vector": [0.12, -0.45, ...],
146+
"k": 10,
147+
"num_candidates": 100
148+
}
149+
}
150+
```
151+
152+
By default, oversampling is set to 3×, meaning if you request k:10, {{es}} retrieves 30 candidates for re-ranking. You don’t need to configure this behavior; it’s applied automatically for BBQ searches.
153+
154+
:::{note}
155+
You can change oversampling from the default 3× to another value. Refer to [Oversampling and rescoring for quantized vectors](https://www.elastic.co/docs/solutions/search/vector/knn#dense-vector-knn-search-rescoring) for details.
156+
:::
157+
158+
## Learn more [bbq-learn-more]
159+
160+
- [Better Binary Quantization (BBQ) in Lucene and {{es}}](https://www.elastic.co/search-labs/blog/better-binary-quantization-lucene-elasticsearch) - Learn how BBQ works, its benefits, and how it reduces memory usage while preserving search accuracy.
161+
- [Dense vector field type](https://www.elastic.co/docs/reference/elasticsearch/mapping-reference/dense-vector) - Find code examples for using `bbq_hnsw` `index_type`.
162+
- [kNN search](https://www.elastic.co/docs/solutions/search/vector/knn) - Learn about the search algorithm that BBQ works with.
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
---
2+
mapped_pages:
3+
- https://www.elastic.co/guide/en/elasticsearch/reference/current/source-index-settings.html
4+
navigation_title: Source settings
5+
---
6+
7+
# Source index settings [source-index-settings]
8+
9+
All settings around the _source metadata field.
10+
11+
$$$source-mode$$$
12+
13+
`index.source.mode`
14+
: (Static, string) The source mode for the index. Valid values are [`synthetic`](/reference/elasticsearch/mapping-reference/mapping-source-field.md#synthetic-source), [`disabled`](/reference/elasticsearch/mapping-reference/mapping-source-field.md#disable-source-field) or `stored`. Defaults to `stored`. The `stored` source mode always stores the source metadata field on disk.
15+
16+
$$$recovery-use_synthetic_source$$$
17+
18+
`index.recovery.use_synthetic_source`
19+
: (Static, boolean) If synthetic source mode is used, whether the recovery source should also be synthesized instead of stored to disk. Defaults to `true`. This setting can only be configured if synthetic source mode is enabled.
20+
21+
$$$synthetic-source-keep$$$
22+
23+
`index.mapping.synthetic_source_keep`
24+
: (Static, string) Controls how to retain accuracy of fields at the index level. Valid values are `none` or `arrays`.This is a subset of [synthetic source keep mapping attribute](/reference/elasticsearch/mapping-reference/mapping-source-field.md#synthetic-source-keep). Defaults to `arrays` if `index.mode` is `logsdb` or otherwise `none`.

0 commit comments

Comments
 (0)