# Set "index.mapping.dimension\_fields.limit" does not work

**URL:** <https://discuss.elastic.co/t/set-index-mapping-dimension-fields-limit-does-not-work/346330>\
**Category:** Elasticsearch\
**Created:** [November 3, 2023, 6:51am UTC](https://discuss.elastic.co/t/set-index-mapping-dimension-fields-limit-does-not-work/346330 "2023-11-03T06:51:57Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![VietDuc](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/vietduc/32/121888_2.png) [@VietDuc](https://discuss.elastic.co/u/VietDuc)\
**Post date:** [November 3, 2023, 6:51am UTC](https://discuss.elastic.co/t/set-index-mapping-dimension-fields-limit-does-not-work/346330/1 "2023-11-03T06:51:57Z")

</div>

Hi everyone,

We would like to extend the number of dimension\_fields of our TSDS by

```auto
POST _index_template/ds-micrometer-metrics-prod
{
  "index_patterns": [
    "micrometer"
  ],
  "data_stream": {},
  "template": {
    "settings": {
      "index.mode": "time_series",
      "index.mapping.dimension_fields.limit": 25,
      "index.routing_path": [
        "identifier"
      ]
    }
  },
  "composed_of": [
    "metrics-timeseries-datastream-mappings",
    "metrics-timeseries-datastream-prod-settings"
  ],
  "priority": 500
}

```

And we can get the template by

```auto
GET _index_template/ds-micrometer-metrics-prod

```

And result

```auto
{
  "index_templates": [
    {
      "name": "ds-micrometer-metrics-prod",
      ...
        "template": {
          "settings": {
            "index": {
              ....
              "mapping": {
                "dimension_fields": {
                  "limit": "25"
                }
              }
            }
          }
        },
...

```

However, when we tried to apply new mappings which has 23 dimension fields, we got error:

```auto
{
  "error": {
    "root_cause": [
      {
        "type": "illegal_argument_exception",
        "reason": "Limit of total dimension fields [21] has been exceeded"
      }
    ],
    "type": "illegal_argument_exception",
    "reason": "Limit of total dimension fields [21] has been exceeded"
  },
  "status": 400
}

```

Do you know why and how to fix this issue?

Elasticsearch: 8.8.1

Best regards,

---

<div class="post-metadata">

**Author:** ![VietDuc](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/vietduc/32/121888_2.png) [@VietDuc](https://discuss.elastic.co/u/VietDuc)\
**Post date:** [November 10, 2023, 3:39am UTC](https://discuss.elastic.co/t/set-index-mapping-dimension-fields-limit-does-not-work/346330/2 "2023-11-10T03:39:59Z")

</div>

For anyone has same issue.  
You have to set the limit at the mapping not at the \_index\_template

```auto
POST _component_template/metrics-timeseries-datastream-mappings
{
    "template":
    {
        "settings":
        {
            "index":
            {
                "mode": "time_series",
                "routing_path":
                [
                    ...
                ],
                "mapping":
                {
                    "dimension_fields":
                    {
                        "limit": "25"
                    }
                }
            }
        },

```

---

<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:** [December 8, 2023, 3:40am UTC](https://discuss.elastic.co/t/set-index-mapping-dimension-fields-limit-does-not-work/346330/3 "2023-12-08T03:40:03Z")

</div>

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