Delete by query
var Elastic = require('machines-elastic');
// Delete by query
Elastic.deleteByQuery({
hostname: 'localhost',
index: 'myindex',
query: '{ query: { "match_all" : {} } }',
port: 9200,
type: 'mytype',
}).exec({
// An unexpected error occurred.
error: function (err) {
},
// Could not connect to ElasticSearch at the provided hostname and port.
couldNotConnect: function () {
},
// The specified index does not exist.
noSuchIndex: function () {
},
// OK.
success: function () {
},
});
The hostname of your ElasticSearch server
'localhost'
The name of the index where are documents to delete
'myindex'
The delete query
'{ query: { "match_all" : {} } }'
The port your ElasticSearch server is running on
9200
The "type" of the document to delete
'mytype'
An unexpected error occurred.
Could not connect to ElasticSearch at the provided hostname and port.
The specified index does not exist.
OK.