forked from elastic/elasticsearch
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix composite early termination on sorted
I broke composite early termination when reworking how aggregations' contact for `getLeafCollector` around early termination in elastic#70320. We didn't see it in our tests because we weren't properly emulating the aggregation collection stage. This fixes early termination by adhering to the new contract and adds more tests. Closes elastic#72078 Co-authored-by: Benjamin Trent <[email protected]>
- Loading branch information
Showing
4 changed files
with
190 additions
and
4 deletions.
There are no files selected for viewing
173 changes: 173 additions & 0 deletions
173
...src/yamlRestTest/resources/rest-api-spec/test/search.aggregation/235_composite_sorted.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,173 @@ | ||
--- | ||
setup: | ||
- do: | ||
indices.create: | ||
index: sorted | ||
body: | ||
mappings: | ||
properties: | ||
date: | ||
type: date | ||
kw: | ||
type: keyword | ||
settings: | ||
index: | ||
number_of_shards: 1 | ||
number_of_replicas: 0 | ||
sort: | ||
field: date | ||
order: desc | ||
|
||
# Index single documents at a time and refresh. That'll create as many | ||
# segments as possible which has revealed bugs in the past. | ||
- do: | ||
index: | ||
index: sorted | ||
body: {"date": "2021-01-01T00:00:00Z", "kw": "cat"} | ||
refresh: true | ||
- do: | ||
index: | ||
index: sorted | ||
body: {"date": "2021-01-02T00:00:00Z", "kw": "cat"} | ||
refresh: true | ||
- do: | ||
index: | ||
index: sorted | ||
body: {"date": "2021-01-03T00:00:00Z", "kw": "cat"} | ||
refresh: true | ||
- do: | ||
index: | ||
index: sorted | ||
body: {"date": "2021-01-04T00:00:00Z", "kw": "cat"} | ||
refresh: true | ||
- do: | ||
index: | ||
index: sorted | ||
body: {"date": "2021-01-05T00:00:00Z", "kw": "cat"} | ||
refresh: true | ||
- do: | ||
index: | ||
index: sorted | ||
body: {"date": "2021-01-06T00:00:00Z", "kw": "cat"} | ||
refresh: true | ||
- do: | ||
index: | ||
index: sorted | ||
body: {"date": "2021-01-07T00:00:00Z", "kw": "cat"} | ||
refresh: true | ||
- do: | ||
index: | ||
index: sorted | ||
body: {"date": "2021-01-08T00:00:00Z", "kw": "cat"} | ||
refresh: true | ||
- do: | ||
index: | ||
index: sorted | ||
body: {"date": "2021-01-09T00:00:00Z", "kw": "not a cat"} | ||
refresh: true | ||
- do: | ||
index: | ||
index: sorted | ||
body: {"date": "2021-01-10T00:00:00Z", "kw": "also not a cat"} | ||
refresh: true | ||
|
||
--- | ||
one source - first page: | ||
- do: | ||
search: | ||
index: sorted | ||
body: | ||
size: 0 | ||
aggs: | ||
c: | ||
composite: | ||
size: 2 | ||
sources: | ||
- date: | ||
date_histogram: | ||
field: date | ||
calendar_interval: day | ||
- length: { aggregations.c.buckets: 2 } | ||
- match: { aggregations.c.buckets.0.key.date: 1609459200000 } | ||
- match: { aggregations.c.buckets.0.doc_count: 1 } | ||
- match: { aggregations.c.buckets.1.key.date: 1609545600000 } | ||
- match: { aggregations.c.buckets.1.doc_count: 1 } | ||
|
||
--- | ||
one source - second page: | ||
- do: | ||
search: | ||
index: sorted | ||
body: | ||
size: 0 | ||
aggs: | ||
c: | ||
composite: | ||
size: 2 | ||
sources: | ||
- date: | ||
date_histogram: | ||
field: date | ||
calendar_interval: day | ||
after: | ||
date: 1609545600000 | ||
- length: { aggregations.c.buckets: 2 } | ||
- match: { aggregations.c.buckets.0.key.date: 1609632000000 } | ||
- match: { aggregations.c.buckets.0.doc_count: 1 } | ||
- match: { aggregations.c.buckets.1.key.date: 1609718400000 } | ||
- match: { aggregations.c.buckets.1.doc_count: 1 } | ||
|
||
--- | ||
two sources - first page: | ||
- do: | ||
search: | ||
index: sorted | ||
body: | ||
size: 0 | ||
aggs: | ||
c: | ||
composite: | ||
size: 2 | ||
sources: | ||
- date: | ||
date_histogram: | ||
field: date | ||
calendar_interval: day | ||
- kw: | ||
terms: | ||
field: kw | ||
- length: { aggregations.c.buckets: 2 } | ||
- match: { aggregations.c.buckets.0.key.date: 1609459200000 } | ||
- match: { aggregations.c.buckets.0.key.kw: 1609459200000 } | ||
- match: { aggregations.c.buckets.0.doc_count: 1 } | ||
- match: { aggregations.c.buckets.1.key.date: 1609545600000 } | ||
- match: { aggregations.c.buckets.0.key.kw: 1609459200000 } | ||
- match: { aggregations.c.buckets.1.doc_count: 1 } | ||
|
||
--- | ||
two sources - second page: | ||
- do: | ||
search: | ||
index: sorted | ||
body: | ||
size: 0 | ||
aggs: | ||
c: | ||
composite: | ||
size: 2 | ||
sources: | ||
- date: | ||
date_histogram: | ||
field: date | ||
calendar_interval: day | ||
- kw: | ||
terms: | ||
field: kw | ||
after: | ||
date: 1609545600000 | ||
kw: cat | ||
- length: { aggregations.c.buckets: 2 } | ||
- match: { aggregations.c.buckets.0.key.date: 1609632000000 } | ||
- match: { aggregations.c.buckets.0.doc_count: 1 } | ||
- match: { aggregations.c.buckets.1.key.date: 1609718400000 } | ||
- match: { aggregations.c.buckets.1.doc_count: 1 } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters