We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 2b04b99 commit 1eba68cCopy full SHA for 1eba68c
1 file changed
elasticsearch/python_modules/elasticsearch.py
@@ -187,12 +187,17 @@ def metric_init(params):
187
188
host = params.get('host', 'http://localhost:9200/')
189
190
- version = params.get('version', '1.2')
191
-
+ result = json.load(urllib.urlopen(host))
+
192
+ host_version = result.get('version',{}).get('number') or "1.2"
193
+ version = params.get('version', host_version)
194
195
m = re.match('(?P<major>\d+)\.(?P<minor>(\d+(\.\d+)*))', version)
196
197
if m and m.group('major') == '0':
198
url_cluster = '{0}_cluster/nodes/_local/stats?all=true'.format(host)
199
+ elif m and m.group('major') == '1' and m.group('minor') == '3.2':
200
+ url_cluster = '{0}_nodes/_local/stats'.format(host)
201
else:
202
url_cluster = '{0}_cluster/state/nodes'.format(host)
203
0 commit comments