Is it possible to create index patterns with the help of Elasticsearch JS client in Elkstack 7.3+?
Or, for example, from Kibana plugin?
I know it's possible from the API side, but is it achievable using the client?
Thanks a lot
Is it possible to create index patterns with the help of Elasticsearch JS client in Elkstack 7.3+?
Or, for example, from Kibana plugin?
I know it's possible from the API side, but is it achievable using the client?
Thanks a lot
Yes, it's possible to use SavedObject client for this, but with nuances. If you don't have a lot of the logic on the server it would be easier to call API endpoint directly.
Operations with SavedObjects performed on behalf of a user. It means that whenever you access SavedObject client on the server, it should be associated with the incoming request objects. Thus you need to register your endpoint to get SavedObjects client and create index-pattern
:
const client = request.getSavedObjectsClient();
client.create('index-pattern', ...);
example from the Kibana codebase:
Thanks for the answer.
And is anything available from the server side to do similar things? (getting and creating index patterns)
I think we use saved object interface for this. as in example before: savedObjectsClient.create('index-pattern', ...)
This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
© 2020. All Rights Reserved - Elasticsearch
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.