![]() |
The Index API provides the ability to create and remove secondary indexes.
Aerospike currently supports indexing of strings and integers.
A string index allows for equality lookups. An equality lookup means that if you query for an indexed bin with value "abc", then only the records containing bins with "abc" will be returned.
An integer index allows for either equality or range lookups. An equality lookup means that if you query for an indexed bin with value 123, then only the records containing bins with the value 123 will be returned. A range lookup means that you can query bins within a range. So, if your range is (1...100), then all records containing the a value in that range will be returned.
Data Structures | |
struct | as_index_task |
Enumerations | |
enum | as_index_type { AS_INDEX_TYPE_DEFAULT, AS_INDEX_TYPE_LIST, AS_INDEX_TYPE_MAPKEYS, AS_INDEX_TYPE_MAPVALUES } |
enum as_index_type |
Index Type
Enumerator | |
---|---|
AS_INDEX_TYPE_DEFAULT | |
AS_INDEX_TYPE_LIST | |
AS_INDEX_TYPE_MAPKEYS | |
AS_INDEX_TYPE_MAPVALUES |
Definition at line 66 of file aerospike_index.h.
|
inlinestatic |
Create secondary index given data type.
This asynchronous server call will return before the command is complete. The user can optionally wait for command completion by using a task instance.
as | The aerospike instance to use for this operation. |
err | The as_error to be populated if an error occurs. |
task | The optional task data used to poll for completion. |
policy | The policy to use for this operation. If NULL, then the default policy will be used. |
ns | The namespace to be indexed. |
set | The set to be indexed. |
bin | The bin to be indexed. |
name | The name of the index. |
dtype | The data type of index, string or integer. |
Definition at line 177 of file aerospike_index.h.
References aerospike_index_create_complex(), and AS_INDEX_TYPE_DEFAULT.
as_status aerospike_index_create_complex | ( | aerospike * | as, |
as_error * | err, | ||
as_index_task * | task, | ||
const as_policy_info * | policy, | ||
const as_namespace | ns, | ||
const as_set | set, | ||
const as_index_position | position, | ||
const char * | name, | ||
as_index_type | itype, | ||
as_index_datatype | dtype | ||
) |
Create secondary index given collection type and data type.
This asynchronous server call will return before the command is complete. The user can optionally wait for command completion by using a task instance.
as | The aerospike instance to use for this operation. |
err | The as_error to be populated if an error occurs. |
task | The optional task data used to poll for completion. |
policy | The policy to use for this operation. If NULL, then the default policy will be used. |
ns | The namespace to be indexed. |
set | The set to be indexed. |
position | The bin or complex position name to be indexed. |
name | The name of the index. |
itype | The type of index, default or complex type. |
dtype | The data type of index, string or integer. |
as_status aerospike_index_create_wait | ( | as_error * | err, |
as_index_task * | task, | ||
uint32_t | interval_ms | ||
) |
Wait for asynchronous task to complete using given polling interval.
err | The as_error to be populated if an error occurs. |
task | The task data used to poll for completion. |
interval_ms | The polling interval in milliseconds. If zero, 1000 ms is used. |
|
inlinestatic |
Create a new secondary index on an integer bin.
Definition at line 232 of file aerospike_index.h.
References aerospike_index_create_complex(), AS_INDEX_NUMERIC, and AS_INDEX_TYPE_DEFAULT.
as_status aerospike_index_remove | ( | aerospike * | as, |
as_error * | err, | ||
const as_policy_info * | policy, | ||
const as_namespace | ns, | ||
const char * | name | ||
) |
Removes (drops) a secondary index.
as | The aerospike instance to use for this operation. |
err | The as_error to be populated if an error occurs. |
policy | The policy to use for this operation. If NULL, then the default policy will be used. |
ns | The namespace containing the index to be removed. |
name | The name of the index to be removed. |
|
inlinestatic |
Create a new secondary index on a string bin.
Definition at line 246 of file aerospike_index.h.
References aerospike_index_create_complex(), AS_INDEX_STRING, and AS_INDEX_TYPE_DEFAULT.