Skip to content

Instantly share code, notes, and snippets.

@sahas-
Created October 14, 2015 01:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sahas-/bc29e621e61e3cf0baf3 to your computer and use it in GitHub Desktop.
Save sahas-/bc29e621e61e3cf0baf3 to your computer and use it in GitHub Desktop.
var es = require('elasticsearch');
module ejs{
export class Ops{
update(){
let action = {'update': {'_id': 'AVBjrkfgjt6ZxwHlJ1w5'}};
let data = {"doc":{"more data":{"dob":1981,"place":"TN"}}};
let _client = new es.Client({host:"http://192.168.99.111:9200"});
_client.bulk({
index:'elasticsearch',
type:'hack',
field:'_source',
body:JSON.stringify(action)+'\n'+JSON.stringify(data)
}).then((res)=>{
console.log(res);
},(error) =>{
console.log(error);
});
}
}
}
var _ops = new ejs.Ops();
_ops.update();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment