How to set "search_type" to "count" in elasticsearch-rails? -


here's query i'd working elasticsearch-rails. (the query works in sense). goal return buckets items have person name begins letter b. first stumbling block can't figure out how specify search_type should set count.

get _search?search_type=count {         "query": {         "prefix": {            "person": "b"         }    },     "aggs" : {         "facets" : {             "terms" : {                 "field" : "person",                 "size" : 0,                 "order" : { "_term" : "asc" }             }         }     } } 

according this issue, doesn't seem supported yet.

an alternative works setting size: 0 in query, this:

{         "size": 0,                    <--- add     "query": {         "prefix": {            "person": "b"         }    },     "aggs" : {         "facets" : {             "terms" : {                 "field" : "person",                 "size" : 0,                 "order" : { "_term" : "asc" }             }         }     } } 

it worth noting, though, search_type=count going deprecated is deprecated in es 2.0 , recommendation set size: 0 in query mentioned above. doing make es 2.0-compliant... @ least query, :)


Comments

Popular posts from this blog

php - Admin SDK -- get information about the group -

dns - How To Use Custom Nameserver On Free Cloudflare? -

Python Error - TypeError: input expected at most 1 arguments, got 3 -