Receive files in Elasticsearch plugin over http


I'm developing a plugin for Elasticsearch. The plugin uses the BaseRestHandler to add some new HTTP endpoints. One of this endpoints is used by an Android app. The app sends some information to the plugin which then creates a new document in Elasticsearch based on the received information. That works well up to here. But now I want to send some images (jpg) made by the android app to the HTTP endpoint of the Elasticsearch plugin. The goal is that the plugin stores the images somewhere and creates a Elasticsearch document with the paths of the stored files.

I think files are uploaded with HTTP by using multipart requests. Is it possible to get the individual files from the content of the received Elasticsearch RestRequest?

I'm also open to other ideas if you have one :slight_smile:

Thanks in advance!

This is looking close to what I did recently in FSCrawler project:

Where you can basically send to this REST service any binary document which will be indexed into elasticsearch and stored if you want.

But I choose to add this as a separate feature instead of having to maintain a plugin.

Thanks for your response, it helped me a lot. I've decided that it's not necessary to develop a plugin and I'm doing it now the same way you do.

On the Android side I use Android Volley for the multipart request. It's very easy to use and works well together with the glassfish http server.

Thanks for the help!

1 Like

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