diff --git a/qa/full-cluster-restart/src/test/java/org/elasticsearch/upgrades/FullClusterRestartIT.java b/qa/full-cluster-restart/src/test/java/org/elasticsearch/upgrades/FullClusterRestartIT.java index 4f7082e86781c..42711f12c11ba 100644 --- a/qa/full-cluster-restart/src/test/java/org/elasticsearch/upgrades/FullClusterRestartIT.java +++ b/qa/full-cluster-restart/src/test/java/org/elasticsearch/upgrades/FullClusterRestartIT.java @@ -19,6 +19,7 @@ import org.elasticsearch.cluster.metadata.MetadataIndexStateService; import org.elasticsearch.common.Strings; import org.elasticsearch.common.settings.Settings; +import org.elasticsearch.common.time.DateUtils; import org.elasticsearch.common.xcontent.support.XContentMapValues; import org.elasticsearch.core.Booleans; import org.elasticsearch.core.CheckedFunction; @@ -307,6 +308,8 @@ private int createTimeSeriesModeIndex(int replicas) throws IOException { mappingsAndSettings.field("number_of_replicas", replicas); mappingsAndSettings.field("mode", "time_series"); mappingsAndSettings.field("routing_path", "dim"); + mappingsAndSettings.field("time_series.start_time", 1L); + mappingsAndSettings.field("time_series.end_time", DateUtils.MAX_MILLIS_BEFORE_9999 - 1); mappingsAndSettings.endObject(); } { diff --git a/qa/multi-cluster-search/src/test/resources/rest-api-spec/test/multi_cluster/100_tsdb.yml b/qa/multi-cluster-search/src/test/resources/rest-api-spec/test/multi_cluster/100_tsdb.yml index a3c73d7f434d6..5807219992677 100644 --- a/qa/multi-cluster-search/src/test/resources/rest-api-spec/test/multi_cluster/100_tsdb.yml +++ b/qa/multi-cluster-search/src/test/resources/rest-api-spec/test/multi_cluster/100_tsdb.yml @@ -2,8 +2,8 @@ setup: # Create a local tsdb index with a tsid the doesn't overlap with the remote cluster. - skip: - version: " - 7.99.99" - reason: introduced in 8.0.0 + version: " - 8.0.99" + reason: introduced in 8.1.0 - do: indices.create: @@ -13,6 +13,9 @@ setup: index: mode: time_series routing_path: [metricset, k8s.pod.uid] + time_series: + start_time: 2021-04-28T00:00:00Z + end_time: 2021-04-29T00:00:00Z number_of_replicas: 0 number_of_shards: 2 mappings: diff --git a/qa/multi-cluster-search/src/test/resources/rest-api-spec/test/remote_cluster/10_basic.yml b/qa/multi-cluster-search/src/test/resources/rest-api-spec/test/remote_cluster/10_basic.yml index 4f46d103c238f..6b6794e6919b4 100644 --- a/qa/multi-cluster-search/src/test/resources/rest-api-spec/test/remote_cluster/10_basic.yml +++ b/qa/multi-cluster-search/src/test/resources/rest-api-spec/test/remote_cluster/10_basic.yml @@ -156,8 +156,8 @@ --- tsdb: - skip: - version: " - 7.99.99" - reason: introduced in 8.0.0 + version: " - 8.0.99" + reason: introduced in 8.1.0 - do: indices.create: @@ -167,6 +167,9 @@ tsdb: index: mode: time_series routing_path: [metricset, k8s.pod.uid] + time_series: + start_time: 2021-04-28T00:00:00Z + end_time: 2021-04-29T00:00:00Z number_of_replicas: 0 number_of_shards: 2 mappings: diff --git a/qa/rolling-upgrade/src/test/java/org/elasticsearch/upgrades/IndexingIT.java b/qa/rolling-upgrade/src/test/java/org/elasticsearch/upgrades/IndexingIT.java index 52bbd2b41bf9b..1b9eec1387961 100644 --- a/qa/rolling-upgrade/src/test/java/org/elasticsearch/upgrades/IndexingIT.java +++ b/qa/rolling-upgrade/src/test/java/org/elasticsearch/upgrades/IndexingIT.java @@ -15,6 +15,7 @@ import org.elasticsearch.client.Response; import org.elasticsearch.client.ResponseException; import org.elasticsearch.common.Strings; +import org.elasticsearch.common.time.DateUtils; import org.elasticsearch.common.xcontent.support.XContentMapValues; import org.elasticsearch.core.Booleans; import org.elasticsearch.index.mapper.DateFieldMapper; @@ -322,6 +323,8 @@ private void createTsdbIndex() throws IOException { indexSpec.startObject("settings").startObject("index"); indexSpec.field("mode", "time_series"); indexSpec.array("routing_path", new String[] { "dim" }); + indexSpec.field("time_series.start_time", 1L); + indexSpec.field("time_series.end_time", DateUtils.MAX_MILLIS_BEFORE_9999 - 1); indexSpec.endObject().endObject(); createIndex.setJsonEntity(Strings.toString(indexSpec.endObject())); client().performRequest(createIndex); diff --git a/qa/smoke-test-multinode/src/test/resources/rest-api-spec/test/smoke_test_multinode/20_tsdb_consistency.yml b/qa/smoke-test-multinode/src/test/resources/rest-api-spec/test/smoke_test_multinode/20_tsdb_consistency.yml index 4dbfc8b9a3f31..7fec5769b8177 100644 --- a/qa/smoke-test-multinode/src/test/resources/rest-api-spec/test/smoke_test_multinode/20_tsdb_consistency.yml +++ b/qa/smoke-test-multinode/src/test/resources/rest-api-spec/test/smoke_test_multinode/20_tsdb_consistency.yml @@ -3,8 +3,8 @@ setup: - skip: - version: " - 7.99.99" - reason: introduced in 8.0.0 + version: " - 8.0.99" + reason: introduced in 8.1.0 - do: indices.create: @@ -14,6 +14,9 @@ setup: index: mode: time_series routing_path: [metricset, k8s.pod.uid] + time_series: + start_time: 2021-04-28T00:00:00Z + end_time: 2021-04-29T00:00:00Z number_of_shards: 10 number_of_replicas: 1 mappings: 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/10_settings.yml index eed1ccb7247cf..073164e8ac6c5 100644 --- 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/10_settings.yml @@ -1,7 +1,7 @@ enable: - skip: - version: " - 7.99.99" - reason: introduced in 8.0.0 + version: " - 8.0.99" + reason: introduced in 8.1.0 - do: indices.create: @@ -11,6 +11,9 @@ enable: index: mode: time_series routing_path: [metricset, k8s.pod.uid] + time_series: + start_time: 2021-04-28T00:00:00Z + end_time: 2021-04-29T00:00:00Z number_of_replicas: 0 number_of_shards: 2 mappings: @@ -41,8 +44,8 @@ enable: --- no sort field: - skip: - version: " - 7.99.99" - reason: introduced in 8.0.0 + version: " - 8.0.99" + reason: introduced in 8.1.0 - do: catch: /\[index.mode=time_series\] is incompatible with \[index.sort.field\]/ @@ -52,13 +55,17 @@ no sort field: settings: index: mode: time_series + routing_path: foo + time_series: + start_time: 2021-04-28T00:00:00Z + end_time: 2021-04-29T00:00:00Z sort.field: ['a'] --- no sort order: - skip: - version: " - 7.99.99" - reason: introduced in 8.0.0 + version: " - 8.0.99" + reason: introduced in 8.1.0 - do: catch: /\[index.mode=time_series\] is incompatible with \[index.sort.order\]/ @@ -68,13 +75,17 @@ no sort order: settings: index: mode: time_series + routing_path: foo + time_series: + start_time: 2021-04-28T00:00:00Z + end_time: 2021-04-29T00:00:00Z sort.order: ['DESC'] --- no sort mode: - skip: - version: " - 7.99.99" - reason: introduced in 8.0.0 + version: " - 8.0.99" + reason: introduced in 8.1.0 - do: catch: /\[index.mode=time_series\] is incompatible with \[index.sort.mode\]/ @@ -84,13 +95,17 @@ no sort mode: settings: index: mode: time_series + routing_path: foo + time_series: + start_time: 2021-04-28T00:00:00Z + end_time: 2021-04-29T00:00:00Z sort.mode: ['MIN'] --- no sort missing: - skip: - version: " - 7.99.99" - reason: introduced in 8.0.0 + version: " - 8.0.99" + reason: introduced in 8.1.0 - do: catch: /\[index.mode=time_series\] is incompatible with \[index.sort.missing\]/ @@ -100,13 +115,17 @@ no sort missing: settings: index: mode: time_series + routing_path: foo + time_series: + start_time: 2021-04-28T00:00:00Z + end_time: 2021-04-29T00:00:00Z sort.missing: ['_last'] --- no partitioning: - skip: - version: " - 7.99.99" - reason: introduced in 8.0.0 + version: " - 8.0.99" + reason: introduced in 8.1.0 - do: catch: /\[index.mode=time_series\] is incompatible with \[index.routing_partition_size\]/ @@ -116,14 +135,18 @@ no partitioning: settings: index: mode: time_series + routing_path: foo + time_series: + start_time: 2021-04-28T00:00:00Z + end_time: 2021-04-29T00:00:00Z shards: 5 routing_partition_size: 2 --- routing_path required: - skip: - version: " - 7.99.99" - reason: introduced in 8.0.0 to be backported to 7.16.0 + version: " - 8.0.99" + reason: introduced in 8.1.0 - do: catch: /\[index.mode=time_series\] requires \[index.routing_path\]/ @@ -133,13 +156,16 @@ routing_path required: settings: index: mode: time_series - shards: 5 + time_series: + start_time: 2021-04-28T00:00:00Z + end_time: 2021-04-29T00:00:00Z + number_of_shards: 5 --- routing_path is not allowed in standard mode: - skip: - version: " - 7.99.99" - reason: introduced in 8.0.0 to be backported to 7.16.0 + version: " - 8.0.99" + reason: introduced in 8.1.0 - do: catch: /\[index.routing_path\] requires \[index.mode=time_series\]/ @@ -153,8 +179,8 @@ routing_path is not allowed in standard mode: --- routing required: - skip: - version: " - 7.99.99" - reason: introduced in 8.0.0 to be backported to 7.16.0 + version: " - 8.0.99" + reason: introduced in 8.1.0 - do: catch: /routing is forbidden on CRUD operations that target indices in \[index.mode=time_series\]/ @@ -165,6 +191,9 @@ routing required: index: mode: time_series routing_path: foo + time_series: + start_time: 2021-04-28T00:00:00Z + end_time: 2021-04-29T00:00:00Z mappings: _routing: required: true diff --git a/rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/tsdb/15_timestamp_mapping.yml b/rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/tsdb/15_timestamp_mapping.yml index 5c15da33012a5..76fb0282df902 100644 --- a/rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/tsdb/15_timestamp_mapping.yml +++ b/rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/tsdb/15_timestamp_mapping.yml @@ -2,8 +2,8 @@ --- date: - skip: - version: " - 7.99.99" - reason: introduced in 8.0.0 to be backported to 7.16.0 + version: " - 8.0.99" + reason: introduced in 8.1.0 - do: indices.create: @@ -13,6 +13,9 @@ date: index: mode: time_series routing_path: [metricset] + time_series: + start_time: 2021-04-28T00:00:00Z + end_time: 2021-04-29T00:00:00Z number_of_replicas: 0 number_of_shards: 2 mappings: @@ -48,8 +51,8 @@ date: --- date_nanos: - skip: - version: " - 7.99.99" - reason: introduced in 8.0.0 to be backported to 7.16.0 + version: " - 8.0.99" + reason: introduced in 8.1.0 - do: indices.create: @@ -59,6 +62,9 @@ date_nanos: index: mode: time_series routing_path: [metricset] + time_series: + start_time: 2021-04-28T00:00:00Z + end_time: 2021-04-29T00:00:00Z number_of_replicas: 0 number_of_shards: 2 mappings: @@ -94,8 +100,8 @@ date_nanos: --- automatically add with date: - skip: - version: " - 7.99.99" - reason: introduced in 8.0.0 to be backported to 7.16.0 + version: " - 8.0.99" + reason: introduced in 8.1.0 - do: indices.create: @@ -105,6 +111,9 @@ automatically add with date: index: mode: time_series routing_path: [metricset] + time_series: + start_time: 2021-04-28T00:00:00Z + end_time: 2021-04-29T00:00:00Z number_of_replicas: 0 number_of_shards: 2 mappings: @@ -138,8 +147,8 @@ automatically add with date: --- reject @timestamp with wrong type: - skip: - version: " - 7.99.99" - reason: introduced in 8.0.0 to be backported to 7.16.0 + version: " - 8.0.99" + reason: introduced in 8.1.0 - do: catch: /data stream timestamp field \[@timestamp\] is of type \[keyword\], but \[date,date_nanos\] is expected/ @@ -150,6 +159,9 @@ reject @timestamp with wrong type: index: mode: time_series routing_path: [metricset] + time_series: + start_time: 2021-04-28T00:00:00Z + end_time: 2021-04-29T00:00:00Z number_of_replicas: 0 number_of_shards: 2 mappings: @@ -172,6 +184,9 @@ reject timestamp meta field with wrong type: index: mode: time_series routing_path: [metricset] + time_series: + start_time: 2021-04-28T00:00:00Z + end_time: 2021-04-29T00:00:00Z number_of_replicas: 0 number_of_shards: 2 mappings: @@ -192,6 +207,9 @@ enable timestamp meta field: index: mode: time_series routing_path: [metricset] + time_series: + start_time: 2021-04-28T00:00:00Z + end_time: 2021-04-29T00:00:00Z number_of_replicas: 0 number_of_shards: 2 mappings: @@ -219,6 +237,9 @@ reject bad timestamp meta field: index: mode: time_series routing_path: [metricset] + time_series: + start_time: 2021-04-28T00:00:00Z + end_time: 2021-04-29T00:00:00Z number_of_replicas: 0 number_of_shards: 2 mappings: @@ -238,6 +259,9 @@ write without timestamp: index: mode: time_series routing_path: [metricset] + time_series: + start_time: 2021-04-28T00:00:00Z + end_time: 2021-04-29T00:00:00Z number_of_replicas: 0 number_of_shards: 2 mappings: @@ -275,6 +299,9 @@ explicitly enable timestamp meta field: index: mode: time_series routing_path: [metricset] + time_series: + start_time: 2021-04-28T00:00:00Z + end_time: 2021-04-29T00:00:00Z number_of_replicas: 0 number_of_shards: 2 mappings: @@ -292,7 +319,7 @@ explicitly enable timestamp meta field: refresh: true index: test body: { - "@timestamp": 1632625793000, + "@timestamp": 2021-04-28T18:50:53.142Z, "metricset": "pod", "new_field" : "value" } @@ -303,7 +330,7 @@ explicitly enable timestamp meta field: body: docvalue_fields: [ '@timestamp', 'new_field.keyword' ] - match: { hits.total.value: 1 } - - match: { hits.hits.0.fields.@timestamp: [ "2021-09-26T03:09:53.000Z" ] } + - match: { hits.hits.0.fields.@timestamp: [ "2021-04-28T18:50:53.142Z" ] } - match: { hits.hits.0.fields.new_field\.keyword: [ "value" ] } - do: diff --git a/rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/tsdb/20_mapping.yml b/rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/tsdb/20_mapping.yml index 1d11cde944d45..c01fa5f24de44 100644 --- a/rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/tsdb/20_mapping.yml +++ b/rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/tsdb/20_mapping.yml @@ -1,7 +1,7 @@ ecs style: - skip: - version: " - 7.99.99" - reason: introduced in 8.0.0 + version: " - 8.0.99" + reason: introduced in 8.1.0 - do: indices.create: @@ -11,6 +11,9 @@ ecs style: index: mode: time_series routing_path: [metricset, k8s.pod.uid] + time_series: + start_time: 2021-04-28T00:00:00Z + end_time: 2021-04-29T00:00:00Z number_of_replicas: 0 number_of_shards: 2 mappings: @@ -53,8 +56,8 @@ ecs style: --- top level dim object: - skip: - version: " - 7.99.99" - reason: introduced in 8.0.0 + version: " - 8.0.99" + reason: introduced in 8.1.0 - do: indices.create: @@ -64,6 +67,9 @@ top level dim object: index: mode: time_series routing_path: [dim.*] + time_series: + start_time: 2021-04-28T00:00:00Z + end_time: 2021-04-29T00:00:00Z number_of_replicas: 0 number_of_shards: 2 mappings: @@ -108,8 +114,8 @@ top level dim object: --- non keyword matches routing_path: - skip: - version: " - 7.99.99" - reason: introduced in 8.0.0 + version: " - 8.0.99" + reason: introduced in 8.1.0 - do: catch: '/All fields that match routing_path must be keywords with \[time_series_dimension: true\] and without the \[script\] parameter. \[@timestamp\] was \[date\]./' @@ -120,6 +126,9 @@ non keyword matches routing_path: index: mode: time_series routing_path: [metricset, k8s.pod.uid, "@timestamp"] + time_series: + start_time: 2021-04-28T00:00:00Z + end_time: 2021-04-29T00:00:00Z number_of_replicas: 0 number_of_shards: 2 mappings: @@ -150,8 +159,8 @@ non keyword matches routing_path: --- runtime field matching routing path: - skip: - version: " - 7.99.99" - reason: introduced in 8.0.0 + version: " - 8.0.99" + reason: introduced in 8.1.0 - do: indices.create: @@ -161,6 +170,9 @@ runtime field matching routing path: index: mode: time_series routing_path: [dim.*] + time_series: + start_time: 2021-04-28T00:00:00Z + end_time: 2021-04-29T00:00:00Z mappings: properties: "@timestamp": @@ -189,8 +201,8 @@ runtime field matching routing path: --- "dynamic: runtime matches routing_path": - skip: - version: " - 7.99.99" - reason: introduced in 8.0.0 + version: " - 8.0.99" + reason: introduced in 8.1.0 - do: indices.create: @@ -200,6 +212,9 @@ runtime field matching routing path: index: mode: time_series routing_path: [dim.*] + time_series: + start_time: 2021-04-28T00:00:00Z + end_time: 2021-04-29T00:00:00Z mappings: properties: "@timestamp": @@ -223,8 +238,8 @@ runtime field matching routing path: --- "dynamic: false matches routing_path": - skip: - version: " - 7.99.99" - reason: introduced in 8.0.0 + version: " - 8.0.99" + reason: introduced in 8.1.0 - do: indices.create: @@ -234,6 +249,9 @@ runtime field matching routing path: index: mode: time_series routing_path: [dim.*] + time_series: + start_time: 2021-04-28T00:00:00Z + end_time: 2021-04-29T00:00:00Z mappings: properties: "@timestamp": diff --git a/rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/tsdb/30_snapshot.yml b/rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/tsdb/30_snapshot.yml index cb4c0ce663536..809908c717872 100644 --- a/rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/tsdb/30_snapshot.yml +++ b/rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/tsdb/30_snapshot.yml @@ -30,6 +30,9 @@ teardown: index: mode: time_series routing_path: [metricset, k8s.pod.uid] + time_series: + start_time: 2021-04-28T00:00:00Z + end_time: 2021-04-29T00:00:00Z number_of_replicas: 0 number_of_shards: 2 mappings: diff --git a/rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/tsdb/40_search.yml b/rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/tsdb/40_search.yml index ca8b32fb0c89f..7aa81bf654dee 100644 --- a/rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/tsdb/40_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 + version: " - 8.0.99" + reason: introduced in 8.1.0 - do: indices.create: @@ -11,6 +11,9 @@ setup: index: mode: time_series routing_path: [metricset, k8s.pod.uid] + time_series: + start_time: 2021-04-28T00:00:00Z + end_time: 2021-04-29T00:00:00Z mappings: properties: "@timestamp": @@ -60,8 +63,8 @@ setup: --- query a dimension: - skip: - version: " - 7.99.99" - reason: introduced in 8.0.0 + version: " - 8.0.99" + reason: introduced in 8.1.0 - do: search: @@ -76,8 +79,8 @@ query a dimension: --- query a metric: - skip: - version: " - 7.99.99" - reason: introduced in 8.0.0 + version: " - 8.0.99" + reason: introduced in 8.1.0 - do: search: @@ -108,8 +111,8 @@ query a metric: --- fetch a dimension: - skip: - version: " - 7.99.99" - reason: introduced in 8.0.0 + version: " - 8.0.99" + reason: introduced in 8.1.0 - do: search: @@ -127,8 +130,8 @@ fetch a dimension: --- fetch a metric: - skip: - version: " - 7.99.99" - reason: introduced in 8.0.0 + version: " - 8.0.99" + reason: introduced in 8.1.0 - do: search: @@ -147,8 +150,8 @@ fetch a metric: --- fetch a tag: - skip: - version: " - 7.99.99" - reason: introduced in 8.0.0 + version: " - 8.0.99" + reason: introduced in 8.1.0 - do: search: @@ -208,8 +211,8 @@ aggregate a dimension: --- aggregate a metric: - skip: - version: " - 7.99.99" - reason: introduced in 8.0.0 + version: " - 8.0.99" + reason: introduced in 8.1.0 - do: search: @@ -236,8 +239,8 @@ aggregate a metric: --- aggregate a tag: - skip: - version: " - 7.99.99" - reason: introduced in 8.0.0 + version: " - 8.0.99" + reason: introduced in 8.1.0 - do: search: diff --git a/rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/tsdb/50_alias.yml b/rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/tsdb/50_alias.yml index f404213bb5113..b44f66389e70a 100644 --- a/rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/tsdb/50_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 + version: " - 8.0.99" + reason: introduced in 8.1.0 - do: indices.create: @@ -11,6 +11,9 @@ setup: index: mode: time_series routing_path: [metricset, k8s.pod.uid] + time_series: + start_time: 2021-04-28T00:00:00Z + end_time: 2021-04-29T00:00:00Z mappings: properties: "@timestamp": diff --git a/rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/tsdb/60_add_dimensions.yml b/rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/tsdb/60_add_dimensions.yml index b17b1303b4245..716c0b120d6c3 100644 --- a/rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/tsdb/60_add_dimensions.yml +++ b/rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/tsdb/60_add_dimensions.yml @@ -12,6 +12,9 @@ add dimensions with put_mapping: index: mode: time_series routing_path: [metricset, k8s.pod.uid] + time_series: + start_time: 2021-04-28T00:00:00Z + end_time: 2021-04-29T00:00:00Z mappings: properties: "@timestamp": @@ -62,6 +65,9 @@ add dimensions to no dims with dynamic_template over index: index: mode: time_series routing_path: [metricset] + time_series: + start_time: 2021-04-28T00:00:00Z + end_time: 2021-04-29T00:00:00Z mappings: dynamic_templates: - keywords: @@ -107,6 +113,9 @@ add dimensions to no dims with dynamic_template over bulk: index: mode: time_series routing_path: [metricset] + time_series: + start_time: 2021-04-28T00:00:00Z + end_time: 2021-04-29T00:00:00Z mappings: dynamic_templates: - keywords: @@ -152,6 +161,9 @@ add dimensions to some dims with dynamic_template over index: index: mode: time_series routing_path: [metricset] + time_series: + start_time: 2021-04-28T00:00:00Z + end_time: 2021-04-29T00:00:00Z mappings: dynamic_templates: - keywords: @@ -201,6 +213,9 @@ add dimensions to some dims with dynamic_template over bulk: index: mode: time_series routing_path: [metricset] + time_series: + start_time: 2021-04-28T00:00:00Z + end_time: 2021-04-29T00:00:00Z mappings: dynamic_templates: - keywords: diff --git a/rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/tsdb/70_dimension_types.yml b/rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/tsdb/70_dimension_types.yml index aed895a97980c..d937367b5117b 100644 --- a/rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/tsdb/70_dimension_types.yml +++ b/rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/tsdb/70_dimension_types.yml @@ -12,6 +12,9 @@ keyword dimension: index: mode: time_series routing_path: [uid] + time_series: + start_time: 2021-04-28T00:00:00Z + end_time: 2021-04-29T00:00:00Z mappings: properties: "@timestamp": @@ -82,6 +85,9 @@ long dimension: index: mode: time_series routing_path: [metricset] + time_series: + start_time: 2021-04-28T00:00:00Z + end_time: 2021-04-29T00:00:00Z mappings: properties: "@timestamp": @@ -154,6 +160,9 @@ ip dimension: index: mode: time_series routing_path: [metricset] + time_series: + start_time: 2021-04-28T00:00:00Z + end_time: 2021-04-29T00:00:00Z mappings: properties: "@timestamp": diff --git a/rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/tsdb/80_index_resize.yml b/rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/tsdb/80_index_resize.yml index 5a4c6b8065419..1718a6005002a 100644 --- a/rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/tsdb/80_index_resize.yml +++ b/rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/tsdb/80_index_resize.yml @@ -23,6 +23,9 @@ setup: index: mode: time_series routing_path: [metricset, k8s.pod.uid] + time_series: + start_time: 2021-04-28T00:00:00Z + end_time: 2021-04-29T00:00:00Z number_of_shards: 3 number_of_replicas: 0 # ensure everything is allocated on the same data node for shrink diff --git a/rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/tsdb/90_unsupported_operations.yml b/rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/tsdb/90_unsupported_operations.yml index a5b7846399d71..a742d0a8148a8 100644 --- a/rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/tsdb/90_unsupported_operations.yml +++ b/rest-api-spec/src/yamlRestTest/resources/rest-api-spec/test/tsdb/90_unsupported_operations.yml @@ -1,7 +1,7 @@ setup: - skip: - version: " - 7.99.99" - reason: introduced in 8.0.0 + version: " - 8.0.99" + reason: introduced in 8.1.0 - do: indices.create: @@ -11,6 +11,9 @@ setup: index: mode: time_series routing_path: [metricset, k8s.pod.uid] + time_series: + start_time: 2021-04-28T00:00:00Z + end_time: 2021-04-29T00:00:00Z number_of_replicas: 0 number_of_shards: 2 mappings: @@ -63,8 +66,8 @@ setup: --- index with specified routing: - skip: - version: " - 7.99.99" - reason: introduced in 8.0.0 + version: " - 8.0.99" + reason: introduced in 8.1.0 - do: catch: /indexing with a specified routing is not supported because the destination index \[test\] is in time series mode/ @@ -87,8 +90,8 @@ index with specified routing: --- index with specified routing over _bulk: - skip: - version: " - 7.99.99" - reason: introduced in 8.0.0 + version: " - 8.0.99" + reason: introduced in 8.1.0 - do: bulk: refresh: true @@ -101,8 +104,8 @@ index with specified routing over _bulk: --- delete: - skip: - version: " - 7.99.99" - reason: introduced in 8.0.0 + version: " - 8.0.99" + reason: introduced in 8.1.0 - do: catch: /delete is not supported because the destination index \[test\] is in time series mode/ @@ -113,8 +116,8 @@ delete: --- delete over _bulk: - skip: - version: " - 7.99.99" - reason: introduced in 8.0.0 + version: " - 8.0.99" + reason: introduced in 8.1.0 - do: bulk: @@ -127,8 +130,8 @@ delete over _bulk: --- noop update: - skip: - version: " - 7.99.99" - reason: introduced in 8.0.0 + version: " - 8.0.99" + reason: introduced in 8.1.0 - do: search: @@ -149,8 +152,8 @@ noop update: --- update: - skip: - version: " - 7.99.99" - reason: introduced in 8.0.0 + version: " - 8.0.99" + reason: introduced in 8.1.0 # We fail even though the document isn't found. - do: @@ -174,8 +177,8 @@ update: --- update over _bulk: - skip: - version: " - 7.99.99" - reason: introduced in 8.0.0 + version: " - 8.0.99" + reason: introduced in 8.1.0 - do: bulk: @@ -188,8 +191,8 @@ update over _bulk: --- search with routing: - skip: - version: " - 7.99.99" - reason: introduced in 8.0.0 + version: " - 8.0.99" + reason: introduced in 8.1.0 # We fail even though the document isn't found. - do: @@ -201,8 +204,8 @@ search with routing: --- alias with routing: - skip: - version: " - 7.99.99" - reason: introduced in 8.0.0 + version: " - 8.0.99" + reason: introduced in 8.1.0 - do: catch: /routing is forbidden on CRUD operations that target indices in \[index.mode=time_series\]/ @@ -215,8 +218,8 @@ alias with routing: --- alias with search_routing: - skip: - version: " - 7.99.99" - reason: introduced in 8.0.0 + version: " - 8.0.99" + reason: introduced in 8.1.0 - do: catch: /routing is forbidden on CRUD operations that target indices in \[index.mode=time_series\]/ diff --git a/server/src/main/java/org/elasticsearch/index/IndexMode.java b/server/src/main/java/org/elasticsearch/index/IndexMode.java index ec0e689dfb238..9ad626af8fbf1 100644 --- a/server/src/main/java/org/elasticsearch/index/IndexMode.java +++ b/server/src/main/java/org/elasticsearch/index/IndexMode.java @@ -89,7 +89,8 @@ void validateWithOtherSettings(Map, Object> settings) { } } settingRequiresTimeSeries(settings, IndexMetadata.INDEX_ROUTING_PATH); - // TODO make start and stop time required + settingRequiresTimeSeries(settings, IndexSettings.TIME_SERIES_START_TIME); + settingRequiresTimeSeries(settings, IndexSettings.TIME_SERIES_END_TIME); } private void settingRequiresTimeSeries(Map, Object> settings, Setting setting) { diff --git a/server/src/test/java/org/elasticsearch/index/IndexSortSettingsTests.java b/server/src/test/java/org/elasticsearch/index/IndexSortSettingsTests.java index 3bd46a0f1ac07..211ee680af85a 100644 --- a/server/src/test/java/org/elasticsearch/index/IndexSortSettingsTests.java +++ b/server/src/test/java/org/elasticsearch/index/IndexSortSettingsTests.java @@ -179,6 +179,8 @@ public void testTimeSeriesMode() { Settings.builder() .put(IndexSettings.MODE.getKey(), "time_series") .put(IndexMetadata.INDEX_ROUTING_PATH.getKey(), "some_dimension") + .put(IndexSettings.TIME_SERIES_START_TIME.getKey(), "2021-04-28T00:00:00Z") + .put(IndexSettings.TIME_SERIES_END_TIME.getKey(), "2021-04-29T00:00:00Z") .build() ); Sort sort = buildIndexSort(indexSettings, TimeSeriesIdFieldMapper.FIELD_TYPE, new DateFieldMapper.DateFieldType("@timestamp")); @@ -192,6 +194,8 @@ public void testTimeSeriesModeNoTimestamp() { Settings.builder() .put(IndexSettings.MODE.getKey(), "time_series") .put(IndexMetadata.INDEX_ROUTING_PATH.getKey(), "some_dimension") + .put(IndexSettings.TIME_SERIES_START_TIME.getKey(), "2021-04-28T00:00:00Z") + .put(IndexSettings.TIME_SERIES_END_TIME.getKey(), "2021-04-29T00:00:00Z") .build() ); Exception e = expectThrows(IllegalArgumentException.class, () -> buildIndexSort(indexSettings, TimeSeriesIdFieldMapper.FIELD_TYPE)); diff --git a/server/src/test/java/org/elasticsearch/index/TimeSeriesModeTests.java b/server/src/test/java/org/elasticsearch/index/TimeSeriesModeTests.java index 925bed8c7ab77..8016f3cd6cdb3 100644 --- a/server/src/test/java/org/elasticsearch/index/TimeSeriesModeTests.java +++ b/server/src/test/java/org/elasticsearch/index/TimeSeriesModeTests.java @@ -25,45 +25,30 @@ public class TimeSeriesModeTests extends MapperServiceTestCase { public void testConfigureIndex() { - Settings s = Settings.builder() - .put(IndexSettings.MODE.getKey(), "time_series") - .put(IndexMetadata.INDEX_ROUTING_PATH.getKey(), "foo") - .build(); + Settings s = getSettings(); assertSame(IndexMode.TIME_SERIES, IndexSettings.MODE.get(s)); } public void testPartitioned() { - Settings s = Settings.builder() - .put(IndexMetadata.INDEX_ROUTING_PARTITION_SIZE_SETTING.getKey(), 2) - .put(IndexSettings.MODE.getKey(), "time_series") - .build(); + Settings s = Settings.builder().put(getSettings()).put(IndexMetadata.INDEX_ROUTING_PARTITION_SIZE_SETTING.getKey(), 2).build(); Exception e = expectThrows(IllegalArgumentException.class, () -> IndexSettings.MODE.get(s)); assertThat(e.getMessage(), equalTo("[index.mode=time_series] is incompatible with [index.routing_partition_size]")); } public void testSortField() { - Settings s = Settings.builder() - .put(IndexSortConfig.INDEX_SORT_FIELD_SETTING.getKey(), "a") - .put(IndexSettings.MODE.getKey(), "time_series") - .build(); + Settings s = Settings.builder().put(getSettings()).put(IndexSortConfig.INDEX_SORT_FIELD_SETTING.getKey(), "a").build(); Exception e = expectThrows(IllegalArgumentException.class, () -> IndexSettings.MODE.get(s)); assertThat(e.getMessage(), equalTo("[index.mode=time_series] is incompatible with [index.sort.field]")); } public void testSortMode() { - Settings s = Settings.builder() - .put(IndexSortConfig.INDEX_SORT_MISSING_SETTING.getKey(), "_last") - .put(IndexSettings.MODE.getKey(), "time_series") - .build(); + Settings s = Settings.builder().put(getSettings()).put(IndexSortConfig.INDEX_SORT_MISSING_SETTING.getKey(), "_last").build(); Exception e = expectThrows(IllegalArgumentException.class, () -> IndexSettings.MODE.get(s)); assertThat(e.getMessage(), equalTo("[index.mode=time_series] is incompatible with [index.sort.missing]")); } public void testSortOrder() { - Settings s = Settings.builder() - .put(IndexSortConfig.INDEX_SORT_ORDER_SETTING.getKey(), "desc") - .put(IndexSettings.MODE.getKey(), "time_series") - .build(); + Settings s = Settings.builder().put(getSettings()).put(IndexSortConfig.INDEX_SORT_ORDER_SETTING.getKey(), "desc").build(); Exception e = expectThrows(IllegalArgumentException.class, () -> IndexSettings.MODE.get(s)); assertThat(e.getMessage(), equalTo("[index.mode=time_series] is incompatible with [index.sort.order]")); } @@ -75,10 +60,7 @@ public void testWithoutRoutingPath() { } public void testRequiredRouting() { - Settings s = Settings.builder() - .put(IndexSettings.MODE.getKey(), "time_series") - .put(IndexMetadata.INDEX_ROUTING_PATH.getKey(), "foo") - .build(); + Settings s = getSettings(); Exception e = expectThrows( IllegalArgumentException.class, () -> createMapperService(s, topMapping(b -> b.startObject("_routing").field("required", true).endObject())) @@ -87,36 +69,24 @@ public void testRequiredRouting() { } public void testValidateAlias() { - Settings s = Settings.builder() - .put(IndexSettings.MODE.getKey(), "time_series") - .put(IndexMetadata.INDEX_ROUTING_PATH.getKey(), "foo") - .build(); + Settings s = getSettings(); IndexSettings.MODE.get(s).validateAlias(null, null); // Doesn't throw exception } public void testValidateAliasWithIndexRouting() { - Settings s = Settings.builder() - .put(IndexSettings.MODE.getKey(), "time_series") - .put(IndexMetadata.INDEX_ROUTING_PATH.getKey(), "foo") - .build(); + Settings s = getSettings(); Exception e = expectThrows(IllegalArgumentException.class, () -> IndexSettings.MODE.get(s).validateAlias("r", null)); assertThat(e.getMessage(), equalTo("routing is forbidden on CRUD operations that target indices in [index.mode=time_series]")); } public void testValidateAliasWithSearchRouting() { - Settings s = Settings.builder() - .put(IndexSettings.MODE.getKey(), "time_series") - .put(IndexMetadata.INDEX_ROUTING_PATH.getKey(), "foo") - .build(); + Settings s = getSettings(); Exception e = expectThrows(IllegalArgumentException.class, () -> IndexSettings.MODE.get(s).validateAlias(null, "r")); assertThat(e.getMessage(), equalTo("routing is forbidden on CRUD operations that target indices in [index.mode=time_series]")); } public void testRoutingPathMatchesObject() { - Settings s = Settings.builder() - .put(IndexSettings.MODE.getKey(), "time_series") - .put(IndexMetadata.INDEX_ROUTING_PATH.getKey(), randomBoolean() ? "dim.o" : "dim.*") - .build(); + Settings s = getSettings(randomBoolean() ? "dim.o" : "dim.*"); Exception e = expectThrows(IllegalArgumentException.class, () -> createMapperService(s, mapping(b -> { b.startObject("dim").startObject("properties"); { @@ -137,10 +107,7 @@ public void testRoutingPathMatchesObject() { } public void testRoutingPathMatchesNonDimensionKeyword() { - Settings s = Settings.builder() - .put(IndexSettings.MODE.getKey(), "time_series") - .put(IndexMetadata.INDEX_ROUTING_PATH.getKey(), randomBoolean() ? "dim.non_dim" : "dim.*") - .build(); + Settings s = getSettings(randomBoolean() ? "dim.non_dim" : "dim.*"); Exception e = expectThrows(IllegalArgumentException.class, () -> createMapperService(s, mapping(b -> { b.startObject("dim").startObject("properties"); b.startObject("non_dim").field("type", "keyword").endObject(); @@ -157,10 +124,7 @@ public void testRoutingPathMatchesNonDimensionKeyword() { } public void testRoutingPathMatchesNonKeyword() { - Settings s = Settings.builder() - .put(IndexSettings.MODE.getKey(), "time_series") - .put(IndexMetadata.INDEX_ROUTING_PATH.getKey(), randomBoolean() ? "dim.non_kwd" : "dim.*") - .build(); + Settings s = getSettings(randomBoolean() ? "dim.non_kwd" : "dim.*"); Exception e = expectThrows(IllegalArgumentException.class, () -> createMapperService(s, mapping(b -> { b.startObject("dim").startObject("properties"); b.startObject("non_kwd").field("type", "integer").field("time_series_dimension", true).endObject(); @@ -177,10 +141,7 @@ public void testRoutingPathMatchesNonKeyword() { } public void testRoutingPathMatchesScriptedKeyword() { - Settings s = Settings.builder() - .put(IndexSettings.MODE.getKey(), "time_series") - .put(IndexMetadata.INDEX_ROUTING_PATH.getKey(), randomBoolean() ? "dim.kwd" : "dim.*") - .build(); + Settings s = getSettings(randomBoolean() ? "dim.kwd" : "dim.*"); Exception e = expectThrows(IllegalArgumentException.class, () -> createMapperService(s, mapping(b -> { b.startObject("dim.kwd"); b.field("type", "keyword"); @@ -198,10 +159,7 @@ public void testRoutingPathMatchesScriptedKeyword() { } public void testRoutingPathMatchesRuntimeKeyword() { - Settings s = Settings.builder() - .put(IndexSettings.MODE.getKey(), "time_series") - .put(IndexMetadata.INDEX_ROUTING_PATH.getKey(), randomBoolean() ? "dim.kwd" : "dim.*") - .build(); + Settings s = getSettings(randomBoolean() ? "dim.kwd" : "dim.*"); Exception e = expectThrows( IllegalArgumentException.class, () -> createMapperService(s, runtimeMapping(b -> b.startObject("dim.kwd").field("type", "keyword").endObject())) @@ -216,10 +174,7 @@ public void testRoutingPathMatchesRuntimeKeyword() { } public void testRoutingPathMatchesOnlyKeywordDimensions() throws IOException { - Settings s = Settings.builder() - .put(IndexSettings.MODE.getKey(), "time_series") - .put(IndexMetadata.INDEX_ROUTING_PATH.getKey(), randomBoolean() ? "dim.metric_type,dim.server,dim.species,dim.uuid" : "dim.*") - .build(); + Settings s = getSettings(randomBoolean() ? "dim.metric_type,dim.server,dim.species,dim.uuid" : "dim.*"); createMapperService(s, mapping(b -> { b.startObject("dim").startObject("properties"); b.startObject("metric_type").field("type", "keyword").field("time_series_dimension", true).endObject(); @@ -243,4 +198,21 @@ public LeafFactory newFactory(String fieldName, Map params, Sear } return super.compileScript(script, context); } + + private Settings getSettings() { + return getSettings(randomAlphaOfLength(5), "2021-04-28T00:00:00Z", "2021-04-29T00:00:00Z"); + } + + private Settings getSettings(String routingPath) { + return getSettings(routingPath, "2021-04-28T00:00:00Z", "2021-04-29T00:00:00Z"); + } + + private Settings getSettings(String routingPath, String startTime, String endTime) { + return Settings.builder() + .put(IndexSettings.MODE.getKey(), "time_series") + .put(IndexMetadata.INDEX_ROUTING_PATH.getKey(), routingPath) + .put(IndexSettings.TIME_SERIES_START_TIME.getKey(), startTime) + .put(IndexSettings.TIME_SERIES_END_TIME.getKey(), endTime) + .build(); + } } diff --git a/server/src/test/java/org/elasticsearch/index/mapper/DocumentParserTests.java b/server/src/test/java/org/elasticsearch/index/mapper/DocumentParserTests.java index 6c7ffe1aee22f..bec3b8294686e 100644 --- a/server/src/test/java/org/elasticsearch/index/mapper/DocumentParserTests.java +++ b/server/src/test/java/org/elasticsearch/index/mapper/DocumentParserTests.java @@ -1995,6 +1995,8 @@ public void testDynamicFalseMatchesRoutingPath() throws IOException { .put(getIndexSettings()) .put(IndexSettings.MODE.getKey(), "time_series") .put(IndexMetadata.INDEX_ROUTING_PATH.getKey(), "dim.*") + .put(IndexSettings.TIME_SERIES_START_TIME.getKey(), "2021-04-28T00:00:00Z") + .put(IndexSettings.TIME_SERIES_END_TIME.getKey(), "2021-04-29T00:00:00Z") .build(), mapping(b -> { b.startObject("dim"); diff --git a/server/src/test/java/org/elasticsearch/index/mapper/KeywordFieldMapperTests.java b/server/src/test/java/org/elasticsearch/index/mapper/KeywordFieldMapperTests.java index 63b2ceb0c7925..8cb9fe10702eb 100644 --- a/server/src/test/java/org/elasticsearch/index/mapper/KeywordFieldMapperTests.java +++ b/server/src/test/java/org/elasticsearch/index/mapper/KeywordFieldMapperTests.java @@ -604,6 +604,8 @@ public void testDimensionInRoutingPath() throws IOException { Settings.builder() .put(IndexSettings.MODE.getKey(), "time_series") .put(IndexMetadata.INDEX_ROUTING_PATH.getKey(), "field") + .put(IndexSettings.TIME_SERIES_START_TIME.getKey(), "2021-04-28T00:00:00Z") + .put(IndexSettings.TIME_SERIES_END_TIME.getKey(), "2021-04-29T00:00:00Z") .build() ); mapper.documentMapper().validate(settings, false); // Doesn't throw diff --git a/server/src/test/java/org/elasticsearch/index/mapper/TimeSeriesIdFieldMapperTests.java b/server/src/test/java/org/elasticsearch/index/mapper/TimeSeriesIdFieldMapperTests.java index 81acf8e6c74ef..f95c342d054da 100644 --- a/server/src/test/java/org/elasticsearch/index/mapper/TimeSeriesIdFieldMapperTests.java +++ b/server/src/test/java/org/elasticsearch/index/mapper/TimeSeriesIdFieldMapperTests.java @@ -43,6 +43,8 @@ private DocumentMapper createDocumentMapper(String routingPath, XContentBuilder getIndexSettingsBuilder().put(IndexSettings.MODE.getKey(), IndexMode.TIME_SERIES.name()) .put(MapperService.INDEX_MAPPING_DIMENSION_FIELDS_LIMIT_SETTING.getKey(), 200) // Increase dimension limit .put(IndexMetadata.INDEX_ROUTING_PATH.getKey(), routingPath) + .put(IndexSettings.TIME_SERIES_START_TIME.getKey(), "2021-04-28T00:00:00Z") + .put(IndexSettings.TIME_SERIES_END_TIME.getKey(), "2021-04-29T00:00:00Z") .build(), mappings ).documentMapper(); diff --git a/test/framework/src/main/java/org/elasticsearch/index/mapper/MapperTestCase.java b/test/framework/src/main/java/org/elasticsearch/index/mapper/MapperTestCase.java index 7da507d04430a..3b25f3721e42e 100644 --- a/test/framework/src/main/java/org/elasticsearch/index/mapper/MapperTestCase.java +++ b/test/framework/src/main/java/org/elasticsearch/index/mapper/MapperTestCase.java @@ -752,6 +752,8 @@ public final void testMinimalIsInvalidInRoutingPath() throws IOException { Settings.builder() .put(IndexSettings.MODE.getKey(), "time_series") .put(IndexMetadata.INDEX_ROUTING_PATH.getKey(), "field") + .put(IndexSettings.TIME_SERIES_START_TIME.getKey(), "2021-04-28T00:00:00Z") + .put(IndexSettings.TIME_SERIES_END_TIME.getKey(), "2021-04-29T00:00:00Z") .build() ); Exception e = expectThrows(IllegalArgumentException.class, () -> mapper.documentMapper().validate(settings, false)); diff --git a/x-pack/plugin/ccr/qa/multi-cluster/src/test/java/org/elasticsearch/xpack/ccr/FollowIndexIT.java b/x-pack/plugin/ccr/qa/multi-cluster/src/test/java/org/elasticsearch/xpack/ccr/FollowIndexIT.java index 9907b2ba71d74..d2f6b0215d081 100644 --- a/x-pack/plugin/ccr/qa/multi-cluster/src/test/java/org/elasticsearch/xpack/ccr/FollowIndexIT.java +++ b/x-pack/plugin/ccr/qa/multi-cluster/src/test/java/org/elasticsearch/xpack/ccr/FollowIndexIT.java @@ -244,7 +244,7 @@ public void testFollowSearchableSnapshotsFails() throws Exception { public void testFollowTsdbIndex() throws Exception { final int numDocs = 128; final String leaderIndexName = "tsdb_leader"; - long basetime = DateFieldMapper.DEFAULT_DATE_TIME_FORMATTER.parseMillis("2021-01-01T00:00:00Z"); + long basetime = DateFieldMapper.DEFAULT_DATE_TIME_FORMATTER.parseMillis("2021-04-28T18:35:24.467Z"); if ("leader".equals(targetCluster)) { logger.info("Running against leader cluster"); createIndex( @@ -252,6 +252,8 @@ public void testFollowTsdbIndex() throws Exception { Settings.builder() .put(IndexSettings.MODE.getKey(), "time_series") .put(IndexMetadata.INDEX_ROUTING_PATH.getKey(), "dim") + .put(IndexSettings.TIME_SERIES_START_TIME.getKey(), "2021-04-28T00:00:00Z") + .put(IndexSettings.TIME_SERIES_END_TIME.getKey(), "2021-04-29T00:00:00Z") .build(), "\"properties\": {\"@timestamp\": {\"type\": \"date\"}, \"dim\": {\"type\": \"keyword\", \"time_series_dimension\": true}}" ); diff --git a/x-pack/plugin/src/yamlRestTest/resources/rest-api-spec/test/analytics/histogram.yml b/x-pack/plugin/src/yamlRestTest/resources/rest-api-spec/test/analytics/histogram.yml index a8bc88f7f7f07..4ac176423e0ab 100644 --- a/x-pack/plugin/src/yamlRestTest/resources/rest-api-spec/test/analytics/histogram.yml +++ b/x-pack/plugin/src/yamlRestTest/resources/rest-api-spec/test/analytics/histogram.yml @@ -175,8 +175,8 @@ setup: --- histogram with time series mappings: - skip: - version: " - 7.99.99" - reason: time series mode added in 8.0.0 + version: " - 8.0.99" + reason: introduced in 8.1.0 - do: @@ -187,6 +187,9 @@ histogram with time series mappings: index: mode: time_series routing_path: [metricset, k8s.pod.uid] + time_series: + start_time: 2021-04-28T00:00:00Z + end_time: 2021-04-29T00:00:00Z number_of_replicas: 0 number_of_shards: 2 mappings: diff --git a/x-pack/plugin/src/yamlRestTest/resources/rest-api-spec/test/data_stream/150_tsdb.yml b/x-pack/plugin/src/yamlRestTest/resources/rest-api-spec/test/data_stream/150_tsdb.yml index a4db59eb5c1c0..47fe7a890cf87 100644 --- a/x-pack/plugin/src/yamlRestTest/resources/rest-api-spec/test/data_stream/150_tsdb.yml +++ b/x-pack/plugin/src/yamlRestTest/resources/rest-api-spec/test/data_stream/150_tsdb.yml @@ -1,7 +1,7 @@ setup: - skip: - version: " - 7.99.99" - reason: introduced in 8.0.0 + version: " - 8.0.99" + reason: introduced in 8.1.0 features: allowed_warnings - do: @@ -19,6 +19,9 @@ setup: number_of_shards: 2 mode: time_series routing_path: [metricset, time_series_dimension] + time_series: + start_time: 2021-04-28T00:00:00Z + end_time: 2021-04-29T00:00:00Z mappings: properties: "@timestamp":