Histogram aggregation can start only from divisible by interval value

Here is my code to reproduce this problem:


There is my comment with the result.
The problem is that I can't make histogram start from the value I want.
For instance, I've got a set of values 1..11, I want to start the
histogram from *extended_bounds.min=*7 and group by interval=3. I expect
to get results 7 (3 docs), 10 (2 docs), but actually I get this: 6 (2
docs), 9 (3 docs)
.
As you see the histogram goes only by divisible by interval values (it's
the same if the set is 2..11). There is no related information about this
behaviour in the ES docs.

Is this a bug? How can I solve that problem and accomplish that what I need?

Thank you in advance.

--
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/088d249c-e442-4e2d-8c82-8292a97f40ec%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Hi,

This feature is not supported by the histogram aggregation. Maybe one way
you could achieve the same thing would be by using a script that subtracts
1 from your field values?

On Sun, Dec 21, 2014 at 8:49 PM, Demetrioca 2e3s19@gmail.com wrote:

Here is my code to reproduce this problem:
https://gist.github.com/2e3s/9cab65985d932a060704
There is my comment with the result.
The problem is that I can't make histogram start from the value I want.
For instance, I've got a set of values 1..11, I want to start the
histogram from *extended_bounds.min=*7 and group by interval=3. I
expect to get results 7 (3 docs), 10 (2 docs), but actually I get this: 6
(2 docs), 9 (3 docs)
.
As you see the histogram goes only by divisible by interval values (it's
the same if the set is 2..11). There is no related information about this
behaviour in the ES docs.

Is this a bug? How can I solve that problem and accomplish that what I
need?

Thank you in advance.

--
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/088d249c-e442-4e2d-8c82-8292a97f40ec%40googlegroups.com
https://groups.google.com/d/msgid/elasticsearch/088d249c-e442-4e2d-8c82-8292a97f40ec%40googlegroups.com?utm_medium=email&utm_source=footer
.
For more options, visit https://groups.google.com/d/optout.

--
Adrien Grand

--
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/CAL6Z4j5PGDcACULku7%3DbFLGCcg4sfzjF4nPurVPh-egrOg59AQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

That's not good, I wonder if it can be improved in the next versions.
Thanks anyway, it works with *script *(added to the github gist):

curl -XPOST "http://localhost:9200/divisible/divisible/_search?pretty=true&search_type=count" -d '
{
"query":{
"range": {"value": {"gte": 7}}
},
"aggregations": {
"rows": {
"histogram": {
"field": "value",
"interval": 3,
"script": "_value-1",
"lang":"groovy",
"min_doc_count": 0,
"extended_bounds": { "min": 7 }
}
}
}
}
'

The result appears to be expected, I need only add +1 (remainder from the
start value divided by interval) to the aggregated keys in my code.
If histogram aggregation would support value transformation for histogram
aggregation it would even look like the aggregation supports what I need.

On Monday, December 22, 2014 3:29:00 AM UTC+6, Adrien Grand wrote:

Hi,

This feature is not supported by the histogram aggregation. Maybe one way
you could achieve the same thing would be by using a script that subtracts
1 from your field values?

On Sun, Dec 21, 2014 at 8:49 PM, Demetrioca <2e3...@gmail.com
<javascript:>> wrote:

Here is my code to reproduce this problem:
https://gist.github.com/2e3s/9cab65985d932a060704
There is my comment with the result.
The problem is that I can't make histogram start from the value I want.
For instance, I've got a set of values 1..11, I want to start the
histogram from *extended_bounds.min=*7 and group by interval=3. I
expect to get results 7 (3 docs), 10 (2 docs), but actually I get
this: 6 (2 docs), 9 (3 docs).
As you see the histogram goes only by divisible by interval values (it's
the same if the set is 2..11). There is no related information about this
behaviour in the ES docs.

Is this a bug? How can I solve that problem and accomplish that what I
need?

Thank you in advance.

--
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 elasticsearc...@googlegroups.com <javascript:>.
To view this discussion on the web visit
https://groups.google.com/d/msgid/elasticsearch/088d249c-e442-4e2d-8c82-8292a97f40ec%40googlegroups.com
https://groups.google.com/d/msgid/elasticsearch/088d249c-e442-4e2d-8c82-8292a97f40ec%40googlegroups.com?utm_medium=email&utm_source=footer
.
For more options, visit https://groups.google.com/d/optout.

--
Adrien Grand

--
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/742f5293-c3c8-47b2-a616-54c80b932250%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.