<p dir="auto">I have a problem with consistency of ES sorting. When I order for example by date, ES gives different orderings from one query to another because of duplicate dates. To fix this we usually perform sorting by date + sorting by _id, which meant to be unique, but it isn't. Sorting by _id field only acts the same, it is bouncing. We have config of ES 1.4.1, 1 shard + 1 replica per index. When I disable replica it seems that sorting bouncing stops.</p>
<p dir="auto"><strong>Elasticsearch version</strong>:<br>
2.3.1</p>
<p dir="auto"><strong>Description of the problem including expected versus actual behavior</strong>:<br>
This is similar to <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="120870471" data-permission-text="Title is private" data-url="https://github.com/elastic/elasticsearch/issues/15291" data-hovercard-type="issue" data-hovercard-url="/elastic/elasticsearch/issues/15291/hovercard" href="https://github.com/elastic/elasticsearch/issues/15291">#15291</a> but still happens with version 2.3.1 on slightly different circumstances. In the previous issue the field was a string, now it's an array.</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="POST /test_index
{
   &quot;settings&quot;: {
      &quot;number_of_shards&quot;: 1,
      &quot;number_of_replicas&quot;: 0
   },
       &quot;mappings&quot; : {
        &quot;file&quot; : { }
        }
    }
}

POST /test_index/file
{
   &quot;texts&quot;: [
      &quot;quick brown fox here.&quot;,
      &quot;just a fox&quot;
   ]
}

POST /test_index/file/_search
{
   &quot;query&quot;: {
      &quot;match_phrase&quot;: {
         &quot;text&quot;: &quot;quick brown fox&quot;
      }
   },
   &quot;highlight&quot;: {
      &quot;fields&quot;: {
         &quot;text&quot;: {
            &quot;number_of_fragments&quot;: 0
         }
      }
   }
}"><pre class="notranslate"><code class="notranslate">POST /test_index
{
   "settings": {
      "number_of_shards": 1,
      "number_of_replicas": 0
   },
       "mappings" : {
        "file" : { }
        }
    }
}

POST /test_index/file
{
   "texts": [
      "quick brown fox here.",
      "just a fox"
   ]
}

POST /test_index/file/_search
{
   "query": {
      "match_phrase": {
         "text": "quick brown fox"
      }
   },
   "highlight": {
      "fields": {
         "text": {
            "number_of_fragments": 0
         }
      }
   }
}
</code></pre></div>
<p dir="auto">I expect to get a single highlighted fragment from the first string in the array, but instead I get</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="   &quot;hits&quot; : [ {                                                                                 
     &quot;_index&quot; : &quot;test_index&quot;,                                                                   
     &quot;_type&quot; : &quot;file&quot;,                                                                          
     &quot;_id&quot; : &quot;AVRcVPVIk4eDYtUZXTb8&quot;,                                                            
     &quot;_score&quot; : 0.34520942,                                                                     
     &quot;_source&quot; : {                                                                              
       &quot;texts&quot; : [ &quot;quick brown fox here.&quot;, &quot;just a fox&quot; ]                                      
     },                                                                                         
     &quot;highlight&quot; : {                                                                            
       &quot;texts&quot; : [ &quot;&lt;em&gt;quick&lt;/em&gt; &lt;em&gt;brown&lt;/em&gt; &lt;em&gt;fox&lt;/em&gt; here.&quot;, &quot;just a &lt;em&gt;fox&lt;/em&gt;&quot; ]  
     }                                                                                          
   } ]                                                                                          "><pre class="notranslate"><code class="notranslate">   "hits" : [ {                                                                                 
     "_index" : "test_index",                                                                   
     "_type" : "file",                                                                          
     "_id" : "AVRcVPVIk4eDYtUZXTb8",                                                            
     "_score" : 0.34520942,                                                                     
     "_source" : {                                                                              
       "texts" : [ "quick brown fox here.", "just a fox" ]                                      
     },                                                                                         
     "highlight" : {                                                                            
       "texts" : [ "&lt;em&gt;quick&lt;/em&gt; &lt;em&gt;brown&lt;/em&gt; &lt;em&gt;fox&lt;/em&gt; here.", "just a &lt;em&gt;fox&lt;/em&gt;" ]  
     }                                                                                          
   } ]                                                                                          
</code></pre></div>
<p dir="auto">The separate fox is also highlighted even though it doesn't actually match.</p>