-
Notifications
You must be signed in to change notification settings - Fork 25.8k
Can't use time_series_metric mapping parameter with scaled_float or unsigned_long fields #78100
Description
Elasticsearch version (bin/elasticsearch --version):
Latest elasticsearch-8.0.0-SNAPSHOT-darwin-x86_64.tar.gz
Version: 8.0.0-SNAPSHOT, Build: default/tar/a3213137789b03e114a0bfa97db953e2ecf82671/2021-09-21T13:21:46.873945Z", JVM: 16.0.1
Plugins installed: []
JVM version (java -version):
openjdk version "16.0.1" 2021-04-20
OpenJDK Runtime Environment AdoptOpenJDK-16.0.1+9 (build 16.0.1+9)
OpenJDK 64-Bit Server VM AdoptOpenJDK-16.0.1+9 (build 16.0.1+9, mixed mode, sharing)
OS version (uname -a if on a Unix-like system):
Darwin Kernel Version 20.6.0: Wed Jun 23 00:26:31 PDT 2021; root:xnu-7195.141.2~5/RELEASE_X86_64 x86_64
Description of the problem including expected versus actual behavior:
#76766 adds the time_series_metric mapping parameter to numeric fields. However, you can't use the parameter in scaled_float or unsigned_long fields.
Steps to reproduce:
- Attempt to create an index containing a
scaled_floatfield with thetime_series_metricparameter.
# Unscaled float as counter metric
PUT my-scaled-float-counter-index
{
"mappings": {
"properties": {
"my-scaled-float-field": {
"type": "scaled_float",
"scaling_factor": 2.3,
"time_series_metric": "counter"
}
}
}
}
# Unscaled float as gauge metric
PUT my-scaled-float-gauge-index
{
"mappings": {
"properties": {
"my-scaled-float-field": {
"type": "scaled_float",
"scaling_factor": 2.3,
"time_series_metric": "gauge"
}
}
}
}
The request returns the following error:
{
"error" : {
"root_cause" : [
{
"type" : "mapper_parsing_exception",
"reason" : "unknown parameter [time_series_metric] on mapper [my-scaled-float-field] of type [scaled_float]"
}
],
"type" : "mapper_parsing_exception",
"reason" : "Failed to parse mapping: unknown parameter [time_series_metric] on mapper [my-scaled-float-field] of type [scaled_float]",
"caused_by" : {
"type" : "mapper_parsing_exception",
"reason" : "unknown parameter [time_series_metric] on mapper [my-scaled-float-field] of type [scaled_float]"
}
},
"status" : 400
}
- Attempt to create an index containing an
unsigned_longfield with thetime_series_metricparameter.
# Unsigned long as counter
PUT my-unsigned-long-counter-index
{
"mappings": {
"properties": {
"my-unsigned-long-field": {
"type": "unsigned_long",
"time_series_metric": "counter"
}
}
}
}
# Unsigned long as gauge
PUT my-unsigned-long-gauge-index
{
"mappings": {
"properties": {
"my-unsigned-long-field": {
"type": "unsigned_long",
"time_series_metric": "gauge"
}
}
}
}
The request returns the following error:
{
"error" : {
"root_cause" : [
{
"type" : "mapper_parsing_exception",
"reason" : "unknown parameter [time_series_metric] on mapper [my-unsigned-long-field] of type [unsigned_long]"
}
],
"type" : "mapper_parsing_exception",
"reason" : "Failed to parse mapping: unknown parameter [time_series_metric] on mapper [my-unsigned-long-field] of type [unsigned_long]",
"caused_by" : {
"type" : "mapper_parsing_exception",
"reason" : "unknown parameter [time_series_metric] on mapper [my-unsigned-long-field] of type [unsigned_long]"
}
},
"status" : 400
}