Delete the document with the specified unique id.
var ElasticSearch = require('machinepack-elasticsearch');
// Delete the document with the specified unique id.
ElasticSearch.destroy({
hostname: 'localhost',
index: 'myindex',
id: 'lzmkDgMjTbGoacxLMsB_zA',
port: 9200,
type: 'user',
}).exec({
// An unexpected error occurred.
error: function (err) {
},
// Could not connect to ElasticSearch at the provided hostname and port, or all connections in the ES client pool are "dead".
couldNotConnect: function () {
},
// The specified index does not exist
noSuchIndex: function () {
},
// No document with the specified id and type exists in this index
documentNotFound: function () {
},
// OK.
success: function () {
},
});
The hostname of your ElasticSearch server
'localhost'
The name of the index where the document is stored
'myindex'
The unique id of the document to delete
'lzmkDgMjTbGoacxLMsB_zA'
The port your ElasticSearch server is running on
9200
The "type" of the document to delete
'user'
An unexpected error occurred.
Could not connect to ElasticSearch at the provided hostname and port, or all connections in the ES client pool are "dead".
The specified index does not exist
No document with the specified id and type exists in this index
OK.