# BulkFile Indexing with base64 command utility on linux server

**URL:** https://discuss.elastic.co/t/bulkfile-indexing-with-base64-command-utility-on-linux-server/17147
**Category:** Elasticsearch
**Created:** [April 23, 2014, 9:38am UTC](https://discuss.elastic.co/t/bulkfile-indexing-with-base64-command-utility-on-linux-server/17147 "2014-04-23T09:38:25Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![ravikanth](https://avatars.discourse-cdn.com/v4/letter/r/ce7236/32.png) [@ravikanth](https://discuss.elastic.co/u/ravikanth)
#### Post date: [April 23, 2014, 9:38am UTC](https://discuss.elastic.co/t/bulkfile-indexing-with-base64-command-utility-on-linux-server/17147/1 "2014-04-23T09:38:25Z")

</div>

Hi,  
when iam indexing file content by using base64 command utility with CURL on  
linux server iam getting following exception.

Caused by: org.elasticsearch.common.jackson.core.JsonParseException: Failed  
to decode VALUE\_STRING as base64 (MIME-NO-LINEFEEDS): Illegal character '''  
(code 0x27) in base64 content.

plz provide the solution .

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/b8f7c244-c6dc-4f22-a056-c600a2bb4f7a%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/b8f7c244-c6dc-4f22-a056-c600a2bb4f7a%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

### Author: ![ravikanth](https://avatars.discourse-cdn.com/v4/letter/r/ce7236/32.png) [@ravikanth](https://discuss.elastic.co/u/ravikanth)
#### Post date: [April 23, 2014, 9:47am UTC](https://discuss.elastic.co/t/bulkfile-indexing-with-base64-command-utility-on-linux-server/17147/2 "2014-04-23T09:47:20Z")

</div>

for the above iam using following command to get the content from file and convert into base64encode.

file\_path='/path/to/file'  
file=$(base64 $file\_path | perl -pe 's/\n/\n/g')  
curl -XPUT "[http://eshost.com:9200/index/type/](http://eshost.com:9200/index/type/)" -d '{  
"file" : "content" : "'$file'"  
}'

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/98ea59e3-3a0a-4940-8005-e6442e8b8a47%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/98ea59e3-3a0a-4940-8005-e6442e8b8a47%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

### Author: ![jprante](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jprante/32/44941_2.png) [@jprante](https://discuss.elastic.co/u/jprante)
#### Post date: [April 23, 2014, 12:36pm UTC](https://discuss.elastic.co/t/bulkfile-indexing-with-base64-command-utility-on-linux-server/17147/3 "2014-04-23T12:36:03Z")

</div>

This is not bulk indexing, but anyway...

If you want to post binary data to Elasticsearch from command line, you  
should use

echo '{"content":"'$(base64 /path/to/file)'"}' | curl -XPOST  
'0:9200/test/docs/1' --data-binary @-

Jörg

On Wed, Apr 23, 2014 at 11:47 AM, [ravikanth.htnakivar@gmail.com](mailto:ravikanth.htnakivar@gmail.com) wrote:

> for the above iam using following command to get the content from file and convert into base64encode.
> 
> file\_path='/path/to/file'  
> file=$(base64 $file\_path | perl -pe 's/\n/\n/g')  
> curl -XPUT "[http://eshost.com:9200/index/type/](http://eshost.com:9200/index/type/)" -d '{  
> "file" : "content" : "'$file'"  
> }'
> 
> --  
> You received this message because you are subscribed to the Google Groups  
> "elasticsearch" group.  
> To unsubscribe from this group and stop receiving emails from it, send an  
> email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> To view this discussion on the web visit  
> [https://groups.google.com/d/msgid/elasticsearch/98ea59e3-3a0a-4940-8005-e6442e8b8a47%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/98ea59e3-3a0a-4940-8005-e6442e8b8a47%40googlegroups.com)[https://groups.google.com/d/msgid/elasticsearch/98ea59e3-3a0a-4940-8005-e6442e8b8a47%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/98ea59e3-3a0a-4940-8005-e6442e8b8a47%40googlegroups.com?utm_medium=email&utm_source=footer)  
> .
> 
> For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/CAKdsXoEDb2MKz1%3DtOb3W%3DTnsErr2%3D-LJjUbCWJ-fk-Leo9xK6A%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAKdsXoEDb2MKz1%3DtOb3W%3DTnsErr2%3D-LJjUbCWJ-fk-Leo9xK6A%40mail.gmail.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

### Author: ![ravikanth](https://avatars.discourse-cdn.com/v4/letter/r/ce7236/32.png) [@ravikanth](https://discuss.elastic.co/u/ravikanth)
#### Post date: [April 23, 2014, 12:39pm UTC](https://discuss.elastic.co/t/bulkfile-indexing-with-base64-command-utility-on-linux-server/17147/4 "2014-04-23T12:39:44Z")

</div>

here i need to execute the curl with different file url in loop for  
multiple file

On Wed, Apr 23, 2014 at 6:06 PM, [joergprante@gmail.com](mailto:joergprante@gmail.com) \<  
[joergprante@gmail.com](mailto:joergprante@gmail.com)\> wrote:

> This is not bulk indexing, but anyway...
> 
> If you want to post binary data to Elasticsearch from command line, you  
> should use
> 
> echo '{"content":"'$(base64 /path/to/file)'"}' | curl -XPOST  
> '0:9200/test/docs/1' --data-binary @-
> 
> Jörg
> 
> On Wed, Apr 23, 2014 at 11:47 AM, [ravikanth.htnakivar@gmail.com](mailto:ravikanth.htnakivar@gmail.com) wrote:
> 
> > for the above iam using following command to get the content from file and convert into base64encode.
> > 
> > file\_path='/path/to/file'  
> > file=$(base64 $file\_path | perl -pe 's/\n/\n/g')  
> > curl -XPUT "[http://eshost.com:9200/index/type/](http://eshost.com:9200/index/type/)" -d '{  
> > "file" : "content" : "'$file'"  
> > }'
> > 
> > --  
> > You received this message because you are subscribed to the Google Groups  
> > "elasticsearch" group.  
> > To unsubscribe from this group and stop receiving emails from it, send an  
> > email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> > To view this discussion on the web visit  
> > [https://groups.google.com/d/msgid/elasticsearch/98ea59e3-3a0a-4940-8005-e6442e8b8a47%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/98ea59e3-3a0a-4940-8005-e6442e8b8a47%40googlegroups.com)[https://groups.google.com/d/msgid/elasticsearch/98ea59e3-3a0a-4940-8005-e6442e8b8a47%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/98ea59e3-3a0a-4940-8005-e6442e8b8a47%40googlegroups.com?utm_medium=email&utm_source=footer)  
> > .
> > 
> > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).
> 
> --  
> You received this message because you are subscribed to a topic in the  
> Google Groups "elasticsearch" group.  
> To unsubscribe from this topic, visit  
> [https://groups.google.com/d/topic/elasticsearch/orI2Xe5ruvs/unsubscribe](https://groups.google.com/d/topic/elasticsearch/orI2Xe5ruvs/unsubscribe).  
> To unsubscribe from this group and all its topics, send an email to  
> [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> To view this discussion on the web visit  
> [https://groups.google.com/d/msgid/elasticsearch/CAKdsXoEDb2MKz1%3DtOb3W%3DTnsErr2%3D-LJjUbCWJ-fk-Leo9xK6A%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAKdsXoEDb2MKz1%3DtOb3W%3DTnsErr2%3D-LJjUbCWJ-fk-Leo9xK6A%40mail.gmail.com)[https://groups.google.com/d/msgid/elasticsearch/CAKdsXoEDb2MKz1%3DtOb3W%3DTnsErr2%3D-LJjUbCWJ-fk-Leo9xK6A%40mail.gmail.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/CAKdsXoEDb2MKz1%3DtOb3W%3DTnsErr2%3D-LJjUbCWJ-fk-Leo9xK6A%40mail.gmail.com?utm_medium=email&utm_source=footer)  
> .
> 
> For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/CAOUhgp2F9CeWN0AvPyTv4WuSFjRFdG0Ws%2BCHBr7ttHKT\_uoSMA%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAOUhgp2F9CeWN0AvPyTv4WuSFjRFdG0Ws%2BCHBr7ttHKT_uoSMA%40mail.gmail.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)
#### Post date: [July 6, 2017, 1:34am UTC](https://discuss.elastic.co/t/bulkfile-indexing-with-base64-command-utility-on-linux-server/17147/5 "2017-07-06T01:34:06Z")

</div>


