Vector search
Elastic Stack Serverless
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.
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 is an important component of most modern semantic search 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 page.
This guide explores the more manual technical implementation of vector search approaches, that do not use the higher-level semantic_text
workflow.
Which approach you use depends on your specific requirements and use case.
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 | 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 neural embeddings capture semantic meaning by translating content into fixed-length vectors of floating-point bumbers. 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
Learn more about dense vector search.
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
- Large-scale deployments