Monday, 15 June 2015

Elasticsearch Facets Count returns different results -



Elasticsearch Facets Count returns different results -

i have interesting issue, when run request wa state

{ "query":{"bool":{"must":[ {"query_string":{"default_field":"state","query":"\"**wa**\""}}],"must_not": [],"should":[]}},"from":0,"size":10,"sort":[], "facets":{ "states" : { "terms" : { "field" : "state" } } } }

result

"facets": { "states": { "_type": "terms", "missing": 0, "total": 78201, "other": 0, "terms": [ { "term": "wa", "count": 78201 } ] }

but if run request all states

{ "query":{ "bool":{"must":[{"match_all":{}}],"must_not":[],"should":[]}},"from":0,"size":1,"sort":[], "facets":{ "states" : { "terms" : { "field" : "state" } } } }

return less count wa, expected have same number query before

"facets": { "states": { "_type": "terms", "missing": 209814, "total": 2549592, "other": 1200206, "terms": [ { "term": "ca", "count": 305780 }, { "term": "mi", "count": 185574 }, { "term": "fl", "count": 160341 }, { "term": "tn", "count": 135670 }, { "term": "il", "count": 132751 }, { "term": "tx", "count": 113359 }, { "term": "oh", "count": 98598 }, { "term": "pa", "count": 84601 }, { "term": "co", "count": 79796 }, { "term": "wa", "count": 52916 } ] } } }

so, how elasticsearch facets work?

thanks always

elasticsearch facets

No comments:

Post a Comment