Ver Fonte

Data stream support for rollup search (#59296)

Dan Hermann há 5 anos atrás
pai
commit
b961454038

+ 1 - 1
x-pack/plugin/rollup/src/main/java/org/elasticsearch/xpack/rollup/action/TransportRollupSearchAction.java

@@ -100,7 +100,7 @@ public class TransportRollupSearchAction extends TransportAction<SearchRequest,
 
     @Override
     protected void doExecute(Task task, SearchRequest request, ActionListener<SearchResponse> 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);

+ 73 - 0
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