Aggregation Range

Hi,
I have used range aggregation query to hit only those document whose amount is greater than or equal to 1000
But it also gives me those doc with amount less than 1000.
Is there any alternative query to get amount greater than 1000
or Am I doing some mistake in my query.
They query I fired is as follows,
{
"aggs" : {
"rate_ranges" : {
"range" : {
"field" : "amount",
"ranges" : [
{ "from" : 1000.0 }
]
}
}
}
}

It seems like you have confused aggregations with queries.

Queries define the set of documents that should be matched while aggregations define how those matching documents should be grouped into buckets or otherwise summarised.

You need a query expression with a range

{
  "query": {
	"range": {
	  "amount": {
		"gte": 1000
	  }
	}
  }
}
1 Like

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