elasticsearch

Convenience wrapper to access elasticsearch API on our cluster with general purpose CLI tool.

accre.elasticsearch.es_request(path, method='GET', params=None, data=None)[source]

Make an API request to the ACCRE elasticsearch cluster with the specified path, optionally querystring parameters and JSON payload data, and return the raw response text.

Parameters:
  • path (str) – URL path for the elasticsearch API endpoint. Note that this should not include a preceding slash, and that it may if desired contain the querystring parameters for the endpoint after a question mark

  • method (str) – HTTP method to send, defaults to GET

  • params (dict(str, str)) – Querystring parameters to send if not specified in the path string

  • data (dict) – JSON compatible dictionary to send as a JSON payload for the request

Returns:

HTTP response payload in raw text format

Return type:

str

accre.elasticsearch.get_shard_allocation_settings()[source]

Return a string indicating the current persistent and transient shard allocation settings, which may be either “all” (default), “primaries”, “new_primaries”, or “none”. If there is no transient setting, than it will be indicated as an empty string.

Returns:

Current persistent shard allocation settings

Return type:

dict(str, str)

accre.elasticsearch.main()[source]

CLI entry point for making routine requests to the ACCRE Elasticsearch cluster

accre.elasticsearch.set_shard_allocation_setting(setting)[source]

Set the persistent shard allocation setting for the cluster, should be one of “all”, “none”, “primaries”, or “new_primaries”

Parameters:

setting (str) – Persistent shard allocation setting

Returns:

json response of settings change request

Rtyple:

dict