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
Post a Comment