backends

Module djangoes.backends provides abstract classes for djangoes 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.

meta_client_class

alias of MetaClientBase

class MetaClientBase(conn)

ElasticSearch meta client base.

The meta client aims to provide an interface to the “meta” API of ElasticSearch, ie. manipulation of indices (creation, deletion, etc.), of cluster and nodes (settings), and of snapshot (backup/restore).

The base class exposes a simple interface with 4 main attributes that must be implemented in the child class:

  • indices
  • cluster
  • nodes
  • snapshot
cluster

Access to meta API about cluster.

indices

Access to meta API about indices.

nodes

Access to meta API about nodes.

snapshot

Access to meta API about snapshot.

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.

At the moment it only provides the SimpleHttpBackend, based on the default transport class.

class SimpleHttpBackend(alias, server, indices)

Connection wrapper based on the ElasticSearch official library.

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.

meta_client_class

alias of MetaClient

transport_class

alias of Transport