---
setup:
- skip:
    features:
    - "headers"
    - "allowed_warnings_regex"
---
Source filtering:
- do:
    index:
      refresh: true
      index: "test_index"
      id: "test_id_1"
      body:
        foo: "bar"
        bar: "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:
    index:
      refresh: true
      index: "test_index"
      id: "test_id_2"
      body:
        foo: "qux"
        bar: "pux"
    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:
      refresh: true
      index: "test_index"
      id: "test_id_3"
      body:
        foo: "corge"
        bar: "forge"
    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:
    bulk:
      refresh: true
      body: "{ \"update\": { \"_index\": \"test_index\", \"_id\": \"test_id_1\", \"\
        _source\": true } }\n{ \"doc\": { \"foo\": \"baz\" } }\n{ \"update\": { \"\
        _index\": \"test_index\", \"_id\": \"test_id_2\" } }\n{ \"_source\": true,\
        \ \"doc\": { \"foo\": \"quux\" } }\n"
    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:
    items.0.update.get._source.foo: "baz"
- match:
    items.1.update.get._source.foo: "quux"
- do:
    bulk:
      index: "test_index"
      _source: true
      body: "{ \"update\": { \"_id\": \"test_id_3\" } }\n{ \"doc\": { \"foo\": \"\
        garply\" } }\n"
    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:
    items.0.update.get._source.foo: "garply"
- do:
    bulk:
      refresh: true
      body: "{ \"update\": { \"_index\": \"test_index\", \"_id\": \"test_id_1\", \"\
        _source\": {\"includes\": \"bar\"} } }\n{ \"doc\": { \"foo\": \"baz\" } }\n\
        { \"update\": { \"_index\": \"test_index\", \"_id\": \"test_id_2\" } }\n{\
        \ \"_source\": {\"includes\": \"foo\"}, \"doc\": { \"foo\": \"quux\" } }\n"
    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:
    items.0.update.get._source.bar: "foo"
- is_false: "items.0.update.get._source.foo"
- match:
    items.1.update.get._source.foo: "quux"
- is_false: "items.1.update.get._source.bar"
- do:
    bulk:
      index: "test_index"
      _source_includes: "foo"
      body: "{ \"update\": { \"_id\": \"test_id_3\" } }\n{ \"doc\": { \"foo\": \"\
        garply\" } }\n"
    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:
    items.0.update.get._source.foo: "garply"
- is_false: "items.0.update.get._source.bar"
