[Resolved] Cannot contact elasticsearch database


#1

I cannot seem to contact the elasticsearch database, below is a snippet on my code

  var elasticsearch = require(['elasticsearch'], function() {
  var client = new elasticsearch.Client({
    host: 'localhost:9200',
    log: 'trace'
    });
  });

  var results = client.search(
  {
    "query": {
      "bool": {
        "must": [
        {
          "match_all": {}
        },
        ]
      }
    }
  })

The problem comes where I am unable to create a client, and it does not seem to recognise any elasticsearch when I try to import it using require.

Any help would be much appreciated.


#2

What is your project name? What error messages are you seeing?


#3

Hello. I just solved the problem, I just forgot to input elasticsearch as one of my dependancies.