Consider following schema for document { user_name : string, tweet : string }. Now when search query is fired result should be sorted in such a way that tweets of certain user_name should appear on top while rest of the tweets at bottom.
Best use-case would of Soundcloud. When a user starts searching, sounds or users which he/she follows appear at top while rest of the content at bottom.
Is there any way to do this in elasticsearch?
Note: If you are able to answer it using tire gem then it would be great otherwise only logic is also acceptable.
You can push certain results to the top using Custom Filters Score query. Just add user_name:certain_name as a filter with high enough boost.