Skip to content

Can't use time_series_metric mapping parameter with scaled_float or unsigned_long fields #78100

@jrodewig

Description

@jrodewig

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:

  1. Attempt to create an index containing a scaled_float field with the time_series_metric parameter.
# 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
}
  1. Attempt to create an index containing an unsigned_long field with the time_series_metric parameter.
# 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
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    :Search Foundations/MappingIndex mappings, including merging and defining field types:StorageEngine/RollupTurn fine-grained time-based data into coarser-grained data:StorageEngine/TSDBYou know, for Metrics>bugTeam:AnalyticsMeta label for analytical engine team (ESQL/Aggs/Geo)Team:Search FoundationsMeta label for the Search Foundations team in Elasticsearch

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions