Unable to send large files to elasticsearch using curl: argument too long
<p>This is the script i used to export some documents to elasticsearch but no luck </p>

<pre><code>#!/bin/ksh
set -v 
trap read debug
date=$(date +%Y-%m-%d);
echo $date;
config_file="/home/p.sshanm/reports_elastic.cfg";
echo $config_file;
URL="http://p-acqpes-app01.wirecard.sys:9200/reports-"$date"";
echo $URL;

find /transfers/documents/*/done/ -type f -name "ABC-Record*_${date}*.csv"|
while IFS='' read -r -d '' filename
do
    echo "filename : ${filename}"
    var=$(base64 "$filename"| perl -pe 's/\n//g');

    #if i use below it will fail as argument too long , so i used with curl option @
    # var1= $(curl -XPUT 'http://localhost:9200/reports-'$date'/document/reports?pipeline=attachment&amp;pretty' -d' { "data" : "'$var'" }')

    var1=$(curl -X PUT -H "Content-Type: application/json" -d @- "$URL" &gt;&gt;CURLDATA
    { "data": "$var" }
    CURL_DATA)
done;
</code></pre>

<p>If i use below it as </p>

<pre><code>var1= $(curl -XPUT 'http://localhost:9200/reports-'$date'/document/reports?pipeline=attachment&amp;pretty' -d' { "data" : "'$var'" }')
</code></pre>

<p>will fail as below, so i used with curl option <code>@</code></p>

<blockquote>
  <p>argument too long</p>
</blockquote>