How to use the elasticsearch.resourcesToInitialise function in elasticsearch

To help you get started, we’ve selected a few elasticsearch examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github holidayextras / jsonapi-store-elasticsearch / lib / elasticsearchHandler.js View on Github external
ElasticsearchStore.prototype.initialise = function(resourceConfig) {
  var self = this;
  var clientConfig = {
    host: "http://localhost:9200"
  };
  var client = new elasticsearch.Client(JSON.parse(JSON.stringify(clientConfig)));
  if (!client) {
    console.error("error connecting to Elasticsearch");
  } else {
    self._db = client;
  }
  self.resourceConfig = resourceConfig;
  if (!self._db) {
    return elasticsearch.resourcesToInitialise.push(resourceConfig);
  }
  self.ready = true;
};