node.js - 如何解决尝试创建太多滚动上下文。必须小于或等于:[500]?
问题描述
我正在尝试从 Elastic DB 进行查询。因此,对于 90000 条记录,我需要在两种不同的情况下使用弹性数据库。我的查询如下。
var queryobj = {
"query": {
"bool": {
"must": [
{
"match": {
"mobile": value
}
}
],
}
}
};
var { _scroll_id, hits, took } = await elasticClient.search({
index: 'mobiledata',
type: '_doc',
scroll: '20m',
filterPath: '_scroll_id,hits.hits._source,took',
size: 10000,
body: queryobj
});
if (hits) {
console.log("hits ", hits);
return hits.hits;
}
return hits;
在尝试执行此操作时,我收到如下错误:
{ Error: [exception] Trying to create too many scroll contexts. Must be less than or equal to:
[500]. This limit can be set by changing the [search.max_open_scroll_context] setting.
status: 500,
displayName: 'InternalServerError',
message: '[exception] Trying to create too many scroll contexts. Must be less than or equal to:
[500]. This limit can be set by changing the [search.max_open_scroll_context] setting.',
谁能帮我解决这个错误?
解决方案
await elasticClient.clearScroll({scroll_id: _scroll_id});
每当您想关闭滚动 api 并打开另一个滚动 api 时,请运行上述代码。这对我来说可以。
推荐阅读
- mysql - SQL - 匹配字符串中的最后两个字符
- android - Galaxy S 21 Ultra 未显示在其他 Android 手机上显示的全文字符串
- c - 将结构数据参数传递给线程
- python - 太多重定向问题,如果 URL 不以斜杠结尾
- php - Doctrine 实体管理器是否有可能刷新持久化新实体?
- javascript - 在不和谐的语音聊天中踢/断开某人的连接
- asp.net-core - 用于处理 IdentityServer 端点请求的 .NET Core 消息处理程序
- html - 如何将 Web 浏览器窗口宽度传递给 Rails 控制器?
- python - 运行烧瓶应用程序时,我在 Postman 上收到 404 Not Found Error
- gnu-smalltalk - GNU smalltalk 运行一个 .st 文件