简体   繁体   English

Elasticsearch删除了Javascript客户端失败的索引列表,并显示“无活动连接”

[英]Elasticsearch delete a list of indices with the Javascript client failing with “No Living connections”

I am using the official Elasticsearch Javascript client with version 6.0 and trying to delete a list of indices. 我正在使用6.0版的官方Elasticsearch Javascript客户端,并尝试删除索引列表。

The code is: 代码是:

const client = new elasticsearch.Client({
    "hosts": [
        "https://the-es-host-here.us-west-2.es.amazonaws.com"
    ],
    "apiVersion": "6.0",
    "sniffOnStart": true
});

const indices = [
    'enduser-2017-12-04',
    'enduser-2017-12-08',
    'enduser-2017-12-07',
    'enduser-2017-12-01',
    'enduser-2017-12-14',
    'enduser-2017-12-10',
    'enduser-2017-12-27',
    'enduser-2017-12-02',
    'enduser-2017-12-18',
    'enduser-2017-12-22',
    'enduser-2017-12-28',
    'enduser-2017-12-09',
    'enduser-2017-12-03',
    'enduser-2017-12-05',
    'enduser-2017-12-11',
    'enduser-2017-11-29',
    'enduser-2017-12-17',
    'enduser-2017-12-15',
    'enduser-2017-12-19'
];

client.indices.delete({
    index: indices
}, (error) => {
    if(error) {
        console.error(error);
    }
});

But none of the indexes are being deleted and I am seeing the following error: 但是没有任何索引被删除,我看到以下错误:

Error: No Living connections

I don't see what I am doing wrong. 我看不到我在做什么错。

After an hour of fiddling the problem was related to passing "sniffOnStart": true into new elasticsearch.Client() . 经过一个小时的摆弄,问题与将"sniffOnStart": true传递给new elasticsearch.Client() "sniffOnStart": true new elasticsearch.Client() I have no idea why this breaks, but after removing sniffOnStart everything works. 我不知道为什么会这样,但是删除sniffOnStart一切正常。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM