high severityElasticsearch kNN search API

kNN search queries with filters timeout (>60s) or severely degrade performance on large indices, while unfiltered work fine. E.g., ReadTimeoutError or response timeout in client.

Root cause

Filtered approximate kNN (HNSW) requires exploring more graph nodes/candidates to find enough matching the filter, unlike regular queries where filters speed up. On large indices (200M+ docs), this leads to high compute/latency exceeding timeouts, especially with multiple segments requiring sequential graph searches.

elasticsearchknntimeoutfilterhnswapproximate-searchperformance

Citations