我有类似以下的查询
{
"script_fields": {
"my_script_field": {
"script": "..."
}
},
"query": {
"match": {
"my_script_field":"*"
}
}
}
并返回空。
{
"took": 1,
"timed_out": false,
"_shards": {
"total": 10,
"successful": 10,
"failed": 0
},
"hits": {
"total": 0,
"max_score": null,
"hits": []
}
}
我可以看到脚本实际上只是重新调整所有内容 像:
{
"fields": [
"_source"
],
"script_fields": {
"my_script_field": {
"script": "..."
}
},
"query": {
match_all: {}
}
}
示例结果:
"hits": {
"total": 1008681,
"max_score": 1,
"hits": [
{
"_index": "logstash-2016.08.27",
"_type": "traffic",
"_id": "AVbLDW8qw2vffjMOfTxb",
"_score": 1,
"_source": {
"@version": "1",
"@timestamp": "2016-08-27T06:11:46.000Z",
.................
}
},
"fields": {
"my_scripted_field": [
"Asia"
]
}
但我似乎无法以任何其他方式在查询上下文中访问它。
我的问题是:
谢谢!