【问题标题】:Why Elastic search bulk operation failing for large size of data为什么弹性搜索批量操作对大量数据失败
【发布时间】:2019-06-09 11:58:57
【问题描述】:

我正在尝试以批量方式发送大约 30MB 的数据,它正在破坏 这个错误并没有说太多,但是当数据大小 id 小于它的工作正常时,我怀疑它只是因为大小?我通过 ES 6.4 API doc 找不到任何这样的限制,你知道为什么会这样吗?我可以设置限制吗

Elasticsearch ERROR: 2019-01-14T15:32:36Z
  Error: Request error, retrying
  POST http://xx.xx.xx.xx:yyyy/_bulk => read ECONNRESET
      at Log.error (D:\UBX\UBX_WS\NodeAngular\myapp\node_modules\elasticsearch\src\lib\log.js:226:56)
      at checkRespForFailure (D:\UBX\UBX_WS\NodeAngular\myapp\node_modules\elasticsearch\src\lib\transport.js:259:18)
      at HttpConnector.<anonymous> (D:\UBX\UBX_WS\NodeAngular\myapp\node_modules\elasticsearch\src\lib\connectors\http.js:163:7)
      at ClientRequest.wrapper (D:\UBX\UBX_WS\NodeAngular\myapp\node_modules\lodash\lodash.js:4935:19)
      at emitOne (events.js:116:13)
      at ClientRequest.emit (events.js:211:7)
      at ClientRequest.wrapped (D:\UBX\UBX_WS\NodeAngular\myapp\node_modules\newrelic\lib\transaction\tracer\index.js:181:22)
      at ClientRequest.wrappedRequestEmit (D:\UBX\UBX_WS\NodeAngular\myapp\node_modules\newrelic\lib\instrumentation\core\http-outbound.js:138:26)
      at Socket.socketErrorListener (_http_client.js:387:9)
      at emitOne (events.js:116:13)

客户端创建

this.client = new elasticsearch.Client({
                log: 'info',
                hosts: 'xxxxx',
                apiVersion: '6.4',
                keepAlive: true,
                suggestCompression: true,
                requestTimeout: 1000 * 60 * 60,
                createNodeAgent: (httpConnector, config) => {
                    let Agent = httpConnector.hand.Agent;
                    let agentConfig = httpConnector.makeAgentConfig(config);
                    agentConfig.keepAliveTimeout = 1000 * 60 * 60;
                    return new Agent(agentConfig);
                }
});


**Sending bulk data** 


ESClient.bulk({ body },
                    function (err, resp) {
                        if (err) {
                            log.error('bulkUpdateOrDelete failed with error - ', JSON.stringify(err));
                            reject(err);
                        } else {
                            log.debug('************* bulkUpdateOrDelete success with response - ', JSON.stringify(resp));
                            log.debug(JSON.stringify(resp));
                            resolve(resp);
                        }
                    });

【问题讨论】:

    标签: node.js elasticsearch elasticsearch-5


    【解决方案1】:

    我认为这与限制请求大小的 HTTP 设置有关。

    这个设置http.max_content_length默认为100 Mb,所以你应该尝试在你的elasticsearch.yml

    中增加它

    文档链接 - https://www.elastic.co/guide/en/elasticsearch/reference/current/modules-http.html

    【讨论】:

    • 谢谢,破解的内容是28MB我会明确设置和检查
    • 我正在使用 nodejs (express) 并且有一个具有相同错误的 elasticsearch 包,我应该在哪里更新 http.max_content_length 设置。
    【解决方案2】:

    您是否在云中的服务器上运行 Elasticsearch?通常基于服务器大小的 HTTP 有效负载存在限制,因此我假设您的实例仅支持

    【讨论】:

    • 对,特别是AWS弹性的限制
    猜你喜欢
    • 2019-06-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-08-16
    • 1970-01-01
    • 2022-06-16
    • 2016-04-13
    • 1970-01-01
    相关资源
    最近更新 更多