winston-elasticsearch icon indicating copy to clipboard operation
winston-elasticsearch copied to clipboard

ensureMappingTemplate & mappingTemplate seems not working

Open mogadanez opened this issue 4 years ago • 4 comments

I tried to debug it at bulk_writer.js

thiz.client.indices.putTemplate(tmplMessage).then(
          (res1) => {
              debugger
            fulfill(res1);
          },
          (err1) => {
            debugger
            reject(err1);
          }
        );

and it fall to catch with error

[mapper_parsing_exception] Root mapping definition has unsupported parameters:  [severity : {index=true, type=keyword}] [@timestamp : {type=date}]

mappingTemplate is exactly as in template

mogadanez avatar Mar 24 '20 23:03 mogadanez

I cannot confirm this, have you tried this with a fresh instance of ES? I could imagine that you already have an index pattern or your version of ES is not recent enough...

vanthome avatar Mar 31 '20 21:03 vanthome

Are you using elasticsearch 6 or 7? This was happening with 6.. now recent PR fixed it (on master now.. didn't release yet).

Munawwar avatar Jun 09 '20 09:06 Munawwar

A bigger issue is that this silently fails. Versions:

Elasticsearch: 7
"winston": "^3.2.1",
"winston-elasticsearch": "0.15.5"

I had to deduce that the problem was actually here with a lot of trial and error. The package should instead throw an error / cause connection failure to elastic in case of incorrect configuration.

peey avatar Jun 01 '21 11:06 peey

This is a flaky bug. It sometimes happens and sometimes doesn't. Anyways, the problem goes away if I create the template myself.

peey avatar Jun 25 '21 15:06 peey