61 lines
1.1 KiB
YAML
61 lines
1.1 KiB
YAML
---
|
|
"Script upsert":
|
|
|
|
- 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 }
|
|
|
|
- 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
|
|
|
|
- match: { _source.foo: xxx }
|
|
|
|
|