Skip to content

Instantly share code, notes, and snippets.

@harshvb7
Created July 10, 2019 11:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save harshvb7/c8983eb2cae44f8954391dbbc56a2181 to your computer and use it in GitHub Desktop.
Save harshvb7/c8983eb2cae44f8954391dbbc56a2181 to your computer and use it in GitHub Desktop.
from elasticsearch_dsl import FacetedSearch, TermsFacet
class TweetSearch(FacetedSearch):
facets = {
# use bucket aggregations to define facets
'city': TermsFacet(field='user.city.name'),
}
def search(self):
s = super().search()
# override the search queryset here.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment