# Need Help:Attachment ype in elastic search

**URL:** https://discuss.elastic.co/t/need-help-attachment-ype-in-elastic-search/17319
**Category:** Elasticsearch
**Created:** [May 2, 2014, 10:45am UTC](https://discuss.elastic.co/t/need-help-attachment-ype-in-elastic-search/17319 "2014-05-02T10:45:12Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Aakarsh\_Sharma](https://avatars.discourse-cdn.com/v4/letter/a/a88e57/32.png) [@Aakarsh\_Sharma](https://discuss.elastic.co/u/Aakarsh_Sharma)
#### Post date: [May 2, 2014, 10:45am UTC](https://discuss.elastic.co/t/need-help-attachment-ype-in-elastic-search/17319/1 "2014-05-02T10:45:12Z")

</div>

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  
issues:  
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](http://localhost:9200/documentsx) (put).

1. created property for attachment in mapping(working fine):  
url:[http://localhost:9200/documentsx/person/\_mapping](http://localhost:9200/documentsx/person/_mapping)

{  
"person" : {  
"properties" : {  
"my\_attachment" : { "type" : "attachment" }  
}  
}  
}

5.downloaded a software from ([http://www.fourmilab.ch/webtools/base64/](http://www.fourmilab.ch/webtools/base64/)) 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)](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 [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/d97116cb-41fd-4b6c-a66a-8e56fb58c5db%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/d97116cb-41fd-4b6c-a66a-8e56fb58c5db%40googlegroups.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:32am UTC](https://discuss.elastic.co/t/need-help-attachment-ype-in-elastic-search/17319/2 "2017-07-06T01:32:08Z")

</div>


