# Query\_string with wildcard does not calculate score

**URL:** <https://discuss.elastic.co/t/query-string-with-wildcard-does-not-calculate-score/5588>\
**Category:** Elasticsearch\
**Created:** [October 13, 2011, 1:46pm UTC](https://discuss.elastic.co/t/query-string-with-wildcard-does-not-calculate-score/5588 "2011-10-13T13:46:28Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![BlueZero\_2](https://avatars.discourse-cdn.com/v4/letter/b/e68b1a/32.png) [@BlueZero\_2](https://discuss.elastic.co/u/BlueZero_2)\
**Post date:** [October 13, 2011, 1:46pm UTC](https://discuss.elastic.co/t/query-string-with-wildcard-does-not-calculate-score/5588/1 "2011-10-13T13:46:28Z")

</div>

I need to search nicknames with wildcard and sort them by  
relevance(score).  
But, when i do a query with wildcard, then the score is always 1.0

curl -XGET http://$HOST:$PORT/pokec/pouzivatelia/\_search -d '{  
"from" : 0,  
"size": 10,  
"query" : {  
"query\_string" : { "default\_field":"Nick",  
"query":"_blue_" }  
}  
}  
'

result:  
"\_score":1.0

curl -XGET http://$HOST:$PORT/pokec/pouzivatelia/\_search -d '{  
"from" : 0,  
"size": 10,  
"query" : {  
"query\_string" : { "default\_field":"Nick",  
"query":"blue" }  
}  
}  
'

result:  
"\_score":13.376108

Is there a way to get score also with wildcard?

---

<div class="post-metadata">

**Author:** ![Gustavo\_Maia](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/gustavo_maia/32/2183_2.png) [@Gustavo\_Maia](https://discuss.elastic.co/u/Gustavo_Maia)\
**Post date:** [October 13, 2011, 2:13pm UTC](https://discuss.elastic.co/t/query-string-with-wildcard-does-not-calculate-score/5588/2 "2011-10-13T14:13:57Z")

</div>

Check it.

> <https://github.com/elastic/elasticsearch/issues/1184>
>
> In the classe MapperQueryParser have the default value.
> 
> setMultiTermRewriteMeth…od(MultiTermQuery.CONSTANT\_SCORE\_AUTO\_REWRITE\_DEFAULT);
> 
> when use wildcard i need to change this value to
> 
> setMultiTermRewriteMethod(MultiTermQuery.SCORING\_BOOLEAN\_QUERY\_REWRITE);
> 
> I know it is slow search. But is very important for me because i need do similary search like quora.com.

You need to set rewrite to scoring\_boolean

2011/10/13 BlueZero [bluezero@bluezero.sk](mailto:bluezero@bluezero.sk):

> I need to search nicknames with wildcard and sort them by  
> relevance(score).  
> But, when i do a query with wildcard, then the score is always 1.0
> 
> curl -XGET http://$HOST:$PORT/pokec/pouzivatelia/\_search -d '{  
> "from" : 0,  
> "size": 10,  
> "query" : {  
> "query\_string" : { "default\_field":"Nick",  
> "query":"_blue_" }  
> }  
> }  
> '
> 
> result:  
> "\_score":1.0
> 
> curl -XGET http://$HOST:$PORT/pokec/pouzivatelia/\_search -d '{  
> "from" : 0,  
> "size": 10,  
> "query" : {  
> "query\_string" : { "default\_field":"Nick",  
> "query":"blue" }  
> }  
> }  
> '
> 
> result:  
> "\_score":13.376108
> 
> Is there a way to get score also with wildcard?

--  
Gustavo Maia

---

<div class="post-metadata">

