# Index.mapping.total\_fields.limit

**URL:** https://discuss.elastic.co/t/index-mapping-total-fields-limit/275193
**Category:** Elasticsearch
**Created:** [June 7, 2021, 7:57pm UTC](https://discuss.elastic.co/t/index-mapping-total-fields-limit/275193 "2021-06-07T19:57:11Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![Bruceclegg](https://avatars.discourse-cdn.com/v4/letter/b/bc8723/32.png) [@Bruceclegg](https://discuss.elastic.co/u/Bruceclegg)
#### Post date: [June 7, 2021, 7:57pm UTC](https://discuss.elastic.co/t/index-mapping-total-fields-limit/275193/1 "2021-06-07T19:57:11Z")

</div>

...  
We're running elasticsearch 6.8.15

For various reasons we are unable to run Lifecycle Management on our indexes - so I have set up a cron job which uses curator that when an index reaches a certain size or age it will be deleted (and recreated).

I am having a problem figuring out how to automate the index.mapping.total\_fields.limit. A couple of our indexes require a limit \> 1000. We've been running them like that for ages and we haven't experienced any performance issues. Currently, after curator runs I go to the gui and add the limit manually by editing the settings from the management page. But this only updates the settings for the current index and when the image is recreated the next time I have to do it again.

What is the best way to override the default index.mapping.total\_fields.limit at index creation?  
...

---

<div class="post-metadata">

### Author: ![theuntergeek](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/theuntergeek/32/44961_2.png) [@theuntergeek](https://discuss.elastic.co/u/theuntergeek)
#### Post date: [June 7, 2021, 8:16pm UTC](https://discuss.elastic.co/t/index-mapping-total-fields-limit/275193/2 "2021-06-07T20:16:12Z")

</div>

Using that setting in an index template will do the trick.

---

<div class="post-metadata">

### Author: ![Bruceclegg](https://avatars.discourse-cdn.com/v4/letter/b/bc8723/32.png) [@Bruceclegg](https://discuss.elastic.co/u/Bruceclegg)
#### Post date: [June 21, 2021, 5:21pm UTC](https://discuss.elastic.co/t/index-mapping-total-fields-limit/275193/3 "2021-06-21T17:21:51Z")

</div>

Thank you for your reply. I have been out for two weeks with a nasty case of Covid. It sucked.

I did not set up the templates here - but what I propose to do is from the console run:

PUT \_template/aacp-log-test  
{  
"mapping": {  
"total\_fields": {  
"limit": "2500"  
}  
}

Am I on the right track?

---

<div class="post-metadata">

### Author: ![Bruceclegg](https://avatars.discourse-cdn.com/v4/letter/b/bc8723/32.png) [@Bruceclegg](https://discuss.elastic.co/u/Bruceclegg)
#### Post date: [June 24, 2021, 4:03pm UTC](https://discuss.elastic.co/t/index-mapping-total-fields-limit/275193/4 "2021-06-24T16:03:18Z")

</div>

You are being very helpful. **I do appreciate it.**

PUT \_template/aacp-log-test  
{  
"mapping": {  
"total\_fields": {  
"limit": "2500"  
}  
}}

**yields:**

{  
"error": {  
"root\_cause": [  
{  
"type": "action\_request\_validation\_exception",  
"reason": "Validation Failed: 1: index patterns are missing;"  
}  
],  
"type": "action\_request\_validation\_exception",  
"reason": "Validation Failed: 1: index patterns are missing;"  
},  
"status": 400  
}

**if I change "mapping" to "mappings" I get:**

{  
"error": {  
"root\_cause": [  
{  
"type": "action\_request\_validation\_exception",  
"reason": "Validation Failed: 1: index patterns are missing;"  
}  
],  
"type": "action\_request\_validation\_exception",  
"reason": "Validation Failed: 1: index patterns are missing;"  
},  
"status": 400  
}

I've tried some other variations, but I'm still getting the Validation Failed message. Can you help me understand the error message better please?

---

<div class="post-metadata">

### Author: ![Bruceclegg](https://avatars.discourse-cdn.com/v4/letter/b/bc8723/32.png) [@Bruceclegg](https://discuss.elastic.co/u/Bruceclegg)
#### Post date: [June 25, 2021, 12:45am UTC](https://discuss.elastic.co/t/index-mapping-total-fields-limit/275193/5 "2021-06-25T00:45:23Z")

</div>

I tried this:

PUT \_template/aapc.log-test  
{  
"index\_patterns" : ["aapc.log-tes\*"],  
"mappings": {  
"total\_fields": {  
"limit": "2500"  
}  
}}

and got:

{  
"error": {  
"root\_cause": [  
{  
"type": "mapper\_parsing\_exception",  
"reason": "Root mapping definition has unsupported parameters: [limit : 2500]"  
}  
],  
"type": "mapper\_parsing\_exception",  
"reason": "Failed to parse mapping [total\_fields]: Root mapping definition has unsupported parameters: [limit : 2500]",  
"caused\_by": {  
"type": "mapper\_parsing\_exception",  
"reason": "Root mapping definition has unsupported parameters: [limit : 2500]"  
}  
},  
"status": 400  
}

---

<div class="post-metadata">

### Author: ![leandrojmp](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/leandrojmp/32/107231_2.png) [@leandrojmp](https://discuss.elastic.co/u/leandrojmp)
#### Post date: [June 25, 2021, 1:08am UTC](https://discuss.elastic.co/t/index-mapping-total-fields-limit/275193/6 "2021-06-25T01:08:19Z")

</div>

The `index.mapping.total_fields.limit` is a setting, it needs to be inside the **settings** block of the [index template](https://www.elastic.co/guide/en/elasticsearch/reference/7.13/indices-templates-v1.html), you are putting it inside the **mappings** block.

Try this:

```auto
PUT _template/aapc.log-test
{
   "index_patterns" : ["aapc.log-tes*"],
   "settings" : {
     "index" : {
       "mapping" : {
         "total_fields" : {
           "limit": "2500"
         }
       }
     }
   }
}

```

---

<div class="post-metadata">

### Author: ![Bruceclegg](https://avatars.discourse-cdn.com/v4/letter/b/bc8723/32.png) [@Bruceclegg](https://discuss.elastic.co/u/Bruceclegg)
#### Post date: [June 25, 2021, 7:01pm UTC](https://discuss.elastic.co/t/index-mapping-total-fields-limit/275193/7 "2021-06-25T19:01:43Z")

</div>

> [@leandrojmp](#):
>
> ```auto
> PUT _template/aapc.log-test
> {
> "index_patterns" : ["aapc.log-tes*"],
> "settings" : {
> "index" : {
> "mapping" : {
> "total_fields" : {
> "limit": "2500"
> }
> }
> }
> }
> }
> 
> ```

Thank you - this worked perfectly.

---

<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: [July 23, 2021, 7:01pm UTC](https://discuss.elastic.co/t/index-mapping-total-fields-limit/275193/8 "2021-07-23T19:01:59Z")

</div>

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