<p dir="auto">The desire average would be 38/4 = 9.5.</p>
<p dir="auto">POST /sports/athlete/13<br>
{"name":"john","rating": ["8", "10"]}<br>
POST /sports/athlete/14<br>
{"name":"john","rating": ["10", "10"]}</p>
<p dir="auto">POST /sports/athlete/_search<br>
{<br>
"size": 0,<br>
"aggregations": {<br>
"the_name": {<br>
"terms": {<br>
"field": "name",<br>
"order": {<br>
"rating_avg": "desc"<br>
}<br>
},<br>
"aggregations": {<br>
"rating_avg": {<br>
"avg": {<br>
"field": "rating"<br>
}<br>
}<br>
}<br>
}<br>
}<br>
}</p>
<p dir="auto">However the query return a value of 9.3333, which is 28/3. The duplicated value in a doc has been ignored.</p>
<p dir="auto"><strong>Description of the problem including expected versus actual behavior</strong>:<br>
On Elasticsearch 2.2.1, when loading some geojson shapes into a field indexed with:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="&quot;location&quot;: {&quot;type&quot;: &quot;geo_shape&quot;, &quot;precision&quot;: &quot;1600m&quot;}"><pre class="notranslate"><code class="notranslate">"location": {"type": "geo_shape", "precision": "1600m"}
</code></pre></div>
<p dir="auto">Throws the following error:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="Provided shape has duplicate consecutive coordinates at: (180.0, -90.0, NaN)"><pre class="notranslate"><code class="notranslate">Provided shape has duplicate consecutive coordinates at: (180.0, -90.0, NaN)
</code></pre></div>
<p dir="auto">I believe the geojson is valid and should load fine.</p>
<p dir="auto"><strong>Steps to reproduce</strong>:</p>
<ol dir="auto">
<li>Load the 'geometry' field of this <a href="https://github.com/elastic/elasticsearch/files/195473/Antarctica.txt">json blob of Antarctica</a> into a geoshape index</li>
</ol>
<p dir="auto">This is a reprise of <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="110380740" data-permission-text="Title is private" data-url="https://github.com/elastic/elasticsearch/issues/14014" data-hovercard-type="issue" data-hovercard-url="/elastic/elasticsearch/issues/14014/hovercard" href="https://github.com/elastic/elasticsearch/issues/14014">#14014</a> but with more details included. I agree with the analysis in that ticket by <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/danni/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/danni">@danni</a> that this is a artefact of the shape being simplified before being indexed - the 'duplicate consecutive coordinates' being referred to in the error quite simply don't appear even once in the original data.</p>