# Wierd scoring

**URL:** https://discuss.elastic.co/t/wierd-scoring/13673
**Category:** Elasticsearch
**Created:** [September 18, 2013, 2:55pm UTC](https://discuss.elastic.co/t/wierd-scoring/13673 "2013-09-18T14:55:20Z")
**Posts on this page:** 11
**Page:** 1

<div class="post-metadata">

### Author: ![kristofer](https://avatars.discourse-cdn.com/v4/letter/k/45deac/32.png) [@kristofer](https://discuss.elastic.co/u/kristofer)
#### Post date: [September 18, 2013, 2:55pm UTC](https://discuss.elastic.co/t/wierd-scoring/13673/1 "2013-09-18T14:55:20Z")

</div>

Hello

I'm currently building a search using elasticsearch and I'm getting some  
wierd results  
"query" : { "match\_phrase\_prefix" : { "name" : "agnes" } } \<-- this query  
gives "Carin Agneta Axeltorp" a higher score then "St. Agnes"  
how can this be as the second one is a more exact match

Kristofer

--  
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: [September 18, 2013, 4:12pm UTC](https://discuss.elastic.co/t/wierd-scoring/13673/2 "2013-09-18T16:12:22Z")

</div>

There are many factors involved with scoring. Can you post the explain  
output of that query?

Without looking at the explain, my guess was that the IDF contributed to  
the higher scoring of the first document. How many shards and documents do  
you have? With a low document count and more than one shard, the IDF can  
result in inconsistencies (which tend to get corrected as the document  
count gets higher).

Cheers,

Ivan

On Wed, Sep 18, 2013 at 7:55 AM, [kristofer@otilia.se](mailto:kristofer@otilia.se) wrote:

> Hello
> 
> I'm currently building a search using elasticsearch and I'm getting some  
> wierd results  
> "query" : { "match\_phrase\_prefix" : { "name" : "agnes" } } \<-- this query  
> gives "Carin Agneta Axeltorp" a higher score then "St. Agnes"  
> how can this be as the second one is a more exact match
> 
> Kristofer
> 
> --  
> 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: ![kristofer](https://avatars.discourse-cdn.com/v4/letter/k/45deac/32.png) [@kristofer](https://discuss.elastic.co/u/kristofer)
#### Post date: [September 19, 2013, 6:45am UTC](https://discuss.elastic.co/t/wierd-scoring/13673/3 "2013-09-19T06:45:18Z")

</div>

in that type-call there are ~4600 documents but there's the same problem in  
another type and that one has over 400 000 documents.

As I'm really new to this I don' know how to check how many shards I have,  
how to set them and how many I should have so that might be the issue

On Wed, Sep 18, 2013 at 6:12 PM, Ivan Brusic [ivan@brusic.com](mailto:ivan@brusic.com) wrote:

> There are many factors involved with scoring. Can you post the explain  
> output of that query?
> 
> Without looking at the explain, my guess was that the IDF contributed to  
> the higher scoring of the first document. How many shards and documents do  
> you have? With a low document count and more than one shard, the IDF can  
> result in inconsistencies (which tend to get corrected as the document  
> count gets higher).
> 
> Cheers,
> 
> Ivan
> 
> On Wed, Sep 18, 2013 at 7:55 AM, [kristofer@otilia.se](mailto:kristofer@otilia.se) wrote:
> 
> > Hello
> > 
> > I'm currently building a search using elasticsearch and I'm getting some  
> > wierd results  
> > "query" : { "match\_phrase\_prefix" : { "name" : "agnes" } } \<-- this query  
> > gives "Carin Agneta Axeltorp" a higher score then "St. Agnes"  
> > how can this be as the second one is a more exact match
> > 
> > Kristofer
> > 
> > --  
> > 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 a topic in the  
> Google Groups "elasticsearch" group.  
> To unsubscribe from this topic, visit  
> [https://groups.google.com/d/topic/elasticsearch/at\_AzCukPJ4/unsubscribe](https://groups.google.com/d/topic/elasticsearch/at_AzCukPJ4/unsubscribe).  
> To unsubscribe from this group and all its topics, 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: ![sina\_tamanna](https://avatars.discourse-cdn.com/v4/letter/s/a6a055/32.png) [@sina\_tamanna](https://discuss.elastic.co/u/sina_tamanna)
#### Post date: [September 19, 2013, 7:12am UTC](https://discuss.elastic.co/t/wierd-scoring/13673/4 "2013-09-19T07:12:49Z")

</div>

As Ivan mentioned, it would be easier to help if you have the result of  
scoring explained. You could achieve this by appending "explain" : true to  
the query:

"query" : { "match\_phrase\_prefix" : { "name" : "agnes" } }, "explain" : true

As for the number of shards and documents take a look at:  
[http://www.elasticsearch.org/guide/reference/api/admin-indices-get-settings/](http://www.elasticsearch.org/guide/reference/api/admin-indices-get-settings/)  
[http://www.elasticsearch.org/guide/reference/api/admin-cluster-nodes-stats/](http://www.elasticsearch.org/guide/reference/api/admin-cluster-nodes-stats/)

--  
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: ![kristofer](https://avatars.discourse-cdn.com/v4/letter/k/45deac/32.png) [@kristofer](https://discuss.elastic.co/u/kristofer)
#### Post date: [September 19, 2013, 8:01am UTC](https://discuss.elastic.co/t/wierd-scoring/13673/5 "2013-09-19T08:01:30Z")

</div>

"query" : { "match\_phrase\_prefix" : { "company.name" : "agnes" } },  
"explain" : true

I'm guessing this is more info then needed for this senario but here goes  
the full response:

HTTP/1.1 200 OK  
Content-Type: application/json; charset=UTF-8  
Content-Length: 4406

{  
"took":2,  
"timed\_out":false,  
"\_shards":{  
"total":4,  
"successful":4,  
"failed":0  
},  
"hits":{  
"total":8,  
"max\_score":5.593096,  
"hits":[  
{  
"\_shard":3,  
"\_node":"Z7swhx3jR-6oZWQ47bYkIw",  
"\_index":"tandlakare",  
"\_type":"view\_data",  
"\_id":"352",  
"\_score":5.593096,  
"\_source":{  
"id":"352",  
"company":{  
"name":"Tandl\u00e4kare Agneta Hultin Tandl\u00e4karhuset"  
},

"url\_structure":"/stockholm/\u00e5kersberga/tandl\u00e4kare-agneta-hultin-tandl\u00e4karhuset",  
"street\_address":"Saturnusv\u00e4gen 2",  
"subscription\_id":"1",  
"img":"",  
"city":"\u00c5kersberga",  
"tstamp":"2013-02-21T13:51:26",  
"location":"59.477667565305000000,18.295774234384000000",  
"\_boost":"1.0"  
},  
"\_explanation":{  
"value":5.593096,  
"description":"weight(company.name:agnet in 88)  
[PerFieldSimilarity], result of:",  
"details":[  
{  
"value":5.593096,  
"description":"fieldWeight in 88, product of:",  
"details":[  
{  
"value":1.0,  
"description":"tf(freq=1.0), with freq of:",  
"details":[  
{  
"value":1.0,  
"description":"termFreq=1.0"  
}  
]  
},  
{  
"value":11.186192,  
"description":"idf(docFreq=3, maxDocs=106137)"  
},  
{  
"value":0.5,  
"description":"fieldNorm(doc=88)"  
}  
]  
}  
]  
}  
},  
{  
"\_shard":3,  
"\_node":"Z7swhx3jR-6oZWQ47bYkIw",  
"\_index":"tandlakare",  
"\_type":"view\_data",  
"\_id":"2291",  
"\_score":5.593096,  
"\_source":{  
"id":"2291",  
"company":{  
"name":"Carin Agneta Axeltorp"  
},  
"url\_structure":"/sk\u00e5ne/limhamn/carin-agneta-axeltorp",  
"street\_address":"Abbedissgatan 7",  
"subscription\_id":"1",  
"img":"",  
"city":"Limhamn",  
"tstamp":"2012-11-14T01:37:47",  
"location":"55.572641300000000797,12.951067099999999499",  
" \_boost":"1.0"  
},  
"\_explanation":{  
"value":5.593096,  
"description":"weight(company.name:agnet in 571)  
[PerFieldSimilarity], result of:",  
"details":[  
{  
"value":5.593096,  
"description":"fieldWeight in 571, product of:",  
"details":[  
{  
"value":1.0,  
"description":"tf(freq=1.0), with freq of:",  
"details":[  
{  
"value":1.0,  
"description":"termFreq=1.0"  
}  
]  
},  
{  
"value":11.186192,  
"description":"idf(docFreq=3, maxDocs=106137)"  
},  
{  
"value":0.5,  
"description":"fieldNorm(doc=571)"  
}  
]  
}  
]  
}  
},  
{  
"\_shard":2,  
"\_node":"Z7swhx3jR-6oZWQ47bYkIw",  
"\_index":"tandlakare",  
"\_type":"view\_data",  
"\_id":"881",  
"\_score":5.5646315,  
"\_source":{  
"id":"881",  
"company":{  
"name":"St. Agnes"  
},  
"url\_structure":"/v\u00e4stra  
g\u00f6taland/alings\u00e5s/st.-agnes",  
"street\_address":"V\u00e4stra Ringgatan 1 A",  
"subscription\_id":"1",  
"img":"",  
"city":"Alings\u00e5s",  
"tstamp":"2012-11-14T01:37:26",  
"location":"57.931587100000001556,12.529198600000000852",  
"\_boost":"1.0"  
},  
"\_explanation":{  
"value":5.5646315,  
"description":"sum of:",  
"details":[  
{  
"value":5.5646315,  
"description":"weight(company.name:agn in 218)  
[PerFieldSimilarity], result of:",  
"details":[  
{  
"value":5.5646315,  
"description":"score(doc=218,freq=1.0 =  
termFreq=1.0\n), product of:",  
"details":[  
{  
"value":0.74948466,  
"description":"queryWeight, product of:",  
"details":[  
{  
"value":11.879376,  
"description":"idf(docFreq=1,  
maxDocs=106141)"  
},  
{  
"value":0.06309125,  
"description":"queryNorm"  
}  
]  
},  
{  
"value":7.42461,  
"description":"fieldWeight in 218, product  
of:",  
"details":[  
{  
"value":1.0,  
"description":"tf(freq=1.0), with  
freq of:",  
"details":[  
{  
"value":1.0,  
"description":"termFreq=1.0"  
}  
]  
},  
{  
"value":11.879376,  
"description":"idf(docFreq=1,  
maxDocs=106141)"  
},  
{  
"value":0.625,  
"description":"fieldNorm(doc=218)"  
}  
]  
}  
]  
}  
]  
}  
]  
}  
},  
{  
"\_shard":0,  
"\_node":"Z7swhx3jR-6oZWQ47bYkIw",  
"\_index":"tandlakare",  
"\_type":"view\_data",  
"\_id":"2432",  
"\_score":3.9855573,  
"\_source":{  
"id":"2432",  
"company":{  
"name":"Tandl\u00e4kare Agneta Knutsson"  
},

"url\_structure":"/sk\u00e5ne/limhamn/tandl\u00e4kare-agneta-knutsson",  
"street\_address":"Geijersgatan 8",  
"subscription\_id":"1",  
"img":"",  
"city":"Limhamn",  
"tstamp":"2012-11-14T01:37:49",  
"location":"55.590610499999996819,12.941211600000000814",  
"\_boost":"1.0"  
},  
"\_explanation":{  
"value":3.9855573,  
"description":"sum of:",  
"details":[  
{  
"value":3.9855573,  
"description":"weight(company.name:agnet in 609)  
[PerFieldSimilarity], result of:",  
"details":[  
{  
"value":3.9855573,  
"description":"score(doc=609,freq=1.0 =  
termFreq=1.0\n), product of:",  
"details":[  
{  
"value":0.694725,  
"description":"queryWeight, product of:",  
"details":[  
{  
"value":11.47377,  
"description":"idf(docFreq=2,  
maxDocs=106126)"  
},  
{  
"value":0.060548972,  
"description":"queryNorm"  
}  
]  
},  
{  
"value":5.736885,  
"description":"fieldWeight in 609, product  
of:",  
"details":[  
{  
"value":1.0,  
"description":"tf(freq=1.0), with  
freq of:",  
"details":[  
{  
"value":1.0,  
"description":"termFreq=1.0"  
}  
]  
},  
{  
"value":11.47377,  
"description":"idf(docFreq=2,  
maxDocs=106126)"  
},  
{  
"value":0.5,  
"description":"fieldNorm(doc=609)"  
}  
]  
}  
]  
}  
]  
}  
]  
}  
}  
]  
}  
}

On Thu, Sep 19, 2013 at 9:12 AM, [sina.tamanna@gmail.com](mailto:sina.tamanna@gmail.com) wrote:

> As Ivan mentioned, it would be easier to help if you have the result of  
> scoring explained. You could achieve this by appending "explain" : true to  
> the query:
> 
> "query" : { "match\_phrase\_prefix" : { "name" : "agnes" } }, "explain" :  
> true
> 
> As for the number of shards and documents take a look at:
> 
> [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/api/admin-indices-get-settings/)  
> [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/api/admin-cluster-nodes-stats/)
> 
> --  
> You received this message because you are subscribed to a topic in the  
> Google Groups "elasticsearch" group.  
> To unsubscribe from this topic, visit  
> [https://groups.google.com/d/topic/elasticsearch/at\_AzCukPJ4/unsubscribe](https://groups.google.com/d/topic/elasticsearch/at_AzCukPJ4/unsubscribe).  
> To unsubscribe from this group and all its topics, 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: ![kristofer](https://avatars.discourse-cdn.com/v4/letter/k/45deac/32.png) [@kristofer](https://discuss.elastic.co/u/kristofer)
#### Post date: [September 19, 2013, 8:02am UTC](https://discuss.elastic.co/t/wierd-scoring/13673/6 "2013-09-19T08:02:34Z")

</div>

and I think I have 4 shards

On Thu, Sep 19, 2013 at 10:01 AM, Kristofer Hamnell [kristofer@otilia.se](mailto:kristofer@otilia.se)wrote:

> "query" : { "match\_phrase\_prefix" : { "company.name" : "agnes" } },  
> "explain" : true
> 
> I'm guessing this is more info then needed for this senario but here goes  
> the full response:
> 
> HTTP/1.1 200 OK  
> Content-Type: application/json; charset=UTF-8  
> Content-Length: 4406
> 
> {  
> "took":2,  
> "timed\_out":false,  
> "\_shards":{  
> "total":4,  
> "successful":4,  
> "failed":0  
> },  
> "hits":{  
> "total":8,  
> "max\_score":5.593096,  
> "hits":[  
> {  
> "\_shard":3,  
> "\_node":"Z7swhx3jR-6oZWQ47bYkIw",  
> "\_index":"tandlakare",  
> "\_type":"view\_data",  
> "\_id":"352",  
> "\_score":5.593096,  
> "\_source":{  
> "id":"352",  
> "company":{  
> "name":"Tandl\u00e4kare Agneta Hultin  
> Tandl\u00e4karhuset"  
> },
> 
> "url\_structure":"/stockholm/\u00e5kersberga/tandl\u00e4kare-agneta-hultin-tandl\u00e4karhuset",  
> "street\_address":"Saturnusv\u00e4gen 2",  
> "subscription\_id":"1",  
> "img":"",  
> "city":"\u00c5kersberga",  
> "tstamp":"2013-02-21T13:51:26",  
> "location":"59.477667565305000000,18.295774234384000000",  
> "\_boost":"1.0"  
> },  
> "\_explanation":{  
> "value":5.593096,  
> "description":"weight(company.name:agnet in 88)  
> [PerFieldSimilarity], result of:",  
> "details":[  
> {  
> "value":5.593096,  
> "description":"fieldWeight in 88, product of:",  
> "details":[  
> {  
> "value":1.0,  
> "description":"tf(freq=1.0), with freq of:",  
> "details":[  
> {  
> "value":1.0,  
> "description":"termFreq=1.0"  
> }  
> ]  
> },  
> {  
> "value":11.186192,  
> "description":"idf(docFreq=3, maxDocs=106137)"  
> },  
> {  
> "value":0.5,  
> "description":"fieldNorm(doc=88)"  
> }  
> ]  
> }  
> ]  
> }  
> },  
> {  
> "\_shard":3,  
> "\_node":"Z7swhx3jR-6oZWQ47bYkIw",  
> "\_index":"tandlakare",  
> "\_type":"view\_data",  
> "\_id":"2291",  
> "\_score":5.593096,  
> "\_source":{  
> "id":"2291",  
> "company":{  
> "name":"Carin Agneta Axeltorp"  
> },  
> "url\_structure":"/sk\u00e5ne/limhamn/carin-agneta-axeltorp",  
> "street\_address":"Abbedissgatan 7",  
> "subscription\_id":"1",  
> "img":"",  
> "city":"Limhamn",  
> "tstamp":"2012-11-14T01:37:47",  
> "location":"55.572641300000000797,12.951067099999999499",  
> " \_boost":"1.0"  
> },  
> "\_explanation":{  
> "value":5.593096,  
> "description":"weight(company.name:agnet in 571)  
> [PerFieldSimilarity], result of:",  
> "details":[  
> {  
> "value":5.593096,  
> "description":"fieldWeight in 571, product of:",  
> "details":[  
> {  
> "value":1.0,  
> "description":"tf(freq=1.0), with freq of:",  
> "details":[  
> {  
> "value":1.0,  
> "description":"termFreq=1.0"  
> }  
> ]  
> },  
> {  
> "value":11.186192,  
> "description":"idf(docFreq=3, maxDocs=106137)"  
> },  
> {  
> "value":0.5,  
> "description":"fieldNorm(doc=571)"  
> }  
> ]  
> }  
> ]  
> }  
> },  
> {  
> "\_shard":2,  
> "\_node":"Z7swhx3jR-6oZWQ47bYkIw",  
> "\_index":"tandlakare",  
> "\_type":"view\_data",  
> "\_id":"881",  
> "\_score":5.5646315,  
> "\_source":{  
> "id":"881",  
> "company":{  
> "name":"St. Agnes"  
> },  
> "url\_structure":"/v\u00e4stra  
> g\u00f6taland/alings\u00e5s/st.-agnes",  
> "street\_address":"V\u00e4stra Ringgatan 1 A",  
> "subscription\_id":"1",  
> "img":"",  
> "city":"Alings\u00e5s",  
> "tstamp":"2012-11-14T01:37:26",  
> "location":"57.931587100000001556,12.529198600000000852",  
> "\_boost":"1.0"  
> },  
> "\_explanation":{  
> "value":5.5646315,  
> "description":"sum of:",  
> "details":[  
> {  
> "value":5.5646315,  
> "description":"weight(company.name:agn in 218)  
> [PerFieldSimilarity], result of:",  
> "details":[  
> {  
> "value":5.5646315,  
> "description":"score(doc=218,freq=1.0 =  
> termFreq=1.0\n), product of:",  
> "details":[  
> {  
> "value":0.74948466,  
> "description":"queryWeight, product of:",  
> "details":[  
> {  
> "value":11.879376,  
> "description":"idf(docFreq=1,  
> maxDocs=106141)"  
> },  
> {  
> "value":0.06309125,  
> "description":"queryNorm"  
> }  
> ]  
> },  
> {  
> "value":7.42461,  
> "description":"fieldWeight in 218,  
> product of:",  
> "details":[  
> {  
> "value":1.0,  
> "description":"tf(freq=1.0), with  
> freq of:",  
> "details":[  
> {  
> "value":1.0,  
> "description":"termFreq=1.0"  
> }  
> ]  
> },  
> {  
> "value":11.879376,  
> "description":"idf(docFreq=1,  
> maxDocs=106141)"  
> },  
> {  
> "value":0.625,  
> "description":"fieldNorm(doc=218)"  
> }  
> ]  
> }  
> ]  
> }  
> ]  
> }  
> ]  
> }  
> },  
> {  
> "\_shard":0,  
> "\_node":"Z7swhx3jR-6oZWQ47bYkIw",  
> "\_index":"tandlakare",  
> "\_type":"view\_data",  
> "\_id":"2432",  
> "\_score":3.9855573,  
> "\_source":{  
> "id":"2432",  
> "company":{  
> "name":"Tandl\u00e4kare Agneta Knutsson"  
> },
> 
> "url\_structure":"/sk\u00e5ne/limhamn/tandl\u00e4kare-agneta-knutsson",  
> "street\_address":"Geijersgatan 8",  
> "subscription\_id":"1",  
> "img":"",  
> "city":"Limhamn",  
> "tstamp":"2012-11-14T01:37:49",  
> "location":"55.590610499999996819,12.941211600000000814",  
> "\_boost":"1.0"  
> },  
> "\_explanation":{  
> "value":3.9855573,  
> "description":"sum of:",  
> "details":[  
> {  
> "value":3.9855573,  
> "description":"weight(company.name:agnet in 609)  
> [PerFieldSimilarity], result of:",  
> "details":[  
> {  
> "value":3.9855573,  
> "description":"score(doc=609,freq=1.0 =  
> termFreq=1.0\n), product of:",  
> "details":[  
> {  
> "value":0.694725,  
> "description":"queryWeight, product of:",  
> "details":[  
> {  
> "value":11.47377,  
> "description":"idf(docFreq=2,  
> maxDocs=106126)"  
> },  
> {  
> "value":0.060548972,  
> "description":"queryNorm"  
> }  
> ]  
> },  
> {  
> "value":5.736885,  
> "description":"fieldWeight in 609,  
> product of:",  
> "details":[  
> {  
> "value":1.0,  
> "description":"tf(freq=1.0), with  
> freq of:",  
> "details":[  
> {  
> "value":1.0,  
> "description":"termFreq=1.0"  
> }  
> ]  
> },  
> {  
> "value":11.47377,  
> "description":"idf(docFreq=2,  
> maxDocs=106126)"  
> },  
> {  
> "value":0.5,  
> "description":"fieldNorm(doc=609)"  
> }  
> ]  
> }  
> ]  
> }  
> ]  
> }  
> ]  
> }  
> }  
> ]  
> }  
> }
> 
> On Thu, Sep 19, 2013 at 9:12 AM, [sina.tamanna@gmail.com](mailto:sina.tamanna@gmail.com) wrote:
> 
> > As Ivan mentioned, it would be easier to help if you have the result of  
> > scoring explained. You could achieve this by appending "explain" : true to  
> > the query:
> > 
> > "query" : { "match\_phrase\_prefix" : { "name" : "agnes" } }, "explain" :  
> > true
> > 
> > As for the number of shards and documents take a look at:
> > 
> > [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/api/admin-indices-get-settings/)
> > 
> > [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/api/admin-cluster-nodes-stats/)
> > 
> > --  
> > You received this message because you are subscribed to a topic in the  
> > Google Groups "elasticsearch" group.  
> > To unsubscribe from this topic, visit  
> > [https://groups.google.com/d/topic/elasticsearch/at\_AzCukPJ4/unsubscribe](https://groups.google.com/d/topic/elasticsearch/at_AzCukPJ4/unsubscribe).  
> > To unsubscribe from this group and all its topics, 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: ![Ivan](https://avatars.discourse-cdn.com/v4/letter/i/df788c/32.png) [@Ivan](https://discuss.elastic.co/u/Ivan)
#### Post date: [September 19, 2013, 5:15pm UTC](https://discuss.elastic.co/t/wierd-scoring/13673/7 "2013-09-19T17:15:12Z")

</div>

You do have four shards and in your case they are working in your favor  
since the document you wish to have a higher score actually has a higher  
IDF.

I have not used prefix queries in a long time, so I don't have any answers  
regarding the scoring. The scores are really close! For some reason,  
the St. Agnes document has its higher TD-IDF value reduced by the  
queryNorm, while the other documents do not factor in the queryNorm. I'm  
guess the prefix query expansion has something to do with it. Not sure why  
the first two document even match since their name does not match the  
prefix. The playing around with the fuzziness and expansion settings.

Cheers,

Ivan

On Thu, Sep 19, 2013 at 1:02 AM, Kristofer Hamnell [kristofer@otilia.se](mailto:kristofer@otilia.se)wrote:

> and I think I have 4 shards
> 
> On Thu, Sep 19, 2013 at 10:01 AM, Kristofer Hamnell [kristofer@otilia.se](mailto:kristofer@otilia.se)wrote:
> 
> > "query" : { "match\_phrase\_prefix" : { "company.name" : "agnes" } },  
> > "explain" : true
> > 
> > I'm guessing this is more info then needed for this senario but here goes  
> > the full response:
> > 
> > HTTP/1.1 200 OK  
> > Content-Type: application/json; charset=UTF-8  
> > Content-Length: 4406
> > 
> > {  
> > "took":2,  
> > "timed\_out":false,  
> > "\_shards":{  
> > "total":4,  
> > "successful":4,  
> > "failed":0  
> > },  
> > "hits":{  
> > "total":8,  
> > "max\_score":5.593096,  
> > "hits":[  
> > {  
> > "\_shard":3,  
> > "\_node":"Z7swhx3jR-6oZWQ47bYkIw",  
> > "\_index":"tandlakare",  
> > "\_type":"view\_data",  
> > "\_id":"352",  
> > "\_score":5.593096,  
> > "\_source":{  
> > "id":"352",  
> > "company":{  
> > "name":"Tandl\u00e4kare Agneta Hultin  
> > Tandl\u00e4karhuset"  
> > },
> > 
> > "url\_structure":"/stockholm/\u00e5kersberga/tandl\u00e4kare-agneta-hultin-tandl\u00e4karhuset",  
> > "street\_address":"Saturnusv\u00e4gen 2",  
> > "subscription\_id":"1",  
> > "img":"",  
> > "city":"\u00c5kersberga",  
> > "tstamp":"2013-02-21T13:51:26",  
> > "location":"59.477667565305000000,18.295774234384000000",  
> > "\_boost":"1.0"  
> > },  
> > "\_explanation":{  
> > "value":5.593096,  
> > "description":"weight(company.name:agnet in 88)  
> > [PerFieldSimilarity], result of:",  
> > "details":[  
> > {  
> > "value":5.593096,  
> > "description":"fieldWeight in 88, product of:",  
> > "details":[  
> > {  
> > "value":1.0,  
> > "description":"tf(freq=1.0), with freq of:",  
> > "details":[  
> > {  
> > "value":1.0,  
> > "description":"termFreq=1.0"  
> > }  
> > ]  
> > },  
> > {  
> > "value":11.186192,  
> > "description":"idf(docFreq=3, maxDocs=106137)"  
> > },  
> > {  
> > "value":0.5,  
> > "description":"fieldNorm(doc=88)"  
> > }  
> > ]  
> > }  
> > ]  
> > }  
> > },  
> > {  
> > "\_shard":3,  
> > "\_node":"Z7swhx3jR-6oZWQ47bYkIw",  
> > "\_index":"tandlakare",  
> > "\_type":"view\_data",  
> > "\_id":"2291",  
> > "\_score":5.593096,  
> > "\_source":{  
> > "id":"2291",  
> > "company":{  
> > "name":"Carin Agneta Axeltorp"  
> > },
> > 
> > "url\_structure":"/sk\u00e5ne/limhamn/carin-agneta-axeltorp",  
> > "street\_address":"Abbedissgatan 7",  
> > "subscription\_id":"1",  
> > "img":"",  
> > "city":"Limhamn",  
> > "tstamp":"2012-11-14T01:37:47",  
> > "location":"55.572641300000000797,12.951067099999999499",  
> > " \_boost":"1.0"  
> > },  
> > "\_explanation":{  
> > "value":5.593096,  
> > "description":"weight(company.name:agnet in 571)  
> > [PerFieldSimilarity], result of:",  
> > "details":[  
> > {  
> > "value":5.593096,  
> > "description":"fieldWeight in 571, product of:",  
> > "details":[  
> > {  
> > "value":1.0,  
> > "description":"tf(freq=1.0), with freq of:",  
> > "details":[  
> > {  
> > "value":1.0,  
> > "description":"termFreq=1.0"  
> > }  
> > ]  
> > },  
> > {  
> > "value":11.186192,  
> > "description":"idf(docFreq=3, maxDocs=106137)"  
> > },  
> > {  
> > "value":0.5,  
> > "description":"fieldNorm(doc=571)"  
> > }  
> > ]  
> > }  
> > ]  
> > }  
> > },  
> > {  
> > "\_shard":2,  
> > "\_node":"Z7swhx3jR-6oZWQ47bYkIw",  
> > "\_index":"tandlakare",  
> > "\_type":"view\_data",  
> > "\_id":"881",  
> > "\_score":5.5646315,  
> > "\_source":{  
> > "id":"881",  
> > "company":{  
> > "name":"St. Agnes"  
> > },  
> > "url\_structure":"/v\u00e4stra  
> > g\u00f6taland/alings\u00e5s/st.-agnes",  
> > "street\_address":"V\u00e4stra Ringgatan 1 A",  
> > "subscription\_id":"1",  
> > "img":"",  
> > "city":"Alings\u00e5s",  
> > "tstamp":"2012-11-14T01:37:26",  
> > "location":"57.931587100000001556,12.529198600000000852",  
> > "\_boost":"1.0"  
> > },  
> > "\_explanation":{  
> > "value":5.5646315,  
> > "description":"sum of:",  
> > "details":[  
> > {  
> > "value":5.5646315,  
> > "description":"weight(company.name:agn in 218)  
> > [PerFieldSimilarity], result of:",  
> > "details":[  
> > {  
> > "value":5.5646315,  
> > "description":"score(doc=218,freq=1.0 =  
> > termFreq=1.0\n), product of:",  
> > "details":[  
> > {  
> > "value":0.74948466,  
> > "description":"queryWeight, product of:",  
> > "details":[  
> > {  
> > "value":11.879376,  
> > "description":"idf(docFreq=1,  
> > maxDocs=106141)"  
> > },  
> > {  
> > "value":0.06309125,  
> > "description":"queryNorm"  
> > }  
> > ]  
> > },  
> > {  
> > "value":7.42461,  
> > "description":"fieldWeight in 218,  
> > product of:",  
> > "details":[  
> > {  
> > "value":1.0,  
> > "description":"tf(freq=1.0), with  
> > freq of:",  
> > "details":[  
> > {  
> > "value":1.0,  
> > "description":"termFreq=1.0"  
> > }  
> > ]  
> > },  
> > {  
> > "value":11.879376,  
> > "description":"idf(docFreq=1,  
> > maxDocs=106141)"  
> > },  
> > {  
> > "value":0.625,  
> > "description":"fieldNorm(doc=218)"  
> > }  
> > ]  
> > }  
> > ]  
> > }  
> > ]  
> > }  
> > ]  
> > }  
> > },  
> > {  
> > "\_shard":0,  
> > "\_node":"Z7swhx3jR-6oZWQ47bYkIw",  
> > "\_index":"tandlakare",  
> > "\_type":"view\_data",  
> > "\_id":"2432",  
> > "\_score":3.9855573,  
> > "\_source":{  
> > "id":"2432",  
> > "company":{  
> > "name":"Tandl\u00e4kare Agneta Knutsson"  
> > },
> > 
> > "url\_structure":"/sk\u00e5ne/limhamn/tandl\u00e4kare-agneta-knutsson",  
> > "street\_address":"Geijersgatan 8",  
> > "subscription\_id":"1",  
> > "img":"",  
> > "city":"Limhamn",  
> > "tstamp":"2012-11-14T01:37:49",  
> > "location":"55.590610499999996819,12.941211600000000814",  
> > "\_boost":"1.0"  
> > },  
> > "\_explanation":{  
> > "value":3.9855573,  
> > "description":"sum of:",  
> > "details":[  
> > {  
> > "value":3.9855573,  
> > "description":"weight(company.name:agnet in 609)  
> > [PerFieldSimilarity], result of:",  
> > "details":[  
> > {  
> > "value":3.9855573,  
> > "description":"score(doc=609,freq=1.0 =  
> > termFreq=1.0\n), product of:",  
> > "details":[  
> > {  
> > "value":0.694725,  
> > "description":"queryWeight, product of:",  
> > "details":[  
> > {  
> > "value":11.47377,  
> > "description":"idf(docFreq=2,  
> > maxDocs=106126)"  
> > },  
> > {  
> > "value":0.060548972,  
> > "description":"queryNorm"  
> > }  
> > ]  
> > },  
> > {  
> > "value":5.736885,  
> > "description":"fieldWeight in 609,  
> > product of:",  
> > "details":[  
> > {  
> > "value":1.0,  
> > "description":"tf(freq=1.0), with  
> > freq of:",  
> > "details":[  
> > {  
> > "value":1.0,  
> > "description":"termFreq=1.0"  
> > }  
> > ]  
> > },  
> > {  
> > "value":11.47377,  
> > "description":"idf(docFreq=2,  
> > maxDocs=106126)"  
> > },  
> > {  
> > "value":0.5,  
> > "description":"fieldNorm(doc=609)"  
> > }  
> > ]  
> > }  
> > ]  
> > }  
> > ]  
> > }  
> > ]  
> > }  
> > }  
> > ]  
> > }  
> > }
> > 
> > On Thu, Sep 19, 2013 at 9:12 AM, [sina.tamanna@gmail.com](mailto:sina.tamanna@gmail.com) wrote:
> > 
> > > As Ivan mentioned, it would be easier to help if you have the result of  
> > > scoring explained. You could achieve this by appending "explain" : true to  
> > > the query:
> > > 
> > > "query" : { "match\_phrase\_prefix" : { "name" : "agnes" } }, "explain" :  
> > > true
> > > 
> > > As for the number of shards and documents take a look at:
> > > 
> > > [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/api/admin-indices-get-settings/)
> > > 
> > > [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/api/admin-cluster-nodes-stats/)
> > > 
> > > --  
> > > You received this message because you are subscribed to a topic in the  
> > > Google Groups "elasticsearch" group.  
> > > To unsubscribe from this topic, visit  
> > > [https://groups.google.com/d/topic/elasticsearch/at\_AzCukPJ4/unsubscribe](https://groups.google.com/d/topic/elasticsearch/at_AzCukPJ4/unsubscribe).  
> > > To unsubscribe from this group and all its topics, 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).

