Curl created visualization is not visible in Kibana

Hi,

I can create new visualization using curl command. After executing curl command to create visualization, I got this message -
{"_index":".kibana-4","_type":"visualization","_id":"v66","_version":1,"created":true}

which confirms that my visualization v66 is created but when i go to kibana dashboard i can not see visualization v66 or any new visualization created there.

Can anyone please help me with this?

What does the visualization within the index now look like?

Example: http://localhost:9200/.kibana/visualization/v66?pretty=true

The request i sent -

curl -XPOST 'https://<****>amazonaws.com/.kibana-4/visualization/v66' -d '{"_index":".kibana-4","_type":"visualization","_id":"v66","_score":1,"_source":{"title":"v66","visState":{"type":"line","params":{"shareYAxis":true,"addTooltip":true,"addLegend":true,"defaultYExtents":false},"aggs":[{"id":"1","type":"min","schema":"metric","params":{"field":"value"}},{"id":"2","type":"date_histogram","schema":"segment","params":{"field":"timestamp","interval":"hour","min_doc_count":1,"extended_bounds":{}}},{"id":"3","type":"filters","schema":"group","params":{"filters":[{"input":{"query":{"query_string":{"query":"*dpd1","analyze_wildcard":true}}}},{"input":{"query":{"query_string":{"query":"*cpva","analyze_wildcard":true}}}}]}}],"listeners":{}},"description":"","savedSearchId":"v66","version":1,"kibanaSavedObjectMeta":{"searchSourceJSON":{"filter":[]}}}}'

But I could not see the visualization when i do search -
curl -XGET 'https://<****>amazonaws.com/.kibana-4/visualization/_search'

I can see other visualization i created manually but could not see the one i created using above command

Hi.
(I'm french so sorry for my English).
When you create a vizualisation, do you use a JSon file ?
Because you can import and export vizualisation ok ?
If I understand, you created a vizualisation in an other Kibana, and you want to import it in an other Kibana ?
If it's the case, you must to adapt the curl command with " -d @yourFileWithYourJsonVizualisation "
If it's not the case, can you explain me what do you want to do exactly and let put the matter in the context please.

The exact scenario is -

  1. I have some web page say html web page for example
  2. User uses web page to provide some information for which i want to show graphs to the user
  3. In background when user sends request, I will create the new visulization in kibana and provide the visulization (may be iframe) back to the html web page and will show embeded graph on that web page.

So i dont know how I should create visualization runtime and show it on my html page as embeded graph.

I am using Kibana 4.0.3.

On your POST, only send the contents of source.

curl -XPOST 'https://<***>amazonaws.com/.kibana-4/visualization/v66' -d '{"title":"v66","visState":{"type":"line","params":{"shareYAxis":true,"addTooltip":true,"addLegend":true,"defaultYExtents":false},"aggs":[{"id":"1","type":"min","schema":"metric","params":{"field":"value"}},{"id":"2","type":"datehistogram","schema":"segment","params":{"field":"timestamp","interval":"hour","min_doc_count":1,"extended_bounds":{}}},{"id":"3","type":"filters","schema":"group","params":{"filters":[{"input":{"query":{"query_string":{"query":"dpd1","analyze_wildcard":true}}}},{"input":{"query":{"query_string":{"query":"*cpva","analyze_wildcard":true}}}}]}}],"listeners":{}},"description":"","savedSearchId":"v66","version":1,"kibanaSavedObjectMeta":{"searchSourceJSON":{"filter":[]}}}'

It throws an error -
{"error":"MapperParsingException[failed to parse [visState]]; nested: ElasticsearchIllegalArgumentException[unknown property [type]]; ","status":400}

i think it is because the way the json is written . Part of the json looks like -
"visState": {
"type": "line",
"params": {
"shareYAxis": true,
"addTooltip": true,
"addLegend": true,
"defaultYExtents": false
},
"aggs": [
{
"id": "1",
"type": "min",
"schema": "metric",
"params": {
"field": "value"
}
},
{
"id": "2",
"type": "date_histogram",
"schema": "segment",
"params": {
"field": "timestamp",
"interval": "hour",
"min_doc_count": 1,
"extended_bounds": {
}
}
}

which shows visState contains element like -
"String" = >"String"
"String" = > JSON object
"string" = > [JSON objects]

but i am not sure.

I also tried to convert json document as -
"String" = >"String"
"String" = > "JSON object"
"string" = > "[JSON objects]"

but i got this error -
{"error":"MapperParsingException[object mapping for [visualization] tried to parse field [kibanaSavedObjectMeta] as object, but got EOF, has a concrete value been provided to it?]","status":400}

The entire JSON I am sending -

{
  "title": "v11",
  "visState": "{\"type\":\"line\",\"params\":{\"shareYAxis\":true,\"addTooltip\":true,\"addLegend\":true,\"defaultYExtents\":false},\"aggs\":[{\"id\":\"1\",\"type\":\"min\",\"schema\":\"metric\",\"params\":{\"field\":\"value\"}},{\"id\":\"2\",\"type\":\"date_histogram\",\"schema\":\"segment\",\"params\":{\"field\":\"timestamp\",\"interval\":\"hour\",\"min_doc_count\":1,\"extended_bounds\":{}}},{\"id\":\"3\",\"type\":\"filters\",\"schema\":\"group\",\"params\":{\"filters\":[{\"input\":{\"query\":{\"query_string\":{\"query\":\"*dpd1\",\"analyze_wildcard\":true}}}},{\"input\":{\"query\":{\"query_string\":{\"query\":\"*cpva\",\"analyze_wildcard\":true}}}}]}}],\"listeners\":{}}",
  "description": "",
  "savedSearchId": "v11",
  "version": 1,
  "kibanaSavedObjectMeta": "{\"searchSourceJSON\":{\"index\":\"logstash-abc-*\",\"filter\":[]}}"
}

Anyways,
Finally I could run curl command with only source and again i got response as true for visulzation creation but there is no visualization in kibana or when I hit curl search query.

curl -XPOST 'https://<****>aws.com/.kibana-4/visualization/v12' -d '{"title":"v12","visState":"{\"type\":\"line\",\"params\":{\"shareYAxis\":true,\"addTooltip\":true,\"addLegend\":true,\"defaultYExtents\":false},\"aggs\":[{\"id\":\"1\",\"type\":\"min\",\"schema\":\"metric\",\"params\":{\"field\":\"value\"}},{\"id\":\"2\",\"type\":\"date_histogram\",\"schema\":\"segment\",\"params\":{\"field\":\"timestamp\",\"interval\":\"hour\",\"min_doc_count\":1,\"extended_bounds\":{}}},{\"id\":\"3\",\"type\":\"filters\",\"schema\":\"group\",\"params\":{\"filters\":[{\"input\":{\"query\":{\"query_string\":{\"query\":\"*dpd1\",\"analyze_wildcard\":true}}}},{\"input\":{\"query\":{\"query_string\":{\"query\":\"*cpva\",\"analyze_wildcard\":true}}}}]}}],\"listeners\":{}}","description":"","savedSearchId":"v12","version":1,"kibanaSavedObjectMeta":{"searchSourceJSON":"{\"index\":\"logstash-abc-*\",\"filter\":[]}"}}'

Response -
{"_index":".kibana-4","_type":"visualization","_id":"v12","_version":1,"created":true}

I think the problem is that kibana's users must have the index-pattern.
So, on the elasticSearch's output of users, it must appear an index with data which permit to create vizualisation.
So for users in elasticSearch :
.kibana with index pattern
your_Index = with data insert

And so, when users load your dashboard in a web page, he will see your vizualisation.