you could execute a query, sorted by price and in the same request execute
a statistical facet for the price field and then check in your client for
each hit being returned, if it is above the average value returned by the
statistical facet.
You could also do this in two roundtrips, getting the statistical average
from the facet first and then executing a second query filtering only for
products with a price higher than the average.
Thank you Alexander. The first possibility is what we ended up doing for
now. We plan on looking into the aggregations framework as a replacement
once we upgrade to elasticsearch 1.0 so we don't need to return thousands
of documents to the client.
Thank you.
On Monday, January 20, 2014 1:19:08 AM UTC-8, Alexander Reelsen wrote:
Hey,
you could execute a query, sorted by price and in the same request execute
a statistical facet for the price field and then check in your client for
each hit being returned, if it is above the average value returned by the
statistical facet.
You could also do this in two roundtrips, getting the statistical average
from the facet first and then executing a second query filtering only for
products with a price higher than the average.
--Alex
On Fri, Jan 17, 2014 at 12:43 AM, Kevin Pearson <kevin.p...@gmail.com<javascript:>
wrote:
I am wondering if there is a way to use aggregated values inside a query.
Example:
Say our data contains items and their price:
{
"id" : string
"name" : string
"price" : float
}
I want to do a query that returns the top items that have a price far
from the average price of items with the same name.
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.