Skip to content

Instantly share code, notes, and snippets.

@kartikag01
Created December 13, 2017 16:57
Show Gist options
  • Select an option

  • Save kartikag01/21a880dd7119220d4418df4d08cf42c4 to your computer and use it in GitHub Desktop.

Select an option

Save kartikag01/21a880dd7119220d4418df4d08cf42c4 to your computer and use it in GitHub Desktop.
nodejs elastic connection
import elasticsearch from "elasticsearch";
let elasticClient;
export const getElasticInstance = () => {
if (elasticClient)
return elasticClient;
elasticClient = new elasticsearch.Client({
host: 'localhost:9200'
});
return elasticClient;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment