Hi all,
i'm trying to test if a value is in an array but i don't know why my if
clause doesn't work...
doc['users'] is an array of long values in my example.
So If i do :
{
"query" : {
"match_all" : {}
},
"sort" : {
"_script" : {
"script" : "doc['users'].values.contains((long)1)",
"type" : "string",
"order" : "desc"
}
}
}
I retrieve "true" or "false" in my result.
But if i try :
{
"query" : {
"match_all" : {}
},
"sort" : {
"_script" : {
"script" : "if(doc['users'].values.contains((long)1)){return
'foo'}",
"type" : "string",
"order" : "desc"
}
}
}
I got an exception "SearchPhaseExecutionException":
org.elasticsearch.index.fielddata.fieldcomparator.StringScriptDataComparator$InnerSource
I tried with if(doc['users'].values.contains((long)1) == true) too but same
issue...
Someone knows why ?
Thanks in advance !
--
You received this message because you are subscribed to the Google Groups
"elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/elasticsearch/bd1e6451-b1d3-4b30-be70-ce141409f9d0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.