Query indexes
- class couchbase.management.queries.CollectionQueryIndexManager(impl: QueryIndexMgmtInterface, bucket_name: str)
Performs management operations on query indexes at the collection level.
- build_deferred_indexes(options: BuildDeferredQueryIndexOptions | None = None, **kwargs: Unpack[BuildDeferredQueryIndexOptionsKwargs]) None
Starts building any indexes which were previously created with
deferred=True.- Parameters:
options (
BuildDeferredQueryIndexOptions) – Optional parameters for this operation.**kwargs – keyword arguments that can be used as optional parameters for this operation.
- create_index(index_name: str, keys: Iterable[str], options: CreateQueryIndexOptions | None = None, **kwargs: Unpack[CreateQueryIndexOptionsKwargs]) None
Creates a new query index.
- Parameters:
index_name (str) – The name of the index.
keys (Iterable[str]) – The keys which this index should cover.
options (
CreateQueryIndexOptions) – Optional parameters for this operation.**kwargs – keyword arguments that can be used as optional parameters for this operation.
- Raises:
InvalidArgumentException – If the index_name or keys are invalid types.
QueryIndexAlreadyExistsException – If the index already exists.
- create_primary_index(options: CreatePrimaryQueryIndexOptions | None = None, **kwargs: Unpack[CreatePrimaryQueryIndexOptionsKwargs]) None
Creates a new primary query index.
- Parameters:
options (
CreatePrimaryQueryIndexOptions) – Optional parameters for this operation.**kwargs – keyword arguments that can be used as optional parameters for this operation.
- Raises:
QueryIndexAlreadyExistsException – If the index already exists.
- drop_index(index_name: str, options: DropQueryIndexOptions | None = None, **kwargs: Unpack[DropQueryIndexOptionsKwargs]) None
Drops an existing query index.
- Parameters:
index_name (str) – The name of the index to drop.
options (
DropQueryIndexOptions) – Optional parameters for this operation.**kwargs – keyword arguments that can be used as optional parameters for this operation.
- Raises:
InvalidArgumentException – If the index_name is an invalid types.
QueryIndexNotFoundException – If the index does not exists.
- drop_primary_index(options: DropPrimaryQueryIndexOptions | None = None, **kwargs: Unpack[DropPrimaryQueryIndexOptionsKwargs]) None
Drops an existing primary query index.
- Parameters:
options (
DropPrimaryQueryIndexOptions) – Optional parameters for this operation.**kwargs – keyword arguments that can be used as optional parameters for this operation.
- Raises:
QueryIndexNotFoundException – If the index does not exists.
- get_all_indexes(options: GetAllQueryIndexOptions | None = None, **kwargs: Unpack[GetAllQueryIndexOptionsKwargs]) Iterable[QueryIndex]
Returns a list of indexes for a specific collection.
- Parameters:
options (
GetAllQueryIndexOptions) – Optional parameters for this operation.**kwargs – keyword arguments that can be used as optional parameters for this operation.
- Returns:
A list of indexes.
- Return type:
Iterable[
QueryIndex]
- watch_indexes(index_names: Iterable[str], options: WatchQueryIndexOptions | None = None, **kwargs: Unpack[WatchQueryIndexOptionsKwargs]) None
Waits for a number of indexes to finish creation and be ready to use.
- Parameters:
index_names (Iterable[str]) – The names of the indexes to watch.
options (
WatchQueryIndexOptions) – Optional parameters for this operation.**kwargs – keyword arguments that can be used as optional parameters for this operation.
- Raises:
InvalidArgumentException – If the index_names are invalid types.
WatchQueryIndexTimeoutException – If the specified timeout is reached before all the specified indexes are ready to use.
- class couchbase.management.queries.QueryIndex(name: str, is_primary: bool, type: str, state: str, namespace: str | None, datastore_id: str | None, keyspace: str | None, index_key: list[str] = <factory>, condition: str | None = None, bucket_name: str | None = None, scope_name: str | None = None, collection_name: str | None = None, partition: str | None = None)
A query index, as the query service describes it.
- class couchbase.management.queries.QueryIndexManager(impl: QueryIndexMgmtInterface)
Performs management operations on query indexes.
For managing query indexes at the collection level,
CollectionQueryIndexManagershould be used.- build_deferred_indexes(bucket_name: str, options: BuildDeferredQueryIndexOptions | None = None, **kwargs: Unpack[BuildDeferredQueryIndexOptionsKwargs]) None
Starts building any indexes which were previously created with
deferred=True.- Parameters:
bucket_name (str) – The name of the bucket to perform build on.
options (
BuildDeferredQueryIndexOptions) – Optional parameters for this operation.**kwargs – keyword arguments that can be used as optional parameters for this operation.
- Raises:
InvalidArgumentException – If the bucket_name is an invalid type.
- create_index(bucket_name: str, index_name: str, keys: Iterable[str], options: CreateQueryIndexOptions | None = None, **kwargs: Unpack[CreateQueryIndexOptionsKwargs]) None
Creates a new query index.
- Parameters:
bucket_name (str) – The name of the bucket this index is for.
index_name (str) – The name of the index.
keys (Iterable[str]) – The keys which this index should cover.
options (
CreateQueryIndexOptions) – Optional parameters for this operation.**kwargs – keyword arguments that can be used as optional parameters for this operation.
- Raises:
InvalidArgumentException – If the bucket_name, index_name or keys are invalid types.
QueryIndexAlreadyExistsException – If the index already exists.
- create_primary_index(bucket_name: str, options: CreatePrimaryQueryIndexOptions | None = None, **kwargs: Unpack[CreatePrimaryQueryIndexOptionsKwargs]) None
Creates a new primary query index.
- Parameters:
bucket_name (str) – The name of the bucket this index is for.
options (
CreatePrimaryQueryIndexOptions) – Optional parameters for this operation.**kwargs – keyword arguments that can be used as optional parameters for this operation.
- Raises:
InvalidArgumentException – If the bucket_name is an invalid type.
QueryIndexAlreadyExistsException – If the index already exists.
- drop_index(bucket_name: str, index_name: str, options: DropQueryIndexOptions | None = None, **kwargs: Unpack[DropQueryIndexOptionsKwargs]) None
Drops an existing query index.
- Parameters:
bucket_name (str) – The name of the bucket containing the index to drop.
index_name (str) – The name of the index to drop.
options (
DropQueryIndexOptions) – Optional parameters for this operation.**kwargs – keyword arguments that can be used as optional parameters for this operation.
- Raises:
InvalidArgumentException – If the bucket_name or index_name are invalid types.
QueryIndexNotFoundException – If the index does not exists.
- drop_primary_index(bucket_name: str, options: DropPrimaryQueryIndexOptions | None = None, **kwargs: Unpack[DropPrimaryQueryIndexOptionsKwargs]) None
Drops an existing primary query index.
- Parameters:
bucket_name (str) – The name of the bucket this index to drop.
options (
DropPrimaryQueryIndexOptions) – Optional parameters for this operation.**kwargs – keyword arguments that can be used as optional parameters for this operation.
- Raises:
InvalidArgumentException – If the bucket_name is an invalid type.
QueryIndexNotFoundException – If the index does not exists.
- get_all_indexes(bucket_name: str, options: GetAllQueryIndexOptions | None = None, **kwargs: Unpack[GetAllQueryIndexOptionsKwargs]) Iterable[QueryIndex]
Returns a list of indexes for a specific bucket.
- Parameters:
bucket_name (str) – The name of the bucket to fetch indexes for.
options (
GetAllQueryIndexOptions) – Optional parameters for this operation.**kwargs – keyword arguments that can be used as optional parameters for this operation.
- Returns:
A list of indexes for a specific bucket.
- Return type:
Iterable[
QueryIndex]- Raises:
InvalidArgumentException – If the bucket_name is an invalid type.
- watch_indexes(bucket_name: str, index_names: Iterable[str], options: WatchQueryIndexOptions | None = None, **kwargs: Unpack[WatchQueryIndexOptionsKwargs]) None
Waits for a number of indexes to finish creation and be ready to use.
- Parameters:
bucket_name (str) – The name of the bucket to watch for indexes on.
index_names (Iterable[str]) – The names of the indexes to watch.
options (
WatchQueryIndexOptions) – Optional parameters for this operation.**kwargs – keyword arguments that can be used as optional parameters for this operation.
- Raises:
InvalidArgumentException – If the bucket_name or index_names are invalid types.
WatchQueryIndexTimeoutException – If the specified timeout is reached before all the specified indexes are ready to use.