From 1a00ee4b0d00ce6797b881571abe69f6750412b9 Mon Sep 17 00:00:00 2001 From: Nik Everett Date: Wed, 22 Sep 2021 14:01:53 -0400 Subject: [PATCH 1/2] TSDB: More tests This adds more tests copied from the our original TSDB prototype in PR #75638 that are still applicable time series mode indices. There are a bunch of disabled assertions because we are not yet generating `_tsid` but the non-disabled assertions are useful. And we will soon be generating the `_tsid` so we can re-enable those assertions. --- .../{10_settings.yml => 010_settings.yml} | 0 .../rest-api-spec/test/tsdb/040_search.yml | 266 ++++++++++++++++++ .../rest-api-spec/test/tsdb/050_alias.yml | 135 +++++++++ .../test/tsdb/060_add_dimensions.yml | 239 ++++++++++++++++ .../test/tsdb/070_dimension_types.yml | 206 ++++++++++++++ .../test/tsdb/080_index_resize.yml | 163 +++++++++++ 6 files changed, 1009 insertions(+) rename rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/tsdb/{10_settings.yml => 010_settings.yml} (100%) create mode 100644 rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/tsdb/040_search.yml create mode 100644 rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/tsdb/050_alias.yml create mode 100644 rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/tsdb/060_add_dimensions.yml create mode 100644 rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/tsdb/070_dimension_types.yml create mode 100644 rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/tsdb/080_index_resize.yml diff --git a/rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/tsdb/10_settings.yml b/rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/tsdb/010_settings.yml similarity index 100% rename from rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/tsdb/10_settings.yml rename to rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/tsdb/010_settings.yml diff --git a/rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/tsdb/040_search.yml b/rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/tsdb/040_search.yml new file mode 100644 index 0000000000000..f16d5f718f888 --- /dev/null +++ b/rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/tsdb/040_search.yml @@ -0,0 +1,266 @@ +setup: + - skip: + version: " - 7.99.99" + reason: introduced in 8.0.0 to be backported to 7.16.0 + + - do: + indices.create: + index: test + body: + settings: + index: + mode: time_series + mappings: + properties: + "@timestamp": + type: date + metricset: + type: keyword + time_series_dimension: true + k8s: + properties: + pod: + properties: + uid: + type: keyword + time_series_dimension: true + name: + type: keyword + ip: + type: ip + network: + properties: + tx: + type: long + rx: + type: long + - do: + bulk: + refresh: true + index: test + body: + - '{"index": {}}' + - '{"@timestamp": "2021-04-28T18:50:04.467Z", "metricset": "pod", "k8s": {"pod": {"name": "cat", "uid":"947e4ced-1786-4e53-9e0c-5c447e959507", "ip": "10.10.55.1", "network": {"tx": 2001818691, "rx": 802133794}}}}' + - '{"index": {}}' + - '{"@timestamp": "2021-04-28T18:50:24.467Z", "metricset": "pod", "k8s": {"pod": {"name": "cat", "uid":"947e4ced-1786-4e53-9e0c-5c447e959507", "ip": "10.10.55.1", "network": {"tx": 2005177954, "rx": 801479970}}}}' + - '{"index": {}}' + - '{"@timestamp": "2021-04-28T18:50:44.467Z", "metricset": "pod", "k8s": {"pod": {"name": "cat", "uid":"947e4ced-1786-4e53-9e0c-5c447e959507", "ip": "10.10.55.1", "network": {"tx": 2006223737, "rx": 802337279}}}}' + - '{"index": {}}' + - '{"@timestamp": "2021-04-28T18:51:04.467Z", "metricset": "pod", "k8s": {"pod": {"name": "cat", "uid":"947e4ced-1786-4e53-9e0c-5c447e959507", "ip": "10.10.55.2", "network": {"tx": 2012916202, "rx": 803685721}}}}' + - '{"index": {}}' + - '{"@timestamp": "2021-04-28T18:50:03.142Z", "metricset": "pod", "k8s": {"pod": {"name": "dog", "uid":"df3145b3-0563-4d3b-a0f7-897eb2876ea9", "ip": "10.10.55.3", "network": {"tx": 1434521831, "rx": 530575198}}}}' + - '{"index": {}}' + - '{"@timestamp": "2021-04-28T18:50:23.142Z", "metricset": "pod", "k8s": {"pod": {"name": "dog", "uid":"df3145b3-0563-4d3b-a0f7-897eb2876ea9", "ip": "10.10.55.3", "network": {"tx": 1434577921, "rx": 530600088}}}}' + - '{"index": {}}' + - '{"@timestamp": "2021-04-28T18:50:53.142Z", "metricset": "pod", "k8s": {"pod": {"name": "dog", "uid":"df3145b3-0563-4d3b-a0f7-897eb2876ea9", "ip": "10.10.55.3", "network": {"tx": 1434587694, "rx": 530604797}}}}' + - '{"index": {}}' + - '{"@timestamp": "2021-04-28T18:51:03.142Z", "metricset": "pod", "k8s": {"pod": {"name": "dog", "uid":"df3145b3-0563-4d3b-a0f7-897eb2876ea9", "ip": "10.10.55.3", "network": {"tx": 1434595272, "rx": 530605511}}}}' + +--- +query a dimension: + - skip: + version: " - 7.99.99" + reason: introduced in 8.0.0 to be backported to 7.16.0 + + - do: + search: + index: test + body: + query: + match: + k8s.pod.uid: 947e4ced-1786-4e53-9e0c-5c447e959507 + + - match: {hits.total.value: 4} + +--- +query a metric: + - skip: + version: " - 7.99.99" + reason: introduced in 8.0.0 to be backported to 7.16.0 + + - do: + search: + index: test + body: + query: + range: + k8s.pod.network.tx: + gt: 2006223737 + + - match: {hits.total.value: 1} + +# TODO add test showing that quering _tsid fails + +--- +fetch a dimension: + - skip: + version: " - 7.99.99" + reason: introduced in 8.0.0 to be backported to 7.16.0 + + - do: + search: + index: test + body: + fields: + - field: k8s.pod.uid + query: + query_string: + query: '+@timestamp:"2021-04-28T18:51:04.467Z" +k8s.pod.name:cat' + + - match: {hits.total.value: 1} + - match: {hits.hits.0.fields.k8s\.pod\.uid: [947e4ced-1786-4e53-9e0c-5c447e959507]} + +--- +fetch a metric: + - skip: + version: " - 7.99.99" + reason: introduced in 8.0.0 to be backported to 7.16.0 + + - do: + search: + index: test + body: + fields: + - field: k8s.pod.network.tx + query: + query_string: + query: '+@timestamp:"2021-04-28T18:51:04.467Z" +k8s.pod.name:cat' + + - match: {hits.total.value: 1} + - match: {hits.hits.0.fields.k8s\.pod\.network\.tx: [2012916202]} + - is_false: hits.hits.0.fields._tsid # tsid isn't fetched by default + +--- +fetch a tag: + - skip: + version: " - 7.99.99" + reason: introduced in 8.0.0 to be backported to 7.16.0 + + - do: + search: + index: test + body: + fields: + - field: k8s.pod.ip + query: + query_string: + query: '+@timestamp:"2021-04-28T18:51:04.467Z" +k8s.pod.name:cat' + + - match: {hits.total.value: 1} + - match: {hits.hits.0.fields.k8s\.pod\.ip: ['10.10.55.2']} + - is_false: hits.hits.0.fields._tsid # tsid isn't fetched by default + +# TODO add test to fetch the tsid + +--- +aggregate a dimension: + - skip: + version: " - 7.99.99" + reason: introduced in 8.0.0 to be backported to 7.16.0 + + - do: + search: + index: test + body: + size: 0 + aggs: + uids: + terms: + field: k8s.pod.uid + + - match: {hits.total.value: 8} + - match: {aggregations.uids.buckets.0.key: 947e4ced-1786-4e53-9e0c-5c447e959507} + - match: {aggregations.uids.buckets.0.doc_count: 4} + - match: {aggregations.uids.buckets.1.key: df3145b3-0563-4d3b-a0f7-897eb2876ea9} + - match: {aggregations.uids.buckets.1.doc_count: 4} + +--- +aggregate a metric: + - skip: + version: " - 7.99.99" + reason: introduced in 8.0.0 to be backported to 7.16.0 + + - do: + search: + index: test + body: + size: 0 + aggs: + uids: + terms: + field: k8s.pod.uid + aggs: + max_rx: + max: + field: k8s.pod.network.rx + + - match: {hits.total.value: 8} + - match: {aggregations.uids.buckets.0.key: 947e4ced-1786-4e53-9e0c-5c447e959507} + - match: {aggregations.uids.buckets.0.doc_count: 4} + - match: {aggregations.uids.buckets.0.max_rx.value: 803685721} + - match: {aggregations.uids.buckets.1.key: df3145b3-0563-4d3b-a0f7-897eb2876ea9} + - match: {aggregations.uids.buckets.1.doc_count: 4} + - match: {aggregations.uids.buckets.1.max_rx.value: 530605511} + +--- +aggregate a tag: + - skip: + version: " - 7.99.99" + reason: introduced in 8.0.0 to be backported to 7.16.0 + + - do: + search: + index: test + body: + size: 0 + aggs: + ips: + terms: + field: k8s.pod.ip + order: + _key: asc + + - match: {hits.total.value: 8} + - match: {aggregations.ips.buckets.0.key: 10.10.55.1} + - match: {aggregations.ips.buckets.0.doc_count: 3} + - match: {aggregations.ips.buckets.1.key: 10.10.55.2} + - match: {aggregations.ips.buckets.1.doc_count: 1} + - match: {aggregations.ips.buckets.2.key: 10.10.55.3} + - match: {aggregations.ips.buckets.2.doc_count: 4} + + +# TODO add a test aggregating the _tsid + +--- +field capabilities: + - skip: + version: " - 7.99.99" + reason: introduced in 8.0.0 to be backported to 7.16.0 + + - do: + field_caps: + index: test + fields: [k8s.pod.uid, k8s.pod.network.rx, k8s.pod.ip, _tsid] + + # TODO assert time_series_metric and time_series_dimension + - match: {fields.k8s\.pod\.uid.keyword.searchable: true} + - match: {fields.k8s\.pod\.uid.keyword.aggregatable: true} + - is_false: fields.k8s\.pod\.uid.keyword.indices + - is_false: fields.k8s\.pod\.uid.keyword.non_searchable_indices + - is_false: fields.k8s\.pod\.uid.keyword.non_aggregatable_indices + - match: {fields.k8s\.pod\.network\.rx.long.searchable: true} + - match: {fields.k8s\.pod\.network\.rx.long.aggregatable: true} + - is_false: fields.k8s\.pod\.network\.rx.long.indices + - is_false: fields.k8s\.pod\.network\.rx.long.non_searchable_indices + - is_false: fields.k8s\.pod\.network\.rx.long.non_aggregatable_indices + - match: {fields.k8s\.pod\.ip.ip.searchable: true} + - match: {fields.k8s\.pod\.ip.ip.aggregatable: true} + - is_false: fields.k8s\.pod\.ip.ip.indices + - is_false: fields.k8s\.pod\.ip.ip.non_searchable_indices + - is_false: fields.k8s\.pod\.ip.ip.non_aggregatable_indices + # TODO assert tsid once we build it: + # - match: {fields._tsid._tsid.searchable: false} + # - match: {fields._tsid._tsid.aggregatable: true} + # - is_false: fields._tsid._tsid.indices + # - is_false: fields._tsid._tsid.non_searchable_indices + # - is_false: fields._tsid._tsid.non_aggregatable_indices diff --git a/rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/tsdb/050_alias.yml b/rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/tsdb/050_alias.yml new file mode 100644 index 0000000000000..655fdb3450da1 --- /dev/null +++ b/rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/tsdb/050_alias.yml @@ -0,0 +1,135 @@ +setup: + - skip: + version: " - 7.99.99" + reason: introduced in 8.0.0 to be backported to 7.16.0 + + - do: + indices.create: + index: test + body: + settings: + index: + mode: time_series + mappings: + properties: + "@timestamp": + type: date + metricset: + type: keyword + time_series_dimension: true + k8s: + properties: + pod: + properties: + uid: + type: keyword + time_series_dimension: true + name: + type: keyword + ip: + type: ip + network: + properties: + tx: + type: long + rx: + type: long + - do: + bulk: + refresh: true + index: test + body: + - '{"index": {}}' + - '{"@timestamp": "2021-04-28T18:50:04.467Z", "metricset": "pod", "k8s": {"pod": {"name": "cat", "uid":"947e4ced-1786-4e53-9e0c-5c447e959507", "ip": "10.10.55.1", "network": {"tx": 2001818691, "rx": 802133794}}}}' + - '{"index": {}}' + - '{"@timestamp": "2021-04-28T18:50:24.467Z", "metricset": "pod", "k8s": {"pod": {"name": "cat", "uid":"947e4ced-1786-4e53-9e0c-5c447e959507", "ip": "10.10.55.1", "network": {"tx": 2005177954, "rx": 801479970}}}}' + - '{"index": {}}' + - '{"@timestamp": "2021-04-28T18:50:44.467Z", "metricset": "pod", "k8s": {"pod": {"name": "cat", "uid":"947e4ced-1786-4e53-9e0c-5c447e959507", "ip": "10.10.55.1", "network": {"tx": 2006223737, "rx": 802337279}}}}' + - '{"index": {}}' + - '{"@timestamp": "2021-04-28T18:51:04.467Z", "metricset": "pod", "k8s": {"pod": {"name": "cat", "uid":"947e4ced-1786-4e53-9e0c-5c447e959507", "ip": "10.10.55.2", "network": {"tx": 2012916202, "rx": 803685721}}}}' + - '{"index": {}}' + - '{"@timestamp": "2021-04-28T18:50:03.142Z", "metricset": "pod", "k8s": {"pod": {"name": "dog", "uid":"df3145b3-0563-4d3b-a0f7-897eb2876ea9", "ip": "10.10.55.3", "network": {"tx": 1434521831, "rx": 530575198}}}}' + - '{"index": {}}' + - '{"@timestamp": "2021-04-28T18:50:23.142Z", "metricset": "pod", "k8s": {"pod": {"name": "dog", "uid":"df3145b3-0563-4d3b-a0f7-897eb2876ea9", "ip": "10.10.55.3", "network": {"tx": 1434577921, "rx": 530600088}}}}' + - '{"index": {}}' + - '{"@timestamp": "2021-04-28T18:50:53.142Z", "metricset": "pod", "k8s": {"pod": {"name": "dog", "uid":"df3145b3-0563-4d3b-a0f7-897eb2876ea9", "ip": "10.10.55.3", "network": {"tx": 1434587694, "rx": 530604797}}}}' + - '{"index": {}}' + - '{"@timestamp": "2021-04-28T18:51:03.142Z", "metricset": "pod", "k8s": {"pod": {"name": "dog", "uid":"df3145b3-0563-4d3b-a0f7-897eb2876ea9", "ip": "10.10.55.3", "network": {"tx": 1434595272, "rx": 530605511}}}}' + +--- +search an alias: + - skip: + version: " - 7.99.99" + reason: introduced in 8.0.0 to be backported to 7.16.0 + + - do: + indices.put_alias: + index: test + name: test_alias + + + # TODO search on tsid once we generate it + # - do: + # search: + # index: test_alias + # body: + # size: 0 + # aggs: + # tsids: + # terms: + # field: _tsid + # order: + # _key: asc + + # - match: {hits.total.value: 8} + # - match: {aggregations.tsids.buckets.0.key: {k8s.pod.uid: 947e4ced-1786-4e53-9e0c-5c447e959507, metricset: pod}} + # - match: {aggregations.tsids.buckets.0.doc_count: 4} + # - match: {aggregations.tsids.buckets.1.key: {k8s.pod.uid: df3145b3-0563-4d3b-a0f7-897eb2876ea9, metricset: pod}} + # - match: {aggregations.tsids.buckets.1.doc_count: 4} + +--- +index into alias: + - skip: + version: " - 7.99.99" + reason: introduced in 8.0.0 to be backported to 7.16.0 + + - do: + indices.put_alias: + index: test + name: test_alias + + - do: + bulk: + refresh: true + index: test_alias + body: + - '{"index": {}}' + - '{"@timestamp": "2021-04-28T18:50:03.142Z", "metricset": "pod", "k8s": {"pod": {"name": "cow", "uid":"1c4fc7b8-93b7-4ba8-b609-2a48af2f8e39", "ip": "10.10.55.4", "network": {"tx": 1434521831, "rx": 530575198}}}}' + - '{"index": {}}' + - '{"@timestamp": "2021-04-28T18:50:23.142Z", "metricset": "pod", "k8s": {"pod": {"name": "cow", "uid":"1c4fc7b8-93b7-4ba8-b609-2a48af2f8e39", "ip": "10.10.55.4", "network": {"tx": 1434577921, "rx": 530600088}}}}' + - '{"index": {}}' + - '{"@timestamp": "2021-04-28T18:50:53.142Z", "metricset": "pod", "k8s": {"pod": {"name": "cow", "uid":"1c4fc7b8-93b7-4ba8-b609-2a48af2f8e39", "ip": "10.10.55.4", "network": {"tx": 1434587694, "rx": 530604797}}}}' + - '{"index": {}}' + - '{"@timestamp": "2021-04-28T18:51:03.142Z", "metricset": "pod", "k8s": {"pod": {"name": "cow", "uid":"1c4fc7b8-93b7-4ba8-b609-2a48af2f8e39", "ip": "10.10.55.4", "network": {"tx": 1434595272, "rx": 530605511}}}}' + - match: {errors: false} + + # TODO search on tsid once we generate it + # - do: + # search: + # index: test + # body: + # size: 0 + # aggs: + # tsids: + # terms: + # field: _tsid + # order: + # _key: asc + + # - match: {hits.total.value: 12} + # - match: {aggregations.tsids.buckets.0.key: {k8s.pod.uid: 1c4fc7b8-93b7-4ba8-b609-2a48af2f8e39, metricset: pod}} + # - match: {aggregations.tsids.buckets.0.doc_count: 4} + # - match: {aggregations.tsids.buckets.1.key: {k8s.pod.uid: 947e4ced-1786-4e53-9e0c-5c447e959507, metricset: pod}} + # - match: {aggregations.tsids.buckets.1.doc_count: 4} + # - match: {aggregations.tsids.buckets.2.key: {k8s.pod.uid: df3145b3-0563-4d3b-a0f7-897eb2876ea9, metricset: pod}} + # - match: {aggregations.tsids.buckets.2.doc_count: 4} diff --git a/rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/tsdb/060_add_dimensions.yml b/rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/tsdb/060_add_dimensions.yml new file mode 100644 index 0000000000000..f0a92d73452cb --- /dev/null +++ b/rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/tsdb/060_add_dimensions.yml @@ -0,0 +1,239 @@ +--- +add dimensions with put_mapping: + - skip: + version: " - 7.99.99" + reason: introduced in 8.0.0 to be backported to 7.16.0 + + - do: + indices.create: + index: test + body: + settings: + index: + mode: time_series + mappings: + properties: + "@timestamp": + type: date + + # TODO restore after #77731 + # - do: + # catch: "/Error building time series id: There aren't any mapped dimensions/" + # index: + # index: test + # refresh: true + # body: + # "@timestamp": "2021-04-28T18:35:24.467Z" + # metricset: cat + + - do: + indices.put_mapping: + index: test + body: + properties: + metricset: + type: keyword + time_series_dimension: true + + - do: + index: + index: test + refresh: true + body: + "@timestamp": "2021-04-28T18:35:24.467Z" + metricset: cat + + - do: + search: + index: test + body: + fields: + # - field: _tsid TODO fetch the tsid + - field: "@timestamp" + + - match: {hits.total.value: 1} + # - match: {hits.hits.0.fields._tsid: [{metricset: cat}]} TODO Fetch the tsid + - match: {hits.hits.0.fields.@timestamp: ["2021-04-28T18:35:24.467Z"]} + +--- +add dimensions to no dims with dynamic_template over index: + - skip: + version: " - 7.99.99" + reason: introduced in 8.0.0 to be backported to 7.16.0 + + - do: + indices.create: + index: test + body: + settings: + index: + mode: time_series + mappings: + dynamic_templates: + - keywords: + match_mapping_type: string + mapping: + type: keyword + time_series_dimension: true + properties: + "@timestamp": + type: date + + - do: + index: + index: test + refresh: true + body: + "@timestamp": "2021-04-28T18:35:24.467Z" + metricset: cat + - match: {result: created} + + - do: + search: + index: test + body: + fields: + # - field: _tsid TODO fetch the tsid + - field: "@timestamp" + - match: {hits.total.value: 1} + # - match: {hits.hits.0.fields._tsid: [{metricset: cat}]} TODO fetch the tsid + - match: {hits.hits.0.fields.@timestamp: ["2021-04-28T18:35:24.467Z"]} + +--- +add dimensions to no dims with dynamic_template over bulk: + - skip: + version: " - 7.99.99" + reason: introduced in 8.0.0 to be backported to 7.15.0 + + - do: + indices.create: + index: test + body: + settings: + index: + mode: time_series + mappings: + dynamic_templates: + - keywords: + match_mapping_type: string + mapping: + type: keyword + time_series_dimension: true + properties: + "@timestamp": + type: date + + - do: + bulk: + index: test + refresh: true + body: + - '{"index": {}}' + - '{"@timestamp": "2021-04-28T18:35:24.467Z", "metricset": "cat"}' + - is_false: errors + + - do: + search: + index: test + body: + fields: + # - field: _tsid TODO fetch tsid + - field: "@timestamp" + - match: {hits.total.value: 1} + # - match: {hits.hits.0.fields._tsid: [{metricset: cat}]} TODO fetch tsid + - match: {hits.hits.0.fields.@timestamp: ["2021-04-28T18:35:24.467Z"]} + +--- +add dimensions to some dims with dynamic_template over index: + - skip: + version: " - 7.99.99" + reason: introduced in 8.0.0 to be backported to 7.16.0 + + - do: + indices.create: + index: test + body: + settings: + index: + mode: time_series + mappings: + dynamic_templates: + - keywords: + match_mapping_type: string + mapping: + type: keyword + time_series_dimension: true + properties: + "@timestamp": + type: date + metricset: + type: keyword + time_series_dimension: true + + - do: + index: + index: test + refresh: true + body: + "@timestamp": "2021-04-28T18:35:24.467Z" + metricset: cat + other_dim: cat + - match: {result: created} + + - do: + search: + index: test + body: + fields: + # - field: _tsid TODO fetch tsid + - field: "@timestamp" + - match: {hits.total.value: 1} + # - match: {hits.hits.0.fields._tsid: [{metricset: cat, other_dim: cat}]} TODO fetch tsid + - match: {hits.hits.0.fields.@timestamp: ["2021-04-28T18:35:24.467Z"]} + +--- +add dimensions to some dims with dynamic_template over bulk: + - skip: + version: " - 7.99.99" + reason: introduced in 8.0.0 to be backported to 7.16.0 + + - do: + indices.create: + index: test + body: + settings: + index: + mode: time_series + mappings: + dynamic_templates: + - keywords: + match_mapping_type: string + mapping: + type: keyword + time_series_dimension: true + properties: + "@timestamp": + type: date + metricset: + type: keyword + time_series_dimension: true + + - do: + bulk: + index: test + refresh: true + body: + - '{"index": {}}' + - '{"@timestamp": "2021-04-28T18:35:24.467Z", "metricset": "cat", "other_dim": "cat"}' + - is_false: errors + + - do: + search: + index: test + body: + fields: + # - field: _tsid TODO fetch tsid + - field: "@timestamp" + - match: {hits.total.value: 1} + # - match: {hits.hits.0.fields._tsid: [{metricset: cat, other_dim: cat}]} TODO fetch tsid + - match: {hits.hits.0.fields.@timestamp: ["2021-04-28T18:35:24.467Z"]} diff --git a/rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/tsdb/070_dimension_types.yml b/rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/tsdb/070_dimension_types.yml new file mode 100644 index 0000000000000..0384840be6015 --- /dev/null +++ b/rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/tsdb/070_dimension_types.yml @@ -0,0 +1,206 @@ +keyword dimension: + - skip: + features: close_to + version: " - 7.99.99" + reason: introduced in 8.0.0 to be backported to 7.16.0 + + - do: + indices.create: + index: test + body: + settings: + index: + mode: time_series + mappings: + properties: + "@timestamp": + type: date + uid: + type: keyword + time_series_dimension: true + + - do: + bulk: + refresh: true + index: test + body: + - '{"index": {}}' + - '{"@timestamp": "2021-04-28T18:35:24.467Z", "uid": "947e4ced-1786-4e53-9e0c-5c447e959507", "voltage": 7.2}' + - '{"index": {}}' + - '{"@timestamp": "2021-04-28T18:35:34.467Z", "uid": "947e4ced-1786-4e53-9e0c-5c447e959507", "voltage": 7.6}' + - '{"index": {}}' + - '{"@timestamp": "2021-04-28T18:35:44.467Z", "uid": "947e4ced-1786-4e53-9e0c-5c447e959507", "voltage": 7.1}' + - '{"index": {}}' + - '{"@timestamp": "2021-04-28T18:35:54.467Z", "uid": "947e4ced-1786-4e53-9e0c-5c447e959507", "voltage": 7.3}' + - '{"index": {}}' + - '{"@timestamp": "2021-04-28T18:35:24.467Z", "uid": "df3145b3-0563-4d3b-a0f7-897eb2876ea9", "voltage": 3.2}' + - '{"index": {}}' + - '{"@timestamp": "2021-04-28T18:35:34.467Z", "uid": "df3145b3-0563-4d3b-a0f7-897eb2876ea9", "voltage": 3.6}' + - '{"index": {}}' + - '{"@timestamp": "2021-04-28T18:35:44.467Z", "uid": "df3145b3-0563-4d3b-a0f7-897eb2876ea9", "voltage": 3.1}' + - '{"index": {}}' + - '{"@timestamp": "2021-04-28T18:35:54.467Z", "uid": "df3145b3-0563-4d3b-a0f7-897eb2876ea9", "voltage": 3.3}' + - is_false: errors + + # TODO aggregate on tsid + # - do: + # search: + # index: test + # body: + # size: 0 + # aggs: + # tsids: + # terms: + # field: _tsid + # order: + # _key: asc + # aggs: + # voltage: + # avg: + # field: voltage + + # - match: {hits.total.value: 8} + # - match: {aggregations.tsids.buckets.0.key: {uid: 947e4ced-1786-4e53-9e0c-5c447e959507}} + # - match: {aggregations.tsids.buckets.0.doc_count: 4} + # - close_to: {aggregations.tsids.buckets.0.voltage.value: { value: 7.3, error: 0.01 }} + # - match: {aggregations.tsids.buckets.1.key: {uid: df3145b3-0563-4d3b-a0f7-897eb2876ea9}} + # - match: {aggregations.tsids.buckets.1.doc_count: 4} + # - close_to: {aggregations.tsids.buckets.1.voltage.value: { value: 3.3, error: 0.01 }} + +--- +long dimension: + - skip: + features: close_to + version: " - 7.99.99" + reason: introduced in 8.0.0 to be backported to 7.16.0 + + - do: + indices.create: + index: test + body: + settings: + index: + mode: time_series + mappings: + properties: + "@timestamp": + type: date + id: + type: long + time_series_dimension: true + + - do: + bulk: + refresh: true + index: test + body: + - '{"index": {}}' + - '{"@timestamp": "2021-04-28T18:35:24.467Z", "id": 1, "voltage": 7.2}' + - '{"index": {}}' + - '{"@timestamp": "2021-04-28T18:35:34.467Z", "id": "1", "voltage": 7.6}' + - '{"index": {}}' + - '{"@timestamp": "2021-04-28T18:35:44.467Z", "id": 1.0, "voltage": 7.1}' + - '{"index": {}}' + - '{"@timestamp": "2021-04-28T18:35:54.467Z", "id": "001", "voltage": 7.3}' + - '{"index": {}}' + - '{"@timestamp": "2021-04-28T18:35:24.467Z", "id": 2, "voltage": 3.2}' + - '{"index": {}}' + - '{"@timestamp": "2021-04-28T18:35:34.467Z", "id": 2, "voltage": 3.6}' + - '{"index": {}}' + - '{"@timestamp": "2021-04-28T18:35:44.467Z", "id": 2, "voltage": 3.1}' + - '{"index": {}}' + - '{"@timestamp": "2021-04-28T18:35:54.467Z", "id": 2, "voltage": 3.3}' + + # TODO aggregate on tsid + # - do: + # search: + # index: test + # body: + # size: 0 + # aggs: + # tsids: + # terms: + # field: _tsid + # order: + # _key: asc + # aggs: + # voltage: + # avg: + # field: voltage + + # - match: {hits.total.value: 8} + # - match: {aggregations.tsids.buckets.0.key: {id: 1}} + # - match: {aggregations.tsids.buckets.0.doc_count: 4} + # - close_to: {aggregations.tsids.buckets.0.voltage.value: { value: 7.3, error: 0.01 }} + # - match: {aggregations.tsids.buckets.1.key: {id: 2}} + # - match: {aggregations.tsids.buckets.1.doc_count: 4} + # - close_to: {aggregations.tsids.buckets.1.voltage.value: { value: 3.3, error: 0.01 }} + +--- +ip dimension: + - skip: + features: close_to + version: " - 7.99.99" + reason: introduced in 8.0.0 to be backported to 7.16.0 + + - do: + indices.create: + index: test + body: + settings: + index: + mode: time_series + mappings: + properties: + "@timestamp": + type: date + ip: + type: ip + time_series_dimension: true + + - do: + bulk: + refresh: true + index: test + body: + - '{"index": {}}' + - '{"@timestamp": "2021-04-28T18:35:24.467Z", "ip": "10.10.1.1", "voltage": 7.2}' + - '{"index": {}}' + - '{"@timestamp": "2021-04-28T18:35:34.467Z", "ip": "10.10.1.1", "voltage": 7.6}' + - '{"index": {}}' + - '{"@timestamp": "2021-04-28T18:35:44.467Z", "ip": "10.10.1.1", "voltage": 7.1}' + - '{"index": {}}' + - '{"@timestamp": "2021-04-28T18:35:54.467Z", "ip": "::ffff:10.10.1.1", "voltage": 7.3}' + - '{"index": {}}' + - '{"@timestamp": "2021-04-28T18:35:24.467Z", "ip": "2001:0db8:85a3:0000:0000:8a2e:0370:7334", "voltage": 3.2}' + - '{"index": {}}' + - '{"@timestamp": "2021-04-28T18:35:34.467Z", "ip": "2001:0db8:85a3:0:0:8a2e:0370:7334", "voltage": 3.6}' + - '{"index": {}}' + - '{"@timestamp": "2021-04-28T18:35:44.467Z", "ip": "2001:0db8:85a3::8a2e:0370:7334", "voltage": 3.1}' + - '{"index": {}}' + - '{"@timestamp": "2021-04-28T18:35:54.467Z", "ip": "2001:0db8:85a3::8a2e:0370:7334", "voltage": 3.3}' + + # TODO aggregate on tsid + # - do: + # search: + # index: test + # body: + # size: 0 + # aggs: + # tsids: + # terms: + # field: _tsid + # order: + # _key: asc + # aggs: + # voltage: + # avg: + # field: voltage + + # - match: {hits.total.value: 8} + # - match: {aggregations.tsids.buckets.0.key: {ip: "10.10.1.1"}} + # - match: {aggregations.tsids.buckets.0.doc_count: 4} + # - close_to: {aggregations.tsids.buckets.0.voltage.value: { value: 7.3, error: 0.01 }} + # - match: {aggregations.tsids.buckets.1.key: {ip: "2001:db8:85a3::8a2e:370:7334"}} + # - match: {aggregations.tsids.buckets.1.doc_count: 4} + # - close_to: {aggregations.tsids.buckets.1.voltage.value: { value: 3.3, error: 0.01 }} diff --git a/rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/tsdb/080_index_resize.yml b/rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/tsdb/080_index_resize.yml new file mode 100644 index 0000000000000..32474a36b5a6a --- /dev/null +++ b/rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/tsdb/080_index_resize.yml @@ -0,0 +1,163 @@ +setup: + - do: + indices.create: + index: test + body: + settings: + index: + mode: time_series + number_of_shards: 3 + number_of_replicas: 0 + mappings: + properties: + "@timestamp": + type: date + metricset: + type: keyword + time_series_dimension: true + k8s: + properties: + pod: + properties: + uid: + type: keyword + time_series_dimension: true + name: + type: keyword + ip: + type: ip + network: + properties: + tx: + type: long + rx: + type: long + - do: + bulk: + refresh: true + index: test + body: + - '{"index": {}}' + - '{"@timestamp": "2021-04-28T18:50:04.467Z", "metricset": "pod", "k8s": {"pod": {"name": "cat", "uid":"947e4ced-1786-4e53-9e0c-5c447e959507", "ip": "10.10.55.1", "network": {"tx": 2001818691, "rx": 802133794}}}}' + - '{"index": {}}' + - '{"@timestamp": "2021-04-28T18:50:24.467Z", "metricset": "pod", "k8s": {"pod": {"name": "cat", "uid":"947e4ced-1786-4e53-9e0c-5c447e959507", "ip": "10.10.55.1", "network": {"tx": 2005177954, "rx": 801479970}}}}' + - '{"index": {}}' + - '{"@timestamp": "2021-04-28T18:50:44.467Z", "metricset": "pod", "k8s": {"pod": {"name": "cat", "uid":"947e4ced-1786-4e53-9e0c-5c447e959507", "ip": "10.10.55.1", "network": {"tx": 2006223737, "rx": 802337279}}}}' + - '{"index": {}}' + - '{"@timestamp": "2021-04-28T18:51:04.467Z", "metricset": "pod", "k8s": {"pod": {"name": "cat", "uid":"947e4ced-1786-4e53-9e0c-5c447e959507", "ip": "10.10.55.2", "network": {"tx": 2012916202, "rx": 803685721}}}}' + - '{"index": {}}' + - '{"@timestamp": "2021-04-28T18:50:03.142Z", "metricset": "pod", "k8s": {"pod": {"name": "dog", "uid":"df3145b3-0563-4d3b-a0f7-897eb2876ea9", "ip": "10.10.55.3", "network": {"tx": 1434521831, "rx": 530575198}}}}' + - '{"index": {}}' + - '{"@timestamp": "2021-04-28T18:50:23.142Z", "metricset": "pod", "k8s": {"pod": {"name": "dog", "uid":"df3145b3-0563-4d3b-a0f7-897eb2876ea9", "ip": "10.10.55.3", "network": {"tx": 1434577921, "rx": 530600088}}}}' + - '{"index": {}}' + - '{"@timestamp": "2021-04-28T18:50:53.142Z", "metricset": "pod", "k8s": {"pod": {"name": "dog", "uid":"df3145b3-0563-4d3b-a0f7-897eb2876ea9", "ip": "10.10.55.3", "network": {"tx": 1434587694, "rx": 530604797}}}}' + - '{"index": {}}' + - '{"@timestamp": "2021-04-28T18:51:03.142Z", "metricset": "pod", "k8s": {"pod": {"name": "dog", "uid":"df3145b3-0563-4d3b-a0f7-897eb2876ea9", "ip": "10.10.55.3", "network": {"tx": 1434595272, "rx": 530605511}}}}' + + - do: + indices.put_settings: + index: test + body: + index.blocks.write: true + +--- +split: + - skip: + version: all + reason: shard splitting doesn't work yet + features: "arbitrary_key" + + - do: + indices.split: + index: test + target: test_split + body: + settings: + index.number_of_replicas: 0 + index.number_of_shards: 6 + + - do: + search: + index: test_split + body: + fields: + # - field: _tsid TODO fetch tsid + query: + query_string: + query: '+@timestamp:"2021-04-28T18:51:04.467Z" +k8s.pod.name:cat' + + - match: {hits.total.value: 1} + # TODO test fetching tsid + # - match: {hits.hits.0.fields._tsid: [{k8s.pod.uid: 947e4ced-1786-4e53-9e0c-5c447e959507, metricset: pod}]} + +--- +shrink: + - skip: + version: " - 7.99.99" + reason: introduced in 8.0.0 to be backported to 7.15.0 + features: "arbitrary_key" + + - do: + nodes.info: + node_id: data:true + - set: + nodes._arbitrary_key_: node_id + + - do: + indices.put_settings: + index: test + body: + index.routing.allocation.include._id: $node_id + + - do: + cluster.health: + wait_for_status: green + wait_for_no_relocating_shards: true + index: test + + - do: + indices.shrink: + index: test + target: test_shrink + body: + settings: + index.number_of_shards: 1 + + - do: + search: + index: test_shrink + body: + # fields: + # - field: _tsid TODO test fetching tsid + query: + query_string: + query: '+@timestamp:"2021-04-28T18:51:04.467Z" +k8s.pod.name:cat' + + - match: {hits.total.value: 1} + # TODO test fetching tsid + # - match: {hits.hits.0.fields._tsid: [{k8s.pod.uid: 947e4ced-1786-4e53-9e0c-5c447e959507, metricset: pod}]} + +--- +clone: + - skip: + version: " - 7.99.99" + reason: introduced in 8.0.0 to be backported to 7.15.0 + + - do: + indices.clone: + index: test + target: test_clone + + - do: + search: + index: test_clone + body: + # fields: + # - field: _tsid TODO test fetching tsid + query: + query_string: + query: '+@timestamp:"2021-04-28T18:51:04.467Z" +k8s.pod.name:cat' + + - match: {hits.total.value: 1} + # TODO test fetching tsid + # - match: {hits.hits.0.fields._tsid: [{k8s.pod.uid: 947e4ced-1786-4e53-9e0c-5c447e959507, metricset: pod}]} From 7f789bf15541b0f5c07f6a118b8cbc47844606f9 Mon Sep 17 00:00:00 2001 From: Nik Everett Date: Fri, 1 Oct 2021 16:21:22 -0400 Subject: [PATCH 2/2] Fixup --- .../{010_settings.yml => 10_settings.yml} | 0 .../tsdb/{040_search.yml => 40_search.yml} | 25 +++---- .../test/tsdb/{050_alias.yml => 50_alias.yml} | 54 +------------ ...d_dimensions.yml => 60_add_dimensions.yml} | 40 ++++------ ...nsion_types.yml => 70_dimension_types.yml} | 75 +------------------ ...0_index_resize.yml => 80_index_resize.yml} | 19 +++-- 6 files changed, 41 insertions(+), 172 deletions(-) rename rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/tsdb/{010_settings.yml => 10_settings.yml} (100%) rename rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/tsdb/{040_search.yml => 40_search.yml} (90%) rename rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/tsdb/{050_alias.yml => 50_alias.yml} (71%) rename rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/tsdb/{060_add_dimensions.yml => 60_add_dimensions.yml} (80%) rename rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/tsdb/{070_dimension_types.yml => 70_dimension_types.yml} (64%) rename rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/tsdb/{080_index_resize.yml => 80_index_resize.yml} (88%) diff --git a/rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/tsdb/010_settings.yml b/rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/tsdb/10_settings.yml similarity index 100% rename from rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/tsdb/010_settings.yml rename to rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/tsdb/10_settings.yml diff --git a/rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/tsdb/040_search.yml b/rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/tsdb/40_search.yml similarity index 90% rename from rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/tsdb/040_search.yml rename to rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/tsdb/40_search.yml index f16d5f718f888..5227377249e66 100644 --- a/rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/tsdb/040_search.yml +++ b/rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/tsdb/40_search.yml @@ -1,7 +1,7 @@ setup: - skip: version: " - 7.99.99" - reason: introduced in 8.0.0 to be backported to 7.16.0 + reason: introduced in 8.0.0 - do: indices.create: @@ -60,7 +60,7 @@ setup: query a dimension: - skip: version: " - 7.99.99" - reason: introduced in 8.0.0 to be backported to 7.16.0 + reason: introduced in 8.0.0 - do: search: @@ -76,7 +76,7 @@ query a dimension: query a metric: - skip: version: " - 7.99.99" - reason: introduced in 8.0.0 to be backported to 7.16.0 + reason: introduced in 8.0.0 - do: search: @@ -95,7 +95,7 @@ query a metric: fetch a dimension: - skip: version: " - 7.99.99" - reason: introduced in 8.0.0 to be backported to 7.16.0 + reason: introduced in 8.0.0 - do: search: @@ -114,7 +114,7 @@ fetch a dimension: fetch a metric: - skip: version: " - 7.99.99" - reason: introduced in 8.0.0 to be backported to 7.16.0 + reason: introduced in 8.0.0 - do: search: @@ -134,7 +134,7 @@ fetch a metric: fetch a tag: - skip: version: " - 7.99.99" - reason: introduced in 8.0.0 to be backported to 7.16.0 + reason: introduced in 8.0.0 - do: search: @@ -156,7 +156,7 @@ fetch a tag: aggregate a dimension: - skip: version: " - 7.99.99" - reason: introduced in 8.0.0 to be backported to 7.16.0 + reason: introduced in 8.0.0 - do: search: @@ -178,7 +178,7 @@ aggregate a dimension: aggregate a metric: - skip: version: " - 7.99.99" - reason: introduced in 8.0.0 to be backported to 7.16.0 + reason: introduced in 8.0.0 - do: search: @@ -206,7 +206,7 @@ aggregate a metric: aggregate a tag: - skip: version: " - 7.99.99" - reason: introduced in 8.0.0 to be backported to 7.16.0 + reason: introduced in 8.0.0 - do: search: @@ -235,7 +235,7 @@ aggregate a tag: field capabilities: - skip: version: " - 7.99.99" - reason: introduced in 8.0.0 to be backported to 7.16.0 + reason: introduced in 8.0.0 - do: field_caps: @@ -259,8 +259,3 @@ field capabilities: - is_false: fields.k8s\.pod\.ip.ip.non_searchable_indices - is_false: fields.k8s\.pod\.ip.ip.non_aggregatable_indices # TODO assert tsid once we build it: - # - match: {fields._tsid._tsid.searchable: false} - # - match: {fields._tsid._tsid.aggregatable: true} - # - is_false: fields._tsid._tsid.indices - # - is_false: fields._tsid._tsid.non_searchable_indices - # - is_false: fields._tsid._tsid.non_aggregatable_indices diff --git a/rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/tsdb/050_alias.yml b/rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/tsdb/50_alias.yml similarity index 71% rename from rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/tsdb/050_alias.yml rename to rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/tsdb/50_alias.yml index 655fdb3450da1..21ddeb55b13c3 100644 --- a/rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/tsdb/050_alias.yml +++ b/rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/tsdb/50_alias.yml @@ -1,7 +1,7 @@ setup: - skip: version: " - 7.99.99" - reason: introduced in 8.0.0 to be backported to 7.16.0 + reason: introduced in 8.0.0 - do: indices.create: @@ -56,42 +56,13 @@ setup: - '{"index": {}}' - '{"@timestamp": "2021-04-28T18:51:03.142Z", "metricset": "pod", "k8s": {"pod": {"name": "dog", "uid":"df3145b3-0563-4d3b-a0f7-897eb2876ea9", "ip": "10.10.55.3", "network": {"tx": 1434595272, "rx": 530605511}}}}' ---- -search an alias: - - skip: - version: " - 7.99.99" - reason: introduced in 8.0.0 to be backported to 7.16.0 - - - do: - indices.put_alias: - index: test - name: test_alias - - - # TODO search on tsid once we generate it - # - do: - # search: - # index: test_alias - # body: - # size: 0 - # aggs: - # tsids: - # terms: - # field: _tsid - # order: - # _key: asc - - # - match: {hits.total.value: 8} - # - match: {aggregations.tsids.buckets.0.key: {k8s.pod.uid: 947e4ced-1786-4e53-9e0c-5c447e959507, metricset: pod}} - # - match: {aggregations.tsids.buckets.0.doc_count: 4} - # - match: {aggregations.tsids.buckets.1.key: {k8s.pod.uid: df3145b3-0563-4d3b-a0f7-897eb2876ea9, metricset: pod}} - # - match: {aggregations.tsids.buckets.1.doc_count: 4} +# TODO search on _tsid in an alias --- index into alias: - skip: version: " - 7.99.99" - reason: introduced in 8.0.0 to be backported to 7.16.0 + reason: introduced in 8.0.0 - do: indices.put_alias: @@ -114,22 +85,3 @@ index into alias: - match: {errors: false} # TODO search on tsid once we generate it - # - do: - # search: - # index: test - # body: - # size: 0 - # aggs: - # tsids: - # terms: - # field: _tsid - # order: - # _key: asc - - # - match: {hits.total.value: 12} - # - match: {aggregations.tsids.buckets.0.key: {k8s.pod.uid: 1c4fc7b8-93b7-4ba8-b609-2a48af2f8e39, metricset: pod}} - # - match: {aggregations.tsids.buckets.0.doc_count: 4} - # - match: {aggregations.tsids.buckets.1.key: {k8s.pod.uid: 947e4ced-1786-4e53-9e0c-5c447e959507, metricset: pod}} - # - match: {aggregations.tsids.buckets.1.doc_count: 4} - # - match: {aggregations.tsids.buckets.2.key: {k8s.pod.uid: df3145b3-0563-4d3b-a0f7-897eb2876ea9, metricset: pod}} - # - match: {aggregations.tsids.buckets.2.doc_count: 4} diff --git a/rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/tsdb/060_add_dimensions.yml b/rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/tsdb/60_add_dimensions.yml similarity index 80% rename from rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/tsdb/060_add_dimensions.yml rename to rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/tsdb/60_add_dimensions.yml index f0a92d73452cb..f593f554824cb 100644 --- a/rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/tsdb/060_add_dimensions.yml +++ b/rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/tsdb/60_add_dimensions.yml @@ -2,7 +2,7 @@ add dimensions with put_mapping: - skip: version: " - 7.99.99" - reason: introduced in 8.0.0 to be backported to 7.16.0 + reason: introduced in 8.0.0 - do: indices.create: @@ -16,15 +16,7 @@ add dimensions with put_mapping: "@timestamp": type: date - # TODO restore after #77731 - # - do: - # catch: "/Error building time series id: There aren't any mapped dimensions/" - # index: - # index: test - # refresh: true - # body: - # "@timestamp": "2021-04-28T18:35:24.467Z" - # metricset: cat + # TODO verify its an error to index without an declared dimensions #77731 - do: indices.put_mapping: @@ -48,18 +40,18 @@ add dimensions with put_mapping: index: test body: fields: - # - field: _tsid TODO fetch the tsid + # TODO fetch the tsid - field: "@timestamp" - match: {hits.total.value: 1} - # - match: {hits.hits.0.fields._tsid: [{metricset: cat}]} TODO Fetch the tsid + # TODO Fetch the tsid - match: {hits.hits.0.fields.@timestamp: ["2021-04-28T18:35:24.467Z"]} --- add dimensions to no dims with dynamic_template over index: - skip: version: " - 7.99.99" - reason: introduced in 8.0.0 to be backported to 7.16.0 + reason: introduced in 8.0.0 - do: indices.create: @@ -93,17 +85,17 @@ add dimensions to no dims with dynamic_template over index: index: test body: fields: - # - field: _tsid TODO fetch the tsid + # TODO fetch the tsid - field: "@timestamp" - match: {hits.total.value: 1} - # - match: {hits.hits.0.fields._tsid: [{metricset: cat}]} TODO fetch the tsid + # TODO fetch the tsid - match: {hits.hits.0.fields.@timestamp: ["2021-04-28T18:35:24.467Z"]} --- add dimensions to no dims with dynamic_template over bulk: - skip: version: " - 7.99.99" - reason: introduced in 8.0.0 to be backported to 7.15.0 + reason: introduced in 8.0.0 - do: indices.create: @@ -137,17 +129,17 @@ add dimensions to no dims with dynamic_template over bulk: index: test body: fields: - # - field: _tsid TODO fetch tsid + # TODO fetch tsid - field: "@timestamp" - match: {hits.total.value: 1} - # - match: {hits.hits.0.fields._tsid: [{metricset: cat}]} TODO fetch tsid + # TODO fetch tsid - match: {hits.hits.0.fields.@timestamp: ["2021-04-28T18:35:24.467Z"]} --- add dimensions to some dims with dynamic_template over index: - skip: version: " - 7.99.99" - reason: introduced in 8.0.0 to be backported to 7.16.0 + reason: introduced in 8.0.0 - do: indices.create: @@ -185,17 +177,17 @@ add dimensions to some dims with dynamic_template over index: index: test body: fields: - # - field: _tsid TODO fetch tsid + # TODO fetch tsid - field: "@timestamp" - match: {hits.total.value: 1} - # - match: {hits.hits.0.fields._tsid: [{metricset: cat, other_dim: cat}]} TODO fetch tsid + # TODO fetch tsid - match: {hits.hits.0.fields.@timestamp: ["2021-04-28T18:35:24.467Z"]} --- add dimensions to some dims with dynamic_template over bulk: - skip: version: " - 7.99.99" - reason: introduced in 8.0.0 to be backported to 7.16.0 + reason: introduced in 8.0.0 - do: indices.create: @@ -232,8 +224,8 @@ add dimensions to some dims with dynamic_template over bulk: index: test body: fields: - # - field: _tsid TODO fetch tsid + # TODO fetch tsid - field: "@timestamp" - match: {hits.total.value: 1} - # - match: {hits.hits.0.fields._tsid: [{metricset: cat, other_dim: cat}]} TODO fetch tsid + # TODO fetch tsid - match: {hits.hits.0.fields.@timestamp: ["2021-04-28T18:35:24.467Z"]} diff --git a/rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/tsdb/070_dimension_types.yml b/rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/tsdb/70_dimension_types.yml similarity index 64% rename from rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/tsdb/070_dimension_types.yml rename to rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/tsdb/70_dimension_types.yml index 0384840be6015..80d049a7e43d2 100644 --- a/rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/tsdb/070_dimension_types.yml +++ b/rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/tsdb/70_dimension_types.yml @@ -2,7 +2,7 @@ keyword dimension: - skip: features: close_to version: " - 7.99.99" - reason: introduced in 8.0.0 to be backported to 7.16.0 + reason: introduced in 8.0.0 - do: indices.create: @@ -43,36 +43,13 @@ keyword dimension: - is_false: errors # TODO aggregate on tsid - # - do: - # search: - # index: test - # body: - # size: 0 - # aggs: - # tsids: - # terms: - # field: _tsid - # order: - # _key: asc - # aggs: - # voltage: - # avg: - # field: voltage - - # - match: {hits.total.value: 8} - # - match: {aggregations.tsids.buckets.0.key: {uid: 947e4ced-1786-4e53-9e0c-5c447e959507}} - # - match: {aggregations.tsids.buckets.0.doc_count: 4} - # - close_to: {aggregations.tsids.buckets.0.voltage.value: { value: 7.3, error: 0.01 }} - # - match: {aggregations.tsids.buckets.1.key: {uid: df3145b3-0563-4d3b-a0f7-897eb2876ea9}} - # - match: {aggregations.tsids.buckets.1.doc_count: 4} - # - close_to: {aggregations.tsids.buckets.1.voltage.value: { value: 3.3, error: 0.01 }} --- long dimension: - skip: features: close_to version: " - 7.99.99" - reason: introduced in 8.0.0 to be backported to 7.16.0 + reason: introduced in 8.0.0 - do: indices.create: @@ -112,36 +89,13 @@ long dimension: - '{"@timestamp": "2021-04-28T18:35:54.467Z", "id": 2, "voltage": 3.3}' # TODO aggregate on tsid - # - do: - # search: - # index: test - # body: - # size: 0 - # aggs: - # tsids: - # terms: - # field: _tsid - # order: - # _key: asc - # aggs: - # voltage: - # avg: - # field: voltage - - # - match: {hits.total.value: 8} - # - match: {aggregations.tsids.buckets.0.key: {id: 1}} - # - match: {aggregations.tsids.buckets.0.doc_count: 4} - # - close_to: {aggregations.tsids.buckets.0.voltage.value: { value: 7.3, error: 0.01 }} - # - match: {aggregations.tsids.buckets.1.key: {id: 2}} - # - match: {aggregations.tsids.buckets.1.doc_count: 4} - # - close_to: {aggregations.tsids.buckets.1.voltage.value: { value: 3.3, error: 0.01 }} --- ip dimension: - skip: features: close_to version: " - 7.99.99" - reason: introduced in 8.0.0 to be backported to 7.16.0 + reason: introduced in 8.0.0 - do: indices.create: @@ -181,26 +135,3 @@ ip dimension: - '{"@timestamp": "2021-04-28T18:35:54.467Z", "ip": "2001:0db8:85a3::8a2e:0370:7334", "voltage": 3.3}' # TODO aggregate on tsid - # - do: - # search: - # index: test - # body: - # size: 0 - # aggs: - # tsids: - # terms: - # field: _tsid - # order: - # _key: asc - # aggs: - # voltage: - # avg: - # field: voltage - - # - match: {hits.total.value: 8} - # - match: {aggregations.tsids.buckets.0.key: {ip: "10.10.1.1"}} - # - match: {aggregations.tsids.buckets.0.doc_count: 4} - # - close_to: {aggregations.tsids.buckets.0.voltage.value: { value: 7.3, error: 0.01 }} - # - match: {aggregations.tsids.buckets.1.key: {ip: "2001:db8:85a3::8a2e:370:7334"}} - # - match: {aggregations.tsids.buckets.1.doc_count: 4} - # - close_to: {aggregations.tsids.buckets.1.voltage.value: { value: 3.3, error: 0.01 }} diff --git a/rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/tsdb/080_index_resize.yml b/rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/tsdb/80_index_resize.yml similarity index 88% rename from rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/tsdb/080_index_resize.yml rename to rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/tsdb/80_index_resize.yml index 32474a36b5a6a..b91b5e55150c5 100644 --- a/rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/tsdb/080_index_resize.yml +++ b/rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/tsdb/80_index_resize.yml @@ -1,4 +1,8 @@ setup: + - skip: + version: " - 7.99.99" + reason: introduced in 8.0.0 + - do: indices.create: index: test @@ -81,20 +85,19 @@ split: index: test_split body: fields: - # - field: _tsid TODO fetch tsid + # TODO fetch tsid query: query_string: query: '+@timestamp:"2021-04-28T18:51:04.467Z" +k8s.pod.name:cat' - match: {hits.total.value: 1} # TODO test fetching tsid - # - match: {hits.hits.0.fields._tsid: [{k8s.pod.uid: 947e4ced-1786-4e53-9e0c-5c447e959507, metricset: pod}]} --- shrink: - skip: version: " - 7.99.99" - reason: introduced in 8.0.0 to be backported to 7.15.0 + reason: introduced in 8.0.0 features: "arbitrary_key" - do: @@ -127,21 +130,19 @@ shrink: search: index: test_shrink body: - # fields: - # - field: _tsid TODO test fetching tsid + # TODO test fetching tsid query: query_string: query: '+@timestamp:"2021-04-28T18:51:04.467Z" +k8s.pod.name:cat' - match: {hits.total.value: 1} # TODO test fetching tsid - # - match: {hits.hits.0.fields._tsid: [{k8s.pod.uid: 947e4ced-1786-4e53-9e0c-5c447e959507, metricset: pod}]} --- clone: - skip: version: " - 7.99.99" - reason: introduced in 8.0.0 to be backported to 7.15.0 + reason: introduced in 8.0.0 - do: indices.clone: @@ -152,12 +153,10 @@ clone: search: index: test_clone body: - # fields: - # - field: _tsid TODO test fetching tsid + # TODO test fetching tsid query: query_string: query: '+@timestamp:"2021-04-28T18:51:04.467Z" +k8s.pod.name:cat' - match: {hits.total.value: 1} # TODO test fetching tsid - # - match: {hits.hits.0.fields._tsid: [{k8s.pod.uid: 947e4ced-1786-4e53-9e0c-5c447e959507, metricset: pod}]}