--  
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: ![kristofer](https://avatars.discourse-cdn.com/v4/letter/k/45deac/32.png) [@kristofer](https://discuss.elastic.co/u/kristofer)
#### Post date: [September 20, 2013, 6:29am UTC](https://discuss.elastic.co/t/wierd-scoring/13673/8 "2013-09-20T06:29:42Z")

</div>

is there a better way to search then with prefix for what I'm trying to do  
then?

On Thu, Sep 19, 2013 at 7:15 PM, Ivan Brusic [ivan@brusic.com](mailto:ivan@brusic.com) wrote:

> You do have four shards and in your case they are working in your favor  
> since the document you wish to have a higher score actually has a higher  
> IDF.
> 
> I have not used prefix queries in a long time, so I don't have any answers  
> regarding the scoring. The scores are really close! For some reason,  
> the St. Agnes document has its higher TD-IDF value reduced by the  
> queryNorm, while the other documents do not factor in the queryNorm. I'm  
> guess the prefix query expansion has something to do with it. Not sure why  
> the first two document even match since their name does not match the  
> prefix. The playing around with the fuzziness and expansion settings.
> 
> Cheers,
> 
> Ivan
> 
> On Thu, Sep 19, 2013 at 1:02 AM, Kristofer Hamnell [kristofer@otilia.se](mailto:kristofer@otilia.se)wrote:
> 
> > and I think I have 4 shards
> > 
> > On Thu, Sep 19, 2013 at 10:01 AM, Kristofer Hamnell [kristofer@otilia.se](mailto:kristofer@otilia.se)wrote:
> > 
> > > "query" : { "match\_phrase\_prefix" : { "company.name" : "agnes" } },  
> > > "explain" : true
> > > 
> > > I'm guessing this is more info then needed for this senario but here  
> > > goes the full response:
> > > 
> > > HTTP/1.1 200 OK  
> > > Content-Type: application/json; charset=UTF-8  
> > > Content-Length: 4406
> > > 
> > > {  
> > > "took":2,  
> > > "timed\_out":false,  
> > > "\_shards":{  
> > > "total":4,  
> > > "successful":4,  
> > > "failed":0  
> > > },  
> > > "hits":{  
> > > "total":8,  
> > > "max\_score":5.593096,  
> > > "hits":[  
> > > {  
> > > "\_shard":3,  
> > > "\_node":"Z7swhx3jR-6oZWQ47bYkIw",  
> > > "\_index":"tandlakare",  
> > > "\_type":"view\_data",  
> > > "\_id":"352",  
> > > "\_score":5.593096,  
> > > "\_source":{  
> > > "id":"352",  
> > > "company":{  
> > > "name":"Tandl\u00e4kare Agneta Hultin  
> > > Tandl\u00e4karhuset"  
> > > },
> > > 
> > > "url\_structure":"/stockholm/\u00e5kersberga/tandl\u00e4kare-agneta-hultin-tandl\u00e4karhuset",  
> > > "street\_address":"Saturnusv\u00e4gen 2",  
> > > "subscription\_id":"1",  
> > > "img":"",  
> > > "city":"\u00c5kersberga",  
> > > "tstamp":"2013-02-21T13:51:26",  
> > > "location":"59.477667565305000000,18.295774234384000000",  
> > > "\_boost":"1.0"  
> > > },  
> > > "\_explanation":{  
> > > "value":5.593096,  
> > > "description":"weight(company.name:agnet in 88)  
> > > [PerFieldSimilarity], result of:",  
> > > "details":[  
> > > {  
> > > "value":5.593096,  
> > > "description":"fieldWeight in 88, product of:",  
> > > "details":[  
> > > {  
> > > "value":1.0,  
> > > "description":"tf(freq=1.0), with freq of:",  
> > > "details":[  
> > > {  
> > > "value":1.0,  
> > > "description":"termFreq=1.0"  
> > > }  
> > > ]  
> > > },  
> > > {  
> > > "value":11.186192,  
> > > "description":"idf(docFreq=3, maxDocs=106137)"  
> > > },  
> > > {  
> > > "value":0.5,  
> > > "description":"fieldNorm(doc=88)"  
> > > }  
> > > ]  
> > > }  
> > > ]  
> > > }  
> > > },  
> > > {  
> > > "\_shard":3,  
> > > "\_node":"Z7swhx3jR-6oZWQ47bYkIw",  
> > > "\_index":"tandlakare",  
> > > "\_type":"view\_data",  
> > > "\_id":"2291",  
> > > "\_score":5.593096,  
> > > "\_source":{  
> > > "id":"2291",  
> > > "company":{  
> > > "name":"Carin Agneta Axeltorp"  
> > > },
> > > 
> > > "url\_structure":"/sk\u00e5ne/limhamn/carin-agneta-axeltorp",  
> > > "street\_address":"Abbedissgatan 7",  
> > > "subscription\_id":"1",  
> > > "img":"",  
> > > "city":"Limhamn",  
> > > "tstamp":"2012-11-14T01:37:47",  
> > > "location":"55.572641300000000797,12.951067099999999499",  
> > > " \_boost":"1.0"  
> > > },  
> > > "\_explanation":{  
> > > "value":5.593096,  
> > > "description":"weight(company.name:agnet in 571)  
> > > [PerFieldSimilarity], result of:",  
> > > "details":[  
> > > {  
> > > "value":5.593096,  
> > > "description":"fieldWeight in 571, product of:",  
> > > "details":[  
> > > {  
> > > "value":1.0,  
> > > "description":"tf(freq=1.0), with freq of:",  
> > > "details":[  
> > > {  
> > > "value":1.0,  
> > > "description":"termFreq=1.0"  
> > > }  
> > > ]  
> > > },  
> > > {  
> > > "value":11.186192,  
> > > "description":"idf(docFreq=3,  
> > > maxDocs=106137)"  
> > > },  
> > > {  
> > > "value":0.5,  
> > > "description":"fieldNorm(doc=571)"  
> > > }  
> > > ]  
> > > }  
> > > ]  
> > > }  
> > > },  
> > > {  
> > > "\_shard":2,  
> > > "\_node":"Z7swhx3jR-6oZWQ47bYkIw",  
> > > "\_index":"tandlakare",  
> > > "\_type":"view\_data",  
> > > "\_id":"881",  
> > > "\_score":5.5646315,  
> > > "\_source":{  
> > > "id":"881",  
> > > "company":{  
> > > "name":"St. Agnes"  
> > > },  
> > > "url\_structure":"/v\u00e4stra  
> > > g\u00f6taland/alings\u00e5s/st.-agnes",  
> > > "street\_address":"V\u00e4stra Ringgatan 1 A",  
> > > "subscription\_id":"1",  
> > > "img":"",  
> > > "city":"Alings\u00e5s",  
> > > "tstamp":"2012-11-14T01:37:26",  
> > > "location":"57.931587100000001556,12.529198600000000852",  
> > > "\_boost":"1.0"  
> > > },  
> > > "\_explanation":{  
> > > "value":5.5646315,  
> > > "description":"sum of:",  
> > > "details":[  
> > > {  
> > > "value":5.5646315,  
> > > "description":"weight(company.name:agn in 218)  
> > > [PerFieldSimilarity], result of:",  
> > > "details":[  
> > > {  
> > > "value":5.5646315,  
> > > "description":"score(doc=218,freq=1.0 =  
> > > termFreq=1.0\n), product of:",  
> > > "details":[  
> > > {  
> > > "value":0.74948466,  
> > > "description":"queryWeight, product  
> > > of:",  
> > > "details":[  
> > > {  
> > > "value":11.879376,  
> > > "description":"idf(docFreq=1,  
> > > maxDocs=106141)"  
> > > },  
> > > {  
> > > "value":0.06309125,  
> > > "description":"queryNorm"  
> > > }  
> > > ]  
> > > },  
> > > {  
> > > "value":7.42461,  
> > > "description":"fieldWeight in 218,  
> > > product of:",  
> > > "details":[  
> > > {  
> > > "value":1.0,  
> > > "description":"tf(freq=1.0), with  
> > > freq of:",  
> > > "details":[  
> > > {  
> > > "value":1.0,  
> > > "description":"termFreq=1.0"  
> > > }  
> > > ]  
> > > },  
> > > {  
> > > "value":11.879376,  
> > > "description":"idf(docFreq=1,  
> > > maxDocs=106141)"  
> > > },  
> > > {  
> > > "value":0.625,  
> > > "description":"fieldNorm(doc=218)"  
> > > }  
> > > ]  
> > > }  
> > > ]  
> > > }  
> > > ]  
> > > }  
> > > ]  
> > > }  
> > > },  
> > > {  
> > > "\_shard":0,  
> > > "\_node":"Z7swhx3jR-6oZWQ47bYkIw",  
> > > "\_index":"tandlakare",  
> > > "\_type":"view\_data",  
> > > "\_id":"2432",  
> > > "\_score":3.9855573,  
> > > "\_source":{  
> > > "id":"2432",  
> > > "company":{  
> > > "name":"Tandl\u00e4kare Agneta Knutsson"  
> > > },
> > > 
> > > "url\_structure":"/sk\u00e5ne/limhamn/tandl\u00e4kare-agneta-knutsson",  
> > > "street\_address":"Geijersgatan 8",  
> > > "subscription\_id":"1",  
> > > "img":"",  
> > > "city":"Limhamn",  
> > > "tstamp":"2012-11-14T01:37:49",  
> > > "location":"55.590610499999996819,12.941211600000000814",  
> > > "\_boost":"1.0"  
> > > },  
> > > "\_explanation":{  
> > > "value":3.9855573,  
> > > "description":"sum of:",  
> > > "details":[  
> > > {  
> > > "value":3.9855573,  
> > > "description":"weight(company.name:agnet in 609)  
> > > [PerFieldSimilarity], result of:",  
> > > "details":[  
> > > {  
> > > "value":3.9855573,  
> > > "description":"score(doc=609,freq=1.0 =  
> > > termFreq=1.0\n), product of:",  
> > > "details":[  
> > > {  
> > > "value":0.694725,  
> > > "description":"queryWeight, product  
> > > of:",  
> > > "details":[  
> > > {  
> > > "value":11.47377,  
> > > "description":"idf(docFreq=2,  
> > > maxDocs=106126)"  
> > > },  
> > > {  
> > > "value":0.060548972,  
> > > "description":"queryNorm"  
> > > }  
> > > ]  
> > > },  
> > > {  
> > > "value":5.736885,  
> > > "description":"fieldWeight in 609,  
> > > product of:",  
> > > "details":[  
> > > {  
> > > "value":1.0,  
> > > "description":"tf(freq=1.0), with  
> > > freq of:",  
> > > "details":[  
> > > {  
> > > "value":1.0,  
> > > "description":"termFreq=1.0"  
> > > }  
> > > ]  
> > > },  
> > > {  
> > > "value":11.47377,  
> > > "description":"idf(docFreq=2,  
> > > maxDocs=106126)"  
> > > },  
> > > {  
> > > "value":0.5,  
> > > "description":"fieldNorm(doc=609)"  
> > > }  
> > > ]  
> > > }  
> > > ]  
> > > }  
> > > ]  
> > > }  
> > > ]  
> > > }  
> > > }  
> > > ]  
> > > }  
> > > }
> > > 
> > > On Thu, Sep 19, 2013 at 9:12 AM, [sina.tamanna@gmail.com](mailto:sina.tamanna@gmail.com) wrote:
> > > 
> > > > As Ivan mentioned, it would be easier to help if you have the result of  
> > > > scoring explained. You could achieve this by appending "explain" : true to  
> > > > the query:
> > > > 
> > > > "query" : { "match\_phrase\_prefix" : { "name" : "agnes" } }, "explain"  
> > > > : true
> > > > 
> > > > As for the number of shards and documents take a look at:
> > > > 
> > > > [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/api/admin-indices-get-settings/)
> > > > 
> > > > [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/api/admin-cluster-nodes-stats/)
> > > > 
> > > > --  
> > > > You received this message because you are subscribed to a topic in the  
> > > > Google Groups "elasticsearch" group.  
> > > > To unsubscribe from this topic, visit  
> > > > [https://groups.google.com/d/topic/elasticsearch/at\_AzCukPJ4/unsubscribe](https://groups.google.com/d/topic/elasticsearch/at_AzCukPJ4/unsubscribe)  
> > > > .  
> > > > To unsubscribe from this group and all its topics, 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).
> 
> --  
> You received this message because you are subscribed to a topic in the  
> Google Groups "elasticsearch" group.  
> To unsubscribe from this topic, visit  
> [https://groups.google.com/d/topic/elasticsearch/at\_AzCukPJ4/unsubscribe](https://groups.google.com/d/topic/elasticsearch/at_AzCukPJ4/unsubscribe).  
> To unsubscribe from this group and all its topics, 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: ![Ivan](https://avatars.discourse-cdn.com/v4/letter/i/df788c/32.png) [@Ivan](https://discuss.elastic.co/u/Ivan)
#### Post date: [September 20, 2013, 4:21pm UTC](https://discuss.elastic.co/t/wierd-scoring/13673/9 "2013-09-20T16:21:29Z")

</div>

Try using ngrams, which has a more predictable outcome than prefix query  
expansion, IMHO. However, perhaps someone can help you with the normal  
prefix query.

--  
Ivan

On Thu, Sep 19, 2013 at 11:29 PM, Kristofer Hamnell [kristofer@otilia.se](mailto:kristofer@otilia.se)wrote:

> is there a better way to search then with prefix for what I'm trying to do  
> then?
> 
> On Thu, Sep 19, 2013 at 7:15 PM, Ivan Brusic [ivan@brusic.com](mailto:ivan@brusic.com) wrote:
> 
> > You do have four shards and in your case they are working in your favor  
> > since the document you wish to have a higher score actually has a higher  
> > IDF.
> > 
> > I have not used prefix queries in a long time, so I don't have any  
> > answers regarding the scoring. The scores are really close! For some  
> > reason, the St. Agnes document has its higher TD-IDF value reduced by the  
> > queryNorm, while the other documents do not factor in the queryNorm. I'm  
> > guess the prefix query expansion has something to do with it. Not sure why  
> > the first two document even match since their name does not match the  
> > prefix. The playing around with the fuzziness and expansion settings.
> > 
> > Cheers,
> > 
> > Ivan
> > 
> > On Thu, Sep 19, 2013 at 1:02 AM, Kristofer Hamnell [kristofer@otilia.se](mailto:kristofer@otilia.se)wrote:
> > 
> > > and I think I have 4 shards
> > > 
> > > On Thu, Sep 19, 2013 at 10:01 AM, Kristofer Hamnell \<kristofer@otilia.se
> > > 
> > > > wrote:
> > > 
> > > > "query" : { "match\_phrase\_prefix" : { "company.name" : "agnes" } },  
> > > > "explain" : true
> > > > 
> > > > I'm guessing this is more info then needed for this senario but here  
> > > > goes the full response:
> > > > 
> > > > HTTP/1.1 200 OK  
> > > > Content-Type: application/json; charset=UTF-8  
> > > > Content-Length: 4406
> > > > 
> > > > {  
> > > > "took":2,  
> > > > "timed\_out":false,  
> > > > "\_shards":{  
> > > > "total":4,  
> > > > "successful":4,  
> > > > "failed":0  
> > > > },  
> > > > "hits":{  
> > > > "total":8,  
> > > > "max\_score":5.593096,  
> > > > "hits":[  
> > > > {  
> > > > "\_shard":3,  
> > > > "\_node":"Z7swhx3jR-6oZWQ47bYkIw",  
> > > > "\_index":"tandlakare",  
> > > > "\_type":"view\_data",  
> > > > "\_id":"352",  
> > > > "\_score":5.593096,  
> > > > "\_source":{  
> > > > "id":"352",  
> > > > "company":{  
> > > > "name":"Tandl\u00e4kare Agneta Hultin  
> > > > Tandl\u00e4karhuset"  
> > > > },
> > > > 
> > > > "url\_structure":"/stockholm/\u00e5kersberga/tandl\u00e4kare-agneta-hultin-tandl\u00e4karhuset",  
> > > > "street\_address":"Saturnusv\u00e4gen 2",  
> > > > "subscription\_id":"1",  
> > > > "img":"",  
> > > > "city":"\u00c5kersberga",  
> > > > "tstamp":"2013-02-21T13:51:26",  
> > > > "location":"59.477667565305000000,18.295774234384000000",  
> > > > "\_boost":"1.0"  
> > > > },  
> > > > "\_explanation":{  
> > > > "value":5.593096,  
> > > > "description":"weight(company.name:agnet in 88)  
> > > > [PerFieldSimilarity], result of:",  
> > > > "details":[  
> > > > {  
> > > > "value":5.593096,  
> > > > "description":"fieldWeight in 88, product of:",  
> > > > "details":[  
> > > > {  
> > > > "value":1.0,  
> > > > "description":"tf(freq=1.0), with freq of:",  
> > > > "details":[  
> > > > {  
> > > > "value":1.0,  
> > > > "description":"termFreq=1.0"  
> > > > }  
> > > > ]  
> > > > },  
> > > > {  
> > > > "value":11.186192,  
> > > > "description":"idf(docFreq=3,  
> > > > maxDocs=106137)"  
> > > > },  
> > > > {  
> > > > "value":0.5,  
> > > > "description":"fieldNorm(doc=88)"  
> > > > }  
> > > > ]  
> > > > }  
> > > > ]  
> > > > }  
> > > > },  
> > > > {  
> > > > "\_shard":3,  
> > > > "\_node":"Z7swhx3jR-6oZWQ47bYkIw",  
> > > > "\_index":"tandlakare",  
> > > > "\_type":"view\_data",  
> > > > "\_id":"2291",  
> > > > "\_score":5.593096,  
> > > > "\_source":{  
> > > > "id":"2291",  
> > > > "company":{  
> > > > "name":"Carin Agneta Axeltorp"  
> > > > },
> > > > 
> > > > "url\_structure":"/sk\u00e5ne/limhamn/carin-agneta-axeltorp",  
> > > > "street\_address":"Abbedissgatan 7",  
> > > > "subscription\_id":"1",  
> > > > "img":"",  
> > > > "city":"Limhamn",  
> > > > "tstamp":"2012-11-14T01:37:47",  
> > > > "location":"55.572641300000000797,12.951067099999999499",  
> > > > " \_boost":"1.0"  
> > > > },  
> > > > "\_explanation":{  
> > > > "value":5.593096,  
> > > > "description":"weight(company.name:agnet in 571)  
> > > > [PerFieldSimilarity], result of:",  
> > > > "details":[  
> > > > {  
> > > > "value":5.593096,  
> > > > "description":"fieldWeight in 571, product of:",  
> > > > "details":[  
> > > > {  
> > > > "value":1.0,  
> > > > "description":"tf(freq=1.0), with freq of:",  
> > > > "details":[  
> > > > {  
> > > > "value":1.0,  
> > > > "description":"termFreq=1.0"  
> > > > }  
> > > > ]  
> > > > },  
> > > > {  
> > > > "value":11.186192,  
> > > > "description":"idf(docFreq=3,  
> > > > maxDocs=106137)"  
> > > > },  
> > > > {  
> > > > "value":0.5,  
> > > > "description":"fieldNorm(doc=571)"  
> > > > }  
> > > > ]  
> > > > }  
> > > > ]  
> > > > }  
> > > > },  
> > > > {  
> > > > "\_shard":2,  
> > > > "\_node":"Z7swhx3jR-6oZWQ47bYkIw",  
> > > > "\_index":"tandlakare",  
> > > > "\_type":"view\_data",  
> > > > "\_id":"881",  
> > > > "\_score":5.5646315,  
> > > > "\_source":{  
> > > > "id":"881",  
> > > > "company":{  
> > > > "name":"St. Agnes"  
> > > > },  
> > > > "url\_structure":"/v\u00e4stra  
> > > > g\u00f6taland/alings\u00e5s/st.-agnes",  
> > > > "street\_address":"V\u00e4stra Ringgatan 1 A",  
> > > > "subscription\_id":"1",  
> > > > "img":"",  
> > > > "city":"Alings\u00e5s",  
> > > > "tstamp":"2012-11-14T01:37:26",  
> > > > "location":"57.931587100000001556,12.529198600000000852",  
> > > > "\_boost":"1.0"  
> > > > },  
> > > > "\_explanation":{  
> > > > "value":5.5646315,  
> > > > "description":"sum of:",  
> > > > "details":[  
> > > > {  
> > > > "value":5.5646315,  
> > > > "description":"weight(company.name:agn in 218)  
> > > > [PerFieldSimilarity], result of:",  
> > > > "details":[  
> > > > {  
> > > > "value":5.5646315,  
> > > > "description":"score(doc=218,freq=1.0 =  
> > > > termFreq=1.0\n), product of:",  
> > > > "details":[  
> > > > {  
> > > > "value":0.74948466,  
> > > > "description":"queryWeight, product  
> > > > of:",  
> > > > "details":[  
> > > > {  
> > > > "value":11.879376,  
> > > > "description":"idf(docFreq=1,  
> > > > maxDocs=106141)"  
> > > > },  
> > > > {  
> > > > "value":0.06309125,  
> > > > "description":"queryNorm"  
> > > > }  
> > > > ]  
> > > > },  
> > > > {  
> > > > "value":7.42461,  
> > > > "description":"fieldWeight in 218,  
> > > > product of:",  
> > > > "details":[  
> > > > {  
> > > > "value":1.0,  
> > > > "description":"tf(freq=1.0),  
> > > > with freq of:",  
> > > > "details":[  
> > > > {  
> > > > "value":1.0,
> > > > 
> > > > "description":"termFreq=1.0"  
> > > > }  
> > > > ]  
> > > > },  
> > > > {  
> > > > "value":11.879376,  
> > > > "description":"idf(docFreq=1,  
> > > > maxDocs=106141)"  
> > > > },  
> > > > {  
> > > > "value":0.625,
> > > > 
> > > > "description":"fieldNorm(doc=218)"  
> > > > }  
> > > > ]  
> > > > }  
> > > > ]  
> > > > }  
> > > > ]  
> > > > }  
> > > > ]  
> > > > }  
> > > > },  
> > > > {  
> > > > "\_shard":0,  
> > > > "\_node":"Z7swhx3jR-6oZWQ47bYkIw",  
> > > > "\_index":"tandlakare",  
> > > > "\_type":"view\_data",  
> > > > "\_id":"2432",  
> > > > "\_score":3.9855573,  
> > > > "\_source":{  
> > > > "id":"2432",  
> > > > "company":{  
> > > > "name":"Tandl\u00e4kare Agneta Knutsson"  
> > > > },
> > > > 
> > > > "url\_structure":"/sk\u00e5ne/limhamn/tandl\u00e4kare-agneta-knutsson",  
> > > > "street\_address":"Geijersgatan 8",  
> > > > "subscription\_id":"1",  
> > > > "img":"",  
> > > > "city":"Limhamn",  
> > > > "tstamp":"2012-11-14T01:37:49",  
> > > > "location":"55.590610499999996819,12.941211600000000814",  
> > > > "\_boost":"1.0"  
> > > > },  
> > > > "\_explanation":{  
> > > > "value":3.9855573,  
> > > > "description":"sum of:",  
> > > > "details":[  
> > > > {  
> > > > "value":3.9855573,  
> > > > "description":"weight(company.name:agnet in 609)  
> > > > [PerFieldSimilarity], result of:",  
> > > > "details":[  
> > > > {  
> > > > "value":3.9855573,  
> > > > "description":"score(doc=609,freq=1.0 =  
> > > > termFreq=1.0\n), product of:",  
> > > > "details":[  
> > > > {  
> > > > "value":0.694725,  
> > > > "description":"queryWeight, product  
> > > > of:",  
> > > > "details":[  
> > > > {  
> > > > "value":11.47377,  
> > > > "description":"idf(docFreq=2,  
> > > > maxDocs=106126)"  
> > > > },  
> > > > {  
> > > > "value":0.060548972,  
> > > > "description":"queryNorm"  
> > > > }  
> > > > ]  
> > > > },  
> > > > {  
> > > > "value":5.736885,  
> > > > "description":"fieldWeight in 609,  
> > > > product of:",  
> > > > "details":[  
> > > > {  
> > > > "value":1.0,  
> > > > "description":"tf(freq=1.0),  
> > > > with freq of:",  
> > > > "details":[  
> > > > {  
> > > > "value":1.0,
> > > > 
> > > > "description":"termFreq=1.0"  
> > > > }  
> > > > ]  
> > > > },  
> > > > {  
> > > > "value":11.47377,  
> > > > "description":"idf(docFreq=2,  
> > > > maxDocs=106126)"  
> > > > },  
> > > > {  
> > > > "value":0.5,
> > > > 
> > > > "description":"fieldNorm(doc=609)"  
> > > > }  
> > > > ]  
> > > > }  
> > > > ]  
> > > > }  
> > > > ]  
> > > > }  
> > > > ]  
> > > > }  
> > > > }  
> > > > ]  
> > > > }  
> > > > }
> > > > 
> > > > On Thu, Sep 19, 2013 at 9:12 AM, [sina.tamanna@gmail.com](mailto:sina.tamanna@gmail.com) wrote:
> > > > 
> > > > > As Ivan mentioned, it would be easier to help if you have the result  
> > > > > of scoring explained. You could achieve this by appending "explain" : true  
> > > > > to the query:
> > > > > 
> > > > > "query" : { "match\_phrase\_prefix" : { "name" : "agnes" } }, "explain"  
> > > > > : true
> > > > > 
> > > > > As for the number of shards and documents take a look at:
> > > > > 
> > > > > [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/api/admin-indices-get-settings/)
> > > > > 
> > > > > [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/api/admin-cluster-nodes-stats/)
> > > > > 
> > > > > --  
> > > > > You received this message because you are subscribed to a topic in the  
> > > > > Google Groups "elasticsearch" group.  
> > > > > To unsubscribe from this topic, visit  
> > > > > [https://groups.google.com/d/topic/elasticsearch/at\_AzCukPJ4/unsubscribe](https://groups.google.com/d/topic/elasticsearch/at_AzCukPJ4/unsubscribe)  
> > > > > .  
> > > > > To unsubscribe from this group and all its topics, 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).
> > 
> > --  
> > You received this message because you are subscribed to a topic in the  
> > Google Groups "elasticsearch" group.  
> > To unsubscribe from this topic, visit  
> > [https://groups.google.com/d/topic/elasticsearch/at\_AzCukPJ4/unsubscribe](https://groups.google.com/d/topic/elasticsearch/at_AzCukPJ4/unsubscribe).  
> > To unsubscribe from this group and all its topics, 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).

