From 7fa9cf601b515d829de18be50eea911f4309d5ec Mon Sep 17 00:00:00 2001 From: Dan Hermann Date: Fri, 10 Jul 2020 11:13:34 -0500 Subject: [PATCH] Data stream support for rollup search --- .../action/TransportRollupSearchAction.java | 2 +- .../10_data_stream_resolvability.yml | 73 +++++++++++++++++++ 2 files changed, 74 insertions(+), 1 deletion(-) diff --git a/x-pack/plugin/rollup/src/main/java/org/elasticsearch/xpack/rollup/action/TransportRollupSearchAction.java b/x-pack/plugin/rollup/src/main/java/org/elasticsearch/xpack/rollup/action/TransportRollupSearchAction.java index f936abdfcf9..db11baea492 100644 --- a/x-pack/plugin/rollup/src/main/java/org/elasticsearch/xpack/rollup/action/TransportRollupSearchAction.java +++ b/x-pack/plugin/rollup/src/main/java/org/elasticsearch/xpack/rollup/action/TransportRollupSearchAction.java @@ -100,7 +100,7 @@ public class TransportRollupSearchAction extends TransportAction listener) { - String[] indices = resolver.concreteIndexNames(clusterService.state(), request.indicesOptions(), request.indices()); + String[] indices = resolver.concreteIndexNames(clusterService.state(), request); RollupSearchContext rollupSearchContext = separateIndices(indices, clusterService.state().getMetadata().indices()); MultiSearchRequest msearch = createMSearchRequest(request, registry, rollupSearchContext); diff --git a/x-pack/plugin/src/test/resources/rest-api-spec/test/data_stream/10_data_stream_resolvability.yml b/x-pack/plugin/src/test/resources/rest-api-spec/test/data_stream/10_data_stream_resolvability.yml index 6007c062bac..bb9fffd7865 100644 --- a/x-pack/plugin/src/test/resources/rest-api-spec/test/data_stream/10_data_stream_resolvability.yml +++ b/x-pack/plugin/src/test/resources/rest-api-spec/test/data_stream/10_data_stream_resolvability.yml @@ -409,3 +409,76 @@ indices.delete_data_stream: name: simple-data-stream1 - is_true: acknowledged + +--- +"Verify data stream resolvability in rollup search": + - skip: + version: " - 7.99.99" + reason: "change to 7.8.99 after backport" + features: allowed_warnings + + - do: + allowed_warnings: + - "index template [my-template1] has index patterns [simple-data-stream1] matching patterns from existing older templates [global] with patterns (global => [*]); this template [my-template1] will take precedence during new index creation" + indices.put_index_template: + name: my-template1 + body: + index_patterns: [simple-data-stream1] + template: + mappings: + properties: + '@timestamp': + type: date + partition: + type: keyword + price: + type: integer + data_stream: + timestamp_field: '@timestamp' + + - do: + indices.create_data_stream: + name: simple-data-stream1 + - is_true: acknowledged + + - do: + index: + index: simple-data-stream1 + body: { partition: a, price: 1, '@timestamp': '2020-12-12T00:00:00.000Z' } + + - do: + index: + index: simple-data-stream1 + body: { partition: a, price: 2, '@timestamp': '2020-12-12T01:00:00.000Z' } + + - do: + index: + index: simple-data-stream1 + body: { partition: b, price: 3, '@timestamp': '2020-12-12T01:00:00.000Z' } + + - do: + indices.refresh: + index: simple-data-stream1 + + - do: + rollup.rollup_search: + index: "simple-data-stream1" + body: + size: 0 + aggs: + histo: + date_histogram: + field: "@timestamp" + calendar_interval: "1h" + time_zone: "UTC" + + - length: { aggregations.histo.buckets: 2 } + - match: { aggregations.histo.buckets.0.key_as_string: "2020-12-12T00:00:00.000Z" } + - match: { aggregations.histo.buckets.0.doc_count: 1 } + - match: { aggregations.histo.buckets.1.key_as_string: "2020-12-12T01:00:00.000Z" } + - match: { aggregations.histo.buckets.1.doc_count: 2 } + + - do: + indices.delete_data_stream: + name: simple-data-stream1 + - is_true: acknowledged