Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions solutions/search/vector.md
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,30 @@ Embedding models usually output floating-point vectors (for example, 32 bits per

{{es}} offers several quantization options for `dense_vector` fields: [BBQ (Better Binary Quantization)](elasticsearch://reference/elasticsearch/mapping-reference/dense-vector.md#dense-vector-quantization-bbq), [int8](elasticsearch://reference/elasticsearch/mapping-reference/dense-vector.md#dense-vector-quantization-int8), and [int4](elasticsearch://reference/elasticsearch/mapping-reference/dense-vector.md#dense-vector-quantization-int4). For the full list, configuration details, and trade-offs, refer to [Automatically quantize vectors for kNN search](elasticsearch://reference/elasticsearch/mapping-reference/dense-vector.md#dense-vector-quantization).

## Vector index mode [vector-index-mode]
```{applies_to}
stack: ga 9.5
```

Vector index mode (`index.mode: vectordb_document`) is an index-level setting that applies defaults tuned for vector search workloads. Instead of configuring storage, indexing, and merge behavior yourself, you set the index mode when you create an index, and {{es}} applies a bundle of optimizations automatically.

Use vector index mode when your index is primarily used for similarity search on dense vectors and you want efficient storage and indexing out of the box.

You can set it explicitly when you create the index:

```console
PUT my-vector-index
{
"settings": {
"index": {
"mode": "vectordb_document"
}
}
}
```

Refer to [General index settings](elasticsearch://reference/elasticsearch/index-settings/index-modules.md#index-mode-setting) to learn what index mode does and which options are available. For the default values used by vector index mode, refer to [Index modes for vector search](elasticsearch://reference/elasticsearch/mapping-reference/dense-vector.md#dense-vector-index-modes).

## Vector embedding models

A {{ml}} model that converts your source data into vector embeddings. The model you choose determines the dimensionality and quality of the resulting vectors. It also constrains what types of content the system understands well. The vectors in your index and your query vectors must be generated by the same model for similarity comparisons to be meaningful.
Expand Down
28 changes: 28 additions & 0 deletions solutions/search/vector/knn.md
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,34 @@
}
```

### Near-real-time kNN [near-real-time-knn]
```{applies_to}
stack: ga 9.5
```

Use the `near_real_time` parameter in the top-level `knn` object to control whether approximate kNN search includes vectors from data that was indexed recently but not yet fully prepared for search.

When `near_real_time` is `true`, kNN search can include vectors from newly indexed data, even if {{es}} has not finished optimizing them yet. Results may include documents you indexed seconds ago, but search can be slower while optimization is still in progress.

Check notice on line 189 in solutions/search/vector/knn.md

View workflow job for this annotation

GitHub Actions / build / vale

Elastic.WordChoice: Consider using 'can, might' instead of 'may', unless the term is in the UI.

When `near_real_time` is `false`, kNN search skips vectors that are not yet fully optimized. Indexing runs faster on large vector workloads, but documents you just indexed may not appear in kNN results until {{es}} finishes preparing them in the background.

Check notice on line 191 in solutions/search/vector/knn.md

View workflow job for this annotation

GitHub Actions / build / vale

Elastic.WordChoice: Consider using 'can, might' instead of 'may', unless the term is in the UI.

Check warning on line 191 in solutions/search/vector/knn.md

View workflow job for this annotation

GitHub Actions / build / vale

Elastic.DontUse: Don't use 'just'.

The default value depends on the index mode. For indices that use the `standard` mode, `near_real_time` defaults to `true`. For indices that use `vectordb_document` mode, it defaults to `false`.

The following example overrides the default behavior and enables near-real-time search, so the approximate kNN query can include vectors that were indexed very recently:

```console
POST my-vector-index/_search
{
"knn": {
"field": "image-vector",
"query_vector": [-5, 9, -12],
"k": 10,
"num_candidates": 100,
"near_real_time": true
}
}
```

### Tune approximate kNN for speed or accuracy [tune-approximate-knn-for-speed-accuracy]

To gather results, the kNN API first finds a `num_candidates` number of approximate neighbors per shard, computes similarity to the query vector, selects the top `k` per shard, and merges them into the global top `k` nearest neighbors.
Expand Down
Loading