How to put a new dashboard in ElasticSearch from a dashbaord json file

Hi,

I'm trying a curl method to import dashbaord to ES like this :

curl -s -XPOST localhost:9200/.kibana/_bulk --data @Dashboard55.json

but not working:

{"error":{"root_cause":[{"type":"parse_exception","reason":"Failed to derive xcontent"}],"type":"parse_exception","reason":"Failed to derive xcontent"}

My json file seems me correct, so did you have an idea ?

Thanks

Perhaps it would be easier for us to help if we had the JSON file you're trying to post.

Yes, Sorry

[
{
"_id":"Dashboard55",
"_type": "dashboard",
"_source": {
"title": "DashBoard_Customer_55",
"hits": 0,
"description": "",
"panelsJSON": "[{"col":1,"id":"Visualization2","panelIndex":1,"row":1,"size_x":3,"size_y":2,"type":"visualization"},{"col":4,"id":"Visualization1","panelIndex":2,"row":1,"size_x":2,"size_y":2,"type":"visualization"},{"col":1,"id":"table1","panelIndex":3,"row":3,"size_x":8,"size_y":2,"type":"visualization"},{"col":6,"id":"Customer_id_Visu","panelIndex":4,"row":1,"size_x":3,"size_y":2,"type":"visualization"}]",
"optionsJSON": "{"darkTheme":false}",
"uiStateJSON": "{"P-1":{"spy":{"mode":{"fill":false,"name":null}}},"P-2":{"spy":{"mode":{"fill":false,"name":null}}}}",
"version": 1,
"timeRestore": false,
"kibanaSavedObjectMeta": {
"searchSourceJSON": "{"filter":[{"query":{"query_string":{"query":"customer_id:55","analyze_wildcard":true}}}]}"
}
}
}
]

That file doesn't conform to the spec of the bulk API. Why use the bulk API to add a single document?

Ok,

I used this just to see how it work because i tried few methods without success.
So are there curl methods to put just one document ?

Thanks

With this method i have an other issue :

curl -XPOST 'http://localhost:9200/.kibana/dashboard/Dashboard55' -d @Dashboard55.json

{"error":{"root_cause":[{"type":"mapper_parsing_exception","reason":"failed to parse"}],"type":"mapper_parsing_exception","reason":"failed to parse","caused_by":{"type":"not_x_content_exception","reason":"Compressor detection can only be called on some xcontent bytes or compressed xcontent bytes"}},"status":400}

Now It work, We must to delete a few first fields to have just this part:

{
"title": "DashBoard_Customer_55",
"hits": 0,
"description": "",
"panelsJSON": "[{"col":1,"id":"Visualization2","panelIndex":1,"row":1,"size_x":3,"size_y":2,"type":"visualization"},{"col":4,"id":"Visualization1","panelIndex":2,"row":1,"size_x":2,"size_y":2,"type":"visualization"},{"col":1,"id":"table1","panelIndex":3,"row":3,"size_x":8,"size_y":2,"type":"visualization"},{"col":6,"id":"Customer_id_Visu","panelIndex":4,"row":1,"size_x":3,"size_y":2,"type":"visualization"}]",
"optionsJSON": "{"darkTheme":false}",
"uiStateJSON": "{"P-1":{"spy":{"mode":{"fill":false,"name":null}}},"P-2":{"spy":{"mode":{"fill":false,"name":null}}}}",
"version": 1,
"timeRestore": false,
"kibanaSavedObjectMeta": {
"searchSourceJSON": "{"filter":[{"query":{"query_string":{"query":"customer_id:55","analyze_wildcard":true}}}]}"
}
}

curl -XPUT http://localhost:9200/.kibana/dashboard/Dashboard55/ -d @Dashboard55.json

Thanks

Is there any performance drawback to always using the bulk API instead of the single index operation?