Creation of Kibana visualization using curl fails in version 6.1.2

I am getting error while trying to create Kibana visualization using following curl:
Error is: "Invalid request payload JSON format"

curl -X POST "http://localhost:5601/api/saved-objects/visualization/my-visualization" -H 'kbn-xsrf' -H 'Content-Type : application/json' -d visualization.json

visualization.json is :
{
"attributes": {
"title": "Event_Name_Source",
"visState": "{"title":"Event_Name_Source","type": "pie", "params": { "type": "pie", "addTooltip": true, "addLegend": true, "legendPosition": "right","isDonut": true,"labels": {"show": false,"values": true,"last_level": true,"truncate": 100}},"aggs": [{ "id": "1", "enabled": true, "type": "count", "schema": "metric", "params": {}}, { "id": "2", "enabled": true,"type": "terms","schema": "segment","params": {"field": "eventName","otherBucket": false,"otherBucketLabel": "Other","missingBucket": false,"missingBucketLabel": "Missing","size": 5,"order": "desc","orderBy": "1","customLabel": "Event Name"}},{"id": "3","enabled": true,"type": "terms","schema": "segment","params": {"field": "eventSource","otherBucket": false,"otherBucketLabel": "Other","missingBucket": false,"missingBucketLabel": "Missing","size": 5,"order": "desc","orderBy": "1","customLabel": "Event Source"}}]}",
"uiStateJSON": "{}",
"description": "",
"version": 1,
"kibanaSavedObjectMeta": {
"searchSourceJSON": "{"index": "cloudtraillogs","filter": [],"query": {"query": "","language": "lucene"}}"
}
}

Please help with what is wrong in the above json. Is this format correct for elasticsearch version 6.1.2

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.