Indexes

Indexes are used to allow fast access to documents. For each collection there is always the primary index which is a hash index for the document identifier.

Usage example:

from arango import create

# here we define connection to Arango
c = create()

# here we creating collection explicitly
c.test.create()

# create `hash` index for two fields: `name` and `num`,
# not unque
c.test.index.create(["name", "num"])

# create unique `hash` index for `slug` field
c.test.index.create(
    "slug",
    index_type="hash",
    unique=True
)
class arango.index.Index(collection=None)

Interface to work with Indexes

__call__()

Get list of all available indexes. Returns tuple with indentyfiers and original response

...
c.test.index()
create(fields, index_type='hash', unique=False)

Create new index. By default type is hash and unique=False

fields may be either str, list or tuple.

This method may generate WrongIndexType exception in case index_type isn’t allowed for Arango DB

delete(field_id)

Return tuple of two values: - bool success or not deletion - original response

get(field_id, force_read=False)

Get index by id