summaryrefslogtreecommitdiff
path: root/rest-api-spec/test/update/15_script.yaml
blob: c8cfc5f216cd8aeb90badef6f51e80a84750dd3a (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
---
"Script":

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

  - do:
      update:
          index:  test_1
          type:   test
          id:     1
          script: "1"
          body:
            lang:   mvel
            script: "ctx._source.foo = bar"
            params: { bar: 'xxx' }

  - match: { _index:   test_1 }
  - match: { _type:    test   }
  - match: { _id:      "1"    }
  - match: { _version: 2      }

  - do:
      get:
          index:  test_1
          type:   test
          id:     1

  - match: { _source.foo:        xxx }
  - match: { _source.count:      1   }

  - do:
      update:
          index:  test_1
          type:   test
          id:     1
          lang:   mvel
          script: "ctx._source.foo = 'yyy'"

  - match: { _index:   test_1 }
  - match: { _type:    test   }
  - match: { _id:      "1"    }
  - match: { _version: 3      }

  - do:
      get:
          index:  test_1
          type:   test
          id:     1

  - match: { _source.foo:        yyy }
  - match: { _source.count:      1   }

  - do:
      catch:      /script_lang not supported \[doesnotexist\]/
      update:
          index:  test_1
          type:   test
          id:     1
          body:
            script: "1"
            lang:   "doesnotexist"
            params: { bar: 'xxx' }

  - do:
      catch:      /script_lang not supported \[doesnotexist\]/
      update:
          index:  test_1
          type:   test
          id:     1
          lang:   doesnotexist
          script: "1"