Skip to content

Commit

Permalink
added test for flattened type in top_metrics.yml (#78960)
Browse files Browse the repository at this point in the history
  • Loading branch information
nilanshu96 authored Oct 18, 2021
1 parent 94ab204 commit 6895511
Showing 1 changed file with 39 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -668,3 +668,42 @@
- match: { aggregations.tm.top.1.sort: [2] }
- match: { aggregations.tm.top.2.metrics.animal\.keyword: null}
- match: { aggregations.tm.top.2.sort: [3] }

---
"with flattened":
- do:
indices.create:
index: test
body:
mappings:
properties:
host:
type: flattened

- do:
bulk:
index: test
refresh: true
body:
- '{"index": {}}'
- '{"host": {"hostname": "abc", "name": "x"}, "v": 1}'
- '{"index": {}}'
- '{"host": {"hostname": "foo", "name": "y"}, "v": 2}'
- '{"index": {}}'
- '{"host": {"hostname": "bar", "name": "z"}, "v": 3}'

- do:
search:
index: test
size: 0
body:
aggs:
tm:
top_metrics:
metrics:
field: host.hostname
sort:
v: asc
size: 3
- match: { aggregations.tm.top.0.sort: [1] }
- match: { aggregations.tm.top.0.metrics.host\.hostname: abc }

0 comments on commit 6895511

Please sign in to comment.