I have typed this command to index a document in Elasticsearch
create an index
curl -X PUT \"localhost:9200/test_idx_1x\"
This is a complete shell script implementation:
file_path='/path/to/file' file=$(base64 $file_path | perl -pe 's/\n/\\n/g') curl -XPUT "http://eshost.com:9200/index/type/" -d '{ "file" : "content" : "'$file'" }'