Custom_score query + sort by different field possible?

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 elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

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 elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Also don't forget to enable track_scores if you are sorting on a field that
is not the score.

http://www.elasticsearch.org/guide/reference/api/search/sort.html

--
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?

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 elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

--
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 elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Awesome! thanks Ivan & Igor!

On Friday, March 1, 2013 9:40:39 PM UTC-8, Ivan Brusic wrote:

Also don't forget to enable track_scores if you are sorting on a field
that is not the score.

http://www.elasticsearch.org/guide/reference/api/search/sort.html

--
Ivan

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.

--
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 elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.