Ping endpoint
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
from ..transport import Transport
|
from ..transport import Transport
|
||||||
from ..exceptions import NotFoundError
|
from ..exceptions import NotFoundError, TransportError
|
||||||
from .indices import IndicesClient
|
from .indices import IndicesClient
|
||||||
from .cluster import ClusterClient
|
from .cluster import ClusterClient
|
||||||
from .utils import query_params, _make_path
|
from .utils import query_params, _make_path
|
||||||
@@ -56,6 +56,15 @@ class Elasticsearch(object):
|
|||||||
self.indices = IndicesClient(self)
|
self.indices = IndicesClient(self)
|
||||||
self.cluster = ClusterClient(self)
|
self.cluster = ClusterClient(self)
|
||||||
|
|
||||||
|
@query_params()
|
||||||
|
def ping(self, params=None):
|
||||||
|
""" Returns True if the cluster is up, False otherwise. """
|
||||||
|
try:
|
||||||
|
self.transport.perform_request('HEAD', _make_path(), params=params)
|
||||||
|
except TransportError:
|
||||||
|
return False
|
||||||
|
return True
|
||||||
|
|
||||||
@query_params()
|
@query_params()
|
||||||
def info(self, params=None):
|
def info(self, params=None):
|
||||||
""" Get the basic info from the current cluster. """
|
""" Get the basic info from the current cluster. """
|
||||||
|
|||||||
Reference in New Issue
Block a user