# Huge performance hit when using fuzzy and highlights

**URL:** <https://discuss.elastic.co/t/huge-performance-hit-when-using-fuzzy-and-highlights/7817>\
**Category:** Elasticsearch\
**Created:** [May 23, 2012, 12:22am UTC](https://discuss.elastic.co/t/huge-performance-hit-when-using-fuzzy-and-highlights/7817 "2012-05-23T00:22:16Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![anon44344346](https://avatars.discourse-cdn.com/v4/letter/a/e56c9b/32.png) [@anon44344346](https://discuss.elastic.co/u/anon44344346)\
**Post date:** [May 23, 2012, 12:22am UTC](https://discuss.elastic.co/t/huge-performance-hit-when-using-fuzzy-and-highlights/7817/1 "2012-05-23T00:22:16Z")

</div>

index with about 150k documents.

when using fuzzy search and highlight on three fields, there is a huge  
performance impact. what is 1 second without highligt turnos into a 7  
second query when enabling highlights on three fieds.

thought it was related  
to [http://elasticsearch-users.115913.n3.nabble.com/highlighting-just-fields-td3916391.html](http://elasticsearch-users.115913.n3.nabble.com/highlighting-just-fields-td3916391.html)  
, but tried with 0.19.3 and have had same results.

willing to post more detailed info.

txs!!!

---

<div class="post-metadata">

**Author:** ![anon44344346](https://avatars.discourse-cdn.com/v4/letter/a/e56c9b/32.png) [@anon44344346](https://discuss.elastic.co/u/anon44344346)\
**Post date:** [May 23, 2012, 3:17pm UTC](https://discuss.elastic.co/t/huge-performance-hit-when-using-fuzzy-and-highlights/7817/2 "2012-05-23T15:17:43Z")

</div>

Is this behavior to be expected (big performance loss when combining fuzzy  
and highlighting) ? Or is it bug-related or just the way it is? some  
tweaking available?

On Tuesday, May 22, 2012 8:22:16 PM UTC-4, JoeZ99 wrote:

> index with about 150k documents.
> 
> when using fuzzy search and highlight on three fields, there is a huge  
> performance impact. what is 1 second without highligt turnos into a 7  
> second query when enabling highlights on three fieds.
> 
> thought it was related to  
> [http://elasticsearch-users.115913.n3.nabble.com/highlighting-just-fields-td3916391.html](http://elasticsearch-users.115913.n3.nabble.com/highlighting-just-fields-td3916391.html), but tried with 0.19.3 and have had same results.
> 
> willing to post more detailed info.
> 
> txs!!!

---

<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:** [May 25, 2012, 8:36pm UTC](https://discuss.elastic.co/t/huge-performance-hit-when-using-fuzzy-and-highlights/7817/3 "2012-05-25T20:36:44Z")

</div>

First, fuzzy is not amazing when it comes to performance wise, second, can  
you try and use the fast vector highlighter by enabling term vectors in teh  
mappings for the fields you index on?

On Wed, May 23, 2012 at 5:17 PM, JoeZ99 [jzarate@gmail.com](mailto:jzarate@gmail.com) wrote:

> Is this behavior to be expected (big performance loss when combining fuzzy  
> and highlighting) ? Or is it bug-related or just the way it is? some  
> tweaking available?
> 
> On Tuesday, May 22, 2012 8:22:16 PM UTC-4, JoeZ99 wrote:
> 
> > index with about 150k documents.
> > 
> > when using fuzzy search and highlight on three fields, there is a huge  
> > performance impact. what is 1 second without highligt turnos into a 7  
> > second query when enabling highlights on three fieds.
> > 
> > thought it was related to [http://elasticsearch-users](http://elasticsearch-users).\*\*  
> > [115913.n3.nabble.com/\*\*highlighting-just-fields-\*\*td3916391.html](http://115913.n3.nabble.com/ **highlighting-just-fields-** td3916391.html)[http://elasticsearch-users.115913.n3.nabble.com/highlighting-just-fields-td3916391.html](http://elasticsearch-users.115913.n3.nabble.com/highlighting-just-fields-td3916391.html), but tried with 0.19.3 and have had same results.
> > 
> > willing to post more detailed info.
> > 
> > txs!!!

---

<div class="post-metadata">

**Author:** ![anon44344346](https://avatars.discourse-cdn.com/v4/letter/a/e56c9b/32.png) [@anon44344346](https://discuss.elastic.co/u/anon44344346)\
**Post date:** [May 26, 2012, 11:52pm UTC](https://discuss.elastic.co/t/huge-performance-hit-when-using-fuzzy-and-highlights/7817/4 "2012-05-26T23:52:27Z")

</div>

I'm afraid so. this is a simplified mapping I'm using:

"types": {  
...  
"typeA": {  
"mapping": {  
"fieldA": {  
"type":"string",  
"term\_vector" : "with\_positions\_offsets"  
},  
...  
}  
}

and when searching in "typeA":  
{  
"query": {  
"fuzzy": {  
"\_all": "whatever"  
}  
},  
"highlight": {  
"fields": {  
"fieldA":{}  
}  
}  
}

So I don't have much hope left. The only thing I haven't tried yet is to  
set "store=true" for the "fieldA" field (I've read highighter uses it if  
available). I don't know if there is such a difference between using that  
and \_store

On Friday, May 25, 2012 4:36:44 PM UTC-4, kimchy wrote:

> First, fuzzy is not amazing when it comes to performance wise, second, can  
> you try and use the fast vector highlighter by enabling term vectors in teh  
> mappings for the fields you index on?
> 
> On Wed, May 23, 2012 at 5:17 PM, JoeZ99 wrote:
> 
> > Is this behavior to be expected (big performance loss when combining  
> > fuzzy and highlighting) ? Or is it bug-related or just the way it is? some  
> > tweaking available?
> > 
> > On Tuesday, May 22, 2012 8:22:16 PM UTC-4, JoeZ99 wrote:
> > 
> > > index with about 150k documents.
> > > 
> > > when using fuzzy search and highlight on three fields, there is a huge  
> > > performance impact. what is 1 second without highligt turnos into a 7  
> > > second query when enabling highlights on three fieds.
> > > 
> > > thought it was related to [http://elasticsearch-users](http://elasticsearch-users).\*\*  
> > > [115913.n3.nabble.com/\*\*highlighting-just-fields-\*\*td3916391.html](http://115913.n3.nabble.com/ **highlighting-just-fields-** td3916391.html)[http://elasticsearch-users.115913.n3.nabble.com/highlighting-just-fields-td3916391.html](http://elasticsearch-users.115913.n3.nabble.com/highlighting-just-fields-td3916391.html), but tried with 0.19.3 and have had same results.
> > > 
> > > willing to post more detailed info.
> > > 
> > > txs!!!

---

<div class="post-metadata">

**Author:** ![anon44344346](https://avatars.discourse-cdn.com/v4/letter/a/e56c9b/32.png) [@anon44344346](https://discuss.elastic.co/u/anon44344346)\
**Post date:** [May 27, 2012, 3:20pm UTC](https://discuss.elastic.co/t/huge-performance-hit-when-using-fuzzy-and-highlights/7817/5 "2012-05-27T15:20:37Z")

</div>

An update. Reindexed the 130k documents with store set to true for the  
field to be highlighted, and gained a 20%, from 7 seconds to aprox. 5.

any ideas on when lucene 4.0 is going to be out?

On Tuesday, May 22, 2012 8:22:16 PM UTC-4, JoeZ99 wrote:

> index with about 150k documents.
> 
> when using fuzzy search and highlight on three fields, there is a huge  
> performance impact. what is 1 second without highligt turnos into a 7  
> second query when enabling highlights on three fieds.
> 
> thought it was related to  
> [http://elasticsearch-users.115913.n3.nabble.com/highlighting-just-fields-td3916391.html](http://elasticsearch-users.115913.n3.nabble.com/highlighting-just-fields-td3916391.html), but tried with 0.19.3 and have had same results.
> 
> willing to post more detailed info.
> 
> txs!!!

---

<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:26am UTC](https://discuss.elastic.co/t/huge-performance-hit-when-using-fuzzy-and-highlights/7817/6 "2017-07-06T03:26:48Z")

</div>


