# Logstash 5.2 and specifying primitive types

**URL:** <https://discuss.elastic.co/t/logstash-5-2-and-specifying-primitive-types/144384>\
**Category:** Logstash\
**Created:** [August 14, 2018, 6:29pm UTC](https://discuss.elastic.co/t/logstash-5-2-and-specifying-primitive-types/144384 "2018-08-14T18:29:00Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![brandondash](https://avatars.discourse-cdn.com/v4/letter/b/76d3ee/32.png) [@brandondash](https://discuss.elastic.co/u/brandondash)\
**Post date:** [August 14, 2018, 6:29pm UTC](https://discuss.elastic.co/t/logstash-5-2-and-specifying-primitive-types/144384/1 "2018-08-14T18:29:00Z")

</div>

I have a pipeline that uses a grok pattern to force a particular field to be an integer.

```
MY_PATTERN ^%{DATE_STAMP:for_date} %{INT:total_count:int}$

```

Logstash correctly parses my log and shoves the appropriate data into the appropriate fields with the appropriate labels; however, when I bring up my docs in Kibana the "total\_count" field still registers as a string, not an int.

What am I doing wrong?

---

<div class="post-metadata">

**Author:** ![magnusbaeck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/magnusbaeck/32/44943_2.png) [@magnusbaeck](https://discuss.elastic.co/u/magnusbaeck)\
**Post date:** [August 14, 2018, 6:49pm UTC](https://discuss.elastic.co/t/logstash-5-2-and-specifying-primitive-types/144384/2 "2018-08-14T18:49:16Z")

</div>

If you look at the actual JSON document, is `total_count` as integer rather than a string containing an integer? If it's an integer, have you always had `:int` in the pattern, i.e. do _all_ documents in the index have `total_count` as an integer?

The existing mapping of a field in an index can't be changed , so chances are that `total_count` at some point was mapped as a string. To fix that afterwards you need to reindex.

---

<div class="post-metadata">

**Author:** ![brandondash](https://avatars.discourse-cdn.com/v4/letter/b/76d3ee/32.png) [@brandondash](https://discuss.elastic.co/u/brandondash)\
**Post date:** [August 14, 2018, 6:50pm UTC](https://discuss.elastic.co/t/logstash-5-2-and-specifying-primitive-types/144384/3 "2018-08-14T18:50:46Z")

</div>

Thanks Magnus!

Yes, it looks like I'll need to reindex... that, or just wait for my index to roll over.

---

<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 11, 2018, 6:50pm UTC](https://discuss.elastic.co/t/logstash-5-2-and-specifying-primitive-types/144384/4 "2018-09-11T18:50:52Z")

</div>

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