# Problem with numeric field created by JSON extractor

**URL:** <https://community.graylog.org/t/problem-with-numeric-field-created-by-json-extractor/1468>\
**Category:** Graylog Central (peer support)\
**Created:** [June 15, 2017, 1:42pm UTC](https://community.graylog.org/t/problem-with-numeric-field-created-by-json-extractor/1468 "2017-06-15T13:42:30Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![lao974](https://avatars.discourse-cdn.com/v4/letter/l/958977/32.png) [@lao974](https://community.graylog.org/u/lao974)\
**Post date:** [June 15, 2017, 1:42pm UTC](https://community.graylog.org/t/problem-with-numeric-field-created-by-json-extractor/1468/1 "2017-06-15T13:42:30Z")

</div>

Hi all,

I experience strange behaviour regarding a numeric field created by JSON extractor.

- When I want to generate a chart of it, I get an error saying “Could not create field graph Field graphs are only available for numeric fields.”
- When creating statistics, I get NaN values for all numeric fields.
- It seems it is a string. However, when I want to add a converter to it by pressing action button at the right side of the field the option is disabled saying “Extractors can only be used with string fields”

This is the message I extract fields from, the field in question is durationMs:  
`{"stage":"WorkflowScript","buildName":"jenkins-tester-35","node":"master","durationMs":1244,"success":true}`

Everything seems working fine apart from using durationMs as numeric field.  
I’m quite stuck here, any help is much appreciated.

Thanks, Peter

 ![](https://us1.discourse-cdn.com/flex016/uploads/graylog/original/1X/55fa90f3783b044e7751a1f6eef2b41fefbc447a.png)

---

<div class="post-metadata">

**Author:** ![jochen](https://sea2.discourse-cdn.com/flex016/user_avatar/community.graylog.org/jochen/32/8_2.png) [@jochen](https://community.graylog.org/u/jochen)\
**Post date:** [June 15, 2017, 3:52pm UTC](https://community.graylog.org/t/problem-with-numeric-field-created-by-json-extractor/1468/2 "2017-06-15T15:52:24Z")

</div>

Are you sure that the `durationMs` field has a numeric type _in all_ indices covered by your search queries? The field mapping can be different from index to index.

Try reducing the time range of your queries for testing.

You could also create a custom Elasticsearch index mapping for your data: [http://docs.graylog.org/en/2.2/pages/configuration/elasticsearch.html#custom-index-mappings](http://docs.graylog.org/en/2.2/pages/configuration/elasticsearch.html#custom-index-mappings)

---

<div class="post-metadata">

**Author:** ![lao974](https://avatars.discourse-cdn.com/v4/letter/l/958977/32.png) [@lao974](https://community.graylog.org/u/lao974)\
**Post date:** [June 15, 2017, 4:15pm UTC](https://community.graylog.org/t/problem-with-numeric-field-created-by-json-extractor/1468/3 "2017-06-15T16:15:27Z")

</div>

Hi Jochen,

No I’m not sure at all about indices.

What I found since posting my question is that if I rename this field on source side e.g. to durationMs2 than it works as supposed. Than I found that some earlier tests sent this field as string by accident, so I guess this is the source of confusion.

Is there a way to convert those early string fields (created this morning) to number? Sorry if it is lame question, I’m very new to graylog and totally lame to elastic.

Thanks!

---

<div class="post-metadata">

**Author:** ![jochen](https://sea2.discourse-cdn.com/flex016/user_avatar/community.graylog.org/jochen/32/8_2.png) [@jochen](https://community.graylog.org/u/jochen)\
**Post date:** [June 16, 2017, 3:21pm UTC](https://community.graylog.org/t/problem-with-numeric-field-created-by-json-extractor/1468/4 "2017-06-16T15:21:24Z")

</div>

> [@lao974](#):
>
> Is there a way to convert those early string fields (created this morning) to number? Sorry if it is lame question, I’m very new to graylog and totally lame to elastic.

You could try using the Elasticsearch Reindex API for this: [Reindex API | Elasticsearch Guide [2.4] | Elastic](https://www.elastic.co/guide/en/elasticsearch/reference/2.4/docs-reindex.html)

---

<div class="post-metadata">

**Author:** ![lao974](https://avatars.discourse-cdn.com/v4/letter/l/958977/32.png) [@lao974](https://community.graylog.org/u/lao974)\
**Post date:** [June 21, 2017, 8:27am UTC](https://community.graylog.org/t/problem-with-numeric-field-created-by-json-extractor/1468/5 "2017-06-21T08:27:22Z")

</div>

It’s ok now, thanks a lot for your help!

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex016/uploads/graylog/original/3X/c/7/c7c09c6b5099570133d6502b83f50ba4430de5b6.png) [@system](https://community.graylog.org/u/system)\
**Post date:** [July 5, 2017, 8:27am UTC](https://community.graylog.org/t/problem-with-numeric-field-created-by-json-extractor/1468/6 "2017-07-05T08:27:38Z")

</div>

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