Skip to content

Commit 6895511

Browse files
authored
added test for flattened type in top_metrics.yml (#78960)
1 parent 94ab204 commit 6895511

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
@@ -668,3 +668,42 @@
668668
- match: { aggregations.tm.top.1.sort: [2] }
669669
- match: { aggregations.tm.top.2.metrics.animal\.keyword: null}
670670
- match: { aggregations.tm.top.2.sort: [3] }
671+
672+
---
673+
"with flattened":
674+
- do:
675+
indices.create:
676+
index: test
677+
body:
678+
mappings:
679+
properties:
680+
host:
681+
type: flattened
682+
683+
- do:
684+
bulk:
685+
index: test
686+
refresh: true
687+
body:
688+
- '{"index": {}}'
689+
- '{"host": {"hostname": "abc", "name": "x"}, "v": 1}'
690+
- '{"index": {}}'
691+
- '{"host": {"hostname": "foo", "name": "y"}, "v": 2}'
692+
- '{"index": {}}'
693+
- '{"host": {"hostname": "bar", "name": "z"}, "v": 3}'
694+
695+
- do:
696+
search:
697+
index: test
698+
size: 0
699+
body:
700+
aggs:
701+
tm:
702+
top_metrics:
703+
metrics:
704+
field: host.hostname
705+
sort:
706+
v: asc
707+
size: 3
708+
- match: { aggregations.tm.top.0.sort: [1] }
709+
- match: { aggregations.tm.top.0.metrics.host\.hostname: abc }

0 commit comments

Comments
 (0)