# Mapping for indexed attachments without storing them

**URL:** <https://discuss.elastic.co/t/mapping-for-indexed-attachments-without-storing-them/16233>\
**Category:** Elasticsearch\
**Created:** [March 7, 2014, 3:37pm UTC](https://discuss.elastic.co/t/mapping-for-indexed-attachments-without-storing-them/16233 "2014-03-07T15:37:51Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Pavel\_Hlousek](https://avatars.discourse-cdn.com/v4/letter/p/dec6dc/32.png) [@Pavel\_Hlousek](https://discuss.elastic.co/u/Pavel_Hlousek)\
**Post date:** [March 7, 2014, 3:37pm UTC](https://discuss.elastic.co/t/mapping-for-indexed-attachments-without-storing-them/16233/1 "2014-03-07T15:37:51Z")

</div>

Hello,

I'm new to elasticsearch and I'm currently playing with mapper-attachments  
plugin. My idea is to use ES to index file contents and NOT to store the  
file contents. Is it possible? What would the mapping be? Cannot get it  
working...

Thanks for help

Pavel

--  
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/d72c5f4b-bc21-4e95-9042-00cde1535789%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/d72c5f4b-bc21-4e95-9042-00cde1535789%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![Pavel\_Hlousek](https://avatars.discourse-cdn.com/v4/letter/p/dec6dc/32.png) [@Pavel\_Hlousek](https://discuss.elastic.co/u/Pavel_Hlousek)\
**Post date:** [March 7, 2014, 3:59pm UTC](https://discuss.elastic.co/t/mapping-for-indexed-attachments-without-storing-them/16233/2 "2014-03-07T15:59:20Z")

</div>

I forgot to mention that I used the latest releases of both ES and the  
mapper-attchments plugin.

Dne pátek, 7. března 2014 16:37:51 UTC+1 Pavel Hloušek napsal(a):

> Hello,
> 
> I'm new to elasticsearch and I'm currently playing with mapper-attachments  
> plugin. My idea is to use ES to index file contents and NOT to store the  
> file contents. Is it possible? What would the mapping be? Cannot get it  
> working...
> 
> Thanks for help
> 
> Pavel

--  
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/38ed817d-3ed5-47da-8498-41aebe692a22%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/38ed817d-3ed5-47da-8498-41aebe692a22%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [March 7, 2014, 4:03pm UTC](https://discuss.elastic.co/t/mapping-for-indexed-attachments-without-storing-them/16233/3 "2014-03-07T16:03:00Z")

</div>

The best idea is not to use mapper attachment and extract content before indexing using Apache Tika for example, which is used as well in mapper attachment.  
That's what I did in FSRiver project. At first I was using mapper attachment but definitely not using it gives more flexibility and more control of what you are sending over the wire.

That said, you can use exclude to remove from \_source some content.  
See: [http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/mapping-source-field.html#include-exclude](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/mapping-source-field.html#include-exclude)

--  
David Pilato | Technical Advocate | [Elasticsearch.com](http://Elasticsearch.com)  
@dadoonet | @elasticsearchfr

Le 7 mars 2014 à 16:59:23, Pavel Hloušek ([pavel.hlousek@gmail.com](mailto:pavel.hlousek@gmail.com)) a écrit:

I forgot to mention that I used the latest releases of both ES and the mapper-attchments plugin.

Dne pátek, 7. března 2014 16:37:51 UTC+1 Pavel Hloušek napsal(a):  
Hello,

I'm new to elasticsearch and I'm currently playing with mapper-attachments plugin. My idea is to use ES to index file contents and NOT to store the file contents. Is it possible? What would the mapping be? Cannot get it working...

Thanks for help

## Pavel

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/38ed817d-3ed5-47da-8498-41aebe692a22%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/38ed817d-3ed5-47da-8498-41aebe692a22%40googlegroups.com).  
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/etPan.5319edb4.12200854.9291%40MacBook-Air-de-David.local](https://groups.google.com/d/msgid/elasticsearch/etPan.5319edb4.12200854.9291%40MacBook-Air-de-David.local).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![Pavel\_Hlousek](https://avatars.discourse-cdn.com/v4/letter/p/dec6dc/32.png) [@Pavel\_Hlousek](https://discuss.elastic.co/u/Pavel_Hlousek)\
**Post date:** [March 7, 2014, 4:14pm UTC](https://discuss.elastic.co/t/mapping-for-indexed-attachments-without-storing-them/16233/4 "2014-03-07T16:14:14Z")

</div>

Here is a gist that reproduces my steps:

> <https://gist.github.com/anonymous/9414437>

Dne pátek, 7. března 2014 16:37:51 UTC+1 Pavel Hloušek napsal(a):

> Hello,
> 
> I'm new to elasticsearch and I'm currently playing with mapper-attachments  
> plugin. My idea is to use ES to index file contents and NOT to store the  
> file contents. Is it possible? What would the mapping be? Cannot get it  
> working...
> 
> Thanks for help
> 
> Pavel

--  
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/88a8ad46-0d60-462d-b914-75a096830208%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/88a8ad46-0d60-462d-b914-75a096830208%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![Pavel\_Hlousek](https://avatars.discourse-cdn.com/v4/letter/p/dec6dc/32.png) [@Pavel\_Hlousek](https://discuss.elastic.co/u/Pavel_Hlousek)\
**Post date:** [March 7, 2014, 4:18pm UTC](https://discuss.elastic.co/t/mapping-for-indexed-attachments-without-storing-them/16233/5 "2014-03-07T16:18:53Z")

</div>

Thanks for your answer. I get your point. However, for a PHP project it  
seemed easier to user mapper attachment. Otherwise there is need to keep  
Apache Tika server running or run it each time from cli which is rather  
expensive.

Still, exclude is nice but I'd like to share space on servers - there can  
be a lot of content.

Pavel

Dne pátek, 7. března 2014 17:03:00 UTC+1 David Pilato napsal(a):

> The best idea is not to use mapper attachment and extract content before  
> indexing using Apache Tika for example, which is used as well in mapper  
> attachment.  
> That's what I did in FSRiver project. At first I was using mapper  
> attachment but definitely not using it gives more flexibility and more  
> control of what you are sending over the wire.
> 
> That said, you can use exclude to remove from \_source some content.  
> See:  
> [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/mapping-source-field.html#include-exclude)
> 
> --  
> _David Pilato_ | _Technical Advocate_ | _[Elasticsearch.com](http://Elasticsearch.com)_  
> @dadoonet [https://twitter.com/dadoonet](https://twitter.com/dadoonet) | @elasticsearchfr[https://twitter.com/elasticsearchfr](https://twitter.com/elasticsearchfr)
> 
> Le 7 mars 2014 à 16:59:23, Pavel Hloušek ([pavel....@gmail.com](mailto:pavel....@gmail.com)\<javascript:\>)  
> a écrit:
> 
> I forgot to mention that I used the latest releases of both ES and the  
> mapper-attchments plugin.
> 
> Dne pátek, 7. března 2014 16:37:51 UTC+1 Pavel Hloušek napsal(a):
> 
> > Hello,
> > 
> > I'm new to elasticsearch and I'm currently playing with  
> > mapper-attachments plugin. My idea is to use ES to index file contents and  
> > NOT to store the file contents. Is it possible? What would the mapping be?  
> > Cannot get it working...
> > 
> > Thanks for help
> > 
> > Pavel
> 
> --  
> 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 [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com) \<javascript:\>.  
> To view this discussion on the web visit  
> [https://groups.google.com/d/msgid/elasticsearch/38ed817d-3ed5-47da-8498-41aebe692a22%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/38ed817d-3ed5-47da-8498-41aebe692a22%40googlegroups.com)[https://groups.google.com/d/msgid/elasticsearch/38ed817d-3ed5-47da-8498-41aebe692a22%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/38ed817d-3ed5-47da-8498-41aebe692a22%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/a798dab0-3bee-40ae-a200-55a4173b6c71%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/a798dab0-3bee-40ae-a200-55a4173b6c71%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [March 7, 2014, 5:10pm UTC](https://discuss.elastic.co/t/mapping-for-indexed-attachments-without-storing-them/16233/6 "2014-03-07T17:10:02Z")

</div>

What's wrong with exclude?  
It does the job, right?

--  
David 😉  
Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs

> Le 7 mars 2014 à 17:18, Pavel Hloušek [pavel.hlousek@gmail.com](mailto:pavel.hlousek@gmail.com) a écrit :
> 
> Thanks for your answer. I get your point. However, for a PHP project it seemed easier to user mapper attachment. Otherwise there is need to keep Apache Tika server running or run it each time from cli which is rather expensive.
> 
> Still, exclude is nice but I'd like to share space on servers - there can be a lot of content.
> 
> Pavel
> 
> Dne pátek, 7. března 2014 17:03:00 UTC+1 David Pilato napsal(a):
> 
> > The best idea is not to use mapper attachment and extract content before indexing using Apache Tika for example, which is used as well in mapper attachment.  
> > That's what I did in FSRiver project. At first I was using mapper attachment but definitely not using it gives more flexibility and more control of what you are sending over the wire.
> > 
> > That said, you can use exclude to remove from \_source some content.  
> > See: [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/mapping-source-field.html#include-exclude)
> > 
> > --  
> > David Pilato | Technical Advocate | [Elasticsearch.com](http://Elasticsearch.com)  
> > @dadoonet | @elasticsearchfr
> > 
> > > Le 7 mars 2014 à 16:59:23, Pavel Hloušek ([pavel....@gmail.com](mailto:pavel....@gmail.com)) a écrit:
> > > 
> > > I forgot to mention that I used the latest releases of both ES and the mapper-attchments plugin.
> > > 
> > > Dne pátek, 7. března 2014 16:37:51 UTC+1 Pavel Hloušek napsal(a):
> > > 
> > > > Hello,
> > > > 
> > > > I'm new to elasticsearch and I'm currently playing with mapper-attachments plugin. My idea is to use ES to index file contents and NOT to store the file contents. Is it possible? What would the mapping be? Cannot get it working...
> > > > 
> > > > Thanks for help
> > > > 
> > > > Pavel  
> > > > --  
> > > > 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 [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com).  
> > > > To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/38ed817d-3ed5-47da-8498-41aebe692a22%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/38ed817d-3ed5-47da-8498-41aebe692a22%40googlegroups.com).  
> > > > 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/a798dab0-3bee-40ae-a200-55a4173b6c71%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/a798dab0-3bee-40ae-a200-55a4173b6c71%40googlegroups.com).  
> 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/DB4E69A9-EC1A-4FF5-B2FC-E0CE03D88F1F%40pilato.fr](https://groups.google.com/d/msgid/elasticsearch/DB4E69A9-EC1A-4FF5-B2FC-E0CE03D88F1F%40pilato.fr).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![vorou](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/vorou/32/8377_2.png) [@vorou](https://discuss.elastic.co/u/vorou)\
**Post date:** [March 9, 2016, 6:46pm UTC](https://discuss.elastic.co/t/mapping-for-indexed-attachments-without-storing-them/16233/7 "2016-03-09T18:46:19Z")

</div>

Sorry to ressurect an old topic.

Exclude did the job, thank you. But could you please elaborate on why the plugin stores the base64 by default? I guess you'll need it only if something in Tika extracting process changed. Are there any other reasons why shouldn't I disable it?

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [March 9, 2016, 6:59pm UTC](https://discuss.elastic.co/t/mapping-for-indexed-attachments-without-storing-them/16233/8 "2016-03-09T18:59:13Z")

</div>

It was by design. Note that it will change with 5.0.0 with this [https://www.elastic.co/guide/en/elasticsearch/plugins/master/ingest-attachment.html](https://www.elastic.co/guide/en/elasticsearch/plugins/master/ingest-attachment.html)

---

<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 5, 2017, 11:09pm UTC](https://discuss.elastic.co/t/mapping-for-indexed-attachments-without-storing-them/16233/9 "2017-07-05T23:09:50Z")

</div>


