# Should I disable scoring somehow for performance reasons?

**URL:** <https://discuss.elastic.co/t/should-i-disable-scoring-somehow-for-performance-reasons/19594>\
**Category:** Elasticsearch\
**Created:** [September 3, 2014, 4:04pm UTC](https://discuss.elastic.co/t/should-i-disable-scoring-somehow-for-performance-reasons/19594 "2014-09-03T16:04:53Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Andre\_Hansel](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/andre_hansel/32/934_2.png) [@Andre\_Hansel](https://discuss.elastic.co/u/Andre_Hansel)\
**Post date:** [September 3, 2014, 4:04pm UTC](https://discuss.elastic.co/t/should-i-disable-scoring-somehow-for-performance-reasons/19594/1 "2014-09-03T16:04:53Z")

</div>

I have an index with about a million entries with a rather dynamic  
structure. The queries I want to perform are of the kind: "give me exactly  
the entries that contain '_abc_' and '_def_' in any two fields". The  
results can be returned in an arbitrary order.

Since I still need the analyzer for accent and case folding and the like,  
the query I end up with is:  
{  
"query": {  
"match": {  
"\_all": {  
"query": "abc def",  
"operator": "and"  
}  
}  
}  
}

I have the exact same dataset in Sphinx with min\_infix\_length = 3 (the  
Sphinx equivalent of "min\_gram: 3") and on my development machine no query  
takes longer than 100 ms (in Sphinx).

I haven't even activated the ngrams in Elasticsearch yet and it already  
takes more than 500 ms to search for a new set of terms.

Now I wonder if this rather bad performance is related to the scoring that  
is performed and what I can do to make it (much) better. Can I maybe turn  
off the scoring (since I don't care about the order at all) and get better  
performance by that?

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/ed6690b3-0116-46ef-bdb2-649c2d3e50e2%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/ed6690b3-0116-46ef-bdb2-649c2d3e50e2%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![vineeth\_mohan\_2](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/vineeth_mohan_2/32/747_2.png) [@vineeth\_mohan\_2](https://discuss.elastic.co/u/vineeth_mohan_2)\
**Post date:** [September 3, 2014, 4:13pm UTC](https://discuss.elastic.co/t/should-i-disable-scoring-somehow-for-performance-reasons/19594/2 "2014-09-03T16:13:05Z")

</div>

Hello ,

If you use filters rather than query , the scoring should be out of  
picture.

Thanks  
Vineeth

On Wed, Sep 3, 2014 at 9:34 PM, André Hänsel [andre@webkr.de](mailto:andre@webkr.de) wrote:

> I have an index with about a million entries with a rather dynamic  
> structure. The queries I want to perform are of the kind: "give me exactly  
> the entries that contain '_abc_' and '_def_' in any two fields". The  
> results can be returned in an arbitrary order.
> 
> Since I still need the analyzer for accent and case folding and the like,  
> the query I end up with is:  
> {  
> "query": {  
> "match": {  
> "\_all": {  
> "query": "abc def",  
> "operator": "and"  
> }  
> }  
> }  
> }
> 
> I have the exact same dataset in Sphinx with min\_infix\_length = 3 (the  
> Sphinx equivalent of "min\_gram: 3") and on my development machine no query  
> takes longer than 100 ms (in Sphinx).
> 
> I haven't even activated the ngrams in Elasticsearch yet and it already  
> takes more than 500 ms to search for a new set of terms.
> 
> Now I wonder if this rather bad performance is related to the scoring that  
> is performed and what I can do to make it (much) better. Can I maybe turn  
> off the scoring (since I don't care about the order at all) and get better  
> performance by that?
> 
> --  
> You received this message because you are subscribed to the Google Groups  
> "elasticsearch" group.  
> To unsubscribe from this group and stop receiving emails from it, send an  
> email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> To view this discussion on the web visit  
> [https://groups.google.com/d/msgid/elasticsearch/ed6690b3-0116-46ef-bdb2-649c2d3e50e2%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/ed6690b3-0116-46ef-bdb2-649c2d3e50e2%40googlegroups.com)  
> [https://groups.google.com/d/msgid/elasticsearch/ed6690b3-0116-46ef-bdb2-649c2d3e50e2%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/ed6690b3-0116-46ef-bdb2-649c2d3e50e2%40googlegroups.com?utm_medium=email&utm_source=footer)  
> .  
> For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/CAGdPd5kMwT-%3Ddk7p%2Bhn39SewPkuMEc9sHmVNcvEfY-n0ePZuKg%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAGdPd5kMwT-%3Ddk7p%2Bhn39SewPkuMEc9sHmVNcvEfY-n0ePZuKg%40mail.gmail.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![Andre\_Hansel](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/andre_hansel/32/934_2.png) [@Andre\_Hansel](https://discuss.elastic.co/u/Andre_Hansel)\
**Post date:** [September 3, 2014, 4:18pm UTC](https://discuss.elastic.co/t/should-i-disable-scoring-somehow-for-performance-reasons/19594/3 "2014-09-03T16:18:06Z")

</div>

I thought I need a query (instead of a filter) to use the analyzer. How can  
I do this? Sorry, I'm rather new to Elasticsearch.

Also, is that the best way to go for this kind of query?

On Wednesday, September 3, 2014 6:13:15 PM UTC+2, vineeth mohan wrote:

> Hello ,
> 
> If you use filters rather than query , the scoring should be out of  
> picture.
> 
> Thanks  
> Vineeth
> 
> On Wed, Sep 3, 2014 at 9:34 PM, André Hänsel \<[an...@webkr.de](mailto:an...@webkr.de) \<javascript:\>
> 
> > wrote:
> 
> > I have an index with about a million entries with a rather dynamic  
> > structure. The queries I want to perform are of the kind: "give me exactly  
> > the entries that contain '_abc_' and '_def_' in any two fields". The  
> > results can be returned in an arbitrary order.
> > 
> > Since I still need the analyzer for accent and case folding and the like,  
> > the query I end up with is:  
> > {  
> > "query": {  
> > "match": {  
> > "\_all": {  
> > "query": "abc def",  
> > "operator": "and"  
> > }  
> > }  
> > }  
> > }
> > 
> > I have the exact same dataset in Sphinx with min\_infix\_length = 3 (the  
> > Sphinx equivalent of "min\_gram: 3") and on my development machine no query  
> > takes longer than 100 ms (in Sphinx).
> > 
> > I haven't even activated the ngrams in Elasticsearch yet and it already  
> > takes more than 500 ms to search for a new set of terms.
> > 
> > Now I wonder if this rather bad performance is related to the scoring  
> > that is performed and what I can do to make it (much) better. Can I maybe  
> > turn off the scoring (since I don't care about the order at all) and get  
> > better performance by that?
> > 
> > --  
> > You received this message because you are subscribed to the Google Groups  
> > "elasticsearch" group.  
> > To unsubscribe from this group and stop receiving emails from it, send an  
> > email to [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com) \<javascript:\>.  
> > To view this discussion on the web visit  
> > [https://groups.google.com/d/msgid/elasticsearch/ed6690b3-0116-46ef-bdb2-649c2d3e50e2%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/ed6690b3-0116-46ef-bdb2-649c2d3e50e2%40googlegroups.com)  
> > [https://groups.google.com/d/msgid/elasticsearch/ed6690b3-0116-46ef-bdb2-649c2d3e50e2%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/ed6690b3-0116-46ef-bdb2-649c2d3e50e2%40googlegroups.com?utm_medium=email&utm_source=footer)  
> > .  
> > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/908c48c1-13a4-4a61-9759-d5228b06c086%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/908c48c1-13a4-4a61-9759-d5228b06c086%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![vineeth\_mohan\_2](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/vineeth_mohan_2/32/747_2.png) [@vineeth\_mohan\_2](https://discuss.elastic.co/u/vineeth_mohan_2)\
**Post date:** [September 3, 2014, 4:26pm UTC](https://discuss.elastic.co/t/should-i-disable-scoring-somehow-for-performance-reasons/19594/4 "2014-09-03T16:26:40Z")

</div>

Hi ,

Analyzer are used either way. Just that score is not computed for filters.  
Also there are some permanence optimizations using caching in filters -

> **[Elasticsearch Platform — Find real-time answers at scale](https://www.elastic.co)**
>
> Power insights and outcomes with the Elasticsearch Platform and AI. See into your data and find answers that matter with enterprise solutions designed to help you build, observe, and protect. Try Elasticsearch free today.

Try that too.

Thanks  
Vineeth

On Wed, Sep 3, 2014 at 9:48 PM, André Hänsel [andre@webkr.de](mailto:andre@webkr.de) wrote:

> I thought I need a query (instead of a filter) to use the analyzer. How  
> can I do this? Sorry, I'm rather new to Elasticsearch.
> 
> Also, is that the best way to go for this kind of query?
> 
> On Wednesday, September 3, 2014 6:13:15 PM UTC+2, vineeth mohan wrote:
> 
> > Hello ,
> > 
> > If you use filters rather than query , the scoring should be out of  
> > picture.
> > 
> > Thanks  
> > Vineeth
> > 
> > On Wed, Sep 3, 2014 at 9:34 PM, André Hänsel [an...@webkr.de](mailto:an...@webkr.de) wrote:
> > 
> > > I have an index with about a million entries with a rather dynamic  
> > > structure. The queries I want to perform are of the kind: "give me exactly  
> > > the entries that contain '_abc_' and '_def_' in any two fields". The  
> > > results can be returned in an arbitrary order.
> > > 
> > > Since I still need the analyzer for accent and case folding and the  
> > > like, the query I end up with is:  
> > > {  
> > > "query": {  
> > > "match": {  
> > > "\_all": {  
> > > "query": "abc def",  
> > > "operator": "and"  
> > > }  
> > > }  
> > > }  
> > > }
> > > 
> > > I have the exact same dataset in Sphinx with min\_infix\_length = 3 (the  
> > > Sphinx equivalent of "min\_gram: 3") and on my development machine no query  
> > > takes longer than 100 ms (in Sphinx).
> > > 
> > > I haven't even activated the ngrams in Elasticsearch yet and it already  
> > > takes more than 500 ms to search for a new set of terms.
> > > 
> > > Now I wonder if this rather bad performance is related to the scoring  
> > > that is performed and what I can do to make it (much) better. Can I maybe  
> > > turn off the scoring (since I don't care about the order at all) and get  
> > > better performance by that?
> > > 
> > > --  
> > > You received this message because you are subscribed to the Google  
> > > Groups "elasticsearch" group.  
> > > To unsubscribe from this group and stop receiving emails from it, send  
> > > an email to [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com).
> > > 
> > > To view this discussion on the web visit [https://groups.google.com/d/](https://groups.google.com/d/)  
> > > msgid/elasticsearch/ed6690b3-0116-46ef-bdb2-649c2d3e50e2%  
> > > [40googlegroups.com](http://40googlegroups.com)  
> > > [https://groups.google.com/d/msgid/elasticsearch/ed6690b3-0116-46ef-bdb2-649c2d3e50e2%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/ed6690b3-0116-46ef-bdb2-649c2d3e50e2%40googlegroups.com?utm_medium=email&utm_source=footer)  
> > > .  
> > > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).
> > 
> > --  
> > You received this message because you are subscribed to the Google Groups  
> > "elasticsearch" group.  
> > To unsubscribe from this group and stop receiving emails from it, send an  
> > email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> > To view this discussion on the web visit  
> > [https://groups.google.com/d/msgid/elasticsearch/908c48c1-13a4-4a61-9759-d5228b06c086%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/908c48c1-13a4-4a61-9759-d5228b06c086%40googlegroups.com)  
> > [https://groups.google.com/d/msgid/elasticsearch/908c48c1-13a4-4a61-9759-d5228b06c086%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/908c48c1-13a4-4a61-9759-d5228b06c086%40googlegroups.com?utm_medium=email&utm_source=footer)  
> > .
> 
> For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/CAGdPd5kYMRGK8-U8MS2C5mQVJtZ5Pd-GE2pZK\_RdCa3-6pGxxA%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAGdPd5kYMRGK8-U8MS2C5mQVJtZ5Pd-GE2pZK_RdCa3-6pGxxA%40mail.gmail.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![Andre\_Hansel](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/andre_hansel/32/934_2.png) [@Andre\_Hansel](https://discuss.elastic.co/u/Andre_Hansel)\
**Post date:** [September 3, 2014, 5:47pm UTC](https://discuss.elastic.co/t/should-i-disable-scoring-somehow-for-performance-reasons/19594/5 "2014-09-03T17:47:14Z")

</div>

Indeed I forgot about the query filter.

Here's my new query:

{  
"query": {  
"filtered": {  
"filter": {  
"query": {  
"match": {  
"\_all": {  
"query": "abc def",  
"operator": "and"  
}  
}  
}  
}  
}  
}  
}

Now all the documents have a score of 1, but the performance is still  
really bad. Any further suggestions?

On Wednesday, September 3, 2014 6:26:51 PM UTC+2, vineeth mohan wrote:

> Hi ,
> 
> Analyzer are used either way. Just that score is not computed for filters.  
> Also there are some permanence optimizations using caching in filters -  
> [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/en/elasticsearch/guide/current/filter-caching.html)  
> Try that too.
> 
> Thanks  
> Vineeth
> 
> On Wed, Sep 3, 2014 at 9:48 PM, André Hänsel \<[an...@webkr.de](mailto:an...@webkr.de) \<javascript:\>
> 
> > wrote:
> 
> > I thought I need a query (instead of a filter) to use the analyzer. How  
> > can I do this? Sorry, I'm rather new to Elasticsearch.
> > 
> > Also, is that the best way to go for this kind of query?
> > 
> > On Wednesday, September 3, 2014 6:13:15 PM UTC+2, vineeth mohan wrote:
> > 
> > > Hello ,
> > > 
> > > If you use filters rather than query , the scoring should be out of  
> > > picture.
> > > 
> > > Thanks  
> > > Vineeth
> > > 
> > > On Wed, Sep 3, 2014 at 9:34 PM, André Hänsel [an...@webkr.de](mailto:an...@webkr.de) wrote:
> > > 
> > > > I have an index with about a million entries with a rather dynamic  
> > > > structure. The queries I want to perform are of the kind: "give me exactly  
> > > > the entries that contain '_abc_' and '_def_' in any two fields". The  
> > > > results can be returned in an arbitrary order.
> > > > 
> > > > Since I still need the analyzer for accent and case folding and the  
> > > > like, the query I end up with is:  
> > > > {  
> > > > "query": {  
> > > > "match": {  
> > > > "\_all": {  
> > > > "query": "abc def",  
> > > > "operator": "and"  
> > > > }  
> > > > }  
> > > > }  
> > > > }
> > > > 
> > > > I have the exact same dataset in Sphinx with min\_infix\_length = 3 (the  
> > > > Sphinx equivalent of "min\_gram: 3") and on my development machine no query  
> > > > takes longer than 100 ms (in Sphinx).
> > > > 
> > > > I haven't even activated the ngrams in Elasticsearch yet and it already  
> > > > takes more than 500 ms to search for a new set of terms.
> > > > 
> > > > Now I wonder if this rather bad performance is related to the scoring  
> > > > that is performed and what I can do to make it (much) better. Can I maybe  
> > > > turn off the scoring (since I don't care about the order at all) and get  
> > > > better performance by that?
> > > > 
> > > > --  
> > > > You received this message because you are subscribed to the Google  
> > > > Groups "elasticsearch" group.  
> > > > To unsubscribe from this group and stop receiving emails from it, send  
> > > > an email to [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com).
> > > > 
> > > > To view this discussion on the web visit [https://groups.google.com/d/](https://groups.google.com/d/)  
> > > > msgid/elasticsearch/ed6690b3-0116-46ef-bdb2-649c2d3e50e2%  
> > > > [40googlegroups.com](http://40googlegroups.com)  
> > > > [https://groups.google.com/d/msgid/elasticsearch/ed6690b3-0116-46ef-bdb2-649c2d3e50e2%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/ed6690b3-0116-46ef-bdb2-649c2d3e50e2%40googlegroups.com?utm_medium=email&utm_source=footer)  
> > > > .  
> > > > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).
> > > 
> > > --  
> > > You received this message because you are subscribed to the Google Groups  
> > > "elasticsearch" group.  
> > > To unsubscribe from this group and stop receiving emails from it, send an  
> > > email to [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com) \<javascript:\>.  
> > > To view this discussion on the web visit  
> > > [https://groups.google.com/d/msgid/elasticsearch/908c48c1-13a4-4a61-9759-d5228b06c086%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/908c48c1-13a4-4a61-9759-d5228b06c086%40googlegroups.com)  
> > > [https://groups.google.com/d/msgid/elasticsearch/908c48c1-13a4-4a61-9759-d5228b06c086%40googlegroups.com?utm\_medium=email&utm\_source=footer](https://groups.google.com/d/msgid/elasticsearch/908c48c1-13a4-4a61-9759-d5228b06c086%40googlegroups.com?utm_medium=email&utm_source=footer)  
> > > .
> > 
> > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/3f5739ba-50e1-4f99-9cd3-7a44c57c0eb9%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/3f5739ba-50e1-4f99-9cd3-7a44c57c0eb9%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<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, 1:04am UTC](https://discuss.elastic.co/t/should-i-disable-scoring-somehow-for-performance-reasons/19594/6 "2017-07-06T01:04:36Z")

</div>


