# Understanding json typing

**URL:** https://discuss.elastic.co/t/understanding-json-typing/122932
**Category:** Elasticsearch
**Created:** [March 7, 2018, 5:17pm UTC](https://discuss.elastic.co/t/understanding-json-typing/122932 "2018-03-07T17:17:41Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![Tim\_Coote1](https://avatars.discourse-cdn.com/v4/letter/t/c4cdca/32.png) [@Tim\_Coote1](https://discuss.elastic.co/u/Tim_Coote1)
#### Post date: [March 7, 2018, 5:17pm UTC](https://discuss.elastic.co/t/understanding-json-typing/122932/1 "2018-03-07T17:17:41Z")

</div>

I'm getting errors of this form:

````auto
"error"=>{"type"=>"mapper_parsing_exception", "reason"=>"failed to parse [valueId.value]", "caused_by"=>{"type"=>"json_parse_exception", "reason"=>"Current token (VALUE_TRUE) not numeric, can not use numeric value accessors\n at [Source: org.elasticsearch.common.bytes.BytesReference$MarkSupportingStreamInputWrapper@6cd61514; line: 1, column: 218]"
```,

which I suspect is because I've got json log entries of this form:

````

{  
"notificationType": "ValueChanged",  
"valueId": {  
"value": true,  
}  
}

```auto
After log entries of this form:

```

{  
"notificationType": "ValueChanged",  
"valueId": {  
"value": 3,  
}  
}

```auto

Am I interpreting this correctly - the first log entry is creating a field, name "value" of type "number", and the second has a field of the same name, of type "boolean"?

If I am, what's the best approach? Insert some filter ahead of elasticsearch to change the name of "value" fields to something that depends on the type of their value? Something else?

If I'm wrong, does anyone have a thought on what is going wrong with the parsing?

tia

Tim
```

---

<div class="post-metadata">

### Author: ![krmathieu](https://avatars.discourse-cdn.com/v4/letter/k/b5e925/32.png) [@krmathieu](https://discuss.elastic.co/u/krmathieu)
#### Post date: [March 8, 2018, 2:58am UTC](https://discuss.elastic.co/t/understanding-json-typing/122932/2 "2018-03-08T02:58:27Z")

</div>

Tim,

It looks like you have a comma after the "value": 3 key pair but you do not have anything after that in the valueid object. That is not valid JSON and probably why you are getting the error. If you fix that I believe that will resolve your issue.

Kevin

---

<div class="post-metadata">

### Author: ![Krunal\_kalaria](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/krunal_kalaria/32/23862_2.png) [@Krunal\_kalaria](https://discuss.elastic.co/u/Krunal_kalaria)
#### Post date: [March 8, 2018, 3:58am UTC](https://discuss.elastic.co/t/understanding-json-typing/122932/3 "2018-03-08T03:58:31Z")

</div>

Can you share the json log that you want to parse it.

---

<div class="post-metadata">

### Author: ![Tim\_Coote1](https://avatars.discourse-cdn.com/v4/letter/t/c4cdca/32.png) [@Tim\_Coote1](https://discuss.elastic.co/u/Tim_Coote1)
#### Post date: [March 8, 2018, 12:28pm UTC](https://discuss.elastic.co/t/understanding-json-typing/122932/4 "2018-03-08T12:28:32Z")

</div>

Thanks, Kevin

Actually that's my mistake in obfuscating the json -there was a following field that I'd removed. I should have tested what i put in the posting.

I'll do the process properly and create a complete filebeat/logstash/elasticsearch pipeline and post a minimal log that's creating the issue for me.

tc

---

<div class="post-metadata">

### Author: ![Tim\_Coote1](https://avatars.discourse-cdn.com/v4/letter/t/c4cdca/32.png) [@Tim\_Coote1](https://discuss.elastic.co/u/Tim_Coote1)
#### Post date: [March 9, 2018, 12:59pm UTC](https://discuss.elastic.co/t/understanding-json-typing/122932/5 "2018-03-09T12:59:16Z")

</div>

And when I tried to create a simple test, it worked. So I don't know what I got wrong, but there we are.  
Thanks for helping.

---

<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: [April 6, 2018, 12:59pm UTC](https://discuss.elastic.co/t/understanding-json-typing/122932/6 "2018-04-06T12:59:23Z")

</div>

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