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
This commit is contained in:
Clinton Gormley 2015-02-28 17:02:07 +01:00
parent 2e797b9d55
commit 53d0a0a4b9
1 changed files with 15 additions and 3 deletions

View File

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