Skip to content
Merged
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
52 changes: 27 additions & 25 deletions solutions/search/vector.md
Original file line number Diff line number Diff line change
@@ -1,48 +1,50 @@
---
navigation_title: Vector search
applies_to:
stack:
serverless:
---
# Vector search
# Vector search in {{es}}

:::{tip}
Looking for a minimal configuration approach? The `semantic_text` field type provides an abstraction over these vector search implementations with sensible defaults and automatic model management. It's the recommended approach for most users. [Learn more about semantic_text](semantic-search/semantic-search-semantic-text.md).
Looking for a minimal configuration approach? The `semantic_text` field type provides an abstraction over vector search implementations with sensible defaults and automatic model management. It's the recommended way to start with {{es}} vector search. [Learn more about semantic_text](semantic-search/semantic-search-semantic-text.md).
:::

Vector embeddings are a core technology in modern search, enabling models to learn and represent complex relationships in input data. When your content is vectorized, Elasticsearch can help users find content based on meaning and similarity, instead of just keyword or exact term matches.
Vector search in {{es}} uses vector embeddings to power modern, AI-driven search experiences. With vectorized content, Elasticsearch retrieves results based on meaning and similarity, not just keywords or exact term matches.

Vector search is an important component of most modern [semantic search](semantic-search.md) implementations. It can also be used independently for various similarity matching use cases. Learn more about use cases for AI-powered search in the [overview](ai-search/ai-search.md) page.
Vector search is a core component of most [semantic search](semantic-search.md) workflows, but it can also be used independently for similarity matching use cases. Learn more about the broader benefits in the [AI-powered search overview](ai-search/ai-search.md).

This guide explores the more manual technical implementation of vector search approaches, that do not use the higher-level `semantic_text` workflow.
This guide focuses on the more manual technical implementations of vector search, outside of the higher-level `semantic_text` workflow.
The right approach depends on your requirements, data type, and use case.

Which approach you use depends on your specific requirements and use case.
## Vector queries and field types in {{es}} [vector-queries-and-field-types]

## Vector queries and field types
Here’s a quick reference for the main **vector field types** and **query types** you can use:

Here's a quick reference overview of vector search field types and queries available in Elasticsearch:
| Vector type | Field type | Query type | Primary use case |
| --------------- | --------------- | --------------- | ----------------------------------------------------------- |
| Dense vectors | `dense_vector` | `knn` | Semantic similarity with your own embeddings model |
| Sparse vectors | `sparse_vector` | `sparse_vector` | Semantic term expansion using the ELSER model |
| Sparse or dense | `semantic_text` | `semantic` | Managed semantic search, agnostic to implementation details |

| Vector type | Field type | Query type | Primary use case |
| ----------- | --------------- | --------------- | -------------------------------------------------- |
| Dense | `dense_vector` | `knn` | Semantic similarity using your chosen embeddings model |
| Sparse | `sparse_vector` | `sparse_vector` | Semantic term expansion with the ELSER model |
| Sparse or dense | `semantic_text` | `semantic` | Managed semantic search that is agnostic to implementation details |
## Dense vector search in {{es}}

## Dense vector search
Dense vector search uses neural embeddings to capture semantic meaning. It translates content into fixed-length numeric vectors, where similar items cluster close together in vector space. This makes dense vectors ideal for:

Dense neural embeddings capture semantic meaning by translating content into fixed-length vectors of floating-point numbers. Similar content maps to nearby points in the vector space, making them ideal for:
- Finding semantically similar content
- Matching questions with answers
- Image similarity search
- Content-based recommendations
- Finding semantically similar documents
- Matching user questions with answers
- Image and multimedia similarity search
- Content-based recommendations

[Learn more about dense vector search](vector/dense-vector.md).
[Learn more about dense vector search in {{es}}](vector/dense-vector.md).

## Sparse vector search
## Sparse vector search with ELSER

The sparse vector approach uses the ELSER model to expand content with semantically related terms. This approach preserves explainability while adding semantic understanding, making it well-suited for:
- Enhanced keyword search
- Cases requiring explainable results
- Domain-specific search
Sparse vector search relies on the **ELSER model** to expand content with semantically related terms. This approach combines semantic understanding with explainability, making it a strong fit for:

- Enhanced keyword search
- Use cases requiring explainable results
- Domain-specific search
- Large-scale deployments

[Learn more about sparse vector search with ELSER](vector/sparse-vector.md).
33 changes: 18 additions & 15 deletions solutions/search/vector/dense-vector.md
Original file line number Diff line number Diff line change
@@ -1,34 +1,37 @@
---
navigation_title: Dense vector
applies_to:
stack:
serverless:
---
# Dense vector
# Dense vector search in {{es}}

Dense neural embeddings capture semantic meaning by translating content into fixed-length vectors of floating-point numbers. Similar content maps to nearby points in the vector space, making them ideal for:
Dense vectors use neural embeddings to represent semantic meaning. They translate text, images, or other data into fixed-length vectors of floating-point numbers. Content with similar meaning is mapped to nearby points in vector space, making dense vector search a powerful technique for:

- Finding semantically similar content
- Matching questions with answers
- Image similarity search
- Content-based recommendations
- Matching natural language questions with relevant answers
- Performing image and multimedia similarity search
- Delivering content-based recommendations

## Working with dense vectors in {{es}}

:::{tip}
Using the `semantic_text` field type provides automatic model management and sensible defaults. [Learn more](../semantic-search/semantic-search-semantic-text.md).
For most use cases, the [`semantic_text` field type](../semantic-search/semantic-search-semantic-text.md) is the recommended starting point. It provides automatic model management and sensible defaults for vector search.
:::

Dense vector search requires both index configuration and a strategy for generating embeddings. To use dense vectors in {{es}}:
To implement dense vector search in {{es}}, you need both an index configuration and a way to generate embeddings:

1. Index documents with embeddings
- You can generate embeddings within {{es}}
- Refer to [this overview](../semantic-search.md#using-nlp-models) of the main options
- You can also [bring your own embeddings](bring-own-vectors.md)
- Use the `dense_vector` field type
2. Query the index using the [`knn` search](knn.md)
1. **Index documents with embeddings**
- Generate embeddings directly in {{es}}
- Refer to the [overview of NLP model options](../semantic-search.md#using-nlp-models)
- Or [bring your own embeddings](bring-own-vectors.md)
- Store them using the `dense_vector` field type

2. **Query the index with k-NN search**
- Use the [`knn` query](knn.md) to retrieve results based on vector similarity

## Better Binary Quantization (BBQ) [bbq]

Better Binary Quantization (BBQ) is a vector quantization method for `dense_vector` fields that compresses vectors for faster and more memory-efficient similarity search. BBQ can improve relevance and cost efficiency, especially when used with HNSW.
Better Binary Quantization (BBQ) is an advanced vector quantization technique for `dense_vector` fields. It compresses embeddings into compact binary form, enabling faster similarity search and reducing memory usage. This improves both search relevance and cost efficiency, especially when used with HNSW (Hierarchical Navigable Small World).

For details on how BBQ works, supported algorithms, and configuration examples, refer to [Better Binary Quantization (BBQ)](https://www.elastic.co/docs/reference/elasticsearch/index-settings/bbq)
Learn more about how BBQ works, supported algorithms, and configuration examples in the [Better Binary Quantization (BBQ) documentation](https://www.elastic.co/docs/reference/elasticsearch/index-settings/bbq).
Loading