ES调优

  • Post author:
  • Post category:其他


ES Connection timed out,调优方向

1. 使用游标滚动查询

scrollId 游标id      searchResponse.getScrollId()

scroll 设置游标的保留时间    new Scroll(TimeValue.timeValueMinutes(30L))    指这个游标保留30分钟    游标设置为30分钟,用完需要删除游标

restHighLevelClient.searchScroll(new  SearchScrollRequest().scrollId(scrollId).scroll(scroll));

2. ES的超时时间设置长一些

查询时间:15641

就需要设置超时时间,比如20秒

3. 筛选返回的内容

如果只是显示部分字段,没必要搜索出所有的数据

4. 用完删除游标

游标设置为30分钟,用完需要删除游标

5. 只查询需要的字段

String[] fields = {“hostIP”,”pathFile”};

FetchSourceContext sourceContext = new FetchSourceContext(true,fields,null);

searchSourceBuilder.fetchSource(sourceContext);

6. 排除不需要的字段,大字段

打开jmc.exe

==>




转载于:https://www.cnblogs.com/xiang–liu/p/11612747.html