Object creation at runtime


(Javier Castro) #1

Hi, I am developing an app type plugin.

I'd like to create objects by code.

You use request to /api/saved_objects/type to create them, but I am worry it won't work if I use these request directly in case x-pack is installed, so I've searched further down the code.

And saw you use "kibana/src/ui/public/saved_objects/saved_objects_client.js" internally to do this.

What and how should I include to use this in my app?

Thanks!


(Tyler Smalley) #2

Can you give some more information on the type of objects you're wanting to create?


(Javier Castro) #3

I want to create visualizations, searches and dashboards.

I was already doing this by sending a standard request to elasticsearch, but since Kibana 6.0.0 uses an internal ID, I can't do that, so I ended up doing what I said in the first post.

Regards.


(Tyler Smalley) #4

As of 5.6, there is a SavedObject REST API which there are also clients for.

There is some information in this comment here on how to use the REST API.

The route definitions are located here

If you want to use the client, the server-side client is located here, and the browser-side client is what you previously pointed to.


(Tyler Smalley) #5

One thing to note, in addition to using unique ID's, in 6.0 (and in 5.6 after a migration) we no longer use types in Elasticsearch.


(Javier Castro) #6

I was wondering, what about x-pack, can we use this REST API without the credentials? And, if we indeed need them...how can we retrieve them in code?

Regards.


(system) #7

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.