我记得自己当年初次使用elasticsearch时用from&size的方法进行分页查询,由于我查询时设置的返回记录值太大,导致(’Result window is too large, from + size must be less than or equal to:[10000] but was [10100]. See the scroll api for a more efficient way to requestlarge data sets. This limit can be set by changing the[index.max_result_window] index level parameter.’)
出错后,我上网查询了不少解决办法,大佬们都说要设置index.max_result_window,但是我按他们说的设置后,异常并没有解决.最终,在大神的指点下,我学到了另一种方法:
curl -XPUT elasticsearch:9200/索引名/type名/_settings -d '{ "index" : { "max_result_window" : 1000000}}'
实际解决的时候发现通过以上请求没有解决问题,最后是通过下面的请求解决了该问题:
curl -XPUT elasticsearch:9200/索引名/_settings?preserve_existing=true -d '{"max_result_window":"1000000"}'