Strange boundary of extended_bounds in histogram aggregation


(Tian Xiaochen) #1

I have the histogram query like following:

curl -XPOST 'localhost:9200/myindex/data/_search?pretty' -H 'Content-Type: application/json' -d'
{
  "query" : {
    "bool" : {
      "must" : [ {
        "term" : {
          "s" : 123
        }
      }, {
        "range" : {
          "t" : {
            "gte" : 0,
            "lt" : 100
          }
        }
      } ]
    }
  },
  "aggs" : {
    "agg1" : {
      "histogram" : {
        "field" : "t",
        "min_doc_count" : 0,
        "interval" : 100,
        "offset" : 10,
        "extended_bounds" : {
          "min" : 0,
          "max" : 100
        }
      },
      "aggs" : {
        "sum" : {
          "sum" : {
            "field" : "v"
          }
        }
      }
    }
  },
  "size" : 0
}
'

However the response give the following return value, please notice the first "key" is -90, which is out of [0,100]. [0,100] is the extended_bound I define in the query. I wonder how elasticsearch handle extended_bound when I specify offset.

{
  "took" : 3,
  "timed_out" : false,
  "_shards" : {
    "total" : 5,
    "successful" : 5,
    "skipped" : 0,
    "failed" : 0
  },
  "hits" : {
    "total" : 0,
    "max_score" : 0.0,
    "hits" : [ ]
  },
  "aggregations" : {
    "agg1" : {
      "buckets" : [
        {
          "key" : -90.0,
          "doc_count" : 0,
          "sum" : {
            "value" : 0.0
          }
        },
        {
          "key" : 10.0,
          "doc_count" : 0,
          "sum" : {
            "value" : 0.0
          }
        }
      ]
    }
  }
}

(system) #2

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