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 broken parent and child aggregator (elastic#63811)
In elastic#57892 I broke *some* sub-aggregations inside of the `parent` and `child` aggregator, specifically any sub-aggregations that do work in the `postCollect` phase. This fixes it by delaying the post collect phase of aggs under `parent` and `child` until `beforeBuildingBuckets` because, well, we haven't done *any* collection until after that phase.
- Loading branch information
Showing
6 changed files
with
147 additions
and
66 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
24 changes: 0 additions & 24 deletions
24
modules/parent-join/src/test/resources/rest-api-spec/test/40_unconfigred.yml
This file was deleted.
Oops, something went wrong.
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
119 changes: 119 additions & 0 deletions
119
modules/parent-join/src/yamlRestTest/resources/rest-api-spec/test/40_aggregations.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,119 @@ | ||
setup: | ||
- do: | ||
indices.create: | ||
index: test | ||
body: | ||
settings: | ||
number_of_shards: 2 #Two shards proves that we route properly | ||
mappings: | ||
properties: | ||
join_field: { "type": "join", "relations": { "parent": "child", "child": "grand_child" } } | ||
id: { "type": "keyword" } | ||
|
||
- do: | ||
bulk: | ||
index: test | ||
refresh: true | ||
body: | ||
- '{ "index": {"_id": "1"}}' | ||
- '{ "tag": "bump", "join_field": { "name": "parent" } }' | ||
- '{ "index": {"_id": "2"}}' | ||
- '{ "tag": "jumble", "join_field": { "name": "parent" } }' | ||
- '{ "index": {"_id": "3", "routing": "1"}}' | ||
- '{ "animal": "dog", "join_field": { "name": "child", "parent": "1" } }' | ||
- '{ "index": {"_id": "4", "routing": "1"}}' | ||
- '{ "animal": "cat", "join_field": { "name": "child", "parent": "1" } }' | ||
- '{ "index": {"_id": "5", "routing": "2"}}' | ||
- '{ "animal": "dog", "join_field": { "name": "child", "parent": "2" } }' | ||
- '{ "index": {"_id": "6", "routing": "1"}}' | ||
- '{ "join_field": { "name": "grand_child", "parent": "5" } }' | ||
|
||
--- | ||
unconfigured: | ||
- do: | ||
index: | ||
index: test_unconfigured | ||
refresh: true | ||
body: | ||
join: | ||
name: question | ||
body: <p>I have Windows 2003 server and i bought a new Windows 2008 server..., | ||
title: Whats the best way to file transfer my site from server to a newer one?, | ||
tags: [windows-server-2003, windows-server-2008, file-transfer] | ||
|
||
- do: | ||
search: | ||
index: test_unconfigured | ||
body: | ||
size: 0 | ||
aggs: | ||
to-answers: | ||
children: | ||
type: answer | ||
- match: { hits.total.value: 1 } | ||
- match: { aggregations.to-answers.doc_count: 0 } | ||
|
||
--- | ||
children: | ||
- do: | ||
search: | ||
index: test | ||
body: | ||
size: 0 | ||
aggs: | ||
children: | ||
children: | ||
type: child | ||
- match: { hits.total.value: 6 } | ||
- match: { aggregations.children.doc_count: 3 } | ||
|
||
--- | ||
children containing cardinality: | ||
- do: | ||
search: | ||
index: test | ||
body: | ||
size: 0 | ||
aggs: | ||
children: | ||
children: | ||
type: child | ||
aggs: | ||
cardinality: | ||
cardinality: | ||
field: animal.keyword | ||
- match: { hits.total.value: 6 } | ||
- match: { aggregations.children.doc_count: 3 } | ||
- match: { aggregations.children.cardinality.value: 2 } | ||
|
||
--- | ||
parent: | ||
- do: | ||
search: | ||
index: test | ||
body: | ||
size: 0 | ||
aggs: | ||
parent: | ||
parent: | ||
type: child | ||
- match: { hits.total.value: 6 } | ||
- match: { aggregations.parent.doc_count: 2 } | ||
|
||
--- | ||
parent cardinality: | ||
- do: | ||
search: | ||
index: test | ||
body: | ||
size: 0 | ||
aggs: | ||
parent: | ||
parent: | ||
type: child | ||
aggs: | ||
cardinality: | ||
cardinality: | ||
field: tag.keyword | ||
- match: { hits.total.value: 6 } | ||
- match: { aggregations.parent.doc_count: 2 } |
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