# What does setting dis\_max exactly do in a query\_string query?

**URL:** <https://discuss.elastic.co/t/what-does-setting-dis-max-exactly-do-in-a-query-string-query/11903>\
**Category:** Elasticsearch\
**Created:** [May 9, 2013, 3:12pm UTC](https://discuss.elastic.co/t/what-does-setting-dis-max-exactly-do-in-a-query-string-query/11903 "2013-05-09T15:12:13Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![marlo](https://avatars.discourse-cdn.com/v4/letter/m/d26b3c/32.png) [@marlo](https://discuss.elastic.co/u/marlo)\
**Post date:** [May 9, 2013, 3:12pm UTC](https://discuss.elastic.co/t/what-does-setting-dis-max-exactly-do-in-a-query-string-query/11903/1 "2013-05-09T15:12:13Z")

</div>

I'm running a query as follows:

- query: {
  - 
    - 

query\_string: {  
- query: "china"  
- default\_operator: "AND"  
- use\_dis\_max: true  
- -  
fields: [  
- "headline"  
- "byline"  
- "body"  
]  
}  
}

I've been toggling use\_dis\_max on and off but can't seem to decipher what  
exactly is going on. From the Elasticsearch documentation, dis\_max is  
mentioned as "Since several queries are generated, combining them can be  
automatically done either using a dis\_maxquery or a simple bool query. "  
What exactly is meant by combining them? I understand individual queries  
are run for my query term ('china') to be run against each field specified  
and documents with that field matching my term are returned with a score,  
but what happens afterward? From dis\_max query documentation, I assume the  
highest score for a document is returned, but how about when I set  
use\_dis\_max to false then? At least from what I'm seeing with my data set,  
setting dis\_max to false or true produces identical results.

--  
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).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![Ivan](https://avatars.discourse-cdn.com/v4/letter/i/df788c/32.png) [@Ivan](https://discuss.elastic.co/u/Ivan)\
**Post date:** [May 9, 2013, 3:30pm UTC](https://discuss.elastic.co/t/what-does-setting-dis-max-exactly-do-in-a-query-string-query/11903/2 "2013-05-09T15:30:13Z")

</div>

Here is a great blog post about DisMax:  
[http://searchhub.org/2010/05/23/whats-a-dismax/](http://searchhub.org/2010/05/23/whats-a-dismax/)

--  
Ivan

On Thu, May 9, 2013 at 8:12 AM, Marlo Epres [mepres@gmail.com](mailto:mepres@gmail.com) wrote:

> I'm running a query as follows:
> 
> - query: {
> - 
> - 
> 
> query\_string: {  
> - query: "china"  
> - default\_operator: "AND"  
> - use\_dis\_max: true  
> - -  
> fields: [  
> - "headline"  
> - "byline"  
> - "body"  
> ]  
> }  
> }
> 
> I've been toggling use\_dis\_max on and off but can't seem to decipher what  
> exactly is going on. From the Elasticsearch documentation, dis\_max is  
> mentioned as "Since several queries are generated, combining them can be  
> automatically done either using a dis\_maxquery or a simple bool query. "  
> What exactly is meant by combining them? I understand individual queries  
> are run for my query term ('china') to be run against each field specified  
> and documents with that field matching my term are returned with a score,  
> but what happens afterward? From dis\_max query documentation, I assume the  
> highest score for a document is returned, but how about when I set  
> use\_dis\_max to false then? At least from what I'm seeing with my data set,  
> setting dis\_max to false or true produces identical results.
> 
> --  
> 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).  
> For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
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).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<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, 2:37am UTC](https://discuss.elastic.co/t/what-does-setting-dis-max-exactly-do-in-a-query-string-query/11903/3 "2017-07-06T02:37:19Z")

</div>


