@seedalpha/elastic-index
v3.2.11
Published
ElasticSearch index management
Downloads
1
Readme
ElasticIndex
ElasticSearch index management library
Changelog
3.2.0
:
- explicit options
- documentation
3.1.0
:
- handle
noop
cases, e.g.esIndex.index(doc._id, doc);
3.0.0
:
- move index
type
(name) to options - remove
debug
option - use
visionmedia/debug
2.0.0
:
- get read of too specific env variables
- use elastic search connection string instead of host/port pair
Prerequisites
$ npm set registry http://npm.sandbox.elasticseed.net
$ npm set always-auth true
$ npm login
Installation
$ npm install elastic-index --save
Usage
// index.js
var ElasticIndex = require('elastic-index');
var bookIndex = new ElasticIndex({
type: 'books',
index: 'development',
url: 'https://username:password@host:port'
});
bookIndex.index('1', { name: 'War and Peace' }, function(error) {
if (!error) console.log('Book indexed');
});
bookIndex.unindex('1', function(error) {
if (!error) return console.log('Book removed from index);
});
// abstract
var index = new ElasticIndex(options);
type {String}
, elasticsearch typeindex {String}
, elasticsearch indexurl {String}
, elasticsearch url, default'http://localhost:9200'
Debug
$ DEBUG=elastic-index npm test
Development
$ git clone [email protected]:seedalpha/elastic-index.git
$ cd elastic-index
$ npm install
$ ES_URL=${ELASTIC_SEARCH_URL} npm test # to run on mongohq elasticsearch instance (staging)
$ ES_URL=${ELASTIC_SEARCH_URL} NOCK_OFF=true npm test # to mock requests and run locally
Author
Vladimir Popov [email protected]
License
©2014 Seedalpha