aggregate_double_metric with time series mappings:
  - requires:
      cluster_features: ["gte_v7.16.0"]
      reason: introduced in 7.16.0

  - do:
      indices.create:
          index: test_index
          body:
            mappings:
              properties:
                "@timestamp":
                  type: date
                metricset:
                  type: keyword
                  time_series_dimension: true
                k8s:
                  properties:
                    pod:
                      properties:
                        uid:
                          type: keyword
                          time_series_dimension: true
                        name:
                          type: keyword
                        network:
                          properties:
                            tx:
                              type: aggregate_metric_double
                              metrics: [min, max, sum, value_count]
                              default_metric: max
                              time_series_metric: gauge
                            rx:
                              type: aggregate_metric_double
                              metrics: [min, max, sum, value_count]
                              default_metric: max
                              time_series_metric: gauge

---
aggregate_double_metric with wrong time series mappings:
  - requires:
      cluster_features: ["gte_v7.16.0"]
      reason: introduced in 7.16.0

  - do:
      catch: /Unknown value \[histogram\] for field \[time_series_metric\] \- accepted values are \[gauge\]/
      indices.create:
        index: tsdb_index
        body:
          mappings:
            properties:
              "@timestamp":
                type: date
              metricset:
                type: keyword
                time_series_dimension: true
              k8s:
                properties:
                  pod:
                    properties:
                      uid:
                        type: keyword
                        time_series_dimension: true
                      name:
                        type: keyword
                      network:
                        properties:
                          tx:
                            type: aggregate_metric_double
                            metrics: [min, max, sum, value_count]
                            default_metric: max
                            time_series_metric: gauge
                          rx:
                            type: aggregate_metric_double
                            metrics: [min, max, sum, value_count]
                            default_metric: max
                            time_series_metric: histogram

---
"Field caps with tsdb":
  - requires:
      cluster_features: ["gte_v8.8.0"]
      reason: "Field caps fix in 8.9"

  - do:
      indices.create:
        index: tsdb-fieldcap
        body:
          settings:
            mode: time_series
            routing_path: [field1]
            time_series:
              start_time: "2000-01-01T00:00:00Z"
              end_time: "2099-12-31T23:59:59Z"
          mappings:
            properties:
              field1:
                type: keyword
                time_series_dimension: true
              field2:
                type: long
                time_series_metric: gauge
              field3:
                type: scaled_float
                scaling_factor: 100
                time_series_metric: gauge

  - do:
      field_caps:
        index: tsdb-fieldcap
        fields: "field*"

  - match: {indices: ["tsdb-fieldcap"]}
  - match: {fields.field1.keyword.type: keyword}
  - match: {fields.field3.scaled_float.type: scaled_float}
  - match: {fields.field3.scaled_float.searchable: true}
