文档首页> 云搜索服务 CSS> 故障排除> 功能使用类> 执行命令update-by-query报错“Trying to create too many scroll contexts”
更新时间:2023-02-02 GMT+08:00

执行命令update-by-query报错“Trying to create too many scroll contexts”

问题现象

云搜索服务的Elasticsearch集群执行命令update-by-query,出现报错“Trying to create too many scroll contexts. ”,具体报错信息如下:

{"error":{"root_cause":[{"type":"exception","reason":"Trying to create too many scroll contexts. Must be less than or equal to: [100000]. This limit can be set by changing the [search.max_open_scroll_context] setting."},{"type":"exception","reason":"Trying to create too many scroll contexts. Must be less than or equal to: [100000]. ......

原因分析

当集群每调用一次scroll的创建接口,都会新建一个 scroll使用的context,当scroll contexts的数目达到预定值时,将无法继续创建scroll。

处理步骤

执行如下命令,查看“open_contexts”的参数值即为当前scroll contexts的数目。
GET /_nodes/stats/indices/search

当数目达到最大值时,可以通过以下两种方式解决。

  • 方式一:删除无用的scroll,释放scroll contexts的存储空间。
    DELETE /_search/scroll
    {  "scroll_id" : "DXF1ZXJ5QW5kRmV0Y2gBAAAAAAAAAD4WYm9laVYtZndUQlNsdDcwakFMNjU1QQ=="}
  • 方式二:调整“search.max_open_scroll_context”的值,增加scroll contexts的存储空间。
    PUT /_cluster/settings
    {
    	"persistent" : {
    		"search.max_open_scroll_context": 2012345678
    	},
    
    	"transient": {
    		"search.max_open_scroll_context": 2012345678
    	}
    }