Wednesday, April 27, 2016

Export and import via curl kibana’s dashboards and visualizations, Kibana Dashboard export into another Elasticsearch, command line load dashboard, How to save dashboard as json file, Location of custom Kibana dashboards in ElasticSearch


First in create some index and data in first ElasticSearch. As per my example:
{
 "_index": "twiteer_one",
            "_type": "tweet",
            "_id": "2",
            "_score": 1,
            "_source": {
               "nick": "Ishan@gmail.com",
               "date": "2015-02-10",
               "post": "NCFE",
               "other_name": "Ishan Suman"
            }
         },
         {
            "_index": "twiteer_one",
            "_type": "tweet",
            "_id": "17",
            "_score": 1,
            "_source": {
               "nick": "@binodsuman",
               "date": "2014-08-15",
               "post": "BigData, Kibana, ES, ML",
               "other_name": "Binod Suman"
            }

 - Connect this first ElasticSearch into your kibana dashboard.
 - Create two visualization using above index "twiteer_one"
   In my case, First-Visualization and Second-Visualization
 - Create one Dashboard in kibana using these two visualization.
   In my case my Dashboard name is "My-Dashboard".
 
- Export all three item (two visualization and one dashboard) individually from Kibana.
  HOW: In Kibana -> go to Settings -> Objects -> Visualization and
   * tick on First Visualization and export and save in one folder with name v1.json
   * tick on Second  Visualization and export and save in one folder with name v2.json
 
   - In Kibana -> go to Settings -> Objects -> Dashboard and
   * tick on My Dashboard and export and save in one folder with name dashboard.json
 
 
  - Stop this first ElasticSearch
  - Start your second ElasticSearch, make sure you should have same index "twiteer_one" with same set of data.
  Edit v1.json and remove first four line and your file should like this:
 
   {
      "title": "First Visualization",
      "visState": "{\"title\":\"New
 ----
 -----
  "searchSourceJSON": "{\"index\":\"twiteer_one\",\"query\":{\"query_string\":{\"query\":\"*\",\"analyze_wildcard\":true}},\"filter\":[]}"
      }
    }
  Edit v2.json and dashboard.json also and remove first four lines.
 
  Execute these three curl command:
  D:\Kibana_Json>curl localhost:9200/.kibana/visualization/First-Visualization -d @v1.json
  D:\Kibana_Json>curl localhost:9200/.kibana/visualization/Second-Visualization -d @v2.json
  D:\Kibana_Json>curl localhost:9200/.kibana/dashboard/My-Dashboard -d @dashboard.json
  Make sure after executing each command you must get "created":true message.
  {"_index":".kibana","_type":"dashboard","_id":"My-Dashboard","_version":1,"_shards":{"total":2,"successful":1,"failed":0},"created":true}
D:\Kibana_Json>

  Now you connect second ElasticSearch with Kibana and you will be getting all your visualization and Dashboard.
  Please write if any problem or feedback.
 
 

 

 
   
 
   

No comments:

Post a Comment

You can put your comments here (Either feedback or your Question related to blog)