# APM index not refreshing in Kibana - getting Mapper exception

**URL:** <https://discuss.elastic.co/t/apm-index-not-refreshing-in-kibana-getting-mapper-exception/243063>\
**Category:** APM\
**Tags:** server, ui\
**Created:** [July 29, 2020, 1:35pm UTC](https://discuss.elastic.co/t/apm-index-not-refreshing-in-kibana-getting-mapper-exception/243063 "2020-07-29T13:35:44Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![puja](https://avatars.discourse-cdn.com/v4/letter/p/4491bb/32.png) [@puja](https://discuss.elastic.co/u/puja)\
**Post date:** [July 29, 2020, 1:35pm UTC](https://discuss.elastic.co/t/apm-index-not-refreshing-in-kibana-getting-mapper-exception/243063/1 "2020-07-29T13:35:44Z")

</div>

Hi,  
Some of http fields are not getting refreshed in Kibana for apm-\* index pattern due to which I am unable to create visualization and dashboard. I tried refreshing the index pattern in Kibana -Management\>Index Pattern and refresh field for apm index but it didnt work.  
Also tried adding the field in fields.yml but no luck.

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/5/e/5e7a14cec79e07f360ad1c8f5694cf77c8a6e023.png)

Also, tried PUT/apm\*/\_mapping like below and got mapper exception -

`PUT apm*/_mapping/ { "properties": { "http.response.headers.Access-Control-Allow-Credentials": { "type": "keyword", "index": true }, "http.response.headers.Access-Control-Allow-Origin": { "type": "keyword", "index": true }, "http.response.headers.Cache-Control": { "type": "keyword", "index": true }, "http.response.headers.Content-Length": { "type": "keyword", "index": true }, "http.response.headers.Access-Control-Expose-Headers": { "type": "keyword", "index": true }, "http.response.headers.Content-Security-Policy": { "type": "keyword", "index": true }, "http.response.headers.Connection": { "type": "keyword", "index": true }, "http.response.headers.Content-Type": { "type": "keyword", "index": true }, "http.response.headers.Date": { "type": "keyword", "index": true } } }`  
After running above lines, got below output -  
`{ "error" : { "root_cause" : [{ "type" : "mapper_exception", "reason" : "Can't update attribute for type [http.response.headers.enabled] in index mapping" } ], "type" : "mapper_exception", "reason" : "Can't update attribute for type [http.response.headers.enabled] in index mapping" }, "status" : 500 }`

---

<div class="post-metadata">

**Author:** ![puja](https://avatars.discourse-cdn.com/v4/letter/p/4491bb/32.png) [@puja](https://discuss.elastic.co/u/puja)\
**Post date:** [July 30, 2020, 2:00am UTC](https://discuss.elastic.co/t/apm-index-not-refreshing-in-kibana-getting-mapper-exception/243063/2 "2020-07-30T02:00:57Z")

</div>

Looking forward for solution. Can anyone help.

---

<div class="post-metadata">

**Author:** ![gil](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/gil/32/41911_2.png) [@gil](https://discuss.elastic.co/u/gil)\
**Post date:** [July 30, 2020, 8:45pm UTC](https://discuss.elastic.co/t/apm-index-not-refreshing-in-kibana-getting-mapper-exception/243063/3 "2020-07-30T20:45:54Z")

</div>

Hi @puja, welcome!

You're really close. The issue here is that `http.response.headers` is an `object` field with `enabled: false`, and that can't be changed after the index is created. Instead, you want to modify the index template with those changes and have them take effect when the next index is created. Assuming you're on the latest release at this time, 7.8.1, and using the default ILM setup you could take these steps:

## 1. Add an index template

```auto
PUT _template/apm-custom-7.8.1
{
  "index_patterns": [
    "apm-7.8.1*"
  ],
  "mappings": {
    "properties": {
      "http": {
        "properties": {
          "response": {
            "properties": {
              "headers": {
                "properties": {
                  "Content-Length": {
                    "type": "long",
                    "ignore_malformed": true
                  },
                  "Content-Type": {
                    "type": "keyword"
                  },
                }
              }
            }
          }
        }
      }
    }
  }
}

```

## 2. Force the index to roll over:

```auto
POST apm-7.8.1-transaction/_rollover
{
  "conditions": {
    "max_docs": "1"
  }
}

```

## 3. Submit another transaction

This should happen immediately if your application is running.

## 4. Update the Kibana index pattern

Click `Refresh Field List` like before.

Now return to discover and these fields should behave as described:

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/e/6/e6d7c04d9fda3e090e5ada2a2f927bc0c3626419.png)

You can also use apm-server to update the index template instead of doing the `PUT` request above yourself. Add these to your `apm-server.yml` and run `setup --index-management`:

```auto
setup.template.overwrite: true
setup.template.append_fields:
- name: "http.response.headers.Content-Type"
  type: keyword

```

I suggest adding the `append_fields` to your config so that when you update apm-server, these customizations are retained. More options are described [in the docs](https://www.elastic.co/guide/en/apm/server/current/configuration-template.html).

---

<div class="post-metadata">

**Author:** ![puja](https://avatars.discourse-cdn.com/v4/letter/p/4491bb/32.png) [@puja](https://discuss.elastic.co/u/puja)\
**Post date:** [July 31, 2020, 11:50am UTC](https://discuss.elastic.co/t/apm-index-not-refreshing-in-kibana-getting-mapper-exception/243063/4 "2020-07-31T11:50:19Z")

</div>

Hi @gil,

Thanks for your reply. But I have one more question-

I have around more that 35 http.request.headers and http.response header fields which are not refreshing. So, do I need to add all those around 35 fields manually in apm-server.yml file or there is some other way to append\_fields in file.. like using http.request.headers.\*

Awaiting for reply..

---

<div class="post-metadata">

**Author:** ![gil](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/gil/32/41911_2.png) [@gil](https://discuss.elastic.co/u/gil)\
**Post date:** [July 31, 2020, 2:55pm UTC](https://discuss.elastic.co/t/apm-index-not-refreshing-in-kibana-getting-mapper-exception/243063/5 "2020-07-31T14:55:12Z")

</div>

It's possible to enable dynamic mappings for headers though I would only recommend this if the number of headers is reasonably bounded. Configure `apm-server.yml` with:

```auto
setup.template.append_fields:
- name: "http.response.headers"
  type: object
  enabled: true
  dynamic: true

```

I expect all fields will then be mapped as `keyword` type, including those like `Content-Length` and `Date`.

---

<div class="post-metadata">

**Author:** ![puja](https://avatars.discourse-cdn.com/v4/letter/p/4491bb/32.png) [@puja](https://discuss.elastic.co/u/puja)\
**Post date:** [August 1, 2020, 4:31pm UTC](https://discuss.elastic.co/t/apm-index-not-refreshing-in-kibana-getting-mapper-exception/243063/6 "2020-08-01T16:31:24Z")

</div>

After applying above method, is it possible to change the mapping of Content-Length and Date or any field whose mapping is not keyword

---

<div class="post-metadata">

**Author:** ![gil](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/gil/32/41911_2.png) [@gil](https://discuss.elastic.co/u/gil)\
**Post date:** [August 1, 2020, 10:42pm UTC](https://discuss.elastic.co/t/apm-index-not-refreshing-in-kibana-getting-mapper-exception/243063/7 "2020-08-01T22:42:13Z")

</div>

You should be able to combine the approaches to accomplish that.

---

<div class="post-metadata">

**Author:** ![puja](https://avatars.discourse-cdn.com/v4/letter/p/4491bb/32.png) [@puja](https://discuss.elastic.co/u/puja)\
**Post date:** [August 7, 2020, 5:12pm UTC](https://discuss.elastic.co/t/apm-index-not-refreshing-in-kibana-getting-mapper-exception/243063/8 "2020-08-07T17:12:06Z")

</div>

Thanks @gil  
This worked for me..

---

<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:** [September 4, 2020, 5:12pm UTC](https://discuss.elastic.co/t/apm-index-not-refreshing-in-kibana-getting-mapper-exception/243063/9 "2020-09-04T17:12:17Z")

</div>

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