Finding the min and max value for a float/double field


(Enrique Medina Montenegro) #1

Hi,

What would the best way to get the MAX/MIN values for a specific field in a
search?

For instance, I'm indexing products, and they have an amount field, and when
I search for anything, I want to get the MAX/MIN amount for all the results,
so I can show a slider where the user can filter again the results based on
a range [MIN..MAX] of the amount.

Example: I search for "iPhone", and I get 12456 results. I'd like to get
also which is the MIN and the MAX amount for those results; let's say it's
$200 and $900, respectively.

Thanks.


(Clinton Gormley) #2

Hi Enrique

What would the best way to get the MAX/MIN values for a specific field
in a search?

http://www.elasticsearch.org/guide/reference/api/search/facets/statistical-facet.html

clint


(Enrique Medina Montenegro) #3

Thanks, everything's so easy in ES :slight_smile:

On Mon, Feb 14, 2011 at 4:23 PM, Clinton Gormley clinton@iannounce.co.ukwrote:

Hi Enrique

What would the best way to get the MAX/MIN values for a specific field
in a search?

http://www.elasticsearch.org/guide/reference/api/search/facets/statistical-facet.html

clint


(system) #4