# Rg: attachment highlighting

**URL:** <https://discuss.elastic.co/t/rg-attachment-highlighting/4838>\
**Category:** Elasticsearch\
**Created:** [July 12, 2011, 1:44pm UTC](https://discuss.elastic.co/t/rg-attachment-highlighting/4838 "2011-07-12T13:44:21Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Bhavani\_Krishna](https://avatars.discourse-cdn.com/v4/letter/b/8e8cbc/32.png) [@Bhavani\_Krishna](https://discuss.elastic.co/u/Bhavani_Krishna)\
**Post date:** [July 12, 2011, 1:44pm UTC](https://discuss.elastic.co/t/rg-attachment-highlighting/4838/1 "2011-07-12T13:44:21Z")

</div>

hi, i create a index like below

curl -XPUT '[http://localhost:9200/testindex11/](http://localhost:9200/testindex11/)' -d '{  
"settings" : {  
"index" : {  
"number\_of\_shards" : 1,  
"number\_of\_replicas" : 0  
}  
}  
}'

and i mapped it like below

curl -XPUT localhost:9200/testindex11/testmap/\_mapping -d '  
{  
"testmap": {  
"properties" : {  
"files" : { "type" : "attachment",  
"content" : { "term\_vector":"with\_positions\_offsets","store":"yes" } }  
}  
}  
}  
'

and i stored the data like below

curl -XPUT localhost:9200/testindex11/testmap/1 -d '  
{  
"files" : [  
{  
"\_content\_type" : "application/pdf",  
"\_name" : "/home/fstl/Documents/200302L045.pdf",  
"content" : "BASE64 ENCODED STRING OF PDF/XML/...."  
}  
]  
}'

and i searched like below

curl -XGET '[http://localhost:9200/testindex11/\_search?pretty=true](http://localhost:9200/testindex11/_search?pretty=true)' -d  
'  
{  
"query" : {  
"term" : { "files": "bhavani" }  
},"highlight" : {  
"fields" : {  
"files" : { "content" : {} }  
}  
}  
}'

but i am not getting the highlighted results, just getting content in  
base64 format.

so what i can do to get the results along with highlighted results?

---

<div class="post-metadata">

**Author:** ![Lukas\_Vlcek1](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/lukas_vlcek1/32/819_2.png) [@Lukas\_Vlcek1](https://discuss.elastic.co/u/Lukas_Vlcek1)\
**Post date:** [July 12, 2011, 2:52pm UTC](https://discuss.elastic.co/t/rg-attachment-highlighting/4838/2 "2011-07-12T14:52:41Z")

</div>

Hi,

Here you can find complete attachment example

> <https://gist.github.com/lukas-vlcek/1075067>

Now with highlighting too.

HTH,

Regards,  
Lukas

On Tue, Jul 12, 2011 at 3:44 PM, Bhavani Krishna [kbkrishnacse@gmail.com](mailto:kbkrishnacse@gmail.com)wrote:

> hi, i create a index like below
> 
> curl -XPUT '[http://localhost:9200/testindex11/](http://localhost:9200/testindex11/)' -d '{  
> "settings" : {  
> "index" : {  
> "number\_of\_shards" : 1,  
> "number\_of\_replicas" : 0  
> }  
> }  
> }'
> 
> and i mapped it like below
> 
> curl -XPUT localhost:9200/testindex11/testmap/\_mapping -d '  
> {  
> "testmap": {  
> "properties" : {  
> "files" : { "type" : "attachment",  
> "content" : { "term\_vector":"with\_positions\_offsets","store":"yes" } }  
> }  
> }  
> }  
> '
> 
> and i stored the data like below
> 
> curl -XPUT localhost:9200/testindex11/testmap/1 -d '  
> {  
> "files" : [  
> {  
> "\_content\_type" : "application/pdf",  
> "\_name" : "/home/fstl/Documents/200302L045.pdf",  
> "content" : "BASE64 ENCODED STRING OF PDF/XML/...."  
> }  
> ]  
> }'
> 
> and i searched like below
> 
> curl -XGET '[http://localhost:9200/testindex11/\_search?pretty=true](http://localhost:9200/testindex11/_search?pretty=true)' -d  
> '  
> {  
> "query" : {  
> "term" : { "files": "bhavani" }  
> },"highlight" : {  
> "fields" : {  
> "files" : { "content" : {} }  
> }  
> }  
> }'
> 
> but i am not getting the highlighted results, just getting content in  
> base64 format.
> 
> so what i can do to get the results along with highlighted results?

---

<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:** [July 12, 2011, 3:04pm UTC](https://discuss.elastic.co/t/rg-attachment-highlighting/4838/3 "2011-07-12T15:04:36Z")

</div>

Great !

I suggest creating a pull request to add an example chapter (or a Faq) to share it with the whole ES community.

Is there any place in the site where it can be put (tutorial ?)

David 😉

Le 12 juil. 2011 à 16:52, Lukáš Vlček [lukas.vlcek@gmail.com](mailto:lukas.vlcek@gmail.com) a écrit :

> Hi,
> 
> Here you can find complete attachment example [Test of attachments plugin · GitHub](https://gist.github.com/1075067)  
> Now with highlighting too.
> 
> HTH,
> 
> Regards,  
> Lukas
> 
> On Tue, Jul 12, 2011 at 3:44 PM, Bhavani Krishna [kbkrishnacse@gmail.com](mailto:kbkrishnacse@gmail.com) wrote:  
> hi, i create a index like below
> 
> curl -XPUT '[http://localhost:9200/testindex11/](http://localhost:9200/testindex11/)' -d '{  
> "settings" : {  
> "index" : {  
> "number\_of\_shards" : 1,  
> "number\_of\_replicas" : 0  
> }  
> }  
> }'
> 
> and i mapped it like below
> 
> curl -XPUT localhost:9200/testindex11/testmap/\_mapping -d '  
> {  
> "testmap": {  
> "properties" : {  
> "files" : { "type" : "attachment",  
> "content" : { "term\_vector":"with\_positions\_offsets","store":"yes" } }  
> }  
> }  
> }  
> '
> 
> and i stored the data like below
> 
> curl -XPUT localhost:9200/testindex11/testmap/1 -d '  
> {  
> "files" : [  
> {  
> "\_content\_type" : "application/pdf",  
> "\_name" : "/home/fstl/Documents/200302L045.pdf",  
> "content" : "BASE64 ENCODED STRING OF PDF/XML/...."  
> }  
> ]  
> }'
> 
> and i searched like below
> 
> curl -XGET '[http://localhost:9200/testindex11/\_search?pretty=true](http://localhost:9200/testindex11/_search?pretty=true)' -d  
> '  
> {  
> "query" : {  
> "term" : { "files": "bhavani" }  
> },"highlight" : {  
> "fields" : {  
> "files" : { "content" : {} }  
> }  
> }  
> }'
> 
> but i am not getting the highlighted results, just getting content in  
> base64 format.
> 
> so what i can do to get the results along with highlighted results?

---

<div class="post-metadata">

**Author:** ![Lukas\_Vlcek1](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/lukas_vlcek1/32/819_2.png) [@Lukas\_Vlcek1](https://discuss.elastic.co/u/Lukas_Vlcek1)\
**Post date:** [July 12, 2011, 4:17pm UTC](https://discuss.elastic.co/t/rg-attachment-highlighting/4838/4 "2011-07-12T16:17:50Z")

</div>

Yea, may be a tiny tutorial page about attachments would be nice.

Lukas

On Tue, Jul 12, 2011 at 5:04 PM, David Pilato [david@pilato.fr](mailto:david@pilato.fr) wrote:

> Great !
> 
> I suggest creating a pull request to add an example chapter (or a Faq) to  
> share it with the whole ES community.
> 
> Is there any place in the site where it can be put (tutorial ?)
> 
> David 😉
> 
> Le 12 juil. 2011 à 16:52, Lukáš Vlček [lukas.vlcek@gmail.com](mailto:lukas.vlcek@gmail.com) a écrit :
> 
> Hi,
> 
> Here you can find complete attachment example [https://gist.github.com/1075067](https://gist.github.com/1075067)  
> [Test of attachments plugin · GitHub](https://gist.github.com/1075067)  
> Now with highlighting too.
> 
> HTH,
> 
> Regards,  
> Lukas
> 
> On Tue, Jul 12, 2011 at 3:44 PM, Bhavani Krishna \<[kbkrishnacse@gmail.com](mailto:kbkrishnacse@gmail.com)  
> [kbkrishnacse@gmail.com](mailto:kbkrishnacse@gmail.com)\> wrote:
> 
> > hi, i create a index like below
> > 
> > curl -XPUT ' [http://localhost:9200/testindex11/](http://localhost:9200/testindex11/)  
> > [http://localhost:9200/testindex11/](http://localhost:9200/testindex11/)' -d '{  
> > "settings" : {  
> > "index" : {  
> > "number\_of\_shards" : 1,  
> > "number\_of\_replicas" : 0  
> > }  
> > }  
> > }'
> > 
> > and i mapped it like below
> > 
> > curl -XPUT localhost:9200/testindex11/testmap/\_mapping -d '  
> > {  
> > "testmap": {  
> > "properties" : {  
> > "files" : { "type" : "attachment",  
> > "content" : { "term\_vector":"with\_positions\_offsets","store":"yes" } }  
> > }  
> > }  
> > }  
> > '
> > 
> > and i stored the data like below
> > 
> > curl -XPUT localhost:9200/testindex11/testmap/1 -d '  
> > {  
> > "files" : [  
> > {  
> > "\_content\_type" : "application/pdf",  
> > "\_name" : "/home/fstl/Documents/200302L045.pdf",  
> > "content" : "BASE64 ENCODED STRING OF PDF/XML/...."  
> > }  
> > ]  
> > }'
> > 
> > and i searched like below
> > 
> > curl -XGET ' [http://localhost:9200/testindex11/\_search?pretty=true](http://localhost:9200/testindex11/_search?pretty=true)  
> > [http://localhost:9200/testindex11/\_search?pretty=true](http://localhost:9200/testindex11/_search?pretty=true)' -d  
> > '  
> > {  
> > "query" : {  
> > "term" : { "files": "bhavani" }  
> > },"highlight" : {  
> > "fields" : {  
> > "files" : { "content" : {} }  
> > }  
> > }  
> > }'
> > 
> > but i am not getting the highlighted results, just getting content in  
> > base64 format.
> > 
> > so what i can do to get the results along with highlighted results?

---

<div class="post-metadata">

**Author:** ![Bhavani\_Krishna](https://avatars.discourse-cdn.com/v4/letter/b/8e8cbc/32.png) [@Bhavani\_Krishna](https://discuss.elastic.co/u/Bhavani_Krishna)\
**Post date:** [July 13, 2011, 5:26am UTC](https://discuss.elastic.co/t/rg-attachment-highlighting/4838/5 "2011-07-13T05:26:59Z")

</div>

Thanks..it solved my problem

On Jul 12, 7:52 pm, Lukáš Vlček [lukas.vl...@gmail.com](mailto:lukas.vl...@gmail.com) wrote:

> Hi,
> 
> Here you can find complete attachment examplehttps://gist.github.com/1075067  
> Now with highlighting too.
> 
> HTH,
> 
> Regards,  
> Lukas
> 
> On Tue, Jul 12, 2011 at 3:44 PM, Bhavani Krishna [kbkrishna...@gmail.com](mailto:kbkrishna...@gmail.com)wrote:
> 
> > hi, i create a index like below
> 
> > curl -XPUT '[http://localhost:9200/testindex11/'-d](http://localhost:9200/testindex11/'-d) '{  
> > "settings" : {  
> > "index" : {  
> > "number\_of\_shards" : 1,  
> > "number\_of\_replicas" : 0  
> > }  
> > }  
> > }'
> 
> > and i mapped it like below
> 
> > curl -XPUT localhost:9200/testindex11/testmap/\_mapping -d '  
> > {  
> > "testmap": {  
> > "properties" : {  
> > "files" : { "type" : "attachment",  
> > "content" : { "term\_vector":"with\_positions\_offsets","store":"yes" } }  
> > }  
> > }  
> > }  
> > '
> 
> > and i stored the data like below
> 
> > curl -XPUT localhost:9200/testindex11/testmap/1 -d '  
> > {  
> > "files" : [  
> > {  
> > "\_content\_type" : "application/pdf",  
> > "\_name" : "/home/fstl/Documents/200302L045.pdf",  
> > "content" : "BASE64 ENCODED STRING OF PDF/XML/...."  
> > }  
> > ]  
> > }'
> 
> > and i searched like below
> 
> > curl -XGET '[http://localhost:9200/testindex11/\_search?pretty=true'-d](http://localhost:9200/testindex11/_search?pretty=true'-d)  
> > '  
> > {  
> > "query" : {  
> > "term" : { "files": "bhavani" }  
> > },"highlight" : {  
> > "fields" : {  
> > "files" : { "content" : {} }  
> > }  
> > }  
> > }'
> 
> > but i am not getting the highlighted results, just getting content in  
> > base64 format.
> 
> > so what i can do to get the results along with highlighted results?

---

<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, 4:00am UTC](https://discuss.elastic.co/t/rg-attachment-highlighting/4838/6 "2017-07-06T04:00:53Z")

</div>


