# Highlighting attachments

**URL:** <https://discuss.elastic.co/t/highlighting-attachments/13079>\
**Category:** Elasticsearch\
**Created:** [August 5, 2013, 10:34pm UTC](https://discuss.elastic.co/t/highlighting-attachments/13079 "2013-08-05T22:34:27Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Andrew\_Soep\_2](https://avatars.discourse-cdn.com/v4/letter/a/a8b319/32.png) [@Andrew\_Soep\_2](https://discuss.elastic.co/u/Andrew_Soep_2)\
**Post date:** [August 5, 2013, 10:34pm UTC](https://discuss.elastic.co/t/highlighting-attachments/13079/1 "2013-08-05T22:34:27Z")

</div>

I'm having an issue with getting attachments to highlight in ES. I think  
it has something to do with my mapping, which you can find here:  
[http://pastebin.com/gs0mdUpE](http://pastebin.com/gs0mdUpE)

What I'm confused about is, I thought that if I stored the document, it  
would pull out the data and put it in the appropriate fields if I provided  
the field property. This doesn't seem to be the case, as if I store the  
document with my current mapping (which looks identical to other mappings  
I've seen around the web), it just stores the content in the file property  
of the \_source and that's it. When I tried to add term\_vector to the root  
of the file property definition, it never took for some reason: only when I  
add it to fields-\>file.

Can anyone shed some light on this/let me know if my mappings are wrong?  
The search itself works great and returns what I need, I just can't seem  
to get highlighting to work.

--  
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:** ![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:** [August 6, 2013, 12:57am UTC](https://discuss.elastic.co/t/highlighting-attachments/13079/2 "2013-08-06T00:57:49Z")

</div>

Hey Andrew,

Have a look at this gist: [https://gist.github.com/dadoonet/3907010](https://gist.github.com/dadoonet/3907010)  
(You need to adapt it somehow as it is a bit old).

It should help.

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

Le 6 août 2013 à 00:34, Andrew Soep [siraris@gmail.com](mailto:siraris@gmail.com) a écrit :

I'm having an issue with getting attachments to highlight in ES. I think it has something to do with my mapping, which you can find here: [http://pastebin.com/gs0mdUpE](http://pastebin.com/gs0mdUpE)

What I'm confused about is, I thought that if I stored the document, it would pull out the data and put it in the appropriate fields if I provided the field property. This doesn't seem to be the case, as if I store the document with my current mapping (which looks identical to other mappings I've seen around the web), it just stores the content in the file property of the \_source and that's it. When I tried to add term\_vector to the root of the file property definition, it never took for some reason: only when I add it to fields-\>file.

## Can anyone shed some light on this/let me know if my mappings are wrong? The search itself works great and returns what I need, I just can't seem to get highlighting to work.

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).

--  
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:** ![Andrew\_Soep\_2](https://avatars.discourse-cdn.com/v4/letter/a/a8b319/32.png) [@Andrew\_Soep\_2](https://discuss.elastic.co/u/Andrew_Soep_2)\
**Post date:** [August 7, 2013, 9:55pm UTC](https://discuss.elastic.co/t/highlighting-attachments/13079/3 "2013-08-07T21:55:13Z")

</div>

Hey David,

Thanks for the post. I saw a similar Gist before. I don't understand how  
that's any different than my mapping? I store the file, it stores the  
document, but it doesn't store it in the fields property, it just stores it  
under "file" and doesn't seem to store any of the automatic attributes  
under "fields".

On Monday, August 5, 2013 7:57:49 PM UTC-5, David Pilato wrote:

> Hey Andrew,
> 
> Have a look at this gist: [Test of attachments plugin · GitHub](https://gist.github.com/dadoonet/3907010)  
> (You need to adapt it somehow as it is a bit old).
> 
> It should help.
> 
> --  
> David 😉  
> Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs
> 
> Le 6 août 2013 à 00:34, Andrew Soep \<[sir...@gmail.com](mailto:sir...@gmail.com) \<javascript:\>\> a  
> écrit :
> 
> I'm having an issue with getting attachments to highlight in ES. I think  
> it has something to do with my mapping, which you can find here:  
> ["properties" : { "\_content\_type" : { "type" : "string" }, - Pastebin.com](http://pastebin.com/gs0mdUpE)
> 
> What I'm confused about is, I thought that if I stored the document, it  
> would pull out the data and put it in the appropriate fields if I provided  
> the field property. This doesn't seem to be the case, as if I store the  
> document with my current mapping (which looks identical to other mappings  
> I've seen around the web), it just stores the content in the file property  
> of the \_source and that's it. When I tried to add term\_vector to the root  
> of the file property definition, it never took for some reason: only when I  
> add it to fields-\>file.
> 
> Can anyone shed some light on this/let me know if my mappings are wrong?  
> The search itself works great and returns what I need, I just can't seem  
> to get highlighting to work.
> 
> --  
> 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:\>.  
> 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).  
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/highlighting-attachments/13079/4 "2017-07-06T02:22:17Z")

</div>


