From b9fb12924b582e89294986283a48f5d19851407c Mon Sep 17 00:00:00 2001 From: Dan Hermann Date: Thu, 9 Jul 2020 13:10:44 -0500 Subject: [PATCH] Data stream support for EQL search --- x-pack/plugin/eql/qa/rest/build.gradle | 2 +- .../test/eql/20_data_streams.yml | 54 +++++++++++++++++++ 2 files changed, 55 insertions(+), 1 deletion(-) create mode 100644 x-pack/plugin/eql/qa/rest/src/test/resources/rest-api-spec/test/eql/20_data_streams.yml diff --git a/x-pack/plugin/eql/qa/rest/build.gradle b/x-pack/plugin/eql/qa/rest/build.gradle index a8d9cfb4bcf..d5e1dff4464 100644 --- a/x-pack/plugin/eql/qa/rest/build.gradle +++ b/x-pack/plugin/eql/qa/rest/build.gradle @@ -7,7 +7,7 @@ apply plugin: 'elasticsearch.rest-resources' restResources { restApi { - includeCore '_common', 'bulk' + includeCore '_common', 'bulk', 'indices' includeXpack 'eql' } } diff --git a/x-pack/plugin/eql/qa/rest/src/test/resources/rest-api-spec/test/eql/20_data_streams.yml b/x-pack/plugin/eql/qa/rest/src/test/resources/rest-api-spec/test/eql/20_data_streams.yml new file mode 100644 index 00000000000..0e4e01c1977 --- /dev/null +++ b/x-pack/plugin/eql/qa/rest/src/test/resources/rest-api-spec/test/eql/20_data_streams.yml @@ -0,0 +1,54 @@ +--- +"Verify data stream resolvability in EQL search API": + - 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 + data_stream: + timestamp_field: '@timestamp' + + - do: + indices.create_data_stream: + name: simple-data-stream1 + - is_true: acknowledged + + - do: + bulk: + refresh: true + body: + - create: + _index: simple-data-stream1 + _id: 1 + - event: + - category: process + "@timestamp": 2020-02-03T12:34:56Z + user: SYSTEM + + - do: + eql.search: + index: simple-data-stream1 + body: + query: "process where user = 'SYSTEM'" + + - match: {timed_out: false} + - match: {hits.total.value: 1} + - match: {hits.total.relation: "eq"} + - match: {hits.events.0._source.user: "SYSTEM"} + + - do: + indices.delete_data_stream: + name: simple-data-stream1 + - is_true: acknowledged