0

Am getting this Missing "use strict" statement even though it's decalred at the top of the file, which confuses me. This error appears twice, for lines 10 and 12.

'user strict';
var elasticsearch = require('elasticsearch');
var client = new elasticsearch.Client({
  host : 'http://localhost:9200'
});
client.search({
  index: 'twitter',
  type: 'tweets'
}).then(function (resp) {
  var hits = resp.hits.hits;
}, function (err) {
  console.trace(err.message);
});

The code above is largely copy and paste from http://www.fullscale.co/elasticjs/

user1275105
  • 2,643
  • 5
  • 31
  • 45

1 Answers1

5

It appears you've made a typo.

It should be

'use strict';

If you want to read more about 'use strict', how to use it and what it actually does, you can view the following page:

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Strict_mode

Timon
  • 2,682
  • 1
  • 20
  • 33