Navigation Menu

Skip to content
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

Change nested agg to execute in doc id order #8454

Merged
merged 1 commit into from Nov 14, 2014

Conversation

martijnvg
Copy link
Member

By executing in docid order the child level filters don't require random access bitset any more and can use normal docid set iterators. Also the child filters don't need the bitset cache anymore and can rely on the normal filter cache.

Note: PR is against 1.x branch

if (childDocs.docID() > prevParentDoc) {
childDocId = childDocs.docID();
} else {
childDocId = childDocs.advance(prevParentDoc);
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

I think

if (prevParentDoc == -1) {
  childDocId = childDocs.nextDoc();
} else {
  if (childDocs.docID() > prevParentDoc) {
    childDocId = childDocs.docID();
  } else {
    childDocId = childDocs.advance(prevParentDoc);
  }
}

could just be replaced with

if (childDocs.docID() > prevParentDoc) {
  childDocId = childDocs.docID();
} else {
  childDocId = childDocs.advance(prevParentDoc + 1);
}

?

(No more check that the previous parent doc is -1, and advance to prevParentDoc+1 instead of prevParentDoc)

@jpountz
Copy link
Contributor

jpountz commented Nov 14, 2014

@martijnvg I like the change and just left one minor comment about a potential simplification.

@martijnvg
Copy link
Member Author

@jpountz I updated the PR with your simplification and it looks much better now!

@jpountz
Copy link
Contributor

jpountz commented Nov 14, 2014

LGTM, thanks @martijnvg !

…sed bitset in `nested` agg.

Also the nested agg now requires docs to be consumed / scored in order.

Closes elastic#8454
martijnvg added a commit that referenced this pull request Nov 14, 2014
…sed bitset in `nested` agg.

Also the nested agg now requires docs to be consumed / scored in order.

Closes #8454
@martijnvg martijnvg merged commit 5c7614f into elastic:1.x Nov 14, 2014
martijnvg added a commit that referenced this pull request Nov 14, 2014
…sed bitset in `nested` agg.

Also the nested agg now requires docs to be consumed / scored in order.

Closes #8454
@clintongormley clintongormley changed the title Aggs: Change nested agg to execute in doc id order Aggregations: Change nested agg to execute in doc id order Nov 26, 2014
martijnvg added a commit to martijnvg/elasticsearch that referenced this pull request Jan 26, 2015
… the same parent doc id.

This bug was introduced by elastic#8454 which allowed the childFilter to only be consumed once. By adding the child docid buffering multiple buckets can now be emitted by the same doc id. This child docid buffering only happens in the scope of the current root document, so the amount of child doc ids buffered is small.

Closes elastic#9317
Closes elastic#9346
martijnvg added a commit that referenced this pull request Jan 26, 2015
… the same parent doc id.

This bug was introduced by #8454 which allowed the childFilter to only be consumed once. By adding the child docid buffering multiple buckets can now be emitted by the same doc id. This child docid buffering only happens in the scope of the current root document, so the amount of child doc ids buffered is small.

Closes #9317
Closes #9346
martijnvg added a commit that referenced this pull request Jan 26, 2015
… the same parent doc id.

This bug was introduced by #8454 which allowed the childFilter to only be consumed once. By adding the child docid buffering multiple buckets can now be emitted by the same doc id. This child docid buffering only happens in the scope of the current root document, so the amount of child doc ids buffered is small.

Closes #9317
Closes #9346
martijnvg added a commit that referenced this pull request Jan 26, 2015
… the same parent doc id.

This bug was introduced by #8454 which allowed the childFilter to only be consumed once. By adding the child docid buffering multiple buckets can now be emitted by the same doc id. This child docid buffering only happens in the scope of the current root document, so the amount of child doc ids buffered is small.

Closes #9317
Closes #9346
@martijnvg martijnvg deleted the improvements/nested_agg branch May 18, 2015 23:29
@clintongormley clintongormley changed the title Aggregations: Change nested agg to execute in doc id order Change nested agg to execute in doc id order Jun 7, 2015
mute pushed a commit to mute/elasticsearch that referenced this pull request Jul 29, 2015
…sed bitset in `nested` agg.

Also the nested agg now requires docs to be consumed / scored in order.

Closes elastic#8454
mute pushed a commit to mute/elasticsearch that referenced this pull request Jul 29, 2015
… the same parent doc id.

This bug was introduced by elastic#8454 which allowed the childFilter to only be consumed once. By adding the child docid buffering multiple buckets can now be emitted by the same doc id. This child docid buffering only happens in the scope of the current root document, so the amount of child doc ids buffered is small.

Closes elastic#9317
Closes elastic#9346
@clintongormley clintongormley added :Search/Search Search-related issues that do not fall into other categories and removed :Nested Docs labels Feb 14, 2018
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 v1.4.1 v1.5.0 v2.0.0-beta1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants