-
Notifications
You must be signed in to change notification settings - Fork 400
Closed
Description
As @mmguero pointed out at this kibana issue, I tried your python script for refreshing my index pattern. But at the second request it fails in my case for kibana v.7.4.2:
GET_INDEX_PATTERN_INFO_URI = 'api/saved_objects/index-pattern'
# get the ID of the index name (probably will be the same as the name)
getIndexInfoResponse = requests.get('{}/{}/{}'.format(args.url, GET_INDEX_PATTERN_INFO_URI, args.index))
getIndexInfoResponse.raise_for_status()
getIndexInfo = getIndexInfoResponse.json()
indexId = getIndexInfo['id']This throws a HTTPError: requests.exceptions.HTTPError: 404 Client Error: Not Found for url: http://localhost:5601/api/saved_objects/index-pattern/<my-index-pattern-name> The kibana docs suggest that you have to pass the id of an index pattern. So the uri GET_INDEX_PATTERN_INFO_URI does not exist.
I replaced it with the a _find api call:
GET_INDEX_PATTERN_INFO_URI = 'api/saved_objects/_find'
# get the ID of the index name (probably will be the same as the name)
getIndexInfoResponse = requests.get(
'{}/{}'.format(args.url, GET_INDEX_PATTERN_INFO_URI),
params={
'type': 'index-pattern',
'fields': 'id',
'search': args.index
}
)
getIndexInfoResponse.raise_for_status()
getIndexInfo = getIndexInfoResponse.json()
indexId = getIndexInfo['saved_objects'][0]['id'] Metadata
Metadata
Assignees
Labels
No labels