# Boolean field scripting doesn't work

**URL:** <https://discuss.elastic.co/t/boolean-field-scripting-doesnt-work/9769>\
**Category:** Elasticsearch\
**Created:** [November 20, 2012, 2:41pm UTC](https://discuss.elastic.co/t/boolean-field-scripting-doesnt-work/9769 "2012-11-20T14:41:44Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Udi](https://avatars.discourse-cdn.com/v4/letter/u/8dc957/32.png) [@Udi](https://discuss.elastic.co/u/Udi)\
**Post date:** [November 20, 2012, 2:41pm UTC](https://discuss.elastic.co/t/boolean-field-scripting-doesnt-work/9769/1 "2012-11-20T14:41:44Z")

</div>

Hi,  
I have this mapping:

products: {  
product: {  
boosts: {  
properties: {  
isAvailable: { type: "boolean" }  
}  
}  
}

And while doing this query:  
{  
"from": 0,  
"size": 20,  
"query": {  
"custom\_score": {  
"script": "\_score \* (doc['boosts.isAvailable'].value ? 1 : downBoostFactor)",  
"params": {  
"downBoostFactor": 0.001  
},  
"query": {  
"match\_all": {

```
			}
		}
	}
}

```

}  
I get error saying: nested: ScriptRuntimeException[expected Boolean; but found: java.lang.String];

Am I doing something wrong? Can boolean fileds be queried in script?

Thanks

---

<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, 3:03am UTC](https://discuss.elastic.co/t/boolean-field-scripting-doesnt-work/9769/2 "2017-07-06T03:03:33Z")

</div>


