Boolean field scripting doesn't work

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