<p dir="auto">query string does not return right hits when you use query with wildcard and it is tokenized. Example</p>
<p dir="auto">"query_string": {<br>
"query": "luka-por-si*",<br>
"default_operator": "and",<br>
"allow_leading_wildcard": false,<br>
"analyze_wildcard": true,<br>
"minimum_should_match": "100%",<br>
"fields": [<br>
"name"<br>
],<br>
"use_dis_max": false<br>
}</p>
<p dir="auto">query should return hits with luka AND por AND si_. On es version &lt; 2.3 that works ok, now on version 2.3 and 2.3.1 query returns luka OR por OR si_. I attached files to reproduce this scenario.</p>
<p dir="auto"><strong>Elasticsearch version</strong>:&gt;=2.3</p>
<p dir="auto"><strong>JVM version</strong>:8</p>
<p dir="auto"><strong>OS version</strong>:any (tested on win and Linux ubuntu)</p>
<p dir="auto"><strong>Steps to reproduce</strong>:</p>
<ol dir="auto">
<li>create index (createindexmapping.txt)</li>
<li>fill data (insertdata.txt)</li>
<li>get results (searchdata.txt)<br>
<a href="https://github.com/elastic/elasticsearch/files/212986/createindexmapping.txt">createindexmapping.txt</a><br>
<a href="https://github.com/elastic/elasticsearch/files/212988/insertdata.txt">insertdata.txt</a><br>
<a href="https://github.com/elastic/elasticsearch/files/212987/searchdata.txt">searchdata.txt</a></li>
</ol>
<p dir="auto">I started working on adding a score_mode parameter to the rescore query, something like :</p>
<div class="highlight highlight-source-json notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="{
    &quot;rescore&quot; : {
      &quot;window_size&quot; : 50,
      &quot;query&quot; : {
         &quot;rescore_query&quot; : {
            &quot;match&quot; : {
               &quot;field1&quot; : {
                  &quot;query&quot; : &quot;the quick brown&quot;,
                  &quot;type&quot; : &quot;phrase&quot;,
                  &quot;slop&quot; : 2
               }
            }
         },
         &quot;query_weight&quot; : 0.7,
         &quot;rescore_query_weight&quot; : 1.2,
         &quot;score_mode&quot; : &quot;multiply&quot;
      }
   }
}"><pre class="notranslate">{
    <span class="pl-ent">"rescore"</span> : {
      <span class="pl-ent">"window_size"</span> : <span class="pl-c1">50</span>,
      <span class="pl-ent">"query"</span> : {
         <span class="pl-ent">"rescore_query"</span> : {
            <span class="pl-ent">"match"</span> : {
               <span class="pl-ent">"field1"</span> : {
                  <span class="pl-ent">"query"</span> : <span class="pl-s"><span class="pl-pds">"</span>the quick brown<span class="pl-pds">"</span></span>,
                  <span class="pl-ent">"type"</span> : <span class="pl-s"><span class="pl-pds">"</span>phrase<span class="pl-pds">"</span></span>,
                  <span class="pl-ent">"slop"</span> : <span class="pl-c1">2</span>
               }
            }
         },
         <span class="pl-ent">"query_weight"</span> : <span class="pl-c1">0.7</span>,
         <span class="pl-ent">"rescore_query_weight"</span> : <span class="pl-c1">1.2</span>,
         <span class="pl-ent">"score_mode"</span> : <span class="pl-s"><span class="pl-pds">"</span>multiply<span class="pl-pds">"</span></span>
      }
   }
}</pre></div>
<p dir="auto">Default is "total", possible values are : avg, max, min, total and multiply.</p>
<p dir="auto">My use case is for the "multiply", because I want to do something like:</p>
<div class="highlight highlight-source-json notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="{
   &quot;query&quot; : {
      // lot of complex queries
      // default scoring
   },
   &quot;rescore&quot; : {
      &quot;window_size&quot; : 500,
      &quot;query&quot; : {
         &quot;rescore_query&quot; : {
            &quot;custom_score&quot; : {
              &quot;query&quot; : { &quot;match_all&quot; : { } },
              &quot;script&quot; : &quot;complex_scoring&quot;,
              &quot;lang&quot; : &quot;native&quot;
            }
          },
         &quot;query_weight&quot; : 1.0,
         &quot;rescore_query_weight&quot; : 1.2
      }
   }
}"><pre class="notranslate">{
   <span class="pl-ent">"query"</span> : {
      <span class="pl-ii">// lot of complex queries</span>
      <span class="pl-ii">// default scoring</span>
   },
   <span class="pl-ent">"rescore"</span> : {
      <span class="pl-ent">"window_size"</span> : <span class="pl-c1">500</span>,
      <span class="pl-ent">"query"</span> : {
         <span class="pl-ent">"rescore_query"</span> : {
            <span class="pl-ent">"custom_score"</span> : {
              <span class="pl-ent">"query"</span> : { <span class="pl-ent">"match_all"</span> : { } },
              <span class="pl-ent">"script"</span> : <span class="pl-s"><span class="pl-pds">"</span>complex_scoring<span class="pl-pds">"</span></span>,
              <span class="pl-ent">"lang"</span> : <span class="pl-s"><span class="pl-pds">"</span>native<span class="pl-pds">"</span></span>
            }
          },
         <span class="pl-ent">"query_weight"</span> : <span class="pl-c1">1.0</span>,
         <span class="pl-ent">"rescore_query_weight"</span> : <span class="pl-c1">1.2</span>
      }
   }
}</pre></div>
<p dir="auto">So rather than having to duplicate my complex query in the rescore query, I just multiply the first score with the second one.</p>
<p dir="auto">What do you think? I will post my code.</p>