使用elasticsearch进行深度分页查询时的size-from大于10000的时候,会提示一个max_result_window is too large的错误。

官方推荐是scroll查询返回结果是无序的不满足业务需求,所以还是通过设置最大返回结果数来达到我们的目的

然后我们可以通过以下方法设置:node settings must not contain any index level settings

第一种:

curl -H "Content-Type: application/json" -XPUT 'http://127.0.0.1:9200/_all/_settings?preserve_existing=true' -d '{
"index.max_result_window" : ""
}'

或者

curl -H "Content-Type: application/json" -XPUT http://127.0.0.1:9200/_settings -d '{ "index" : { "max_result_window" : 100000000}}'

第二种:在config/elasticsearch.yml文件中的最后加上index.max_result_window: 100000000,但是这种方法要注意在最前面加上空格

但是要注意,5.x之后,已经不支持第二种方式了。否则启动时,会报下列错误:

使用elasticsearch分页时报max_result_window is too large的错误解决方案的更多相关文章

  1. Tomcat启动时报org.springframework.web.context.ContextLoaderListener错误解决方案

    问题现象:新从svn上检出maven的项目maven+spring+springmvc项目在Tomcat启动时,报如下错误. 严重: Error configuring application lis ...

  2. elasticsearch 分页查询实现方案——Top K+归并排序

    elasticsearch 分页查询实现方案 1. from+size 实现分页 from表示从第几行开始,size表示查询多少条文档.from默认为0,size默认为10,注意:size的大小不能超 ...

  3. Elasticsearch分页解决方案

    一.命令的方式做分页 1.常见的分页方式:from+size elasticsearch默认采用的分页方式是from+size的形式,但是在深度分页的情况下,这种使用方式的效率是非常低的,比如from ...

  4. vue引入js文件时报This dependency was not found:错误

    vue引入js文件时报This dependency was not found:错误 使用了很多方法,原来是这么小的问题,特此记录 解决办法 添加 ./

  5. Java代码解决ElasticSearch的Result window is too large问题

    调用ElasticSearch做分页查询时报错: QueryPhaseExecutionException[Result window is too large, from + size must b ...

  6. Elasticsearch 分页查询

    目录 前言 from + size search after scroll api 总结 参考资料 前言 我们在实际工作中,有很多分页的需求,商品分页.订单分页等,在MySQL中我们可以使用limit ...

  7. elasticsearch 分页查询实现方案

    1. from+size 实现分页 from表示从第几行开始,size表示查询多少条文档.from默认为0,size默认为10, 注意:size的大小不能超过index.max_result_wind ...

  8. ElasticSearch——分页查询

    前言 ElasticSearch实现分页查询,有3种方式,他们在数据查询中各自占据着不同的优势,因此在搜索引擎的数据分页过程中,如何更好地利用各自的优势来进行数据查询是一个非常重要的过程. 传统分页( ...

  9. Elasticsearch——分页查询From&Size VS scroll

    Elasticsearch中数据都存储在分片中,当执行搜索时每个分片独立搜索后,数据再经过整合返回.那么,如果要实现分页查询该怎么办呢? 更多内容参考Elasticsearch资料汇总 按照一般的查询 ...

随机推荐

  1. beautiful number 数位dp

    题意:  求高位往低位递减且  高位%低位==0(相邻) 数字数量 唯一要注意的就是前导零!!!!!!(正因为这个前导零   一开始的pre设置为0       ) 比如  11  10 09 08 ...

  2. 008 pandas介绍

    一:介绍 1.官网 http://pandas.pydata.org/ 2.说明 Python Data Analysis Library 或 pandas 是基于NumPy 的一种工具,该工具是为了 ...

  3. nginx+uwsgi启动Django项目

    1.安装项目环境 系统环境:ubuntu16.04 python环境:python3.5.2 Django版本:django1.11.7 nginx环境:nginx_1.10.3 虚拟环境:virtu ...

  4. Harmonic Number(调和级数+欧拉常数)

    In mathematics, the nth harmonic number is the sum of the reciprocals of the first n natural numbers ...

  5. 新版的 selenium已经放弃PhantomJS改用Chorme headless

    新版的 selenium已经放弃PhantomJS改用Chorme headless   使用pip show selenium显示默认安装的是3.1.3版本目前使用新版selenium调用Phant ...

  6. SpringBoot使用WebJars

    本人主要做的是java,但是从第一份工作开始,就一直在做一个写前端又写后端的程序员,相信很多朋友和我一样,不仅要会后台代码,还要懂得很多的前端代码,例如javascipt和css样式. 本文就为大家简 ...

  7. new关键字对构造函数做了什么

    new 命令 基本用法 new 命令的作用,就是执行构造函数,返回一个实例对象. 1 var Vehicle = function (){ 2 this.price = 1000; 3 }; 4 5 ...

  8. Java读取接口中的数据,并保存到txt文件中!

    //创建读取接口中数据的方法 public static String read() { URL url = null; BufferedReader reader = null; HttpURLCo ...

  9. 用java连接RabbitMQ

    pom.xml <dependencies> <dependency> <groupId>junit</groupId> <artifactId& ...

  10. 【DWM1000】 code 解密7一ANCHOR接收到BLINK

    接着之前ANCHOR的代码分析,但接收到无线数据,应该执行如下代码 case TA_RX_WAIT_DATA :   //already recive a message                ...