java 传json 设置 ES max_result_window

ES分页查询,想偷懒,数据超过一万多一些可以设置一下max_result_window

Map<String,String> params = Collections.singleMap("pretty","true");
String json = "{"
+""index":{"
+""max_result_window":30000"
+"}"
+"}"

HttpEmpty entity = new NStringEntity(json,ContentType.APPLICATION_JSON);

response = restClient.performRequest("PUT","/_index/_settings",params,entity);

但还是建议使用scrollId 查询。

原文地址:https://www.cnblogs.com/dxk1019/p/12858751.html