Using elasticsearch, I would like to get the histogram face for the price field in my model. Without knowing the minimum and maximum prices in advance, I would like the histogram to cover the entire price range with a given number of intervals, say 10. I can see from the documentation in
http://www.elasticsearch.org/guide/reference/api/search/facets/histogram-facet.html
that I can specify a price range for each interval, but that will give me some indefinite number of intervals. I would like to have a certain number of intervals that uniformly cover the entire range of values ββfor the price field. Is there any way to do this?
I know that one solution would be to query my database for min and max values ββand then figure out the size of the corresponding interval, but this contradicts one of the main points of using elasticsearch, which should not hit db for search related queries.
source
share