I think sorting on boolean should work.

If you can't make it working, you could also use function_score to "boost" 
expires:true vs expires:false.

HTH 

--
David ;-)
Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs

> Le 5 janv. 2015 à 23:09, mba...@trunkclub.com a écrit :
> 
> I would like to sort the results of a query such that all of the records with 
> a value of true in the expires field will be at the top. I am not using 
> relevance for sorting. I tried adding this as a sort, but it doesn't seem to 
> work with either sorting order: { expires: { order: "desc" } }
> 
> All of the records are in the result but they aren't sorted. Is there a 
> different way I should be going about this?
> 
> For reference, here is my entire query:
> 
> {
>   "query": {
>     "match_all": {
>     }
>   },
>   "size": 50,
>   "from": 0,
>   "fields": [
>     "id"
>   ],
>   "sort": [
>     {
>       "expires": {
>         "order": "desc"
>       }
>     }
>   ]
> }
> -- 
> 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+unsubscr...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/elasticsearch/0bfc5579-8855-44a8-97e3-58ede3bb10d4%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elasticsearch/BB982DA5-E7BF-4E23-AC76-CDC2C10CDE7B%40pilato.fr.
For more options, visit https://groups.google.com/d/optout.

Reply via email to