ncb000gt / node-es

NodeJS module for ElasticSearch.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

In the trace log all query are empty

genicotjb opened this issue · comments

Hello !

this is my code

`
const esClient = new es.Client({
host: 'http://localhost:9200',
log: {
type: 'file',
level: 'trace'
}
});

return esClient.search({index : 'notices'},
{'query' : {
'bool':{
'must':[
{'match':{'title.normalized':jsonLine.titre.normalized}},
{'match':{'doi.normalized':jsonLine.doi.normalized}}
]
}
}
})`

and in the tracelog the queries are empty ...
Do you have a hint about what I did wrong ?

@genicotjb - thank you for the report... at this time the es module doesn't support a log option on the constructor.

The code example you have above seems to indicate that you are using elasticsearch and not es... the two libraries serve the same purpose, but the implementation is quite a bit different underneath and one is not a drop in replacement for the other.

If you do want to use es instead, an event can be used to capture the output queries to Elasticsearch. This may be useful: https://github.com/ncb000gt/node-es#request-event

var elasticsearch = require('es');

var config = {
  _index : 'bawss',
  server : {
    hosts : ['localhost:9200', 'localhost:9201', 'localhost:9202']
  }
};

var es = elasticsearch(config);

es.request.on('request', function (options) {
  console.log('request initiated');
  console.log(options);
});

es.count(function (err, results) {
  // event results in request options being logged to console...
});

Closing due to time.