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:
opened 04:27AM - 07 Jan 11 UTC
closed 07:56AM - 18 Jul 14 UTC
discuss
I'm trying to write a custom_score script like this:
<pre>{"script": "(doc['bo… olean_field'].value ? 100 : 0)"}</pre>
Mapping shows:
<pre>
{"boolean_field": {"type": "boolean"}}
</pre>
However, the script fails with:
<pre>
CompileException[[Error: expected Boolean; but found: java.lang.String]
</pre>
It works if I rewrite my condition to:
<pre>{"script": "(doc['boolean_field'].value == 'true' ? 100 : 0)"}</pre>
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
--
--