Utility & Helper Methods¶
Sections
Get Information¶
get_alias¶
-
api.
get_alias
(client, alias)¶ Return information about the specified alias.
Parameters: - client – The Elasticsearch client connection
- alias – Alias name to operate on.
Return type: list of strings
get_repository¶
-
api.
get_repository
(client, repository='')¶ Return configuration information for the indicated repository.
Parameters: - client – The Elasticsearch client connection
- repository – The Elasticsearch snapshot repository to use
Return type: dict
get_segmentcount¶
-
api.
get_segmentcount
(client, index_name)¶ Return a tuple of (shardcount, segmentcount) from the provided index_name.
Parameters: - client – The Elasticsearch client connection
- index_name – The index name
Return type: tuple
get_snapshot¶
-
api.
get_snapshot
(client, repository='', snapshot='')¶ Return information about a snapshot (or a comma-separated list of snapshots) If no snapshot specified, it will return all snapshots. If none exist, an empty dictionary will be returned.
Parameters: - client – The Elasticsearch client connection
- repository – The Elasticsearch snapshot repository to use
- snapshot – The snapshot name, or a comma-separated list of snapshots
Return type: dict
Verification¶
check_csv¶
-
api.
check_csv
(value)¶ Some of the curator methods should not operate against multiple indices at once. This method can be used to check if a list or csv has been sent.
Parameters: value – The value to test, if list or csv string Return type: bool
ensure_list¶
-
api.
ensure_list
(indices)¶ Return a list, even if indices is a single value
Parameters: indices – A list of indices to act upon Return type: list
index_closed¶
-
api.
index_closed
(client, index_name)¶ Return True if the indicated index is closed.
Parameters: - client – The Elasticsearch client connection
- index_name – The index name
Return type: bool
optimized¶
-
api.
optimized
(client, index_name, max_num_segments=None)¶ Check if an index is optimized.
Parameters: - client – The Elasticsearch client connection
- index_name – The index name
- max_num_segments – Merge to this number of segments per shard.
Return type: bool
Index Pruning¶
prune_allocated¶
-
api.
prune_allocated
(client, indices, key, value, allocation_type)¶ Return list of indices that do not have the routing allocation rule of key=value
Parameters: - client – The Elasticsearch client connection
- indices – A list of indices to act on
- key – The allocation attribute to check for
- value – The value to check for
- allocation_type – Type of allocation to apply
Return type: list
Other¶
create_snapshot_body¶
-
api.
create_snapshot_body
(indices, ignore_unavailable=False, include_global_state=True, partial=False)¶ Create the request body for creating a snapshot from the provided arguments.
Parameters: - indices – A single index, or list of indices to snapshot.
- ignore_unavailable – Boolean. Ignore unavailable shards/indices. (default: False)
- include_global_state – Boolean. Store cluster global state with snapshot. (default: True)
- partial – Boolean. Do not fail if primary shard is unavailable. (default: False)
Return type: dict