---
setup:
- requires:
    cluster_features: "gte_v8.1.0"
    reason: "Introduced in 8.1.0"
- skip:
    known_issues:
    - cluster_feature: "gte_v8.7.0"
      fixed_by: "gte_v8.10.0"
    reason: "Synthetic source shows up in the mapping in 8.10 and on, may trigger\
      \ assert failures in mixed cluster tests"
    features:
    - "headers"
    - "allowed_warnings_regex"
    - "allowed_warnings_regex"
- do:
    indices.create:
      index: "tsdb_index1"
      body:
        settings:
          index:
            mode: "time_series"
            routing_path:
            - "metricset"
            - "k8s.pod.uid"
            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
            non_tsdb_field:
              type: "keyword"
            k8s:
              properties:
                pod:
                  properties:
                    availability_zone:
                      type: "short"
                      time_series_dimension: true
                    uid:
                      type: "keyword"
                      time_series_dimension: true
                    name:
                      type: "keyword"
                    ip:
                      type: "ip"
                      time_series_dimension: true
                    network:
                      properties:
                        tx:
                          type: "long"
                          time_series_metric: "counter"
                        rx:
                          type: "integer"
                          time_series_metric: "gauge"
                        packets_dropped:
                          type: "long"
                          time_series_metric: "gauge"
                        latency:
                          type: "double"
                          time_series_metric: "gauge"
    headers:
      Content-Type: "application/vnd.elasticsearch+json;compatible-with=8"
      Accept: "application/vnd.elasticsearch+json;compatible-with=8"
    allowed_warnings_regex:
    - "Use of the \\[max_size\\] rollover condition has been deprecated in favour\
      \ of the \\[max_primary_shard_size\\] condition and will be removed in a later\
      \ version"
    - "Parameter \\[confidence_interval\\] in \\[index_options\\] for dense_vector\
      \ field \\[[^\\]]+\\] is deprecated and will be removed in a future version"
- do:
    indices.create:
      index: "tsdb_index2"
      body:
        settings:
          index:
            mode: "time_series"
            routing_path:
            - "k8s.pod.uid"
            time_series:
              start_time: "2021-04-28T00:00:00Z"
              end_time: "2021-04-29T00:00:00Z"
        mappings:
          properties:
            '@timestamp':
              type: "date"
            metricset:
              type: "keyword"
            non_tsdb_field:
              type: "keyword"
            k8s:
              properties:
                pod:
                  properties:
                    availability_zone:
                      type: "short"
                      time_series_dimension: true
                    uid:
                      type: "keyword"
                      time_series_dimension: true
                    name:
                      type: "keyword"
                    ip:
                      type: "ip"
                      time_series_dimension: true
                    network:
                      properties:
                        tx:
                          type: "long"
                          time_series_metric: "gauge"
                        rx:
                          type: "integer"
                        packets_dropped:
                          type: "long"
                          time_series_metric: "gauge"
                        latency:
                          type: "double"
                          time_series_metric: "gauge"
    headers:
      Content-Type: "application/vnd.elasticsearch+json;compatible-with=8"
      Accept: "application/vnd.elasticsearch+json;compatible-with=8"
    allowed_warnings_regex:
    - "Use of the \\[max_size\\] rollover condition has been deprecated in favour\
      \ of the \\[max_primary_shard_size\\] condition and will be removed in a later\
      \ version"
    - "Parameter \\[confidence_interval\\] in \\[index_options\\] for dense_vector\
      \ field \\[[^\\]]+\\] is deprecated and will be removed in a future version"
---
Get simple time series field caps:
- requires:
    cluster_features:
    - "gte_v8.1.0"
    reason: "introduced in 8.1.0"
- do:
    field_caps:
      index: "tsdb_index1"
      fields:
      - "metricset"
      - "non_tsdb_field"
      - "k8s.pod.*"
    headers:
      Content-Type: "application/vnd.elasticsearch+json;compatible-with=8"
      Accept: "application/vnd.elasticsearch+json;compatible-with=8"
    allowed_warnings_regex:
    - "Use of the \\[max_size\\] rollover condition has been deprecated in favour\
      \ of the \\[max_primary_shard_size\\] condition and will be removed in a later\
      \ version"
    - "Parameter \\[confidence_interval\\] in \\[index_options\\] for dense_vector\
      \ field \\[[^\\]]+\\] is deprecated and will be removed in a future version"
