# Mutate -\> convert filter is not working as expected

**URL:** https://discuss.elastic.co/t/mutate-convert-filter-is-not-working-as-expected/145431
**Category:** Logstash
**Created:** [August 21, 2018, 4:24pm UTC](https://discuss.elastic.co/t/mutate-convert-filter-is-not-working-as-expected/145431 "2018-08-21T16:24:53Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![Malli](https://avatars.discourse-cdn.com/v4/letter/m/a3d4f5/32.png) [@Malli](https://discuss.elastic.co/u/Malli)
#### Post date: [August 21, 2018, 4:24pm UTC](https://discuss.elastic.co/t/mutate-convert-filter-is-not-working-as-expected/145431/1 "2018-08-21T16:24:53Z")

</div>

I am trying to creating a new field using mutate-\> add\_field filter for a key coming from json data. I need to convert that filed to a integer/number. i am using the below syntax

mutate  
{  
convert =\> {"timeTaken" =\> "integer"}  
}

Possible values in this field are - numeric Ex: 60,37,90,100,23,0.

I am not getting any error while running the logstash script, but when i am trying to see that field in kibana the type it is showing as unknown(?).

I need this field to be numeric to implement some bar charts.

ELK version i am using is 6.3

Appreciate your help.

---

<div class="post-metadata">

### Author: ![rijinmp](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rijinmp/32/24634_2.png) [@rijinmp](https://discuss.elastic.co/u/rijinmp)
#### Post date: [August 21, 2018, 4:29pm UTC](https://discuss.elastic.co/t/mutate-convert-filter-is-not-working-as-expected/145431/2 "2018-08-21T16:29:00Z")

</div>

Please check the sample value in the filed "timeTaken"

Can you copy the sample log here ?

---

<div class="post-metadata">

### Author: ![Malli](https://avatars.discourse-cdn.com/v4/letter/m/a3d4f5/32.png) [@Malli](https://discuss.elastic.co/u/Malli)
#### Post date: [August 21, 2018, 4:34pm UTC](https://discuss.elastic.co/t/mutate-convert-filter-is-not-working-as-expected/145431/3 "2018-08-21T16:34:45Z")

</div>

I can't share the entire log as it has some sensitive data. but the value is coming in the log as  
"timeTaken":"60" inside the json.

i am able to see the data in the kibana. Attached the screen.  
 ![Capture](https://us1.discourse-cdn.com/elastic/original/3X/4/b/4b3cd68a5267274c40b1137e196b699c5c278948.png)

---

<div class="post-metadata">

### Author: ![Malli](https://avatars.discourse-cdn.com/v4/letter/m/a3d4f5/32.png) [@Malli](https://discuss.elastic.co/u/Malli)
#### Post date: [August 21, 2018, 4:55pm UTC](https://discuss.elastic.co/t/mutate-convert-filter-is-not-working-as-expected/145431/4 "2018-08-21T16:55:58Z")

</div>

Hi @rijinmp - Let me know if the info i sent is good to validate at your end.

---

<div class="post-metadata">

### Author: ![rijinmp](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rijinmp/32/24634_2.png) [@rijinmp](https://discuss.elastic.co/u/rijinmp)
#### Post date: [August 21, 2018, 4:59pm UTC](https://discuss.elastic.co/t/mutate-convert-filter-is-not-working-as-expected/145431/5 "2018-08-21T16:59:57Z")

</div>

Refresh your index . May be this filed is not comes in index . This is a new one.

Management -\> Index -\> your index -\> Refresh

---

<div class="post-metadata">

### Author: ![Malli](https://avatars.discourse-cdn.com/v4/letter/m/a3d4f5/32.png) [@Malli](https://discuss.elastic.co/u/Malli)
#### Post date: [August 21, 2018, 6:01pm UTC](https://discuss.elastic.co/t/mutate-convert-filter-is-not-working-as-expected/145431/6 "2018-08-21T18:01:52Z")

</div>

I am deleting the index and re-creating it every time for testing, but no change.

I have tried your option(index refresh) though, but no change. Issue remains same.

---

<div class="post-metadata">

### Author: ![Malli](https://avatars.discourse-cdn.com/v4/letter/m/a3d4f5/32.png) [@Malli](https://discuss.elastic.co/u/Malli)
#### Post date: [August 23, 2018, 9:38pm UTC](https://discuss.elastic.co/t/mutate-convert-filter-is-not-working-as-expected/145431/7 "2018-08-23T21:38:46Z")

</div>

I have restarted all the Logstash, elsaticsearch and kibana. It started working, i mean the field is showing as number in kibana.

---

<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 20, 2018, 9:39pm UTC](https://discuss.elastic.co/t/mutate-convert-filter-is-not-working-as-expected/145431/8 "2018-09-20T21:39:01Z")

</div>

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