Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TSDB: move TimeSeriesModeIT to yaml tests #80933

Merged
merged 6 commits into from
Nov 23, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,11 @@ set start_time and end_time:
time_series:
start_time: 1632625782000
end_time: 1632625792000
mappings:
properties:
metricset:
type: keyword
time_series_dimension: true

- do:
indices.put_settings:
Expand All @@ -202,6 +207,23 @@ set start_time and end_time:
time_series:
end_time: 1632625792000

- do:
index:
refresh: true
index: test_index
body: {
"@timestamp": 1632625792000,
"metricset": "pod"
}

- do:
search:
index: test_index
body:
docvalue_fields: [ '@timestamp' ]
- match: { hits.total.value: 1 }
- match: { "hits.hits.0.fields.@timestamp": [ "2021-09-26T03:09:52.000Z" ] }

- do:
indices.delete:
index: test_index
Expand Down Expand Up @@ -231,6 +253,46 @@ set start_time and end_time without timeseries mode:
time_series:
end_time: 1632625782000

---
set bad start_time and end_time:
- skip:
version: " - 8.0.99"
reason: introduced in 8.1.0
- do:
indices.create:
index: test_index
body:
settings:
index:
mode: time_series
routing_path: [ metricset ]
time_series:
start_time: 1632625782000
end_time: 1632625792000
mappings:
properties:
metricset:
type: keyword
time_series_dimension: true

- do:
catch: /time series index @timestamp value \[2021-09-26T03:09:41Z\] must be larger than 2021-09-26T03:09:42Z/
index:
index: test_index
body: {
"@timestamp": 1632625781000,
"metricset": "pod"
}

- do:
catch: /time series index @timestamp value \[2021-09-26T03:09:53Z\] must be smaller than 2021-09-26T03:09:52Z/
index:
index: test_index
body: {
"@timestamp": 1632625793000,
"metricset": "pod"
weizijun marked this conversation as resolved.
Show resolved Hide resolved
}

---
check start_time and end_time with data_nano:
- skip:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ reject @timestamp with wrong type:
reject timestamp meta field with wrong type:
- skip:
version: " - 8.0.99"
reason: introduced in 8.0.0 to be backported to 7.16.0
reason: introduced in 8.1.0

- do:
catch: /\[_data_stream_timestamp\] meta field has been disabled/
Expand All @@ -177,3 +177,138 @@ reject timestamp meta field with wrong type:
mappings:
_data_stream_timestamp:
enabled: false

---
enable timestamp meta field:
weizijun marked this conversation as resolved.
Show resolved Hide resolved
- skip:
version: " - 8.0.99"
reason: introduced in 8.1.0

- do:
indices.create:
index: test
body:
settings:
index:
mode: time_series
routing_path: [metricset]
number_of_replicas: 0
number_of_shards: 2
mappings:
_data_stream_timestamp:
enabled: true

- do:
indices.get_mapping:
index: test
- match: { "[email protected]": date }
- match: { 'test.mappings._data_stream_timestamp.enabled': true }

---
reject bad timestamp meta field:
- skip:
version: " - 8.0.99"
reason: introduced in 8.1.0

- do:
catch: /\[_data_stream_timestamp\] config must be an object/
indices.create:
index: test
body:
settings:
index:
mode: time_series
routing_path: [metricset]
number_of_replicas: 0
number_of_shards: 2
mappings:
_data_stream_timestamp: enabled

---
write without timestamp:
- skip:
version: " - 8.0.99"
reason: introduced in 8.1.0

- do:
indices.create:
index: test
body:
settings:
index:
mode: time_series
routing_path: [metricset]
number_of_replicas: 0
number_of_shards: 2
mappings:
properties:
"@timestamp":
type: date
metricset:
type: keyword
time_series_dimension: true

- do:
indices.get_mapping:
index: test
- match: { "[email protected]": date }
- match: { 'test.mappings._data_stream_timestamp.enabled': true }

- do:
catch: /data stream timestamp field \[@timestamp\] is missing/
index:
index: test
body:
"metricset": "pod"

---
explicitly enable timestamp meta field:
- skip:
version: " - 8.0.99"
reason: introduced in 8.1.0

- do:
indices.create:
index: test
body:
settings:
index:
mode: time_series
routing_path: [metricset]
number_of_replicas: 0
number_of_shards: 2
mappings:
properties:
"@timestamp":
type: date
meta:
field_meta: time_series
metricset:
type: keyword
time_series_dimension: true

- do:
index:
refresh: true
index: test
body: {
"@timestamp": 1632625793000,
"metricset": "pod",
"new_field" : "value"
}

- do:
search:
index: test
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.new_field\.keyword: [ "value" ] }

- do:
indices.get_mapping:
index: test
- match: { "[email protected]": date }
- match: { "[email protected]_meta": time_series }
- match: { 'test.mappings._data_stream_timestamp.enabled': true }
Loading