'use strict';

const fs = require("fs");
const Promise = require("bluebird");
const elasticSearch = new require("elasticsearch").Client({
	host: "localhost:9200",
	log: "trace"
});

let nodeTypes = JSON.parse(fs.readFileSync("./sample/elasticsearch-node-types.json"));

Promise.map(nodeTypes, (type) => {
	return elasticSearch.create({
		index: "node_types",
		type: "node_type",
		body: type
	});
}).then((results) => {
	console.log(results);
});