Elasticsearch Range Aggregation is including upper limit excluding lower limit

I am using the following query:

{
    "aggs": {
    "profiles": {
      "nested": {
        "path": "profiles"
      },
      "aggs": {
        "ctc": {
          "filter": {
            "range": {
              "profiles.current_employment.usd_ctc": {
                "gte": 17266.176,
                "lte": 17266.176
              }
            }
          },
          "aggs": {
            "filtered_aggs": {
              "aggs": {
                "users_count": {
                  "reverse_nested": {}
                }
              },
              "range": {
                "ranges": [
                  {
                    "to": 17266.176,
                    "from": 8633.088
                  },
                  {
                    "to": 25899.264,
                    "from": 17266.176
                  }
                ],
                "field": "profiles.current_employment.usd_ctc"
              }
            }
          }
        }
      }
    }
  }
}

And buckets I am getting:

"aggregations" : {
    "profiles" : {
      "doc_count" : 58457141,
      "ctc" : {
        "doc_count" : 684,
        "filtered_aggs" : {
          "buckets" : [
            {
              "key" : "8633.088-17266.176",
              "from" : 8633.088,
              "to" : 17266.176,
              "doc_count" : 684,
              "users_count" : {
                "doc_count" : 651
              }
            },
            {
              "key" : "17266.176-25899.264",
              "from" : 17266.176,
              "to" : 25899.264,
              "doc_count" : 0,
              "users_count" : {
                "doc_count" : 0
              }
            }
          ]
        }
      }
    }
  }

The first bucket should have 0 count but it is not the case. Please help.

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