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

**URL:** <https://discuss.elastic.co/t/how-do-we-include-the-stack-trace-of-the-error-on-the-javascript-client/259436>\
**Category:** Elasticsearch\
**Created:** [December 23, 2020, 1:18am UTC](https://discuss.elastic.co/t/how-do-we-include-the-stack-trace-of-the-error-on-the-javascript-client/259436 "2020-12-23T01:18:56Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![DevFullStack](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/devfullstack/32/77057_2.png) [@DevFullStack](https://discuss.elastic.co/u/DevFullStack)\
**Post date:** [December 23, 2020, 1:18am UTC](https://discuss.elastic.co/t/how-do-we-include-the-stack-trace-of-the-error-on-the-javascript-client/259436/1 "2020-12-23T01:18:56Z")

</div>

How do we include the stack trace of the error on the JavaScript client? The [API](https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/master/api-reference.html#_common_parameters) says `error_trace ` is an accepted common parameter, but I couldn't get the complete stack trace of the error\* I was troubleshooting :

```javascript
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](https://discuss.elastic.co/t/ignore-malformed-fires-mapper-parsing-exception-for-keyword-type-on-7-10-1-it-worked-on-7-1-0/259142) issue

---

<div class="post-metadata">

**Author:** ![DavidTurner](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/davidturner/32/22453_2.png) [@DavidTurner](https://discuss.elastic.co/u/DavidTurner)\
**Post date:** [December 23, 2020, 10:49am UTC](https://discuss.elastic.co/t/how-do-we-include-the-stack-trace-of-the-error-on-the-javascript-client/259436/2 "2020-12-23T10:49:30Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![DevFullStack](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/devfullstack/32/77057_2.png) [@DevFullStack](https://discuss.elastic.co/u/DevFullStack)\
**Post date:** [December 24, 2020, 2:34am UTC](https://discuss.elastic.co/t/how-do-we-include-the-stack-trace-of-the-error-on-the-javascript-client/259436/3 "2020-12-24T02:34:42Z")

</div>

Issue reported: [error\_trace parameter seems to be ignored on Bulk API items #66811](https://github.com/elastic/elasticsearch/issues/66811)

Thanks!

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [January 21, 2021, 2:34am UTC](https://discuss.elastic.co/t/how-do-we-include-the-stack-trace-of-the-error-on-the-javascript-client/259436/4 "2021-01-21T02:34:55Z")

</div>

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