Hello,
I am trying to import a dashboard via the elasticsearch api with elastic search-py.
I have a sample dashboard from https://demo.elastic.co/ (the http one). I have exported it and it looks like this:
[
{
"_id": "HTTP",
"_type": "dashboard",
"_source": {
"title": "HTTP",
"hits": 0,
"description": "",
"panelsJSON": "[{\"col\":3,\"id\":\"Web-transactions\",\"row\":1,\"size_x\":10,\"size_y\":3,\"type\":\"visualization\"},{\"col\":1,\"id\":\"HTTP-error-codes\",\"row\":7,\"size_x\":6,\"size_y\":3,\"type\":\"visualization\"},{\"col\":7,\"id\":\"HTTP-error-codes-evolution\",\"row\":7,\"size_x\":6,\"size_y\":3,\"type\":\"visualization\"},{\"col\":1,\"id\":\"Navigation\",\"row\":1,\"size_x\":2,\"size_y\":3,\"type\":\"visualization\"},{\"col\":1,\"id\":\"Total-number-of-HTTP-transactions\",\"row\":4,\"size_x\":3,\"size_y\":3,\"type\":\"visualization\"},{\"col\":4,\"id\":\"HTTP-codes-for-the-top-queries\",\"row\":4,\"size_x\":9,\"size_y\":3,\"type\":\"visualization\"},{\"id\":\"Top-10-HTTP-requests\",\"type\":\"visualization\",\"size_x\":12,\"size_y\":5,\"col\":1,\"row\":10}]",
"optionsJSON": "{\"darkTheme\":false}",
"uiStateJSON": "{}",
"version": 1,
"timeRestore": false,
"kibanaSavedObjectMeta": {
"searchSourceJSON": "{\"filter\":[{\"query\":{\"query_string\":{\"analyze_wildcard\":true,\"query\":\"*\"}}}]}"
}
}
}
]
I believe I should be using the create() member function in elastic-py. This was my function call that I was attempting.
with open('http.json') as data_file:
data = json.load(data_file)
es.create(index='.kibana', id='http_dashboard', body=data)
however, I am getting http transport errors that were telling me that i could not have "hits" or "version", etc. how exactly can i import this dashboard via elasticsearch-py?
thanks in advance