No more _source if script_fields is used in elasticsearch query
In the fields
array, make it load _source
:
{ "stored_fields": [ "_source" ], "query": { "term": { "statuses": "active" } }, "script_fields": { "email": { "script": "_source.name" } }}
This works for me:
curl -X DELETE localhost:9200/acurl -X POST localhost:9200/a/b/c -d '{"title" : "foo"}'curl -X POST localhost:9200/a/_refreshecho;curl localhost:9200/a/_search?pretty -d '{ "fields": [ "_source" ], "query": { "match_all": {} }, "script_fields": { "title_script": { "script": "_source.title" } }}'
Output:
"hits" : { # ... "hits" : [ { # ... "_source" : {"title" : "foo"}, "fields" : { "title_script" : "foo" } } ]}