version: ${xpack.oteldata.template.version}
_meta:
  description: Default mappings for the OpenTelemetry metrics index template installed by x-pack
  managed: true
template:
  settings:
    index.mapping.ignore_malformed: true
    index.mapping.total_fields.limit: 10000
  mappings:
    properties:
      start_timestamp:
        type: date_nanos
      metrics:
        type: passthrough
        dynamic: true
        priority: 10
      # workaround for https://github.com/elastic/elasticsearch/issues/99123
      _metric_names_hash:
        type: keyword
        time_series_dimension: true
      unit:
        type: keyword
        time_series_dimension: true
        ignore_above: 1024
    dynamic_templates:
      - histogram:
          mapping:
            type: histogram
      - counter_long:
          mapping:
            type: long
            time_series_metric: counter
      - gauge_long:
          mapping:
            type: long
            time_series_metric: gauge
      - counter_double:
          mapping:
            type: double
            time_series_metric: counter
      - gauge_double:
          mapping:
            type: double
            time_series_metric: gauge
      - summary:
          mapping:
            type: aggregate_metric_double
            metrics: [sum, value_count]
            default_metric: value_count
      - summary_minmax:
          mapping:
            type: aggregate_metric_double
            metrics: [sum, value_count, min, max]
            default_metric: value_count
