【问题标题】:how to increase index max result window in Elasticsearch for a rails application?如何在 Elasticsearch 中为 Rails 应用程序增加索引最大结果窗口?
【发布时间】:2019-10-01 11:37:36
【问题描述】:

elasticsearch 在我的 rails 应用程序中尝试访问超过 10,000 条记录时返回此错误

[500] {"error":{"root_cause":[{"type":"query_phase_execution_exception","reason":"Result window is too large, from + size must be less than or equal to: [10000] but was [12270].

根据我的搜索,我知道有一些解决方案

  1. 增加索引最大结果窗口
  2. 使用 search_after

我找不到可以在 Rails 应用程序上正确设置它们的教程,所以你能帮我这样做吗?知道我正在使用 will_paginate gem 进行分页,我想知道我是否改成pagy gem,能解决问题,还是这个错误与分页无关?

【问题讨论】:

  • 试试 Scroll API
  • 不适合同时多个请求

标签: ruby-on-rails elasticsearch


【解决方案1】:

这是一个索引设置。通过执行更新它 卷曲如下图

curl -XPUT "http://localhost:9200/my_index/_settings" -d '{ "index" : { "max_result_window" : 1000000 } }'

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-02-16
    • 2018-03-12
    • 2021-09-29
    • 1970-01-01
    相关资源
    最近更新 更多