Skip to content

Conversation

@iverase
Copy link
Contributor

@iverase iverase commented Nov 8, 2021

When creating a SourceConfirmedTextQuery with a field that does not exists in the index, then the query throws a NullPointerException. This is due to the fact that in that case the call searcher.collectionStatistics(field) returns a null which causes the exception. This PR handles that situation.

fixes #80419

@iverase iverase added >bug :Search/Search Search-related issues that do not fall into other categories v8.0.0 v7.16.1 v8.1.0 labels Nov 8, 2021
@iverase iverase requested a review from jpountz November 8, 2021 06:49
@elasticmachine elasticmachine added the Team:Search Meta label for search team label Nov 8, 2021
@elasticmachine
Copy link
Collaborator

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

@iverase iverase merged commit 1094de3 into elastic:master Nov 8, 2021
@iverase iverase deleted the SourceConfirmedTextQuery branch November 8, 2021 09:01
iverase added a commit to iverase/elasticsearch that referenced this pull request Nov 8, 2021
Prevents a npe when the field that does not exists in the index
@elasticsearchmachine
Copy link
Collaborator

💔 Backport failed

Status Branch Result
8.0
7.16 Commit could not be cherrypicked due to conflicts

You can use sqren/backport to manually backport by running backport --upstream elastic/elasticsearch --pr 80472

iverase added a commit to iverase/elasticsearch that referenced this pull request Nov 8, 2021
Prevents a npe when the field that does not exists in the index
elasticsearchmachine pushed a commit that referenced this pull request Nov 8, 2021
…0474)

Prevents a npe when the field that does not exists in the index
elasticsearchmachine pushed a commit that referenced this pull request Nov 8, 2021
…) (#80476)

* Prevent NullPointerException in SourceConfirmedTextQuery (#80472)

Prevents a npe when the field that does not exists in the index

* Prevent NullPointerException in SourceConfirmedTextQuery
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

>bug :Search/Search Search-related issues that do not fall into other categories Team:Search Meta label for search team v7.16.0 v8.0.0-rc2 v8.1.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

match_phrase query over match_only_text field can throw a NPE

6 participants