Created
June 14, 2011 11:52
-
-
Save dadoonet/1024756 to your computer and use it in GitHub Desktop.
ES Terms Facet send back bad count results
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Dropping index and Creating articles | |
curl -X DELETE "http://localhost:9200/articles" | |
curl -X POST "http://localhost:9200/articles/article" -d '{"tags" : ["one", "two", "three", "four", "five", "six", "seven"]}' | |
curl -X POST "http://localhost:9200/articles/article" -d '{"tags" : ["two", "three", "four", "five", "six", "seven"]}' | |
curl -X POST "http://localhost:9200/articles/article" -d '{"tags" : ["three", "four", "five", "six", "seven"]}' | |
curl -X POST "http://localhost:9200/articles/article" -d '{"tags" : ["four", "five", "six", "seven"]}' | |
curl -X POST "http://localhost:9200/articles/article" -d '{"tags" : ["five", "six", "seven"]}' | |
curl -X POST "http://localhost:9200/articles/article" -d '{"tags" : ["six", "seven"]}' | |
curl -X POST "http://localhost:9200/articles/article" -d '{"tags" : ["seven"]}' | |
# Classic search with terms facet | |
curl -X POST "http://localhost:9200/articles/_search?pretty=true" -d ' | |
{ | |
"query" : { "match_all" : { } }, | |
"facets" : { | |
"f_tags" : { "terms" : {"field" : "tags"} } | |
} | |
} | |
' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"took" : 0, | |
"timed_out" : false, | |
"_shards" : { | |
"total" : 5, | |
"successful" : 5, | |
"failed" : 0 | |
}, | |
"hits" : { | |
"total" : 7, | |
"max_score" : 1.0, | |
"hits" : [ { | |
"_index" : "articles", | |
"_type" : "article", | |
"_id" : "gkgAyLN6QWuxSyBLxxknIw", | |
"_score" : 1.0, "_source" : {"tags":["two","three","four","five","six","seven"]} | |
}, { | |
"_index" : "articles", | |
"_type" : "article", | |
"_id" : "swVlq23SS9aoC8uHNB_LRA", | |
"_score" : 1.0, "_source" : {"tags":["one","two","three","four","five","six","seven"]} | |
}, { | |
"_index" : "articles", | |
"_type" : "article", | |
"_id" : "oColEdY-SUmMPWvBWBEneQ", | |
"_score" : 1.0, "_source" : {"tags":["six","seven"]} | |
}, { | |
"_index" : "articles", | |
"_type" : "article", | |
"_id" : "hk-9osIlRViESqEF7WPj_w", | |
"_score" : 1.0, "_source" : {"tags":["three","four","five","six","seven"]} | |
}, { | |
"_index" : "articles", | |
"_type" : "article", | |
"_id" : "Ki9KA036TI6n7f6vD2gGWA", | |
"_score" : 1.0, "_source" : {"tags":["four","five","six","seven"]} | |
}, { | |
"_index" : "articles", | |
"_type" : "article", | |
"_id" : "_bFnruq4TdyJQjHH5bTMrg", | |
"_score" : 1.0, "_source" : {"tags":["five","six","seven"]} | |
}, { | |
"_index" : "articles", | |
"_type" : "article", | |
"_id" : "k1FzqoBwQ82PYNa1jgE-Tg", | |
"_score" : 1.0, "_source" : {"tags":["seven"]} | |
} ] | |
}, | |
"facets" : { | |
"f_tags" : { | |
"_type" : "terms", | |
"missing" : 0, | |
"terms" : [ { | |
"term" : "seven", | |
"count" : 7 | |
}, { | |
"term" : "six", | |
"count" : 6 | |
}, { | |
"term" : "three", | |
"count" : 3 | |
}, { | |
"term" : "four", | |
"count" : 3 | |
}, { | |
"term" : "five", | |
"count" : 3 | |
} ] | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment