Skip to content

Instantly share code, notes, and snippets.

@scharrier
Created December 22, 2011 13:25
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save scharrier/b88b5a82c879eeef8739 to your computer and use it in GitHub Desktop.
Save scharrier/b88b5a82c879eeef8739 to your computer and use it in GitHub Desktop.
Elasticsearch facet bad count ?
// First request : calculate "dotc" facet on a match_all query :
{
"query":{"match_all":{}},
"facets":{
"dotc":{"terms":{"field":"Utilisateur.dotc_id"}}
},
"size":0
}
// The count for id "7" is 31 (it's actually false : it should be 45) :
{
"facets": {
"dotc": {
"_type": "terms",
"missing": 0,
"total": 1320,
"other": 655,
"terms": [(10)
{
"term": "7",
"count": 31
},
]
}
}
}
// Second request, with a query on the term "anjou". I'm waiting for 45 results :
{
"query":{"query_string": { "query" : "anjou"}},
"facets":{
"dotc":{"terms":{"field":"Utilisateur.dotc_id"}}
},
"size":0
}
// Okay. Count for id "7" is 45 :
{
"facets": {
"dotc": {
"_type": "terms",
"missing": 0,
"total": 45,
"other": 0,
"terms": [(1)
{
"term": "7",
"count": 45
}
]
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment