I am using a field (_score) that is generated dynamically using a
custom_score query (script + params passed). Would it be possible to sort
on a different field while still calculating this score for the documents
returned? I.e. can a field be generated via a script + params but not be
used to sort the results?
If you are not using _score in your script, you can simply use script fieldshttp://www.elasticsearch.org/guide/reference/api/search/script-fields.html.
It will be even faster since it will be calculated only for the first page
of results instead of all results in your result list. However if you need
the original score in your script, you can add _score as the second sort
order after the field that you actually want to sort on.
On Friday, March 1, 2013 9:13:53 PM UTC-5, Yooz wrote:
Hi,
I am using a field (_score) that is generated dynamically using a
custom_score query (script + params passed). Would it be possible to sort
on a different field while still calculating this score for the documents
returned? I.e. can a field be generated via a script + params but not be
used to sort the results?
Also don't forget to enable track_scores if you are sorting on a field that
is not the score.
--
Ivan
On Fri, Mar 1, 2013 at 7:12 PM, Igor Motov imotov@gmail.com wrote:
If you are not using _score in your script, you can simply use script
fieldshttp://www.elasticsearch.org/guide/reference/api/search/script-fields.html.
It will be even faster since it will be calculated only for the first page
of results instead of all results in your result list. However if you need
the original score in your script, you can add _score as the second sort
order after the field that you actually want to sort on.
On Friday, March 1, 2013 9:13:53 PM UTC-5, Yooz wrote:
Hi,
I am using a field (_score) that is generated dynamically using a
custom_score query (script + params passed). Would it be possible to sort
on a different field while still calculating this score for the documents
returned? I.e. can a field be generated via a script + params but not be
used to sort the results?
On Fri, Mar 1, 2013 at 7:12 PM, Igor Motov <imo...@gmail.com <javascript:>
wrote:
If you are not using _score in your script, you can simply use script
fieldshttp://www.elasticsearch.org/guide/reference/api/search/script-fields.html.
It will be even faster since it will be calculated only for the first page
of results instead of all results in your result list. However if you need
the original score in your script, you can add _score as the second sort
order after the field that you actually want to sort on.
On Friday, March 1, 2013 9:13:53 PM UTC-5, Yooz wrote:
Hi,
I am using a field (_score) that is generated dynamically using a
custom_score query (script + params passed). Would it be possible to sort
on a different field while still calculating this score for the documents
returned? I.e. can a field be generated via a script + params but not be
used to sort the results?
Thanks,
--young
--
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 elasticsearc...@googlegroups.com <javascript:>.
For more options, visit https://groups.google.com/groups/opt_out.
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.