From 39ada119fe78de3e7e3c1c31a36072127cd5e5f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patryk=20Krawaczy=C5=84ski?= Date: Thu, 17 Oct 2019 18:24:51 +0200 Subject: [PATCH] HTTP 405 when node_id is defined _make_path encodes "/" - so the request looks like: GET /_cluster%2Fstats%2Fnodes/node_id and elastic returns a 405 error. --- elasticsearch/client/cluster.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/elasticsearch/client/cluster.py b/elasticsearch/client/cluster.py index 63f662fa..361f7754 100644 --- a/elasticsearch/client/cluster.py +++ b/elasticsearch/client/cluster.py @@ -114,14 +114,15 @@ class ClusterClient(NamespacedClient): :arg node_id: A comma-separated list of node IDs or names to limit the returned information; use `_local` to return information from the - node you're connecting to, leave empty to get information from all + node you're connecting to, `_master` to return information from the + currently-elected master node or leave empty to get information from all nodes :arg flat_settings: Return settings in flat format (default: false) :arg timeout: Explicit operation timeout """ url = "/_cluster/stats" if node_id: - url = _make_path("_cluster/stats/nodes", node_id) + url = _make_path("_cluster","stats","nodes", node_id) return self.transport.perform_request("GET", url, params=params) @query_params(