ElasticSearch.create()

Store the provided document (a dictionary), making it searchable.

Usage

Hover over inputs/exits for more info.

var ElasticSearch = require('machinepack-elasticsearch');


// Store the provided document (a dictionary), making it searchable.

ElasticSearch.create({

hostname: 'localhost',

index: 'myindex',

document: {},

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

 

},

// OK.

success: function (result) {

 

},

});

Inputs

hostname required

The hostname of your ElasticSearch server

'localhost'
index required

The name of the index where the document should be stored

'myindex'
document required

The document to store

port

The port your ElasticSearch server is running on

9200
type

The "type" of this document

'user'

Exits

error

An unexpected error occurred.

couldNotConnect

Could not connect to ElasticSearch at the provided hostname and port, or all connections in the ES client pool are "dead".

noSuchIndex

The specified index does not exist

success

OK.

'lzmkDgMjTbGoacxLMsB_zA'