Facet query issue

I have following data in my index

Action : "added" Product_ID : 123
Action : "added" Product_ID : 124
Action : "removed" Product_ID : 124
Action : "purchased" Product_ID : 123
Action : "added" Product_ID : 123

I want to count number of products added or removed by product_ID wise.
e.g for Product_ID : 123 added = 2 and removed =0.
I can achieve this by firing two separate query for added and removed
respectively using facets.

How can i get above output using single query?

--
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+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/124fbab0-01e9-4b95-9a45-cefdb1b66ce0%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Hey,

you could use term scripts to combine the fields together, see

--Alex

On Tue, Dec 10, 2013 at 9:52 AM, abhi patel abhiage@gmail.com wrote:

I have following data in my index

Action : "added" Product_ID : 123
Action : "added" Product_ID : 124
Action : "removed" Product_ID : 124
Action : "purchased" Product_ID : 123
Action : "added" Product_ID : 123

I want to count number of products added or removed by product_ID wise.
e.g for Product_ID : 123 added = 2 and removed =0.
I can achieve this by firing two separate query for added and removed
respectively using facets.

How can i get above output using single query?

--
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+unsubscribe@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/elasticsearch/124fbab0-01e9-4b95-9a45-cefdb1b66ce0%40googlegroups.com
.
For more options, visit https://groups.google.com/groups/opt_out.

--
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+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/CAGCwEM8AFY6F5%2B_mq4ROQjPyWwR6OS2iGqop02tngwJCeitNzw%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.