<p dir="auto">Hi,</p>
<p dir="auto">I'm working with histogram aggregation but there is something strange with keys.<br>
For instance (cf : <a href="http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-aggregations-bucket-histogram-aggregation.html" rel="nofollow">http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-aggregations-bucket-histogram-aggregation.html</a>):</p>
<p dir="auto">If I use this request :<br>
{<br>
"aggs" : {<br>
"prices" : {<br>
"histogram" : {<br>
"field" : "price",<br>
"interval" : 50<br>
}<br>
}<br>
}<br>
}</p>
<p dir="auto">I obtain something like this :<br>
{<br>
"aggregations": {<br>
"prices" : {<br>
"buckets": [<br>
{<br>
"key_as_string" : "0",<br>
"key": 0,<br>
"doc_count": 2<br>
},<br>
{<br>
"key_as_string" : "50",<br>
"key": 50,<br>
"doc_count": 4<br>
},<br>
{<br>
"key_as_string" : "150",<br>
"key": 150,<br>
"doc_count": 3<br>
}<br>
]<br>
}<br>
}<br>
}</p>
<p dir="auto">Instead of :<br>
{<br>
"aggregations": {<br>
"prices" : {<br>
"buckets": [<br>
{<br>
"key": 0,<br>
"doc_count": 2<br>
},<br>
{<br>
"key": 50,<br>
"doc_count": 4<br>
},<br>
{<br>
"key": 150,<br>
"doc_count": 3<br>
}<br>
]<br>
}<br>
}<br>
}</p>
<p dir="auto">You could say, it's not important but it generates json ~1/3 bigger...<br>
Is there a mean to disable this ???</p>
<p dir="auto">Moreover, in Elasticsearch Java API, it could be fine to have a method to request the response as a hash instead keyed by the buckets keys (cf :<a href="http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-aggregations-bucket-histogram-aggregation.html#_response_format" rel="nofollow">http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-aggregations-bucket-histogram-aggregation.html#_response_format</a>)</p>
<p dir="auto">Thanks!!!</p>
<p dir="auto">Version - 1.3.2<br>
Steps to reproduce</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="cat a.json 
{
    &quot;user&quot; : &quot;vm&quot;
}}"><pre class="notranslate"><code class="notranslate">cat a.json 
{
    "user" : "vm"
}}
</code></pre></div>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="curl -XPOST &quot;http://localhost:9200/config/alert&quot; -d @a.json 
{
  &quot;_index&quot;: &quot;config&quot;,
  &quot;_type&quot;: &quot;alert&quot;,
  &quot;_id&quot;: &quot;0_UJFBy3SLOnfwCnS-D_Zg&quot;,
  &quot;_version&quot;: 1,
  &quot;created&quot;: true
}"><pre class="notranslate"><code class="notranslate">curl -XPOST "http://localhost:9200/config/alert" -d @a.json 
{
  "_index": "config",
  "_type": "alert",
  "_id": "0_UJFBy3SLOnfwCnS-D_Zg",
  "_version": 1,
  "created": true
}
</code></pre></div>
<p dir="auto">Impact: Indexing is happening fine but on return the same wrong formatted JSON is returned and its breaking the application reading it as it expects properly formatted JSON string.</p>