BulkFile Indexing with base64 command utility on linux server


(ravikanth) #1

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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/b8f7c244-c6dc-4f22-a056-c600a2bb4f7a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


(ravikanth) #2

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/" -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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/98ea59e3-3a0a-4940-8005-e6442e8b8a47%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


(Jörg Prante) #3

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 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/" -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.
To view this discussion on the web visit
https://groups.google.com/d/msgid/elasticsearch/98ea59e3-3a0a-4940-8005-e6442e8b8a47%40googlegroups.comhttps://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.

--
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.
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.
For more options, visit https://groups.google.com/d/optout.


(ravikanth) #4

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 <
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 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/" -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.
To view this discussion on the web visit
https://groups.google.com/d/msgid/elasticsearch/98ea59e3-3a0a-4940-8005-e6442e8b8a47%40googlegroups.comhttps://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.

--
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.
To unsubscribe from this group and all its topics, send an email to
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.comhttps://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.

--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/CAOUhgp2F9CeWN0AvPyTv4WuSFjRFdG0Ws%2BCHBr7ttHKT_uoSMA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


(system) #5