# Highlighting attachments

**URL:** <https://discuss.elastic.co/t/highlighting-attachments/13529>\
**Category:** Elasticsearch\
**Created:** [September 9, 2013, 11:04pm UTC](https://discuss.elastic.co/t/highlighting-attachments/13529 "2013-09-09T23:04:24Z")\
**Posts on this page:** 9\
**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:** [September 9, 2013, 11:04pm UTC](https://discuss.elastic.co/t/highlighting-attachments/13529/1 "2013-09-09T23:04:24Z")

</div>

I've been struggling with getting highlighting to work with attachments.  
I've tried a number of different mappings, and I'm not sure what I'm doing  
wrong. I can't imagine that anything else is causing the issue. I've  
compared to other mappings that people have posted that supposedly allow  
attachment highlighting, to no avail. Hoping someone can provide some  
help, as I've been struggling with this for a while. Mapping is below:

{  
"doc" : {  
"properties" : {  
"\_content\_type" : {  
"type" : "string"  
},  
"\_name" : {  
"type" : "string"  
},  
"file" : {  
"type" : "attachment",  
"path" : "full",  
"fields" : {  
"file" : {  
"type" : "string",  
"term\_vector" : "with\_positions\_offsets"  
},  
"author" : {  
"type" : "string"  
},  
"title" : {  
"type" : "string",  
"analyzer" : "english"  
},  
"name" : {  
"type" : "string"  
},  
"date" : {  
"type" : "date",  
"format" : "dateOptionalTime"  
},  
"keywords" : {  
"type" : "string",  
"analyzer" : "keyword",  
"store" : "yes"  
},  
"content\_type" : {  
"type" : "string"  
}  
}  
},  
"summary\_id" : {  
"type" : "string"  
},  
"title" : {  
"type" : "string",  
"analyzer" : "english"  
}  
}  
}

--  
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:** [September 10, 2013, 4:54am UTC](https://discuss.elastic.co/t/highlighting-attachments/13529/2 "2013-09-10T04:54:09Z")

</div>

Hey Andrew,

Have a look here: [https://gist.github.com/dadoonet/3907010](https://gist.github.com/dadoonet/3907010)

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

Le 10 sept. 2013 à 01:04, Andrew Soep [siraris@gmail.com](mailto:siraris@gmail.com) a écrit :

I've been struggling with getting highlighting to work with attachments. I've tried a number of different mappings, and I'm not sure what I'm doing wrong. I can't imagine that anything else is causing the issue. I've compared to other mappings that people have posted that supposedly allow attachment highlighting, to no avail. Hoping someone can provide some help, as I've been struggling with this for a while. Mapping is below:

{  
"doc" : {  
"properties" : {  
"\_content\_type" : {  
"type" : "string"  
},  
"\_name" : {  
"type" : "string"  
},  
"file" : {  
"type" : "attachment",  
"path" : "full",  
"fields" : {  
"file" : {  
"type" : "string",  
"term\_vector" : "with\_positions\_offsets"  
},  
"author" : {  
"type" : "string"  
},  
"title" : {  
"type" : "string",  
"analyzer" : "english"  
},  
"name" : {  
"type" : "string"  
},  
"date" : {  
"type" : "date",  
"format" : "dateOptionalTime"  
},  
"keywords" : {  
"type" : "string",  
"analyzer" : "keyword",  
"store" : "yes"  
},  
"content\_type" : {  
"type" : "string"  
}  
}  
},  
"summary\_id" : {  
"type" : "string"  
},  
"title" : {  
"type" : "string",  
"analyzer" : "english"  
}  
}  
}

--  
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:** ![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:** [September 11, 2013, 5:44am UTC](https://discuss.elastic.co/t/highlighting-attachments/13529/3 "2013-09-11T05:44:20Z")

</div>

Please answer to the mailing list and not to personnal email.

I don't see a big difference. Just wondering about path.

Could send your query as well or best GIST a full curl recreation?  
May be there is something wrong in your query.

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

Le 11 sept. 2013 à 06:46, Andrew Soep [siraris@gmail.com](mailto:siraris@gmail.com) a écrit :

Hey David,

I appreciate the response. I asked this question a while back, and got a similar response, but I don't see what's different about my mapping? When I store attachments, they index, but highlighting never seems to work. Is there anything you see in my mapping that might be causing this?

On Mon, Sep 9, 2013 at 11:54 PM, David Pilato [david@pilato.fr](mailto:david@pilato.fr) wrote:

> Hey Andrew,
> 
> Have a look here: [Test of attachments plugin · GitHub](https://gist.github.com/dadoonet/3907010)
> 
> --  
> David 😉  
> Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs
> 
> Le 10 sept. 2013 à 01:04, Andrew Soep [siraris@gmail.com](mailto:siraris@gmail.com) a écrit :
> 
> I've been struggling with getting highlighting to work with attachments. I've tried a number of different mappings, and I'm not sure what I'm doing wrong. I can't imagine that anything else is causing the issue. I've compared to other mappings that people have posted that supposedly allow attachment highlighting, to no avail. Hoping someone can provide some help, as I've been struggling with this for a while. Mapping is below:
> 
> {  
> "doc" : {  
> "properties" : {  
> "\_content\_type" : {  
> "type" : "string"  
> },  
> "\_name" : {  
> "type" : "string"  
> },  
> "file" : {  
> "type" : "attachment",  
> "path" : "full",  
> "fields" : {  
> "file" : {  
> "type" : "string",  
> "term\_vector" : "with\_positions\_offsets"  
> },  
> "author" : {  
> "type" : "string"  
> },  
> "title" : {  
> "type" : "string",  
> "analyzer" : "english"  
> },  
> "name" : {  
> "type" : "string"  
> },  
> "date" : {  
> "type" : "date",  
> "format" : "dateOptionalTime"  
> },  
> "keywords" : {  
> "type" : "string",  
> "analyzer" : "keyword",  
> "store" : "yes"  
> },  
> "content\_type" : {  
> "type" : "string"  
> }  
> }  
> },  
> "summary\_id" : {  
> "type" : "string"  
> },  
> "title" : {  
> "type" : "string",  
> "analyzer" : "english"  
> }  
> }  
> }
> 
> ## -- 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 a topic in the Google Groups "elasticsearch" group.  
> To unsubscribe from this topic, visit [https://groups.google.com/d/topic/elasticsearch/I37bUApGBNQ/unsubscribe](https://groups.google.com/d/topic/elasticsearch/I37bUApGBNQ/unsubscribe).  
> To unsubscribe from this group and all its topics, 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:** [September 11, 2013, 7:46pm UTC](https://discuss.elastic.co/t/highlighting-attachments/13529/4 "2013-09-11T19:46:48Z")

</div>

David, sorry about that. You were right, it was an issue with the query it  
seems.

But I have another issue now. I'm getting a lot of highlight results now.  
The problem is, when they come back, they are still base64 encoded. When  
I base64\_decode them, instead of getting back text, I get back what seems  
to be raw document data.

So for example, this is a result I get.

```
ZyktKV_lqpV+_fnvzpB6vPT8TkrYxWr/YTX/75iVz9RW_1mlFg_pIwBa8Gr15Z+d/OYDaB2EcSGs9hPYOrdUKioYlhIi/zQ4AGVirGkLY6JqZxmstcbF1X5iH2w/vrPaifGy+5W7IdBOaAvk3E90oBHWNo0qg8XBjjDTLwD5EQAFYkeF2O8mAGgFsx3wHPBv4AGgXOEfHE7M
```

And when I base64\_decode this, I get something along the lines of:

```
zg%jË!Š eŠ mÐÏ ýé¸(lF¸@ €À?¿Â@ €0À @ ˜@@ X@@! !X!˜!Ø" "X"˜"Ø# #X#˜#Ø$ $X$˜$Ø% %X%˜
```

Any ideas? Am I missing something?

On Wednesday, September 11, 2013 12:44:20 AM UTC-5, David Pilato wrote:

> Please answer to the mailing list and not to personnal email.
> 
> I don't see a big difference. Just wondering about path.
> 
> Could send your query as well or best GIST a full curl recreation?  
> May be there is something wrong in your query.
> 
> --  
> David 😉  
> Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs
> 
> Le 11 sept. 2013 à 06:46, Andrew Soep \<[sir...@gmail.com](mailto:sir...@gmail.com) \<javascript:\>\> a  
> écrit :
> 
> Hey David,
> 
> I appreciate the response. I asked this question a while back, and got a  
> similar response, but I don't see what's different about my mapping? When  
> I store attachments, they index, but highlighting never seems to work. Is  
> there anything you see in my mapping that might be causing this?
> 
> On Mon, Sep 9, 2013 at 11:54 PM, David Pilato \<[da...@pilato.fr](mailto:da...@pilato.fr)\<javascript:\>
> 
> > wrote:
> 
> > Hey Andrew,
> > 
> > Have a look here: [Test of attachments plugin · GitHub](https://gist.github.com/dadoonet/3907010)
> > 
> > --  
> > David 😉  
> > Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs
> > 
> > Le 10 sept. 2013 à 01:04, Andrew Soep \<[sir...@gmail.com](mailto:sir...@gmail.com) \<javascript:\>\> a  
> > écrit :
> > 
> > I've been struggling with getting highlighting to work with attachments.  
> > I've tried a number of different mappings, and I'm not sure what I'm doing  
> > wrong. I can't imagine that anything else is causing the issue. I've  
> > compared to other mappings that people have posted that supposedly allow  
> > attachment highlighting, to no avail. Hoping someone can provide some  
> > help, as I've been struggling with this for a while. Mapping is below:
> > 
> > {  
> > "doc" : {  
> > "properties" : {  
> > "\_content\_type" : {  
> > "type" : "string"  
> > },  
> > "\_name" : {  
> > "type" : "string"  
> > },  
> > "file" : {  
> > "type" : "attachment",  
> > "path" : "full",  
> > "fields" : {  
> > "file" : {  
> > "type" : "string",  
> > "term\_vector" : "with\_positions\_offsets"  
> > },  
> > "author" : {  
> > "type" : "string"  
> > },  
> > "title" : {  
> > "type" : "string",  
> > "analyzer" : "english"  
> > },  
> > "name" : {  
> > "type" : "string"  
> > },  
> > "date" : {  
> > "type" : "date",  
> > "format" : "dateOptionalTime"  
> > },  
> > "keywords" : {  
> > "type" : "string",  
> > "analyzer" : "keyword",  
> > "store" : "yes"  
> > },  
> > "content\_type" : {  
> > "type" : "string"  
> > }  
> > }  
> > },  
> > "summary\_id" : {  
> > "type" : "string"  
> > },  
> > "title" : {  
> > "type" : "string",  
> > "analyzer" : "english"  
> > }  
> > }  
> > }
> > 
> > --  
> > 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 a topic in the  
> > Google Groups "elasticsearch" group.  
> > To unsubscribe from this topic, visit  
> > [https://groups.google.com/d/topic/elasticsearch/I37bUApGBNQ/unsubscribe](https://groups.google.com/d/topic/elasticsearch/I37bUApGBNQ/unsubscribe).  
> > To unsubscribe from this group and all its topics, 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:** ![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:** [September 11, 2013, 8:18pm UTC](https://discuss.elastic.co/t/highlighting-attachments/13529/5 "2013-09-11T20:18:28Z")

</div>

Once again, it's hard to tell without a full curl recreation.  
You did not send the query.

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

Le 11 sept. 2013 à 21:46, Andrew Soep [siraris@gmail.com](mailto:siraris@gmail.com) a écrit :

David, sorry about that. You were right, it was an issue with the query it seems.

But I have another issue now. I'm getting a lot of highlight results now. The problem is, when they come back, they are still base64 encoded. When I base64\_decode them, instead of getting back text, I get back what seems to be raw document data.

So for example, this is a result I get.

```
ZyktKV_lqpV+_fnvzpB6vPT8TkrYxWr/YTX/75iVz9RW_1mlFg_pIwBa8Gr15Z+d/OYDaB2EcSGs9hPYOrdUKioYlhIi/zQ4AGVirGkLY6JqZxmstcbF1X5iH2w/vrPaifGy+5W7IdBOaAvk3E90oBHWNo0qg8XBjjDTLwD5EQAFYkeF2O8mAGgFsx3wHPBv4AGgXOEfHE7M
```

And when I base64\_decode this, I get something along the lines of:

```
zg%jË!Š eŠ mÐÏ ýé¸(lF¸@ €À?¿Â@ €0À @ ˜@@ X@@! !X!˜!Ø" "X"˜"Ø# #X#˜#Ø$ $X$˜$Ø% %X%˜
```

Any ideas? Am I missing something?

On Wednesday, September 11, 2013 12:44:20 AM UTC-5, David Pilato wrote:

> Please answer to the mailing list and not to personnal email.
> 
> I don't see a big difference. Just wondering about path.
> 
> Could send your query as well or best GIST a full curl recreation?  
> May be there is something wrong in your query.
> 
> --  
> David 😉  
> Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs
> 
> Le 11 sept. 2013 à 06:46, Andrew Soep [sir...@gmail.com](mailto:sir...@gmail.com) a écrit :
> 
> Hey David,
> 
> I appreciate the response. I asked this question a while back, and got a similar response, but I don't see what's different about my mapping? When I store attachments, they index, but highlighting never seems to work. Is there anything you see in my mapping that might be causing this?
> 
> On Mon, Sep 9, 2013 at 11:54 PM, David Pilato [da...@pilato.fr](mailto:da...@pilato.fr) wrote:
> 
> > Hey Andrew,
> > 
> > Have a look here: [Test of attachments plugin · GitHub](https://gist.github.com/dadoonet/3907010)
> > 
> > --  
> > David 😉  
> > Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs
> > 
> > Le 10 sept. 2013 à 01:04, Andrew Soep [sir...@gmail.com](mailto:sir...@gmail.com) a écrit :
> > 
> > I've been struggling with getting highlighting to work with attachments. I've tried a number of different mappings, and I'm not sure what I'm doing wrong. I can't imagine that anything else is causing the issue. I've compared to other mappings that people have posted that supposedly allow attachment highlighting, to no avail. Hoping someone can provide some help, as I've been struggling with this for a while. Mapping is below:
> > 
> > {  
> > "doc" : {  
> > "properties" : {  
> > "\_content\_type" : {  
> > "type" : "string"  
> > },  
> > "\_name" : {  
> > "type" : "string"  
> > },  
> > "file" : {  
> > "type" : "attachment",  
> > "path" : "full",  
> > "fields" : {  
> > "file" : {  
> > "type" : "string",  
> > "term\_vector" : "with\_positions\_offsets"  
> > },  
> > "author" : {  
> > "type" : "string"  
> > },  
> > "title" : {  
> > "type" : "string",  
> > "analyzer" : "english"  
> > },  
> > "name" : {  
> > "type" : "string"  
> > },  
> > "date" : {  
> > "type" : "date",  
> > "format" : "dateOptionalTime"  
> > },  
> > "keywords" : {  
> > "type" : "string",  
> > "analyzer" : "keyword",  
> > "store" : "yes"  
> > },  
> > "content\_type" : {  
> > "type" : "string"  
> > }  
> > }  
> > },  
> > "summary\_id" : {  
> > "type" : "string"  
> > },  
> > "title" : {  
> > "type" : "string",  
> > "analyzer" : "english"  
> > }  
> > }  
> > }
> > 
> > ## -- 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). 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/I37bUApGBNQ/unsubscribe](https://groups.google.com/d/topic/elasticsearch/I37bUApGBNQ/unsubscribe).  
> > To unsubscribe from this group and all its topics, send an email to [elasticsearc...@googlegroups.com](mailto:elasticsearc...@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).

--  
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:** [September 11, 2013, 8:46pm UTC](https://discuss.elastic.co/t/highlighting-attachments/13529/6 "2013-09-11T20:46:48Z")

</div>

Here is the query I'm sending 🙂

{  
"fields":  
["\_name","title","summary\_id"],  
"query": {  
"multi\_match":  
{  
"query":"test",  
"fields": ["file","title"]  
}  
},  
"size":50,  
"highlight" : {  
"fields" : {  
"file": {  
"fragment\_size" : 200 ,  
"number\_of\_fragments" : 10  
}  
}  
}  
}

On Wednesday, September 11, 2013 3:18:28 PM UTC-5, David Pilato wrote:

> Once again, it's hard to tell without a full curl recreation.  
> You did not send the query.
> 
> --  
> David 😉  
> Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs
> 
> Le 11 sept. 2013 à 21:46, Andrew Soep \<[sir...@gmail.com](mailto:sir...@gmail.com) \<javascript:\>\> a  
> écrit :
> 
> David, sorry about that. You were right, it was an issue with the query  
> it seems.
> 
> But I have another issue now. I'm getting a lot of highlight results now.  
> The problem is, when they come back, they are still base64 encoded. When  
> I base64\_decode them, instead of getting back text, I get back what seems  
> to be raw document data.
> 
> So for example, this is a result I get.
> 
> ```
> ZyktKV_lqpV+_fnvzpB6vPT8TkrYxWr/YTX/75iVz9RW_1mlFg_pIwBa8Gr15Z+d/OYDaB2EcSGs9hPYOrdUKioYlhIi/zQ4AGVirGkLY6JqZxmstcbF1X5iH2w/vrPaifGy+5W7IdBOaAvk3E90oBHWNo0qg8XBjjDTLwD5EQAFYkeF2O8mAGgFsx3wHPBv4AGgXOEfHE7M
> ```
> 
> And when I base64\_decode this, I get something along the lines of:
> 
> ```
> zg%jË!Š eŠ mÐÏ ýé¸(lF¸@ €À?¿Â@ €0À @ ˜@@ X@@! !X!˜!Ø" "X"˜"Ø# #X#˜#Ø$ 
> $X$˜$Ø% %X%˜
> ```
> 
> Any ideas? Am I missing something?
> 
> On Wednesday, September 11, 2013 12:44:20 AM UTC-5, David Pilato wrote:
> 
> > Please answer to the mailing list and not to personnal email.
> > 
> > I don't see a big difference. Just wondering about path.
> > 
> > Could send your query as well or best GIST a full curl recreation?  
> > May be there is something wrong in your query.
> > 
> > --  
> > David 😉  
> > Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs
> > 
> > Le 11 sept. 2013 à 06:46, Andrew Soep [sir...@gmail.com](mailto:sir...@gmail.com) a écrit :
> > 
> > Hey David,
> > 
> > I appreciate the response. I asked this question a while back, and got a  
> > similar response, but I don't see what's different about my mapping? When  
> > I store attachments, they index, but highlighting never seems to work. Is  
> > there anything you see in my mapping that might be causing this?
> > 
> > On Mon, Sep 9, 2013 at 11:54 PM, David Pilato [da...@pilato.fr](mailto:da...@pilato.fr) wrote:
> > 
> > > Hey Andrew,
> > > 
> > > Have a look here: [Test of attachments plugin · GitHub](https://gist.github.com/dadoonet/3907010)
> > > 
> > > --  
> > > David 😉  
> > > Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs
> > > 
> > > Le 10 sept. 2013 à 01:04, Andrew Soep [sir...@gmail.com](mailto:sir...@gmail.com) a écrit :
> > > 
> > > I've been struggling with getting highlighting to work with attachments.  
> > > I've tried a number of different mappings, and I'm not sure what I'm doing  
> > > wrong. I can't imagine that anything else is causing the issue. I've  
> > > compared to other mappings that people have posted that supposedly allow  
> > > attachment highlighting, to no avail. Hoping someone can provide some  
> > > help, as I've been struggling with this for a while. Mapping is below:
> > > 
> > > {  
> > > "doc" : {  
> > > "properties" : {  
> > > "\_content\_type" : {  
> > > "type" : "string"  
> > > },  
> > > "\_name" : {  
> > > "type" : "string"  
> > > },  
> > > "file" : {  
> > > "type" : "attachment",  
> > > "path" : "full",  
> > > "fields" : {  
> > > "file" : {  
> > > "type" : "string",  
> > > "term\_vector" : "with\_positions\_offsets"  
> > > },  
> > > "author" : {  
> > > "type" : "string"  
> > > },  
> > > "title" : {  
> > > "type" : "string",  
> > > "analyzer" : "english"  
> > > },  
> > > "name" : {  
> > > "type" : "string"  
> > > },  
> > > "date" : {  
> > > "type" : "date",  
> > > "format" : "dateOptionalTime"  
> > > },  
> > > "keywords" : {  
> > > "type" : "string",  
> > > "analyzer" : "keyword",  
> > > "store" : "yes"  
> > > },  
> > > "content\_type" : {  
> > > "type" : "string"  
> > > }  
> > > }  
> > > },  
> > > "summary\_id" : {  
> > > "type" : "string"  
> > > },  
> > > "title" : {  
> > > "type" : "string",  
> > > "analyzer" : "english"  
> > > }  
> > > }  
> > > }
> > > 
> > > --  
> > > 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).  
> > > 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/I37bUApGBNQ/unsubscribe](https://groups.google.com/d/topic/elasticsearch/I37bUApGBNQ/unsubscribe).  
> > > To unsubscribe from this group and all its topics, send an email to  
> > > [elasticsearc...@googlegroups.com](mailto:elasticsearc...@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 [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:** ![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:** [September 12, 2013, 8:47am UTC](https://discuss.elastic.co/t/highlighting-attachments/13529/7 "2013-09-12T08:47:31Z")

</div>

I think the main problem here is that you did not store your file field.  
"file" : { "term\_vector":"with\_positions\_offsets", "store":"yes" }

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

Le 11 sept. 2013 à 22:46, Andrew Soep [siraris@gmail.com](mailto:siraris@gmail.com) a écrit :

> Here is the query I'm sending 🙂
> 
> {  
> "fields":  
> ["\_name","title","summary\_id"],  
> "query": {  
> "multi\_match":  
> {  
> "query":"test",  
> "fields": ["file","title"]  
> }  
> },  
> "size":50,  
> "highlight" : {  
> "fields" : {  
> "file": {  
> "fragment\_size" : 200 ,  
> "number\_of\_fragments" : 10  
> }  
> }  
> }  
> }
> 
> On Wednesday, September 11, 2013 3:18:28 PM UTC-5, David Pilato wrote:  
> Once again, it's hard to tell without a full curl recreation.  
> You did not send the query.
> 
> --  
> David 😉  
> Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs
> 
> Le 11 sept. 2013 à 21:46, Andrew Soep [sir...@gmail.com](mailto:sir...@gmail.com) a écrit :
> 
> David, sorry about that. You were right, it was an issue with the query it seems.
> 
> But I have another issue now. I'm getting a lot of highlight results now. The problem is, when they come back, they are still base64 encoded. When I base64\_decode them, instead of getting back text, I get back what seems to be raw document data.
> 
> So for example, this is a result I get.
> 
> ```
> ZyktKV_lqpV+_fnvzpB6vPT8TkrYxWr/YTX/75iVz9RW_1mlFg_pIwBa8Gr15Z+d/OYDaB2EcSGs9hPYOrdUKioYlhIi/zQ4AGVirGkLY6JqZxmstcbF1X5iH2w/vrPaifGy+5W7IdBOaAvk3E90oBHWNo0qg8XBjjDTLwD5EQAFYkeF2O8mAGgFsx3wHPBv4AGgXOEfHE7M
> ```
> 
> And when I base64\_decode this, I get something along the lines of:
> 
> ```
> zg%jË!Š eŠ mÐÏ ýé¸(lF¸@ €À?¿Â@ €0À @ ˜@@ X@@! !X!˜!Ø" "X"˜"Ø# #X#˜#Ø$ $X$˜$Ø% %X%˜
> ```
> 
> Any ideas? Am I missing something?
> 
> On Wednesday, September 11, 2013 12:44:20 AM UTC-5, David Pilato wrote:  
> Please answer to the mailing list and not to personnal email.
> 
> I don't see a big difference. Just wondering about path.
> 
> Could send your query as well or best GIST a full curl recreation?  
> May be there is something wrong in your query.
> 
> --  
> David 😉  
> Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs
> 
> Le 11 sept. 2013 à 06:46, Andrew Soep [sir...@gmail.com](mailto:sir...@gmail.com) a écrit :
> 
> Hey David,
> 
> I appreciate the response. I asked this question a while back, and got a similar response, but I don't see what's different about my mapping? When I store attachments, they index, but highlighting never seems to work. Is there anything you see in my mapping that might be causing this?
> 
> On Mon, Sep 9, 2013 at 11:54 PM, David Pilato [da...@pilato.fr](mailto:da...@pilato.fr) wrote:  
> Hey Andrew,
> 
> Have a look here: [Test of attachments plugin · GitHub](https://gist.github.com/dadoonet/3907010)
> 
> --  
> David 😉  
> Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs
> 
> Le 10 sept. 2013 à 01:04, Andrew Soep [sir...@gmail.com](mailto:sir...@gmail.com) a écrit :
> 
> I've been struggling with getting highlighting to work with attachments. I've tried a number of different mappings, and I'm not sure what I'm doing wrong. I can't imagine that anything else is causing the issue. I've compared to other mappings that people have posted that supposedly allow attachment highlighting, to no avail. Hoping someone can provide some help, as I've been struggling with this for a while. Mapping is below:
> 
> {  
> "doc" : {  
> "properties" : {  
> "\_content\_type" : {  
> "type" : "string"  
> },  
> "\_name" : {  
> "type" : "string"  
> },  
> "file" : {  
> "type" : "attachment",  
> "path" : "full",  
> "fields" : {  
> "file" : {  
> "type" : "string",  
> "term\_vector" : "with\_positions\_offsets"  
> },  
> "author" : {  
> "type" : "string"  
> },  
> "title" : {  
> "type" : "string",  
> "analyzer" : "english"  
> },  
> "name" : {  
> "type" : "string"  
> },  
> "date" : {  
> "type" : "date",  
> "format" : "dateOptionalTime"  
> },  
> "keywords" : {  
> "type" : "string",  
> "analyzer" : "keyword",  
> "store" : "yes"  
> },  
> "content\_type" : {  
> "type" : "string"  
> }  
> }  
> },  
> "summary\_id" : {  
> "type" : "string"  
> },  
> "title" : {  
> "type" : "string",  
> "analyzer" : "english"  
> }  
> }  
> }
> 
> --  
> 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).  
> 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/I37bUApGBNQ/unsubscribe](https://groups.google.com/d/topic/elasticsearch/I37bUApGBNQ/unsubscribe).  
> To unsubscribe from this group and all its topics, send an email to [elasticsearc...@googlegroups.com](mailto:elasticsearc...@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 [elasticsearc...@googlegroups.com](mailto:elasticsearc...@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).

--  
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:** [September 12, 2013, 10:40pm UTC](https://discuss.elastic.co/t/highlighting-attachments/13529/8 "2013-09-12T22:40:58Z")

</div>

That was it David! store: yes solved the problem. Thank you so much!

On Thursday, September 12, 2013 3:47:31 AM UTC-5, David Pilato wrote:

> I think the main problem here is that you did not store your file field.  
> "file" : { "term\_vector":"with\_positions\_offsets", "store":"yes" }
> 
> --  
> _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)  
> | @scrutmydocs [https://twitter.com/scrutmydocs](https://twitter.com/scrutmydocs)
> 
> Le 11 sept. 2013 à 22:46, Andrew Soep \<[sir...@gmail.com](mailto:sir...@gmail.com) \<javascript:\>\> a  
> écrit :
> 
> Here is the query I'm sending 🙂
> 
> {  
> "fields":  
> ["\_name","title","summary\_id"],  
> "query": {  
> "multi\_match":  
> {  
> "query":"test",  
> "fields": ["file","title"]  
> }  
> },  
> "size":50,  
> "highlight" : {  
> "fields" : {  
> "file": {  
> "fragment\_size" : 200 ,  
> "number\_of\_fragments" : 10  
> }  
> }  
> }  
> }
> 
> On Wednesday, September 11, 2013 3:18:28 PM UTC-5, David Pilato wrote:
> 
> > Once again, it's hard to tell without a full curl recreation.  
> > You did not send the query.
> > 
> > --  
> > David 😉  
> > Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs
> > 
> > Le 11 sept. 2013 à 21:46, Andrew Soep [sir...@gmail.com](mailto:sir...@gmail.com) a écrit :
> > 
> > David, sorry about that. You were right, it was an issue with the query  
> > it seems.
> > 
> > But I have another issue now. I'm getting a lot of highlight results  
> > now. The problem is, when they come back, they are still base64 encoded.  
> > When I base64\_decode them, instead of getting back text, I get back what  
> > seems to be raw document data.
> > 
> > So for example, this is a result I get.
> > 
> > ```
> > ZyktKV_lqpV+_fnvzpB6vPT8TkrYxWr/YTX/75iVz9RW_1mlFg_pIwBa8Gr15Z+d/OYDaB2EcSGs9hPYOrdUKioYlhIi/zQ4AGVirGkLY6JqZxmstcbF1X5iH2w/vrPaifGy+5W7IdBOaAvk3E90oBHWNo0qg8XBjjDTLwD5EQAFYkeF2O8mAGgFsx3wHPBv4AGgXOEfHE7M
> > ```
> > 
> > And when I base64\_decode this, I get something along the lines of:
> > 
> > ```
> > zg%jË!Š eŠ mÐÏ ýé¸(lF¸@ €À?¿Â@ €0À @ ˜@@ X@@! !X!˜!Ø" "X"˜"Ø# 
> > #X#˜#Ø$ $X$˜$Ø% %X%˜
> > ```
> > 
> > Any ideas? Am I missing something?
> > 
> > On Wednesday, September 11, 2013 12:44:20 AM UTC-5, David Pilato wrote:
> > 
> > > Please answer to the mailing list and not to personnal email.
> > > 
> > > I don't see a big difference. Just wondering about path.
> > > 
> > > Could send your query as well or best GIST a full curl recreation?  
> > > May be there is something wrong in your query.
> > > 
> > > --  
> > > David 😉  
> > > Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs
> > > 
> > > Le 11 sept. 2013 à 06:46, Andrew Soep [sir...@gmail.com](mailto:sir...@gmail.com) a écrit :
> > > 
> > > Hey David,
> > > 
> > > I appreciate the response. I asked this question a while back, and got  
> > > a similar response, but I don't see what's different about my mapping?  
> > > When I store attachments, they index, but highlighting never seems to  
> > > work. Is there anything you see in my mapping that might be causing this?
> > > 
> > > On Mon, Sep 9, 2013 at 11:54 PM, David Pilato [da...@pilato.fr](mailto:da...@pilato.fr) wrote:
> > > 
> > > > Hey Andrew,
> > > > 
> > > > Have a look here: [Test of attachments plugin · GitHub](https://gist.github.com/dadoonet/3907010)
> > > > 
> > > > --  
> > > > David 😉  
> > > > Twitter : @dadoonet / @elasticsearchfr / @scrutmydocs
> > > > 
> > > > Le 10 sept. 2013 à 01:04, Andrew Soep [sir...@gmail.com](mailto:sir...@gmail.com) a écrit :
> > > > 
> > > > I've been struggling with getting highlighting to work with  
> > > > attachments. I've tried a number of different mappings, and I'm not sure  
> > > > what I'm doing wrong. I can't imagine that anything else is causing the  
> > > > issue. I've compared to other mappings that people have posted that  
> > > > supposedly allow attachment highlighting, to no avail. Hoping someone can  
> > > > provide some help, as I've been struggling with this for a while. Mapping  
> > > > is below:
> > > > 
> > > > {  
> > > > "doc" : {  
> > > > "properties" : {  
> > > > "\_content\_type" : {  
> > > > "type" : "string"  
> > > > },  
> > > > "\_name" : {  
> > > > "type" : "string"  
> > > > },  
> > > > "file" : {  
> > > > "type" : "attachment",  
> > > > "path" : "full",  
> > > > "fields" : {  
> > > > "file" : {  
> > > > "type" : "string",  
> > > > "term\_vector" : "with\_positions\_offsets"  
> > > > },  
> > > > "author" : {  
> > > > "type" : "string"  
> > > > },  
> > > > "title" : {  
> > > > "type" : "string",  
> > > > "analyzer" : "english"  
> > > > },  
> > > > "name" : {  
> > > > "type" : "string"  
> > > > },  
> > > > "date" : {  
> > > > "type" : "date",  
> > > > "format" : "dateOptionalTime"  
> > > > },  
> > > > "keywords" : {  
> > > > "type" : "string",  
> > > > "analyzer" : "keyword",  
> > > > "store" : "yes"  
> > > > },  
> > > > "content\_type" : {  
> > > > "type" : "string"  
> > > > }  
> > > > }  
> > > > },  
> > > > "summary\_id" : {  
> > > > "type" : "string"  
> > > > },  
> > > > "title" : {  
> > > > "type" : "string",  
> > > > "analyzer" : "english"  
> > > > }  
> > > > }  
> > > > }
> > > > 
> > > > --  
> > > > 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).  
> > > > 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/I37bUApGBNQ/unsubscribe](https://groups.google.com/d/topic/elasticsearch/I37bUApGBNQ/unsubscribe)  
> > > > .  
> > > > To unsubscribe from this group and all its topics, send an email to  
> > > > [elasticsearc...@googlegroups.com](mailto:elasticsearc...@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 [elasticsearc...@googlegroups.com](mailto:elasticsearc...@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 [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:16am UTC](https://discuss.elastic.co/t/highlighting-attachments/13529/9 "2017-07-06T02:16:46Z")

</div>


