How to upload a visualtion data to kibana using curl command or using the requests post


(Ranganatha) #1

i want to upload a json visualizations data to kibana using the curl command and this json data was obtained from the kibana itself
is there a way that i could create the visualizations from the python script itself by using the json data from the kibana visualizations.
i am trying to create a new visualizations for users by making little changes in the json visual data,,,is this possible??

here is the json data that i am trying to upload:

{
"title":"cpu_2",
"visState":""" {"params": {"addTimeMarker": false, "grid": {"style": {"color": "#eee"}, "categoryLines": false}, "seriesParams": [{"showCircles": true, "show": true, "type": "histogram", "mode": "stacked", "drawLinesBetweenPoints": true, "valueAxis": "ValueAxis-1", "data": {"id": "2", "label": "Max Cpu_utilisation"}}], "legendPosition": "right", "addTooltip": true, "times": , "categoryAxes": [{"style": {}, "scale": {"type": "linear"}, "title": {}, "show": true, "position": "bottom", "labels": {"truncate": 100, "show": true}, "type": "category", "id": "CategoryAxis-1"}], "type": "histogram", "valueAxes": [{"style": {}, "scale": {"type": "linear", "mode": "normal"}, "title": {"text": "Max Cpu_utilisation"}, "name": "LeftAxis-1", "show": true, "position": "left", "labels": {"filter": false, "rotate": 0, "truncate": 100, "show": true}, "type": "value", "id": "ValueAxis-1"}], "addLegend": true}, "type": "histogram", "aggs": [{"type": "max", "enabled": true, "id": "2", "params": {"field": "Cpu_utilisation"}, "schema": "metric"}, {"type": "terms", "enabled": true, "id": "3", "params": {"orderBy": "2", "field": "Time.keyword", "otherBucketLabel": "Other", "otherBucket": false, "missingBucket": false, "order": "desc", "missingBucketLabel": "Missing", "size": 20}, "schema": "segment"}], "title": "cpu_2"}""",
"uiStateJSON":"{}",
"description" : "",
"version" : 1,
"kibanaSavedObjectMeta":{"searchSourceJSON":""""{"index": "220222b0-06ea-11e9-9ee2-1d0446b8a21a","query": {"language": "lucene","query": ""},"filter": }"""}
}

this is json output of a visualization created in kibana .


(Bhavya R M) #2

Hello,

So there are two questions in your post?

  1. You can upload saved objects json through the saved objects UI in management.

  2. through saved objects API:
    https://www.elastic.co/guide/en/kibana/master/saved-objects-api.html

  3. I am not getting the context of creating vizs from python script here. Can you please explain?

Thanks,
Bhavya


(Ranganatha) #3

why i need to create the vizs from python script....

say there are 10 people and they all have a different data but the vizs are same for all 10 and now to solve this problem ...should we create a new 10 vizs for each or should we just change some parameters in the json file of the vizs (like id and index-pattern).

This is the situation presently ,,,so if we could make the it work by python code, that would be great..


(system) closed #4

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