---
setup:
- skip:
    features:
    - "headers"
    - "allowed_warnings_regex"
- do:
    indices.create:
      index: "test1"
      body:
        settings:
          index.number_of_shards: 1
          index.number_of_replicas: 0
        mappings:
          properties:
            bar:
              type: "keyword"
            baz:
              type: "keyword"
    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:
    index:
      index: "test1"
      id: "1"
      body:
        bar: "bar"
        baz: "baz"
    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:
    index:
      index: "test1"
      id: "2"
      body:
        bar: "foo"
        baz: "foo"
    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.refresh: {}
    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:
    index:
      index: "test1"
      id: "2"
      body:
        bar: "foo"
        baz: "foo"
    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.refresh: {}
    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:
    search:
      rest_total_hits_as_int: true
      body:
        aggs:
          my_agg_1:
            terms:
              field: "bar"
          my_agg_2:
            terms:
              field: "baz"
    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"
---
global_ordinals - blank:
- requires:
    cluster_features:
    - "gte_v8.8.0"
    reason: "global_ordinals introduced in 8.8.0"
- do:
    indices.stats: {}
    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:
    _shards.failed: 0
- gt:
    _all.total.fielddata.memory_size_in_bytes: 0
- is_false: "_all.total.fielddata.fields"
- gte:
    _all.total.fielddata.global_ordinals.build_time_in_millis: 0
- is_false: "_all.total.fielddata.global_ordinals.fields"
---
global_ordinals - fields:
- requires:
    cluster_features:
    - "gte_v8.8.0"
    reason: "global_ordinals introduced in 8.8.0"
- do:
    indices.stats:
      fields: "bar"
    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:
    _shards.failed: 0
- gt:
    _all.total.fielddata.memory_size_in_bytes: 0
- gt:
    _all.total.fielddata.fields.bar.memory_size_in_bytes: 0
- is_false: "_all.total.fielddata.fields.baz"
- gte:
    _all.total.fielddata.global_ordinals.build_time_in_millis: 0
- gte:
    _all.total.fielddata.global_ordinals.fields.bar.build_time_in_millis: 0
- gte:
    _all.total.fielddata.global_ordinals.fields.bar.shard_max_value_count: 1
- is_false: "_all.total.fielddata.global_ordinals.fields.baz"
- do:
    indices.stats:
      fields: "bar,baz"
    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:
    _shards.failed: 0
- gt:
    _all.total.fielddata.memory_size_in_bytes: 0
- gt:
    _all.total.fielddata.fields.bar.memory_size_in_bytes: 0
- gt:
    _all.total.fielddata.fields.baz.memory_size_in_bytes: 0
- gte:
    _all.total.fielddata.global_ordinals.build_time_in_millis: 0
- gte:
    _all.total.fielddata.global_ordinals.fields.bar.build_time_in_millis: 0
- gte:
    _all.total.fielddata.global_ordinals.fields.bar.shard_max_value_count: 1
- gte:
    _all.total.fielddata.global_ordinals.fields.baz.build_time_in_millis: 0
- gte:
    _all.total.fielddata.global_ordinals.fields.baz.shard_max_value_count: 1
- do:
    indices.stats:
      fields: "*"
    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:
    _shards.failed: 0
- gt:
    _all.total.fielddata.memory_size_in_bytes: 0
- gt:
    _all.total.fielddata.fields.bar.memory_size_in_bytes: 0
- gt:
    _all.total.fielddata.fields.baz.memory_size_in_bytes: 0
- gte:
    _all.total.fielddata.global_ordinals.build_time_in_millis: 0
- gte:
    _all.total.fielddata.global_ordinals.fields.bar.build_time_in_millis: 0
- gte:
    _all.total.fielddata.global_ordinals.fields.bar.shard_max_value_count: 1
- gte:
    _all.total.fielddata.global_ordinals.fields.baz.build_time_in_millis: 0
- gte:
    _all.total.fielddata.global_ordinals.fields.baz.shard_max_value_count: 1
- do:
    indices.stats:
      fields: "bar*"
    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:
    _shards.failed: 0
- gt:
    _all.total.fielddata.memory_size_in_bytes: 0
- gt:
    _all.total.fielddata.fields.bar.memory_size_in_bytes: 0
- is_false: "_all.total.fielddata.fields.baz"
- gte:
    _all.total.fielddata.global_ordinals.fields.bar.build_time_in_millis: 0
- gte:
    _all.total.fielddata.global_ordinals.fields.bar.shard_max_value_count: 1
- is_false: "_all.total.fielddata.global_ordinals.fields.baz"
---
global_ordinals - fields and metrics:
- requires:
    cluster_features:
    - "gte_v8.8.0"
    reason: "global_ordinals introduced in 8.8.0"
- do:
    indices.stats:
      fields: "bar*"
      metric: "_all"
    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:
    _shards.failed: 0
- gt:
    _all.total.fielddata.memory_size_in_bytes: 0
- gt:
    _all.total.fielddata.fields.bar.memory_size_in_bytes: 0
- is_false: "_all.total.fielddata.fields.baz"
- gte:
    _all.total.fielddata.global_ordinals.fields.bar.build_time_in_millis: 0
- gte:
    _all.total.fielddata.global_ordinals.fields.bar.shard_max_value_count: 1
- is_false: "_all.total.fielddata.global_ordinals.fields.baz"
- do:
    indices.stats:
      fields: "bar*"
      metric: "fielddata"
    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:
    _shards.failed: 0
- gt:
    _all.total.fielddata.memory_size_in_bytes: 0
