OpenSearch/rest-api-spec/test/script/10_basic.yaml

83 lines
1.8 KiB
YAML

---
"Indexed script":
- skip:
features: groovy_scripting
- do:
put_script:
id: "1"
lang: "groovy"
body: { "script": "_score * doc[\"myParent.weight\"].value" }
- match: { _id: "1" }
- do:
get_script:
id: "1"
lang: "groovy"
- match: { found: true }
- match: { lang: groovy }
- match: { _id: "1" }
- match: { _version: 1 }
- match: { "script": "_score * doc[\"myParent.weight\"].value" }
- do:
catch: missing
get_script:
id: "2"
lang: "groovy"
- match: { found: false }
- match: { lang: groovy }
- match: { _id: "2" }
- is_false: _version
- is_false: script
- do:
delete_script:
id: "1"
lang: "groovy"
- match: { found: true }
- match: { _index: ".scripts" }
- match: { _id: "1" }
- match: { _version: 2 }
- do:
catch: missing
delete_script:
id: "non_existing"
lang: "groovy"
- match: { found: false }
- match: { _index: ".scripts" }
- match: { _id: "non_existing" }
- match: { _version: 1 }
- do:
catch: request
put_script:
id: "1"
lang: "groovy"
body: { "script": "_score * foo bar + doc[\"myParent.weight\"].value" }
- do:
catch: /ElasticsearchIllegalArgumentException.Unable.to.parse.*/
put_script:
id: "1"
lang: "groovy"
body: { "script": "_score * foo bar + doc[\"myParent.weight\"].value" }
- do:
catch: request
put_script:
id: "1"
lang: "foobar"
body: { "script" : "_score * doc[\"myParent.weight\"].value" }
- do:
catch: /ElasticsearchIllegalArgumentException.script_lang.not.supported/
put_script:
id: "1"
lang: "foobar"
body: { "script" : "_score * doc[\"myParent.weight\"].value" }