英文:
while doing "query": { "match_all" : {} } i get less number of records than the total in elasticsearch
问题
总共有1000000条记录,但当我执行以下查询时,仅显示10000条:
GET /Index_Here/_search
{
"query": { "match_all" : {} }
}
我还添加了以下大小,但仍然不起作用:
GET /Index_Here/_search
{
"from" : 0, "size" : 20000,
"query": { "match_all" : {} }
}
甚至我也已经更新了最大窗口大小:
PUT /Index_Here/_settings
{
"index": {
"max_result_window": 200000
}
}
英文:
There are in total 1000000 records, but when i execute the below query it shows only 10,000
GET /Index_Here/_search
{
"query": { "match_all" : {} }
}
I have added the below size also still it does not work
GET /Index_Here/_search
{
"from" : 0, "size" : 20000,
"query": { "match_all" : {} }
}
even i have updated the max windows size also
PUT /Index_Here/_settings
{
"index": {
"max_result_window": 200000
}
}
答案1
得分: 1
Tldr;
这是Elasticsearch的默认设置,旨在提供性能和准确性之间的良好权衡。
解决方案
您可以通过使用参数 track_total_hits
来忽略此“优化”。
GET /Index_Here/_search
{
"track_total_hits": true,
"query": { "match_all" : {} }
}
英文:
Tldr;
This is a default in elasticsearch, to offer a good trade of between performance and accuracy.
Solution
You may disregard this "optimisation" by using the param track_total_hit
.
GET /Index_Here/_search
{
"track_total_hits": true,
"query": { "match_all" : {} }
}
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论