What is kNN vector search in Elasticsearch 8.x?
Answer
Elasticsearch 8.x introduced native kNN (k-Nearest Neighbor) vector search using the dense_vector field type and the knn query parameter. This enables semantic search and AI-powered retrieval: documents are represented as high-dimensional vectors (embeddings generated by ML models like BERT or OpenAI's text-embedding models), and search finds the k documents whose vectors are closest to the query vector by cosine similarity or dot product. Use cases include semantic document search (finding conceptually similar documents even without keyword overlap), image similarity search, recommendation systems, and anomaly detection. Elasticsearch implements approximate kNN using the HNSW (Hierarchical Navigable Small World) algorithm for efficient similarity search at scale. Combine kNN with bool filters for hybrid search (semantic + keyword).
Previous
What are circuit breakers in Elasticsearch?
Next
What security features does Elasticsearch provide?
More Elasticsearch Questions
View all →- Advanced What are cluster health states in Elasticsearch and what causes each?
- Advanced What is hot-warm-cold architecture in Elasticsearch?
- Advanced What is Index Lifecycle Management (ILM) in Elasticsearch?
- Advanced What is Cross-Cluster Replication (CCR) and Cross-Cluster Search (CCS)?
- Advanced How do script_score and function_score work for custom relevance?