I am trying to do a terms filter query to get the number of documents I have for each domain in a list of domains:
GET /myindex/_count
{
"query": {
"filtered": {
"filter": {
"terms": {
"domain": ["w3.org"]
}
}
}
}
}
Returns 25. I have a list of a couple thousand domains and would like to do this all in 1 query. Is that possible? I've tried:
GET /myindex/_count
{
"query": {
"bool": {
"must": {
"terms": {
"domain": [
"w3.org",
"google.com",
...,
]
}
}
}
}
}
but that gives me 1 number (whereas I need them broken down by each domain), e.g.:
w3.org: 25,
google.com: 143,
...