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/dense-vector.md
+24-8Lines changed: 24 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -103,6 +103,10 @@ PUT my-index-2
103
103
{{es}} uses the [HNSW algorithm](https://arxiv.org/abs/1603.09320) to support efficient kNN search. Like most kNN algorithms, HNSW is an approximate method that sacrifices result accuracy for improved speed.
104
104
105
105
## Accessing `dense_vector` fields in search responses
106
+
```{applies_to}
107
+
stack: ga 9.2
108
+
serverless: ga
109
+
```
106
110
107
111
By default, `dense_vector` fields are **not included in `_source`** in responses from the `_search`, `_msearch`, `_get`, and `_mget` APIs.
108
112
This helps reduce response size and improve performance, especially in scenarios where vectors are used solely for similarity scoring and not required in the output.
@@ -130,6 +134,10 @@ POST my-index-2/_search
130
134
```
131
135
132
136
### Storage behavior and `_source`
137
+
```{applies_to}
138
+
stack: ga 9.2
139
+
serverless: ga
140
+
```
133
141
134
142
By default, `dense_vector` fields are **not stored in `_source`** on disk. This is also controlled by the index setting `index.mapping.exclude_source_vectors`.
135
143
This setting is enabled by default for newly created indices and can only be set at index creation time.
@@ -142,10 +150,18 @@ When enabled:
142
150
This setting is compatible with synthetic `_source`, where the entire `_source` document is reconstructed from columnar storage. In full synthetic mode, no `_source` is stored on disk, and all fields — including vectors — are rebuilt when needed.
143
151
144
152
### Rehydration and precision
153
+
```{applies_to}
154
+
stack: ga 9.2
155
+
serverless: ga
156
+
```
145
157
146
158
When vector values are rehydrated (e.g., for reindex, recovery, or explicit `_source` requests), they are restored from their internal format. Internally, vectors are stored at float precision, so if they were originally indexed as higher-precision types (e.g., `double` or `long`), the rehydrated values will have reduced precision. This lossy representation is intended to save space while preserving search quality.
147
159
148
160
### Storing original vectors in `_source`
161
+
```{applies_to}
162
+
stack: ga 9.2
163
+
serverless: ga
164
+
```
149
165
150
166
If you want to preserve the original vector values exactly as they were provided, you can re-enable vector storage in `_source`:
: (Required, string) The type of kNN algorithm to use. Can be either any of:
339
355
* `hnsw` - This utilizes the [HNSW algorithm](https://arxiv.org/abs/1603.09320) for scalable approximate kNN search. This supports all `element_type` values.
340
-
* `int8_hnsw` - The default index type for some float vectors:
341
-
342
-
* {applies_to}`stack: ga 9.1` Default for float vectors with less than 384 dimensions.
356
+
* `int8_hnsw` - The default index type for some float vectors:
357
+
358
+
* {applies_to}`stack: ga 9.1` Default for float vectors with less than 384 dimensions.
343
359
* {applies_to}`stack: ga 9.0` Default for float all vectors.
344
-
360
+
345
361
This utilizes the [HNSW algorithm](https://arxiv.org/abs/1603.09320) in addition to automatically scalar quantization for scalable approximate kNN search with `element_type` of `float`. This can reduce the memory footprint by 4x at the cost of some accuracy. See [Automatically quantize vectors for kNN search](#dense-vector-quantization).
346
362
* `int4_hnsw` - This utilizes the [HNSW algorithm](https://arxiv.org/abs/1603.09320) in addition to automatically scalar quantization for scalable approximate kNN search with `element_type` of `float`. This can reduce the memory footprint by 8x at the cost of some accuracy. See [Automatically quantize vectors for kNN search](#dense-vector-quantization).
347
363
* `bbq_hnsw` - This utilizes the [HNSW algorithm](https://arxiv.org/abs/1603.09320) in addition to automatically binary quantization for scalable approximate kNN search with `element_type` of `float`. This can reduce the memory footprint by 32x at the cost of accuracy. See [Automatically quantize vectors for kNN search](#dense-vector-quantization).
348
-
349
-
{applies_to}`stack: ga 9.1``bbq_hnsw` is the default index type for float vectors with greater than or equal to 384 dimensions.
364
+
365
+
{applies_to}`stack: ga 9.1` `bbq_hnsw` is the default index type for float vectors with greater than or equal to 384 dimensions.
350
366
* `flat` - This utilizes a brute-force search algorithm for exact kNN search. This supports all `element_type` values.
351
367
* `int8_flat` - This utilizes a brute-force search algorithm in addition to automatically scalar quantization. Only supports `element_type` of `float`.
352
368
* `int4_flat` - This utilizes a brute-force search algorithm in addition to automatically half-byte scalar quantization. Only supports `element_type` of `float`.
: (Optional, object) An optional section that configures automatic vector rescoring on knn queries for the given field. Only applicable to quantized index types.
367
383
:::::{dropdown} Properties of rescore_vector
368
384
`oversample`
369
-
: (required, float) The amount to oversample the search results by. This value should be one of the following:
370
-
* Greater than `1.0` and less than `10.0`
385
+
: (required, float) The amount to oversample the search results by. This value should be one of the following:
386
+
* Greater than `1.0` and less than `10.0`
371
387
* Exactly `0` to indicate no oversampling and rescoring should occur {applies_to}`stack: ga 9.1`
372
388
: The higher the value, the more vectors will be gathered and rescored with the raw values per shard.
373
389
: In case a knn query specifies a `rescore_vector` parameter, the query `rescore_vector` parameter will be used instead.
0 commit comments