- gt:
    _all.total.fielddata.fields.bar.memory_size_in_bytes: 0
- is_false: "_all.total.fielddata.fields.baz"
- gte:
    _all.total.fielddata.global_ordinals.fields.bar.build_time_in_millis: 0
- gte:
    _all.total.fielddata.global_ordinals.fields.bar.shard_max_value_count: 1
- is_false: "_all.total.fielddata.global_ordinals.fields.baz"
- do:
    indices.stats:
      fields: "bar*"
      metric:
      - "fielddata"
      - "search"
    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:
    _shards.failed: 0
- gt:
    _all.total.fielddata.memory_size_in_bytes: 0
- gt:
    _all.total.fielddata.fields.bar.memory_size_in_bytes: 0
- is_false: "_all.total.fielddata.fields.baz"
- gte:
    _all.total.fielddata.global_ordinals.fields.bar.build_time_in_millis: 0
- gte:
    _all.total.fielddata.global_ordinals.fields.bar.shard_max_value_count: 1
- is_false: "_all.total.fielddata.global_ordinals.fields.baz"
---
global_ordinals - fielddata_fields:
- requires:
    cluster_features:
    - "gte_v8.8.0"
    reason: "global_ordinals introduced in 8.8.0"
- do:
    indices.stats:
      fielddata_fields: "bar"
    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:
    _shards.failed: 0
- gt:
    _all.total.fielddata.fields.bar.memory_size_in_bytes: 0
- is_false: "_all.total.fielddata.fields.baz"
- gte:
    _all.total.fielddata.global_ordinals.fields.bar.build_time_in_millis: 0
- gte:
    _all.total.fielddata.global_ordinals.fields.bar.shard_max_value_count: 1
- is_false: "_all.total.fielddata.global_ordinals.fields.baz"
- do:
    indices.stats:
      fielddata_fields: "bar,baz"
    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:
    _shards.failed: 0
- gt:
    _all.total.fielddata.fields.bar.memory_size_in_bytes: 0
- gt:
    _all.total.fielddata.fields.baz.memory_size_in_bytes: 0
- gte:
    _all.total.fielddata.global_ordinals.build_time_in_millis: 0
- gte:
    _all.total.fielddata.global_ordinals.fields.bar.build_time_in_millis: 0
- gte:
    _all.total.fielddata.global_ordinals.fields.bar.shard_max_value_count: 1
- gte:
    _all.total.fielddata.global_ordinals.fields.baz.build_time_in_millis: 0
- gte:
    _all.total.fielddata.global_ordinals.fields.baz.shard_max_value_count: 1
- do:
    indices.stats:
      fielddata_fields: "*"
    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:
    _shards.failed: 0
- gt:
    _all.total.fielddata.fields.bar.memory_size_in_bytes: 0
- gt:
    _all.total.fielddata.fields.baz.memory_size_in_bytes: 0
- gte:
    _all.total.fielddata.global_ordinals.build_time_in_millis: 0
- gte:
    _all.total.fielddata.global_ordinals.fields.bar.build_time_in_millis: 0
- gte:
    _all.total.fielddata.global_ordinals.fields.bar.shard_max_value_count: 1
- gte:
    _all.total.fielddata.global_ordinals.fields.baz.build_time_in_millis: 0
- gte:
    _all.total.fielddata.global_ordinals.fields.baz.shard_max_value_count: 1
- do:
    indices.stats:
      fielddata_fields: "*r"
    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:
    _shards.failed: 0
- gt:
    _all.total.fielddata.fields.bar.memory_size_in_bytes: 0
- is_false: "_all.total.fielddata.fields.baz"
- gte:
    _all.total.fielddata.global_ordinals.fields.bar.build_time_in_millis: 0
- gte:
    _all.total.fielddata.global_ordinals.fields.bar.shard_max_value_count: 1
- is_false: "_all.total.fielddata.global_ordinals.fields.baz"
- do:
    indices.stats:
      fielddata_fields: "*r"
      metric: "_all"
    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:
    _shards.failed: 0
- gt:
    _all.total.fielddata.fields.bar.memory_size_in_bytes: 0
- is_false: "_all.total.fielddata.fields.baz"
- gte:
    _all.total.fielddata.global_ordinals.fields.bar.build_time_in_millis: 0
- gte:
    _all.total.fielddata.global_ordinals.fields.bar.shard_max_value_count: 1
- is_false: "_all.total.fielddata.global_ordinals.fields.baz"
- do:
    indices.stats:
      fielddata_fields: "*r"
      metric: "fielddata"
    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:
    _shards.failed: 0
- gt:
    _all.total.fielddata.fields.bar.memory_size_in_bytes: 0
- is_false: "_all.total.fielddata.fields.baz"
- gte:
    _all.total.fielddata.global_ordinals.fields.bar.build_time_in_millis: 0
- gte:
    _all.total.fielddata.global_ordinals.fields.bar.shard_max_value_count: 1
- is_false: "_all.total.fielddata.global_ordinals.fields.baz"
- do:
    indices.stats:
      fielddata_fields: "*r"
      metric:
      - "fielddata"
      - "search"
    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:
    _shards.failed: 0
- gt:
    _all.total.fielddata.fields.bar.memory_size_in_bytes: 0
- is_false: "_all.total.fielddata.fields.baz"
- gte:
    _all.total.fielddata.global_ordinals.fields.bar.build_time_in_millis: 0
- gte:
    _all.total.fielddata.global_ordinals.fields.bar.shard_max_value_count: 1
- is_false: "_all.total.fielddata.global_ordinals.fields.baz"
