---
setup:
- skip:
    features:
    - "headers"
    - "allowed_warnings_regex"
- requires:
    test_runner_features: "allowed_warnings_regex"
---
Test Index and Search locale dependent mappings / dates:
- do:
    allowed_warnings_regex:
    - "Date format \\[E, d MMM yyyy HH:mm:ss Z] contains textual field specifiers\
      \ that could change in JDK 23.*"
    - "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"
    indices.create:
      index: "test_index"
      body:
        settings:
          number_of_shards: 1
        mappings:
          properties:
            date_field:
              type: "date"
              format: "E, d MMM yyyy HH:mm:ss Z"
              locale: "fr"
    headers:
      Content-Type: "application/vnd.elasticsearch+json;compatible-with=8"
      Accept: "application/vnd.elasticsearch+json;compatible-with=8"
- do:
    bulk:
      refresh: true
      body:
      - "{\"index\": {\"_index\": \"test_index\", \"_id\": \"1\"}}"
      - "{\"date_field\": \"mer., 6 déc. 2000 02:55:00 -0800\"}"
      - "{\"index\": {\"_index\": \"test_index\", \"_id\": \"2\"}}"
      - "{\"date_field\": \"jeu., 7 déc. 2000 02:55:00 -0800\"}"
    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
      index: "test_index"
      body:
        query:
          range:
            date_field:
              gte: "mar., 5 déc. 2000 02:55:00 -0800"
              lte: "jeu., 7 déc. 2000 00:00:00 -0800"
    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:
    hits.total: 1
- do:
    search:
      rest_total_hits_as_int: true
      index: "test_index"
      body:
        query:
          range:
            date_field:
              gte: "mar., 5 déc. 2000 02:55:00 -0800"
              lte: "ven., 8 déc. 2000 00:00:00 -0800"
    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:
    hits.total: 2
