Hi,
I want to create visualization via JS client in ES 6.2.
I have read this :
How to put a visualization directly in Kibana/ElasticSearch? ;
but when I compare already existing visualizations in my 6.2 and what is provided in answers in topic mentioned above, there are some differences:
_type is "doc", not "visualization"
_id is not uuid, but "visualization":uuid
_source does not directly contain visualization data, but rather inner "visualization" object
Here is my code:
var _id = uuidv1();
client.create({
index: '.kibana',
type: 'doc',
//id: 'visualization:' + _id,
body: _source,
refresh: true
}).then(function (response) {
console.log('visualization was created:' + response._id);
},
function(error){
console.log('Error creating visualization:' + error);
})
; where _source variable is this JSON:
{
"type":"visualization",
"visualization":{
"title":"dashboarder - Average wait time (OEM)",
"visState": "{"title":"dashboarder - Average wait time (OEM)","type":"timelion","params":{"expression":".es(index=oem-control-file-sequential-read*).label("control-file-sequential-read [ms]"), \n.es(index=oem-db-file-scattered-read*).label("db-file-scattered-read [ms]"),\n.es(index=oem-db-file-sequential-read*).label("db-file-sequential-read [ms]"),\n.es(index=oem-direct-path-read*).label("direct-path-read [ms]"),\n.es(index=oem-direct-path-readtemp*).label("direct-path-readtemp [ms]"),\n.es(index=oem-log-file-sync*).label("log-file-sync [ms]"),"interval":"auto"},"aggs":[]}",
"uiStateJSON": "{}",
"kibanaSavedObjectMeta": { "searchSourceJSON": "{}" }
}
}
If I run this, document is successfully created - I can see it in ".kibana" index via "dev tools", but it does not display in "visualize" tab.
Does anybody have any tips ?
Thanks