I am using the official Elasticsearch Javascript client with version 6.0 and trying to delete a list of indices.
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()
. I have no idea why this breaks, but after removing sniffOnStart
everything works.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.