---
setup:
- skip:
    features:
    - "headers"
    - "allowed_warnings_regex"
---
ignore_above index setting negative value:
- do:
    catch: "bad_request"
    indices.create:
      index: "test"
      body:
        settings:
          index:
            mapping:
              ignore_above: -1
        mappings:
          properties:
            keyword:
              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"
---
keyword ignore_above mapping setting negative value:
- requires:
    cluster_features:
    - "mapper.ignore_above_index_level_setting"
    reason: "introduce ignore_above index level setting"
- do:
    catch: "bad_request"
    indices.create:
      index: "test"
      body:
        mappings:
          properties:
            keyword:
              ignore_above: -2
              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"
---
flattened ignore_above mapping setting negative value:
- requires:
    cluster_features:
    - "mapper.ignore_above_index_level_setting"
    reason: "introduce ignore_above index level setting"
- do:
    catch: "bad_request"
    indices.create:
      index: "test"
      body:
        mappings:
          properties:
            flattened:
              ignore_above: -2
              type: "flattened"
    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"
---
wildcard ignore_above mapping setting negative value:
- requires:
    cluster_features:
    - "mapper.ignore_above_index_level_setting"
    reason: "introduce ignore_above index level setting"
- do:
    catch: "bad_request"
    indices.create:
      index: "test"
      body:
        mappings:
          properties:
            wildcard:
              ignore_above: -2
              type: "wildcard"
    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"
