Perform queriesΒΆ

Now that you have a connection to your ElasticSearch servers, you may want to perform queries. The connection object has an equivalent interface as the official elasticsearch.client.Elasticsearch class, but simplifies most method by removing the index parameter.

For example, to perform a search query on the configured index, using the document type “blog entry”:

>>> from djangoes import connection
>>> search = {'query': {'match_all': {}}}
>>> result ='blog_entry', body=search)
>>> result.get('hits', {}).get('hits', [])
[ ... list of all indexed blog entries ... ]

See also

The official ElasticSearch API documentation.