Can someone help me out? I am trying to convert a field I have from a string to an int when a condition is met.
This is what I have so far:
if (doc['burn.keyword'].value == "Yes") { return 1 }elseif (doc['burn.keyword'].value == "No") { return -1 }
Hi Matt,
I'm able to create a script like this:
if (doc['geo.src'].value == "US") { return 1 } if (doc['geo.src'].value == "CN") { return -1 } return 0
The script is of type "number" and a format of "default".
It looks like it returns the correct values. Can you give this a shot and if it doesn't work, can you tell me what error you're seeing?
Thanks, CJ
This works, thanks!
© 2020. All Rights Reserved - Elasticsearch
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.