- match:
    fields.metricset.keyword.searchable: true
- match:
    fields.metricset.keyword.aggregatable: true
- match:
    fields.metricset.keyword.time_series_dimension: true
- is_false: "fields.metricset.keyword.time_series_metric"
- is_false: "fields.metricset.keyword.indices"
- is_false: "fields.metricset.keyword.non_searchable_indices"
- is_false: "fields.metricset.keyword.non_aggregatable_indices"
- is_false: "fields.metricset.keyword.non_dimension_indices"
- match:
    fields.non_tsdb_field.keyword.searchable: true
- match:
    fields.non_tsdb_field.keyword.aggregatable: true
- is_false: "fields.non_tsdb_field.keyword.time_series_dimension"
- is_false: "fields.non_tsdb_field.keyword.time_series_metric"
- is_false: "fields.non_tsdb_field.keyword.indices"
- is_false: "fields.non_tsdb_field.keyword.non_searchable_indices"
- is_false: "fields.non_tsdb_field.keyword.non_aggregatable_indices"
- is_false: "fields.non_tsdb_field.keyword.non_dimension_indices"
- match:
    fields.k8s\.pod\.availability_zone.short.time_series_dimension: true
- is_false: "fields.k8s\\.pod\\.availability_zone.short.time_series_metric"
- is_false: "fields.k8s\\.pod\\.availability_zone.short.non_dimension_indices"
- match:
    fields.k8s\.pod\.uid.keyword.time_series_dimension: true
- is_false: "fields.k8s\\.pod\\.uid.keyword.time_series_metric"
- is_false: "fields.k8s\\.pod\\.uid.keyword.non_dimension_indices"
- is_false: "fields.k8s\\.pod\\.name.keyword.time_series_dimension"
- is_false: "fields.k8s\\.pod\\.name.keyword.time_series_metric"
- is_false: "fields.k8s\\.pod\\.name.keyword.non_dimension_indices"
- match:
    fields.k8s\.pod\.ip.ip.time_series_dimension: true
- is_false: "fields.k8s\\.pod\\.ip.ip.time_series_metric"
- is_false: "fields.k8s\\.pod\\.ip.ip.non_dimension_indices"
- is_false: "fields.k8s\\.pod\\.network\\.tx.long.time_series_dimension"
- match:
    fields.k8s\.pod\.network\.tx.long.time_series_metric: "counter"
- is_false: "fields.k8s\\.pod\\.network\\.tx.long.non_dimension_indices"
- is_false: "fields.k8s\\.pod\\.network\\.rx.integer.time_series_dimension"
- match:
    fields.k8s\.pod\.network\.rx.integer.time_series_metric: "gauge"
- is_false: "fields.k8s\\.pod\\.network\\.rx.integer.non_dimension_indices"
- is_false: "fields.k8s\\.pod\\.network\\.packets_dropped.long.time_series_dimension"
- match:
    fields.k8s\.pod\.network\.packets_dropped.long.time_series_metric: "gauge"
- is_false: "fields.k8s\\.pod\\.network\\.packets_dropped.long.non_dimension_indices"
- is_false: "fields.k8s\\.pod\\.network\\.latency.double.time_series_dimension"
- match:
    fields.k8s\.pod\.network\.latency.double.time_series_metric: "gauge"
- is_false: "fields.k8s\\.pod\\.network\\.latency.double.non_dimension_indices"
---
Get time series field caps with conflicts:
- requires:
    cluster_features:
    - "gte_v8.1.0"
    reason: "introduced in 8.1.0"
- do:
    field_caps:
      index: "tsdb_index1,tsdb_index2"
      fields:
      - "metricset"
      - "non_tsdb_field"
      - "k8s.pod.*"
    headers:
      Content-Type: "application/vnd.elasticsearch+json;compatible-with=8"
      Accept: "application/vnd.elasticsearch+json;compatible-with=8"
    allowed_warnings_regex:
    - "Use of the \\[max_size\\] rollover condition has been deprecated in favour\
      \ of the \\[max_primary_shard_size\\] condition and will be removed in a later\
      \ version"
    - "Parameter \\[confidence_interval\\] in \\[index_options\\] for dense_vector\
      \ field \\[[^\\]]+\\] is deprecated and will be removed in a future version"
- length:
    indices: 2
- match:
    fields.metricset.keyword.searchable: true
- match:
    fields.metricset.keyword.aggregatable: true
