Elasticsearch DistFS plugin - Simple distributed filesystem on Elasticsearch
This plugin is only written for educational purpose. Do not use it in production!
mvn package
Run with plugin executable found in the Elasticsearch bin directory:
./bin/plugin --u file:///path/to/plugin.zip --i distfs
First time or after a mvn clean
do mvn package
Run Elasticsearch with the command:
mvn exec:java
--> Elasticsearch will run on localhost:9200
Add run configuration:
Main class: org.elasticsearch.bootstrap.Bootstrap
VM Options: -Des.foreground=yes
Upload a file to the DistFS:
POST http://localhost:9200/_distfs/<index>/<type>/<file path>
(with the file as content)
or
POST http://localhost:9200/_distfs/<index>/<type>?path=<file path>
(with the file as content)
for example:
POST http://localhost:9200/_distfs/fs/files/content/images/myimage.jpg
POST http://localhost:9200/_distfs/fs/files?path=content/images/myimage.jpg
Response returns permalink-id:
HTTP/1.1 202 Accepted
Content-Type: text/plain; charset=UTF-8
Content-Length: 36
ad7ed078-7071-45c7-80c4-cab16849153c
GET http://localhost:9200/_distfs/<index>/<type>/<file path>
or
GET http://localhost:9200/_distfs/<index>/<type>?path=<file path>
or
GET http://localhost:9200/_distfs/permalink/<permalink-id>
For example
GET http://localhost:9200/_distfs/fs/files/content/images/myimage.jpg
GET http://localhost:9200/_distfs/fs/files?path=content/images/myimage.jpg
GET http://localhost:9200/_distfs/permalink/a7c559eb-f286-4463-af70-c088b7d3454b
GET http://localhost:9200/_distfs/<index>/<type>/<file path>?cmd=<command>
GET http://localhost:9200/_distfs/<index>/<type>/<dir path>?cmd=ls
Example of output (navigation can be done by clicking the items):
Index of /
[+] ..
[+] images
[+] js
[-] index.html
[-] README.txt