Elasticsearch Version
9.3.0
Installed Plugins
No response
Java Version
bundled
OS Version
Linux fedora 6.18.7-200.fc43.x86_64 #1 SMP PREEMPT_DYNAMIC Fri Jan 23 16:42:34 UTC 2026 x86_64 GNU/Linux
Problem Description
Executing a nested k-NN query with byte vectors results in a nullpointer exception.
Steps to Reproduce
- Create an index with the following structure:
PUT http://localhost:32770/test-knn-byte-000001
Content-Type: application/json
{
"mappings": {
"dynamic": "strict",
"properties": {
"nested": {
"type": "nested",
"dynamic": "strict",
"properties": {
"nested": {
"type": "nested",
"dynamic": "strict",
"properties": {
"byte_vector": {
"type": "dense_vector",
"element_type": "byte",
"dims": 4,
"index": true,
"similarity": "cosine",
"index_options": {
"type": "hnsw",
"m": 16,
"ef_construction": 100
}
}
}
}
}
}
}
}
}
- Add some documents:
POST http://localhost:32770/test-knn-byte-000001/_doc/1
Content-Type: application/json
{ }
- Try to run a search query:
{
"query": {
"bool": {
"must": {
"nested": {
"path": "nested",
"query": {
"nested": {
"path": "nested.nested",
"query": {
"knn": {
"field": "nested.nested.byte_vector",
"num_candidates": 1,
"query_vector": [
0,
1,
2,
3
]
}
}
}
}
}
}
}
}
}
Results in HTTP/1.1 500 Internal Server Error:
{
"error": {
"root_cause": [
{
"type": "null_pointer_exception",
"reason": "Cannot invoke \"org.apache.lucene.search.KnnCollector.visitedCount()\" because \"this.collector\" is null"
}
],
"type": "search_phase_execution_exception",
"reason": "all shards failed",
"phase": "query",
"grouped": true,
"failed_shards": [
{
"shard": 0,
"index": "test-knn-byte-000001",
"node": "vko6mansRpKzClaUwQQ-cg",
"reason": {
"type": "null_pointer_exception",
"reason": "Cannot invoke \"org.apache.lucene.search.KnnCollector.visitedCount()\" because \"this.collector\" is null"
}
}
],
"caused_by": {
"type": "null_pointer_exception",
"reason": "Cannot invoke \"org.apache.lucene.search.KnnCollector.visitedCount()\" because \"this.collector\" is null",
"caused_by": {
"type": "null_pointer_exception",
"reason": "Cannot invoke \"org.apache.lucene.search.KnnCollector.visitedCount()\" because \"this.collector\" is null"
}
}
},
"status": 500
}
Used to work fine in all previous versions. (additional info -- there seems to be no issue with float vectors)
Elasticsearch is started from the official docker image.
Logs (if relevant)
No response
Elasticsearch Version
9.3.0
Installed Plugins
No response
Java Version
bundled
OS Version
Linux fedora 6.18.7-200.fc43.x86_64 #1 SMP PREEMPT_DYNAMIC Fri Jan 23 16:42:34 UTC 2026 x86_64 GNU/Linux
Problem Description
Executing a nested k-NN query with byte vectors results in a nullpointer exception.
Steps to Reproduce
{ "query": { "bool": { "must": { "nested": { "path": "nested", "query": { "nested": { "path": "nested.nested", "query": { "knn": { "field": "nested.nested.byte_vector", "num_candidates": 1, "query_vector": [ 0, 1, 2, 3 ] } } } } } } } } }Results in
HTTP/1.1 500 Internal Server Error:{ "error": { "root_cause": [ { "type": "null_pointer_exception", "reason": "Cannot invoke \"org.apache.lucene.search.KnnCollector.visitedCount()\" because \"this.collector\" is null" } ], "type": "search_phase_execution_exception", "reason": "all shards failed", "phase": "query", "grouped": true, "failed_shards": [ { "shard": 0, "index": "test-knn-byte-000001", "node": "vko6mansRpKzClaUwQQ-cg", "reason": { "type": "null_pointer_exception", "reason": "Cannot invoke \"org.apache.lucene.search.KnnCollector.visitedCount()\" because \"this.collector\" is null" } } ], "caused_by": { "type": "null_pointer_exception", "reason": "Cannot invoke \"org.apache.lucene.search.KnnCollector.visitedCount()\" because \"this.collector\" is null", "caused_by": { "type": "null_pointer_exception", "reason": "Cannot invoke \"org.apache.lucene.search.KnnCollector.visitedCount()\" because \"this.collector\" is null" } } }, "status": 500 }Used to work fine in all previous versions. (additional info -- there seems to be no issue with float vectors)
Elasticsearch is started from the official docker image.
Logs (if relevant)
No response