Skip to content

Preserve the order of nested documents in the Lucene index#34225

Merged
jimczi merged 1 commit intoelastic:masterfrom
jimczi:nested_documents_ordering
Oct 3, 2018
Merged

Preserve the order of nested documents in the Lucene index#34225
jimczi merged 1 commit intoelastic:masterfrom
jimczi:nested_documents_ordering

Conversation

@jimczi
Copy link
Copy Markdown
Contributor

@jimczi jimczi commented Oct 2, 2018

Today we reverse the initial order of the nested documents when we
index them in order to ensure that parents documents appear after
their children. This means that a query will always match nested documents
in the reverse order of their offsets in the source document.
Reversing all documents is not needed so this change ensures that parents
documents appear after their children without modifying the initial order
in each nested level. This allows to match children in the order of their
appearance in the source document which is a requirement to efficiently
implement #33587. Old indices created before this change will continue
to reverse the order of nested documents to ensure backwark compatibility.

Today we reverse the initial order of the nested documents when we
index them in order to ensure that parents documents appear after
their children. This means that a query will always match nested documents
in the reverse order of their offsets in the source document.
Reversing all documents is not needed so this change ensures that parents
documents appear after their children without modifying the initial order
in each nested level. This allows to match children in the order of their
appearance in the source document which is a requirement to efficiently
implement elastic#33587. Old indices created before this change will continue
to reverse the order of nested documents to ensure backwark compatibility.
@jimczi jimczi added >enhancement :Search Foundations/Mapping Index mappings, including merging and defining field types v7.0.0 v6.5.0 labels Oct 2, 2018
@jimczi jimczi requested a review from martijnvg October 2, 2018 12:52
@elasticmachine
Copy link
Copy Markdown
Collaborator

Pinging @elastic/es-search-aggs

Copy link
Copy Markdown
Member

@martijnvg martijnvg left a comment

Choose a reason for hiding this comment

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

LGTM - Leaving the children in the original provided order makes a lot of sense!

@jimczi jimczi merged commit 5a3e031 into elastic:master Oct 3, 2018
@jimczi jimczi deleted the nested_documents_ordering branch October 3, 2018 09:55
jimczi added a commit that referenced this pull request Oct 3, 2018
Today we reverse the initial order of the nested documents when we
index them in order to ensure that parents documents appear after
their children. This means that a query will always match nested documents
in the reverse order of their offsets in the source document.
Reversing all documents is not needed so this change ensures that parents
documents appear after their children without modifying the initial order
in each nested level. This allows to match children in the order of their
appearance in the source document which is a requirement to efficiently
implement #33587. Old indices created before this change will continue
to reverse the order of nested documents to ensure backwark compatibility.
jimczi added a commit that referenced this pull request Oct 3, 2018
jimczi added a commit that referenced this pull request Oct 3, 2018
jimczi added a commit that referenced this pull request Oct 4, 2018
erayarslan added a commit to erayarslan/elasticsearch that referenced this pull request Oct 4, 2018
kcm pushed a commit that referenced this pull request Oct 30, 2018
Today we reverse the initial order of the nested documents when we
index them in order to ensure that parents documents appear after
their children. This means that a query will always match nested documents
in the reverse order of their offsets in the source document.
Reversing all documents is not needed so this change ensures that parents
documents appear after their children without modifying the initial order
in each nested level. This allows to match children in the order of their
appearance in the source document which is a requirement to efficiently
implement #33587. Old indices created before this change will continue
to reverse the order of nested documents to ensure backwark compatibility.
kcm pushed a commit that referenced this pull request Oct 30, 2018
kcm pushed a commit that referenced this pull request Oct 30, 2018
kcm pushed a commit that referenced this pull request Oct 30, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

>enhancement :Search Foundations/Mapping Index mappings, including merging and defining field types v6.5.0 v7.0.0-beta1

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants