# Convert from string to integer

**URL:** <https://discuss.elastic.co/t/convert-from-string-to-integer/63163>\
**Category:** Logstash\
**Created:** [October 17, 2016, 8:01am UTC](https://discuss.elastic.co/t/convert-from-string-to-integer/63163 "2016-10-17T08:01:44Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Lego](https://avatars.discourse-cdn.com/v4/letter/l/b5e925/32.png) [@Lego](https://discuss.elastic.co/u/Lego)\
**Post date:** [October 17, 2016, 8:01am UTC](https://discuss.elastic.co/t/convert-from-string-to-integer/63163/1 "2016-10-17T08:01:44Z")

</div>

Hello.  
I need to convert data from string to integer.

I use following syntax:

filter {

if [type] == "log1c"  
{  
csv  
{  
columns =\> [  
"ReportDate","ReportTime","UserName","ErpMode","Action","ReportName","QueryType","ReportData","Field1","Field2"  
]  
separator =\> ";"  
}

csv  
{  
source =\> "ReportData"  
columns =\> [  
"Uid","ReportAction","ReportDuration","DateOfStart","DateOfFinish"  
]  
separator =\> "|"  
}

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

}

But in Kibana i see that field ReportDuration still has string type.

How can I convert data from string to integer?

Thanks in advance.

---

<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:** [October 17, 2016, 8:07am UTC](https://discuss.elastic.co/t/convert-from-string-to-integer/63163/2 "2016-10-17T08:07:04Z")

</div>

> [@Lego](#):
>
> But in Kibana i see that field ReportDuration still has string type.

Did you delete the old index before updating the config?

---

<div class="post-metadata">

**Author:** ![Lego](https://avatars.discourse-cdn.com/v4/letter/l/b5e925/32.png) [@Lego](https://discuss.elastic.co/u/Lego)\
**Post date:** [October 17, 2016, 8:43am UTC](https://discuss.elastic.co/t/convert-from-string-to-integer/63163/3 "2016-10-17T08:43:35Z")

</div>

Hello. I'm newbie in ELK stack, so could you tell ne how i can do it?

---

<div class="post-metadata">

**Author:** ![Lego](https://avatars.discourse-cdn.com/v4/letter/l/b5e925/32.png) [@Lego](https://discuss.elastic.co/u/Lego)\
**Post date:** [October 17, 2016, 10:10am UTC](https://discuss.elastic.co/t/convert-from-string-to-integer/63163/4 "2016-10-17T10:10:36Z")

</div>

Ok.  
I'm trying to delete old index:

curl -XDELETE '[http://localhost:9200/ReportDuration/](http://localhost:9200/ReportDuration/)'  
{"error":{"root\_cause":[{"type":"index\_not\_found\_exception","reason":"no such index","resource.type":"index\_or\_alias","[resource.id](http://resource.id)":"ReportDuration","index":"ReportDuration"}],"type":"index\_not\_found\_exception","reason":"no such index","resource.type":"index\_or\_alias","[resource.id](http://resource.id)":"ReportDuration","index":"ReportDuration"},"status":4

But I get error message.

Do I implement right action?

---

<div class="post-metadata">

**Author:** ![Lego](https://avatars.discourse-cdn.com/v4/letter/l/b5e925/32.png) [@Lego](https://discuss.elastic.co/u/Lego)\
**Post date:** [October 17, 2016, 12:31pm UTC](https://discuss.elastic.co/t/convert-from-string-to-integer/63163/5 "2016-10-17T12:31:53Z")

</div>

Solved.

1. Delete indexes  
curl -XDELETE '[http://localhost:9200/\*](http://localhost:9200/*)'

2. Load filebeat template again  
curl -XPUT '[http://localhost:9200/\_template/filebeat](http://localhost:9200/_template/filebeat)' -d@/temp/filebeat.template.json

3. Setup this template as default 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:** [July 6, 2017, 4:33am UTC](https://discuss.elastic.co/t/convert-from-string-to-integer/63163/6 "2017-07-06T04:33:57Z")

</div>