--  
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: ![kristofer](https://avatars.discourse-cdn.com/v4/letter/k/45deac/32.png) [@kristofer](https://discuss.elastic.co/u/kristofer)
#### Post date: [September 20, 2013, 9:14pm UTC](https://discuss.elastic.co/t/wierd-scoring/13673/10 "2013-09-20T21:14:22Z")

</div>

Thanks a million for all the help, I'll look into ngrams  
Den 20 sep 2013 18:21 skrev "Ivan Brusic" [ivan@brusic.com](mailto:ivan@brusic.com):

> Try using ngrams, which has a more predictable outcome than prefix query  
> expansion, IMHO. However, perhaps someone can help you with the normal  
> prefix query.
> 
> --  
> Ivan
> 
> On Thu, Sep 19, 2013 at 11:29 PM, Kristofer Hamnell [kristofer@otilia.se](mailto:kristofer@otilia.se)wrote:
> 
> > is there a better way to search then with prefix for what I'm trying to  
> > do then?
> > 
> > On Thu, Sep 19, 2013 at 7:15 PM, Ivan Brusic [ivan@brusic.com](mailto:ivan@brusic.com) wrote:
> > 
> > > You do have four shards and in your case they are working in your favor  
> > > since the document you wish to have a higher score actually has a higher  
> > > IDF.
> > > 
> > > I have not used prefix queries in a long time, so I don't have any  
> > > answers regarding the scoring. The scores are really close! For some  
> > > reason, the St. Agnes document has its higher TD-IDF value reduced by the  
> > > queryNorm, while the other documents do not factor in the queryNorm. I'm  
> > > guess the prefix query expansion has something to do with it. Not sure why  
> > > the first two document even match since their name does not match the  
> > > prefix. The playing around with the fuzziness and expansion settings.
> > > 
> > > Cheers,
> > > 
> > > Ivan
> > > 
> > > On Thu, Sep 19, 2013 at 1:02 AM, Kristofer Hamnell [kristofer@otilia.se](mailto:kristofer@otilia.se)wrote:
> > > 
> > > > and I think I have 4 shards
> > > > 
> > > > On Thu, Sep 19, 2013 at 10:01 AM, Kristofer Hamnell \<  
> > > > kristofer@otilia.se\> wrote:
> > > > 
> > > > > "query" : { "match\_phrase\_prefix" : { "company.name" : "agnes" } },  
> > > > > "explain" : true
> > > > > 
> > > > > I'm guessing this is more info then needed for this senario but here  
> > > > > goes the full response:
> > > > > 
> > > > > HTTP/1.1 200 OK  
> > > > > Content-Type: application/json; charset=UTF-8  
> > > > > Content-Length: 4406
> > > > > 
> > > > > {  
> > > > > "took":2,  
> > > > > "timed\_out":false,  
> > > > > "\_shards":{  
> > > > > "total":4,  
> > > > > "successful":4,  
> > > > > "failed":0  
> > > > > },  
> > > > > "hits":{  
> > > > > "total":8,  
> > > > > "max\_score":5.593096,  
> > > > > "hits":[  
> > > > > {  
> > > > > "\_shard":3,  
> > > > > "\_node":"Z7swhx3jR-6oZWQ47bYkIw",  
> > > > > "\_index":"tandlakare",  
> > > > > "\_type":"view\_data",  
> > > > > "\_id":"352",  
> > > > > "\_score":5.593096,  
> > > > > "\_source":{  
> > > > > "id":"352",  
> > > > > "company":{  
> > > > > "name":"Tandl\u00e4kare Agneta Hultin  
> > > > > Tandl\u00e4karhuset"  
> > > > > },
> > > > > 
> > > > > "url\_structure":"/stockholm/\u00e5kersberga/tandl\u00e4kare-agneta-hultin-tandl\u00e4karhuset",  
> > > > > "street\_address":"Saturnusv\u00e4gen 2",  
> > > > > "subscription\_id":"1",  
> > > > > "img":"",  
> > > > > "city":"\u00c5kersberga",  
> > > > > "tstamp":"2013-02-21T13:51:26",
> > > > > 
> > > > > "location":"59.477667565305000000,18.295774234384000000",  
> > > > > "\_boost":"1.0"  
> > > > > },  
> > > > > "\_explanation":{  
> > > > > "value":5.593096,  
> > > > > "description":"weight(company.name:agnet in 88)  
> > > > > [PerFieldSimilarity], result of:",  
> > > > > "details":[  
> > > > > {  
> > > > > "value":5.593096,  
> > > > > "description":"fieldWeight in 88, product of:",  
> > > > > "details":[  
> > > > > {  
> > > > > "value":1.0,  
> > > > > "description":"tf(freq=1.0), with freq of:",  
> > > > > "details":[  
> > > > > {  
> > > > > "value":1.0,  
> > > > > "description":"termFreq=1.0"  
> > > > > }  
> > > > > ]  
> > > > > },  
> > > > > {  
> > > > > "value":11.186192,  
> > > > > "description":"idf(docFreq=3,  
> > > > > maxDocs=106137)"  
> > > > > },  
> > > > > {  
> > > > > "value":0.5,  
> > > > > "description":"fieldNorm(doc=88)"  
> > > > > }  
> > > > > ]  
> > > > > }  
> > > > > ]  
> > > > > }  
> > > > > },  
> > > > > {  
> > > > > "\_shard":3,  
> > > > > "\_node":"Z7swhx3jR-6oZWQ47bYkIw",  
> > > > > "\_index":"tandlakare",  
> > > > > "\_type":"view\_data",  
> > > > > "\_id":"2291",  
> > > > > "\_score":5.593096,  
> > > > > "\_source":{  
> > > > > "id":"2291",  
> > > > > "company":{  
> > > > > "name":"Carin Agneta Axeltorp"  
> > > > > },
> > > > > 
> > > > > "url\_structure":"/sk\u00e5ne/limhamn/carin-agneta-axeltorp",  
> > > > > "street\_address":"Abbedissgatan 7",  
> > > > > "subscription\_id":"1",  
> > > > > "img":"",  
> > > > > "city":"Limhamn",  
> > > > > "tstamp":"2012-11-14T01:37:47",
> > > > > 
> > > > > "location":"55.572641300000000797,12.951067099999999499",  
> > > > > " \_boost":"1.0"  
> > > > > },  
> > > > > "\_explanation":{  
> > > > > "value":5.593096,  
> > > > > "description":"weight(company.name:agnet in 571)  
> > > > > [PerFieldSimilarity], result of:",  
> > > > > "details":[  
> > > > > {  
> > > > > "value":5.593096,  
> > > > > "description":"fieldWeight in 571, product of:",  
> > > > > "details":[  
> > > > > {  
> > > > > "value":1.0,  
> > > > > "description":"tf(freq=1.0), with freq of:",  
> > > > > "details":[  
> > > > > {  
> > > > > "value":1.0,  
> > > > > "description":"termFreq=1.0"  
> > > > > }  
> > > > > ]  
> > > > > },  
> > > > > {  
> > > > > "value":11.186192,  
> > > > > "description":"idf(docFreq=3,  
> > > > > maxDocs=106137)"  
> > > > > },  
> > > > > {  
> > > > > "value":0.5,  
> > > > > "description":"fieldNorm(doc=571)"  
> > > > > }  
> > > > > ]  
> > > > > }  
> > > > > ]  
> > > > > }  
> > > > > },  
> > > > > {  
> > > > > "\_shard":2,  
> > > > > "\_node":"Z7swhx3jR-6oZWQ47bYkIw",  
> > > > > "\_index":"tandlakare",  
> > > > > "\_type":"view\_data",  
> > > > > "\_id":"881",  
> > > > > "\_score":5.5646315,  
> > > > > "\_source":{  
> > > > > "id":"881",  
> > > > > "company":{  
> > > > > "name":"St. Agnes"  
> > > > > },  
> > > > > "url\_structure":"/v\u00e4stra  
> > > > > g\u00f6taland/alings\u00e5s/st.-agnes",  
> > > > > "street\_address":"V\u00e4stra Ringgatan 1 A",  
> > > > > "subscription\_id":"1",  
> > > > > "img":"",  
> > > > > "city":"Alings\u00e5s",  
> > > > > "tstamp":"2012-11-14T01:37:26",
> > > > > 
> > > > > "location":"57.931587100000001556,12.529198600000000852",  
> > > > > "\_boost":"1.0"  
> > > > > },  
> > > > > "\_explanation":{  
> > > > > "value":5.5646315,  
> > > > > "description":"sum of:",  
> > > > > "details":[  
> > > > > {  
> > > > > "value":5.5646315,  
> > > > > "description":"weight(company.name:agn in 218)  
> > > > > [PerFieldSimilarity], result of:",  
> > > > > "details":[  
> > > > > {  
> > > > > "value":5.5646315,  
> > > > > "description":"score(doc=218,freq=1.0 =  
> > > > > termFreq=1.0\n), product of:",  
> > > > > "details":[  
> > > > > {  
> > > > > "value":0.74948466,  
> > > > > "description":"queryWeight, product  
> > > > > of:",  
> > > > > "details":[  
> > > > > {  
> > > > > "value":11.879376,  
> > > > > "description":"idf(docFreq=1,  
> > > > > maxDocs=106141)"  
> > > > > },  
> > > > > {  
> > > > > "value":0.06309125,  
> > > > > "description":"queryNorm"  
> > > > > }  
> > > > > ]  
> > > > > },  
> > > > > {  
> > > > > "value":7.42461,  
> > > > > "description":"fieldWeight in 218,  
> > > > > product of:",  
> > > > > "details":[  
> > > > > {  
> > > > > "value":1.0,  
> > > > > "description":"tf(freq=1.0),  
> > > > > with freq of:",  
> > > > > "details":[  
> > > > > {  
> > > > > "value":1.0,
> > > > > 
> > > > > "description":"termFreq=1.0"  
> > > > > }  
> > > > > ]  
> > > > > },  
> > > > > {  
> > > > > "value":11.879376,  
> > > > > "description":"idf(docFreq=1,  
> > > > > maxDocs=106141)"  
> > > > > },  
> > > > > {  
> > > > > "value":0.625,
> > > > > 
> > > > > "description":"fieldNorm(doc=218)"  
> > > > > }  
> > > > > ]  
> > > > > }  
> > > > > ]  
> > > > > }  
> > > > > ]  
> > > > > }  
> > > > > ]  
> > > > > }  
> > > > > },  
> > > > > {  
> > > > > "\_shard":0,  
> > > > > "\_node":"Z7swhx3jR-6oZWQ47bYkIw",  
> > > > > "\_index":"tandlakare",  
> > > > > "\_type":"view\_data",  
> > > > > "\_id":"2432",  
> > > > > "\_score":3.9855573,  
> > > > > "\_source":{  
> > > > > "id":"2432",  
> > > > > "company":{  
> > > > > "name":"Tandl\u00e4kare Agneta Knutsson"  
> > > > > },
> > > > > 
> > > > > "url\_structure":"/sk\u00e5ne/limhamn/tandl\u00e4kare-agneta-knutsson",  
> > > > > "street\_address":"Geijersgatan 8",  
> > > > > "subscription\_id":"1",  
> > > > > "img":"",  
> > > > > "city":"Limhamn",  
> > > > > "tstamp":"2012-11-14T01:37:49",
> > > > > 
> > > > > "location":"55.590610499999996819,12.941211600000000814",  
> > > > > "\_boost":"1.0"  
> > > > > },  
> > > > > "\_explanation":{  
> > > > > "value":3.9855573,  
> > > > > "description":"sum of:",  
> > > > > "details":[  
> > > > > {  
> > > > > "value":3.9855573,  
> > > > > "description":"weight(company.name:agnet in 609)  
> > > > > [PerFieldSimilarity], result of:",  
> > > > > "details":[  
> > > > > {  
> > > > > "value":3.9855573,  
> > > > > "description":"score(doc=609,freq=1.0 =  
> > > > > termFreq=1.0\n), product of:",  
> > > > > "details":[  
> > > > > {  
> > > > > "value":0.694725,  
> > > > > "description":"queryWeight, product  
> > > > > of:",  
> > > > > "details":[  
> > > > > {  
> > > > > "value":11.47377,  
> > > > > "description":"idf(docFreq=2,  
> > > > > maxDocs=106126)"  
> > > > > },  
> > > > > {  
> > > > > "value":0.060548972,  
> > > > > "description":"queryNorm"  
> > > > > }  
> > > > > ]  
> > > > > },  
> > > > > {  
> > > > > "value":5.736885,  
> > > > > "description":"fieldWeight in 609,  
> > > > > product of:",  
> > > > > "details":[  
> > > > > {  
> > > > > "value":1.0,  
> > > > > "description":"tf(freq=1.0),  
> > > > > with freq of:",  
> > > > > "details":[  
> > > > > {  
> > > > > "value":1.0,
> > > > > 
> > > > > "description":"termFreq=1.0"  
> > > > > }  
> > > > > ]  
> > > > > },  
> > > > > {  
> > > > > "value":11.47377,  
> > > > > "description":"idf(docFreq=2,  
> > > > > maxDocs=106126)"  
> > > > > },  
> > > > > {  
> > > > > "value":0.5,
> > > > > 
> > > > > "description":"fieldNorm(doc=609)"  
> > > > > }  
> > > > > ]  
> > > > > }  
> > > > > ]  
> > > > > }  
> > > > > ]  
> > > > > }  
> > > > > ]  
> > > > > }  
> > > > > }  
> > > > > ]  
> > > > > }  
> > > > > }
> > > > > 
> > > > > On Thu, Sep 19, 2013 at 9:12 AM, [sina.tamanna@gmail.com](mailto:sina.tamanna@gmail.com) wrote:
> > > > > 
> > > > > > As Ivan mentioned, it would be easier to help if you have the result  
> > > > > > of scoring explained. You could achieve this by appending "explain" : true  
> > > > > > to the query:
> > > > > > 
> > > > > > "query" : { "match\_phrase\_prefix" : { "name" : "agnes" } }, "explain"  
> > > > > > : true
> > > > > > 
> > > > > > As for the number of shards and documents take a look at:
> > > > > > 
> > > > > > [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/api/admin-indices-get-settings/)
> > > > > > 
> > > > > > [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/api/admin-cluster-nodes-stats/)
> > > > > > 
> > > > > > --  
> > > > > > You received this message because you are subscribed to a topic in  
> > > > > > the Google Groups "elasticsearch" group.  
> > > > > > To unsubscribe from this topic, visit  
> > > > > > [https://groups.google.com/d/topic/elasticsearch/at\_AzCukPJ4/unsubscribe](https://groups.google.com/d/topic/elasticsearch/at_AzCukPJ4/unsubscribe)  
> > > > > > .  
> > > > > > To unsubscribe from this group and all its topics, 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).
> > > 
> > > --  
> > > You received this message because you are subscribed to a topic in the  
> > > Google Groups "elasticsearch" group.  
> > > To unsubscribe from this topic, visit  
> > > [https://groups.google.com/d/topic/elasticsearch/at\_AzCukPJ4/unsubscribe](https://groups.google.com/d/topic/elasticsearch/at_AzCukPJ4/unsubscribe).  
> > > To unsubscribe from this group and all its topics, 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).
> 
> --  
> You received this message because you are subscribed to a topic in the  
> Google Groups "elasticsearch" group.  
> To unsubscribe from this topic, visit  
> [https://groups.google.com/d/topic/elasticsearch/at\_AzCukPJ4/unsubscribe](https://groups.google.com/d/topic/elasticsearch/at_AzCukPJ4/unsubscribe).  
> To unsubscribe from this group and all its topics, 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:15am UTC](https://discuss.elastic.co/t/wierd-scoring/13673/11 "2017-07-06T02:15:16Z")

</div>


