# Attachment plugin: why does it return extracted text only if asked for "file" field explicitly?

**URL:** <https://discuss.elastic.co/t/attachment-plugin-why-does-it-return-extracted-text-only-if-asked-for-file-field-explicitly/44900>\
**Category:** Elasticsearch\
**Created:** [March 19, 2016, 1:58pm UTC](https://discuss.elastic.co/t/attachment-plugin-why-does-it-return-extracted-text-only-if-asked-for-file-field-explicitly/44900 "2016-03-19T13:58:01Z")\
**Posts on this page:** 5\
**Page:** 1

<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 19, 2016, 1:58pm UTC](https://discuss.elastic.co/t/attachment-plugin-why-does-it-return-extracted-text-only-if-asked-for-file-field-explicitly/44900/1 "2016-03-19T13:58:01Z")

</div>

If I ask for `file` field in my query explicitly, the field `file` in the response will contain extracted text. If I don't ask for any fields, the field `file` (in source) will be a subdocument with `_name`, `_content`, etc. I don't quite get how does it work, am I missing some basic Elasticsearch knowledge here?

I belive that the extraction isn't happening on each search (as I set `"store": true` for the file field), but there is no extracted text anywhere in `_source`. Where is it stored?

PS: By the way, if I set `"store": false`, will Elastic re-extract text from base64 on each search request?

---

<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 19, 2016, 2:23pm UTC](https://discuss.elastic.co/t/attachment-plugin-why-does-it-return-extracted-text-only-if-asked-for-file-field-explicitly/44900/2 "2016-03-19T14:23:14Z")

</div>

The source is never modified by elasticsearch. Other sub fields are generated and indexed at index time.

---

<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 19, 2016, 3:22pm UTC](https://discuss.elastic.co/t/attachment-plugin-why-does-it-return-extracted-text-only-if-asked-for-file-field-explicitly/44900/3 "2016-03-19T15:22:02Z")

</div>

Thanks! Your words pointed me into right direction.

For anyone struggling with the same question, [the post which cleared it up for me](http://elasticsearch-users.115913.n3.nabble.com/What-does-it-mean-to-store-a-field-tp3514176p3515729.html).

Could you please answer the PS part? If I set `"store": false` for a field of type `attachment`, will attachment plugin re-extract text from base64 from `_source` on each search request?

---

<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 19, 2016, 4:26pm UTC](https://discuss.elastic.co/t/attachment-plugin-why-does-it-return-extracted-text-only-if-asked-for-file-field-explicitly/44900/4 "2016-03-19T16:26:20Z")

</div>

You can set it to false unless you need to highlight the text.

---

<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:06pm UTC](https://discuss.elastic.co/t/attachment-plugin-why-does-it-return-extracted-text-only-if-asked-for-file-field-explicitly/44900/5 "2017-07-05T23:06:52Z")

</div>


