Skip to main content
InterviewHubPRO
Section Overview
Q31

Question 31 of 50

Part 3: Advanced Internals, Scale & Production Patterns (Senior / Lead)

62%
Elasticsearch & Lucene (50 Qs)•Part 3: Advanced Internals, Scale & Production Patterns (Senior / Lead)

What is the difference between Dense Vector search in Elasticsearch and traditional search?

senior LevelMost AskedCode ExampleelasticsearchAdvanced Internals

In Simple Words: Elasticsearch 8.x supports a native dense_vector field type using HNSW indexing:

  • Allows running exact lexical queries (BM25) and approximate semantic vector search within the exact same query:
json
{
  "knn": {
    "field": "image_vector",
    "query_vector": [0.15, -0.42, 0.88],
    "k": 10,
    "num_candidates": 100
  },
  "query": {
    "match": { "category": "electronics" }
  }
}