Browse Source

TSDB: Test ids query on time series index (#81436)

Christos Soulios 3 years ago
parent
commit
0c9af5003d

+ 34 - 0
rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/tsdb/40_search.yml

@@ -325,3 +325,37 @@ field capabilities:
   - is_false: fields._tsid._tsid.indices
   - is_false: fields._tsid._tsid.non_searchable_indices
   - is_false: fields._tsid._tsid.non_aggregatable_indices
+
+---
+ids query:
+  - skip:
+      version: " - 8.0.99"
+      reason: introduced in 8.1.0
+
+  # Ingest documents assigning custom ids so we can query them
+  - do:
+      bulk:
+        refresh: true
+        body:
+          - '{"index": {"_index": "test", "_id": "u1"}}'
+          - '{"@timestamp": "2021-04-28T18:45:04.467Z", "metricset": "foo", "k8s": {"pod": {"name": "cat", "uid":"6483d28c-24ee-44f2-926b-63b89d6d8b1b", "ip": "10.10.55.1", "network": {"tx": 2001828691, "rx": 802133794}}}}'
+          - '{"index": {"_index": "test", "_id": "u2"}}'
+          - '{"@timestamp": "2021-04-28T18:50:24.467Z", "metricset": "foo", "k8s": {"pod": {"name": "cat", "uid":"6483d28c-24ee-44f2-926b-63b89d6d8b1b", "ip": "10.10.55.1", "network": {"tx": 2001838691, "rx": 801479970}}}}'
+          - '{"index": {"_index": "test", "_id": "u3"}}'
+          - '{"@timestamp": "2021-04-28T18:55:24.467Z", "metricset": "foo", "k8s": {"pod": {"name": "cat", "uid":"6483d28c-24ee-44f2-926b-63b89d6d8b1b", "ip": "10.10.55.1", "network": {"tx": 2001848691, "rx": 801479970}}}}'
+
+  - do:
+      search:
+        index: test
+        body:
+          fields:
+            - field: k8s.pod.network.tx
+          query:
+            ids:
+              values: ["u1", "u3"]
+
+  - match: {hits.total.value: 2}
+  - match: {hits.hits.0._id: "u1"}
+  - match: {hits.hits.0.fields.k8s\.pod\.network\.tx: [2001828691]}
+  - match: {hits.hits.1._id: "u3"}
+  - match: {hits.hits.1.fields.k8s\.pod\.network\.tx: [2001848691]}