2
我试图创建一个从现有油田,又名request_uri
一个新的领域,从script_field值不返回原始值
原来的查询返回,
{
...
"hits" : [
{
"_type" : "xx",
"_index" : "xx",
"fields" : {
"request_uri" : [
"/static/image/smiley/default/shocked.gif"
]
},
"_id" : "AUx5EnoynHZzwsDrHRRb",
"_score" : 1
}
],
"total" : 2
}
}
现在,如果我创建一个script_field底座上的request_uri
字段,
{
"script_fields": {
"isAnImage": {
"script": "doc['request_uri'].value"
}
}
}
的isAnImage
返回default
。这意味着它不是原始值,但分析关键字
刚刚违背了文档的数组...
我错了什么事?
我需要得到原始的request_uri
字符串,并做一些事情,但我无法检索正确的字符串。
尝试使用_source而不是doc。效率低下,因为它强制加载源,但它可能会做你想做的事。 – GlenRSmith 2015-04-03 12:50:52