Setting 'index.mapping.total_fields.limit' on Index Template

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
}

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

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?

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.

1 Like

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