Here's the query I'd like to get working with elasticsearch-rails. (The query works in Sense). My goal is to return all the buckets for items that have a person whose name begins with the letter B. My first stumbling block is that I can't figure out how to specify that the search_type should be set to count.
GET _search?search_type=count
{
"query": {
"prefix": {
"person": "B"
}
},
"aggs" : {
"facets" : {
"terms" : {
"field" : "person",
"size" : 0,
"order" : { "_term" : "asc" }
}
}
}
}