Call Elastic search from shell script for indexing pdf document Call Elastic search from shell script for indexing pdf document elasticsearch elasticsearch

Call Elastic search from shell script for indexing pdf document


I guess the issue has to shell not expanding the variables within single-quotes, you need to double-quote to expand it. i.e.

change -d' { "data" : $var }'

to

-d '{"data" : "'"$(base64 file_name.pdf)"'"}'  

directly to pass the base64 stream.

(or)

-d '{"data" : "'"$var"'"}'

More about quoting and variables in ksh here.