OpenSearch/rest-api-spec/test/script/30_expressions.yaml
Clinton Gormley 53d0a0a4b9 REST test: Fixed expressions test
Perl reads the number as a string, so instead mapped the field as a long
specifically.

Also, the value returned in JSON is an integer, not a float
2015-02-28 17:02:29 +01:00

28 lines
542 B
YAML

---
setup:
- do:
indices.create:
index: test123
body:
mappings:
test:
properties:
age:
type: long
- do:
index:
index: test123
type: test
id: 1
body: { age: 23 }
- do:
indices.refresh: {}
---
"Expressions scripting test":
- do: { search: { body: { script_fields : { my_field : { lang: expression, script: 'doc["age"].value' } } } } }
- match: { hits.hits.0.fields.my_field: [ 23 ] }