Skip to content

Commit 171ae21

Browse files
nik9000nilanshu96
andauthored
added test for flattened type in top_metrics.yml (#78960) (#79368)
Co-authored-by: Nilanshu V Rajmane <[email protected]>
1 parent 7490958 commit 171ae21

File tree

1 file changed

+39
-0
lines changed
  • x-pack/plugin/src/yamlRestTest/resources/rest-api-spec/test/analytics

1 file changed

+39
-0
lines changed

x-pack/plugin/src/yamlRestTest/resources/rest-api-spec/test/analytics/top_metrics.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -708,3 +708,42 @@
708708
- match: { aggregations.tm.top.1.sort: [2] }
709709
- match: { aggregations.tm.top.2.metrics.animal\.keyword: null}
710710
- match: { aggregations.tm.top.2.sort: [3] }
711+
712+
---
713+
"with flattened":
714+
- do:
715+
indices.create:
716+
index: test
717+
body:
718+
mappings:
719+
properties:
720+
host:
721+
type: flattened
722+
723+
- do:
724+
bulk:
725+
index: test
726+
refresh: true
727+
body:
728+
- '{"index": {}}'
729+
- '{"host": {"hostname": "abc", "name": "x"}, "v": 1}'
730+
- '{"index": {}}'
731+
- '{"host": {"hostname": "foo", "name": "y"}, "v": 2}'
732+
- '{"index": {}}'
733+
- '{"host": {"hostname": "bar", "name": "z"}, "v": 3}'
734+
735+
- do:
736+
search:
737+
index: test
738+
size: 0
739+
body:
740+
aggs:
741+
tm:
742+
top_metrics:
743+
metrics:
744+
field: host.hostname
745+
sort:
746+
v: asc
747+
size: 3
748+
- match: { aggregations.tm.top.0.sort: [1] }
749+
- match: { aggregations.tm.top.0.metrics.host\.hostname: abc }

0 commit comments

Comments
 (0)