# Trying to add attachments

**URL:** <https://discuss.elastic.co/t/trying-to-add-attachments/15954>\
**Category:** Elasticsearch\
**Created:** [February 21, 2014, 3:08pm UTC](https://discuss.elastic.co/t/trying-to-add-attachments/15954 "2014-02-21T15:08:57Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Patrick\_Aljord](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/patrick_aljord/32/1785_2.png) [@Patrick\_Aljord](https://discuss.elastic.co/u/Patrick_Aljord)\
**Post date:** [February 21, 2014, 3:08pm UTC](https://discuss.elastic.co/t/trying-to-add-attachments/15954/1 "2014-02-21T15:08:57Z")

</div>

Hey all,

I'm trying to map a field to have type attachment, this works on new  
indices but not on existing ones.  
Is there a way to do this on existing indices? Here is the gist of it:

> <https://gist.github.com/patcito/281143ee4f440171c875>

Thanks in advance,

Pat

--  
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/52be5155-1d34-47e4-9484-284c976c49c2%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/52be5155-1d34-47e4-9484-284c976c49c2%40googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<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:** [February 21, 2014, 3:12pm UTC](https://discuss.elastic.co/t/trying-to-add-attachments/15954/2 "2014-02-21T15:12:09Z")

</div>

Salut Patrick! 🙂

You can not update an existing field with new specification for this field.  
You need to either add a new field, create a new type (with the new mapping) or create a new index.

In addition to this, if you have existing documents, you'll probably need to reindex them.

Note: that although mapper attachment is cool to start with elasticsearch, I'd prefer to do text extraction in another process than at index time.

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

Le 21 février 2014 à 16:09:00, Patrick Aljord ([patcito@gmail.com](mailto:patcito@gmail.com)) a écrit:

Hey all,

I'm trying to map a field to have type attachment, this works on new indices but not on existing ones.  
Is there a way to do this on existing indices? Here is the gist of it:

> <https://gist.github.com/patcito/281143ee4f440171c875>

Thanks in advance,

## Pat

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/52be5155-1d34-47e4-9484-284c976c49c2%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/52be5155-1d34-47e4-9484-284c976c49c2%40googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
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.53076cc9.2ae8944a.5655%40MacBook-Air-de-David.local](https://groups.google.com/d/msgid/elasticsearch/etPan.53076cc9.2ae8944a.5655%40MacBook-Air-de-David.local).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![Patrick\_Aljord](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/patrick_aljord/32/1785_2.png) [@Patrick\_Aljord](https://discuss.elastic.co/u/Patrick_Aljord)\
**Post date:** [February 21, 2014, 3:31pm UTC](https://discuss.elastic.co/t/trying-to-add-attachments/15954/3 "2014-02-21T15:31:47Z")

</div>

Salut David 🙂 Thanks for the quick reply.

So, the best way to do this would be to index the attachment in another  
document in another process? Or could it be in the same document as an  
attachment but in a different process always? Also is there another way to  
index files than by mapper attachment?

On Friday, February 21, 2014 4:12:09 PM UTC+1, David Pilato wrote:

> Salut Patrick! 🙂
> 
> You can not update an existing field with new specification for this field.  
> You need to either add a new field, create a new type (with the new  
> mapping) or create a new index.
> 
> In addition to this, if you have existing documents, you'll probably need  
> to reindex them.
> 
> Note: that although mapper attachment is cool to start with elasticsearch,  
> I'd prefer to do text extraction in another process than at index time.
> 
> --  
> _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 21 février 2014 à 16:09:00, Patrick Aljord ([pat...@gmail.com](mailto:pat...@gmail.com)\<javascript:\>)  
> a écrit:
> 
> Hey all,
> 
> I'm trying to map a field to have type attachment, this works on new  
> indices but not on existing ones.  
> Is there a way to do this on existing indices? Here is the gist of it:
> 
> [elasticsearch attachments · GitHub](https://gist.github.com/patcito/281143ee4f440171c875)
> 
> Thanks in advance,
> 
> ## Pat
> 
> 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/52be5155-1d34-47e4-9484-284c976c49c2%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/52be5155-1d34-47e4-9484-284c976c49c2%40googlegroups.com)  
> .  
> For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
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/23429696-37f0-4994-bbe7-daa83efd3de2%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/23429696-37f0-4994-bbe7-daa83efd3de2%40googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<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:** [February 21, 2014, 3:39pm UTC](https://discuss.elastic.co/t/trying-to-add-attachments/15954/4 "2014-02-21T15:39:55Z")

</div>

You can index attachment content in the same document. That's really fine.  
I would only recommend to extract document content and metadata in another process.  
Then, in that process, generate the JSon document with all needed fields.

This is basically what I did in FSRiver. I removed the mapper attachment as it was not flexible enough for my use case.  
Imagine that you send a big PDF file (100Mb) which contains mostly pictures and 10kb of text. Instead of sending the full 100Mb document encoded in Base64, you can extract text and only send text over the wire. (your network bandwidth will say thank you 🙂 )

[https://github.com/dadoonet/fsriver/blob/master/src/main/java/fr/pilato/elasticsearch/river/fs/river/FsRiver.java#L687](https://github.com/dadoonet/fsriver/blob/master/src/main/java/fr/pilato/elasticsearch/river/fs/river/FsRiver.java#L687)

I don't remember which programming language are you using? Can you use Tika from it?

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

Le 21 février 2014 à 16:31:51, Patrick Aljord ([patcito@gmail.com](mailto:patcito@gmail.com)) a écrit:

Salut David 🙂 Thanks for the quick reply.

So, the best way to do this would be to index the attachment in another document in another process? Or could it be in the same document as an attachment but in a different process always? Also is there another way to index files than by mapper attachment?

On Friday, February 21, 2014 4:12:09 PM UTC+1, David Pilato wrote:  
Salut Patrick! 🙂

You can not update an existing field with new specification for this field.  
You need to either add a new field, create a new type (with the new mapping) or create a new index.

In addition to this, if you have existing documents, you'll probably need to reindex them.

Note: that although mapper attachment is cool to start with elasticsearch, I'd prefer to do text extraction in another process than at index time.

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

Le 21 février 2014 à 16:09:00, Patrick Aljord ([pat...@gmail.com](mailto:pat...@gmail.com)) a écrit:

Hey all,

I'm trying to map a field to have type attachment, this works on new indices but not on existing ones.  
Is there a way to do this on existing indices? Here is the gist of it:

> <https://gist.github.com/patcito/281143ee4f440171c875>

Thanks in advance,

## Pat

## 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/52be5155-1d34-47e4-9484-284c976c49c2%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/52be5155-1d34-47e4-9484-284c976c49c2%40googlegroups.com). For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

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/23429696-37f0-4994-bbe7-daa83efd3de2%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/23429696-37f0-4994-bbe7-daa83efd3de2%40googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
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.5307734c.2eb141f2.5655%40MacBook-Air-de-David.local](https://groups.google.com/d/msgid/elasticsearch/etPan.5307734c.2eb141f2.5655%40MacBook-Air-de-David.local).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![Patrick\_Aljord](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/patrick_aljord/32/1785_2.png) [@Patrick\_Aljord](https://discuss.elastic.co/u/Patrick_Aljord)\
**Post date:** [February 21, 2014, 3:57pm UTC](https://discuss.elastic.co/t/trying-to-add-attachments/15954/5 "2014-02-21T15:57:26Z")

</div>

I'm using golang so I can index the attachment in a different go routine.  
FSRiver looks cool, with it I just need to upload files to /some/path and  
FSRiver will index them automatically every 15 minutes or so and doing the  
hard work of separating text from binary using tika, is that correct? I  
think I may just use that.

On Fri, Feb 21, 2014 at 4:39 PM, David Pilato [david@pilato.fr](mailto:david@pilato.fr) wrote:

> You can index attachment content in the same document. That's really fine.  
> I would only recommend to extract document content and metadata in another  
> process.  
> Then, in that process, generate the JSon document with all needed fields.
> 
> This is basically what I did in FSRiver. I removed the mapper attachment  
> as it was not flexible enough for my use case.  
> Imagine that you send a big PDF file (100Mb) which contains mostly  
> pictures and 10kb of text. Instead of sending the full 100Mb document  
> encoded in Base64, you can extract text and only send text over the wire.  
> (your network bandwidth will say thank you 🙂 )
> 
> [https://github.com/dadoonet/fsriver/blob/master/src/main/java/fr/pilato/elasticsearch/river/fs/river/FsRiver.java#L687](https://github.com/dadoonet/fsriver/blob/master/src/main/java/fr/pilato/elasticsearch/river/fs/river/FsRiver.java#L687)
> 
> I don't remember which programming language are you using? Can you use  
> Tika from it?
> 
> --  
> _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 21 février 2014 à 16:31:51, Patrick Aljord ([patcito@gmail.com](mailto:patcito@gmail.com)) a écrit:
> 
> Salut David 🙂 Thanks for the quick reply.
> 
> So, the best way to do this would be to index the attachment in another  
> document in another process? Or could it be in the same document as an  
> attachment but in a different process always? Also is there another way to  
> index files than by mapper attachment?
> 
> On Friday, February 21, 2014 4:12:09 PM UTC+1, David Pilato wrote:
> 
> > Salut Patrick! 🙂
> > 
> > You can not update an existing field with new specification for this  
> > field.  
> > You need to either add a new field, create a new type (with the new  
> > mapping) or create a new index.
> > 
> > In addition to this, if you have existing documents, you'll probably  
> > need to reindex them.
> > 
> > Note: that although mapper attachment is cool to start with  
> > elasticsearch, I'd prefer to do text extraction in another process than at  
> > index time.
> > 
> > ```
> > --
> > 
> > ```
> > 
> > _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 21 février 2014 à 16:09:00, Patrick Aljord ([pat...@gmail.com](mailto:pat...@gmail.com)) a écrit:
> > 
> > Hey all,
> > 
> > I'm trying to map a field to have type attachment, this works on new  
> > indices but not on existing ones.  
> > Is there a way to do this on existing indices? Here is the gist of it:
> > 
> > [elasticsearch attachments · GitHub](https://gist.github.com/patcito/281143ee4f440171c875)
> > 
> > Thanks in advance,
> > 
> > ## Pat
> > 
> > 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/](https://groups.google.com/d/)  
> > msgid/elasticsearch/52be5155-1d34-47e4-9484-284c976c49c2%  
> > [40googlegroups.com](http://40googlegroups.com).  
> > For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).
> > 
> > --  
> > 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/23429696-37f0-4994-bbe7-daa83efd3de2%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/23429696-37f0-4994-bbe7-daa83efd3de2%40googlegroups.com)  
> .  
> For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).
> 
> --  
> 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/5wkxrfMECZA/unsubscribe](https://groups.google.com/d/topic/elasticsearch/5wkxrfMECZA/unsubscribe).  
> To unsubscribe from this group and all its topics, 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.5307734c.2eb141f2.5655%40MacBook-Air-de-David.local](https://groups.google.com/d/msgid/elasticsearch/etPan.5307734c.2eb141f2.5655%40MacBook-Air-de-David.local)  
> .
> 
> For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
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/CAK9TW4rFBYRrVjLEiO1q4AcR%3D-J4F%2B0Cv7p02pE5-bzXan6Jxg%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAK9TW4rFBYRrVjLEiO1q4AcR%3D-J4F%2B0Cv7p02pE5-bzXan6Jxg%40mail.gmail.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<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:** [February 21, 2014, 3:58pm UTC](https://discuss.elastic.co/t/trying-to-add-attachments/15954/6 "2014-02-21T15:58:42Z")

</div>

Yes. That's it.

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

Le 21 février 2014 à 16:57:29, Patrick Aljord ([patcito@gmail.com](mailto:patcito@gmail.com)) a écrit:

I'm using golang so I can index the attachment in a different go routine. FSRiver looks cool, with it I just need to upload files to /some/path and FSRiver will index them automatically every 15 minutes or so and doing the hard work of separating text from binary using tika, is that correct? I think I may just use that.

On Fri, Feb 21, 2014 at 4:39 PM, David Pilato [david@pilato.fr](mailto:david@pilato.fr) wrote:  
You can index attachment content in the same document. That's really fine.  
I would only recommend to extract document content and metadata in another process.  
Then, in that process, generate the JSon document with all needed fields.

This is basically what I did in FSRiver. I removed the mapper attachment as it was not flexible enough for my use case.  
Imagine that you send a big PDF file (100Mb) which contains mostly pictures and 10kb of text. Instead of sending the full 100Mb document encoded in Base64, you can extract text and only send text over the wire. (your network bandwidth will say thank you 🙂 )

[https://github.com/dadoonet/fsriver/blob/master/src/main/java/fr/pilato/elasticsearch/river/fs/river/FsRiver.java#L687](https://github.com/dadoonet/fsriver/blob/master/src/main/java/fr/pilato/elasticsearch/river/fs/river/FsRiver.java#L687)

I don't remember which programming language are you using? Can you use Tika from it?

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

Le 21 février 2014 à 16:31:51, Patrick Aljord ([patcito@gmail.com](mailto:patcito@gmail.com)) a écrit:

Salut David 🙂 Thanks for the quick reply.

So, the best way to do this would be to index the attachment in another document in another process? Or could it be in the same document as an attachment but in a different process always? Also is there another way to index files than by mapper attachment?

On Friday, February 21, 2014 4:12:09 PM UTC+1, David Pilato wrote:  
Salut Patrick! 🙂

You can not update an existing field with new specification for this field.  
You need to either add a new field, create a new type (with the new mapping) or create a new index.

In addition to this, if you have existing documents, you'll probably need to reindex them.

Note: that although mapper attachment is cool to start with elasticsearch, I'd prefer to do text extraction in another process than at index time.

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

Le 21 février 2014 à 16:09:00, Patrick Aljord ([pat...@gmail.com](mailto:pat...@gmail.com)) a écrit:

Hey all,

I'm trying to map a field to have type attachment, this works on new indices but not on existing ones.  
Is there a way to do this on existing indices? Here is the gist of it:

> <https://gist.github.com/patcito/281143ee4f440171c875>

Thanks in advance,

## Pat

## 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/52be5155-1d34-47e4-9484-284c976c49c2%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/52be5155-1d34-47e4-9484-284c976c49c2%40googlegroups.com). For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

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/23429696-37f0-4994-bbe7-daa83efd3de2%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/23429696-37f0-4994-bbe7-daa83efd3de2%40googlegroups.com). For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

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/5wkxrfMECZA/unsubscribe](https://groups.google.com/d/topic/elasticsearch/5wkxrfMECZA/unsubscribe).  
To unsubscribe from this group and all its topics, 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.5307734c.2eb141f2.5655%40MacBook-Air-de-David.local](https://groups.google.com/d/msgid/elasticsearch/etPan.5307734c.2eb141f2.5655%40MacBook-Air-de-David.local).

For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
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/CAK9TW4rFBYRrVjLEiO1q4AcR%3D-J4F%2B0Cv7p02pE5-bzXan6Jxg%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAK9TW4rFBYRrVjLEiO1q4AcR%3D-J4F%2B0Cv7p02pE5-bzXan6Jxg%40mail.gmail.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
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.530777b2.216231b.5655%40MacBook-Air-de-David.local](https://groups.google.com/d/msgid/elasticsearch/etPan.530777b2.216231b.5655%40MacBook-Air-de-David.local).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![Patrick\_Aljord](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/patrick_aljord/32/1785_2.png) [@Patrick\_Aljord](https://discuss.elastic.co/u/Patrick_Aljord)\
**Post date:** [February 21, 2014, 4:03pm UTC](https://discuss.elastic.co/t/trying-to-add-attachments/15954/7 "2014-02-21T16:03:51Z")

</div>

Hm, do you know how I would proceed to attach FSRiver docs to my regular  
elasticsearch index? I mean, from my app point of view, some docs have  
attachments, is there a trick to link FSRiver indexed files to other  
elasticsearch docs in a different index so I can query docs with FSRiver  
attached files (I hope this makes sense)?

On Fri, Feb 21, 2014 at 4:58 PM, David Pilato [david@pilato.fr](mailto:david@pilato.fr) wrote:

> Yes. That's it.
> 
> --  
> _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 21 février 2014 à 16:57:29, Patrick Aljord ([patcito@gmail.com](mailto:patcito@gmail.com)) a écrit:
> 
> I'm using golang so I can index the attachment in a different go routine.  
> FSRiver looks cool, with it I just need to upload files to /some/path and  
> FSRiver will index them automatically every 15 minutes or so and doing the  
> hard work of separating text from binary using tika, is that correct? I  
> think I may just use that.
> 
> On Fri, Feb 21, 2014 at 4:39 PM, David Pilato [david@pilato.fr](mailto:david@pilato.fr) wrote:
> 
> > You can index attachment content in the same document. That's really  
> > fine.  
> > I would only recommend to extract document content and metadata in  
> > another process.  
> > Then, in that process, generate the JSon document with all needed fields.
> > 
> > This is basically what I did in FSRiver. I removed the mapper attachment  
> > as it was not flexible enough for my use case.  
> > Imagine that you send a big PDF file (100Mb) which contains mostly  
> > pictures and 10kb of text. Instead of sending the full 100Mb document  
> > encoded in Base64, you can extract text and only send text over the wire.  
> > (your network bandwidth will say thank you 🙂 )
> > 
> > [https://github.com/dadoonet/fsriver/blob/master/src/main/java/fr/pilato/elasticsearch/river/fs/river/FsRiver.java#L687](https://github.com/dadoonet/fsriver/blob/master/src/main/java/fr/pilato/elasticsearch/river/fs/river/FsRiver.java#L687)
> > 
> > I don't remember which programming language are you using? Can you use  
> > Tika from it?
> > 
> > ```
> > --
> > 
> > ```
> > 
> > _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 21 février 2014 à 16:31:51, Patrick Aljord ([patcito@gmail.com](mailto:patcito@gmail.com)) a  
> > écrit:
> > 
> > Salut David 🙂 Thanks for the quick reply.
> > 
> > So, the best way to do this would be to index the attachment in another  
> > document in another process? Or could it be in the same document as an  
> > attachment but in a different process always? Also is there another way to  
> > index files than by mapper attachment?
> > 
> > On Friday, February 21, 2014 4:12:09 PM UTC+1, David Pilato wrote:
> > 
> > > Salut Patrick! 🙂
> > > 
> > > You can not update an existing field with new specification for this  
> > > field.  
> > > You need to either add a new field, create a new type (with the new  
> > > mapping) or create a new index.
> > > 
> > > In addition to this, if you have existing documents, you'll probably  
> > > need to reindex them.
> > > 
> > > Note: that although mapper attachment is cool to start with  
> > > elasticsearch, I'd prefer to do text extraction in another process than at  
> > > index time.
> > > 
> > > ```
> > > --
> > > 
> > > ```
> > > 
> > > _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 21 février 2014 à 16:09:00, Patrick Aljord ([pat...@gmail.com](mailto:pat...@gmail.com)) a  
> > > écrit:
> > > 
> > > Hey all,
> > > 
> > > I'm trying to map a field to have type attachment, this works on new  
> > > indices but not on existing ones.  
> > > Is there a way to do this on existing indices? Here is the gist of it:
> > > 
> > > [elasticsearch attachments · GitHub](https://gist.github.com/patcito/281143ee4f440171c875)
> > > 
> > > Thanks in advance,
> > > 
> > > ## Pat
> > > 
> > > 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/52be5155-1d34-47e4-9484-284c976c49c2%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/52be5155-1d34-47e4-9484-284c976c49c2%40googlegroups.com)  
> > > .  
> > > For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).
> > > 
> > > --  
> > > 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/23429696-37f0-4994-bbe7-daa83efd3de2%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/23429696-37f0-4994-bbe7-daa83efd3de2%40googlegroups.com)  
> > .  
> > For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).
> > 
> > --  
> > 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/5wkxrfMECZA/unsubscribe](https://groups.google.com/d/topic/elasticsearch/5wkxrfMECZA/unsubscribe).  
> > To unsubscribe from this group and all its topics, 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.5307734c.2eb141f2.5655%40MacBook-Air-de-David.local](https://groups.google.com/d/msgid/elasticsearch/etPan.5307734c.2eb141f2.5655%40MacBook-Air-de-David.local).
> > 
> > For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).
> 
> --  
> 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/CAK9TW4rFBYRrVjLEiO1q4AcR%3D-J4F%2B0Cv7p02pE5-bzXan6Jxg%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAK9TW4rFBYRrVjLEiO1q4AcR%3D-J4F%2B0Cv7p02pE5-bzXan6Jxg%40mail.gmail.com)  
> .
> 
> For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).
> 
> --  
> 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/5wkxrfMECZA/unsubscribe](https://groups.google.com/d/topic/elasticsearch/5wkxrfMECZA/unsubscribe).  
> To unsubscribe from this group and all its topics, 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.530777b2.216231b.5655%40MacBook-Air-de-David.local](https://groups.google.com/d/msgid/elasticsearch/etPan.530777b2.216231b.5655%40MacBook-Air-de-David.local)  
> .
> 
> For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
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/CAK9TW4pffMyF6WU1TZU2p%2BQMX-X1JVsPba3iWa\_rVfXR7\_xQTQ%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAK9TW4pffMyF6WU1TZU2p%2BQMX-X1JVsPba3iWa_rVfXR7_xQTQ%40mail.gmail.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<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:** [February 21, 2014, 4:05pm UTC](https://discuss.elastic.co/t/trying-to-add-attachments/15954/8 "2014-02-21T16:05:45Z")

</div>

It makes sense but you can not do it with FSRiver. ☹  
So I guess you need to do something similar to FSRiver in your own project.

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

Le 21 février 2014 à 17:03:55, Patrick Aljord ([patcito@gmail.com](mailto:patcito@gmail.com)) a écrit:

Hm, do you know how I would proceed to attach FSRiver docs to my regular elasticsearch index? I mean, from my app point of view, some docs have attachments, is there a trick to link FSRiver indexed files to other elasticsearch docs in a different index so I can query docs with FSRiver attached files (I hope this makes sense)?

On Fri, Feb 21, 2014 at 4:58 PM, David Pilato [david@pilato.fr](mailto:david@pilato.fr) wrote:  
Yes. That's it.

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

Le 21 février 2014 à 16:57:29, Patrick Aljord ([patcito@gmail.com](mailto:patcito@gmail.com)) a écrit:

I'm using golang so I can index the attachment in a different go routine. FSRiver looks cool, with it I just need to upload files to /some/path and FSRiver will index them automatically every 15 minutes or so and doing the hard work of separating text from binary using tika, is that correct? I think I may just use that.

On Fri, Feb 21, 2014 at 4:39 PM, David Pilato [david@pilato.fr](mailto:david@pilato.fr) wrote:  
You can index attachment content in the same document. That's really fine.  
I would only recommend to extract document content and metadata in another process.  
Then, in that process, generate the JSon document with all needed fields.

This is basically what I did in FSRiver. I removed the mapper attachment as it was not flexible enough for my use case.  
Imagine that you send a big PDF file (100Mb) which contains mostly pictures and 10kb of text. Instead of sending the full 100Mb document encoded in Base64, you can extract text and only send text over the wire. (your network bandwidth will say thank you 🙂 )

[https://github.com/dadoonet/fsriver/blob/master/src/main/java/fr/pilato/elasticsearch/river/fs/river/FsRiver.java#L687](https://github.com/dadoonet/fsriver/blob/master/src/main/java/fr/pilato/elasticsearch/river/fs/river/FsRiver.java#L687)

I don't remember which programming language are you using? Can you use Tika from it?

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

Le 21 février 2014 à 16:31:51, Patrick Aljord ([patcito@gmail.com](mailto:patcito@gmail.com)) a écrit:

Salut David 🙂 Thanks for the quick reply.

So, the best way to do this would be to index the attachment in another document in another process? Or could it be in the same document as an attachment but in a different process always? Also is there another way to index files than by mapper attachment?

On Friday, February 21, 2014 4:12:09 PM UTC+1, David Pilato wrote:  
Salut Patrick! 🙂

You can not update an existing field with new specification for this field.  
You need to either add a new field, create a new type (with the new mapping) or create a new index.

In addition to this, if you have existing documents, you'll probably need to reindex them.

Note: that although mapper attachment is cool to start with elasticsearch, I'd prefer to do text extraction in another process than at index time.

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

Le 21 février 2014 à 16:09:00, Patrick Aljord ([pat...@gmail.com](mailto:pat...@gmail.com)) a écrit:

Hey all,

I'm trying to map a field to have type attachment, this works on new indices but not on existing ones.  
Is there a way to do this on existing indices? Here is the gist of it:

> <https://gist.github.com/patcito/281143ee4f440171c875>

Thanks in advance,

## Pat

## 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/52be5155-1d34-47e4-9484-284c976c49c2%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/52be5155-1d34-47e4-9484-284c976c49c2%40googlegroups.com). For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

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/23429696-37f0-4994-bbe7-daa83efd3de2%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/23429696-37f0-4994-bbe7-daa83efd3de2%40googlegroups.com). For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

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/5wkxrfMECZA/unsubscribe](https://groups.google.com/d/topic/elasticsearch/5wkxrfMECZA/unsubscribe).  
To unsubscribe from this group and all its topics, 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.5307734c.2eb141f2.5655%40MacBook-Air-de-David.local](https://groups.google.com/d/msgid/elasticsearch/etPan.5307734c.2eb141f2.5655%40MacBook-Air-de-David.local).

For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
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/CAK9TW4rFBYRrVjLEiO1q4AcR%3D-J4F%2B0Cv7p02pE5-bzXan6Jxg%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAK9TW4rFBYRrVjLEiO1q4AcR%3D-J4F%2B0Cv7p02pE5-bzXan6Jxg%40mail.gmail.com).

## For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

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/5wkxrfMECZA/unsubscribe](https://groups.google.com/d/topic/elasticsearch/5wkxrfMECZA/unsubscribe).  
To unsubscribe from this group and all its topics, 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.530777b2.216231b.5655%40MacBook-Air-de-David.local](https://groups.google.com/d/msgid/elasticsearch/etPan.530777b2.216231b.5655%40MacBook-Air-de-David.local).

For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
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/CAK9TW4pffMyF6WU1TZU2p%2BQMX-X1JVsPba3iWa\_rVfXR7\_xQTQ%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAK9TW4pffMyF6WU1TZU2p%2BQMX-X1JVsPba3iWa_rVfXR7_xQTQ%40mail.gmail.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
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.53077959.140e0f76.5655%40MacBook-Air-de-David.local](https://groups.google.com/d/msgid/elasticsearch/etPan.53077959.140e0f76.5655%40MacBook-Air-de-David.local).  
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, 1:48am UTC](https://discuss.elastic.co/t/trying-to-add-attachments/15954/9 "2017-07-06T01:48:17Z")

</div>


