IndexBuilder

class aerospike_sdk.aio.operations.index.IndexBuilder[source]

Bases: _IndexBuilderBase

Configure a secondary index, then create() or drop() it.

Typical chain for a new index: on_bin()named()numeric() or string() → optional collection() or context()await create().

For removal, only named() (and namespace/set from construction) is required before await drop().

Example:

await (
    client.index(namespace="test", set_name="users")
    .on_bin("email")
    .named("email_idx")
    .string()
    .create()
)

See also

index()

async create()[source]

Create the index on the cluster.

Example:

await (
    client.index(namespace="test", set_name="users")
    .on_bin("email")
    .named("email_idx")
    .string()
    .create()
)
Raises:
  • ValueError – If on_bin, named, or index type was not set.

  • AerospikeError – On server or transport failure (typed subclass when the driver maps a result code).

See also

drop()

Return type:

None

async drop()[source]

Drop a previously created index by name.

Example:

await (
    client.index(namespace="test", set_name="users")
    .named("email_idx")
    .drop()
)
Raises:

Note

Namespace and set come from the builder constructor, not from on_bin().

Return type:

None