Friday, 15 August 2014

elasticsearch: find the newest elements, return "asc" -



elasticsearch: find the newest elements, return "asc" -

using elasticsearch in go, need search newest lastly x elements, ordered time.

i think having accomplish goal:

"query": {"constant_score": {}}, "sort": {"time": {"order": "desc"}}, "size": x

however, homecoming newest elements in reverse order, wouldn't it?

is there way homecoming newest x elements in ascending order?

this request give oldest elements matching query.

to accomplish goal, create count query (ordering not needed) , desc sorted request start parameter set count-x. solution ugly , inefficient.

you'd lot improve off desc sorting results in go app.

elasticsearch

No comments:

Post a Comment