# Custom field formatter in production

**URL:** https://discuss.elastic.co/t/custom-field-formatter-in-production/28761
**Category:** Kibana
**Created:** [September 7, 2015, 9:37am UTC](https://discuss.elastic.co/t/custom-field-formatter-in-production/28761 "2015-09-07T09:37:33Z")
**Posts on this page:** 18
**Page:** 1

<div class="post-metadata">

### Author: ![piebuo](https://avatars.discourse-cdn.com/v4/letter/p/ecccb3/32.png) [@piebuo](https://discuss.elastic.co/u/piebuo)
#### Post date: [September 7, 2015, 9:37am UTC](https://discuss.elastic.co/t/custom-field-formatter-in-production/28761/1 "2015-09-07T09:37:34Z")

</div>

Hi everyone,  
i followed these instructions to create a custom field formatter:  
[Writing Custom Field Formatters for Kibana](https://www.elastic.co/blog/kibana-custom-field-formatters)  
now in development environment i have my custom field as i wanted.  
How can i port these customization in my production environment?  
The folder tree is completely different and there is no trace of register.js, so where i have tu put my custom field file and where i register it?

---

<div class="post-metadata">

### Author: ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)
#### Post date: [September 7, 2015, 9:43am UTC](https://discuss.elastic.co/t/custom-field-formatter-in-production/28761/2 "2015-09-07T09:43:34Z")

</div>

Are you running the same version of KB on both?

---

<div class="post-metadata">

### Author: ![piebuo](https://avatars.discourse-cdn.com/v4/letter/p/ecccb3/32.png) [@piebuo](https://discuss.elastic.co/u/piebuo)
#### Post date: [September 7, 2015, 9:47am UTC](https://discuss.elastic.co/t/custom-field-formatter-in-production/28761/3 "2015-09-07T09:47:13Z")

</div>

Yes, 4.1 for both, i pulled down the development environmente here:  
[github](https://github.com/elastic/kibana)  
i selected 4.1 branch, and the production environment here:  
[kibana](https://www.elastic.co/downloads/kibana)

---

<div class="post-metadata">

### Author: ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)
#### Post date: [September 7, 2015, 9:48am UTC](https://discuss.elastic.co/t/custom-field-formatter-in-production/28761/4 "2015-09-07T09:48:38Z")

</div>

So you built your dev environment from the source?

---

<div class="post-metadata">

### Author: ![piebuo](https://avatars.discourse-cdn.com/v4/letter/p/ecccb3/32.png) [@piebuo](https://discuss.elastic.co/u/piebuo)
#### Post date: [September 7, 2015, 9:49am UTC](https://discuss.elastic.co/t/custom-field-formatter-in-production/28761/5 "2015-09-07T09:49:57Z")

</div>

yes, as explained in the guide, with npm and grunt

---

<div class="post-metadata">

### Author: ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)
#### Post date: [September 7, 2015, 9:52am UTC](https://discuss.elastic.co/t/custom-field-formatter-in-production/28761/6 "2015-09-07T09:52:09Z")

</div>

Then you probably want to do the exact same thing for prod.

I don't know the details of why this is different though, maybe one of the devs will stop by.

---

<div class="post-metadata">

### Author: ![piebuo](https://avatars.discourse-cdn.com/v4/letter/p/ecccb3/32.png) [@piebuo](https://discuss.elastic.co/u/piebuo)
#### Post date: [September 7, 2015, 9:54am UTC](https://discuss.elastic.co/t/custom-field-formatter-in-production/28761/7 "2015-09-07T09:54:45Z")

</div>

it is completely different the folder tree, i don't know where i have to put my new file and there is no trace of register.js , the file where i put a string with the declaration of new field.  
is there a way to resolve this problem?

---

<div class="post-metadata">

### Author: ![Pieter\_Agenbag](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/pieter_agenbag/32/4562_2.png) [@Pieter\_Agenbag](https://discuss.elastic.co/u/Pieter_Agenbag)
#### Post date: [September 7, 2015, 1:35pm UTC](https://discuss.elastic.co/t/custom-field-formatter-in-production/28761/8 "2015-09-07T13:35:40Z")

</div>

If you built your Kibana on dev (with included changes) .... there should be a "target" subdirectory in your kibana directory.  
You should be able to deploy that package to production.

\*You cant make changes directly to the production environment - neither should you try. The packages in the target directory will have your changes baked in.

---

<div class="post-metadata">

### Author: ![piebuo](https://avatars.discourse-cdn.com/v4/letter/p/ecccb3/32.png) [@piebuo](https://discuss.elastic.co/u/piebuo)
#### Post date: [September 7, 2015, 5:24pm UTC](https://discuss.elastic.co/t/custom-field-formatter-in-production/28761/9 "2015-09-07T17:24:33Z")

</div>

> [@Pieter\_Agenbag](#):
>
> target

there no "target" folder in my tree folder, how can i solve it?

---

<div class="post-metadata">

### Author: ![Pieter\_Agenbag](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/pieter_agenbag/32/4562_2.png) [@Pieter\_Agenbag](https://discuss.elastic.co/u/Pieter_Agenbag)
#### Post date: [September 8, 2015, 6:49am UTC](https://discuss.elastic.co/t/custom-field-formatter-in-production/28761/10 "2015-09-08T06:49:20Z")

</div>

> [@piebuo](#):
>
> yes, as explained in the guide, with npm and grunt

If you say you used grunt to build your dev environment , but have no "target" directory , I assume you just used

```
grunt dev

```

to run your changes in "dev mode".

Once you are happy that everything works , you should run

```
grunt build

```

or force it (I initially had trouble with the phantomJS testing) with

```
grunt --force build

```

---

<div class="post-metadata">

### Author: ![piebuo](https://avatars.discourse-cdn.com/v4/letter/p/ecccb3/32.png) [@piebuo](https://discuss.elastic.co/u/piebuo)
#### Post date: [September 8, 2015, 9:37am UTC](https://discuss.elastic.co/t/custom-field-formatter-in-production/28761/11 "2015-09-08T09:37:50Z")

</div>

> [@Pieter\_Agenbag](#):
>
> grunt --force build

It worked perfectly! Thank you very much!

---

<div class="post-metadata">

### Author: ![Pieter\_Agenbag](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/pieter_agenbag/32/4562_2.png) [@Pieter\_Agenbag](https://discuss.elastic.co/u/Pieter_Agenbag)
#### Post date: [September 9, 2015, 7:44am UTC](https://discuss.elastic.co/t/custom-field-formatter-in-production/28761/12 "2015-09-09T07:44:43Z")

</div>

Great 🙂

Now that you are on a custom build , you just need to be careful with new versions of Kibana. You'll have to pull and merge the changes to dev first ,buid it , test it and then deploy to production again.

---

<div class="post-metadata">

### Author: ![piebuo](https://avatars.discourse-cdn.com/v4/letter/p/ecccb3/32.png) [@piebuo](https://discuss.elastic.co/u/piebuo)
#### Post date: [September 9, 2015, 8:10am UTC](https://discuss.elastic.co/t/custom-field-formatter-in-production/28761/13 "2015-09-09T08:10:54Z")

</div>

ok, thank you again!

---

<div class="post-metadata">

### Author: ![piebuo](https://avatars.discourse-cdn.com/v4/letter/p/ecccb3/32.png) [@piebuo](https://discuss.elastic.co/u/piebuo)
#### Post date: [September 9, 2015, 8:31am UTC](https://discuss.elastic.co/t/custom-field-formatter-in-production/28761/14 "2015-09-09T08:31:24Z")

</div>

sorry again, do you think that is possible to merge two fields?  
i need to take a field value and merge it in a url with another field.  
To be clear:  
[http://www.example.com/[field1]/[field2]](http://www.example.com/%5Bfield1%5D/%5Bfield2%5D)  
is there a way to do that?  
thank you in advance

---

<div class="post-metadata">

### Author: ![Pieter\_Agenbag](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/pieter_agenbag/32/4562_2.png) [@Pieter\_Agenbag](https://discuss.elastic.co/u/Pieter_Agenbag)
#### Post date: [September 9, 2015, 9:10am UTC](https://discuss.elastic.co/t/custom-field-formatter-in-production/28761/15 "2015-09-09T09:10:37Z")

</div>

Once you start changing the code anything is possible 🙂 ... but probably not with a simple custom formatter, as its called on a specific field value.

I would imagine you're better off storing the combination of the two fields in a new joined field - which you can then apply your custom formatter on, in which you can split the value up and do what you please with it.

Maybe have a look at the [copy\_to](https://www.elastic.co/guide/en/elasticsearch/reference/current/mapping-core-types.html#copy-to "copy\_to") mapping option.

---

<div class="post-metadata">

### Author: ![mokka](https://avatars.discourse-cdn.com/v4/letter/m/8797f3/32.png) [@mokka](https://discuss.elastic.co/u/mokka)
#### Post date: [April 19, 2016, 4:47pm UTC](https://discuss.elastic.co/t/custom-field-formatter-in-production/28761/16 "2016-04-19T16:47:35Z")

</div>

Hi Piebuo,

I was wondering if you could help me with adding a new field formatter. I am trying to create a custom field formatter to highlight desired string values. I followed the example for Writing Custom Field Formatters for Kibana. However, I am not able to see the new field option in the drop down. I created Highlight.js and Highlight.html as shown in the example and added my new format to the registry file. I reloaded the Kibana page. What have I missed? I am new to Kibana and I am sure I missed something very simple. Any help is greatly appreciated. Thank you!

---

<div class="post-metadata">

### Author: ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)
#### Post date: [April 19, 2016, 8:31pm UTC](https://discuss.elastic.co/t/custom-field-formatter-in-production/28761/17 "2016-04-19T20:31:58Z")

</div>

Please start a new thread, this one is pretty old and things do change 🙂

---

<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 6, 2017, 1:55pm UTC](https://discuss.elastic.co/t/custom-field-formatter-in-production/28761/18 "2017-07-06T13:55:38Z")

</div>


