How do we include the stack trace of the error on the JavaScript client?

How do we include the stack trace of the error on the JavaScript client? The API says error_trace is an accepted common parameter, but I couldn't get the complete stack trace of the error* I was troubleshooting :

var client = new elasticsearch.Client({ 
  host: 'localhost:9200',
  log: [{ level: 'error', type: 'stdio' },
        { level: 'debug', type: 'file', path: '...'}],
  //...
  apiVersion: "5.6"
});

client.bulk({ body: [/*...*/], error_trace: true}, function(err, resp){
  if(resp.errors) {
    console.log(resp.items[0].index.error);
    //Prints {type: "mapper_parsing_exception", 
    //reason: "unknown parameter [ignore_malformed] on mapper [mykeyword] 
    //of type [keyword]"}
  }
});

*this refers to the Ignore_malformed fires mapper_parsing_exception for keyword type issue

Looks like we don't respect the ?error_trace parameter for the items of a bulk request, which I suspect is also a bug (but it's nothing to do with the client or the other bug you were investigating). Please report that too!

Issue reported: error_trace parameter seems to be ignored on Bulk API items #66811

Thanks!

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.