**Author:** ![BlueZero\_2](https://avatars.discourse-cdn.com/v4/letter/b/e68b1a/32.png) [@BlueZero\_2](https://discuss.elastic.co/u/BlueZero_2)\
**Post date:** [October 14, 2011, 6:59am UTC](https://discuss.elastic.co/t/query-string-with-wildcard-does-not-calculate-score/5588/3 "2011-10-14T06:59:30Z")

</div>

Didnt help at all

curl -XGET http://$HOST:$PORT/pokec/pouzivatelia/\_search -d '{  
"from" : 0,  
"size": 10,  
"query" : {  
"query\_string" : { "default\_field":"Nick",  
"query":"_blue_", "rewrite":"scoring\_boolean" }  
}  
}  
'

score:1.1630663  
Nick:bluehill  
score:1.1630663  
Nick:Boblue  
score:1.1630663  
Nick:blue723  
score:1.1630663  
Nick:blue\_eyed

So every document has the same score. But shouldnt have.

On Oct 13, 4:13 pm, Gustavo Maia [gustavobbm...@gmail.com](mailto:gustavobbm...@gmail.com) wrote:

> Check it.
> 
> [WildcardQuery - dont use boost · Issue #1184 · elastic/elasticsearch · GitHub](https://github.com/elasticsearch/elasticsearch/issues/1184)
> 
> You need to set rewrite to scoring\_boolean
> 
> 2011/10/13 BlueZero [bluez...@bluezero.sk](mailto:bluez...@bluezero.sk):
> 
> > I need to search nicknames with wildcard and sort them by  
> > relevance(score).  
> > But, when i do a query with wildcard, then thescoreis always 1.0
> 
> > curl -XGET http://$HOST:$PORT/pokec/pouzivatelia/\_search -d '{  
> > "from" : 0,  
> > "size": 10,  
> > "query" : {  
> > "query\_string" : { "default\_field":"Nick",  
> > "query":"_blue_" }  
> > }  
> > }  
> > '
> 
> > result:  
> > "\_score":1.0
> 
> > curl -XGET http://$HOST:$PORT/pokec/pouzivatelia/\_search -d '{  
> > "from" : 0,  
> > "size": 10,  
> > "query" : {  
> > "query\_string" : { "default\_field":"Nick",  
> > "query":"blue" }  
> > }  
> > }  
> > '
> 
> > result:  
> > "\_score":13.376108
> 
> > Is there a way to getscorealso with wildcard?
> 
> --  
> Gustavo Maia

---

<div class="post-metadata">

**Author:** ![BlueZero\_2](https://avatars.discourse-cdn.com/v4/letter/b/e68b1a/32.png) [@BlueZero\_2](https://discuss.elastic.co/u/BlueZero_2)\
**Post date:** [October 24, 2011, 11:29am UTC](https://discuss.elastic.co/t/query-string-with-wildcard-does-not-calculate-score/5588/4 "2011-10-24T11:29:45Z")

</div>

any suggestions? please.

On Oct 14, 8:59 am, BlueZero [bluez...@bluezero.sk](mailto:bluez...@bluezero.sk) wrote:

> Didnt help at all
> 
> curl -XGET http://$HOST:$PORT/pokec/pouzivatelia/\_search -d '{  
> "from" : 0,  
> "size": 10,  
> "query" : {  
> "query\_string" : { "default\_field":"Nick",  
> "query":"_blue_", "rewrite":"scoring\_boolean" }  
> }}
> 
> '
> 
> score:1.1630663  
> Nick:bluehillscore:1.1630663  
> Nick:Bobluescore:1.1630663  
> Nick:blue723score:1.1630663  
> Nick:blue\_eyed
> 
> So every document has the samescore. But shouldnt have.
> 
> On Oct 13, 4:13 pm, Gustavo Maia [gustavobbm...@gmail.com](mailto:gustavobbm...@gmail.com) wrote:
> 
> > Check it.
> 
> > [WildcardQuery - dont use boost · Issue #1184 · elastic/elasticsearch · GitHub](https://github.com/elasticsearch/elasticsearch/issues/1184)
> 
> > You need to set rewrite to scoring\_boolean
> 
> > 2011/10/13 BlueZero [bluez...@bluezero.sk](mailto:bluez...@bluezero.sk):
> 
> > > I need to search nicknames with wildcard and sort them by  
> > > relevance(score).  
> > > But, when i do a query with wildcard, then thescoreis always 1.0
> 
> > > curl -XGET http://$HOST:$PORT/pokec/pouzivatelia/\_search -d '{  
> > > "from" : 0,  
> > > "size": 10,  
> > > "query" : {  
> > > "query\_string" : { "default\_field":"Nick",  
> > > "query":"_blue_" }  
> > > }  
> > > }  
> > > '
> 
> > > result:  
> > > "\_score":1.0
> 
> > > curl -XGET http://$HOST:$PORT/pokec/pouzivatelia/\_search -d '{  
> > > "from" : 0,  
> > > "size": 10,  
> > > "query" : {  
> > > "query\_string" : { "default\_field":"Nick",  
> > > "query":"blue" }  
> > > }  
> > > }  
> > > '
> 
> > > result:  
> > > "\_score":13.376108
> 
> > > Is there a way to getscorealso with wildcard?
> 
> > --  
> > Gustavo Maia

---

<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:51am UTC](https://discuss.elastic.co/t/query-string-with-wildcard-does-not-calculate-score/5588/5 "2017-07-06T03:51:05Z")

</div>


