Skip to content

Highlight of SourceConfirmedTextQuery can throw NPE #125635

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
dnhatn opened this issue Mar 26, 2025 · 3 comments · Fixed by #127414
Closed

Highlight of SourceConfirmedTextQuery can throw NPE #125635

dnhatn opened this issue Mar 26, 2025 · 3 comments · Fixed by #127414
Assignees
Labels
>bug priority:normal A label for assessing bug priority to be used by ES engineers :Search Relevance/Highlighting How a query matched a document Team:Search Relevance Meta label for the Search Relevance team in Elasticsearch

Comments

@dnhatn
Copy link
Member

dnhatn commented Mar 26, 2025

Caused by: java.lang.NullPointerException: Cannot invoke \"org.apache.lucene.search.ScorerSupplier.get(long)\" because the return value of \"org.elasticsearch.index.mapper.extras.SourceConfirmedTextQuery$2.scorerSupplier(org.apache.lucene.index.LeafReaderContext)\" is null
\tat [email protected]/org.elasticsearch.index.mapper.extras.SourceConfirmedTextQuery$2.matches(SourceConfirmedTextQuery.java:324)
\tat [email protected]/org.apache.lucene.search.DisjunctionMaxQuery$DisjunctionMaxWeight.matches(DisjunctionMaxQuery.java:125)
\tat [email protected]/org.apache.lucene.search.uhighlight.FieldOffsetStrategy.createOffsetsEnumsWeightMatcher(FieldOffsetStrategy.java:147)
\tat [email protected]/org.apache.lucene.search.uhighlight.FieldOffsetStrategy.createOffsetsEnumFromReader(FieldOffsetStrategy.java:74)
\tat [email protected]/org.apache.lucene.search.uhighlight.MemoryIndexOffsetStrategy.getOffsetsEnum(MemoryIndexOffsetStrategy.java:117)
\tat [email protected]/org.apache.lucene.search.uhighlight.FieldHighlighter.highlightFieldForDoc(FieldHighlighter.java:83)
\tat [email protected]/org.elasticsearch.lucene.search.uhighlight.CustomFieldHighlighter.highlightFieldForDoc(CustomFieldHighlighter.java:75)
\tat [email protected]/org.elasticsearch.lucene.search.uhighlight.CustomUnifiedHighlighter.highlightField(CustomUnifiedHighlighter.java:152)
\tat [email protected]/org.elasticsearch.search.fetch.subphase.highlight.DefaultHighlighter.highlight(DefaultHighlighter.java:87)
\tat [email protected]/org.elasticsearch.search.fetch.subphase.highlight.HighlightPhase$1.process(HighlightPhase.java:70)
\tat [email protected]/org.elasticsearch.search.fetch.FetchPhase$1.nextDoc(FetchPhase.java:188)
\tat [email protected]/org.elasticsearch.search.fetch.FetchPhaseDocsIterator.iterate(FetchPhaseDocsIterator.java:90)
\tat [email protected]/org.elasticsearch.search.fetch.FetchPhase.buildSearchHits(FetchPhase.java:205)
\tat [email protected]/org.elasticsearch.search.fetch.FetchPhase.execute(FetchPhase.java:85)
\tat [email protected]/org.elasticsearch.search.SearchService.lambda$executeFetchPhase$13(SearchService.java:1028)
\tat [email protected]/org.elasticsearch.action.ActionRunnable$3.accept(ActionRunnable.java:79)
\tat [email protected]/org.elasticsearch.action.ActionRunnable$3.accept(ActionRunnable.java:76)
\tat [email protected]/org.elasticsearch.action.ActionRunnable$4.doRun(ActionRunnable.java:101)
\tat [email protected]/org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:27)
@dnhatn dnhatn added the :Search Relevance/Highlighting How a query matched a document label Mar 26, 2025
@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/es-search-relevance (Team:Search Relevance)

@elasticsearchmachine elasticsearchmachine added the Team:Search Relevance Meta label for the Search Relevance team in Elasticsearch label Mar 26, 2025
@benwtrent benwtrent added >bug priority:normal A label for assessing bug priority to be used by ES engineers labels Mar 26, 2025
@adityabad
Copy link

Steps of reproduction please?

@benwtrent
Copy link
Member

@adityabad I appreciate your concern on bug quality :). However, this was a log seen in the wild and consequently a simple reproduction is likely not possible.

If you wish to address the bug, or have ran into yourself, it is appreciated.

@benwtrent benwtrent self-assigned this Apr 25, 2025
@cbuescher cbuescher marked this as a duplicate of #127438 Apr 28, 2025
elasticsearchmachine pushed a commit that referenced this issue Apr 29, 2025
…127414)

We should check for the field and statistics actually existing when
checking matches and explanation with `match_only_text` fields

closes: #125635
benwtrent added a commit to benwtrent/elasticsearch that referenced this issue Apr 29, 2025
…lastic#127414)

We should check for the field and statistics actually existing when
checking matches and explanation with `match_only_text` fields

closes: elastic#125635
(cherry picked from commit 3d67e0e)
elasticsearchmachine pushed a commit that referenced this issue Apr 29, 2025
…127414) (#127526)

We should check for the field and statistics actually existing when
checking matches and explanation with `match_only_text` fields

closes: #125635
(cherry picked from commit 3d67e0e)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
>bug priority:normal A label for assessing bug priority to be used by ES engineers :Search Relevance/Highlighting How a query matched a document Team:Search Relevance Meta label for the Search Relevance team in Elasticsearch
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants