How to store a file to elastic search from kibana plugin server

Hi Team,
I am developing a kibana plugin that generate a file containing the data selected by the user on the plugin interface. After that I should be able to generate a link that the user can use to download the created file . Now I am at a point where I need to store the file and I was thinking of storing it in elastic search and provide the link for downloads. How can I do that from my kibana server ?
Also how can I talk to elastic search om my server?
I am making APIs call to the static host http://localhost:9200/.
But I wanna do it dynamically since it will be a plugin and the elastic search host my differs from one user to another.
Thanks

What sort of file are you creating and do you want them to be indexed an analyzed?

Generally, I'd probably recommend against storing big binary files in ES though you can using something like the ingest-attachment plugin

If you're not creating a binary file, ES can handle that a little better. You can throw whatever you want into a JSON string as long as you escape. You'll probably want to set it to text... If you don't want it to be searchable you can also set index to false.

All that said, not knowing your exact use case, I'd probably recommend storing the file somewhere else and storing the URL in ES.

I am creating a csv file. I guess the size of the file won't be that big, just few MB and I would keep that in elastic search if it's possible.

No I don't want them to be indexed.

Btw any idea on how to communicate with elastic search from my plugin server dynamically without using the static url http://localhost:9200/. ? Because the ES url could change and not always be http://localhost:9200/.

You'll need something to tell you where ES lives... If you're sure it's only going to be on localhost, I guess you could also just start iterating through every port until you get a successful response.

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