IndexBuilder¶
- class aerospike_sdk.aio.operations.index.IndexBuilder[source]¶
Bases:
_IndexBuilderBaseConfigure a secondary index, then
create()ordrop()it.Typical chain for a new index:
on_bin()→named()→numeric()orstring()→ optionalcollection()orcontext()→awaitcreate().For removal, only
named()(and namespace/set from construction) is required beforeawaitdrop().Example:
await ( client.index(namespace="test", set_name="users") .on_bin("email") .named("email_idx") .string() .create() )
See also
- 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
- Return type:
- async drop()[source]¶
Drop a previously created index by name.
Example:
await ( client.index(namespace="test", set_name="users") .named("email_idx") .drop() )
- Raises:
ValueError – If
named()was not called.AerospikeError – On server or transport failure.
Note
Namespace and set come from the builder constructor, not from
on_bin().- Return type: