使用match或match_phrase查询es时,发现同一条查询语句,返回结果数,连续查询几次都不同(没有新入数据及其它可能影响的情况)
如下查询语句:
{"sort":{"publish_time":"desc"},"query":{"filtered":{"query":{"match_phrase":{"weibo_content":"攀枝花市商业银行"}},"filter":{"range":{"publish_time":{"gte":1438358400,"lt":1462031999}}}}},"from":0,"size":5}
第一次查返回3条结果,
{
"took": 10,
"timed_out": false,
"_shards": {
"total": 10,
"successful": 10,
"failed": 0
},
"hits": {
"total": 3,
"max_score": null,
"hits": [
{
"_index": "weibo_20160118",
"_type": "document",
"_id": "213956940231194956",
"_score": null,
"_source": {
"location": "北京",
"user_id": 1273845995,
"usn": "Minstar_珮_20140206",
"weibo_content": "真的!攀枝花市商业银行!牛逼大了!报银监局的报告让写出来他们制度建设不行,组织架构有问题,风险管理落实也不好!我怕银监局直接下令整改,给人家惹麻烦,放管理建议里,人家根本不看管理建议直接给我告总监!说我查不来的都是无关紧要的问题!你贷款没有审批书是小问题!!!靠!!"
},
"sort": [
1458891529
]
},
{
"_index": "weibo_20160118",
"_type": "document",
"_id": "213950318351582685",
"_score": null,
"_source": {
"location": "四川",
"user_id": 1221499901,
"usn": "坚持成功999",
"weibo_content": "【攀枝花市商业银行】您尾号6879的卡,03月07日09时02分,ATM取款,支出500.00元,活期余额20892.61元。 "
},
"sort": [
1457312750
]
},
{
"_index": "weibo_20160118",
"_type": "document",
"_id": "213946806259957035",
"_score": null,
"_source": {
"location": "广东",
"user_id": 5274323924,
"usn": "巡鹰安防",
"weibo_content": "【你的锁,安全吗?】近日,民生银行宣布推出指纹支付,而攀枝花市商业银行日前也推出了掌静脉存取款业务。此前,央行曾下发征求意见稿,允许商业银行探索远程开户等问题。详情:http://t.cn/RGNQDvG"
},
"sort": [
1456475403
]
}
]
}
}
再查一次返回2条,
{
"took": 10,
"timed_out": false,
"_shards": {
"total": 10,
"successful": 10,
"failed": 0
},
"hits": {
"total": 2,
"max_score": null,
"hits": [
{
"_index": "weibo_20160118",
"_type": "document",
"_id": "213956940231194956",
"_score": null,
"_source": {
"location": "北京",
"user_id": 1273845995,
"usn": "Minstar_珮_20140206",
"weibo_content": "真的!攀枝花市商业银行!牛逼大了!报银监局的报告让写出来他们制度建设不行,组织架构有问题,风险管理落实也不好!我怕银监局直接下令整改,给人家惹麻烦,放管理建议里,人家根本不看管理建议直接给我告总监!说我查不来的都是无关紧要的问题!你贷款没有审批书是小问题!!!靠!!"
},
"sort": [
1458891529
]
},
{
"_index": "weibo_20160118",
"_type": "document",
"_id": "213946806259957035",
"_score": null,
"_source": {
"location": "广东",
"user_id": 5274323924,
"usn": "巡鹰安防",
"weibo_content": "【你的锁,安全吗?】近日,民生银行宣布推出指纹支付,而攀枝花市商业银行日前也推出了掌静脉存取款业务。此前,央行曾下发征求意见稿,允许商业银行探索远程开户等问题。详情:http://t.cn/RGNQDvG"
},
"sort": [
1456475403
]
}
]
}
}
然后再查几次可能又返回3条,就是这条 "weibo_content": "【攀枝花市商业银行】您尾号6879的卡,03月07日09时02分,ATM取款,支出500.00元,活期余额20892.61元。 "结果,有时候能出来,有时候搜不出来,
这种情况有没有办法解决~
如下查询语句:
{"sort":{"publish_time":"desc"},"query":{"filtered":{"query":{"match_phrase":{"weibo_content":"攀枝花市商业银行"}},"filter":{"range":{"publish_time":{"gte":1438358400,"lt":1462031999}}}}},"from":0,"size":5}
第一次查返回3条结果,
{
"took": 10,
"timed_out": false,
"_shards": {
"total": 10,
"successful": 10,
"failed": 0
},
"hits": {
"total": 3,
"max_score": null,
"hits": [
{
"_index": "weibo_20160118",
"_type": "document",
"_id": "213956940231194956",
"_score": null,
"_source": {
"location": "北京",
"user_id": 1273845995,
"usn": "Minstar_珮_20140206",
"weibo_content": "真的!攀枝花市商业银行!牛逼大了!报银监局的报告让写出来他们制度建设不行,组织架构有问题,风险管理落实也不好!我怕银监局直接下令整改,给人家惹麻烦,放管理建议里,人家根本不看管理建议直接给我告总监!说我查不来的都是无关紧要的问题!你贷款没有审批书是小问题!!!靠!!"
},
"sort": [
1458891529
]
},
{
"_index": "weibo_20160118",
"_type": "document",
"_id": "213950318351582685",
"_score": null,
"_source": {
"location": "四川",
"user_id": 1221499901,
"usn": "坚持成功999",
"weibo_content": "【攀枝花市商业银行】您尾号6879的卡,03月07日09时02分,ATM取款,支出500.00元,活期余额20892.61元。 "
},
"sort": [
1457312750
]
},
{
"_index": "weibo_20160118",
"_type": "document",
"_id": "213946806259957035",
"_score": null,
"_source": {
"location": "广东",
"user_id": 5274323924,
"usn": "巡鹰安防",
"weibo_content": "【你的锁,安全吗?】近日,民生银行宣布推出指纹支付,而攀枝花市商业银行日前也推出了掌静脉存取款业务。此前,央行曾下发征求意见稿,允许商业银行探索远程开户等问题。详情:http://t.cn/RGNQDvG"
},
"sort": [
1456475403
]
}
]
}
}
再查一次返回2条,
{
"took": 10,
"timed_out": false,
"_shards": {
"total": 10,
"successful": 10,
"failed": 0
},
"hits": {
"total": 2,
"max_score": null,
"hits": [
{
"_index": "weibo_20160118",
"_type": "document",
"_id": "213956940231194956",
"_score": null,
"_source": {
"location": "北京",
"user_id": 1273845995,
"usn": "Minstar_珮_20140206",
"weibo_content": "真的!攀枝花市商业银行!牛逼大了!报银监局的报告让写出来他们制度建设不行,组织架构有问题,风险管理落实也不好!我怕银监局直接下令整改,给人家惹麻烦,放管理建议里,人家根本不看管理建议直接给我告总监!说我查不来的都是无关紧要的问题!你贷款没有审批书是小问题!!!靠!!"
},
"sort": [
1458891529
]
},
{
"_index": "weibo_20160118",
"_type": "document",
"_id": "213946806259957035",
"_score": null,
"_source": {
"location": "广东",
"user_id": 5274323924,
"usn": "巡鹰安防",
"weibo_content": "【你的锁,安全吗?】近日,民生银行宣布推出指纹支付,而攀枝花市商业银行日前也推出了掌静脉存取款业务。此前,央行曾下发征求意见稿,允许商业银行探索远程开户等问题。详情:http://t.cn/RGNQDvG"
},
"sort": [
1456475403
]
}
]
}
}
然后再查几次可能又返回3条,就是这条 "weibo_content": "【攀枝花市商业银行】您尾号6879的卡,03月07日09时02分,ATM取款,支出500.00元,活期余额20892.61元。 "结果,有时候能出来,有时候搜不出来,
这种情况有没有办法解决~
4 个回复
medcl - 今晚打老虎。
赞同来自: joeywen 、denghc0607 、laoyang360
可以通过查询的时候指定preference参数来控制每次访问的入口:
https://www.elastic.co/guide/e ... .html
denghc0607 - 90后搜索狂
赞同来自: John
martindu - 搜披露创始人
赞同来自:
chendaoqiu - 90后IT
赞同来自: