-
Notifications
You must be signed in to change notification settings - Fork 25.6k
Closed
Labels
:Search Relevance/HighlightingHow a query matched a documentHow a query matched a document>bugTeam:Search RelevanceMeta label for the Search Relevance team in ElasticsearchMeta label for the Search Relevance team in Elasticsearchv8.10.0
Description
Elasticsearch Version
8.10+
Installed Plugins
No response
Java Version
bundled
OS Version
any
Problem Description
Unified highlighter fails with new setting
index.highlight.weight_matches_mode.enabled: "true"
This KnnScoreDocQuery was created by a different reader is the log line for the failure.
Relevant PR for the cause: #96068
Steps to Reproduce
This yaml rest test reproduces the bug.
---
"Test hybrid search with knn":
- skip:
version: ' - 8.3.99'
reason: 'kNN added to search endpoint in 8.4'
- do:
indices.create:
index: test-highlighting-knn
body:
mappings:
"properties":
"vectors":
"type": "dense_vector"
"dims": 2
"index": true
"similarity": "l2_norm"
"text":
"type": "text"
"fields":
"fvh":
"type": "text"
"term_vector": "with_positions_offsets"
"postings":
"type": "text"
"index_options": "offsets"
- do:
index:
index: test-highlighting-knn
id: "1"
body:
"text" : "The quick brown fox is brown."
"vectors": [1, 2]
- do:
indices.refresh: {}
- do:
search:
index: test-highlighting-knn
body: {
"query": { "multi_match": { "query": "quick brown fox", "type": "phrase", "fields": [ "text*" ] } },
"highlight": { "type": "unified", "fields": { "*": { } } },
"knn": { "field": "vectors", "query_vector": [1, 2], "k": 10, "num_candidates": 10 } }
- match: { hits.hits.0.highlight.text.0: "The <em>quick brown fox</em> is brown." }
- match: { hits.hits.0.highlight.text\.fvh.0: "The <em>quick brown fox</em> is brown." }
- match: { hits.hits.0.highlight.text\.postings.0: "The <em>quick brown fox</em> is brown." }
- do:
indices.put_settings:
index: test-highlighting-knn
body:
index.highlight.weight_matches_mode.enabled: "false"
- do:
search:
index: test-highlighting-knn
body: {
"query" : { "multi_match" : { "query" : "quick brown fox", "type": "phrase", "fields" : [ "text*"] } },
"highlight" : { "type" : "unified", "fields" : { "*" : {} } },
"knn": { "field": "vectors", "query_vector": [1, 2], "k": 10, "num_candidates": 10 } }
- match: { hits.hits.0.highlight.text.0: "The <em>quick brown fox</em> is brown." }
- match: { hits.hits.0.highlight.text\.fvh.0: "The <em>quick brown fox</em> is brown." }
- match: { hits.hits.0.highlight.text\.postings.0: "The <em>quick brown fox</em> is brown." }
Logs (if relevant)
The failure stack trace looks as follows:
1> Caused by: java.lang.IllegalStateException: This KnnScoreDocQuery was created by a different reader
1> at [email protected]/org.elasticsearch.search.vectors.KnnScoreDocQuery.createWeight(KnnScoreDocQuery.java:71)
1> at [email protected]/org.apache.lucene.search.IndexSearcher.createWeight(IndexSearcher.java:896)
1> at [email protected]/org.apache.lucene.search.BooleanWeight.<init>(BooleanWeight.java:59)
1> at [email protected]/org.apache.lucene.search.BooleanQuery.createWeight(BooleanQuery.java:245)
1> at [email protected]/org.apache.lucene.search.uhighlight.FieldOffsetStrategy.createOffsetsEnumsWeightMatcher(FieldOffsetStrategy.java:146)
1> at [email protected]/org.apache.lucene.search.uhighlight.FieldOffsetStrategy.createOffsetsEnumFromReader(FieldOffsetStrategy.java:74)
1> at [email protected]/org.apache.lucene.search.uhighlight.MemoryIndexOffsetStrategy.getOffsetsEnum(MemoryIndexOffsetStrategy.java:119)
1> at [email protected]/org.apache.lucene.search.uhighlight.FieldHighlighter.highlightFieldForDoc(FieldHighlighter.java:80)
1> at [email protected]/org.elasticsearch.lucene.search.uhighlight.CustomFieldHighlighter.highlightFieldForDoc(CustomFieldHighlighter.java:63)
1> at org.elasticsearch.s 1> [email protected]/org.elasticsearch.lucene.search.uhighlight.CustomUnifiedHighlighter.highlightField(CustomUnifiedHighlighter.java:148)
1> at [email protected]/org.elasticsearch.search.fetch.subphase.highlight.DefaultHighlighter.highlight(DefaultHighlighter.java:81)
1> at [email protected]/org.elasticsearch.search.fetch.subphase.highlight.HighlightPhase$1.process(HighlightPhase.java:69)
1> at [email protected]/org.elasticsearch.search.fetch.FetchPhase$1.nextDoc(FetchPhase.java:164)
1> at [email protected]/org.elasticsearch.search.fetch.FetchPhaseDocsIterator.iterate(FetchPhaseDocsIterator.java:70)
1> at [email protected]/org.elasticsearch.search.fetch.FetchPhase.buildSearchHits(FetchPhase.java:170)
1> at [email protected]/org.elasticsearch.search.fetch.FetchPhase.execute(FetchPhase.java:79)
1> at [email protected]/org.elasticsearch.search.SearchService.lambda$executeFetchPhase$9(SearchService.java:863)
1> at [email protected]/org.elasticsearch.action.ActionRunnable$2.accept(ActionRunnable.java:51)
1> at [email protected]/org.elasticsearch.action.ActionRunnable$2.accept(ActionRunnable.java:48)
1> at [email protected]/org.elasticsearch.action.ActionRunnable$3.doRun(ActionRunnable.java:73)
1> at [email protected]/org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:26)
1> ... 6 more
Metadata
Metadata
Assignees
Labels
:Search Relevance/HighlightingHow a query matched a documentHow a query matched a document>bugTeam:Search RelevanceMeta label for the Search Relevance team in ElasticsearchMeta label for the Search Relevance team in Elasticsearchv8.10.0