Search results page is changing the sort order incorrectly/arbitrarily
Problem
When rendering the search results page something is changing the order arbitrarily (likely due to how it's loaded out of order from Postgres).
What this means is that when you see a page of results the results are out of order in the context of that page and therefore the best result is not first in the list.
This could mean users often don't see the best result first and may miss it.
Example
When loading this search the first result by relevance is not shown at the top. It should be !195764 which clearly matches the best.
From the rails console I was able to see the sorting is getting messed up when doing the Postgres queries to load the data:
user = User.find_by_username("DylanGriffith")
query = "elasticsearch storage analysis"
project = Project.find_by_full_path("gitlab-org/gitlab")
search_results = Gitlab::Elastic::ProjectSearchResults.new(user, query, project)
search_results.send(:issues).first.title
=> "Analysis of where our Elasticsearch storage is mostly used"
search_results.objects('issues').first.title
=> "Extract EE specific files/lines for configuration files"
Solution
Ensure we retain the same order that comes back from Elasticsearch since these are sorted by relevance.