Automating visualization entries in .kibana index

We have common log types across different application and I want to automate the creation of visualization entry in .kibana index from the template (exported json from kibana) I created.

I am following the post below but the last suggestion was, the only way to create a visualization is through kibana manual import. When I tried to perform PUT of my visualization data, I faced same issue: "Rejecting mapping update to [.kibana] as the final mapping would have more than 1 type: [visualization, doc]"

Is there any way now to automate the visualization entry creation and deal with more than 1 document type? I am using 6.3.2 version. Please advise

Hello,
I faced the same issue as you, and I came up with using Bulk API. You should carefully read the documentation because you should know how you split the metadata fields and the data fields.

I find a work around. I created templates and inject the values automatically per application and log type. Once the visualization json is ready, for the moment I import it manually and select the targeted index.

My end goal is to automate it using REST call via POST method, but I am currently facing some challenges at this point, if I can replicate the way kibana form the POST request, my issue will be solved.