We have script field stored in file. We need script field to display and also for sorting.
Looks like script is executed two times, one for showing the field in the response and another time for sorting.
Is there any way, we can avoid this execution two times?
i.e run the script one time, use this result for display and sort.
The script is executed two times because it is used within two different contexts within the search. Instead of specifying a sort script, you can use a script score. The score is always returned, so you can use it for display, and it is also the default sort.
@rjernst thanks for the reply..
We are also planning to use that approach..
Only problem is, We have multiple script fields,
Depending on request, we may have sort on one or more script fields
So, checking if there is way to cache the results of script and use it in other place
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.