【问题标题】:How to set the retry on conflict in Elastic search using client.bulk method如何使用 client.bulk 方法在弹性搜索中设置冲突重试
【发布时间】:2022-01-02 06:14:13
【问题描述】:

我正在使用 client.bulk 方法插入弹性搜索。我需要根据文档在 client.bulk 中传递 retry_on_conflict 参数。

https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-update.html

下面的代码我正在尝试,但得到了错误。

const options = {
            index: config.aws.es.index,
            body: bulkBody,
            retry_on_conflict: 5
           // retryOnCflict: 5 (Tried this also) 
        };
        
        
        client.bulk(options, (err, { body }) => {
            if (err) {
                reject(err);
            } else {
                // console.log('ES bulk result: %j', body);
                resolve(body);
            }
        });

错误:

warnings: [
'Client - Unknown parameter: "retryOnConflict", sending it as query parameter'
],

任何人帮助我如何在 client.bulk() 中添加 retry_on_conflict。

【问题讨论】:

    标签: elasticsearch amazon-elasticsearch


    【解决方案1】:

    在批量请求的正文中添加retry_on_conflict,如here所示

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2019-06-05
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-03-09
      • 1970-01-01
      相关资源
      最近更新 更多