-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix infinite loop in nested agg (#15931)
Signed-off-by: kkewwei <[email protected]>
- Loading branch information
Showing
5 changed files
with
174 additions
and
12 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
111 changes: 111 additions & 0 deletions
111
rest-api-spec/src/main/resources/rest-api-spec/test/search.aggregation/410_nested_aggs.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,111 @@ | ||
--- | ||
# The test setup includes: | ||
# - Create nested mapping for test_nested_agg_index index | ||
# - Index two example documents | ||
# - nested agg | ||
|
||
setup: | ||
- do: | ||
indices.create: | ||
index: test_nested_agg_index | ||
body: | ||
mappings: | ||
properties: | ||
a: | ||
type: nested | ||
properties: | ||
b1: | ||
type: keyword | ||
b2: | ||
type: nested | ||
properties: | ||
c: | ||
type: nested | ||
properties: | ||
d: | ||
type: keyword | ||
|
||
- do: | ||
bulk: | ||
refresh: true | ||
body: | | ||
{"index": {"_index": "test_nested_agg_index", "_id": "0"}} | ||
{"a": { "b1": "b11", "b2": { "c": { "d": "d1" } }}} | ||
{"index": {"_index": "test_nested_agg_index", "_id": "1"}} | ||
{"a": { "b1": "b12", "b2": { "c": { "d": "d2" } }}} | ||
--- | ||
# Delete Index when connection is teardown | ||
teardown: | ||
- do: | ||
indices.delete: | ||
index: test_nested_agg_index | ||
|
||
--- | ||
"Supported queries": | ||
- skip: | ||
version: " - 2.17.99" | ||
reason: "fixed in 2.18.0" | ||
|
||
# Verify Document Count | ||
- do: | ||
search: | ||
body: { | ||
query: { | ||
match_all: { } | ||
} | ||
} | ||
|
||
- length: { hits.hits: 2 } | ||
|
||
# Verify nested aggregation | ||
- do: | ||
search: | ||
body: { | ||
aggs: { | ||
nested_agg: { | ||
nested: { | ||
path: "a" | ||
}, | ||
aggs: { | ||
a_b1: { | ||
terms: { | ||
field: "a.b1" | ||
}, | ||
aggs: { | ||
"c": { | ||
nested: { | ||
path: "a.b2.c" | ||
}, | ||
aggs: { | ||
"d": { | ||
terms: { | ||
field: "a.b2.c.d" | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
- length: { hits.hits: 2 } | ||
- match: { aggregations.nested_agg.doc_count: 2 } | ||
- length: { aggregations.nested_agg.a_b1.buckets: 2 } | ||
|
||
- match: { aggregations.nested_agg.a_b1.buckets.0.key: "b11" } | ||
- match: { aggregations.nested_agg.a_b1.buckets.0.doc_count: 1 } | ||
- match: { aggregations.nested_agg.a_b1.buckets.0.c.doc_count: 1 } | ||
- length: { aggregations.nested_agg.a_b1.buckets.0.c.d.buckets: "1" } | ||
- match: { aggregations.nested_agg.a_b1.buckets.0.c.d.buckets.0.key: "d1" } | ||
- match: { aggregations.nested_agg.a_b1.buckets.0.c.d.buckets.0.doc_count: 1 } | ||
|
||
- match: { aggregations.nested_agg.a_b1.buckets.1.key: "b12" } | ||
- match: { aggregations.nested_agg.a_b1.buckets.1.doc_count: 1 } | ||
- match: { aggregations.nested_agg.a_b1.buckets.1.c.doc_count: 1 } | ||
- length: { aggregations.nested_agg.a_b1.buckets.1.c.d.buckets: "1" } | ||
- match: { aggregations.nested_agg.a_b1.buckets.1.c.d.buckets.0.key: "d2" } | ||
- match: { aggregations.nested_agg.a_b1.buckets.1.c.d.buckets.0.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