Hello there,
I have a production system whereby each tenant is assigned dedicated aliases for reporting purposes. I can't change this approach. When a new tenant is added to the system, then from a kibana perspective I need to import a new set of index patterns for these aliases and a new set of set of dashboards (and their dependencies: visualizations and saved searches) particular to this new tenant.
In Kibana 5 this task was achieved by writing directly to the .kibana index through elastic-search client. However, I'm sure the recommended approach in Kibana 6 is to do this via the Kibana APIs. I've been following:
how-to-import-index-pattern-in-kibana-6-using-api
API for managing saved objects
I exported a set of index patterns with something like:
curl -uelastic --insecure "https://localhost:5602/api/saved_objects?type=index-pattern" >> index_patterns.json
However, once I have an array of index-pattern objects I don't know how to import them. I've tried the following:
[tango@iel-dev-mtn-vm2 experimental]$ curl -uelastic:t3l3com --insecure -X POST -H "Content-Type: application/json" -H "kbn-xsrf: true" "https://diffhost:5602/api/saved_objects/index-pattern" -d "@master_index_patterns.json"
{"statusCode":400,"error":"Bad Request","message":""value" must be an object","validation":{"source":"payload","keys":["value"]}}
[tango@iel-dev-mtn-vm2 experimental]$
As the object is an array of objects, I tried wrapping the array in an object { "objects" : []}, as I've observed this pattern in some other kibana APIs.
[tango@iel-dev-mtn-vm2 experimental]$ curl -uelastic --insecure -X POST -H "Content-Type: application/json" -H "kbn-xsrf: true" "https://diffhost:5602/api/saved_objects/index-pattern" -d "@master_index_patterns.json"
{"statusCode":400,"error":"Bad Request","message":"child "attributes" fails because ["attributes" is required]. "objects" is not allowed","validation":{"source":"payload","keys":["attributes","objects"]}}[
Any guidance on how to proceed would be very much appreciated.