Elasticsearch 使用scroll时出现异常 Trying to create more than 500 scroll contexts will not be allowed

简介: Trying to create more than 500 scroll contexts will not be allowed in the next

简述

Trying to create more than 500 scroll contexts will not be allowed in the next major version by default
 You can change the  [search.max_open_scroll_context] setting to use a greater default value or lower the number of scrolls that you need to run in parallel."

问题原因

Elasticsearch 使用scroll时,中设置的timeout时间内,累计生成的scroll_id数超过了最大限制

问题解决方式

  • 减小timeout设置
 SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder();
            searchSourceBuilder.query(queryBuilder);
            searchSourceBuilder.size(5000);
            SearchRequest searchRequest = new SearchRequest();
            searchRequest.source(searchSourceBuilder);
            TimeValue timeValue = new TimeValue(3000);
            searchRequest.scroll(timeValue);
            searchRequest.indices("");
  • 清理scroll
 ClearScrollRequest clearScrollRequest = new ClearScrollRequest();
                clearScrollRequest.addScrollId(scrollId);// 也可以选择setScrollIds()将多个scrollId一起使用
                ClearScrollResponse clearScrollResponse = null;
                try {
                    clearScrollResponse = produceRestClient.clearScroll(clearScrollRequest, RequestOptions.DEFAULT);
                } catch (IOException e) {
                    e.printStackTrace();
                }
                boolean succeeded = clearScrollResponse.isSucceeded();
                log.info("--------------->>>>{}-----", succeeded);
相关实践学习
以电商场景为例搭建AI语义搜索应用
本实验旨在通过阿里云Elasticsearch结合阿里云搜索开发工作台AI模型服务,构建一个高效、精准的语义搜索系统,模拟电商场景,深入理解AI搜索技术原理并掌握其实现过程。
ElasticSearch 最新快速入门教程
本课程由千锋教育提供。全文搜索的需求非常大。而开源的解决办法Elasricsearch(Elastic)就是一个非常好的工具。目前是全文搜索引擎的首选。本系列教程由浅入深讲解了在CentOS7系统下如何搭建ElasticSearch,如何使用Kibana实现各种方式的搜索并详细分析了搜索的原理,最后讲解了在Java应用中如何集成ElasticSearch并实现搜索。  
相关文章
elasticsearch使用 scroll 滚动分页实战实例
elasticsearch使用 scroll 滚动分页实战实例
537 0
|
安全 索引
elasticsearch异常问题
elasticsearch异常问题
682 0
|
固态存储 架构师 开发工具
|
Python
python执行elasticsearch异常【已解决】
python执行elasticsearch异常【已解决】
502 2
|
Linux
elasticsearch启动异常
elasticsearch启动异常
237 1
|
自然语言处理 前端开发 Java
ElasticSearch 实现分词全文检索 - Scroll 深分页
ElasticSearch 实现分词全文检索 - Scroll 深分页
333 0
|
运维 安全 网络协议
运维.索引引擎ElasticSearch.记录一个小异常:received plaintext http traffic on an https channel
运维.索引引擎ElasticSearch.记录一个小异常:received plaintext http traffic on an https channel
1379 0
|
存储 数据采集 负载均衡
Elasticsearch系列---搜索执行过程及scroll游标查询
Elasticsearch系列---搜索执行过程及scroll游标查询
|
前端开发 安全 Unix
elasticsearch安装及启动异常解决
elasticsearch安装及启动异常解决
514 0
|
缓存 数据安全/隐私保护
Elasticsearch出现401异常?业务并没有受到影响?
401表示鉴权失败,正常情况下,鉴权失败表示用户名密码信息异常。但是某些场景下,ES 的 Gateway中收到了401的响应,但是业务很正常...
2476 0
Elasticsearch出现401异常?业务并没有受到影响?

热门文章

最新文章