# "value cannot be parsed to boolean" -- Is there some to get ES to say which property this is?

**URL:** <https://discuss.elastic.co/t/value-cannot-be-parsed-to-boolean-is-there-some-to-get-es-to-say-which-property-this-is/53518>\
**Category:** Elasticsearch\
**Created:** [June 21, 2016, 2:23pm UTC](https://discuss.elastic.co/t/value-cannot-be-parsed-to-boolean-is-there-some-to-get-es-to-say-which-property-this-is/53518 "2016-06-21T14:23:39Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![memelet](https://avatars.discourse-cdn.com/v4/letter/m/6bbea6/32.png) [@memelet](https://discuss.elastic.co/u/memelet)\
**Post date:** [June 21, 2016, 2:23pm UTC](https://discuss.elastic.co/t/value-cannot-be-parsed-to-boolean-is-there-some-to-get-es-to-say-which-property-this-is/53518/1 "2016-06-21T14:23:39Z")

</div>

It would be really helpful if when properties fail to parse the key and actual value are added the exception/log. Is there a log level that might add this info? (Although it should be shown at any log level.)

[2016-06-21 14:16:50,587][ERROR][bootstrap] [s-elasticsearch-master-1] Exception  
java.lang.IllegalArgumentException: value cannot be parsed to boolean [true/1/on/yes OR false/0/off/no]  
at org.elasticsearch.common.Booleans.parseBooleanExact(Booleans.java:97)  
at org.elasticsearch.cluster.node.DiscoveryNode.dataNode(DiscoveryNode.java:256)  
at org.elasticsearch.cluster.node.DiscoveryNodes$Builder.build(DiscoveryNodes.java:659)  
at org.elasticsearch.cluster.ClusterState$Builder.nodes(ClusterState.java:571)  
at org.elasticsearch.cluster.service.InternalClusterService.doStart(InternalClusterService.java:205)  
at org.elasticsearch.common.component.AbstractLifecycleComponent.start(AbstractLifecycleComponent.java:68)  
at org.elasticsearch.node.Node.start(Node.java:279)  
at org.elasticsearch.bootstrap.Bootstrap.start(Bootstrap.java:206)  
at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:272)  
at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:35)  
[

---

<div class="post-metadata">

**Author:** ![memelet](https://avatars.discourse-cdn.com/v4/letter/m/6bbea6/32.png) [@memelet](https://discuss.elastic.co/u/memelet)\
**Post date:** [June 21, 2016, 2:51pm UTC](https://discuss.elastic.co/t/value-cannot-be-parsed-to-boolean-is-there-some-to-get-es-to-say-which-property-this-is/53518/2 "2016-06-21T14:51:44Z")

</div>

Besides, isn't valid yaml booleans this?

y|Y|yes|Yes|YES|n|N|no|No|NO  
|true|True|TRUE|false|False|FALSE  
|on|On|ON|off|Off|OFF

I am creating the yaml from ansible. When ansible renders the elasticsearch.yml it turn python boolean into True,False. If I use |to\_yaml it still uses True,False because those are valid yaml booleans.

---

<div class="post-metadata">

**Author:** ![polyfractal](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/polyfractal/32/48162_2.png) [@polyfractal](https://discuss.elastic.co/u/polyfractal)\
**Post date:** [June 21, 2016, 3:52pm UTC](https://discuss.elastic.co/t/value-cannot-be-parsed-to-boolean-is-there-some-to-get-es-to-say-which-property-this-is/53518/3 "2016-06-21T15:52:13Z")

</div>

Short answer is that no, it appears the parser cannot be configured to display the value that failed to parse correctly: [https://github.com/elastic/elasticsearch/blob/v2.3.3/core/src/main/java/org/elasticsearch/common/Booleans.java#L86-L97](https://github.com/elastic/elasticsearch/blob/v2.3.3/core/src/main/java/org/elasticsearch/common/Booleans.java#L86-L97)

Unfortunately, this is kind of hit-or-miss in the codebase right now. Newer parsing code generally makes an attempt to use formats like `"Cannot parse value [foo], expected ["yes", "no"], got ["bar"]"`. But a lot of places, especially older code, doesn't follow this convention.

Regarding the set of yaml, I agree the parser seems incomplete. I've opened an issue: [https://github.com/elastic/elasticsearch/issues/19006](https://github.com/elastic/elasticsearch/issues/19006)

---

<div class="post-metadata">

**Author:** ![jasontedor](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jasontedor/32/66992_2.png) [@jasontedor](https://discuss.elastic.co/u/jasontedor)\
**Post date:** [June 21, 2016, 4:57pm UTC](https://discuss.elastic.co/t/value-cannot-be-parsed-to-boolean-is-there-some-to-get-es-to-say-which-property-this-is/53518/4 "2016-06-21T16:57:35Z")

</div>

> [@memelet](#):
>
> Besides, isn't valid yaml booleans this?
> 
> y|Y|yes|Yes|YES|n|N|no|No|NO  
> |true|True|TRUE|false|False|FALSE  
> |on|On|ON|off|Off|OFF

No, only if we support the optional language-independent type `Boolean` which we do not.

---

<div class="post-metadata">

**Author:** ![memelet](https://avatars.discourse-cdn.com/v4/letter/m/6bbea6/32.png) [@memelet](https://discuss.elastic.co/u/memelet)\
**Post date:** [June 22, 2016, 4:42am UTC](https://discuss.elastic.co/t/value-cannot-be-parsed-to-boolean-is-there-some-to-get-es-to-say-which-property-this-is/53518/5 "2016-06-22T04:42:29Z")

</div>

Ok, fair enough. The only real downside is that ansible variables must be defined:

node.master: 'true'

instead of

node.master: true

---

<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:** [July 5, 2017, 10:41pm UTC](https://discuss.elastic.co/t/value-cannot-be-parsed-to-boolean-is-there-some-to-get-es-to-say-which-property-this-is/53518/6 "2017-07-05T22:41:34Z")

</div>


