forked from elastic/elasticsearch
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[7.x] Revert "Remove aggregation's postCollect phase (elastic#68942)
This partially reverts elastic#64016 and and adds elastic#67839 and adds additional tests that would have caught issues with the changes in elastic#64016. It's mostly Nik's code, I am just cleaning things up a bit. Co-authored-by: Nik Everett nik9000@gmail.com
- Loading branch information
Showing
44 changed files
with
703 additions
and
59 deletions.
There are no files selected for viewing
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
238 changes: 238 additions & 0 deletions
238
modules/parent-join/src/yamlRestTest/resources/rest-api-spec/test/50_order_by.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,238 @@ | ||
--- | ||
"order by sub agg containing join": | ||
- skip: | ||
reason: "It was fixed it 7.11.2" | ||
version: " - 7.11.2" | ||
- do: | ||
indices.create: | ||
index: test_1 | ||
body: | ||
settings: | ||
number_of_shards: 1 | ||
number_of_replicas: 0 | ||
mappings: | ||
properties: | ||
name: | ||
type: keyword | ||
join: | ||
type: join | ||
relations: | ||
animal: feature | ||
|
||
- do: | ||
bulk: | ||
index: test_1 | ||
refresh: true | ||
body: | | ||
{ "index": {"_id": "sheep"} } | ||
{ "name": "sheep", "join": {"name": "animal"} } | ||
{ "index": {"_id": "cow"} } | ||
{ "name": "cow", "join": {"name": "animal"} } | ||
{ "index": {"_id": "pig"} } | ||
{ "name": "pig", "join": {"name": "animal"} } | ||
{ "index": {"routing": "sheep"} } | ||
{ "join": {"name": "feature", "parent": "sheep"}, "tag": "danger", "number": 1 } | ||
{ "index": {"routing": "sheep"} } | ||
{ "join": {"name": "feature", "parent": "sheep"}, "tag": "fluffiness", "number": 10 } | ||
{ "index": {"routing": "cow"} } | ||
{ "join": {"name": "feature", "parent": "cow"}, "tag": "danger", "number": 3 } | ||
{ "index": {"routing": "cow"} } | ||
{ "join": {"name": "feature", "parent": "cow"}, "tag": "fluffiness", "number": 1 } | ||
{ "index": {"routing": "pig"} } | ||
{ "join": {"name": "feature", "parent": "pig"}, "tag": "danger", "number": 100 } | ||
{ "index": {"routing": "pig"} } | ||
{ "join": {"name": "feature", "parent": "pig"}, "tag": "fluffiness", "number": 1 } | ||
- do: | ||
search: | ||
index: test_1 | ||
body: | ||
size: 0 | ||
aggs: | ||
name: | ||
terms: | ||
size: 1 | ||
shard_size: 1 | ||
field: name | ||
order: | ||
- "children>max_number": desc | ||
aggs: | ||
children: | ||
children: | ||
type: feature | ||
aggs: | ||
max_number: | ||
max: | ||
field: number | ||
- length: { aggregations.name.buckets: 1 } | ||
- match: { aggregations.name.buckets.0.key: pig } | ||
- match: { aggregations.name.buckets.0.doc_count: 1 } | ||
- match: { aggregations.name.buckets.0.children.max_number.value: 100.0 } | ||
|
||
--- | ||
"order by sub agg containing join and nested": | ||
- skip: | ||
reason: "It was fixed it 7.11.2" | ||
version: " - 7.11.2" | ||
- do: | ||
indices.create: | ||
index: test_1 | ||
body: | ||
settings: | ||
number_of_shards: 1 | ||
number_of_replicas: 0 | ||
mappings: | ||
properties: | ||
name: | ||
type: keyword | ||
join: | ||
type: join | ||
relations: | ||
animal: feature | ||
nested: | ||
type: nested | ||
properties: | ||
number: | ||
type: long | ||
|
||
- do: | ||
bulk: | ||
index: test_1 | ||
refresh: true | ||
body: | | ||
{ "index": {"_id": "sheep"} } | ||
{ "name": "sheep", "join": {"name": "animal"} } | ||
{ "index": {"_id": "cow"} } | ||
{ "name": "cow", "join": {"name": "animal"} } | ||
{ "index": {"_id": "pig"} } | ||
{ "name": "pig", "join": {"name": "animal"} } | ||
{ "index": {"routing": "sheep"} } | ||
{ "join": {"name": "feature", "parent": "sheep"}, "tag": "danger", "nested": [{"number": 1}] } | ||
{ "index": {"routing": "sheep"} } | ||
{ "join": {"name": "feature", "parent": "sheep"}, "tag": "fluffiness", "nested": [{"number": 10}] } | ||
{ "index": {"routing": "cow"} } | ||
{ "join": {"name": "feature", "parent": "cow"}, "tag": "danger", "nested": [{"number": 3}] } | ||
{ "index": {"routing": "cow"} } | ||
{ "join": {"name": "feature", "parent": "cow"}, "tag": "fluffiness", "nested": [{"number": 1}] } | ||
{ "index": {"routing": "pig"} } | ||
{ "join": {"name": "feature", "parent": "pig"}, "tag": "danger", "nested": [{"number": 100}, {"number": 1}] } | ||
{ "index": {"routing": "pig"} } | ||
{ "join": {"name": "feature", "parent": "pig"}, "tag": "fluffiness", "nested": [{"number": 1}] } | ||
- do: | ||
search: | ||
index: test_1 | ||
body: | ||
size: 0 | ||
aggs: | ||
name: | ||
terms: | ||
size: 1 | ||
shard_size: 1 | ||
field: name | ||
order: | ||
- "children>nested>max_number": desc | ||
aggs: | ||
children: | ||
children: | ||
type: feature | ||
aggs: | ||
nested: | ||
nested: | ||
path: nested | ||
aggs: | ||
max_number: | ||
max: | ||
field: nested.number | ||
- length: { aggregations.name.buckets: 1 } | ||
- match: { aggregations.name.buckets.0.key: pig } | ||
- match: { aggregations.name.buckets.0.doc_count: 1 } | ||
- match: { aggregations.name.buckets.0.children.nested.max_number.value: 100.0 } | ||
|
||
--- | ||
"order by sub agg containing join and nested and filter": | ||
- skip: | ||
reason: "It was fixed it 7.11.2" | ||
version: " - 7.11.2" | ||
- do: | ||
indices.create: | ||
index: test_1 | ||
body: | ||
settings: | ||
number_of_shards: 1 | ||
number_of_replicas: 0 | ||
mappings: | ||
properties: | ||
name: | ||
type: keyword | ||
join: | ||
type: join | ||
relations: | ||
animal: feature | ||
nested: | ||
type: nested | ||
properties: | ||
code: | ||
type: | ||
keyword | ||
number: | ||
type: long | ||
|
||
- do: | ||
bulk: | ||
index: test_1 | ||
refresh: true | ||
body: | | ||
{ "index": {"_id": "sheep"} } | ||
{ "name": "sheep", "join": {"name": "animal"} } | ||
{ "index": {"_id": "cow"} } | ||
{ "name": "cow", "join": {"name": "animal"} } | ||
{ "index": {"_id": "pig"} } | ||
{ "name": "pig", "join": {"name": "animal"} } | ||
{ "index": {"routing": "sheep"} } | ||
{ "join": {"name": "feature", "parent": "sheep"}, "tag": "danger", "nested": [{"code": "mighty", "number": 1}, {"code": "meek", "number": 100}] } | ||
{ "index": {"routing": "sheep"} } | ||
{ "join": {"name": "feature", "parent": "sheep"}, "tag": "fluffiness", "nested": [{"code": "mighty", "number": 10}, {"code": "meek", "number": 10}] } | ||
{ "index": {"routing": "cow"} } | ||
{ "join": {"name": "feature", "parent": "cow"}, "tag": "danger", "nested": [{"code": "mighty", "number": 3}, {"code": "meek", "number": 3}] } | ||
{ "index": {"routing": "cow"} } | ||
{ "join": {"name": "feature", "parent": "cow"}, "tag": "fluffiness", "nested": [{"code": "mighty", "number": 1}, {"code": "meek", "number": 1}] } | ||
{ "index": {"routing": "pig"} } | ||
{ "join": {"name": "feature", "parent": "pig"}, "tag": "danger", "nested": [{"code": "mighty", "number": 100}, {"code": "meek", "number": 1}] } | ||
{ "index": {"routing": "pig"} } | ||
{ "join": {"name": "feature", "parent": "pig"}, "tag": "fluffiness", "nested": [{"code": "mighty", "number": 1}, {"code": "meek", "number": 1}] } | ||
- do: | ||
search: | ||
index: test_1 | ||
body: | ||
size: 0 | ||
aggs: | ||
name: | ||
terms: | ||
size: 1 | ||
shard_size: 1 | ||
field: name | ||
order: | ||
- "children>nested>filter>max_number": desc | ||
aggs: | ||
children: | ||
children: | ||
type: feature | ||
aggs: | ||
nested: | ||
nested: | ||
path: nested | ||
aggs: | ||
filter: | ||
filter: | ||
match: | ||
nested.code: mighty | ||
aggs: | ||
max_number: | ||
max: | ||
field: nested.number | ||
- length: { aggregations.name.buckets: 1 } | ||
- match: { aggregations.name.buckets.0.key: pig } | ||
- match: { aggregations.name.buckets.0.doc_count: 1 } | ||
- match: { aggregations.name.buckets.0.children.nested.filter.max_number.value: 100.0 } |
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
Oops, something went wrong.