Hi. I want to create a runtime field using this script:
if (doc.containsKey('price') ) {
return Integer.parseInt(doc['price.keyword'].value)
}
but I'm getting this error: Cannot cast from [int] to [void]. What does it actually mean?
Hi. I want to create a runtime field using this script:
if (doc.containsKey('price') ) {
return Integer.parseInt(doc['price.keyword'].value)
}
but I'm getting this error: Cannot cast from [int] to [void]. What does it actually mean?
Hi @kibanauser4
In runtime fields the way to return a value is to call emit( ... )
with the result.
In your case should be:
if (doc.containsKey('price') ) {
emit(Integer.parseInt(doc['price.keyword'].value));
}
This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
© 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.