2013-06-28 13:44:13 -04:00
|
|
|
---
|
|
|
|
"Script upsert":
|
|
|
|
|
2015-02-12 12:07:42 -05:00
|
|
|
- skip:
|
|
|
|
features: groovy_scripting
|
|
|
|
|
2013-06-28 13:44:13 -04:00
|
|
|
- do:
|
|
|
|
update:
|
|
|
|
index: test_1
|
|
|
|
type: test
|
|
|
|
id: 1
|
|
|
|
body:
|
|
|
|
script: "ctx._source.foo = bar"
|
|
|
|
params: { bar: 'xxx' }
|
|
|
|
upsert: { foo: baz }
|
|
|
|
|
|
|
|
- do:
|
|
|
|
get:
|
|
|
|
index: test_1
|
|
|
|
type: test
|
|
|
|
id: 1
|
|
|
|
|
|
|
|
- match: { _source.foo: baz }
|
|
|
|
|
|
|
|
|
|
|
|
- do:
|
|
|
|
update:
|
|
|
|
index: test_1
|
|
|
|
type: test
|
|
|
|
id: 1
|
|
|
|
body:
|
|
|
|
script: "ctx._source.foo = bar"
|
|
|
|
params: { bar: 'xxx' }
|
|
|
|
upsert: { foo: baz }
|
|
|
|
|
|
|
|
- do:
|
|
|
|
get:
|
|
|
|
index: test_1
|
|
|
|
type: test
|
|
|
|
id: 1
|
|
|
|
|
|
|
|
- match: { _source.foo: xxx }
|
2015-02-12 12:07:42 -05:00
|
|
|
|
2014-08-04 04:13:10 -04:00
|
|
|
- do:
|
|
|
|
update:
|
|
|
|
index: test_1
|
|
|
|
type: test
|
|
|
|
id: 2
|
|
|
|
body:
|
|
|
|
script: "ctx._source.foo = bar"
|
|
|
|
params: { bar: 'xxx' }
|
|
|
|
upsert: { foo: baz }
|
|
|
|
scripted_upsert: true
|
|
|
|
|
|
|
|
- do:
|
|
|
|
get:
|
|
|
|
index: test_1
|
|
|
|
type: test
|
|
|
|
id: 2
|
|
|
|
|
2014-08-06 09:05:46 -04:00
|
|
|
- match: { _source.foo: xxx }
|
2013-06-28 13:44:13 -04:00
|
|
|
|
2015-02-12 12:07:42 -05:00
|
|
|
|