# MVEL script and checks on boolean type fields

**URL:** <https://discuss.elastic.co/t/mvel-script-and-checks-on-boolean-type-fields/19731>\
**Category:** Elasticsearch\
**Created:** [September 11, 2014, 7:01am UTC](https://discuss.elastic.co/t/mvel-script-and-checks-on-boolean-type-fields/19731 "2014-09-11T07:01:51Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Florian\_B](https://avatars.discourse-cdn.com/v4/letter/f/51bf81/32.png) [@Florian\_B](https://discuss.elastic.co/u/Florian_B)\
**Post date:** [September 11, 2014, 7:01am UTC](https://discuss.elastic.co/t/mvel-script-and-checks-on-boolean-type-fields/19731/1 "2014-09-11T07:01:51Z")

</div>

hola everybody,

i have a field in my mapping like  
"some\_flag" : {  
"type" : "boolean",  
"store" : "yes"  
}

and i want to give bias to results that have the flag set to false. first i  
ran into the issue that apparently the field is treated as a string (was  
getting type errors)

then it at least executed, but i cant find out how the booleans are  
represented as strings. i had found some stack overflow entry that  
suggested that internally it's represented as 'T' and 'F' due to the way  
the JSON is interpreted but

(doc['some\_flag']=='T') ? 1 : 2;

does not work either.

What's the trick I am missing?

elasticsearch version: 1.3.1

thx,  
\_f

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/0db9a4c6-426f-4ba6-bd67-0d6431322f4e%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/0db9a4c6-426f-4ba6-bd67-0d6431322f4e%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<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 6, 2017, 1:03am UTC](https://discuss.elastic.co/t/mvel-script-and-checks-on-boolean-type-fields/19731/2 "2017-07-06T01:03:10Z")

</div>


