I created a couple of scripted fields using Kibana GUI and used them to create visualizations.
I am now looking for a way to automate the creation of scripted fields and import dashboards. Is there an API available for doing the same? If not what is the easiest way to achieve this programmatically?
The UI is updating the index-pattern saved object with the new scripted field data. You could perform these steps programmatically. You can open the developer tools in your browser and add a scripted field to an index-pattern. The network tab will capture the interactions with the server so you can see how the UI is using Kibana's saved object API.
Add your scripted field to attributes. fields. Fields is just a JSON array that has been serialized into a string for storage. Convert the string into JSON, add your scripted field to the array and then serialize back to a string.
The Kibana dev tools can only be used for Elasticsearch APIs, meaning, it is a playground for interacting with Elasticsearch. Anything under /api is a Kibana API hosted by Kibana's web server.
The reason you are getting the error is that the GET request is getting passed to Elasticsearch which does not have a /api/saved_objects endpoint.
I would recommend using someting like CURL for interacting with Kibana's APIs.
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.