-
Notifications
You must be signed in to change notification settings - Fork 24.9k
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
Exists queries to MatchNoneQueryBuilder when the field is unmapped #54857
Conversation
Pinging @elastic/es-search (:Search/Search) |
server/src/main/java/org/elasticsearch/index/query/ExistsQueryBuilder.java
Outdated
Show resolved
Hide resolved
@jpountz Updated the PR. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, I left some suggestions to make it better.
server/src/main/java/org/elasticsearch/index/query/ExistsQueryBuilder.java
Show resolved
Hide resolved
server/src/main/java/org/elasticsearch/index/query/ExistsQueryBuilder.java
Outdated
Show resolved
Hide resolved
server/src/test/java/org/elasticsearch/index/query/ExistsQueryBuilderTests.java
Outdated
Show resolved
Hide resolved
server/src/test/java/org/elasticsearch/index/query/ExistsQueryBuilderTests.java
Outdated
Show resolved
Hide resolved
I updated the PR, let me know if this works. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, this looks close to me, I only left minor comments. Can you also add a testMustRewrite
test to ExistsQueryBuilderTests for unmapped fields? You can look at TermQueryBuilderTests for inspiration, I believe that is has such logic.
return Collections.emptySet(); | ||
} | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe that this entire if statement can be removed without affecting correctness. It is not possible to have a field that is neither and object nor a field at this stage.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But in this, if
statement we are checking the field type.
MappedFieldType fieldType = context.getMapperService().fieldType(field);
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks I had the wrong assumption that simpleMatchToIndexName would return an empty set if the field is not mapped.
server/src/main/java/org/elasticsearch/index/query/ExistsQueryBuilder.java
Show resolved
Hide resolved
Updated the PR with tests. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@elasticmachine test this please
return Collections.emptySet(); | ||
} | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks I had the wrong assumption that simpleMatchToIndexName would return an empty set if the field is not mapped.
@elasticmachine test this please |
@jpountz Merged lastest master. Please trigger the test? |
@jpountz any update? |
@elasticmachine test this please |
@jpountz I didn't find any test failure related to my changes. Am I missing something here? Thanks |
@elasticmachine update master |
@elasticmachine test this please |
@SivagurunathanV Agreed, this looks like a transient failure. I triggered a new build. |
@SivagurunathanV Can you merge master again? |
@jpountz I merged the latest master. Please trigger a new build to check. |
@elasticmachine test this please |
@jpountz passed 🎉 |
@jpountz Can you please merge this PR? |
gradle check
?