Hi All,
I am using elastic search version 1.4.2.
I am creating a scripted term as below.
"aggregations" : {
"aggr~~derived_i~g" : {
"terms" : {
"script" : "if(doc['g'].value > 50) {'big sal'} else {'small sal'}",
"size" : 0,
"order" : {
"_term" : "asc"
}
}
This works fine and I am able to fetch both the bucket values.
Now I am trying to filter the terms, which doesn't work!
"query" : {
"filtered" : {
"query" : {
"match_all" : { }
},
"filter" : {
"and" : {
"filters" : [ {
"and" : {
"filters" : [ {
"not" : {
"filter" : {
"or" : {
"filters" : [ {
"script" : {
"script" : "doc['g'].value > 50 == param0 ",
"params" : {
"param0" : false
}
}
} ]
}
}
}
} ]
}
} ]
}
}
}
while I change the param0 to true, it does not return the values as expected. It returns values with doc['g'].value > 50 in both the cases.
Script filter like
"script" : " !( doc['g'].value > 50 ) "
Will it work?
Thanks
Shalini