title: Result order in Spring Data Elasticsearch @Query
body: <p>This is Spring Boot Data Elasticsearch (Embedded Elasticsearch).</p>
  
  <p>I have a simple query:</p>
  
  <pre><code>{
    "query": {
      "match_phrase" : {
        "text" : "12"
      }
    }
  }
  </code></pre>
  
  <p>And when I send this query via localhost:9200 there's an answer:</p>
  
  <pre><code>{
    "took": 56, "timed_out": false,
    "_shards": {"total": 1, "successful": 1, "failed": 0 },
    "hits": {
      "total": 5,
      "max_score": 0.3172162,
      "hits": [
       {
         "_index": "abc", "_type": "abc", "_id": "AWbzvDOghegm62vg48M5",
         "_score": 0.3172162,
         "_source": {
           "entityId": "5840", "text": "abc"
         }
       },
       {
         "_score": 0.3172162,
         "_source": {"entityId": "5838"}
       },
       {
         "_score": 0.3172162,
         "_source": {"entityId": "5834"}
       },
       {
         "_score": 0.26434684,
         "_source": {"entityId": "5850"}
       },
       {
         "_score": 0.26434684,
         "_source": {"entityId": "5846"}
       }
       ]
     }
   }
  </code></pre>
  
  <p>Everything is OK.</p>
  
  <p>In project I have a Data ElasticsearchRepository:</p>
  
  <pre><code>public interface MyESEntityRepository extends ElasticsearchRepository&lt;MyESEntity, String&gt; {
      @Query("same ES query")
      List&lt;MyESEntity&gt; find(String q);
  }
  </code></pre>
  
  <p>And here my problem: I sand the same query and receive same set but in a different order.</p>
  
  <p>Through 9200 I receive next ordered by <code>_score</code> set with <code>entityId</code>: <code>5840</code> <code>5838</code> <code>5834</code> <code>5850</code> <code>5846</code>.</p>
  
  <p>ES Data Repository return: <code>5850</code> <code>5846</code> <code>5840</code> <code>5838</code> <code>5834</code>. Thus, in this example, it looks as if it is a desc order by entityId. However, in a real query, something is different. Perhaps this is the order of time modification.</p>
  
  <p>How to get order by <code>_score</code>?</p>
  
  <p><hr/>
  With <code>Pageable</code> same effect:</p>
  
  <pre><code>Page&lt;MyESEntity&gt; find(String q, Pageable pageable);
  </code></pre>
  
  <p>and</p>
  
  <pre><code>find("12", new PageRequest(0, 10, new Sort(new Sort.Order(Sort.Direction.DESC,"_score")))).getContent();
  </code></pre>