# Multi\_fields, store, highlights

**URL:** <https://discuss.elastic.co/t/multi-fields-store-highlights/8329>\
**Category:** Elasticsearch\
**Created:** [July 5, 2012, 4:36pm UTC](https://discuss.elastic.co/t/multi-fields-store-highlights/8329 "2012-07-05T16:36:48Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sebastien\_Lorber](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sebastien_lorber/32/2551_2.png) [@Sebastien\_Lorber](https://discuss.elastic.co/u/Sebastien_Lorber)\
**Post date:** [July 5, 2012, 4:36pm UTC](https://discuss.elastic.co/t/multi-fields-store-highlights/8329/1 "2012-07-05T16:36:48Z")

</div>

Hello,

I have the following mapping:

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

Notice that i added most of my Java code which explains how i build my  
query, and also an unit test of the result (i hope it will help others)

Is there a simple way to get highlights when using a multi\_field?

The pain is:

- I need to use a boolean/text search on these 3 fields
- I need to store=yes for all of them or i can't get the highlights from  
searches which match thanks to a field with store=false
- I need to add highlights for the 3 fields or i only get the highlights  
when it was matched by the field analyzer
- My highlight map has now 3 fields and i must select/merge the most  
appropriate one (exact match \> stemming \> ngrams for me)

What is the effect of using store=yes on each subfield? Is the original  
field going to be stored 3 times and take useless space???

Isn't there a way to build simpler queries just on the multi\_field instead  
of including all the subfields in my queries?  
And to have highlights merged automatically?  
For exemple if we have a match against 2 fields "stemmer" + "ngrams", is  
there an option to have something like "i want the biggest/smaller  
highlight for a field"  
For exemple, on a search "descript":

- Ngrams (4-\>8) will match on "descript" and produce "descript" highlight
- Stemming will match on description stemmed to "descript" and produce  
"description" highlight"

---

<div class="post-metadata">

**Author:** ![Sebastien\_Lorber](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sebastien_lorber/32/2551_2.png) [@Sebastien\_Lorber](https://discuss.elastic.co/u/Sebastien_Lorber)\
**Post date:** [July 5, 2012, 4:41pm UTC](https://discuss.elastic.co/t/multi-fields-store-highlights/8329/2 "2012-07-05T16:41:00Z")

</div>

I have noticed the plugin analysis combo

> **[GitHub - yakaz/elasticsearch-analysis-combo: Elasticsearch Combo Analyzer](https://github.com/yakaz/elasticsearch-analysis-combo)**
>
> Elasticsearch Combo Analyzer. Contribute to yakaz/elasticsearch-analysis-combo development by creating an account on GitHub.

It seems nice because we can use many analyzers for a single field, and  
thus i guess have to query only 1 field, ask for 1 highlight, and use  
store=yes on one field, but bypassing multi\_field.  
But before using it, can someone tell me if i'm doing something wrong or is  
it that complicated to query against a multi\_field?

Thanks

On Thursday, July 5, 2012 6:36:48 PM UTC+2, Sébastien Lorber wrote:

> Hello,
> 
> I have the following mapping:  
> [ElasticSearch mapping multi\_field analyzer · GitHub](https://gist.github.com/3053540)
> 
> Notice that i added most of my Java code which explains how i build my  
> query, and also an unit test of the result (i hope it will help others)
> 
> Is there a simple way to get highlights when using a multi\_field?
> 
> The pain is:
> 
> - I need to use a boolean/text search on these 3 fields
> - I need to store=yes for all of them or i can't get the highlights  
> from searches which match thanks to a field with store=false
> - I need to add highlights for the 3 fields or i only get the  
> highlights when it was matched by the field analyzer
> - My highlight map has now 3 fields and i must select/merge the most  
> appropriate one (exact match \> stemming \> ngrams for me)
> 
> What is the effect of using store=yes on each subfield? Is the original  
> field going to be stored 3 times and take useless space???
> 
> Isn't there a way to build simpler queries just on the multi\_field instead  
> of including all the subfields in my queries?  
> And to have highlights merged automatically?  
> For exemple if we have a match against 2 fields "stemmer" + "ngrams", is  
> there an option to have something like "i want the biggest/smaller  
> highlight for a field"  
> For exemple, on a search "descript":
> 
> - Ngrams (4-\>8) will match on "descript" and produce "descript" highlight
> - Stemming will match on description stemmed to "descript" and produce  
> "description" highlight"

---

<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:21am UTC](https://discuss.elastic.co/t/multi-fields-store-highlights/8329/3 "2017-07-06T03:21:23Z")

</div>


