• -


Category : latest version

This restpoint is used to upload single file to the cluster. Before we start make sure cluster is up-and-running, by sending simple curl command:

curl http://localhost:10200

Returned JSON response shows cluster status (see Post check installation).

How to upload single jpeg file to the cluster:

curl -XPOST "http://localhost:10200/_ewupload?folder=/files/mypictures/&filename=myimage.jpg" --data-binary @myimage.jpg

What happened?
/files/mypictures/ folder has been created on ElasticWarehouse cluster and myimage.jpg was successfully uploaded into it. Our myimage.jpg file is now accessible by id aYLro1V_TzO0tfLNmbp4gA. To navigate through ElasticWarehouse cluster you can use ewshell bash script (see community page) distributed with ElasticWarehouse package.

ewshell.sh -c browse /files/mypictures

Upload an update?

curl -XPOST "http://localhost:10200/_ewupload?folder=/files/mypictures/&filename=myimage.jpg&id=aYLro1V_TzO0tfLNmbp4gA" --data-binary @myimage.jpg

When you browse cluster, you see MODIFYDATE and MODIFYTIME are not empty after update.

ewshell.sh -c browse /files/mypictures

To manage uploaded file use tasks (use _ewtask rest point)

Parameter Requirement Type Description
folder mandatory string An attribute to define name of the folder where file to be uploaded. If folder doesn’t exist, then will be created.
filename mandatory string Target filename. File you upload may have different name on ElasticWarehouse cluster than on local file system. Each file actions are performed via ID, so cluster allows even to store many files with the same name in the same folder. To distinguish them, use file Id.
id optional string File id whose update is being requested. If id is not passed to the request, then file will be uploaded as a new one.
showrequest optional boolean When set to “true” ElasticWarehouse node prints converted JSON request on standard output. Converted JSON request can be executed directly on ElasticSearch cluster. It’s useful when you plan to build your own ElasticWarehouse client connected directly to the ElasticSearch cluster.
ElasticWarehouse REST API