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.

Example Data:
*ID      |  Name  |    Price*
1        |  Chair   |   5.99
2        |  Chair   |   5.99
3        |  Chair   |   59.99
4        |  Desk   |   61.00
5        |  Desk   |   60.00
6        |  Desk   |   59.99

The top response would be ID 3, since 59.99 is way higher than the average 
price for a chair.

I believe I need to write a custom score script, but I am not sure how I 
can get a reference to the average of items with the same name.

Thank you,
Kevin

-- 
You received this message because you are subscribed to the Google Groups 
"elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elasticsearch/8069763d-9ce2-4dfc-afc5-6293c2171828%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to