unfortunately the same "issue". The Ranged based Aggregation returns me:
"starRating": { "buckets": [ { "key": "0.0-0.0", "from": 0.0, "from_as_string": "0.0", "to": 0.0, "to_as_string": "0.0", "doc_count": 0 }, { "key": "1.0-1.0", "from": 1.0, "from_as_string": "1.0", "to": 1.0, "to_as_string": "1.0", "doc_count": 0 }, { "key": "2.0-2.0", "from": 2.0, "from_as_string": "2.0", "to": 2.0, "to_as_string": "2.0", "doc_count": 0 }, { "key": "3.0-3.0", "from": 3.0, "from_as_string": "3.0", "to": 3.0, "to_as_string": "3.0", "doc_count": 0 }, { "key": "4.0-4.0", "from": 4.0, "from_as_string": "4.0", "to": 4.0, "to_as_string": "4.0", "doc_count": 0 }, { "key": "5.0-5.0", "from": 5.0, "from_as_string": "5.0", "to": 5.0, "to_as_string": "5.0", "doc_count": 0 } ] } It looks like, that the values are read / indexed "wrong". Whats strange, the filtering by range works. On Monday, April 27, 2015 at 12:52:35 PM UTC+2, deepak.chauhan wrote: > > Besides the Terms filter in aggregation , you should use range aggregation > . > It would work like.. > > { > "aggs": { > stars" : { > "range" : { > "field" : "starRating" , > "ranges": [{ > "to": 5 > }, { > "from": 5, > "to": 10 > }, { > "from": 10, > "to": 15 > }, { > "from": 15 > }] > > } > } > } > > > > > On Mon, Apr 27, 2015 at 4:18 PM, <r...@hubrick.com <javascript:>> wrote: > >> Hey, >> >> I'm a little bit stucked using Terms aggregations on a numeric field. >> >> My schema looks like that: >> >> { ... >> starRating: >> { >> >> - type: "long" >> >> } >> ... >> } >> >> I pass documents there, works fine. >> I query them, using a Range Query like, works also fine: >> >> { >> "range": { >> "starRating": { >> "from": 0, >> "to": 5, >> } >> } >> } >> >> Whenever I ask for Term Aggregations like: >> >> { >> "aggs": { >> stars" : { >> "terms" : { "field" : "starRating" } >> } >> } >> >> OR Facets with >> >> "facets" : { >> "tag" : { >> "terms" : { >> "field" : "starRating" >> } >> } >> } >> >> Strange values are returned: >> >> "facets": { >> "tag": { >> "_type": "terms", >> "missing": 0, >> "total": 3814, >> "other": 0, >> "terms": [ >> { >> "term": 0.0, >> "count": 2397 >> }, >> { >> "term": 1.5E-323, >> "count": 610 >> }, >> { >> "term": 2.0E-323, >> "count": 378 >> }, >> { >> "term": 1.0E-323, >> "count": 269 >> }, >> { >> "term": 4.9E-324, >> "count": 93 >> }, >> { >> "term": 2.5E-323, >> "count": 67 >> } >> ] >> } >> }, >> "aggregations": { >> "stars": { >> "doc_count_error_upper_bound": 0, >> "sum_other_doc_count": 0, >> "buckets": [ >> { >> "key": 0.0, >> "doc_count": 2397 >> }, >> { >> "key": 1.5E-323, >> "doc_count": 610 >> }, >> { >> "key": 2.0E-323, >> "doc_count": 378 >> }, >> { >> "key": 1.0E-323, >> "doc_count": 269 >> }, >> { >> "key": 4.9E-324, >> "doc_count": 93 >> }, >> { >> "key": 2.5E-323, >> "doc_count": 67 >> } >> ] >> } >> } >> >> >> Even in the Java Client, I get DoubleTerms instead of LongTerms. >> >> Does anybody have an Idea, what wents wrong there. I would expect >> Long-Keys and not Double keys (which are basically close to 0) >> The Histogram (with interval of 1) also does not work, everything is >> close to the zero valued key. >> >> >> Cheers, Ralf >> >> >> >> >> -- >> 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/7c604a6a-aaf8-4645-903b-d9472868b1bd%40googlegroups.com >> >> <https://groups.google.com/d/msgid/elasticsearch/7c604a6a-aaf8-4645-903b-d9472868b1bd%40googlegroups.com?utm_medium=email&utm_source=footer> >> . >> For more options, visit https://groups.google.com/d/optout. >> > > -- 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+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/fed3b7c0-782d-424f-9412-ba6816ce7ffc%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.