while doing "query": { "match_all" : {} } i get less number of records than the total in elasticsearch

huangapple go评论67阅读模式
英文:

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" : {} }
}

huangapple
  • 本文由 发表于 2023年5月29日 04:53:13
  • 转载请务必保留本文链接:https://go.coder-hub.com/76353558.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定