Not able to make API call on Elasticsearch 6.x for index pattern management


(Scott Preddy) #1

We used to make the call below to Elasticsearch to get configuration information during kibana index management jobs. After moving from 5.x to 6.x I get this error:

2019-02-11 21:00:51,450 ERROR Unable to connect to Elasticsearch to get kibana version: 404 - {"_index":".kibana","_type":"config","_id":"6.4.0","found":false}

Here is context of the error (see call in bold)

get default kibana version

**res = get("/.kibana/config/" + kibana_version)**
res_body = res.read()
if res.status >= 400:
    logging.error("Unable to connect to Elasticsearch to get kibana version: " + str(res.status) + " - " + res_body)
    exit(1)

try:
    root = json.loads(res_body)
    logging.debug("Response body: ")
    logging.debug(root)
    blob += root["_source"]["defaultIndex"]
    logging.debug('_source"]["defaultIndex"')
except:
    logging.warn("Failed to read default index pattern: " + res_body)
return blob