Skip to content

Conversation

@jimczi
Copy link
Contributor

@jimczi jimczi commented Sep 26, 2018

When nested objects are present in the mappings, we add a filter in
queries to exclude them if there is no evidence that the query cannot
match in this space. In 6x we visit the query in order to find a mandatory
clause that can match root documents only. If we find one we can omit the
nested documents filter. Currently only term and range queries are checked,
this change adds the support for terms query to effectively remove the nested filter
if a mandatory terms clause targets a non-nested field.

Closes #34067

When nested objects are present in the mappings, we add a filter in
queries to exclude them if there is no evidence that the query cannot
match in this space. In 6x we visit the query in order to find a mandatory
clause that can match root documents only. If we find one we can omit the
nested documents filter. Currently only `term` and `range` queries are checked,
this change adds the support for `terms` query to effectively remove the nested filter
if a mandatory `terms` clause targets a non-nested field.

Closes elastic#34067
@jimczi jimczi added >enhancement :Search/Search Search-related issues that do not fall into other categories v7.0.0 v6.5.0 labels Sep 26, 2018
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-search-aggs

@mayya-sharipova mayya-sharipova self-requested a review October 1, 2018 20:54
Copy link
Contributor

@mayya-sharipova mayya-sharipova left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks Jim, makes sense!

@jimczi jimczi merged commit aba4a59 into elastic:master Oct 2, 2018
@jimczi jimczi deleted the can_match_nested_terms branch October 2, 2018 07:30
jimczi added a commit that referenced this pull request Oct 2, 2018
…34072)

When nested objects are present in the mappings, we add a filter in
queries to exclude them if there is no evidence that the query cannot
match in this space. In 6x we visit the query in order to find a mandatory
clause that can match root documents only. If we find one we can omit the
nested documents filter. Currently only `term` and `range` queries are checked,
this change adds the support for `terms` query to effectively remove the nested filter
if a mandatory `terms` clause targets a non-nested field.

Closes #34067
kcm pushed a commit that referenced this pull request Oct 30, 2018
…34072)

When nested objects are present in the mappings, we add a filter in
queries to exclude them if there is no evidence that the query cannot
match in this space. In 6x we visit the query in order to find a mandatory
clause that can match root documents only. If we find one we can omit the
nested documents filter. Currently only `term` and `range` queries are checked,
this change adds the support for `terms` query to effectively remove the nested filter
if a mandatory `terms` clause targets a non-nested field.

Closes #34067
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

>enhancement :Search/Search Search-related issues that do not fall into other categories v6.5.0 v7.0.0-beta1

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants