Hello I am trying to use script_fields.
This is my ES request : { "query": { "match_all": {} }, "script_fields": { "test": { "script": { "lang": "painless", "source": "(doc['type'].value=='user') ? 1 : null" } } } }
this returns : Cannot cast from [int] to [java.lang.Object]
when I use "source": "2" or "source": "(doc['type'].value=='user') ? 'test' : null",it works perfectly.
Hello,
Thank you for your very fast reply.
I am using 7.1 version on AWS cloud.
This snippet worked perfectyly for me too. I think the return statement is the missing thing :D.
But this is so strange, with string value I don't need to put return, when I put the number value directly I don't need to put return too. I don't know how to explain this.
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.