【发布时间】:2016-06-22 21:25:20
【问题描述】:
我为我的文档创建了一个自定义评分函数,它只返回每个文档的字段 a 的值。但是由于某种原因,在下面的示例中,结果中_score 的最后一位数字与每个文档的a 值的最后一位不同。这里发生了什么?
PUT test/doc/1
{
"a": 851459198
}
PUT test/doc/2
{
"a": 984968088
}
GET test/_search
{
"query": {
"function_score": {
"script_score": {
"script": {
"inline": "doc[\"a\"].value"
}
}
}
}
}
这将返回以下内容:
{
"took": 16,
"timed_out": false,
"_shards": {
"total": 5,
"successful": 5,
"failed": 0
},
"hits": {
"total": 2,
"max_score": 984968060,
"hits": [
{
"_index": "test",
"_type": "doc",
"_id": "2",
"_score": 984968060,
"_source": {
"a": 984968088
}
},
{
"_index": "test",
"_type": "doc",
"_id": "1",
"_score": 851459200,
"_source": {
"a": 851459198
}
}
]
}
}
为什么_score 与字段a 的值不同?
我使用的是 Elasticsearch 2.1.1
【问题讨论】:
标签: elasticsearch