summaryrefslogtreecommitdiff
path: root/rest-api-spec/test/mget/15_ids.yaml
blob: a86fc2cdc6e98e354994d53b82d3af5f8551ff8e (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
---
"IDs":
  - do:
      index:
          index:  test_1
          type:   test
          id:     1
          body:   { foo: bar }

  - do:
      index:
          index:  test_1
          type:   test_2
          id:     2
          body:   { foo: baz }

  - do:
      cluster.health:
          wait_for_status: yellow

  - do:
      mget:
        index:  test_1
        type:   test
        body:
          ids: [1, 2]

  - is_true:  docs.0.found
  - match:  { docs.0._index:     test_1      }
  - match:  { docs.0._type:      test        }
  - match:  { docs.0._id:        "1"         }
  - match:  { docs.0._version:   1           }
  - match:  { docs.0._source:    { foo: bar }}

  - is_false: docs.1.found
  - match:  { docs.1._index:     test_1      }
  - match:  { docs.1._type:      test        }
  - match:  { docs.1._id:        "2"         }

  - do:
      mget:
        index:  test_1
        body:
          ids: [1, 2]

  - is_true:  docs.0.found
  - match:  { docs.0._index:     test_1      }
  - match:  { docs.0._type:      test        }
  - match:  { docs.0._id:        "1"         }
  - match:  { docs.0._version:   1           }
  - match:  { docs.0._source:    { foo: bar }}

  - is_true:  docs.1.found
  - match:  { docs.1._index:     test_1      }
  - match:  { docs.1._type:      test_2      }
  - match:  { docs.1._id:        "2"         }
  - match:  { docs.1._version:   1           }
  - match:  { docs.1._source:    { foo: baz }}


  - do:
      catch:  /ActionRequestValidationException.+ no documents to get/
      mget:
        index:  test_1
        body:
          ids: []

  - do:
      catch:  /ActionRequestValidationException.+ no documents to get/
      mget:
        index:  test_1
        body:   {}