# Elastic attachments feature

**URL:** <https://discuss.elastic.co/t/elastic-attachments-feature/13087>\
**Category:** Elasticsearch\
**Created:** [August 6, 2013, 9:53am UTC](https://discuss.elastic.co/t/elastic-attachments-feature/13087 "2013-08-06T09:53:36Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Eyal](https://avatars.discourse-cdn.com/v4/letter/e/76d3ee/32.png) [@Eyal](https://discuss.elastic.co/u/Eyal)\
**Post date:** [August 6, 2013, 9:53am UTC](https://discuss.elastic.co/t/elastic-attachments-feature/13087/1 "2013-08-06T09:53:36Z")

</div>

I'm trying to get the attachment feature working but I have some problems  
posting the attachment.

I'm using elasticsearch-0.90.1, mapper-attachments (from the loading  
comments:  
[2013-08-06 12:23:00,040][INFO][plugins] [Franz Kafka -  
Node 1 - Client] loaded [mapper-attachments], sites [bigdesk, head,  
paramedic])

I have a field of type 'attachment' named 'my\_attachment', and I'm trying  
to post a file to it like so:

curl -X POST  
"[http://localhost:9200/system\_attachments/system%2Fattachment/2](http://localhost:9200/system_attachments/system%2Fattachment/2)" -d  
'{"my\_attachment":"TG9yZW0gSXBzdW0gaXMgc2ltcGx5IGR1bW15IHRleHQgb2YgdGhlIHByaW50\naW5nIGFuZCB0eXBlc2V0dGluZyBpbmR1c3RyeS4gTG9yZW0gSXBzdW0gaGFz\nIGJlZW4gdGhlIGluZHVzdHJ5J3Mgc3RhbmRhcmQgZHVtbXkgdGV4dCBldmVy\nIHNpbmNlIHRoZSAxNTAwcywgd2hlbiBhbiB1bmtub3duIHByaW50ZXIgdG9v\nayBhIGdhbGxleSBvZiB0eXBlIGFuZCBzY3JhbWJsZWQgaXQgdG8gbWFrZSBh\nIHR5cGUgc3BlY2ltZW4gYm9vay4gSXQgaGFzIHN1cnZpdmVkIG5vdCBvbmx5\nIGZpdmUgY2VudHVyaWVzLCBidXQgYWxzbyB0aGUgbGVhcCBpbnRvIGVsZWN0\ncm9uaWMgdHlwZXNldHRpbmcsIHJlbWFpbmluZyBlc3NlbnRpYWxseSB1bmNo\nYW5nZWQuIEl0IHdhcyBwb3B1bGFyaXNlZCBpbiB0aGUgMTk2MHMgd2l0aCB0\naGUgcmVsZWFzZSBvZiBMZXRyYXNldCBzaGVldHMgY29udGFpbmluZyBMb3Jl\nbSBJcHN1bSBwYXNzYWdlcywgYW5kIG1vcmUgcmVjZW50bHkgd2l0aCBkZXNr\ndG9wIHB1Ymxpc2hpbmcgc29mdHdhcmUgbGlrZSBBbGR1cyBQYWdlTWFrZXIg\naW5jbHVkaW5nIHZlcnNpb25zIG9mIExvcmVtIElwc3VtLg==\n"}'

My mapping looks ok, you can see that 'my\_attachment' is of type  
'attachment' and all the default fields. This is my mapping:

{  
state: open  
settings: {  
index.analysis.filter.my\_ngram.max\_gram: 15  
index.analysis.filter.my\_ngram.type: nGram  
index.number\_of\_replicas: 0  
index.analysis.filter.my\_ngram.min\_gram: 1  
index.analysis.analyzer.ngram\_analyzer.filter.1: my\_ngram  
index.analysis.filter.my\_stemmer.name: english  
index.analysis.analyzer.ngram\_analyzer.filter.0: stop  
index.analysis.filter.my\_stemmer.type: stemmer  
index.analysis.analyzer.ngram\_analyzer.tokenizer: whitespace  
index.analysis.analyzer.ngram\_analyzer.type: custom  
index.number\_of\_shards: 2  
index.analysis.analyzer.ngram\_analyzer.filter.2: lowercase  
index.version.created: 900199  
}  
mappings: {  
system/attachment: {  
properties: {  
my\_attachment: {  
path: full  
type: attachment  
fields: {  
author: {  
type: string  
}  
title: {  
type: string  
}  
keywords: {  
type: string  
}  
my\_attachment: {  
analyzer: ngram\_analyzer  
type: string  
}  
name: {  
type: string  
}  
date: {  
format: dateOptionalTime  
type: date  
}  
content\_type: {  
type: string  
}  
}  
}  
description: {  
analyzer: ngram\_analyzer  
type: string  
}  
attachment\_file\_name: {  
analyzer: ngram\_analyzer  
type: string  
}  
filename: {  
analyzer: ngram\_analyzer  
type: string  
}  
}  
}  
}  
aliases: []  
}

but the document is looking strange:  
{  
\_index: system\_attachments  
\_type: system/attachment  
\_id: 2  
\_version: 2  
\_score: 1  
\_source: {  
my\_attachment: TG9yZW0gSXBzdW0gaXMgc2ltcGx5IGR1bW15IHRleHQgb2YgdGhlIHByaW50  
aW5nIGFuZCB0eXBlc2V0dGluZyBpbmR1c3RyeS4gTG9yZW0gSXBzdW0gaGFz  
IGJlZW4gdGhlIGluZHVzdHJ5J3Mgc3RhbmRhcmQgZHVtbXkgdGV4dCBldmVy  
IHNpbmNlIHRoZSAxNTAwcywgd2hlbiBhbiB1bmtub3duIHByaW50ZXIgdG9v  
ayBhIGdhbGxleSBvZiB0eXBlIGFuZCBzY3JhbWJsZWQgaXQgdG8gbWFrZSBh  
IHR5cGUgc3BlY2ltZW4gYm9vay4gSXQgaGFzIHN1cnZpdmVkIG5vdCBvbmx5  
IGZpdmUgY2VudHVyaWVzLCBidXQgYWxzbyB0aGUgbGVhcCBpbnRvIGVsZWN0  
cm9uaWMgdHlwZXNldHRpbmcsIHJlbWFpbmluZyBlc3NlbnRpYWxseSB1bmNo  
YW5nZWQuIEl0IHdhcyBwb3B1bGFyaXNlZCBpbiB0aGUgMTk2MHMgd2l0aCB0  
aGUgcmVsZWFzZSBvZiBMZXRyYXNldCBzaGVldHMgY29udGFpbmluZyBMb3Jl  
bSBJcHN1bSBwYXNzYWdlcywgYW5kIG1vcmUgcmVjZW50bHkgd2l0aCBkZXNr  
dG9wIHB1Ymxpc2hpbmcgc29mdHdhcmUgbGlrZSBBbGR1cyBQYWdlTWFrZXIg  
aW5jbHVkaW5nIHZlcnNpb25zIG9mIExvcmVtIElwc3VtLg==  
}  
}

What am I doing wrong?

Cheers,  
Eyal.

--  
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).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![Eyal](https://avatars.discourse-cdn.com/v4/letter/e/76d3ee/32.png) [@Eyal](https://discuss.elastic.co/u/Eyal)\
**Post date:** [August 6, 2013, 10:50am UTC](https://discuss.elastic.co/t/elastic-attachments-feature/13087/2 "2013-08-06T10:50:37Z")

</div>

I can't search for the content in these files, whether its pdf or xlsx.  
However, searching in txt files does work..

On Tuesday, August 6, 2013 12:53:36 PM UTC+3, Eyal wrote:

> I'm trying to get the attachment feature working but I have some problems  
> posting the attachment.
> 
> I'm using elasticsearch-0.90.1, mapper-attachments (from the loading  
> comments:  
> [2013-08-06 12:23:00,040][INFO][plugins] [Franz Kafka -  
> Node 1 - Client] loaded [mapper-attachments], sites [bigdesk, head,  
> paramedic])
> 
> I have a field of type 'attachment' named 'my\_attachment', and I'm trying  
> to post a file to it like so:
> 
> curl -X POST "  
> [http://localhost:9200/system\_attachments/system%2Fattachment/2](http://localhost:9200/system_attachments/system%2Fattachment/2)" -d  
> '{"my\_attachment":"TG9yZW0gSXBzdW0gaXMgc2ltcGx5IGR1bW15IHRleHQgb2YgdGhlIHByaW50\naW5nIGFuZCB0eXBlc2V0dGluZyBpbmR1c3RyeS4gTG9yZW0gSXBzdW0gaGFz\nIGJlZW4gdGhlIGluZHVzdHJ5J3Mgc3RhbmRhcmQgZHVtbXkgdGV4dCBldmVy\nIHNpbmNlIHRoZSAxNTAwcywgd2hlbiBhbiB1bmtub3duIHByaW50ZXIgdG9v\nayBhIGdhbGxleSBvZiB0eXBlIGFuZCBzY3JhbWJsZWQgaXQgdG8gbWFrZSBh\nIHR5cGUgc3BlY2ltZW4gYm9vay4gSXQgaGFzIHN1cnZpdmVkIG5vdCBvbmx5\nIGZpdmUgY2VudHVyaWVzLCBidXQgYWxzbyB0aGUgbGVhcCBpbnRvIGVsZWN0\ncm9uaWMgdHlwZXNldHRpbmcsIHJlbWFpbmluZyBlc3NlbnRpYWxseSB1bmNo\nYW5nZWQuIEl0IHdhcyBwb3B1bGFyaXNlZCBpbiB0aGUgMTk2MHMgd2l0aCB0\naGUgcmVsZWFzZSBvZiBMZXRyYXNldCBzaGVldHMgY29udGFpbmluZyBMb3Jl\nbSBJcHN1bSBwYXNzYWdlcywgYW5kIG1vcmUgcmVjZW50bHkgd2l0aCBkZXNr\ndG9wIHB1Ymxpc2hpbmcgc29mdHdhcmUgbGlrZSBBbGR1cyBQYWdlTWFrZXIg\naW5jbHVkaW5nIHZlcnNpb25zIG9mIExvcmVtIElwc3VtLg==\n"}'
> 
> My mapping looks ok, you can see that 'my\_attachment' is of type  
> 'attachment' and all the default fields. This is my mapping:
> 
> {  
> state: open  
> settings: {  
> index.analysis.filter.my\_ngram.max\_gram: 15  
> index.analysis.filter.my\_ngram.type: nGram  
> index.number\_of\_replicas: 0  
> index.analysis.filter.my\_ngram.min\_gram: 1  
> index.analysis.analyzer.ngram\_analyzer.filter.1: my\_ngram  
> index.analysis.filter.my\_stemmer.name: english  
> index.analysis.analyzer.ngram\_analyzer.filter.0: stop  
> index.analysis.filter.my\_stemmer.type: stemmer  
> index.analysis.analyzer.ngram\_analyzer.tokenizer: whitespace  
> index.analysis.analyzer.ngram\_analyzer.type: custom  
> index.number\_of\_shards: 2  
> index.analysis.analyzer.ngram\_analyzer.filter.2: lowercase  
> index.version.created: 900199  
> }  
> mappings: {  
> system/attachment: {  
> properties: {  
> my\_attachment: {  
> path: full  
> type: attachment  
> fields: {  
> author: {  
> type: string  
> }  
> title: {  
> type: string  
> }  
> keywords: {  
> type: string  
> }  
> my\_attachment: {  
> analyzer: ngram\_analyzer  
> type: string  
> }  
> name: {  
> type: string  
> }  
> date: {  
> format: dateOptionalTime  
> type: date  
> }  
> content\_type: {  
> type: string  
> }  
> }  
> }  
> description: {  
> analyzer: ngram\_analyzer  
> type: string  
> }  
> attachment\_file\_name: {  
> analyzer: ngram\_analyzer  
> type: string  
> }  
> filename: {  
> analyzer: ngram\_analyzer  
> type: string  
> }  
> }  
> }  
> }  
> aliases:   
> }
> 
> but the document is looking strange:  
> {  
> \_index: system\_attachments  
> \_type: system/attachment  
> \_id: 2  
> \_version: 2  
> \_score: 1  
> \_source: {  
> my\_attachment:  
> TG9yZW0gSXBzdW0gaXMgc2ltcGx5IGR1bW15IHRleHQgb2YgdGhlIHByaW50  
> aW5nIGFuZCB0eXBlc2V0dGluZyBpbmR1c3RyeS4gTG9yZW0gSXBzdW0gaGFz  
> IGJlZW4gdGhlIGluZHVzdHJ5J3Mgc3RhbmRhcmQgZHVtbXkgdGV4dCBldmVy  
> IHNpbmNlIHRoZSAxNTAwcywgd2hlbiBhbiB1bmtub3duIHByaW50ZXIgdG9v  
> ayBhIGdhbGxleSBvZiB0eXBlIGFuZCBzY3JhbWJsZWQgaXQgdG8gbWFrZSBh  
> IHR5cGUgc3BlY2ltZW4gYm9vay4gSXQgaGFzIHN1cnZpdmVkIG5vdCBvbmx5  
> IGZpdmUgY2VudHVyaWVzLCBidXQgYWxzbyB0aGUgbGVhcCBpbnRvIGVsZWN0  
> cm9uaWMgdHlwZXNldHRpbmcsIHJlbWFpbmluZyBlc3NlbnRpYWxseSB1bmNo  
> YW5nZWQuIEl0IHdhcyBwb3B1bGFyaXNlZCBpbiB0aGUgMTk2MHMgd2l0aCB0  
> aGUgcmVsZWFzZSBvZiBMZXRyYXNldCBzaGVldHMgY29udGFpbmluZyBMb3Jl  
> bSBJcHN1bSBwYXNzYWdlcywgYW5kIG1vcmUgcmVjZW50bHkgd2l0aCBkZXNr  
> dG9wIHB1Ymxpc2hpbmcgc29mdHdhcmUgbGlrZSBBbGR1cyBQYWdlTWFrZXIg  
> aW5jbHVkaW5nIHZlcnNpb25zIG9mIExvcmVtIElwc3VtLg==  
> }  
> }
> 
> What am I doing wrong?
> 
> Cheers,  
> Eyal.

--  
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).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<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, 2:22am UTC](https://discuss.elastic.co/t/elastic-attachments-feature/13087/3 "2017-07-06T02:22:42Z")

</div>


