Error putting base64 converted string into Elasticsearch

Please format your code using </> icon as explained in this guide. It will make your post more readable.

Probably you should run something like:

var=$(base64 "$filename"| perl -pe 's/\n//g');
var1=$(curl -XPOST 'http://localhost:9200/reports-'$date'/document/reports?pipeline=attachment&pretty' -H "Content-Type: application/json" -d @- <<CURL_DATA
{ "data": "$var" }
CURL_DATA)
1 Like