将弹性搜索限制设置为“无限制" [英] Setting Elastic search limit to "unlimited"

查看:29
本文介绍了将弹性搜索限制设置为“无限制"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何从弹性搜索中获取所有结果,因为结果只显示限制为 10.我有这样的查询:

How can i get all the results from elastic search as the results only display limit to 10 only. ihave got a query like:

@data = Athlete.search :load => true do
          size 15
          query do
            boolean do
              must { string q, {:fields => ["name", "other_names", "nickname", "short_name"], :phrase_slop => 5} }
              unless conditions.blank?
                conditions.each do |condition|
                  must { eval(condition) }
                end
              end
              unless excludes.blank?
                excludes.each do |exclude|
                  must_not { eval(exclude) }
                end
              end
            end
          end
          sort do
            by '_score', "desc"
          end
        end

我已将限制设置为 15,但我不想将其设置为无限制,以便我可以获得所有数据我无法设置限制,因为我的数据不断变化,我想获取所有数据.

i have set the limit to 15 but i wan't to make it unlimited so that i can get all the data I can't set the limit as my data keeps on changing and i want to get all the data.

推荐答案

您可以使用 fromsize 参数来分页浏览所有数据.这可能会非常慢,具体取决于您的数据以及索引中的内容.

You can use the from and size parameters to page through all your data. This could be very slow depending on your data and how much is in the index.

http://www.elastic.co/guide/en/elasticsearch/reference/current/search-request-from-size.html

这篇关于将弹性搜索限制设置为“无限制"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