Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.Sign up
Optimize the composite aggregation for match_all and range queries #28745
This change refactors the composite aggregation to add an execution mode that visits documents in the order of the values present in the leading source of the composite definition. This mode does not need to visit all documents since it can early terminate the collection when the leading source value is greater than the lowest value in the queue.
... can use the field
This mode can execute iff:
If these conditions are not met this aggregation visits each document like any other agg.
I still need to dig more to fully understand how it works but I like the idea. Some comments:
OK, I had a more thorough review and I like the change in general. There is one or two places where it might make too strong assumptions about the value of the cost but other than that it looks good to me. I'd also like to see more comments to explain how things work. I suggested some javadocs improvements.
Mar 26, 2018
added a commit
this pull request
Mar 27, 2018
referenced this pull request
Apr 23, 2018
Hi! It seems that the optimization of index sorting is replaced by the execution mode that visits documents in the order of the values present in the leading source. I wonder why the previous optimization could not be retained. The condition of index sorting is easier to be met and can early terminate aggregation on each segment without the condition of leading source and query.
Grateful for any help!