summaryrefslogtreecommitdiff
path: root/rest-api-spec/test/mget/20_fields.yaml
blob: 347fc25f67e8231962d8e5aaf637dea0388014fe (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
---
"Fields":

  - do:
      index:
          index:  test_1
          type:   test
          id:     1
          body:   { foo: bar }

  - do:
      cluster.health:
          wait_for_status: yellow

  - do:
      mget:
        index: test_1
        type:  test
        body:
          docs:
            - { _id: 1                         }
            - { _id: 1, fields: foo            }
            - { _id: 1, fields: [foo]          }
            - { _id: 1, fields: [foo, _source] }

  - is_false: docs.0.fields
  - match:  { docs.0._source: { foo: bar }}

  - match:  { docs.1.fields.foo: [bar] }
  - is_false: docs.1._source

  - match:  { docs.2.fields.foo: [bar] }
  - is_false: docs.2._source

  - match:  { docs.3.fields.foo: [bar] }
  - match:  { docs.3._source: { foo: bar }}

  - do:
      mget:
        index: test_1
        type:  test
        fields: foo
        body:
          docs:
            - { _id: 1                         }
            - { _id: 1, fields: foo            }
            - { _id: 1, fields: [foo]          }
            - { _id: 1, fields: [foo, _source] }

  - match:  { docs.0.fields.foo: [bar] }
  - is_false: docs.0._source

  - match:  { docs.1.fields.foo: [bar] }
  - is_false: docs.1._source

  - match:  { docs.2.fields.foo: [bar] }
  - is_false: docs.2._source

  - match:  { docs.3.fields.foo: [bar] }
  - match:  { docs.3._source: { foo: bar }}

  - do:
      mget:
        index:  test_1
        type:   test
        fields: [foo]
        body:
          docs:
            - { _id: 1                         }
            - { _id: 1, fields: foo            }
            - { _id: 1, fields: [foo]          }
            - { _id: 1, fields: [foo, _source] }

  - match:  { docs.0.fields.foo: [bar] }
  - is_false: docs.0._source

  - match:  { docs.1.fields.foo: [bar] }
  - is_false: docs.1._source

  - match:  { docs.2.fields.foo: [bar] }
  - is_false: docs.2._source

  - match:  { docs.3.fields.foo: [bar] }
  - match:  { docs.3._source: { foo: bar }}

  - do:
      mget:
        index:  test_1
        type:   test
        fields: [foo, _source]
        body:
          docs:
            - { _id: 1                         }
            - { _id: 1, fields: foo            }
            - { _id: 1, fields: [foo]          }
            - { _id: 1, fields: [foo, _source] }

  - match:  { docs.0.fields.foo: [bar] }
  - match:  { docs.0._source: { foo: bar }}

  - match:  { docs.1.fields.foo: [bar] }
  - is_false: docs.1._source

  - match:  { docs.2.fields.foo: [bar] }
  - is_false: docs.2._source

  - match:  { docs.3.fields.foo: [bar] }
  - match:  { docs.3._source: { foo: bar }}