namshi/esbootstrap

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

Homepage:

Size: 253

Language: JavaScript

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

esbootstrap

esboostrap will bootstrap, map and load fixtures for an elasticsearch index.

Installation

Add esboostrap in devDependencies

install esbootstrap --save-dev
Usage
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() {
//....

Tests

b****-please


This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.