-
Notifications
You must be signed in to change notification settings - Fork 25.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
TSDB: Add unsigned_long dimension fields to _tsid #81284
This PR builds on the work added in #80276 that generates the _tsid field for keyword, ip and number dimension fields. It adds support for unsigned_long dimension fields.
- Loading branch information
Showing
3 changed files
with
154 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
124 changes: 124 additions & 0 deletions
124
...gin/mapper-unsigned-long/src/yamlRestTest/resources/rest-api-spec/test/70_time_series.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,124 @@ | ||
setup: | ||
- skip: | ||
version: " - 8.0.99" | ||
reason: _tsid introduced in 8.1.0 | ||
|
||
- do: | ||
indices.create: | ||
index: test | ||
body: | ||
settings: | ||
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": | ||
type: date | ||
metricset: | ||
type: keyword | ||
time_series_dimension: true | ||
ul: | ||
type: unsigned_long | ||
time_series_dimension: true | ||
|
||
- do: | ||
bulk: | ||
refresh: true | ||
index: test | ||
body: | ||
- '{"index": {}}' | ||
- '{"@timestamp": "2021-04-28T18:35:24.467Z", "metricset": "aa", "voltage": 7.2, "ul": 9223372036854775807}' | ||
- '{"index": {}}' | ||
- '{"@timestamp": "2021-04-28T18:35:34.467Z", "metricset": "aa", "voltage": 7.6, "ul": 9223372036854775807}' | ||
- '{"index": {}}' | ||
- '{"@timestamp": "2021-04-28T18:35:44.467Z", "metricset": "aa", "voltage": 7.1, "ul": 18446744073709551614}' | ||
- '{"index": {}}' | ||
- '{"@timestamp": "2021-04-28T18:35:54.467Z", "metricset": "aa", "voltage": 7.3, "ul": 18446744073709551615}' | ||
- '{"index": {}}' | ||
- '{"@timestamp": "2021-04-28T18:35:24.467Z", "metricset": "aa", "voltage": 3.2, "ul": 9223372036854775808}' | ||
- '{"index": {}}' | ||
- '{"@timestamp": "2021-04-28T18:35:34.467Z", "metricset": "aa", "voltage": 3.6, "ul": 9223372036854775808}' | ||
- '{"index": {}}' | ||
- '{"@timestamp": "2021-04-28T18:35:44.467Z", "metricset": "aa", "voltage": 3.1, "ul": 9223372036854775808}' | ||
- '{"index": {}}' | ||
- '{"@timestamp": "2021-04-28T18:35:54.467Z", "metricset": "aa", "voltage": 3.3, "ul": 9223372036854775807}' | ||
|
||
--- | ||
fetch the _tsid: | ||
- skip: | ||
version: " - 8.00.99" | ||
reason: _tsid support introduced in 8.1.0 | ||
|
||
- do: | ||
search: | ||
index: test | ||
body: | ||
fields: [_tsid, metricset, ul] | ||
query: | ||
query_string: | ||
query: '+@timestamp:"2021-04-28T18:35:24.467Z" +metricset:aa' | ||
|
||
- match: {hits.total.value: 2} | ||
- match: {hits.hits.0.fields._tsid: [{metricset: aa, ul: 9223372036854775808}]} | ||
- match: {hits.hits.0.fields.metricset: [aa]} | ||
- match: {hits.hits.0.fields.ul: [9223372036854775808]} | ||
- match: {hits.hits.1.fields._tsid: [{metricset: aa, ul: 9223372036854775807}]} | ||
- match: {hits.hits.1.fields.metricset: [aa]} | ||
- match: {hits.hits.1.fields.ul: [9223372036854775807]} | ||
|
||
--- | ||
# TODO: Sort order is wrong here. Probably this is caused by the encoding of unsigned_long | ||
aggregate the _tsid: | ||
- skip: | ||
version: " - 8.00.99" | ||
reason: _tsid support introduced in 8.1.0 | ||
|
||
- do: | ||
search: | ||
index: test | ||
body: | ||
size: 0 | ||
aggs: | ||
tsids: | ||
terms: | ||
field: _tsid | ||
order: | ||
_key: asc | ||
|
||
- match: {hits.total.value: 8} | ||
- match: {aggregations.tsids.buckets.0.key: {metricset: aa, ul: 9223372036854775808}} | ||
- match: {aggregations.tsids.buckets.0.doc_count: 3} | ||
- match: {aggregations.tsids.buckets.1.key: {metricset: aa, ul: 18446744073709551614}} | ||
- match: {aggregations.tsids.buckets.1.doc_count: 1} | ||
- match: {aggregations.tsids.buckets.2.key: {metricset: aa, ul: 18446744073709551615}} | ||
- match: {aggregations.tsids.buckets.2.doc_count: 1 } | ||
- match: {aggregations.tsids.buckets.3.key: {metricset: aa, ul: 9223372036854775807}} | ||
- match: {aggregations.tsids.buckets.3.doc_count: 3} | ||
|
||
--- | ||
# The time-series index is sorted by [_tsid, @timestamp] in ascending order by default | ||
# TODO: Sort order is wrong here. Probably this is caused by the encoding of unsigned_long | ||
default sort: | ||
- skip: | ||
version: " - 8.00.99" | ||
reason: _tsid support introduced in 8.1.0 | ||
|
||
- do: | ||
search: | ||
index: test | ||
body: | ||
fields: [ _tsid ] | ||
|
||
- match: {hits.total.value: 8 } | ||
- match: {hits.hits.0.fields._tsid: [{metricset: aa, ul: 9223372036854775808}]} | ||
- match: {hits.hits.1.fields._tsid: [{metricset: aa, ul: 9223372036854775808}]} | ||
- match: {hits.hits.2.fields._tsid: [{metricset: aa, ul: 9223372036854775808}]} | ||
- match: {hits.hits.3.fields._tsid: [{metricset: aa, ul: 18446744073709551614}]} | ||
- match: {hits.hits.4.fields._tsid: [{metricset: aa, ul: 18446744073709551615}]} | ||
- match: {hits.hits.5.fields._tsid: [{metricset: aa, ul: 9223372036854775807}]} | ||
- match: {hits.hits.6.fields._tsid: [{metricset: aa, ul: 9223372036854775807}]} | ||
- match: {hits.hits.7.fields._tsid: [{metricset: aa, ul: 9223372036854775807}]} |