Added namespacing to the client

This commit is contained in:
Honza Kral
2013-06-01 16:59:07 +02:00
parent 79c6535657
commit 0eafdab2e8
+17
View File
@@ -64,6 +64,20 @@ def query_params(*es_query_params):
return _wrapper
class NamespacedClient(object):
def __init__(self, client):
self.client = client
@property
def transport(self):
return self.client.transport
class ClusterClient(NamespacedClient):
pass
class InidicesClient(NamespacedClient):
pass
class Elasticsearch(object):
"""
Elasticsearch low-level client. Provides a straightforward mapping from
@@ -84,4 +98,7 @@ class Elasticsearch(object):
"""
self.transport = Transport(_normalize_hosts(hosts), **kwargs)
# namespaced clients for compatibility with API names
self.indices = InidicesClient(self)
self.cluster = ClusterClient(self)