backends

Module djangoes.backends provides backend implementation.

backends.abstracts

Module djangoes.backends.abstracts provides abstract classes for backends.

All backends are expecting to subclass these abstract classes and to implement their behaviors.

class Base(alias, server, indices)

ElasticSearch backend wrapper base.

indices

List of names to use to perform ElasticSearch queries.

For each configured index, a connection will use either its index name, or its list of aliases if at least one is defined.

For example, if a connection uses 2 indices, one with only the index index, and the second one with the index_2 index and an alias alias, the result indices will be ['index', 'alias'].

index_names

List of names of all configured indices, without their aliases.

It is the same list of indices but where indices are not replaced by their aliases.

It is particulary useful when indices need to be created for example.

alias_names

List of names of all configured indices’s aliases, without their indices.

It is the same list of indices but where only aliases are presents.

It is particulary useful when aliases need to be created for example.

configure_client()

Configure the ElasticSearch client.

get_alias_names()

Build and return the list of alias names.

This create a list of unique alias names, without using their indices. It can be useful to get alias names instead of their usage names, as given by indices as it would gives index names when no alias is configured - which is not always what is needed.

get_index_names()

Build and return the list of index names.

This create a list of unique index names, without using their aliases. It can be useful to get index names instead of their usage names, as given by indices, for example when one wants to create them.

get_indices()

Build the list of indices or aliases used to query ElasticSearch.

This creates a list composed of index names or alias names. If an index defined aliases, these aliases will be used instead of its own name.

get_indices_with_settings()

Build and return a dict of indices with their settings.

This create a dict where each key is a index name, and each value is the index key’s settings (as used to created the index). It is useful when one wants to create an index with its settings for the given connection.

backends.elasticsearch

Connection backends based on the elasticsearch official python library.

This module aims to contain only basic backend classes using the ElasticSearch official python library and its basics transport classes with few changes.

Each backend implements the expected behavior defined in the base class - that is to say: they provide methods that don’t need to get an index or an alias as argument to perform requests (when applicable).

class BaseElasticsearchBackend(alias, server, indices)

Base connection wrapper based on the ElasticSearch official library.

It uses two entry points to configure the underlying connection:

  • transport_class: the transport class from elasticsearch. By default elasticsearch.transport.Transport.
  • connection_class: the connection class used by the transport class. It’s undefined by default, as it is on the subclasses to provide one.

If any of these elements is not defined, an ImproperlyConfigured error will be raised when the backend will try to configure the client.

configure_client()

Instantiate and configure the ElasticSearch client.

It simply takes the given HOSTS list and uses PARAMS as the keyword arguments of the ElasticSearch class.

The client’s transport_class is given by the class attribute transport_class, and the connection class used by the transport class is given by the class attribute connection_class.

An ImproperlyConfigured exception is raised if any of these elements is undefined.

transport_class

alias of Transport

class SimpleHttpBackend(alias, server, indices)

Connection backend using the urllib3 connection class.

connection_class

alias of Urllib3HttpConnection

class SimpleMemcachedBackend(alias, server, indices)

Connection backend using the Memcache connection class.

As describe in the MemcachedConnection, a plugin must be installed in the ElasticSearch cluster in order to work.

connection_class

alias of MemcachedConnection

class SimpleRequestsHttpBackend(alias, server, indices)

Connection backend using the HTTP for Human request connection class.

connection_class

alias of RequestsHttpConnection

class SimpleThriftBackend(alias, server, indices)

Connection backend using the Thrift experimental connection class.

connection_class

alias of ThriftConnection

class SimpleHttpBackend(alias, server, indices)

Connection backend using the urllib3 connection class.

connection_class

alias of Urllib3HttpConnection