---
setup:
- skip:
    features:
    - "headers"
    - "allowed_warnings_regex"
- do:
    indices.create:
      index: "null_value_configured"
      body:
        mappings:
          properties:
            point:
              type: "geo_point"
              null_value:
                lat: 28.41951122705923
                lon: -81.58118930548268
    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"
---
single null value:
- do:
    bulk:
      refresh: true
      index: "null_value_configured"
      body:
      - "{ \"index\" : {} }"
      - "{ \"point\": null }"
    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:
    errors: false
- do:
    search:
      index: "null_value_configured"
      size: 0
      body:
        aggs:
          grid:
            geohash_grid:
              field: "point"
              precision: 8
    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:
    aggregations.grid.buckets: 1
- match:
    aggregations.grid.buckets.0.key: "djjcxtd7"
- match:
    aggregations.grid.buckets.0.doc_count: 1
---
null value in array:
- requires:
    cluster_features:
    - "gte_v8.3.0"
    reason: "fixed in 8.3.0"
- do:
    bulk:
      refresh: true
      index: "null_value_configured"
      body:
      - "{ \"index\" : {} }"
      - "{ \"point\": [null, {\"lat\": -54.48979082798907, \"lon\": -37.07576688239972}]\
        \ }"
    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:
    errors: false
- do:
    search:
      index: "null_value_configured"
      size: 0
      body:
        aggs:
          grid:
            geohash_grid:
              field: "point"
              precision: 8
    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:
    aggregations.grid.buckets: 2
- match:
    aggregations.grid.buckets.0.key: "djjcxtd7"
- match:
    aggregations.grid.buckets.0.doc_count: 1
- match:
    aggregations.grid.buckets.1.key: "5nmdh26m"
- match:
    aggregations.grid.buckets.1.doc_count: 1
