Range aggrigation problem ES 5.2

Hi,
I have a problem with range aggrigation.
this is my query :

{
  "query": { ... },
  "aggs": {
    "location_bulks": {
      "range": {
        "field": "lc",
        "ranges": [
          {
            "from": 98210000,
            "to": 98219999
          }
        ]
      },
      "aggs": {
        "locations_range": {
          "histogram": {
            "field": "lc",
            "interval": 1000,
            "min_doc_count": 1,
            "order": {
              "_count": "desc"
            }
          }
        }
      }
    }
  }
}

but in the aggrigation results there is some bucket out of range values. is it a bug?

{
  "took": 11,
  "timed_out": false,
  "_shards": {
    "total": 5,
    "successful": 5,
    "failed": 0
  },
  "hits": { ... },
  "aggregations": {
    "location_bulks": {
      "buckets": [
        {
          "key": "9.821E7-9.8219999E7",
          "from": 98210000,
          "to": 98219999,
          "doc_count": 12026,
          "locations_range": {
            "buckets": [
              {
                "key": 98210000,
                "doc_count": 3639
              },
              {
                "key": 98212000,
                "doc_count": 2014
              },
              {
                "key": 98218000,
                "doc_count": 1997
              },
              {
                "key": 98313000,   // <==== out of range
                "doc_count": 11
              },
              {
                "key": 98263000,  // <==== out of range
                "doc_count": 10
              },
              {
                "key": 98260000,  // <==== out of range
                "doc_count": 9
              },
              {
                "key": 98708000,  // <==== out of range
                "doc_count": 8
              },
              {
                "key": 98211000,  // <==== out of range
                "doc_count": 7
              },
            ]
          }
        }
      ]
    }
  }
}

What is the mapping for this field?

mapping:

"lc" : {
    "type" : "long"
}

@jpountz does this ring a bell?
Precision issue with longs?

I find out a document that has two lc (lc is name of field that I aggregated) value. (one of them in range and one of them out of range)

"lc": [
        98210000,
        98260000
      ]

Ha! That explains then...

How can I only get doc_count of in range values?
is there from and to for histogram aggregation?

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.