---
"Source filtering":
  - skip:
      version:  "0 - 0.90.999"
      reason:   "source filtering is not supported in pre 1.0 versions."

  - do:
      index:
        index:  test_1
        type:   test
        id:     1
        body:   { "include": { "field1": "v1", "field2": "v2" }, "count": 1 }
  - do:
      index:
        index:  test_1
        type:   test
        id:     2
        body:   { "include": { "field1": "v1", "field2": "v2" }, "count": 1 }
  - do:
      mget:
        body: >
          { docs:
              [ { _index:  "test_1", _type: "test", _id: "1", _source: false },
                { _index:  "test_1", _type: "test", _id: "2", _source: true }
              ]
          }

  - match:   { docs.0._id: 1 }
  - is_false:  docs.0._source
  - match:   { docs.1._id: 2 }
  - is_true:   docs.1._source


  - do:
      mget:
        body:
          docs:
            - { _index:  "test_1", _type: "test", _id: "1", _source: include.field1 }
            - { _index:  "test_1", _type: "test", _id: "2", _source: [ include.field1 ] }

  - match:   { docs.0._source: { include: { field1: v1 }} }
  - match:   { docs.1._source: { include: { field1: v1 }} }


  - do:
      mget:
        body:
          docs:
            - { _index:  "test_1", _type: "test", _id: "1", _source: { include: include.field1 }  }
            - { _index:  "test_1", _type: "test", _id: "2", _source: { include: [ include.field1 ] } }

  - match:   { docs.0._source: { include: { field1: v1 }} }
  - match:   { docs.1._source: { include: { field1: v1 }} }

  - do:
      mget:
        body:
          docs:
            - { _index:  "test_1", _type: "test", _id: "1", _source: { include: [ include ], exclude: [ "*.field2" ] } }

  - match:   { docs.0._source: { include: { field1: v1 }} }

  - do:
      mget:
        _source: false
        index: test_1
        body: { ids: [ 1,2 ] }
  - is_false:   docs.0._source
  - is_false:   docs.1._source

  - do:
      mget:
        _source: true
        index: test_1
        body: { ids: [ 1,2 ] }
  - is_true:   docs.0._source
  - is_true:   docs.1._source

  - do:
      mget:
        _source: include.field1
        index: test_1
        body: { ids: [ 1,2 ] }
  - match:   { docs.0._source: { include: { field1: v1 }} }
  - match:   { docs.1._source: { include: { field1: v1 }} }

  - do:
      mget:
        _source_include: "include.field1,count"
        index: test_1
        body: { ids: [ 1,2 ] }
  - match:   { docs.0._source: { include: { field1: v1 }, count: 1} }
  - match:   { docs.1._source: { include: { field1: v1 }, count: 1} }

  - do:
      mget:
        _source_include: include
        _source_exclude: "*.field2"
        index: test_1
        body: { ids: [ 1,2 ] }
  - match:   { docs.0._source: { include: { field1: v1 } } }
  - match:   { docs.1._source: { include: { field1: v1 } } }
