# Mapper-attachments and highlights

**URL:** <https://discuss.elastic.co/t/mapper-attachments-and-highlights/6473>\
**Category:** Elasticsearch\
**Created:** [January 23, 2012, 9:55pm UTC](https://discuss.elastic.co/t/mapper-attachments-and-highlights/6473 "2012-01-23T21:55:37Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![Shairon\_Toledo](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/shairon_toledo/32/2490_2.png) [@Shairon\_Toledo](https://discuss.elastic.co/u/Shairon_Toledo)\
**Post date:** [January 23, 2012, 9:55pm UTC](https://discuss.elastic.co/t/mapper-attachments-and-highlights/6473/1 "2012-01-23T21:55:37Z")

</div>

Hi guys,

I got ES with mapper-attachments plugin running here, I've used this  
mapping to the plugin

{  
"doc" : {  
"properties" : {  
"attachment" : {"type" : "attachment", "store" : "yes", "term\_vector"  
: "with\_positions\_offsets" }  
}  
}  
}

The doc

{  
'filename':'Redis manual.pdf',  
'size':61952,  
'folder':'/Users/shairon/References',  
'updated\_at':'2011-12-07T22:02:33Z',  
'modified':'2011-12-07T22:02:33Z',  
'attachment' : '...JVBERi0xLjMKJcTl8uXrp/Og...base64'  
}

I search by

{  
"query":{  
"term" : { "attachment": "redis"}  
},  
"highlight" : {  
"fields" : {  
"attachment" : {}  
}  
}  
}

I get the document properly, the highlight entry is

"highlight":{"filename":["_Redis_ manual.pdf"] }

I see that ES returns \_source of the doc so the field attachment is still a  
encoded content, I was expecting the tika extracted content in text/plain.  
The question is, is there any way to get highlights as decoded text?

---

<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:** [January 23, 2012, 10:24pm UTC](https://discuss.elastic.co/t/mapper-attachments-and-highlights/6473/2 "2012-01-23T22:24:52Z")

</div>

Hi Shairon,

Highlighting attachments works fine for me.

Its highlight the content of my base64 encoded files.

What version do you use (ES and mapper-attachment-plugin) ?

De : [elasticsearch@googlegroups.com](mailto:elasticsearch@googlegroups.com) [[mailto:elasticsearch@googlegroups.com](mailto:elasticsearch@googlegroups.com)]  
De la part de Shairon Toledo  
Envoyé : lundi 23 janvier 2012 22:56  
À : [elasticsearch@googlegroups.com](mailto:elasticsearch@googlegroups.com)  
Objet : mapper-attachments and highlights

Hi guys,

I got ES with mapper-attachments plugin running here, I've used this mapping  
to the plugin

{

"doc" : {

```
"properties" : {

  "attachment" : {"type" : "attachment", "store" : "yes", "term_vector"

```

: "with\_positions\_offsets" }

```
 }

```

}

}

The doc

{

'filename':'Redis manual.pdf',

'size':61952,

'folder':'/Users/shairon/References',

'updated\_at':'2011-12-07T22:02:33Z',

'modified':'2011-12-07T22:02:33Z',

'attachment' : '...JVBERi0xLjMKJcTl8uXrp/Og...base64'

}

I search by

{

"query":{

"term" : { "attachment": "redis"}

},

"highlight" : {

```
     "fields" : {

         "attachment" : {}

     }

 }

```

}

I get the document properly, the highlight entry is

"highlight":{"filename":["_Redis_ manual.pdf"] }

I see that ES returns \_source of the doc so the field attachment is still a  
encoded content, I was expecting the tika extracted content in text/plain.  
The question is, is there any way to get highlights as decoded text?

---

<div class="post-metadata">

**Author:** ![Shairon\_Toledo](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/shairon_toledo/32/2490_2.png) [@Shairon\_Toledo](https://discuss.elastic.co/u/Shairon_Toledo)\
**Post date:** [January 23, 2012, 10:40pm UTC](https://discuss.elastic.co/t/mapper-attachments-and-highlights/6473/3 "2012-01-23T22:40:32Z")

</div>

Hi David,

My env is

elasticsearch-0.18.7  
elasticsearch-mapper-attachments-0.18.7.jar

thx

On Mon, Jan 23, 2012 at 8:24 PM, David Pilato [david@pilato.fr](mailto:david@pilato.fr) wrote:

> Hi Shairon,\*\*\*\*
> 
> * * *
> 
> * * *
> 
> Highlighting attachments works fine for me.\*\*\*\*
> 
> It’s highlight the content of my base64 encoded files.\*\*\*\*
> 
> * * *
> 
> What version do you use (ES and mapper-attachment-plugin) ?\*\*\*\*
> 
> * * *
> 
> * * *
> 
> * * *
> 
> * * *
> 
> _De :_ [elasticsearch@googlegroups.com](mailto:elasticsearch@googlegroups.com) [mailto:  
> [elasticsearch@googlegroups.com](mailto:elasticsearch@googlegroups.com)] _De la part de_ Shairon Toledo  
> _Envoyé :_ lundi 23 janvier 2012 22:56  
> _À :_ [elasticsearch@googlegroups.com](mailto:elasticsearch@googlegroups.com)  
> _Objet :_ mapper-attachments and highlights\*\*\*\*
> 
> * * *
> 
> Hi guys, \*\*\*\*
> 
> * * *
> 
> I got ES with mapper-attachments plugin running here, I've used this  
> mapping to the plugin \*\*\*\*
> 
> * * *
> 
> {\*\*\*\*
> 
> "doc" : {\*\*\*\*
> 
> ```
> "properties" : { ****
> 
> "attachment" : {"type" : "attachment", "store" : "yes",
> 
> ```
> 
> "term\_vector" : "with\_positions\_offsets" }\*\*\*\*
> 
> ```
> } ****
> 
> ```
> 
> }\*\*\*\*
> 
> }\*\*\*\*
> 
> * * *
> 
> The doc\*\*\*\*
> 
> * * *
> 
> {\*\*\*\*
> 
> 'filename':'Redis manual.pdf',\*\*\*\*
> 
> 'size':61952,\*\*\*\*
> 
> 'folder':'/Users/shairon/References',\*\*\*\*
> 
> 'updated\_at':'2011-12-07T22:02:33Z',\*\*\*\*
> 
> 'modified':'2011-12-07T22:02:33Z',\*\*\*\*
> 
> 'attachment' : '...JVBERi0xLjMKJcTl8uXrp/Og...base64'\*\*\*\*
> 
> }\*\*\*\*
> 
> * * *
> 
> I search by\*\*\*\*
> 
> * * *
> 
> {\*\*\*\*
> 
> "query":{\*\*\*\*
> 
> "term" : { "attachment": "redis"} \*\*\*\*
> 
> },\*\*\*\*
> 
> "highlight" : {\*\*\*\*
> 
> ```
> "fields" : { ****
> 
> "attachment" : {} ****
> 
> } ****
> 
> } ****
> 
> ```
> 
> }\*\*\*\*
> 
> * * *
> 
> I get the document properly, the highlight entry is \*\*\*\*
> 
> * * *
> 
> "highlight":{"filename":["_Redis_ manual.pdf"] }\*\*\*\*
> 
> * * *
> 
> I see that ES returns \_source of the doc so the field attachment is still  
> a encoded content, I was expecting the tika extracted content in  
> text/plain. The question is, is there any way to get highlights as decoded  
> text?\*\*\*\*
> 
> * * *
> 
> * * *
> 
> * * *

--  
's  
Shairon Toledo  
[http://www.google.com/profiles/shairon.toledo](http://www.google.com/profiles/shairon.toledo)

---

<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:** [January 23, 2012, 10:53pm UTC](https://discuss.elastic.co/t/mapper-attachments-and-highlights/6473/4 "2012-01-23T22:53:29Z")

</div>

Ok. I think that you should consider to use the new plugin repository, even  
if it should be the same content.

[https://github.com/elasticsearch/elasticsearch-mapper-attachments](https://github.com/elasticsearch/elasticsearch-mapper-attachments)

> **[elastic/elasticsearch-mapper-attachments](https://github.com/elastic/elasticsearch-mapper-attachments)**
>
> elasticsearch-mapper-attachments - Mapper Attachments Type plugin for Elasticsearch

I use this version (1.0.0).

Could you gist a curl recreation ? ( [http://www.elasticsearch.org/help/](http://www.elasticsearch.org/help/)  
[http://www.elasticsearch.org/help/](http://www.elasticsearch.org/help/))

Not sure I can answer right now (time to sleep here ;-)), but I could have a  
look at it tomorrow (or perhaps someone else will answer before).

Some other question.

When you index your doc, do you see updating mapping in logs ?

Can you check also that your mapping is the one you think it is ?

I suspect that your mapping has not been taken into account and that ES  
thinks that your attachment field is only a string

David.

De : [elasticsearch@googlegroups.com](mailto:elasticsearch@googlegroups.com) [[mailto:elasticsearch@googlegroups.com](mailto:elasticsearch@googlegroups.com)]  
De la part de Shairon Toledo  
Envoyé : lundi 23 janvier 2012 23:41  
À : [elasticsearch@googlegroups.com](mailto:elasticsearch@googlegroups.com)  
Objet : Re: mapper-attachments and highlights

Hi David,

My env is

elasticsearch-0.18.7

elasticsearch-mapper-attachments-0.18.7.jar

thx

On Mon, Jan 23, 2012 at 8:24 PM, David Pilato [david@pilato.fr](mailto:david@pilato.fr) wrote:

Hi Shairon,

Highlighting attachments works fine for me.

Its highlight the content of my base64 encoded files.

What version do you use (ES and mapper-attachment-plugin) ?

De : [elasticsearch@googlegroups.com](mailto:elasticsearch@googlegroups.com) [[mailto:elasticsearch@googlegroups.com](mailto:elasticsearch@googlegroups.com)]  
De la part de Shairon Toledo  
Envoyé : lundi 23 janvier 2012 22:56  
À : [elasticsearch@googlegroups.com](mailto:elasticsearch@googlegroups.com)  
Objet : mapper-attachments and highlights

Hi guys,

I got ES with mapper-attachments plugin running here, I've used this mapping  
to the plugin

{

"doc" : {

```
"properties" : {

  "attachment" : {"type" : "attachment", "store" : "yes", "term_vector"

```

: "with\_positions\_offsets" }

```
 }

```

}

}

The doc

{

'filename':'Redis manual.pdf',

'size':61952,

'folder':'/Users/shairon/References',

'updated\_at':'2011-12-07T22:02:33Z',

'modified':'2011-12-07T22:02:33Z',

'attachment' : '...JVBERi0xLjMKJcTl8uXrp/Og...base64'

}

I search by

{

"query":{

"term" : { "attachment": "redis"}

},

"highlight" : {

```
     "fields" : {

         "attachment" : {}

     }

 }

```

}

I get the document properly, the highlight entry is

"highlight":{"filename":["_Redis_ manual.pdf"] }

I see that ES returns \_source of the doc so the field attachment is still a  
encoded content, I was expecting the tika extracted content in text/plain.  
The question is, is there any way to get highlights as decoded text?

--  
[]'s  
Shairon Toledo

> **[shairon toledo - Google+](https://plus.google.com/106371782135444246530)**
>
> A Google+ profile for shairon toledo

---

<div class="post-metadata">

**Author:** ![Shairon\_Toledo](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/shairon_toledo/32/2490_2.png) [@Shairon\_Toledo](https://discuss.elastic.co/u/Shairon_Toledo)\
**Post date:** [January 24, 2012, 12:10am UTC](https://discuss.elastic.co/t/mapper-attachments-and-highlights/6473/5 "2012-01-24T00:10:51Z")

</div>

I removed /plugins/\* and installed new one by

bin/plugin -install elasticsearch/elasticsearch-mapper-attachments/1.0.0

No success.

I've put together the artifacts over a gist

> <https://gist.github.com/shairontoledo/b457803a9358c6465578>
>
> There are more than three files. show original

Do you see any issue with my steps?

Thank for your help o/

On Mon, Jan 23, 2012 at 8:53 PM, David Pilato [david@pilato.fr](mailto:david@pilato.fr) wrote:

> Ok. I think that you should consider to use the new plugin repository,  
> even if it should be the same content.\*\*\*\*
> 
> [GitHub - elastic/elasticsearch-mapper-attachments: Mapper Attachments Type plugin for Elasticsearch](https://github.com/elasticsearch/elasticsearch-mapper-attachments)\*\*\*\*
> 
> * * *
> 
> I use this version (1.0.0).\*\*\*\*
> 
> * * *
> 
> Could you gist a curl recreation ? ([Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/help/))\*\*\*  
> \*
> 
> Not sure I can answer right now (time to sleep here ;-)), but I could have  
> a look at it tomorrow (or perhaps someone else will answer before).\*\*\*\*
> 
> * * *
> 
> Some other question.\*\*\*\*
> 
> When you index your doc, do you see “updating mapping” in logs ?\*\*\*\*
> 
> Can you check also that your mapping is the one you think it is ?\*\*\*\*
> 
> * * *
> 
> I suspect that your mapping has not been taken into account and that ES  
> thinks that your attachment field is only a string…\*\*\*\*
> 
> * * *
> 
> David.\*\*\*\*
> 
> * * *
> 
> _De :_ [elasticsearch@googlegroups.com](mailto:elasticsearch@googlegroups.com) [mailto:  
> [elasticsearch@googlegroups.com](mailto:elasticsearch@googlegroups.com)] _De la part de_ Shairon Toledo  
> _Envoyé :_ lundi 23 janvier 2012 23:41  
> _À :_ [elasticsearch@googlegroups.com](mailto:elasticsearch@googlegroups.com)  
> _Objet :_ Re: mapper-attachments and highlights\*\*\*\*
> 
> * * *
> 
> Hi David,\*\*\*\*
> 
> * * *
> 
> My env is \*\*\*\*
> 
> * * *
> 
> elasticsearch-0.18.7\*\*\*\*
> 
> elasticsearch-mapper-attachments-0.18.7.jar
> 
> thx\*\*\*\*
> 
> * * *
> 
> * * *
> 
> On Mon, Jan 23, 2012 at 8:24 PM, David Pilato [david@pilato.fr](mailto:david@pilato.fr) wrote:\*\*\*\*
> 
> Hi Shairon,\*\*\*\*
> 
> * * *
> 
> * * *
> 
> Highlighting attachments works fine for me.\*\*\*\*
> 
> It’s highlight the content of my base64 encoded files.\*\*\*\*
> 
> * * *
> 
> What version do you use (ES and mapper-attachment-plugin) ?\*\*\*\*
> 
> * * *
> 
> * * *
> 
> * * *
> 
> * * *
> 
> _De :_ [elasticsearch@googlegroups.com](mailto:elasticsearch@googlegroups.com) [mailto:  
> [elasticsearch@googlegroups.com](mailto:elasticsearch@googlegroups.com)] _De la part de_ Shairon Toledo  
> _Envoyé :_ lundi 23 janvier 2012 22:56  
> _À :_ [elasticsearch@googlegroups.com](mailto:elasticsearch@googlegroups.com)  
> _Objet :_ mapper-attachments and highlights\*\*\*\*
> 
> * * *
> 
> Hi guys, \*\*\*\*
> 
> * * *
> 
> I got ES with mapper-attachments plugin running here, I've used this  
> mapping to the plugin \*\*\*\*
> 
> * * *
> 
> {\*\*\*\*
> 
> "doc" : {\*\*\*\*
> 
> ```
> "properties" : { ****
> 
> "attachment" : {"type" : "attachment", "store" : "yes",
> 
> ```
> 
> "term\_vector" : "with\_positions\_offsets" }\*\*\*\*
> 
> ```
> } ****
> 
> ```
> 
> }\*\*\*\*
> 
> }\*\*\*\*
> 
> * * *
> 
> The doc\*\*\*\*
> 
> * * *
> 
> {\*\*\*\*
> 
> 'filename':'Redis manual.pdf',\*\*\*\*
> 
> 'size':61952,\*\*\*\*
> 
> 'folder':'/Users/shairon/References',\*\*\*\*
> 
> 'updated\_at':'2011-12-07T22:02:33Z',\*\*\*\*
> 
> 'modified':'2011-12-07T22:02:33Z',\*\*\*\*
> 
> 'attachment' : '...JVBERi0xLjMKJcTl8uXrp/Og...base64'\*\*\*\*
> 
> }\*\*\*\*
> 
> * * *
> 
> I search by\*\*\*\*
> 
> * * *
> 
> {\*\*\*\*
> 
> "query":{\*\*\*\*
> 
> "term" : { "attachment": "redis"} \*\*\*\*
> 
> },\*\*\*\*
> 
> "highlight" : {\*\*\*\*
> 
> ```
> "fields" : { ****
> 
> "attachment" : {} ****
> 
> } ****
> 
> } ****
> 
> ```
> 
> }\*\*\*\*
> 
> * * *
> 
> I get the document properly, the highlight entry is \*\*\*\*
> 
> * * *
> 
> "highlight":{"filename":["_Redis_ manual.pdf"] }\*\*\*\*
> 
> * * *
> 
> I see that ES returns \_source of the doc so the field attachment is still  
> a encoded content, I was expecting the tika extracted content in  
> text/plain. The question is, is there any way to get highlights as decoded  
> text?\*\*\*\*
> 
> * * *
> 
> * * *
> 
> * * *
> 
> * * *
> 
> * * *
> 
> --  
> 's  
> Shairon Toledo  
> [http://www.google.com/profiles/shairon.toledo](http://www.google.com/profiles/shairon.toledo)\*\*\*\*

--  
's  
Shairon Toledo  
[http://www.google.com/profiles/shairon.toledo](http://www.google.com/profiles/shairon.toledo)

---

<div class="post-metadata">

**Author:** ![Mauricio\_Linhares](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mauricio_linhares/32/880_2.png) [@Mauricio\_Linhares](https://discuss.elastic.co/u/Mauricio_Linhares)\
**Post date:** [January 24, 2012, 3:15am UTC](https://discuss.elastic.co/t/mapper-attachments-and-highlights/6473/6 "2012-01-24T03:15:59Z")

</div>

Hi Shairon,

I could not reproduce your steps from the curl calls and I also could  
not re-generate your pdf file from the base64 in there, so I'm  
guessing there is something wrong with that base64 string and the  
plugin is not being able to decode the file.

You can open config/logging.yml and change the root logger to DEBUG so  
you can see what the plugin says when it receives the file.

In any case, I built a very simple example on how to index and search  
for a document with the plugin enabled, you can check it out here -\>

> **[GitHub - mauricio/elasticsearch-with-attachment](https://github.com/mauricio/elasticsearch-with-attachment)**
>
> Contribute to mauricio/elasticsearch-with-attachment development by creating an account on GitHub.

- 

Maurício Linhares  
[http://techbot.me/](http://techbot.me/) - [http://twitter.com/#!/mauriciojr](http://twitter.com/#!/mauriciojr)

On Mon, Jan 23, 2012 at 9:10 PM, Shairon Toledo  
[shairon.toledo@gmail.com](mailto:shairon.toledo@gmail.com) wrote:

> I removed /plugins/\* and installed new one by
> 
> bin/plugin -install elasticsearch/elasticsearch-mapper-attachments/1.0.0
> 
> No success.
> 
> I've put together the artifacts over a  
> gist [Mapper-Attachments Issue · GitHub](https://gist.github.com/b457803a9358c6465578)
> 
> Do you see any issue with my steps?
> 
> Thank for your help o/
> 
> On Mon, Jan 23, 2012 at 8:53 PM, David Pilato [david@pilato.fr](mailto:david@pilato.fr) wrote:
> 
> > Ok. I think that you should consider to use the new plugin repository,  
> > even if it should be the same content.
> > 
> > [GitHub - elastic/elasticsearch-mapper-attachments: Mapper Attachments Type plugin for Elasticsearch](https://github.com/elasticsearch/elasticsearch-mapper-attachments)
> > 
> > I use this version (1.0.0).
> > 
> > Could you gist a curl recreation ? ([Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/help/))
> > 
> > Not sure I can answer right now (time to sleep here ;-)), but I could have  
> > a look at it tomorrow (or perhaps someone else will answer before).
> > 
> > Some other question.
> > 
> > When you index your doc, do you see “updating mapping” in logs ?
> > 
> > Can you check also that your mapping is the one you think it is ?
> > 
> > I suspect that your mapping has not been taken into account and that ES  
> > thinks that your attachment field is only a string…
> > 
> > David.
> > 
> > De : [elasticsearch@googlegroups.com](mailto:elasticsearch@googlegroups.com)  
> > [[mailto:elasticsearch@googlegroups.com](mailto:elasticsearch@googlegroups.com)] De la part de Shairon Toledo  
> > Envoyé : lundi 23 janvier 2012 23:41  
> > À : [elasticsearch@googlegroups.com](mailto:elasticsearch@googlegroups.com)  
> > Objet : Re: mapper-attachments and highlights
> > 
> > Hi David,
> > 
> > My env is
> > 
> > elasticsearch-0.18.7
> > 
> > elasticsearch-mapper-attachments-0.18.7.jar
> > 
> > thx
> > 
> > On Mon, Jan 23, 2012 at 8:24 PM, David Pilato [david@pilato.fr](mailto:david@pilato.fr) wrote:
> > 
> > Hi Shairon,
> > 
> > Highlighting attachments works fine for me.
> > 
> > It’s highlight the content of my base64 encoded files.
> > 
> > What version do you use (ES and mapper-attachment-plugin) ?
> > 
> > De : [elasticsearch@googlegroups.com](mailto:elasticsearch@googlegroups.com)  
> > [[mailto:elasticsearch@googlegroups.com](mailto:elasticsearch@googlegroups.com)] De la part de Shairon Toledo  
> > Envoyé : lundi 23 janvier 2012 22:56  
> > À : [elasticsearch@googlegroups.com](mailto:elasticsearch@googlegroups.com)  
> > Objet : mapper-attachments and highlights
> > 
> > Hi guys,
> > 
> > I got ES with mapper-attachments plugin running here, I've used this  
> > mapping to the plugin
> > 
> > {
> > 
> > "doc" : {
> > 
> > ```
> > "properties" : {
> > 
> > "attachment" : {"type" : "attachment", "store" : "yes",
> > 
> > ```
> > 
> > "term\_vector" : "with\_positions\_offsets" }
> > 
> > ```
> > }
> > 
> > ```
> > 
> > }
> > 
> > }
> > 
> > The doc
> > 
> > {
> > 
> > 'filename':'Redis manual.pdf',
> > 
> > 'size':61952,
> > 
> > 'folder':'/Users/shairon/References',
> > 
> > 'updated\_at':'2011-12-07T22:02:33Z',
> > 
> > 'modified':'2011-12-07T22:02:33Z',
> > 
> > 'attachment' : '...JVBERi0xLjMKJcTl8uXrp/Og...base64'
> > 
> > }
> > 
> > I search by
> > 
> > {
> > 
> > "query":{
> > 
> > "term" : { "attachment": "redis"}
> > 
> > },
> > 
> > "highlight" : {
> > 
> > ```
> > "fields" : {
> > 
> > "attachment" : {}
> > 
> > }
> > 
> > }
> > 
> > ```
> > 
> > }
> > 
> > I get the document properly, the highlight entry is
> > 
> > "highlight":{"filename":["_Redis_ manual.pdf"] }
> > 
> > I see that ES returns \_source of the doc so the field attachment is still  
> > a encoded content, I was expecting the tika extracted content in text/plain.  
> > The question is, is there any way to get highlights as decoded text?
> > 
> > --  
> > 's  
> > Shairon Toledo  
> > [http://www.google.com/profiles/shairon.toledo](http://www.google.com/profiles/shairon.toledo)
> 
> --  
> 's  
> Shairon Toledo  
> [http://www.google.com/profiles/shairon.toledo](http://www.google.com/profiles/shairon.toledo)

---

<div class="post-metadata">

**Author:** ![Shairon\_Toledo](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/shairon_toledo/32/2490_2.png) [@Shairon\_Toledo](https://discuss.elastic.co/u/Shairon_Toledo)\
**Post date:** [January 24, 2012, 12:49pm UTC](https://discuss.elastic.co/t/mapper-attachments-and-highlights/6473/7 "2012-01-24T12:49:32Z")

</div>

Indeed, curl wasn't good enough to test. Even using your project I get same  
behavior here, no highlights for document content.  
I've created a test case

> **[GitHub - shairontoledo/elasticsearch-attachment-tests](https://github.com/shairontoledo/elasticsearch-attachment-tests)**
>
> Contribute to shairontoledo/elasticsearch-attachment-tests development by creating an account on GitHub.

I got success for filename field but red for  
content[https://github.com/shairontoledo/elasticsearch-attachment-tests/blob/master/src/test/java/net/hashcode/esattach/AttachmentTest.java](https://github.com/shairontoledo/elasticsearch-attachment-tests/blob/master/src/test/java/net/hashcode/esattach/AttachmentTest.java)

//line 97  
assertThat(search.hits().getAt(0).highlightFields().get(attachFiled),  
notNullValue());  
\*  
\*  
\*  
\*  
\*  
\*  
2012/1/24 Maurício Linhares [mauricio.linhares@gmail.com](mailto:mauricio.linhares@gmail.com)

> Hi Shairon,
> 
> I could not reproduce your steps from the curl calls and I also could  
> not re-generate your pdf file from the base64 in there, so I'm  
> guessing there is something wrong with that base64 string and the  
> plugin is not being able to decode the file.
> 
> You can open config/logging.yml and change the root logger to DEBUG so  
> you can see what the plugin says when it receives the file.
> 
> In any case, I built a very simple example on how to index and search  
> for a document with the plugin enabled, you can check it out here -\>  
> [GitHub - mauricio/elasticsearch-with-attachment](https://github.com/mauricio/elasticsearch-with-attachment)
> 
> - 
> 
> Maurício Linhares  
> [http://techbot.me/](http://techbot.me/) - [http://twitter.com/#!/mauriciojr](http://twitter.com/#!/mauriciojr)
> 
> On Mon, Jan 23, 2012 at 9:10 PM, Shairon Toledo  
> [shairon.toledo@gmail.com](mailto:shairon.toledo@gmail.com) wrote:
> 
> > I removed /plugins/\* and installed new one by
> > 
> > bin/plugin -install elasticsearch/elasticsearch-mapper-attachments/1.0.0
> > 
> > No success.
> > 
> > I've put together the artifacts over a  
> > gist [Mapper-Attachments Issue · GitHub](https://gist.github.com/b457803a9358c6465578)
> > 
> > Do you see any issue with my steps?
> > 
> > Thank for your help o/
> > 
> > On Mon, Jan 23, 2012 at 8:53 PM, David Pilato [david@pilato.fr](mailto:david@pilato.fr) wrote:
> > 
> > > Ok. I think that you should consider to use the new plugin repository,  
> > > even if it should be the same content.
> > > 
> > > [GitHub - elastic/elasticsearch-mapper-attachments: Mapper Attachments Type plugin for Elasticsearch](https://github.com/elasticsearch/elasticsearch-mapper-attachments)
> > > 
> > > I use this version (1.0.0).
> > > 
> > > Could you gist a curl recreation ? ([Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/help/))
> > > 
> > > Not sure I can answer right now (time to sleep here ;-)), but I could  
> > > have  
> > > a look at it tomorrow (or perhaps someone else will answer before).
> > > 
> > > Some other question.
> > > 
> > > When you index your doc, do you see “updating mapping” in logs ?
> > > 
> > > Can you check also that your mapping is the one you think it is ?
> > > 
> > > I suspect that your mapping has not been taken into account and that ES  
> > > thinks that your attachment field is only a string…
> > > 
> > > David.
> > > 
> > > De : [elasticsearch@googlegroups.com](mailto:elasticsearch@googlegroups.com)  
> > > [[mailto:elasticsearch@googlegroups.com](mailto:elasticsearch@googlegroups.com)] De la part de Shairon Toledo  
> > > Envoyé : lundi 23 janvier 2012 23:41  
> > > À : [elasticsearch@googlegroups.com](mailto:elasticsearch@googlegroups.com)  
> > > Objet : Re: mapper-attachments and highlights
> > > 
> > > Hi David,
> > > 
> > > My env is
> > > 
> > > elasticsearch-0.18.7
> > > 
> > > elasticsearch-mapper-attachments-0.18.7.jar
> > > 
> > > thx
> > > 
> > > On Mon, Jan 23, 2012 at 8:24 PM, David Pilato [david@pilato.fr](mailto:david@pilato.fr) wrote:
> > > 
> > > Hi Shairon,
> > > 
> > > Highlighting attachments works fine for me.
> > > 
> > > It’s highlight the content of my base64 encoded files.
> > > 
> > > What version do you use (ES and mapper-attachment-plugin) ?
> > > 
> > > De : [elasticsearch@googlegroups.com](mailto:elasticsearch@googlegroups.com)  
> > > [[mailto:elasticsearch@googlegroups.com](mailto:elasticsearch@googlegroups.com)] De la part de Shairon Toledo  
> > > Envoyé : lundi 23 janvier 2012 22:56  
> > > À : [elasticsearch@googlegroups.com](mailto:elasticsearch@googlegroups.com)  
> > > Objet : mapper-attachments and highlights
> > > 
> > > Hi guys,
> > > 
> > > I got ES with mapper-attachments plugin running here, I've used this  
> > > mapping to the plugin
> > > 
> > > {
> > > 
> > > "doc" : {
> > > 
> > > ```
> > > "properties" : {
> > > 
> > > "attachment" : {"type" : "attachment", "store" : "yes",
> > > 
> > > ```
> > > 
> > > "term\_vector" : "with\_positions\_offsets" }
> > > 
> > > ```
> > > }
> > > 
> > > ```
> > > 
> > > }
> > > 
> > > }
> > > 
> > > The doc
> > > 
> > > {
> > > 
> > > 'filename':'Redis manual.pdf',
> > > 
> > > 'size':61952,
> > > 
> > > 'folder':'/Users/shairon/References',
> > > 
> > > 'updated\_at':'2011-12-07T22:02:33Z',
> > > 
> > > 'modified':'2011-12-07T22:02:33Z',
> > > 
> > > 'attachment' : '...JVBERi0xLjMKJcTl8uXrp/Og...base64'
> > > 
> > > }
> > > 
> > > I search by
> > > 
> > > {
> > > 
> > > "query":{
> > > 
> > > "term" : { "attachment": "redis"}
> > > 
> > > },
> > > 
> > > "highlight" : {
> > > 
> > > ```
> > > "fields" : {
> > > 
> > > "attachment" : {}
> > > 
> > > }
> > > 
> > > }
> > > 
> > > ```
> > > 
> > > }
> > > 
> > > I get the document properly, the highlight entry is
> > > 
> > > "highlight":{"filename":["_Redis_ manual.pdf"] }
> > > 
> > > I see that ES returns \_source of the doc so the field attachment is  
> > > still  
> > > a encoded content, I was expecting the tika extracted content in  
> > > text/plain.  
> > > The question is, is there any way to get highlights as decoded text?
> > > 
> > > --  
> > > 's  
> > > Shairon Toledo  
> > > [http://www.google.com/profiles/shairon.toledo](http://www.google.com/profiles/shairon.toledo)
> > 
> > --  
> > 's  
> > Shairon Toledo  
> > [http://www.google.com/profiles/shairon.toledo](http://www.google.com/profiles/shairon.toledo)

--  
's  
Shairon Toledo  
[http://www.google.com/profiles/shairon.toledo](http://www.google.com/profiles/shairon.toledo)

---

<div class="post-metadata">

**Author:** ![Mauricio\_Linhares\_2](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mauricio_linhares_2/32/880_2.png) [@Mauricio\_Linhares\_2](https://discuss.elastic.co/u/Mauricio_Linhares_2)\
**Post date:** [January 24, 2012, 1:01pm UTC](https://discuss.elastic.co/t/mapper-attachments-and-highlights/6473/8 "2012-01-24T13:01:19Z")

</div>

I see you are creating a Node, shouldnt you connect to the ES server that you installed the plugin?

This Node you are starting possibly does not have the plugin installed.

Enviado via iPad

Em 24/01/2012, às 09:49, Shairon Toledo [shairon.toledo@gmail.com](mailto:shairon.toledo@gmail.com) escreveu:

> Indeed, curl wasn't good enough to test. Even using your project I get same behavior here, no highlights for document content.  
> I've created a test case [GitHub - shairontoledo/elasticsearch-attachment-tests](https://github.com/shairontoledo/elasticsearch-attachment-tests)
> 
> I got success for filename field but red for content
> 
> //line 97  
> assertThat(search.hits().getAt(0).highlightFields().get(attachFiled), notNullValue());
> 
> 2012/1/24 Maurício Linhares [mauricio.linhares@gmail.com](mailto:mauricio.linhares@gmail.com)  
> Hi Shairon,
> 
> I could not reproduce your steps from the curl calls and I also could  
> not re-generate your pdf file from the base64 in there, so I'm  
> guessing there is something wrong with that base64 string and the  
> plugin is not being able to decode the file.
> 
> You can open config/logging.yml and change the root logger to DEBUG so  
> you can see what the plugin says when it receives the file.
> 
> In any case, I built a very simple example on how to index and search  
> for a document with the plugin enabled, you can check it out here -\>  
> [GitHub - mauricio/elasticsearch-with-attachment](https://github.com/mauricio/elasticsearch-with-attachment)
> 
> - 
> 
> Maurício Linhares  
> [http://techbot.me/](http://techbot.me/) - [http://twitter.com/#!/mauriciojr](http://twitter.com/#!/mauriciojr)
> 
> On Mon, Jan 23, 2012 at 9:10 PM, Shairon Toledo  
> [shairon.toledo@gmail.com](mailto:shairon.toledo@gmail.com) wrote:
> 
> > I removed /plugins/\* and installed new one by
> > 
> > bin/plugin -install elasticsearch/elasticsearch-mapper-attachments/1.0.0
> > 
> > No success.
> > 
> > I've put together the artifacts over a  
> > gist [Mapper-Attachments Issue · GitHub](https://gist.github.com/b457803a9358c6465578)
> > 
> > Do you see any issue with my steps?
> > 
> > Thank for your help o/
> > 
> > On Mon, Jan 23, 2012 at 8:53 PM, David Pilato [david@pilato.fr](mailto:david@pilato.fr) wrote:
> > 
> > > Ok. I think that you should consider to use the new plugin repository,  
> > > even if it should be the same content.
> > > 
> > > [GitHub - elastic/elasticsearch-mapper-attachments: Mapper Attachments Type plugin for Elasticsearch](https://github.com/elasticsearch/elasticsearch-mapper-attachments)
> > > 
> > > I use this version (1.0.0).
> > > 
> > > Could you gist a curl recreation ? ([Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/help/))
> > > 
> > > Not sure I can answer right now (time to sleep here ;-)), but I could have  
> > > a look at it tomorrow (or perhaps someone else will answer before).
> > > 
> > > Some other question.
> > > 
> > > When you index your doc, do you see “updating mapping” in logs ?
> > > 
> > > Can you check also that your mapping is the one you think it is ?
> > > 
> > > I suspect that your mapping has not been taken into account and that ES  
> > > thinks that your attachment field is only a string…
> > > 
> > > David.
> > > 
> > > De : [elasticsearch@googlegroups.com](mailto:elasticsearch@googlegroups.com)  
> > > [[mailto:elasticsearch@googlegroups.com](mailto:elasticsearch@googlegroups.com)] De la part de Shairon Toledo  
> > > Envoyé : lundi 23 janvier 2012 23:41  
> > > À : [elasticsearch@googlegroups.com](mailto:elasticsearch@googlegroups.com)  
> > > Objet : Re: mapper-attachments and highlights
> > > 
> > > Hi David,
> > > 
> > > My env is
> > > 
> > > elasticsearch-0.18.7
> > > 
> > > elasticsearch-mapper-attachments-0.18.7.jar
> > > 
> > > thx
> > > 
> > > On Mon, Jan 23, 2012 at 8:24 PM, David Pilato [david@pilato.fr](mailto:david@pilato.fr) wrote:
> > > 
> > > Hi Shairon,
> > > 
> > > Highlighting attachments works fine for me.
> > > 
> > > It’s highlight the content of my base64 encoded files.
> > > 
> > > What version do you use (ES and mapper-attachment-plugin) ?
> > > 
> > > De : [elasticsearch@googlegroups.com](mailto:elasticsearch@googlegroups.com)  
> > > [[mailto:elasticsearch@googlegroups.com](mailto:elasticsearch@googlegroups.com)] De la part de Shairon Toledo  
> > > Envoyé : lundi 23 janvier 2012 22:56  
> > > À : [elasticsearch@googlegroups.com](mailto:elasticsearch@googlegroups.com)  
> > > Objet : mapper-attachments and highlights
> > > 
> > > Hi guys,
> > > 
> > > I got ES with mapper-attachments plugin running here, I've used this  
> > > mapping to the plugin
> > > 
> > > {
> > > 
> > > "doc" : {
> > > 
> > > ```
> > > "properties" : {
> > > 
> > > "attachment" : {"type" : "attachment", "store" : "yes",
> > > 
> > > ```
> > > 
> > > "term\_vector" : "with\_positions\_offsets" }
> > > 
> > > ```
> > > }
> > > 
> > > ```
> > > 
> > > }
> > > 
> > > }
> > > 
> > > The doc
> > > 
> > > {
> > > 
> > > 'filename':'Redis manual.pdf',
> > > 
> > > 'size':61952,
> > > 
> > > 'folder':'/Users/shairon/References',
> > > 
> > > 'updated\_at':'2011-12-07T22:02:33Z',
> > > 
> > > 'modified':'2011-12-07T22:02:33Z',
> > > 
> > > 'attachment' : '...JVBERi0xLjMKJcTl8uXrp/Og...base64'
> > > 
> > > }
> > > 
> > > I search by
> > > 
> > > {
> > > 
> > > "query":{
> > > 
> > > "term" : { "attachment": "redis"}
> > > 
> > > },
> > > 
> > > "highlight" : {
> > > 
> > > ```
> > > "fields" : {
> > > 
> > > "attachment" : {}
> > > 
> > > }
> > > 
> > > }
> > > 
> > > ```
> > > 
> > > }
> > > 
> > > I get the document properly, the highlight entry is
> > > 
> > > "highlight":{"filename":["_Redis_ manual.pdf"] }
> > > 
> > > I see that ES returns \_source of the doc so the field attachment is still  
> > > a encoded content, I was expecting the tika extracted content in text/plain.  
> > > The question is, is there any way to get highlights as decoded text?
> > > 
> > > --  
> > > 's  
> > > Shairon Toledo  
> > > [http://www.google.com/profiles/shairon.toledo](http://www.google.com/profiles/shairon.toledo)
> > 
> > --  
> > 's  
> > Shairon Toledo  
> > [http://www.google.com/profiles/shairon.toledo](http://www.google.com/profiles/shairon.toledo)
> 
> --  
> 's  
> Shairon Toledo  
> [http://www.google.com/profiles/shairon.toledo](http://www.google.com/profiles/shairon.toledo)

---

<div class="post-metadata">

**Author:** ![Shairon\_Toledo](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/shairon_toledo/32/2490_2.png) [@Shairon\_Toledo](https://discuss.elastic.co/u/Shairon_Toledo)\
**Post date:** [January 24, 2012, 2:31pm UTC](https://discuss.elastic.co/t/mapper-attachments-and-highlights/6473/9 "2012-01-24T14:31:36Z")

</div>

The plugin is registered properly, in log I can see it

> <https://gist.github.com/shairontoledo/42b8e0e8603670e16ab0>

[2012-01-24 12:28:43,054][INFO][org.elasticsearch.plugins] [Chondu the  
Mystic] loaded [mapper-attachments], sites

Thanks,

2012/1/24 Maurício Linhares [linhares.mauricio@gmail.com](mailto:linhares.mauricio@gmail.com)

> I see you are creating a Node, shouldnt you connect to the ES server that  
> you installed the plugin?
> 
> This Node you are starting possibly does not have the plugin installed.
> 
> Enviado via iPad
> 
> Em 24/01/2012, às 09:49, Shairon Toledo [shairon.toledo@gmail.com](mailto:shairon.toledo@gmail.com)  
> escreveu:
> 
> Indeed, curl wasn't good enough to test. Even using your project I get  
> same behavior here, no highlights for document content.  
> I've created a test case  
> [GitHub - shairontoledo/elasticsearch-attachment-tests](https://github.com/shairontoledo/elasticsearch-attachment-tests)
> 
> I got success for filename field but red for content[https://github.com/shairontoledo/elasticsearch-attachment-tests/blob/master/src/test/java/net/hashcode/esattach/AttachmentTest.java](https://github.com/shairontoledo/elasticsearch-attachment-tests/blob/master/src/test/java/net/hashcode/esattach/AttachmentTest.java)
> 
> //line 97  
> assertThat(search.hits().getAt(0).highlightFields().get(attachFiled),  
> notNullValue());  
> \*  
> \*  
> \*  
> \*  
> \*  
> \*  
> 2012/1/24 Maurício Linhares [mauricio.linhares@gmail.com](mailto:mauricio.linhares@gmail.com)
> 
> > Hi Shairon,
> > 
> > I could not reproduce your steps from the curl calls and I also could  
> > not re-generate your pdf file from the base64 in there, so I'm  
> > guessing there is something wrong with that base64 string and the  
> > plugin is not being able to decode the file.
> > 
> > You can open config/logging.yml and change the root logger to DEBUG so  
> > you can see what the plugin says when it receives the file.
> > 
> > In any case, I built a very simple example on how to index and search  
> > for a document with the plugin enabled, you can check it out here -\>  
> > [GitHub - mauricio/elasticsearch-with-attachment](https://github.com/mauricio/elasticsearch-with-attachment)
> > 
> > - 
> > 
> > Maurício Linhares  
> > [http://techbot.me/](http://techbot.me/) - [http://twitter.com/#!/mauriciojr](http://twitter.com/#!/mauriciojr)
> > 
> > On Mon, Jan 23, 2012 at 9:10 PM, Shairon Toledo  
> > [shairon.toledo@gmail.com](mailto:shairon.toledo@gmail.com) wrote:
> > 
> > > I removed /plugins/\* and installed new one by
> > > 
> > > bin/plugin -install elasticsearch/elasticsearch-mapper-attachments/1.0.0
> > > 
> > > No success.
> > > 
> > > I've put together the artifacts over a  
> > > gist [Mapper-Attachments Issue · GitHub](https://gist.github.com/b457803a9358c6465578)
> > > 
> > > Do you see any issue with my steps?
> > > 
> > > Thank for your help o/
> > > 
> > > On Mon, Jan 23, 2012 at 8:53 PM, David Pilato [david@pilato.fr](mailto:david@pilato.fr) wrote:
> > > 
> > > > Ok. I think that you should consider to use the new plugin repository,  
> > > > even if it should be the same content.
> > > > 
> > > > [GitHub - elastic/elasticsearch-mapper-attachments: Mapper Attachments Type plugin for Elasticsearch](https://github.com/elasticsearch/elasticsearch-mapper-attachments)
> > > > 
> > > > I use this version (1.0.0).
> > > > 
> > > > Could you gist a curl recreation ? ([Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/help/)  
> > > > )
> > > > 
> > > > Not sure I can answer right now (time to sleep here ;-)), but I could  
> > > > have  
> > > > a look at it tomorrow (or perhaps someone else will answer before).
> > > > 
> > > > Some other question.
> > > > 
> > > > When you index your doc, do you see “updating mapping” in logs ?
> > > > 
> > > > Can you check also that your mapping is the one you think it is ?
> > > > 
> > > > I suspect that your mapping has not been taken into account and that ES  
> > > > thinks that your attachment field is only a string…
> > > > 
> > > > David.
> > > > 
> > > > De : [elasticsearch@googlegroups.com](mailto:elasticsearch@googlegroups.com)  
> > > > [[mailto:elasticsearch@googlegroups.com](mailto:elasticsearch@googlegroups.com)] De la part de Shairon Toledo  
> > > > Envoyé : lundi 23 janvier 2012 23:41  
> > > > À : [elasticsearch@googlegroups.com](mailto:elasticsearch@googlegroups.com)  
> > > > Objet : Re: mapper-attachments and highlights
> > > > 
> > > > Hi David,
> > > > 
> > > > My env is
> > > > 
> > > > elasticsearch-0.18.7
> > > > 
> > > > elasticsearch-mapper-attachments-0.18.7.jar
> > > > 
> > > > thx
> > > > 
> > > > On Mon, Jan 23, 2012 at 8:24 PM, David Pilato [david@pilato.fr](mailto:david@pilato.fr) wrote:
> > > > 
> > > > Hi Shairon,
> > > > 
> > > > Highlighting attachments works fine for me.
> > > > 
> > > > It’s highlight the content of my base64 encoded files.
> > > > 
> > > > What version do you use (ES and mapper-attachment-plugin) ?
> > > > 
> > > > De : [elasticsearch@googlegroups.com](mailto:elasticsearch@googlegroups.com)  
> > > > [[mailto:elasticsearch@googlegroups.com](mailto:elasticsearch@googlegroups.com)] De la part de Shairon Toledo  
> > > > Envoyé : lundi 23 janvier 2012 22:56  
> > > > À : [elasticsearch@googlegroups.com](mailto:elasticsearch@googlegroups.com)  
> > > > Objet : mapper-attachments and highlights
> > > > 
> > > > Hi guys,
> > > > 
> > > > I got ES with mapper-attachments plugin running here, I've used this  
> > > > mapping to the plugin
> > > > 
> > > > {
> > > > 
> > > > "doc" : {
> > > > 
> > > > ```
> > > > "properties" : {
> > > > 
> > > > "attachment" : {"type" : "attachment", "store" : "yes",
> > > > 
> > > > ```
> > > > 
> > > > "term\_vector" : "with\_positions\_offsets" }
> > > > 
> > > > ```
> > > > }
> > > > 
> > > > ```
> > > > 
> > > > }
> > > > 
> > > > }
> > > > 
> > > > The doc
> > > > 
> > > > {
> > > > 
> > > > 'filename':'Redis manual.pdf',
> > > > 
> > > > 'size':61952,
> > > > 
> > > > 'folder':'/Users/shairon/References',
> > > > 
> > > > 'updated\_at':'2011-12-07T22:02:33Z',
> > > > 
> > > > 'modified':'2011-12-07T22:02:33Z',
> > > > 
> > > > 'attachment' : '...JVBERi0xLjMKJcTl8uXrp/Og...base64'
> > > > 
> > > > }
> > > > 
> > > > I search by
> > > > 
> > > > {
> > > > 
> > > > "query":{
> > > > 
> > > > "term" : { "attachment": "redis"}
> > > > 
> > > > },
> > > > 
> > > > "highlight" : {
> > > > 
> > > > ```
> > > > "fields" : {
> > > > 
> > > > "attachment" : {}
> > > > 
> > > > }
> > > > 
> > > > }
> > > > 
> > > > ```
> > > > 
> > > > }
> > > > 
> > > > I get the document properly, the highlight entry is
> > > > 
> > > > "highlight":{"filename":["_Redis_ manual.pdf"] }
> > > > 
> > > > I see that ES returns \_source of the doc so the field attachment is  
> > > > still  
> > > > a encoded content, I was expecting the tika extracted content in  
> > > > text/plain.  
> > > > The question is, is there any way to get highlights as decoded text?
> > > > 
> > > > --  
> > > > 's  
> > > > Shairon Toledo  
> > > > [http://www.google.com/profiles/shairon.toledo](http://www.google.com/profiles/shairon.toledo)
> > > 
> > > --  
> > > 's  
> > > Shairon Toledo  
> > > [http://www.google.com/profiles/shairon.toledo](http://www.google.com/profiles/shairon.toledo)
> 
> --  
> 's  
> Shairon Toledo  
> [http://www.google.com/profiles/shairon.toledo](http://www.google.com/profiles/shairon.toledo)

--  
's  
Shairon Toledo  
[http://www.google.com/profiles/shairon.toledo](http://www.google.com/profiles/shairon.toledo)

---

<div class="post-metadata">

**Author:** ![Mauricio\_Linhares](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mauricio_linhares/32/880_2.png) [@Mauricio\_Linhares](https://discuss.elastic.co/u/Mauricio_Linhares)\
**Post date:** [January 24, 2012, 2:35pm UTC](https://discuss.elastic.co/t/mapper-attachments-and-highlights/6473/10 "2012-01-24T14:35:25Z")

</div>

Not sure what it is then, it works on my end.

`s

- 

Maurício Linhares  
[http://techbot.me/](http://techbot.me/) - [http://twitter.com/#!/mauriciojr](http://twitter.com/#!/mauriciojr)

On Tue, Jan 24, 2012 at 11:31 AM, Shairon Toledo  
[shairon.toledo@gmail.com](mailto:shairon.toledo@gmail.com) wrote:

> The plugin is registered properly, in log I can see  
> ithttps://gist.github.com/42b8e0e8603670e16ab0
> 
> [2012-01-24 12:28:43,054][INFO][org.elasticsearch.plugins] [Chondu the  
> Mystic] loaded [mapper-attachments], sites
> 
> Thanks,
> 
> 2012/1/24 Maurício Linhares [linhares.mauricio@gmail.com](mailto:linhares.mauricio@gmail.com)
> 
> > I see you are creating a Node, shouldnt you connect to the ES server that  
> > you installed the plugin?
> > 
> > This Node you are starting possibly does not have the plugin installed.
> > 
> > Enviado via iPad
> > 
> > Em 24/01/2012, às 09:49, Shairon Toledo [shairon.toledo@gmail.com](mailto:shairon.toledo@gmail.com)  
> > escreveu:
> > 
> > Indeed, curl wasn't good enough to test. Even using your project I get  
> > same behavior here, no highlights for document content.  
> > I've created a test  
> > case [GitHub - shairontoledo/elasticsearch-attachment-tests](https://github.com/shairontoledo/elasticsearch-attachment-tests)
> > 
> > I got success for filename field but red for content
> > 
> > //line 97  
> > assertThat(search.hits().getAt(0).highlightFields().get(attachFiled),  
> > notNullValue());
> > 
> > 2012/1/24 Maurício Linhares [mauricio.linhares@gmail.com](mailto:mauricio.linhares@gmail.com)
> > 
> > > Hi Shairon,
> > > 
> > > I could not reproduce your steps from the curl calls and I also could  
> > > not re-generate your pdf file from the base64 in there, so I'm  
> > > guessing there is something wrong with that base64 string and the  
> > > plugin is not being able to decode the file.
> > > 
> > > You can open config/logging.yml and change the root logger to DEBUG so  
> > > you can see what the plugin says when it receives the file.
> > > 
> > > In any case, I built a very simple example on how to index and search  
> > > for a document with the plugin enabled, you can check it out here -\>  
> > > [GitHub - mauricio/elasticsearch-with-attachment](https://github.com/mauricio/elasticsearch-with-attachment)
> > > 
> > > - 
> > > 
> > > Maurício Linhares  
> > > [http://techbot.me/](http://techbot.me/) - [http://twitter.com/#!/mauriciojr](http://twitter.com/#!/mauriciojr)
> > > 
> > > On Mon, Jan 23, 2012 at 9:10 PM, Shairon Toledo  
> > > [shairon.toledo@gmail.com](mailto:shairon.toledo@gmail.com) wrote:
> > > 
> > > > I removed /plugins/\* and installed new one by
> > > > 
> > > > bin/plugin -install  
> > > > elasticsearch/elasticsearch-mapper-attachments/1.0.0
> > > > 
> > > > No success.
> > > > 
> > > > I've put together the artifacts over a  
> > > > gist [Mapper-Attachments Issue · GitHub](https://gist.github.com/b457803a9358c6465578)
> > > > 
> > > > Do you see any issue with my steps?
> > > > 
> > > > Thank for your help o/
> > > > 
> > > > On Mon, Jan 23, 2012 at 8:53 PM, David Pilato [david@pilato.fr](mailto:david@pilato.fr) wrote:
> > > > 
> > > > > Ok. I think that you should consider to use the new plugin repository,  
> > > > > even if it should be the same content.
> > > > > 
> > > > > [GitHub - elastic/elasticsearch-mapper-attachments: Mapper Attachments Type plugin for Elasticsearch](https://github.com/elasticsearch/elasticsearch-mapper-attachments)
> > > > > 
> > > > > I use this version (1.0.0).
> > > > > 
> > > > > Could you gist a curl recreation ?  
> > > > > ([Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/help/))
> > > > > 
> > > > > Not sure I can answer right now (time to sleep here ;-)), but I could  
> > > > > have  
> > > > > a look at it tomorrow (or perhaps someone else will answer before).
> > > > > 
> > > > > Some other question.
> > > > > 
> > > > > When you index your doc, do you see “updating mapping” in logs ?
> > > > > 
> > > > > Can you check also that your mapping is the one you think it is ?
> > > > > 
> > > > > I suspect that your mapping has not been taken into account and that  
> > > > > ES  
> > > > > thinks that your attachment field is only a string…
> > > > > 
> > > > > David.
> > > > > 
> > > > > De : [elasticsearch@googlegroups.com](mailto:elasticsearch@googlegroups.com)  
> > > > > [[mailto:elasticsearch@googlegroups.com](mailto:elasticsearch@googlegroups.com)] De la part de Shairon Toledo  
> > > > > Envoyé : lundi 23 janvier 2012 23:41  
> > > > > À : [elasticsearch@googlegroups.com](mailto:elasticsearch@googlegroups.com)  
> > > > > Objet : Re: mapper-attachments and highlights
> > > > > 
> > > > > Hi David,
> > > > > 
> > > > > My env is
> > > > > 
> > > > > elasticsearch-0.18.7
> > > > > 
> > > > > elasticsearch-mapper-attachments-0.18.7.jar
> > > > > 
> > > > > thx
> > > > > 
> > > > > On Mon, Jan 23, 2012 at 8:24 PM, David Pilato [david@pilato.fr](mailto:david@pilato.fr) wrote:
> > > > > 
> > > > > Hi Shairon,
> > > > > 
> > > > > Highlighting attachments works fine for me.
> > > > > 
> > > > > It’s highlight the content of my base64 encoded files.
> > > > > 
> > > > > What version do you use (ES and mapper-attachment-plugin) ?
> > > > > 
> > > > > De : [elasticsearch@googlegroups.com](mailto:elasticsearch@googlegroups.com)  
> > > > > [[mailto:elasticsearch@googlegroups.com](mailto:elasticsearch@googlegroups.com)] De la part de Shairon Toledo  
> > > > > Envoyé : lundi 23 janvier 2012 22:56  
> > > > > À : [elasticsearch@googlegroups.com](mailto:elasticsearch@googlegroups.com)  
> > > > > Objet : mapper-attachments and highlights
> > > > > 
> > > > > Hi guys,
> > > > > 
> > > > > I got ES with mapper-attachments plugin running here, I've used this  
> > > > > mapping to the plugin
> > > > > 
> > > > > {
> > > > > 
> > > > > "doc" : {
> > > > > 
> > > > > ```
> > > > > "properties" : {
> > > > > 
> > > > > "attachment" : {"type" : "attachment", "store" : "yes",
> > > > > 
> > > > > ```
> > > > > 
> > > > > "term\_vector" : "with\_positions\_offsets" }
> > > > > 
> > > > > ```
> > > > > }
> > > > > 
> > > > > ```
> > > > > 
> > > > > }
> > > > > 
> > > > > }
> > > > > 
> > > > > The doc
> > > > > 
> > > > > {
> > > > > 
> > > > > 'filename':'Redis manual.pdf',
> > > > > 
> > > > > 'size':61952,
> > > > > 
> > > > > 'folder':'/Users/shairon/References',
> > > > > 
> > > > > 'updated\_at':'2011-12-07T22:02:33Z',
> > > > > 
> > > > > 'modified':'2011-12-07T22:02:33Z',
> > > > > 
> > > > > 'attachment' : '...JVBERi0xLjMKJcTl8uXrp/Og...base64'
> > > > > 
> > > > > }
> > > > > 
> > > > > I search by
> > > > > 
> > > > > {
> > > > > 
> > > > > "query":{
> > > > > 
> > > > > "term" : { "attachment": "redis"}
> > > > > 
> > > > > },
> > > > > 
> > > > > "highlight" : {
> > > > > 
> > > > > ```
> > > > > "fields" : {
> > > > > 
> > > > > "attachment" : {}
> > > > > 
> > > > > }
> > > > > 
> > > > > }
> > > > > 
> > > > > ```
> > > > > 
> > > > > }
> > > > > 
> > > > > I get the document properly, the highlight entry is
> > > > > 
> > > > > "highlight":{"filename":["_Redis_ manual.pdf"] }
> > > > > 
> > > > > I see that ES returns \_source of the doc so the field attachment is  
> > > > > still  
> > > > > a encoded content, I was expecting the tika extracted content in  
> > > > > text/plain.  
> > > > > The question is, is there any way to get highlights as decoded text?
> > > > > 
> > > > > --  
> > > > > 's  
> > > > > Shairon Toledo  
> > > > > [http://www.google.com/profiles/shairon.toledo](http://www.google.com/profiles/shairon.toledo)
> > > > 
> > > > --  
> > > > 's  
> > > > Shairon Toledo  
> > > > [http://www.google.com/profiles/shairon.toledo](http://www.google.com/profiles/shairon.toledo)
> > 
> > --  
> > 's  
> > Shairon Toledo  
> > [http://www.google.com/profiles/shairon.toledo](http://www.google.com/profiles/shairon.toledo)
> 
> --  
> 's  
> Shairon Toledo  
> [http://www.google.com/profiles/shairon.toledo](http://www.google.com/profiles/shairon.toledo)

---

<div class="post-metadata">

**Author:** ![Shairon\_Toledo](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/shairon_toledo/32/2490_2.png) [@Shairon\_Toledo](https://discuss.elastic.co/u/Shairon_Toledo)\
**Post date:** [January 29, 2012, 8:27pm UTC](https://discuss.elastic.co/t/mapper-attachments-and-highlights/6473/11 "2012-01-29T20:27:44Z")

</div>

I put attachment plugin working. The issues was related with mapping.  
I've ported Lukáš Vlček's  
script[http://www.elasticsearch.org/tutorials/2011/07/18/attachment-type-in-action.html](http://www.elasticsearch.org/tutorials/2011/07/18/attachment-type-in-action.html)  
to  
java, I'm sharing it in the branch  
[GitHub - shairontoledo/elasticsearch-attachment-tests](https://github.com/shairontoledo/elasticsearch-attachment-tests).

Thank you for attention.

On Mon, Jan 23, 2012 at 10:10 PM, Shairon Toledo  
[shairon.toledo@gmail.com](mailto:shairon.toledo@gmail.com)wrote:

> I removed /plugins/\* and installed new one by
> 
> bin/plugin -install elasticsearch/elasticsearch-mapper-attachments/1.0.0
> 
> No success.
> 
> I've put together the artifacts over a gist  
> [Mapper-Attachments Issue · GitHub](https://gist.github.com/b457803a9358c6465578)
> 
> Do you see any issue with my steps?
> 
> Thank for your help o/
> 
> On Mon, Jan 23, 2012 at 8:53 PM, David Pilato [david@pilato.fr](mailto:david@pilato.fr) wrote:
> 
> > Ok. I think that you should consider to use the new plugin repository,  
> > even if it should be the same content.\*\*\*\*
> > 
> > [GitHub - elastic/elasticsearch-mapper-attachments: Mapper Attachments Type plugin for Elasticsearch](https://github.com/elasticsearch/elasticsearch-mapper-attachments)\*\*\*\*
> > 
> > * * *
> > 
> > I use this version (1.0.0).\*\*\*\*
> > 
> > * * *
> > 
> > Could you gist a curl recreation ? ([Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/help/))\*\*  
> > \*\*
> > 
> > Not sure I can answer right now (time to sleep here ;-)), but I could  
> > have a look at it tomorrow (or perhaps someone else will answer before).\*
> > 
> > * * *
> > 
> > * * *
> > 
> > Some other question.\*\*\*\*
> > 
> > When you index your doc, do you see “updating mapping” in logs ?\*\*\*\*
> > 
> > Can you check also that your mapping is the one you think it is ?\*\*\*\*
> > 
> > * * *
> > 
> > I suspect that your mapping has not been taken into account and that ES  
> > thinks that your attachment field is only a string…\*\*\*\*
> > 
> > * * *
> > 
> > David.\*\*\*\*
> > 
> > * * *
> > 
> > _De :_ [elasticsearch@googlegroups.com](mailto:elasticsearch@googlegroups.com) [mailto:  
> > [elasticsearch@googlegroups.com](mailto:elasticsearch@googlegroups.com)] _De la part de_ Shairon Toledo  
> > _Envoyé :_ lundi 23 janvier 2012 23:41  
> > _À :_ [elasticsearch@googlegroups.com](mailto:elasticsearch@googlegroups.com)  
> > _Objet :_ Re: mapper-attachments and highlights\*\*\*\*
> > 
> > * * *
> > 
> > Hi David,\*\*\*\*
> > 
> > * * *
> > 
> > My env is \*\*\*\*
> > 
> > * * *
> > 
> > elasticsearch-0.18.7\*\*\*\*
> > 
> > elasticsearch-mapper-attachments-0.18.7.jar
> > 
> > thx\*\*\*\*
> > 
> > * * *
> > 
> > * * *
> > 
> > On Mon, Jan 23, 2012 at 8:24 PM, David Pilato [david@pilato.fr](mailto:david@pilato.fr) wrote:\*\*\*  
> > \*
> > 
> > Hi Shairon,\*\*\*\*
> > 
> > * * *
> > 
> > * * *
> > 
> > Highlighting attachments works fine for me.\*\*\*\*
> > 
> > It’s highlight the content of my base64 encoded files.\*\*\*\*
> > 
> > * * *
> > 
> > What version do you use (ES and mapper-attachment-plugin) ?\*\*\*\*
> > 
> > * * *
> > 
> > * * *
> > 
> > * * *
> > 
> > * * *
> > 
> > _De :_ [elasticsearch@googlegroups.com](mailto:elasticsearch@googlegroups.com) [mailto:  
> > [elasticsearch@googlegroups.com](mailto:elasticsearch@googlegroups.com)] _De la part de_ Shairon Toledo  
> > _Envoyé :_ lundi 23 janvier 2012 22:56  
> > _À :_ [elasticsearch@googlegroups.com](mailto:elasticsearch@googlegroups.com)  
> > _Objet :_ mapper-attachments and highlights\*\*\*\*
> > 
> > * * *
> > 
> > Hi guys, \*\*\*\*
> > 
> > * * *
> > 
> > I got ES with mapper-attachments plugin running here, I've used this  
> > mapping to the plugin \*\*\*\*
> > 
> > * * *
> > 
> > {\*\*\*\*
> > 
> > "doc" : {\*\*\*\*
> > 
> > ```
> > "properties" : { ****
> > 
> > "attachment" : {"type" : "attachment", "store" : "yes",
> > 
> > ```
> > 
> > "term\_vector" : "with\_positions\_offsets" }\*\*\*\*
> > 
> > ```
> > } ****
> > 
> > ```
> > 
> > }\*\*\*\*
> > 
> > }\*\*\*\*
> > 
> > * * *
> > 
> > The doc\*\*\*\*
> > 
> > * * *
> > 
> > {\*\*\*\*
> > 
> > 'filename':'Redis manual.pdf',\*\*\*\*
> > 
> > 'size':61952,\*\*\*\*
> > 
> > 'folder':'/Users/shairon/References',\*\*\*\*
> > 
> > 'updated\_at':'2011-12-07T22:02:33Z',\*\*\*\*
> > 
> > 'modified':'2011-12-07T22:02:33Z',\*\*\*\*
> > 
> > 'attachment' : '...JVBERi0xLjMKJcTl8uXrp/Og...base64'\*\*\*\*
> > 
> > }\*\*\*\*
> > 
> > * * *
> > 
> > I search by\*\*\*\*
> > 
> > * * *
> > 
> > {\*\*\*\*
> > 
> > "query":{\*\*\*\*
> > 
> > "term" : { "attachment": "redis"} \*\*\*\*
> > 
> > },\*\*\*\*
> > 
> > "highlight" : {\*\*\*\*
> > 
> > ```
> > "fields" : { ****
> > 
> > "attachment" : {} ****
> > 
> > } ****
> > 
> > } ****
> > 
> > ```
> > 
> > }\*\*\*\*
> > 
> > * * *
> > 
> > I get the document properly, the highlight entry is \*\*\*\*
> > 
> > * * *
> > 
> > "highlight":{"filename":["_Redis_ manual.pdf"] }\*\*\*\*
> > 
> > * * *
> > 
> > I see that ES returns \_source of the doc so the field attachment is still  
> > a encoded content, I was expecting the tika extracted content in  
> > text/plain. The question is, is there any way to get highlights as decoded  
> > text?\*\*\*\*
> > 
> > * * *
> > 
> > * * *
> > 
> > * * *
> > 
> > * * *
> > 
> > * * *
> > 
> > --  
> > 's  
> > Shairon Toledo  
> > [http://www.google.com/profiles/shairon.toledo](http://www.google.com/profiles/shairon.toledo)\*\*\*\*
> 
> --  
> 's  
> Shairon Toledo  
> [http://www.google.com/profiles/shairon.toledo](http://www.google.com/profiles/shairon.toledo)

--  
's  
Shairon Toledo  
[http://www.google.com/profiles/shairon.toledo](http://www.google.com/profiles/shairon.toledo)

---

<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, 3:41am UTC](https://discuss.elastic.co/t/mapper-attachments-and-highlights/6473/12 "2017-07-06T03:41:05Z")

</div>


