From 74cb6865381f0eecee816280d8d0d7a49bd67c8c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Honza=20Kr=C3=A1l?= Date: Tue, 8 Dec 2015 22:19:32 +0100 Subject: [PATCH] Adding missing APIs --- elasticsearch/client/cat.py | 37 +++++++++++++++++++++++++++++++-- elasticsearch/client/indices.py | 30 ++++++++++++++++++++++++++ 2 files changed, 65 insertions(+), 2 deletions(-) diff --git a/elasticsearch/client/cat.py b/elasticsearch/client/cat.py index b2eeb1af..f7a5075f 100644 --- a/elasticsearch/client/cat.py +++ b/elasticsearch/client/cat.py @@ -4,7 +4,7 @@ class CatClient(NamespacedClient): @query_params('h', 'help', 'local', 'master_timeout', 'v') def aliases(self, name=None, params=None): """ - + ``_ :arg name: A comma-separated list of alias names to return @@ -275,7 +275,7 @@ class CatClient(NamespacedClient): @query_params('h', 'help', 'local', 'master_timeout', 'v') def plugins(self, params=None): """ - + ``_ :arg h: Comma-separated list of column names to display @@ -307,3 +307,36 @@ class CatClient(NamespacedClient): params=params) return data + @query_params('h', 'help', 'local', 'master_timeout', 'v') + def repositories(self, params=None): + """ + ``_ + + :arg h: Comma-separated list of column names to display + :arg help: Return help information, default False + :arg local: Return local information, do not retrieve the state from + master node, default False + :arg master_timeout: Explicit operation timeout for connection to master + node + :arg v: Verbose mode. Display column headers, default False + """ + _, data = self.transport.perform_request('GET', '/_cat/repositories', + params=params) + return data + + @query_params('h', 'help', 'master_timeout', 'v') + def snapshots(self, repository=None, params=None): + """ + ``_ + + :arg repository: Name of repository from which to fetch the snapshot + information + :arg h: Comma-separated list of column names to display + :arg help: Return help information, default False + :arg master_timeout: Explicit operation timeout for connection to master + node + :arg v: Verbose mode. Display column headers, default False + """ + _, data = self.transport.perform_request('GET', _make_path('_cat', + 'snapshots', repository), params=params) + return data diff --git a/elasticsearch/client/indices.py b/elasticsearch/client/indices.py index 8d5179f4..55dad3c2 100644 --- a/elasticsearch/client/indices.py +++ b/elasticsearch/client/indices.py @@ -966,3 +966,33 @@ class IndicesClient(NamespacedClient): '_shard_stores'), params=params) return data + @query_params('allow_no_indices', 'expand_wildcards', 'flush', + 'ignore_unavailable', 'max_num_segments', 'only_expunge_deletes', + 'operation_threading', 'wait_for_merge') + def forcemerge(self, index=None, params=None): + """ + ``_ + + :arg index: A comma-separated list of index names; use `_all` or empty + string to perform the operation on all indices + :arg allow_no_indices: Whether to ignore if a wildcard indices + expression resolves into no concrete indices. (This includes `_all` + string or when no indices have been specified) + :arg expand_wildcards: Whether to expand wildcard expression to concrete + indices that are open, closed or both., default 'open', valid + choices are: 'open', 'closed', 'none', 'all' + :arg flush: Specify whether the index should be flushed after performing + the operation (default: true) + :arg ignore_unavailable: Whether specified concrete indices should be + ignored when unavailable (missing or closed) + :arg max_num_segments: The number of segments the index should be merged + into (default: dynamic) + :arg only_expunge_deletes: Specify whether the operation should only + expunge deleted documents + :arg operation_threading: TODO: ? + :arg wait_for_merge: Specify whether the request should block until the + merge process is finished (default: true) + """ + _, data = self.transport.perform_request('POST', _make_path(index, + '_forcemerge'), params=params) + return data