Name: esbootstrap
Owner: Namshi
Description: A simple utility library to bootstrap, map and load fixtures for an elasticsearch index.
Created: 2015-01-28 05:32:16.0
Updated: 2015-02-01 06:48:24.0
Pushed: 2015-02-11 08:39:06.0
Size: 253
Language: JavaScript
GitHub Committers
User | Most Recent Commit | # Commits |
---|
Other Committers
User | Most Recent Commit | # Commits |
---|
esboostrap will bootstrap, map and load fixtures for an elasticsearch index.
Add esboostrap in devDependencies
install esbootstrap --save-dev
esbootstrap = require('esbootstrap');
fixtures = require('./path/tofixtures.json');
options = {
elasticsearch: {
host: ...
log: ...
requestTimeout: ...
keepAlive: ..
},
indexName:...,
createRequestBody: {...}, // @see http://www.elasticsearch.org/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-create
mappingRequestBody: {...}, // @see http://www.elasticsearch.org/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-indices-putmapping
fixtures: fixtures // @see http://www.elasticsearch.org/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-bulk
otstrap.bootstrap(options, function() {
//....
Or if you already have an elasticsearch instance up and running and want to only load some data:
fixtures = require('./path/tofixtures.json');
options = {
elasticsearch: {
host: ...
log: ...
requestTimeout: ...
keepAlive: ..
},
fixtures: fixtures // @see http://www.elasticsearch.org/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-bulk
otstrap.loadFixtures(options, function() {
//....