Skip to content

Instantly share code, notes, and snippets.

@alexlarkou
Created November 28, 2020 13:45
Show Gist options
  • Save alexlarkou/2256b99e493e0be89ba00b4a3ce03c6d to your computer and use it in GitHub Desktop.
Save alexlarkou/2256b99e493e0be89ba00b4a3ce03c6d to your computer and use it in GitHub Desktop.
search example
from elasticsearch_dsl.search import Search
search = Search(using="default", index=index, doc_type=["doc"])
# we only want warning log in this instance
search = search.filter('term', level='warning')
# we look for results whose text includes the query "invalid argument"
search = search.query("multi_match", query="invalid argument", fields=["response.message", "stacktrace"], type="most_prefix")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment