Hi,

I am working on elasticsearch for last 2 months. It is really providing 
awesome searching capabilities, good json structure documents etc...
Currently I am stuck up with the problem on How to write group by query and 
get the data.

Ex:- In this example company, prod_type are defined as 'not_analyzed'

Example Documents:

{"company":"ABC","orders":[{"order_no":"OL1", "prod_type" : "OLP", 
"price":20}, {"order_no":"OL2", "prod_type" : "OLP", "price":50}, 
{"order_no":"OL3", "prod_type" : "GLP", "price":100} ]}

{"company":"XYZ","orders":[{"order_no":"OL10", "prod_type" : "GLP", 
"price":50}, {"order_no":"OL20", "prod_type" : "OLP", "price":80}, 
{"order_no":"OL30", "prod_type" : "GLP", "price":100} ]}


My Requirement: I want the elasticsearch query to get the count, sum(price) 
based on prod_type
SQL Comparision Qry: SELECT COUNT(*), SUM(PRICE) FROM TABLE_NAME GROUP BY 
PROD_TYPE


Can anyone please help me this? 

Please let me know if you need more information.


Thanks,
Samanth

-- 
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 elasticsearch+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elasticsearch/227ad9cc-0327-48de-9df9-bc0c159d9250%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to