# Setting 'index.mapping.total\_fields.limit' on Index Template

**URL:** https://discuss.elastic.co/t/setting-index-mapping-total-fields-limit-on-index-template/79288
**Category:** Elasticsearch
**Created:** [March 20, 2017, 4:15pm UTC](https://discuss.elastic.co/t/setting-index-mapping-total-fields-limit-on-index-template/79288 "2017-03-20T16:15:45Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![yomash](https://avatars.discourse-cdn.com/v4/letter/y/82dd89/32.png) [@yomash](https://discuss.elastic.co/u/yomash)
#### Post date: [March 20, 2017, 4:15pm UTC](https://discuss.elastic.co/t/setting-index-mapping-total-fields-limit-on-index-template/79288/1 "2017-03-20T16:15:45Z")

</div>

I would like to set the 'index.mapping.total\_fields.limit' index setting for an index template, but it does not seem to work. My template looks like:

```
     {
            template: 'alerts*',
            settings: {
                'index.mapping.total_fields.limit': 2000,
                number_of_shards: 10
            },
            mappings: {
                alert: { // > 1000 fields defined }
            }
     },

```

When adding my template I get an error indicating the default limit:

```
{
"error": {
  "root_cause": [
    {
      "type": "illegal_argument_exception",
      "reason": "Limit of total fields [1000] in index [m9CIuWEdQvOmFmjGFReIUg] has been exceeded"
    }
  ],
  "type": "illegal_argument_exception",
  "reason": "Limit of total fields [1000] in index [m9CIuWEdQvOmFmjGFReIUg] has been exceeded"
},
"status": 400
}
```

---

<div class="post-metadata">

### Author: ![jaymode](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jaymode/32/50103_2.png) [@jaymode](https://discuss.elastic.co/u/jaymode)
#### Post date: [March 20, 2017, 6:14pm UTC](https://discuss.elastic.co/t/setting-index-mapping-total-fields-limit-on-index-template/79288/2 "2017-03-20T18:14:31Z")

</div>

I opened a pull request to fix this [https://github.com/elastic/elasticsearch/pull/23659](https://github.com/elastic/elasticsearch/pull/23659)

---

<div class="post-metadata">

### Author: ![jaymode](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jaymode/32/50103_2.png) [@jaymode](https://discuss.elastic.co/u/jaymode)
#### Post date: [March 20, 2017, 6:42pm UTC](https://discuss.elastic.co/t/setting-index-mapping-total-fields-limit-on-index-template/79288/3 "2017-03-20T18:42:48Z")

</div>

It looks like this wasn't really the issue I thought it was. The test I added in that pull request works without issue even without the change I made. I wonder if there is maybe a issue with the format of your template?

Can you try issuing the command again with `?error_trace=true` appended to the URL?

---

<div class="post-metadata">

### Author: ![yomash](https://avatars.discourse-cdn.com/v4/letter/y/82dd89/32.png) [@yomash](https://discuss.elastic.co/u/yomash)
#### Post date: [March 20, 2017, 7:08pm UTC](https://discuss.elastic.co/t/setting-index-mapping-total-fields-limit-on-index-template/79288/4 "2017-03-20T19:08:22Z")

</div>

> [@jaymode](#):
>
> ?error\_trace=true

Thank you for looking into this Jay. This working for me now, I can specify both the: "index.mapping.total\_fields.limit" and "index.mapping.nested\_fields.limit". The error message reflects the correct configuration number when the limit is reached.

There was some sequence of events earlier that cased it not to take, can't figure it out.. or perhaps just plain user error.

EDIT: Complete user error. Sorry to waste your time.

---

<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: [April 17, 2017, 7:08pm UTC](https://discuss.elastic.co/t/setting-index-mapping-total-fields-limit-on-index-template/79288/5 "2017-04-17T19:08:34Z")

</div>

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