# Custom fields in index pattern

**URL:** https://discuss.elastic.co/t/custom-fields-in-index-pattern/111819
**Category:** APM
**Created:** [December 14, 2017, 4:59pm UTC](https://discuss.elastic.co/t/custom-fields-in-index-pattern/111819 "2017-12-14T16:59:43Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![Ionaru](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ionaru/32/25586_2.png) [@Ionaru](https://discuss.elastic.co/u/Ionaru)
#### Post date: [December 14, 2017, 4:59pm UTC](https://discuss.elastic.co/t/custom-fields-in-index-pattern/111819/1 "2017-12-14T16:59:44Z")

</div>

Hi,

I'm fairly new to using Elastic/Kibana/APM and I'm trying to get custom fields to appear in the Kibana index pattern when the index comes from APM.

Using `transaction.setCustomContext()` I was able to add the fields I want to the transaction and those fields also show up in Kibana, but with a warning about a missing cached mapping.

I've tried adding a field to `fields.yml` in the APM folder and letting APM overwrite the existing one, but this did not seem to work.

How do I add my custom fields to Kibana so I can use searches on them and make graphs using those fields?

---

<div class="post-metadata">

### Author: ![roncohen](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/roncohen/32/22881_2.png) [@roncohen](https://discuss.elastic.co/u/roncohen)
#### Post date: [December 14, 2017, 5:22pm UTC](https://discuss.elastic.co/t/custom-fields-in-index-pattern/111819/2 "2017-12-14T17:22:09Z")

</div>

Hi Jeroen,

Thank you for your interest in ElasticAPM!

Custom context is meant to allow developers to supply rich additional context and potentially complex nested objects, but these values do not become searchable in Kibana.

For searchable fields, you'll want to set a tag instead:  
[https://www.elastic.co/guide/en/apm/agent/nodejs/current/agent-api.html#apm-set-tag](https://www.elastic.co/guide/en/apm/agent/nodejs/current/agent-api.html#apm-set-tag)

You shouldn't need to change anything related to index patterns, index mapping or the `fields.yml`

Hope that helps! And don't hesitate to shoot us any feedback you may have here or on GitHub.

---

<div class="post-metadata">

### Author: ![Ionaru](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ionaru/32/25586_2.png) [@Ionaru](https://discuss.elastic.co/u/Ionaru)
#### Post date: [December 14, 2017, 10:09pm UTC](https://discuss.elastic.co/t/custom-fields-in-index-pattern/111819/3 "2017-12-14T22:09:23Z")

</div>

Setting a tag worked, thank you very much!  
Although I used `transaction.setTag()` instead of `apm.setTag()`, that function not mentioned in the Transaction API, but does work. The same is true for `transaction.setCustomContext()`

Is there any way to insert multiple values at the same time as tags, or does each tag required its own function call? `transaction.setCustomContext()` was very useful to me because I could add a large amount of entries to it at the same time.

---

<div class="post-metadata">

### Author: ![wa7son](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/wa7son/32/21259_2.png) [@wa7son](https://discuss.elastic.co/u/wa7son)
#### Post date: [December 14, 2017, 10:36pm UTC](https://discuss.elastic.co/t/custom-fields-in-index-pattern/111819/4 "2017-12-14T22:36:12Z")

</div>

Currently you can only set one tag at a time with `setTag()`, but I don't see why we shouldn't support that. I'll take it up with the team 😃

---

<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: [January 4, 2018, 6:36pm UTC](https://discuss.elastic.co/t/custom-fields-in-index-pattern/111819/5 "2018-01-04T18:36:35Z")

</div>

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