我正在运行一个简单的查询,如下所示:
{ "query": { "term": { "statuses": "active" } }, "script_fields": { "test": { "script": "_source.name" } } }
问题在于,一旦引入script_fields,我将不再获得_source结果。
script_fields
_source
我努力了:
{ "fields": [ "_all" ], "query": { "term": { "statuses": "active" } }, "script_fields": { "email": { "script": "_source.name" } } }
和
{ "fields": [ "*" ], "query": { "term": { "statuses": "active" } }, "script_fields": { "email": { "script": "_source.name" } } }
但是它们没有任何区别。_source除了之外,还有其他方法可以退货script_fields吗?
在fields数组中,使其加载_source:
fields
{ "stored_fields": [ "_source" ], "query": { "term": { "statuses": "active" } }, "script_fields": { "email": { "script": "_source.name" } } }