java 传json 设置 ES max_result_window


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

Map 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 查询。

es