这是我的排序语句
GET search/_search
{
"from": 0,
"size": 20,
"sort": [
{
"_score": {
"order": "desc"
}
},{
"doc_syn_score": {"order": "desc"}
}
]
…
}
说明:doc_syn_score字段是医生的综合分数,是double类型的;
搜索出的结果:
{
"_index" : "search",
"_type" : "_doc",
"_id" : "doc_8488",
"_score" : 40.0,
"_source" : {
...
"doc_syn_score" : 30.66,
…
},
"sort" : [
40.0,
30
]
}
说明,doc_syn_score的排序值竟然变成了30,怎么才能保留小数部分?
GET search/_search
{
"from": 0,
"size": 20,
"sort": [
{
"_score": {
"order": "desc"
}
},{
"doc_syn_score": {"order": "desc"}
}
]
…
}
说明:doc_syn_score字段是医生的综合分数,是double类型的;
搜索出的结果:
{
"_index" : "search",
"_type" : "_doc",
"_id" : "doc_8488",
"_score" : 40.0,
"_source" : {
...
"doc_syn_score" : 30.66,
…
},
"sort" : [
40.0,
30
]
}
说明,doc_syn_score的排序值竟然变成了30,怎么才能保留小数部分?
2 个回复
yz123 - 90后IT
赞同来自: laoyang360
ES的long类型默认接收double和float的值,查询时也展示带小数的值,但是参与计算时会强转成long类型,舍去小数部分,所以设置索引结构时要小心;
还有ES社区建议用short、integer、float这些占空间小的类型,也能加快计算速度!
匿名用户
赞同来自: