Need Help:Attachment ype in elastic search

(Aakarsh Sharma) #1

I am not able to create index on attachment type.Not sure, what is
happening as i am new to elasticsearch .Hope that you would help resolve my
Here is what i am doing step by step:
I am using windows and Rest API:

1.installed mapper plugin by using this command:
plugin -install
elasticsearch/elasticsearch-mapper-attachments/2.0.0(working fine)

  1. restarted elasticsearch(working fine)

3.created index in rest api(working fine):
http://localhost:9200/documentsx (put).

  1. created property for attachment in mapping(working fine):

"person" : {
"properties" : {
"my_attachment" : { "type" : "attachment" }

5.downloaded a software from ( to
encode my pdf
(working fine)

6.encode my pdf with the utility above(working fine)

7.kept my pdf in d:\elasticsearch folder(location of elasticsearch in my pc)

8 executed this:(NOT WORKING)
url: http://localhost:9200/documentsx/person/1(post)
"my_attachment" : {
"_content_type" : "application/pdf",
"_name" : "/sap1.pdf",
"content" : "... base64 encoded attachment ..."
i am getting this error
"error": "MapperParsingException[failed to parse]; nested:
JsonParseException[Failed to decode VALUE_STRING as base64
(MIME-NO-LINEFEEDS): Illegal white space character (code 0x20) as character
#3 of 4-char base64 unit: can only used between units\n at [Source:
[B@16dd7aa; line: 5, column: 29]]; ",
"status": 400

btw if i remove the file or put some random filename above in _name it
gives same error i think it is not reading the file itself.
Where i am going wrong??

Appreciate your help.

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
To view this discussion on the web visit
For more options, visit

(system) #2