curl - elasticsearch: wrong count in terms facet -
not sure if bug or missing something. terms facet returning wrong count number of terms.
i have field have str_tag_analyzer
.
i want tag cloud from field. want top 20 tags along count (how many times appeared).
terms facet looked solution case. have understanding size parameter in terms facet query controls how many tags returned.
when run term facet query different size, unexpected result. here few of queries , result.
query 1
curl -xget 'http://server:9200/stage_profiles/wrapper_0/_search?pretty=1' -d ' { query : { "nested" : { "query" : { "field" : { "gsid" : 222 } }, "path" : "medals" } }, from: 0, size: 0 , facets: { "tags" : { "terms" : {"field" : "field_val_t", size: 1} } } }' { "took" : 1, "timed_out" : false, "_shards" : { "total" : 3, "successful" : 3, "failed" : 0 }, "hits" : { "total" : 189, "max_score" : 1.0, "hits" : [ ] }, "facets" : { "tags" : { "_type" : "terms", "missing" : 57, "total" : 331, "other" : 316, "terms" : [ { "term" : "hyderabad", "count" : 15 } ] } }
query 2
curl -xget 'http://server:9200/stage_profiles/wrapper_0/_search?pretty=1' -d ' { query : { "nested" : { "query" : { "field" : { "gsid" : 222 } }, "path" : "medals" } }, from: 0, size: 0 , facets: { "tags" : { "terms" : {"field" : "field_val_t", size: 3} } } }' { "took" : 1, "timed_out" : false, "_shards" : { "total" : 3, "successful" : 3, "failed" : 0 }, "hits" : { "total" : 189, "max_score" : 1.0, "hits" : [ ] }, "facets" : { "tags" : { "_type" : "terms", "missing" : 57, "total" : 331, "other" : 282, "terms" : [ { "term" : "playing", "count" : 20 }, { "term" : "hyderabad", "count" : 15 }, { "term" : "pune", "count" : 14 } ] } } }
query 3
curl -xget 'http://server:9200/stage_profiles/wrapper_0/_search?pretty=1' -d ' { query : { "nested" : { "query" : { "field" : { "gsid" : 222 } }, "path" : "medals" } }, from: 0, size: 0 , facets: { "tags" : { "terms" : {"field" : "field_val_t", size: 10} } } }' { "took" : 1, "timed_out" : false, "_shards" : { "total" : 3, "successful" : 3, "failed" : 0 }, "hits" : { "total" : 189, "max_score" : 1.0, "hits" : [ ] }, "facets" : { "tags" : { "_type" : "terms", "missing" : 57, "total" : 331, "other" : 198, "terms" : [ { "term" : "playing", "count" : 20 }, { "term" : "hyderabad", "count" : 19 }, { "term" : "bangalore", "count" : 18 }, { "term" : "pune", "count" : 16 }, { "term" : "chennai", "count" : 16 }, { "term" : "games", "count" : 13 }, { "term" : "testing", "count" : 11 }, { "term" : "cricket", "count" : 9 }, { "term" : "singing", "count" : 6 }, { "term" : "movies", "count" : 5 } ] } } }
i have following concerns 1. first query giving tag count of 15, there exists tag count 20 (that can seen in query 2 , 3). must return "playing" tag count 20. 2. 2nd query returns count of "hyderabad" tag 15 3rd query returns count 19 same tag.
please let me know if need other info such mapping, data present in es.
it's known issue. workaround use single shard or ask more terms intend display.
Comments
Post a Comment