---
setup:
- skip:
    features:
    - "headers"
    - "allowed_warnings_regex"
- do:
    index:
      index: "test_1"
      id: "1"
      body:
        include:
          field1: "v1"
          field2: "v2"
        count: 1
    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:
      index: "test_1"
      id: "2"
      body:
        include:
          field1: "v1"
          field2: "v2"
        count: 1
    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"
---
Source filtering -  true/false:
- do:
    mget:
      body:
        docs:
        - _index: "test_1"
          _id: "1"
          _source: false
        - _index: "test_1"
          _id: "2"
          _source: true
    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:
    docs.0._id: "1"
- is_false: "docs.0._source"
- match:
    docs.1._id: "2"
- is_true: "docs.1._source"
---
Source filtering -  include field:
- do:
    mget:
      body:
        docs:
        - _index: "test_1"
          _id: "1"
          _source: "include.field1"
        - _index: "test_1"
          _id: "2"
          _source:
          - "include.field1"
    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:
    docs.0._source:
      include:
        field1: "v1"
- match:
    docs.1._source:
      include:
        field1: "v1"
---
Source filtering -  include nested field:
- do:
    mget:
      body:
        docs:
        - _index: "test_1"
          _id: "1"
          _source:
            include: "include.field1"
        - _index: "test_1"
          _id: "2"
          _source:
            include:
            - "include.field1"
    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:
    docs.0._source:
      include:
        field1: "v1"
- match:
    docs.1._source:
      include:
        field1: "v1"
---
Source filtering -  exclude field:
- do:
    mget:
      body:
        docs:
        - _index: "test_1"
          _id: "1"
          _source:
            include:
            - "include"
            exclude:
            - "*.field2"
    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:
    docs.0._source:
      include:
        field1: "v1"
---
Source filtering -  ids and true/false:
- do:
    mget:
      _source: false
      index: "test_1"
      body:
        ids:
        - 1
        - 2
    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"
- is_false: "docs.0._source"
- is_false: "docs.1._source"
- do:
    mget:
      _source: true
      index: "test_1"
      body:
        ids:
        - 1
        - 2
    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"
- is_true: "docs.0._source"
- is_true: "docs.1._source"
---
Source filtering -  ids and include field:
- do:
    mget:
      _source: "include.field1"
      index: "test_1"
      body:
        ids:
        - 1
        - 2
    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:
    docs.0._source:
      include:
        field1: "v1"
- match:
    docs.1._source:
      include:
        field1: "v1"
---
Source filtering -  ids and include nested field:
- do:
    mget:
      _source_includes: "include.field1,count"
      index: "test_1"
      body:
        ids:
        - 1
        - 2
    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:
    docs.0._source:
      include:
        field1: "v1"
      count: 1
- match:
    docs.1._source:
      include:
        field1: "v1"
      count: 1
---
Source filtering -  ids and exclude field:
- do:
    mget:
      _source_includes: "include"
      _source_excludes: "*.field2"
      index: "test_1"
      body:
        ids:
        - 1
        - 2
    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:
    docs.0._source:
      include:
        field1: "v1"
- match:
    docs.1._source:
      include:
        field1: "v1"
