lib/elmongoose.js
function unindex (options) {
    var self = this

    var unindexUri = helpers.makeDocumentUri(options, self)

    // console.log('unindex:', unindexUri)

    var reqOpts = {
        method: 'DELETE',
        url: unindexUri
    }

    if(options.auth) {
        reqOpts.auth = {
            user: options.auth.user,
            pass: options.auth.password,
            sendImmediately: false
        };
    }

    helpers.backOffRequest(reqOpts, function (err, res, body) {
        if (err) {
            var error = new Error('Elasticsearch document index deletion error: '+util.inspect(err, true, 10, true))
            error.details = err

            console.log('error', error);
            //self.emit('error', error)
            return
        }

        self.emit('elmongoose-unindexed', body)
    })
}
function unindex (options) {
    var self = this

    var unindexUri = helpers.makeDocumentUri(options, self)

    // console.log('unindex:', unindexUri)

    var reqOpts = {
        method: 'DELETE',
        url: unindexUri
    }

    if(options.auth) {
        reqOpts.auth = {
            user: options.auth.user,
            pass: options.auth.password,
            sendImmediately: false
        };
    }

    helpers.backOffRequest(reqOpts, function (err, res, body) {
        if (err) {
            var error = new Error('Elasticsearch document index deletion error: '+util.inspect(err, true, 10, true))
            error.details = err

            console.log('error', error);
            //self.emit('error', error)
            return
        }

        self.emit('elmongoose-unindexed', body)
    })
}
function unindex ( options ) { var self = this var unindexUri = helpers . makeDocumentUri ( options , self ) // console.log('unindex:', unindexUri) var reqOpts = { method : 'DELETE' , url : unindexUri } if ( options . auth ) { reqOpts . auth = { user : options . auth . user , pass : options . auth . password , sendImmediately : false } ; } helpers . backOffRequest ( reqOpts , function ( err , res , body ) { if ( err ) { var error = new Error ( 'Elasticsearch document index deletion error: ' + util . inspect ( err , true , 10 , true ) ) error . details = err console . log ( 'error' , error ) ; //self.emit('error', error) return } self . emit ( 'elmongoose-unindexed' , body ) } ) }
Remove a document from elasticsearch

@param  {Object} options     elasticsearch options object. Keys: host, port, index, type
Remove a document from elasticsearch