Conditional Sorting


(alkaruzi) #1

I have some documents that I would like to sort on a date field. For
documents with date equal to a specified date, example today, and all dates
after that I would like to sort ascending. For dates before the specified
date I would like to sort in descending order.

Is this possible in ElasticSearch? If so could you suggest any literature
or approach.

Thanks

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


(David Pilato) #2

I think I'd use in that case a custom score: http://www.elasticsearch.org/guide/reference/query-dsl/custom-score-query/

Does it help?

--
David :wink:
Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs

Le 23 sept. 2013 à 02:13, Javid Al Karuzi scorpitar@gmail.com a écrit :

I have some documents that I would like to sort on a date field. For documents with date equal to a specified date, example today, and all dates after that I would like to sort ascending. For dates before the specified date I would like to sort in descending order.

Is this possible in ElasticSearch? If so could you suggest any literature or approach.

Thanks

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.


(system) #3