# Current token (START\_OBJECT) not of boolean type

**URL:** <https://discuss.elastic.co/t/current-token-start-object-not-of-boolean-type/162333>\
**Category:** Elasticsearch\
**Created:** [December 28, 2018, 10:41am UTC](https://discuss.elastic.co/t/current-token-start-object-not-of-boolean-type/162333 "2018-12-28T10:41:04Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![burakkilic](https://avatars.discourse-cdn.com/v4/letter/b/46a35a/32.png) [@burakkilic](https://discuss.elastic.co/u/burakkilic)\
**Post date:** [December 28, 2018, 10:41am UTC](https://discuss.elastic.co/t/current-token-start-object-not-of-boolean-type/162333/1 "2018-12-28T10:41:04Z")

</div>

Hi,

I'm getting this error:

```
ERROR 2018/12/28 09:47:00 Bulk response item: {"_index":"events","_type":"_doc","_id":"5bff91647395d80013fa5f8e","status":400,"error":{"type":"mapper_parsing_exception","reason":"failed to parse [data.coupon_applied]","caused_by":{"reason":"Current token (START_OBJECT) not of boolean type\n at [Source: org.elasticsearch.common.bytes.BytesReference$MarkSupportingStreamInputWrapper@79f245e6; line: 1, column: 133]","type":"json_parse_exception"}}}

```

The problem is, data.coupon\_applied has boolean and json values in our MongoDB database. How can I modify the type in elasticsearch so it can accept both values?

Or should I change the data model in MongoDB?

Thanks

---

<div class="post-metadata">

**Author:** ![Igor\_Motov](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/igor_motov/32/45193_2.png) [@Igor\_Motov](https://discuss.elastic.co/u/Igor_Motov)\
**Post date:** [December 28, 2018, 7:18pm UTC](https://discuss.elastic.co/t/current-token-start-object-not-of-boolean-type/162333/2 "2018-12-28T19:18:36Z")

</div>

If you don't need search the content of `data.coupon_applied` you can map it as a disabled object:

```auto
"coupon_applied": {
     "type": "object",
     "enabled": false
}

```

If you need to index the content, you have to either convert `false` to `null` or to `{}` this can be done in your application when you extract data from MongoDB, using ingest node or by changing the data model in MongoDB.

---

<div class="post-metadata">

**Author:** ![burakkilic](https://avatars.discourse-cdn.com/v4/letter/b/46a35a/32.png) [@burakkilic](https://discuss.elastic.co/u/burakkilic)\
**Post date:** [December 30, 2018, 9:34am UTC](https://discuss.elastic.co/t/current-token-start-object-not-of-boolean-type/162333/3 "2018-12-30T09:34:28Z")

</div>

Thanks @Igor_Motov

Can I update the mapping without removing the index?

---

<div class="post-metadata">

**Author:** ![Igor\_Motov](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/igor_motov/32/45193_2.png) [@Igor\_Motov](https://discuss.elastic.co/u/Igor_Motov)\
**Post date:** [December 31, 2018, 9:43pm UTC](https://discuss.elastic.co/t/current-token-start-object-not-of-boolean-type/162333/4 "2018-12-31T21:43:50Z")

</div>

You can only add new fields to the index, but it is not possible to change a field type or delete a field.

---

<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:** [January 28, 2019, 9:43pm UTC](https://discuss.elastic.co/t/current-token-start-object-not-of-boolean-type/162333/5 "2019-01-28T21:43:59Z")

</div>

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