OpenSearch/plugins/lang-python/rest-api-spec/test/lang_python/30_update.yaml

62 lines
1.5 KiB
YAML
Raw Normal View History

# Integration tests for Lang Python components
#
# Test case for #4: https://github.com/elasticsearch/elasticsearch-lang-python/issues/4
# Update request that uses python script with no parameters fails with NullPointerException
#
"Python Update With Empty Parameters":
- do:
index:
index: test
type: test
id: 1
body: { "myfield": "foo" }
- do:
update:
index: test
type: test
id: 1
body:
script:
script:
inline: "ctx[\"_source\"][\"myfield\"]=\"bar\""
lang: python
- do:
get:
index: test
type: test
id: 1
- match: { _source.myfield: "bar" }
---
# Test case for #19: https://github.com/elasticsearch/elasticsearch-lang-python/issues/19
# Multi-line or multi-statement Python scripts raise NullPointerException
#
"Python Update With Multi Lines":
- do:
index:
index: test
type: test
id: 1
body: { "myfield": "foo" }
- do:
update:
index: test
type: test
id: 1
body:
script:
script:
inline: "a=42; ctx[\"_source\"][\"myfield\"]=\"bar\""
lang: python
- do:
get:
index: test
type: test
id: 1
- match: { _source.myfield: "bar" }