Count, Aggregation, Frequency: Bit Stumped

Hi,
Wonder if anyone can help?

I have the following query:

{
"from": 0,
"sort": [
"_score"
],
"fields": [
"id",
"title",
"text"
],
"query": {
"query_string": {
"fields": [
"title",
"text"
],
"query": "("green socks" OR "red socks") AND NOT ("yellow" OR
"blue")"
}
},
"size": 100
}

This works fine and is great. What I would like to do now though, is take
the documents identified by this query, and retrieve the number of
documents that contained "green socks", and the number that contained "red
socks".

So, essentially apply an aggregation (I think) to the articles identified
by the "query": "("green socks" OR "red socks") AND NOT ("yellow" OR
"blue")" query.

If this is an aggregation, what kind of aggregation is it?
If it isn't, what kind of query should I run?

To be clear, what i'm looking for, is at the end of whatever I query I run
I end up with:

"green socks": 10,
"red socks": 13,

where 10 and 13 are the number of documents in the "("green socks" OR
"red socks") AND NOT ("yellow" OR "blue")" result set that contain
"green socks" at least once, and "red socks" at least once (respectively).

Any help v gratefully received,

Thanks,
R

--
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/f2731846-7536-44ab-9df6-808a5b0f1c34%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.