---
setup:
- skip:
    features:
    - "headers"
    - "allowed_warnings_regex"
- do:
    indices.create:
      index: "test_index"
      body:
        mappings:
          properties:
            t1:
              type: "text"
            t2:
              type: "text"
            obj:
              properties:
                t1:
                  type: "text"
                i_t1:
                  type: "text"
                i_t3:
                  type: "text"
    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: "test_index_2"
      body:
        mappings:
          properties:
            t1:
              type: "text"
            t2:
              type: "text"
            obj:
              properties:
                t1:
                  type: "text"
                i_t1:
                  type: "text"
                i_t3:
                  type: "text"
    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 field mapping with * for fields:
- do:
    indices.get_field_mapping:
      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:
    test_index.mappings.t1.full_name: "t1"
- match:
    test_index.mappings.t2.full_name: "t2"
- match:
    test_index.mappings.obj\.t1.full_name: "obj.t1"
- match:
    test_index.mappings.obj\.i_t1.full_name: "obj.i_t1"
- match:
    test_index.mappings.obj\.i_t3.full_name: "obj.i_t3"
---
Get field mapping with t* for fields:
- do:
    indices.get_field_mapping:
      index: "test_index"
      fields: "t*"
    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:
    test_index.mappings.t1.full_name: "t1"
- match:
    test_index.mappings.t2.full_name: "t2"
- length:
    test_index.mappings: 2
---
Get field mapping with *t1 for fields:
- do:
    indices.get_field_mapping:
      index: "test_index"
      fields: "*t1"
    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:
    test_index.mappings.t1.full_name: "t1"
- match:
    test_index.mappings.obj\.t1.full_name: "obj.t1"
- match:
    test_index.mappings.obj\.i_t1.full_name: "obj.i_t1"
- length:
    test_index.mappings: 3
---
Get field mapping with wildcarded relative names:
- do:
    indices.get_field_mapping:
      index: "test_index"
      fields: "obj.i_*"
    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:
    test_index.mappings.obj\.i_t1.full_name: "obj.i_t1"
- match:
    test_index.mappings.obj\.i_t3.full_name: "obj.i_t3"
- length:
    test_index.mappings: 2
---
Get field mapping should work using '_all' for index:
- do:
    indices.get_field_mapping:
      index: "_all"
      fields: "t*"
    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:
    test_index.mappings.t1.full_name: "t1"
- match:
    test_index.mappings.t2.full_name: "t2"
- length:
    test_index.mappings: 2
- match:
    test_index_2.mappings.t1.full_name: "t1"
- match:
    test_index_2.mappings.t2.full_name: "t2"
- length:
    test_index_2.mappings: 2
---
Get field mapping should work using '*' for index:
- do:
    indices.get_field_mapping:
      index: "*"
      fields: "t*"
    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:
    test_index.mappings.t1.full_name: "t1"
- match:
    test_index.mappings.t2.full_name: "t2"
- length:
    test_index.mappings: 2
- match:
    test_index_2.mappings.t1.full_name: "t1"
- match:
    test_index_2.mappings.t2.full_name: "t2"
- length:
    test_index_2.mappings: 2
---
Get field mapping should work using comma_separated values for indices:
- do:
    indices.get_field_mapping:
      index: "test_index,test_index_2"
      fields: "t*"
    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:
    test_index.mappings.t1.full_name: "t1"
- match:
    test_index.mappings.t2.full_name: "t2"
- length:
    test_index.mappings: 2
- match:
    test_index_2.mappings.t1.full_name: "t1"
- match:
    test_index_2.mappings.t2.full_name: "t2"
- length:
    test_index_2.mappings: 2
