How to create visualization on the fly using a script

(Abhijitdeka11) #1


I have some requirement where I need to create different visualization for different users which will differ very slightly on the query param.So, I am considering to create a script which will enable me to do this.Have anyone done this on Kibana 4.Some pointers on how to create visualization using query would be of great help.

I would also like to create Dashboards on the fly but that can wait till I get this one sorted out.


(Tanya Bragin) #2

Most of the parameters you need to create visualizations and dashboards are stored in the URL state in Kibana 4. After creating a sample vis or dashboard, you should be able to examine the URL and decide what to parameterize.

Import new search to kibana via command line
(Abhijitdeka11) #3

Thanks for the reply.I am already able to do that.
I believe all the API's are exposed as REST urls. So, that helped me a lot to understand the workings myself.I am creating the search query first with this endpoint http://localhost:5601/elasticsearch/.kibana/search/create_search_1 with appropriate JSON input. Same goes for the Visualization and Dashboard.I am able to replicate all the three steps to create a Dashboard with my custom query. For next step I am building my custom application to generate all the Dashboards automatically.

(Rajeev) #4

Hi Abhijit,

I am working in an application in which I want to create the visualization and dashboard automatically for the index loaded in elastic search.Can you help me on it . It would be of great help.

Thanks and Best Regards,

(Abhijitdeka11) #5

There are three things you need to build.

Create JSON for all these objects and pass this to "/search/" ,"/visualization/","/dashboard/" as POST req and you will be done.Most of the work involves on building the JSON to pass to this URL.Observe some visualization in Kibana and try chaging some small param and execute it from your code. Next try building the whole JSON on our own.

(Rajeev) #6

Thanks a lot for replying .I am able to create the json but when I am importing the visualisation in kibana manually it ask to create the index in kibana. Can you help me that How should I create index in kibana programattically and also let me know how can I automate the importing of json files of visualisation and dashboard.

(Tanya Bragin) #7

At the moment, there is no API in the Kibana server for automatically creating index patterns, but it's coming in 5.0:

(Abhijitdeka11) #8

I guess you can use the trick of index* regular expression on index. I think Kibana automatically imports all indexes starting with some_index_name* if you provide it manually once.
Regarding auto imoprt of JSON you can use the rest api's "/search/" ,"/visualization/","/dashboard/"

(Rajeev) #9

I am bit new to ELK stack and not able to understand How can I use rest api's rest api's "/search/" ,"/visualization/","/dashboard/" in my C# program to import the JSON file. At Present I am able to get the dashboard and visualisation in one JSON file Which works very well on importing manually.
Also I tried the trick to create index on kibana but it won't work.

(timtian) #10

when will the 5.0 be released? thxs!

Import new search to kibana via command line
(timtian) #11

Also, what's the compatible version of ES and logstash to work with kibana5?


(Tony) #12


Maybe it's a bit late but I have the same need as you do :slight_smile:
I sorted it this way : How to put a visualization directly in Kibana/ElasticSearch?

I'll soon do the dashboard part, now the visualizations part is okay :slight_smile:

See you


(system) #13