# Reindex from 2.4 to 6.5 failed on boolean type

**URL:** <https://discuss.elastic.co/t/reindex-from-2-4-to-6-5-failed-on-boolean-type/158846>\
**Category:** Elasticsearch\
**Created:** [November 30, 2018, 3:49am UTC](https://discuss.elastic.co/t/reindex-from-2-4-to-6-5-failed-on-boolean-type/158846 "2018-11-30T03:49:54Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![cynosureabu](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/cynosureabu/32/47196_2.png) [@cynosureabu](https://discuss.elastic.co/u/cynosureabu)\
**Post date:** [November 30, 2018, 3:49am UTC](https://discuss.elastic.co/t/reindex-from-2-4-to-6-5-failed-on-boolean-type/158846/1 "2018-11-30T03:49:54Z")

</div>

In 2.4, a Boolean type supports 0|1|true|false,  
but seems 6.5 does not support 0|1 any more.

So my reindex failed with error "failed to parse field [claimed] of type [boolean]"

reason":"Current token (VALUE\_NUMBER\_INT) not of boolean type\n at [Source: org.elasticsearch.common.bytes.BytesReference

Any way to get around this?

---

<div class="post-metadata">

**Author:** ![Bernt\_Rostad](https://avatars.discourse-cdn.com/v4/letter/b/3ab097/32.png) [@Bernt\_Rostad](https://discuss.elastic.co/u/Bernt_Rostad)\
**Post date:** [November 30, 2018, 5:13am UTC](https://discuss.elastic.co/t/reindex-from-2-4-to-6-5-failed-on-boolean-type/158846/2 "2018-11-30T05:13:03Z")

</div>

> [@cynosureabu](#):
>
> but seems 6.5 does not support 0|1 any more.

Yes, that bit me too. Before Elasticsearch 6.0 you could use 1 and 0 for boolean _true_ and _false_, but not anymore.

> [@cynosureabu](#):
>
> Any way to get around this?

You will have to update the integer values to booleans, 0 -\> false and 1 -\> true, before you can upgrade to Elasticsearch 6.x.

The way I solved it was to create a [pipeline](https://www.elastic.co/guide/en/elasticsearch/reference/current/pipeline.html) with a processor that transformed the problematic integer values to proper booleans and then used this pipeline in a [reindex](https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-reindex.html) operation. When all indices had been reindexed I could upgrade my cluster to ES 6 without further problems.

Both pipelines and the reindex API are available in Elasticsearch 2.4 but I have no experience using them in that old version; my upgrade was done from version 5.6 so if you struggle using pipelines in the reindexing step you could first try to upgrade from 2.4 to 5.6, without changing the boolean field values, and from there to 6.5 using the aforementioned pipeline to fix the integer values.

---

<div class="post-metadata">

**Author:** ![cynosureabu](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/cynosureabu/32/47196_2.png) [@cynosureabu](https://discuss.elastic.co/u/cynosureabu)\
**Post date:** [November 30, 2018, 8:26am UTC](https://discuss.elastic.co/t/reindex-from-2-4-to-6-5-failed-on-boolean-type/158846/3 "2018-11-30T08:26:16Z")

</div>

Got another nasty way to get around this issue with the script:

"source": "boolean clean = ctx.\_source["user"].get("clean") instanceof boolean ? ctx.\_source["user"].get("clean") : ctx.\_source["user"].get("clean") instanceof Integer ? ("1" == ctx.\_source["user"].get("clean").toString()) : false;

---

<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:** [December 28, 2018, 8:38am UTC](https://discuss.elastic.co/t/reindex-from-2-4-to-6-5-failed-on-boolean-type/158846/4 "2018-12-28T08:38:40Z")

</div>

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