Hi!!!
I have my data points where I have two fields:
user_id
buy_price
Each user_id can sent several data points(with different buy_price value).
Could you please help to count user_id's, grouped by sum their buy_prices(to 100, from 100 to 200, from 200).
If I understood your problem correctly, you wanted to have buckets based on buy_price and for each bucket count of user_id for this price. Range aggregation should help you here.
Thank's for your response!
Everything right, but it's not what I'm looking for. For example I have several docs:
user_id: Ben buy_price: 50
user_id: Ben buy_price: 100
user_id: Ben buy_price: 100
user_id: Jane buy_price: 50
user_id: Luke buy_price: 250
I need to count sum of their buy_price fields and count how many unique user_id each sum range has.
Response in this case should look like this:
to 100 - 1 (Jane. because sum of all her buys is equal 50)
from 100 to 200 - 0
from 200 - 2(Luke has one doc with price 250 and Ben has 3 docs (100+100+50))
I understand now what you intended to do. Unfortunately, you can not do this in elasticsearch.
This would involve having a pipeline range aggregation, which we have decided not to develop. You can read more here https://github.com/elastic/elasticsearch/issues/17590
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.