- is_false: "fields.metricset.keyword.time_series_dimension"
- is_false: "fields.metricset.keyword.time_series_metric"
- is_false: "fields.metricset.keyword.indices"
- is_false: "fields.metricset.keyword.non_searchable_indices"
- is_false: "fields.metricset.keyword.non_aggregatable_indices"
- match:
    fields.metricset.keyword.non_dimension_indices:
    - "tsdb_index2"
- is_false: "fields.metricset.keyword.metric_conflicts_indices"
- match:
    fields.non_tsdb_field.keyword.searchable: true
- match:
    fields.non_tsdb_field.keyword.aggregatable: true
- is_false: "fields.non_tsdb_field.keyword.time_series_dimension"
- is_false: "fields.non_tsdb_field.keyword.time_series_metric"
- is_false: "fields.non_tsdb_field.keyword.indices"
- is_false: "fields.non_tsdb_field.keyword.non_searchable_indices"
- is_false: "fields.non_tsdb_field.keyword.non_aggregatable_indices"
- is_false: "fields.non_tsdb_field.keyword.non_dimension_indices"
- is_false: "fields.non_tsdb_field.keyword.metric_conflicts_indices"
- match:
    fields.k8s\.pod\.availability_zone.short.time_series_dimension: true
- is_false: "fields.k8s\\.pod\\.availability_zone.short.time_series_metric"
- is_false: "fields.k8s\\.pod\\.availability_zone.short.non_dimension_indices"
- is_false: "fields.k8s\\.pod\\.availability_zone.short.metric_conflicts_indices"
- match:
    fields.k8s\.pod\.uid.keyword.time_series_dimension: true
- is_false: "fields.k8s\\.pod\\.uid.keyword.time_series_metric"
- is_false: "fields.k8s\\.pod\\.uid.keyword.non_dimension_indices"
- is_false: "fields.k8s\\.pod\\.uid.keyword.metric_conflicts_indices"
- is_false: "fields.k8s\\.pod\\.name.keyword.time_series_dimension"
- is_false: "fields.k8s\\.pod\\.name.keyword.time_series_metric"
- is_false: "fields.k8s\\.pod\\.name.keyword.non_dimension_indices"
- is_false: "fields.k8s\\.pod\\.name.keyword.metric_conflicts_indices"
- match:
    fields.k8s\.pod\.ip.ip.time_series_dimension: true
- is_false: "fields.k8s\\.pod\\.ip.ip.time_series_metric"
- is_false: "fields.k8s\\.pod\\.ip.ip.non_dimension_indices"
- is_false: "fields.k8s\\.pod\\.ip.ip.metric_conflicts_indices"
- is_false: "fields.k8s\\.pod\\.network\\.tx.long.time_series_dimension"
- is_false: "fields.k8s\\.pod\\.network\\.tx.long.time_series_metric"
- is_false: "fields.k8s\\.pod\\.network\\.tx.long.non_dimension_indices"
- match:
    fields.k8s\.pod\.network\.tx.long.metric_conflicts_indices:
    - "tsdb_index1"
    - "tsdb_index2"
- is_false: "fields.k8s\\.pod\\.network\\.rx.integer.time_series_dimension"
- is_false: "fields.k8s\\.pod\\.network\\.rx.integer.time_series_metric"
- is_false: "fields.k8s\\.pod\\.network\\.rx.integer.non_dimension_indices"
- match:
    fields.k8s\.pod\.network\.rx.integer.metric_conflicts_indices:
    - "tsdb_index1"
    - "tsdb_index2"
- is_false: "fields.k8s\\.pod\\.network\\.packets_dropped.long.time_series_dimension"
- match:
    fields.k8s\.pod\.network\.packets_dropped.long.time_series_metric: "gauge"
- is_false: "fields.k8s\\.pod\\.network\\.packets_dropped.long.non_dimension_indices"
- is_false: "fields.k8s\\.pod\\.network\\.packets_dropped.long.metric_conflicts_indices"
- is_false: "fields.k8s\\.pod\\.network\\.latency.double.time_series_dimension"
- match:
    fields.k8s\.pod\.network\.latency.double.time_series_metric: "gauge"
- is_false: "fields.k8s\\.pod\\.network\\.latency.double.non_dimension_indices"
- is_false: "fields.k8s\\.pod\\.network\\.latency.double.metric_conflicts_indices"
