Elastic.deleteByQuery()

Delete by query

Usage

Hover over inputs/exits for more info.

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 () {

 

},

});

Inputs

hostname required

The hostname of your ElasticSearch server

'localhost'
index required

The name of the index where are documents to delete

'myindex'
query required

The delete query

'{ query: { "match_all" : {} } }'
port

The port your ElasticSearch server is running on

9200
type

The "type" of the document to delete

'mytype'

Exits

error

An unexpected error occurred.

couldNotConnect

Could not connect to ElasticSearch at the provided hostname and port.

noSuchIndex

The specified index does not exist.

success

OK.