# Highlighting Question

**URL:** <https://discuss.elastic.co/t/highlighting-question/5852>\
**Category:** Elasticsearch\
**Created:** [November 11, 2011, 9:58pm UTC](https://discuss.elastic.co/t/highlighting-question/5852 "2011-11-11T21:58:49Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Neil1](https://avatars.discourse-cdn.com/v4/letter/n/278dde/32.png) [@Neil1](https://discuss.elastic.co/u/Neil1)\
**Post date:** [November 11, 2011, 9:58pm UTC](https://discuss.elastic.co/t/highlighting-question/5852/1 "2011-11-11T21:58:49Z")

</div>

If I have a multi-valued field with the following data

autoCompleteContainsCastActor: [  
John Cena  
Brian J White  
Travis Davis  
Brian DeCaro  
Peter Navy Tuiasosopo  
Kyle Clements  
Nick Gomez  
Aidan Gillen  
Steve Harris  
Gonzalo Menendez  
Taylor Cole  
Rosalind Rubin  
Ashley Scott  
]

And I choose to highlight this field in my search for "gomez"

I get 1 fragment whose value is this:

Nick \<em\>Gomez\</em\> Aidan Gillen Steve Harris Gonzalo Menendez  
Taylor Cole Rosalind Rubin Ashley Scott

I'm not changing any defaults with fragment size or number of  
fragments.

So why am I getting back the whole field and not just one entry for  
"Nick Gomez"?

Thanks,

Neil

---

<div class="post-metadata">

**Author:** ![Andy\_3](https://avatars.discourse-cdn.com/v4/letter/a/c57346/32.png) [@Andy\_3](https://discuss.elastic.co/u/Andy_3)\
**Post date:** [November 13, 2011, 2:04am UTC](https://discuss.elastic.co/t/highlighting-question/5852/2 "2011-11-13T02:04:54Z")

</div>

I'm really new to Elasticsearch, so I'm not quite an expert. I  
apologize in advance if something here is not quite right.

Default Highlighting config returns up to 5 fragments at 100  
characters each. [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/api/search/highlighting.html)  
So your getting back 1 fragment of 100 characters, I think this has to  
do with how you indexed the data.

I suspect your creating your index like this, where your passing in  
one field of people, this text is all analyzed and parsed into terms.  
{  
"someobject" : {  
"people" : "John Cena Brian J White Travis Davis"  
}

I think you could try using an array type, like this, as demonstrated  
here, [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/blog/2010/02/12/yourdatayoursearch.html)  
{  
"someobject" : {  
"people" : ["John Cena", "Brian J White", "Travis Davis"]  
}

On Nov 11, 3:58 pm, Neil [neilmatthewl...@gmail.com](mailto:neilmatthewl...@gmail.com) wrote:

> If I have a multi-valued field with the following data
> 
> autoCompleteContainsCastActor: [  
> John Cena  
> Brian J White  
> Travis Davis  
> Brian DeCaro  
> Peter Navy Tuiasosopo  
> Kyle Clements  
> Nick Gomez  
> Aidan Gillen  
> Steve Harris  
> Gonzalo Menendez  
> Taylor Cole  
> Rosalind Rubin  
> Ashley Scott  
> ]
> 
> And I choose to highlight this field in my search for "gomez"
> 
> I get 1 fragment whose value is this:
> 
> Nick \<em\>Gomez\</em\> Aidan Gillen Steve Harris Gonzalo Menendez  
> Taylor Cole Rosalind Rubin Ashley Scott
> 
> I'm not changing any defaults with fragment size or number of  
> fragments.
> 
> So why am I getting back the whole field and not just one entry for  
> "Nick Gomez"?
> 
> Thanks,
> 
> Neil

---

<div class="post-metadata">

**Author:** ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)\
**Post date:** [November 13, 2011, 8:48am UTC](https://discuss.elastic.co/t/highlighting-question/5852/3 "2011-11-13T08:48:08Z")

</div>

Multiple values for the same fields will result in this behavior for  
highlighting... . There is an issue open to try and support discrete  
highlighting per value.

On Fri, Nov 11, 2011 at 11:58 PM, Neil [neilmatthewlott@gmail.com](mailto:neilmatthewlott@gmail.com) wrote:

> If I have a multi-valued field with the following data
> 
> autoCompleteContainsCastActor: [  
> John Cena  
> Brian J White  
> Travis Davis  
> Brian DeCaro  
> Peter Navy Tuiasosopo  
> Kyle Clements  
> Nick Gomez  
> Aidan Gillen  
> Steve Harris  
> Gonzalo Menendez  
> Taylor Cole  
> Rosalind Rubin  
> Ashley Scott  
> ]
> 
> And I choose to highlight this field in my search for "gomez"
> 
> I get 1 fragment whose value is this:
> 
> Nick \<em\>Gomez\</em\> Aidan Gillen Steve Harris Gonzalo Menendez  
> Taylor Cole Rosalind Rubin Ashley Scott
> 
> I'm not changing any defaults with fragment size or number of  
> fragments.
> 
> So why am I getting back the whole field and not just one entry for  
> "Nick Gomez"?
> 
> Thanks,
> 
> Neil

---

<div class="post-metadata">

**Author:** ![Neil1](https://avatars.discourse-cdn.com/v4/letter/n/278dde/32.png) [@Neil1](https://discuss.elastic.co/u/Neil1)\
**Post date:** [November 14, 2011, 10:05pm UTC](https://discuss.elastic.co/t/highlighting-question/5852/4 "2011-11-14T22:05:54Z")

</div>

Thanks. I looked for the specific issue number but could not find it.

Would you provide it when you have a chance?

---

<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:48am UTC](https://discuss.elastic.co/t/highlighting-question/5852/5 "2017-07-06T03:48:42Z")

</div>


