This cheat sheet will introduce Django developers to the API of Elasticsearch DSL. Use it for a Django website when you need to search or filter data fast. The cheat sheet compares the syntax of Django QuerySets with the syntax of Elasticsearch DSL.
You will get these questions answered:
- How to define search queries out of an index document?
- How to count elements in a search query?
- How to read through the elements of a search query?
- How to see what query the domain-specific language will produce?
- How to filter the index records by a field that contains a value?
- How to filter the index records by a field that is exactly equal to a value?
- How to filter by any of the given conditions (OR)?
- How to filter by all given conditions (AND)?
- How to filter the index records by values less than or equal to certain value?
- How to filter by a single value in a nested field?
- How to filter by one of many values in a related model?
- How to sort search results by the values of a specific field?
- How to create queries dynamically?
- How to paginate the results using Django's default pagination?
And all of that is compressed on a single sheet of paper!
Get it now and master your craft like a charm!
Find more details in a DjangoTricks blog post.
Current document revision is 02. Last modified in June, 2018. PDF in black and white.