Getting recent searched result

Hi guys. I'm pretty new with elasticsearch. How do I write a query to get results of most recent searched documents and sorted. For example if I used to search that specific document, when I come back and search it again, it will be always at the top of the result list.

Welcome!

Elasticsearch does not provide such a feature as it does not recall which documents have been served in the past or what the user selected at the end.

You probably have to implement something like this "manually". Using pinned query might help.