Histogram aggregation keys


(RĂ©mi Nonnon) #1

Hi,

I'm working with histogram aggregation but there is something strange with
keys.
For instance (cf :
http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-aggregations-bucket-histogram-aggregation.html):

If I use this request :

{
"aggs" : {
"prices" : {
"histogram" : {
"field" : "price",
"interval" : 50
}
}
}
}

I obtain something like this :

{
"aggregations": {
"prices" : {
"buckets": [
{

                *"key_as_string" : "0",*
                "key": 0,
                "doc_count": 2
            },
            {

                                    *"key_as_string" : "50",*

                "key": 50,
                "doc_count": 4
            },
            {

                                    *"key_as_string" : "150",*

                "key": 150,
                "doc_count": 3
            }
        ]
    }
}

}

Instead of :

{
"aggregations": {
"prices" : {
"buckets": [
{
"key": 0,
"doc_count": 2
},
{
"key": 50,
"doc_count": 4
},
{
"key": 150,
"doc_count": 3
}
]
}
}
}

You could say, it's not important but it generates json ~1/3 bigger...
Is there a mean to disable this ???

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
:http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-aggregations-bucket-histogram-aggregation.html#_response_format)

Thanks!!!

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/47624c50-32d8-4308-b6e5-b07707ad353d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


(system) #2