Created
March 17, 2015 23:46
-
-
Save rjosephwright/4ed7d4d25f89f83875db to your computer and use it in GitHub Desktop.
Kibana mapping
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'json' | |
require 'net/http' | |
index_pattern = { | |
'index-pattern' => { | |
'properties' => { | |
'title' => { | |
'type' => 'string' | |
}, | |
'timeFieldName' => { | |
'type' => 'string' | |
}, | |
'intervalName' => { | |
'type' => 'string' | |
}, | |
'customFormats' => { | |
'type' => 'string' | |
}, | |
'fields' => { | |
'type' => 'string' | |
} | |
} | |
} | |
} | |
visualization = { | |
'visualization' => { | |
'properties' => { | |
'title' => { | |
'type' => 'string' | |
}, | |
'visState' => { | |
'type' => 'string' | |
}, | |
'description' => { | |
'type' => 'string' | |
}, | |
'savedSearchId' => { | |
'type' => 'string' | |
}, | |
'version' => { | |
'type' => 'integer' | |
}, | |
'kibanaSavedObjectMeta' => { | |
'properties' => { | |
'searchSourceJSON' => { | |
'type' => 'string' | |
} | |
} | |
} | |
} | |
} | |
} | |
dashboard = { | |
'dashboard' => { | |
'properties' => { | |
'title' => { | |
'type' => 'string' | |
}, | |
'hits' => { | |
'type' => 'integer' | |
}, | |
'description' => { | |
'type' => 'string' | |
}, | |
'panelsJSON' => { | |
'type' => 'string' | |
}, | |
'version' => { | |
'type' => 'integer' | |
}, | |
'kibanaSavedObjectMeta' => { | |
'properties' => { | |
'searchSourceJSON' => { | |
'type' => 'string' | |
} | |
} | |
} | |
} | |
} | |
} | |
search = { | |
'search' => { | |
'properties' => { | |
'title' => { | |
'type' => 'string' | |
}, | |
'description' => { | |
'type' => 'string' | |
}, | |
'hits' => { | |
'type' => 'integer' | |
}, | |
'columns' => { | |
'type' => 'string' | |
}, | |
'sort' => { | |
'type' => 'string' | |
}, | |
'version' => { | |
'type' => 'integer' | |
}, | |
'kibanaSavedObjectMeta' => { | |
'properties' => { | |
'searchSourceJSON' => { | |
'type' => 'string' | |
} | |
} | |
} | |
} | |
} | |
} | |
http = Net::HTTP.new('es.example.com', 9200) | |
http.send_request('PUT', '/.kibana') | |
http.send_request('PUT', '/.kibana/_mapping/index-pattern', index_pattern.to_json) | |
http.send_request('PUT', '/.kibana/_mapping/visualization', visualization.to_json) | |
http.send_request('PUT', '/.kibana/_mapping/dashboard', dashboard.to_json) | |
http.send_request('PUT', '/.kibana/_mapping/search', search.to_json) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment