Boolean field script 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

--

Hello,

I can also reproduce this on 0.20.0.RC1. The issue seems to have been
reported for a while now:

But I'm not sure what's the status on it. I suppose the workaround for
now would be to index that field as a numeric value.

Best regards,
Radu

http://sematext.com/ -- Elasticsearch -- Solr -- Lucene

On Tue, Nov 20, 2012 at 4:46 PM, Udi Ben Amitai sabaudi@gmail.com wrote:

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

--

--

Thanks!

--