# Elasticsearch/Lucene scoring broken?

**URL:** <https://discuss.elastic.co/t/elasticsearch-lucene-scoring-broken/10961>\
**Category:** Elasticsearch\
**Created:** [March 1, 2013, 3:15am UTC](https://discuss.elastic.co/t/elasticsearch-lucene-scoring-broken/10961 "2013-03-01T03:15:13Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![Bruno\_Miranda](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/bruno_miranda/32/746_2.png) [@Bruno\_Miranda](https://discuss.elastic.co/u/Bruno_Miranda)\
**Post date:** [March 1, 2013, 3:15am UTC](https://discuss.elastic.co/t/elasticsearch-lucene-scoring-broken/10961/1 "2013-03-01T03:15:13Z")

</div>

I am seeing the same exact index and the same exact query return different  
results, could someone please help me understand?

curl -X DELETE [http://localhost:9200/search](http://localhost:9200/search)  
curl -X POST [http://localhost:9200/search](http://localhost:9200/search) -d '{  
"mappings": {  
"document": {  
"properties": {  
"first": {  
"type": "string"  
},  
"last": {  
"type": "string",  
"boost": 2.0  
}  
}  
}  
}  
}'

curl -X POST "[http://localhost:9200/search/document/](http://localhost:9200/search/document/)" -d '{"first":  
"Kimberly","last":"Leighton"}'  
curl -X POST "[http://localhost:9200/search/document/](http://localhost:9200/search/document/)" -d '{"first":"Barbara"  
,"last":"Leighton"}'  
curl -X POST "[http://localhost:9200/search/document/](http://localhost:9200/search/document/)" -d '{"first":"John",  
"last":"Leighton"}'  
curl -X POST "[http://localhost:9200/search/document/](http://localhost:9200/search/document/)" -d '{"first":"Nancy",  
"last":"Mark"}'  
curl -X POST "[http://localhost:9200/search/document/](http://localhost:9200/search/document/)" -d '{"first":  
"Lawrence","last":"Mark"}'  
curl -X POST "[http://localhost:9200/search/document/](http://localhost:9200/search/document/)" -d '{"first":"Louis",  
"last":"Mark"}'  
curl -X POST "[http://localhost:9200/search/document/](http://localhost:9200/search/document/)" -d '{"first":  
"Leighton","last":"Mark"}'  
curl -X POST "[http://localhost:9200/search/document/](http://localhost:9200/search/document/)" -d '{"first":  
"Leighton","last":"Sweet"}'  
curl -X POST "[http://localhost:9200/search/\_refresh](http://localhost:9200/search/_refresh)"

curl -X GET '[http://localhost:9200/search/\_search?pretty](http://localhost:9200/search/_search?pretty)' -d '{  
"query": {  
"query\_string": {  
"query": "Mark Leighton"  
}  
}  
}'

_RESULTS:_ ["Leighton Mark", "Louis Mark", "Kimberly Leighton", "Barbara  
Leighton", "John Leighton", "Nancy Mark", "Lawrence Mark", "Leighton Sweet"]

_I run the same excact code again and the results are different_  
\*  
\*  
\*  
\*  
curl -X DELETE [http://localhost:9200/search](http://localhost:9200/search)  
curl -X POST [http://localhost:9200/search](http://localhost:9200/search) -d '{  
"mappings": {  
"document": {  
"properties": {  
"first": {  
"type": "string"  
},  
"last": {  
"type": "string",  
"boost": 2.0  
}  
}  
}  
}  
}'

curl -X POST "[http://localhost:9200/search/document/](http://localhost:9200/search/document/)" -d '{"first":  
"Kimberly","last":"Leighton"}'  
curl -X POST "[http://localhost:9200/search/document/](http://localhost:9200/search/document/)" -d '{"first":"Barbara"  
,"last":"Leighton"}'  
curl -X POST "[http://localhost:9200/search/document/](http://localhost:9200/search/document/)" -d '{"first":"John",  
"last":"Leighton"}'  
curl -X POST "[http://localhost:9200/search/document/](http://localhost:9200/search/document/)" -d '{"first":"Nancy",  
"last":"Mark"}'  
curl -X POST "[http://localhost:9200/search/document/](http://localhost:9200/search/document/)" -d '{"first":  
"Lawrence","last":"Mark"}'  
curl -X POST "[http://localhost:9200/search/document/](http://localhost:9200/search/document/)" -d '{"first":"Louis",  
"last":"Mark"}'  
curl -X POST "[http://localhost:9200/search/document/](http://localhost:9200/search/document/)" -d '{"first":  
"Leighton","last":"Mark"}'  
curl -X POST "[http://localhost:9200/search/document/](http://localhost:9200/search/document/)" -d '{"first":  
"Leighton","last":"Sweet"}'  
curl -X POST "[http://localhost:9200/search/\_refresh](http://localhost:9200/search/_refresh)"

curl -X GET '[http://localhost:9200/search/\_search?pretty](http://localhost:9200/search/_search?pretty)' -d '{  
"query": {  
"query\_string": {  
"query": "Mark Leighton"  
}  
}  
}'

_RESULTS:_ ["Nancy Mark", "Leighton Mark", "Lawrence Mark", "Louis Mark",  
"Leighton Sweet", "Kimberly Leighton", "Barbara Leighton", "John Leighton"]

The first time the top results was "Leighton Mark" as it should be because  
it matches both terms. The same query seconds later returns a different  
search result.

Is scoring broken in Elasticsearch/Lucene?

Thank you.

--  
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:** [March 1, 2013, 3:47am UTC](https://discuss.elastic.co/t/elasticsearch-lucene-scoring-broken/10961/2 "2013-03-01T03:47:44Z")

</div>

Hard to say without seeing the explanation/scores. How many shards does  
your index have? TFIDF are calculated per shard, which skews scores greatly  
when you only have a few documents. You can experiment with the  
dfs\_query\_then\_fetch search type:

> **[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.

--  
Ivan

On Thu, Feb 28, 2013 at 7:15 PM, Bruno Miranda [bru.miranda@gmail.com](mailto:bru.miranda@gmail.com)wrote:

> I am seeing the same exact index and the same exact query return different  
> results, could someone please help me understand?
> 
> curl -X DELETE [http://localhost:9200/search](http://localhost:9200/search)  
> curl -X POST [http://localhost:9200/search](http://localhost:9200/search) -d '{  
> "mappings": {  
> "document": {  
> "properties": {  
> "first": {  
> "type": "string"  
> },  
> "last": {  
> "type": "string",  
> "boost": 2.0  
> }  
> }  
> }  
> }  
> }'
> 
> curl -X POST "[http://localhost:9200/search/document/](http://localhost:9200/search/document/)" -d '{"first":  
> "Kimberly","last":"Leighton"}'  
> curl -X POST "[http://localhost:9200/search/document/](http://localhost:9200/search/document/)" -d '{"first":  
> "Barbara","last":"Leighton"}'  
> curl -X POST "[http://localhost:9200/search/document/](http://localhost:9200/search/document/)" -d '{"first":"John",  
> "last":"Leighton"}'  
> curl -X POST "[http://localhost:9200/search/document/](http://localhost:9200/search/document/)" -d '{"first":"Nancy"  
> ,"last":"Mark"}'  
> curl -X POST "[http://localhost:9200/search/document/](http://localhost:9200/search/document/)" -d '{"first":  
> "Lawrence","last":"Mark"}'  
> curl -X POST "[http://localhost:9200/search/document/](http://localhost:9200/search/document/)" -d '{"first":"Louis"  
> ,"last":"Mark"}'  
> curl -X POST "[http://localhost:9200/search/document/](http://localhost:9200/search/document/)" -d '{"first":  
> "Leighton","last":"Mark"}'  
> curl -X POST "[http://localhost:9200/search/document/](http://localhost:9200/search/document/)" -d '{"first":  
> "Leighton","last":"Sweet"}'  
> curl -X POST "[http://localhost:9200/search/\_refresh](http://localhost:9200/search/_refresh)"
> 
> curl -X GET '[http://localhost:9200/search/\_search?pretty](http://localhost:9200/search/_search?pretty)' -d '{  
> "query": {  
> "query\_string": {  
> "query": "Mark Leighton"  
> }  
> }  
> }'
> 
> _RESULTS:_ ["Leighton Mark", "Louis Mark", "Kimberly Leighton", "Barbara  
> Leighton", "John Leighton", "Nancy Mark", "Lawrence Mark", "Leighton Sweet"]
> 
> _I run the same excact code again and the results are different_  
> \*  
> \*  
> \*  
> \*  
> curl -X DELETE [http://localhost:9200/search](http://localhost:9200/search)  
> curl -X POST [http://localhost:9200/search](http://localhost:9200/search) -d '{  
> "mappings": {  
> "document": {  
> "properties": {  
> "first": {  
> "type": "string"  
> },  
> "last": {  
> "type": "string",  
> "boost": 2.0  
> }  
> }  
> }  
> }  
> }'
> 
> curl -X POST "[http://localhost:9200/search/document/](http://localhost:9200/search/document/)" -d '{"first":  
> "Kimberly","last":"Leighton"}'  
> curl -X POST "[http://localhost:9200/search/document/](http://localhost:9200/search/document/)" -d '{"first":  
> "Barbara","last":"Leighton"}'  
> curl -X POST "[http://localhost:9200/search/document/](http://localhost:9200/search/document/)" -d '{"first":"John",  
> "last":"Leighton"}'  
> curl -X POST "[http://localhost:9200/search/document/](http://localhost:9200/search/document/)" -d '{"first":"Nancy"  
> ,"last":"Mark"}'  
> curl -X POST "[http://localhost:9200/search/document/](http://localhost:9200/search/document/)" -d '{"first":  
> "Lawrence","last":"Mark"}'  
> curl -X POST "[http://localhost:9200/search/document/](http://localhost:9200/search/document/)" -d '{"first":"Louis"  
> ,"last":"Mark"}'  
> curl -X POST "[http://localhost:9200/search/document/](http://localhost:9200/search/document/)" -d '{"first":  
> "Leighton","last":"Mark"}'  
> curl -X POST "[http://localhost:9200/search/document/](http://localhost:9200/search/document/)" -d '{"first":  
> "Leighton","last":"Sweet"}'  
> curl -X POST "[http://localhost:9200/search/\_refresh](http://localhost:9200/search/_refresh)"
> 
> curl -X GET '[http://localhost:9200/search/\_search?pretty](http://localhost:9200/search/_search?pretty)' -d '{  
> "query": {  
> "query\_string": {  
> "query": "Mark Leighton"  
> }  
> }  
> }'
> 
> _RESULTS:_ ["Nancy Mark", "Leighton Mark", "Lawrence Mark", "Louis Mark",  
> "Leighton Sweet", "Kimberly Leighton", "Barbara Leighton", "John Leighton"]
> 
> The first time the top results was "Leighton Mark" as it should be because  
> it matches both terms. The same query seconds later returns a different  
> search result.
> 
> Is scoring broken in Elasticsearch/Lucene?
> 
> Thank you.
> 
> --  
> 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:** ![Nick\_Zadrozny](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nick_zadrozny/32/1150_2.png) [@Nick\_Zadrozny](https://discuss.elastic.co/u/Nick_Zadrozny)\
**Post date:** [March 1, 2013, 3:56am UTC](https://discuss.elastic.co/t/elasticsearch-lucene-scoring-broken/10961/3 "2013-03-01T03:56:15Z")

</div>

Does the output of `explain` help?

> **[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.

On Thu, Feb 28, 2013 at 7:15 PM, Bruno Miranda [bru.miranda@gmail.com](mailto:bru.miranda@gmail.com)wrote:

> I am seeing the same exact index and the same exact query return different  
> results, could someone please help me understand?
> 
> curl -X DELETE [http://localhost:9200/search](http://localhost:9200/search)  
> curl -X POST [http://localhost:9200/search](http://localhost:9200/search) -d '{  
> "mappings": {  
> "document": {  
> "properties": {  
> "first": {  
> "type": "string"  
> },  
> "last": {  
> "type": "string",  
> "boost": 2.0  
> }  
> }  
> }  
> }  
> }'
> 
> curl -X POST "[http://localhost:9200/search/document/](http://localhost:9200/search/document/)" -d '{"first":  
> "Kimberly","last":"Leighton"}'  
> curl -X POST "[http://localhost:9200/search/document/](http://localhost:9200/search/document/)" -d '{"first":  
> "Barbara","last":"Leighton"}'  
> curl -X POST "[http://localhost:9200/search/document/](http://localhost:9200/search/document/)" -d '{"first":"John",  
> "last":"Leighton"}'  
> curl -X POST "[http://localhost:9200/search/document/](http://localhost:9200/search/document/)" -d '{"first":"Nancy"  
> ,"last":"Mark"}'  
> curl -X POST "[http://localhost:9200/search/document/](http://localhost:9200/search/document/)" -d '{"first":  
> "Lawrence","last":"Mark"}'  
> curl -X POST "[http://localhost:9200/search/document/](http://localhost:9200/search/document/)" -d '{"first":"Louis"  
> ,"last":"Mark"}'  
> curl -X POST "[http://localhost:9200/search/document/](http://localhost:9200/search/document/)" -d '{"first":  
> "Leighton","last":"Mark"}'  
> curl -X POST "[http://localhost:9200/search/document/](http://localhost:9200/search/document/)" -d '{"first":  
> "Leighton","last":"Sweet"}'  
> curl -X POST "[http://localhost:9200/search/\_refresh](http://localhost:9200/search/_refresh)"
> 
> curl -X GET '[http://localhost:9200/search/\_search?pretty](http://localhost:9200/search/_search?pretty)' -d '{  
> "query": {  
> "query\_string": {  
> "query": "Mark Leighton"  
> }  
> }  
> }'
> 
> _RESULTS:_ ["Leighton Mark", "Louis Mark", "Kimberly Leighton", "Barbara  
> Leighton", "John Leighton", "Nancy Mark", "Lawrence Mark", "Leighton Sweet"]
> 
> _I run the same excact code again and the results are different_  
> \*  
> \*  
> \*  
> \*  
> curl -X DELETE [http://localhost:9200/search](http://localhost:9200/search)  
> curl -X POST [http://localhost:9200/search](http://localhost:9200/search) -d '{  
> "mappings": {  
> "document": {  
> "properties": {  
> "first": {  
> "type": "string"  
> },  
> "last": {  
> "type": "string",  
> "boost": 2.0  
> }  
> }  
> }  
> }  
> }'
> 
> curl -X POST "[http://localhost:9200/search/document/](http://localhost:9200/search/document/)" -d '{"first":  
> "Kimberly","last":"Leighton"}'  
> curl -X POST "[http://localhost:9200/search/document/](http://localhost:9200/search/document/)" -d '{"first":  
> "Barbara","last":"Leighton"}'  
> curl -X POST "[http://localhost:9200/search/document/](http://localhost:9200/search/document/)" -d '{"first":"John",  
> "last":"Leighton"}'  
> curl -X POST "[http://localhost:9200/search/document/](http://localhost:9200/search/document/)" -d '{"first":"Nancy"  
> ,"last":"Mark"}'  
> curl -X POST "[http://localhost:9200/search/document/](http://localhost:9200/search/document/)" -d '{"first":  
> "Lawrence","last":"Mark"}'  
> curl -X POST "[http://localhost:9200/search/document/](http://localhost:9200/search/document/)" -d '{"first":"Louis"  
> ,"last":"Mark"}'  
> curl -X POST "[http://localhost:9200/search/document/](http://localhost:9200/search/document/)" -d '{"first":  
> "Leighton","last":"Mark"}'  
> curl -X POST "[http://localhost:9200/search/document/](http://localhost:9200/search/document/)" -d '{"first":  
> "Leighton","last":"Sweet"}'  
> curl -X POST "[http://localhost:9200/search/\_refresh](http://localhost:9200/search/_refresh)"
> 
> curl -X GET '[http://localhost:9200/search/\_search?pretty](http://localhost:9200/search/_search?pretty)' -d '{  
> "query": {  
> "query\_string": {  
> "query": "Mark Leighton"  
> }  
> }  
> }'
> 
> _RESULTS:_ ["Nancy Mark", "Leighton Mark", "Lawrence Mark", "Louis Mark",  
> "Leighton Sweet", "Kimberly Leighton", "Barbara Leighton", "John Leighton"]
> 
> The first time the top results was "Leighton Mark" as it should be because  
> it matches both terms. The same query seconds later returns a different  
> search result.
> 
> Is scoring broken in Elasticsearch/Lucene?
> 
> Thank you.
> 
> --  
> 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).

--  
Nick Zadrozny

Cofounder, One More Cloud

[websolr.com](http://websolr.com) [https://websolr.com/home](https://websolr.com/home) • [bonsai.io](http://bonsai.io) [http://bonsai.io/home](http://bonsai.io/home)

Hassle-free hosted full-text search,  
powered by Apache Solr and Elasticsearch.

--  
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:** ![egaumer](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/egaumer/32/2365_2.png) [@egaumer](https://discuss.elastic.co/u/egaumer)\
**Post date:** [March 1, 2013, 5:03am UTC](https://discuss.elastic.co/t/elasticsearch-lucene-scoring-broken/10961/4 "2013-03-01T05:03:01Z")

</div>

As Ivan pointed out, the 8 documents you're using aren't enough to provide  
a random distribution of terms across shards. Since IDF is computed on a  
per shard basis, your results will vary depending on the way documents have  
been hashed across the shards.

If you want to run small tests like this then just use one shard. The other  
option, as Ivan also pointed out, is to change the query mode (search type)  
so that a global IDF is calculated.

-Eric

On Thursday, February 28, 2013 10:15:13 PM UTC-5, Bruno Miranda wrote:

> I am seeing the same exact index and the same exact query return different  
> results, could someone please help me understand?
> 
> curl -X DELETE [http://localhost:9200/search](http://localhost:9200/search)  
> curl -X POST [http://localhost:9200/search](http://localhost:9200/search) -d '{  
> "mappings": {  
> "document": {  
> "properties": {  
> "first": {  
> "type": "string"  
> },  
> "last": {  
> "type": "string",  
> "boost": 2.0  
> }  
> }  
> }  
> }  
> }'
> 
> curl -X POST "[http://localhost:9200/search/document/](http://localhost:9200/search/document/)" -d '{"first":  
> "Kimberly","last":"Leighton"}'  
> curl -X POST "[http://localhost:9200/search/document/](http://localhost:9200/search/document/)" -d '{"first":  
> "Barbara","last":"Leighton"}'  
> curl -X POST "[http://localhost:9200/search/document/](http://localhost:9200/search/document/)" -d '{"first":"John",  
> "last":"Leighton"}'  
> curl -X POST "[http://localhost:9200/search/document/](http://localhost:9200/search/document/)" -d '{"first":"Nancy"  
> ,"last":"Mark"}'  
> curl -X POST "[http://localhost:9200/search/document/](http://localhost:9200/search/document/)" -d '{"first":  
> "Lawrence","last":"Mark"}'  
> curl -X POST "[http://localhost:9200/search/document/](http://localhost:9200/search/document/)" -d '{"first":"Louis"  
> ,"last":"Mark"}'  
> curl -X POST "[http://localhost:9200/search/document/](http://localhost:9200/search/document/)" -d '{"first":  
> "Leighton","last":"Mark"}'  
> curl -X POST "[http://localhost:9200/search/document/](http://localhost:9200/search/document/)" -d '{"first":  
> "Leighton","last":"Sweet"}'  
> curl -X POST "[http://localhost:9200/search/\_refresh](http://localhost:9200/search/_refresh)"
> 
> curl -X GET '[http://localhost:9200/search/\_search?pretty](http://localhost:9200/search/_search?pretty)' -d '{  
> "query": {  
> "query\_string": {  
> "query": "Mark Leighton"  
> }  
> }  
> }'
> 
> _RESULTS:_ ["Leighton Mark", "Louis Mark", "Kimberly Leighton", "Barbara  
> Leighton", "John Leighton", "Nancy Mark", "Lawrence Mark", "Leighton Sweet"]
> 
> _I run the same excact code again and the results are different_  
> \*  
> \*  
> \*  
> \*  
> curl -X DELETE [http://localhost:9200/search](http://localhost:9200/search)  
> curl -X POST [http://localhost:9200/search](http://localhost:9200/search) -d '{  
> "mappings": {  
> "document": {  
> "properties": {  
> "first": {  
> "type": "string"  
> },  
> "last": {  
> "type": "string",  
> "boost": 2.0  
> }  
> }  
> }  
> }  
> }'
> 
> curl -X POST "[http://localhost:9200/search/document/](http://localhost:9200/search/document/)" -d '{"first":  
> "Kimberly","last":"Leighton"}'  
> curl -X POST "[http://localhost:9200/search/document/](http://localhost:9200/search/document/)" -d '{"first":  
> "Barbara","last":"Leighton"}'  
> curl -X POST "[http://localhost:9200/search/document/](http://localhost:9200/search/document/)" -d '{"first":"John",  
> "last":"Leighton"}'  
> curl -X POST "[http://localhost:9200/search/document/](http://localhost:9200/search/document/)" -d '{"first":"Nancy"  
> ,"last":"Mark"}'  
> curl -X POST "[http://localhost:9200/search/document/](http://localhost:9200/search/document/)" -d '{"first":  
> "Lawrence","last":"Mark"}'  
> curl -X POST "[http://localhost:9200/search/document/](http://localhost:9200/search/document/)" -d '{"first":"Louis"  
> ,"last":"Mark"}'  
> curl -X POST "[http://localhost:9200/search/document/](http://localhost:9200/search/document/)" -d '{"first":  
> "Leighton","last":"Mark"}'  
> curl -X POST "[http://localhost:9200/search/document/](http://localhost:9200/search/document/)" -d '{"first":  
> "Leighton","last":"Sweet"}'  
> curl -X POST "[http://localhost:9200/search/\_refresh](http://localhost:9200/search/_refresh)"
> 
> curl -X GET '[http://localhost:9200/search/\_search?pretty](http://localhost:9200/search/_search?pretty)' -d '{  
> "query": {  
> "query\_string": {  
> "query": "Mark Leighton"  
> }  
> }  
> }'
> 
> _RESULTS:_ ["Nancy Mark", "Leighton Mark", "Lawrence Mark", "Louis Mark",  
> "Leighton Sweet", "Kimberly Leighton", "Barbara Leighton", "John Leighton"]
> 
> The first time the top results was "Leighton Mark" as it should be because  
> it matches both terms. The same query seconds later returns a different  
> search result.
> 
> Is scoring broken in Elasticsearch/Lucene?
> 
> Thank you.

--  
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:** ![Bruno\_Miranda](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/bruno_miranda/32/746_2.png) [@Bruno\_Miranda](https://discuss.elastic.co/u/Bruno_Miranda)\
**Post date:** [March 1, 2013, 5:29am UTC](https://discuss.elastic.co/t/elasticsearch-lucene-scoring-broken/10961/5 "2013-03-01T05:29:02Z")

</div>

If I lower the shard count to 2, it's much more accurate, almost 100% of  
the time. With 5 shards it falls down to about 75%.

The reason I even started looking at such small dataset is because I was  
seeing inconsistent results when using match. Query\_string seems more  
accurate as far as the scoring is concerned.

using query\_string I get the desired result order:

curl -X GET '[http://localhost:9200/search/\_search?pretty](http://localhost:9200/search/_search?pretty)' -d '{  
"query": {  
"query\_string": {  
"query": "mark leighton"  
}  
}  
}'

["Leighton Mark", "Nancy Mark", "Lawrence Mark", "Louis Mark", "Kimberly  
Leighton", "Barbara Leighton", "John Leighton", "Leighton Sweet"]

Using match:

curl -X GET '[http://localhost:9200/search/\_search?pretty](http://localhost:9200/search/_search?pretty)' -d '{  
"query": {  
"multi\_match": {  
"query": "mark leighton",  
"fields": [  
"last",  
"first"  
]  
}  
}  
}'

["Kimberly Leighton", "Barbara Leighton", "John Leighton", "Nancy Mark", "Lawrence  
Mark", "Louis Mark", "Leighton Mark", "Leighton Sweet"]

I get the totally wrong order.

I suppose my first issue was using match when I should be using query  
string, and the second is the dataset is too small for anything over 2  
shards.

Any ideas?

* * *

On Thursday, February 28, 2013 7:15:13 PM UTC-8, Bruno Miranda wrote:

> I am seeing the same exact index and the same exact query return different  
> results, could someone please help me understand?
> 
> curl -X DELETE [http://localhost:9200/search](http://localhost:9200/search)  
> curl -X POST [http://localhost:9200/search](http://localhost:9200/search) -d '{  
> "mappings": {  
> "document": {  
> "properties": {  
> "first": {  
> "type": "string"  
> },  
> "last": {  
> "type": "string",  
> "boost": 2.0  
> }  
> }  
> }  
> }  
> }'
> 
> curl -X POST "[http://localhost:9200/search/document/](http://localhost:9200/search/document/)" -d '{"first":  
> "Kimberly","last":"Leighton"}'  
> curl -X POST "[http://localhost:9200/search/document/](http://localhost:9200/search/document/)" -d '{"first":  
> "Barbara","last":"Leighton"}'  
> curl -X POST "[http://localhost:9200/search/document/](http://localhost:9200/search/document/)" -d '{"first":"John",  
> "last":"Leighton"}'  
> curl -X POST "[http://localhost:9200/search/document/](http://localhost:9200/search/document/)" -d '{"first":"Nancy"  
> ,"last":"Mark"}'  
> curl -X POST "[http://localhost:9200/search/document/](http://localhost:9200/search/document/)" -d '{"first":  
> "Lawrence","last":"Mark"}'  
> curl -X POST "[http://localhost:9200/search/document/](http://localhost:9200/search/document/)" -d '{"first":"Louis"  
> ,"last":"Mark"}'  
> curl -X POST "[http://localhost:9200/search/document/](http://localhost:9200/search/document/)" -d '{"first":  
> "Leighton","last":"Mark"}'  
> curl -X POST "[http://localhost:9200/search/document/](http://localhost:9200/search/document/)" -d '{"first":  
> "Leighton","last":"Sweet"}'  
> curl -X POST "[http://localhost:9200/search/\_refresh](http://localhost:9200/search/_refresh)"
> 
> curl -X GET '[http://localhost:9200/search/\_search?pretty](http://localhost:9200/search/_search?pretty)' -d '{  
> "query": {  
> "query\_string": {  
> "query": "Mark Leighton"  
> }  
> }  
> }'
> 
> _RESULTS:_ ["Leighton Mark", "Louis Mark", "Kimberly Leighton", "Barbara  
> Leighton", "John Leighton", "Nancy Mark", "Lawrence Mark", "Leighton Sweet"]
> 
> _I run the same excact code again and the results are different_  
> \*  
> \*  
> \*  
> \*  
> curl -X DELETE [http://localhost:9200/search](http://localhost:9200/search)  
> curl -X POST [http://localhost:9200/search](http://localhost:9200/search) -d '{  
> "mappings": {  
> "document": {  
> "properties": {  
> "first": {  
> "type": "string"  
> },  
> "last": {  
> "type": "string",  
> "boost": 2.0  
> }  
> }  
> }  
> }  
> }'
> 
> curl -X POST "[http://localhost:9200/search/document/](http://localhost:9200/search/document/)" -d '{"first":  
> "Kimberly","last":"Leighton"}'  
> curl -X POST "[http://localhost:9200/search/document/](http://localhost:9200/search/document/)" -d '{"first":  
> "Barbara","last":"Leighton"}'  
> curl -X POST "[http://localhost:9200/search/document/](http://localhost:9200/search/document/)" -d '{"first":"John",  
> "last":"Leighton"}'  
> curl -X POST "[http://localhost:9200/search/document/](http://localhost:9200/search/document/)" -d '{"first":"Nancy"  
> ,"last":"Mark"}'  
> curl -X POST "[http://localhost:9200/search/document/](http://localhost:9200/search/document/)" -d '{"first":  
> "Lawrence","last":"Mark"}'  
> curl -X POST "[http://localhost:9200/search/document/](http://localhost:9200/search/document/)" -d '{"first":"Louis"  
> ,"last":"Mark"}'  
> curl -X POST "[http://localhost:9200/search/document/](http://localhost:9200/search/document/)" -d '{"first":  
> "Leighton","last":"Mark"}'  
> curl -X POST "[http://localhost:9200/search/document/](http://localhost:9200/search/document/)" -d '{"first":  
> "Leighton","last":"Sweet"}'  
> curl -X POST "[http://localhost:9200/search/\_refresh](http://localhost:9200/search/_refresh)"
> 
> curl -X GET '[http://localhost:9200/search/\_search?pretty](http://localhost:9200/search/_search?pretty)' -d '{  
> "query": {  
> "query\_string": {  
> "query": "Mark Leighton"  
> }  
> }  
> }'
> 
> _RESULTS:_ ["Nancy Mark", "Leighton Mark", "Lawrence Mark", "Louis Mark",  
> "Leighton Sweet", "Kimberly Leighton", "Barbara Leighton", "John Leighton"]
> 
> The first time the top results was "Leighton Mark" as it should be because  
> it matches both terms. The same query seconds later returns a different  
> search result.
> 
> Is scoring broken in Elasticsearch/Lucene?
> 
> Thank you.

--  
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:** ![benjamin\_leviant](https://avatars.discourse-cdn.com/v4/letter/b/919ad9/32.png) [@benjamin\_leviant](https://discuss.elastic.co/u/benjamin_leviant)\
**Post date:** [March 1, 2013, 8:34am UTC](https://discuss.elastic.co/t/elasticsearch-lucene-scoring-broken/10961/6 "2013-03-01T08:34:33Z")

</div>

Hello,

You should try to use the search type dfs\_query\_then\_fetch. It should make  
the scoring much better on a small dataset.

More details :

> **[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.

Regards

Benjamin

On Fri, Mar 1, 2013 at 6:29 AM, Bruno Miranda [bru.miranda@gmail.com](mailto:bru.miranda@gmail.com) wrote:

> If I lower the shard count to 2, it's much more accurate, almost 100% of  
> the time. With 5 shards it falls down to about 75%.
> 
> The reason I even started looking at such small dataset is because I was  
> seeing inconsistent results when using match. Query\_string seems more  
> accurate as far as the scoring is concerned.
> 
> using query\_string I get the desired result order:
> 
> curl -X GET '[http://localhost:9200/search/\_search?pretty](http://localhost:9200/search/_search?pretty)' -d  
> '{  
> "query": {  
> "query\_string": {  
> "query": "mark leighton"  
> }  
> }  
> }'
> 
> ["Leighton Mark", "Nancy Mark", "Lawrence Mark", "Louis Mark", "Kimberly  
> Leighton", "Barbara Leighton", "John Leighton", "Leighton Sweet"]
> 
> Using match:
> 
> curl -X GET '[http://localhost:9200/search/\_search?pretty](http://localhost:9200/search/_search?pretty)' -d  
> '{  
> "query": {  
> "multi\_match": {  
> "query": "mark leighton",  
> "fields": [  
> "last",  
> "first"  
> ]  
> }  
> }  
> }'
> 
> ["Kimberly Leighton", "Barbara Leighton", "John Leighton", "Nancy Mark", "Lawrence  
> Mark", "Louis Mark", "Leighton Mark", "Leighton Sweet"]
> 
> I get the totally wrong order.
> 
> I suppose my first issue was using match when I should be using query  
> string, and the second is the dataset is too small for anything over 2  
> shards.
> 
> Any ideas?
> 
> * * *
> 
> On Thursday, February 28, 2013 7:15:13 PM UTC-8, Bruno Miranda wrote:
> 
> > I am seeing the same exact index and the same exact query return  
> > different results, could someone please help me understand?
> > 
> > curl -X DELETE [http://localhost:9200/search](http://localhost:9200/search)  
> > curl -X POST [http://localhost:9200/search](http://localhost:9200/search) -d '{  
> > "mappings": {  
> > "document": {  
> > "properties": {  
> > "first": {  
> > "type": "string"  
> > },  
> > "last": {  
> > "type": "string",  
> > "boost": 2.0  
> > }  
> > }  
> > }  
> > }  
> > }'
> > 
> > curl -X POST "[http://localhost:9200/search/\*\*document/](http://localhost:9200/search/**document/)[http://localhost:9200/search/document/](http://localhost:9200/search/document/)"  
> > -d '{"first":"Kimberly","last":"\*\*Leighton"}'  
> > curl -X POST "[http://localhost:9200/search/\*\*document/](http://localhost:9200/search/**document/)[http://localhost:9200/search/document/](http://localhost:9200/search/document/)"  
> > -d '{"first":"Barbara","last":"\*\*Leighton"}'  
> > curl -X POST "[http://localhost:9200/search/\*\*document/](http://localhost:9200/search/**document/)[http://localhost:9200/search/document/](http://localhost:9200/search/document/)"  
> > -d '{"first":"John","last":"\*\*Leighton"}'  
> > curl -X POST "[http://localhost:9200/search/\*\*document/](http://localhost:9200/search/**document/)[http://localhost:9200/search/document/](http://localhost:9200/search/document/)"  
> > -d '{"first":"Nancy","last":"\*\*Mark"}'  
> > curl -X POST "[http://localhost:9200/search/\*\*document/](http://localhost:9200/search/**document/)[http://localhost:9200/search/document/](http://localhost:9200/search/document/)"  
> > -d '{"first":"Lawrence","last":"\*\*Mark"}'  
> > curl -X POST "[http://localhost:9200/search/\*\*document/](http://localhost:9200/search/**document/)[http://localhost:9200/search/document/](http://localhost:9200/search/document/)"  
> > -d '{"first":"Louis","last":"\*\*Mark"}'  
> > curl -X POST "[http://localhost:9200/search/\*\*document/](http://localhost:9200/search/**document/)[http://localhost:9200/search/document/](http://localhost:9200/search/document/)"  
> > -d '{"first":"Leighton","last":"\*\*Mark"}'  
> > curl -X POST "[http://localhost:9200/search/\*\*document/](http://localhost:9200/search/**document/)[http://localhost:9200/search/document/](http://localhost:9200/search/document/)"  
> > -d '{"first":"Leighton","last":"\*\*Sweet"}'  
> > curl -X POST "[http://localhost:9200/search/\*\*\_refresh](http://localhost:9200/search/**_refresh)[http://localhost:9200/search/\_refresh](http://localhost:9200/search/_refresh)  
> > "
> > 
> > curl -X GET '[http://localhost:9200/search/\*\*\_search?pretty](http://localhost:9200/search/**_search?pretty)' -d '{  
> > "query": {  
> > "query\_string": {  
> > "query": "Mark Leighton"  
> > }  
> > }  
> > }'
> > 
> > _RESULTS:_ ["Leighton Mark", "Louis Mark", "Kimberly Leighton", "Barbara  
> > Leighton", "John Leighton", "Nancy Mark", "Lawrence Mark", "Leighton Sweet"]
> > 
> > _I run the same excact code again and the results are different_  
> > \*  
> > \*  
> > \*  
> > \*  
> > curl -X DELETE [http://localhost:9200/search](http://localhost:9200/search)  
> > curl -X POST [http://localhost:9200/search](http://localhost:9200/search) -d '{  
> > "mappings": {  
> > "document": {  
> > "properties": {  
> > "first": {  
> > "type": "string"  
> > },  
> > "last": {  
> > "type": "string",  
> > "boost": 2.0  
> > }  
> > }  
> > }  
> > }  
> > }'
> > 
> > curl -X POST "[http://localhost:9200/search/\*\*document/](http://localhost:9200/search/**document/)[http://localhost:9200/search/document/](http://localhost:9200/search/document/)"  
> > -d '{"first":"Kimberly","last":"\*\*Leighton"}'  
> > curl -X POST "[http://localhost:9200/search/\*\*document/](http://localhost:9200/search/**document/)[http://localhost:9200/search/document/](http://localhost:9200/search/document/)"  
> > -d '{"first":"Barbara","last":"\*\*Leighton"}'  
> > curl -X POST "[http://localhost:9200/search/\*\*document/](http://localhost:9200/search/**document/)[http://localhost:9200/search/document/](http://localhost:9200/search/document/)"  
> > -d '{"first":"John","last":"\*\*Leighton"}'  
> > curl -X POST "[http://localhost:9200/search/\*\*document/](http://localhost:9200/search/**document/)[http://localhost:9200/search/document/](http://localhost:9200/search/document/)"  
> > -d '{"first":"Nancy","last":"\*\*Mark"}'  
> > curl -X POST "[http://localhost:9200/search/\*\*document/](http://localhost:9200/search/**document/)[http://localhost:9200/search/document/](http://localhost:9200/search/document/)"  
> > -d '{"first":"Lawrence","last":"\*\*Mark"}'  
> > curl -X POST "[http://localhost:9200/search/\*\*document/](http://localhost:9200/search/**document/)[http://localhost:9200/search/document/](http://localhost:9200/search/document/)"  
> > -d '{"first":"Louis","last":"\*\*Mark"}'  
> > curl -X POST "[http://localhost:9200/search/\*\*document/](http://localhost:9200/search/**document/)[http://localhost:9200/search/document/](http://localhost:9200/search/document/)"  
> > -d '{"first":"Leighton","last":"\*\*Mark"}'  
> > curl -X POST "[http://localhost:9200/search/\*\*document/](http://localhost:9200/search/**document/)[http://localhost:9200/search/document/](http://localhost:9200/search/document/)"  
> > -d '{"first":"Leighton","last":"\*\*Sweet"}'  
> > curl -X POST "[http://localhost:9200/search/\*\*\_refresh](http://localhost:9200/search/**_refresh)[http://localhost:9200/search/\_refresh](http://localhost:9200/search/_refresh)  
> > "
> > 
> > curl -X GET '[http://localhost:9200/search/\*\*\_search?pretty](http://localhost:9200/search/**_search?pretty)' -d '{  
> > "query": {  
> > "query\_string": {  
> > "query": "Mark Leighton"  
> > }  
> > }  
> > }'
> > 
> > _RESULTS:_ ["Nancy Mark", "Leighton Mark", "Lawrence Mark", "Louis  
> > Mark", "Leighton Sweet", "Kimberly Leighton", "Barbara Leighton", "John  
> > Leighton"]
> > 
> > The first time the top results was "Leighton Mark" as it should be  
> > because it matches both terms. The same query seconds later returns a  
> > different search result.
> > 
> > Is scoring broken in Elasticsearch/Lucene?
> > 
> > Thank you.
> 
> --  
> 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:** ![simonw\_2](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/simonw_2/32/1130_2.png) [@simonw\_2](https://discuss.elastic.co/u/simonw_2)\
**Post date:** [March 1, 2013, 9:18am UTC](https://discuss.elastic.co/t/elasticsearch-lucene-scoring-broken/10961/7 "2013-03-01T09:18:24Z")

</div>

Hey,

On Friday, March 1, 2013 6:29:02 AM UTC+1, Bruno Miranda wrote:

> If I lower the shard count to 2, it's much more accurate, almost 100% of  
> the time. With 5 shards it falls down to about 75%.
> 
> The reason I even started looking at such small dataset is because I was  
> seeing inconsistent results when using match. Query\_string seems more  
> accurate as far as the scoring is concerned.
> 
> using query\_string I get the desired result order:

if you just use query\_sting without a field you search on \_all and you will  
get the right matches since both clauses ("mark" & "leighton") of the  
boolean query match

> curl -X GET '[http://localhost:9200/search/\_search?pretty](http://localhost:9200/search/_search?pretty)' -d '{  
> "query": {  
> "query\_string": {  
> "query": "mark leighton"  
> }  
> }  
> }'
> 
> ["Leighton Mark", "Nancy Mark", "Lawrence Mark", "Louis Mark", "Kimberly  
> Leighton", "Barbara Leighton", "John Leighton", "Leighton Sweet"]
> 
> Using match:

if you do multi\_match it will automatically build a dismax query which  
looks like this:

dismax(  
boolean(last:mark, last:leighton),  
boolean(first:mark, first:leighton),  
)

which will use the score the max scoring boolean in the dismax + some  
tiebreaker.  
try to use use\_dis\_max = false in the multi\_match query to make the top  
level a boolean query this should bring up better results

simon

> curl -X GET '[http://localhost:9200/search/\_search?pretty](http://localhost:9200/search/_search?pretty)' -d '{  
> "query": {  
> "multi\_match": {  
> "query": "mark leighton",  
> "fields": [  
> "last",  
> "first"  
> ]  
> }  
> }  
> }'
> 
> ["Kimberly Leighton", "Barbara Leighton", "John Leighton", "Nancy Mark", "Lawrence  
> Mark", "Louis Mark", "Leighton Mark", "Leighton Sweet"]
> 
> I get the totally wrong order.
> 
> I suppose my first issue was using match when I should be using query  
> string, and the second is the dataset is too small for anything over 2  
> shards.
> 
> Any ideas?
> 
> * * *
> 
> On Thursday, February 28, 2013 7:15:13 PM UTC-8, Bruno Miranda wrote:
> 
> > I am seeing the same exact index and the same exact query return  
> > different results, could someone please help me understand?
> > 
> > curl -X DELETE [http://localhost:9200/search](http://localhost:9200/search)  
> > curl -X POST [http://localhost:9200/search](http://localhost:9200/search) -d '{  
> > "mappings": {  
> > "document": {  
> > "properties": {  
> > "first": {  
> > "type": "string"  
> > },  
> > "last": {  
> > "type": "string",  
> > "boost": 2.0  
> > }  
> > }  
> > }  
> > }  
> > }'
> > 
> > curl -X POST "[http://localhost:9200/search/document/](http://localhost:9200/search/document/)" -d '{"first":  
> > "Kimberly","last":"Leighton"}'  
> > curl -X POST "[http://localhost:9200/search/document/](http://localhost:9200/search/document/)" -d '{"first":  
> > "Barbara","last":"Leighton"}'  
> > curl -X POST "[http://localhost:9200/search/document/](http://localhost:9200/search/document/)" -d '{"first":"John"  
> > ,"last":"Leighton"}'  
> > curl -X POST "[http://localhost:9200/search/document/](http://localhost:9200/search/document/)" -d '{"first":  
> > "Nancy","last":"Mark"}'  
> > curl -X POST "[http://localhost:9200/search/document/](http://localhost:9200/search/document/)" -d '{"first":  
> > "Lawrence","last":"Mark"}'  
> > curl -X POST "[http://localhost:9200/search/document/](http://localhost:9200/search/document/)" -d '{"first":  
> > "Louis","last":"Mark"}'  
> > curl -X POST "[http://localhost:9200/search/document/](http://localhost:9200/search/document/)" -d '{"first":  
> > "Leighton","last":"Mark"}'  
> > curl -X POST "[http://localhost:9200/search/document/](http://localhost:9200/search/document/)" -d '{"first":  
> > "Leighton","last":"Sweet"}'  
> > curl -X POST "[http://localhost:9200/search/\_refresh](http://localhost:9200/search/_refresh)"
> > 
> > curl -X GET '[http://localhost:9200/search/\_search?pretty](http://localhost:9200/search/_search?pretty)' -d '{  
> > "query": {  
> > "query\_string": {  
> > "query": "Mark Leighton"  
> > }  
> > }  
> > }'
> > 
> > _RESULTS:_ ["Leighton Mark", "Louis Mark", "Kimberly Leighton", "Barbara  
> > Leighton", "John Leighton", "Nancy Mark", "Lawrence Mark", "Leighton Sweet"]
> > 
> > _I run the same excact code again and the results are different_  
> > \*  
> > \*  
> > \*  
> > \*  
> > curl -X DELETE [http://localhost:9200/search](http://localhost:9200/search)  
> > curl -X POST [http://localhost:9200/search](http://localhost:9200/search) -d '{  
> > "mappings": {  
> > "document": {  
> > "properties": {  
> > "first": {  
> > "type": "string"  
> > },  
> > "last": {  
> > "type": "string",  
> > "boost": 2.0  
> > }  
> > }  
> > }  
> > }  
> > }'
> > 
> > curl -X POST "[http://localhost:9200/search/document/](http://localhost:9200/search/document/)" -d '{"first":  
> > "Kimberly","last":"Leighton"}'  
> > curl -X POST "[http://localhost:9200/search/document/](http://localhost:9200/search/document/)" -d '{"first":  
> > "Barbara","last":"Leighton"}'  
> > curl -X POST "[http://localhost:9200/search/document/](http://localhost:9200/search/document/)" -d '{"first":"John"  
> > ,"last":"Leighton"}'  
> > curl -X POST "[http://localhost:9200/search/document/](http://localhost:9200/search/document/)" -d '{"first":  
> > "Nancy","last":"Mark"}'  
> > curl -X POST "[http://localhost:9200/search/document/](http://localhost:9200/search/document/)" -d '{"first":  
> > "Lawrence","last":"Mark"}'  
> > curl -X POST "[http://localhost:9200/search/document/](http://localhost:9200/search/document/)" -d '{"first":  
> > "Louis","last":"Mark"}'  
> > curl -X POST "[http://localhost:9200/search/document/](http://localhost:9200/search/document/)" -d '{"first":  
> > "Leighton","last":"Mark"}'  
> > curl -X POST "[http://localhost:9200/search/document/](http://localhost:9200/search/document/)" -d '{"first":  
> > "Leighton","last":"Sweet"}'  
> > curl -X POST "[http://localhost:9200/search/\_refresh](http://localhost:9200/search/_refresh)"
> > 
> > curl -X GET '[http://localhost:9200/search/\_search?pretty](http://localhost:9200/search/_search?pretty)' -d '{  
> > "query": {  
> > "query\_string": {  
> > "query": "Mark Leighton"  
> > }  
> > }  
> > }'
> > 
> > _RESULTS:_ ["Nancy Mark", "Leighton Mark", "Lawrence Mark", "Louis  
> > Mark", "Leighton Sweet", "Kimberly Leighton", "Barbara Leighton", "John  
> > Leighton"]
> > 
> > The first time the top results was "Leighton Mark" as it should be  
> > because it matches both terms. The same query seconds later returns a  
> > different search result.
> > 
> > Is scoring broken in Elasticsearch/Lucene?
> > 
> > Thank you.

--  
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:** ![Bruno\_Miranda](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/bruno_miranda/32/746_2.png) [@Bruno\_Miranda](https://discuss.elastic.co/u/Bruno_Miranda)\
**Post date:** [March 1, 2013, 6:09pm UTC](https://discuss.elastic.co/t/elasticsearch-lucene-scoring-broken/10961/8 "2013-03-01T18:09:37Z")

</div>

Thank you for the answers.

I found that even at 5 shards, the query\_and\_fetch was very accurate.

What made by far the biggest difference in accuracy of sorting was the  
user\_dis\_max: false.

{  
"query": {  
"multi\_match": {  
"query": "Leighton Mark",  
"use\_dis\_max": true,  
"fields": [  
"first",  
"last"  
]  
}  
},  
"size": 10  
}

On Friday, March 1, 2013 1:18:24 AM UTC-8, simonw wrote:

> Hey,
> 
> On Friday, March 1, 2013 6:29:02 AM UTC+1, Bruno Miranda wrote:
> 
> > If I lower the shard count to 2, it's much more accurate, almost 100% of  
> > the time. With 5 shards it falls down to about 75%.
> > 
> > The reason I even started looking at such small dataset is because I was  
> > seeing inconsistent results when using match. Query\_string seems more  
> > accurate as far as the scoring is concerned.
> > 
> > using query\_string I get the desired result order:
> 
> if you just use query\_sting without a field you search on \_all and you  
> will get the right matches since both clauses ("mark" & "leighton") of the  
> boolean query match
> 
> > curl -X GET '[http://localhost:9200/search/\_search?pretty](http://localhost:9200/search/_search?pretty)' -d '{  
> > "query": {  
> > "query\_string": {  
> > "query": "mark leighton"  
> > }  
> > }  
> > }'
> > 
> > ["Leighton Mark", "Nancy Mark", "Lawrence Mark", "Louis Mark", "Kimberly  
> > Leighton", "Barbara Leighton", "John Leighton", "Leighton Sweet"]
> > 
> > Using match:
> 
> if you do multi\_match it will automatically build a dismax query which  
> looks like this:
> 
> dismax(  
> boolean(last:mark, last:leighton),  
> boolean(first:mark, first:leighton),  
> )
> 
> which will use the score the max scoring boolean in the dismax + some  
> tiebreaker.  
> try to use use\_dis\_max = false in the multi\_match query to make the top  
> level a boolean query this should bring up better results
> 
> simon
> 
> > curl -X GET '[http://localhost:9200/search/\_search?pretty](http://localhost:9200/search/_search?pretty)' -d '{  
> > "query": {  
> > "multi\_match": {  
> > "query": "mark leighton",  
> > "fields": [  
> > "last",  
> > "first"  
> > ]  
> > }  
> > }  
> > }'
> > 
> > ["Kimberly Leighton", "Barbara Leighton", "John Leighton", "Nancy Mark", "Lawrence  
> > Mark", "Louis Mark", "Leighton Mark", "Leighton Sweet"]
> > 
> > I get the totally wrong order.
> > 
> > I suppose my first issue was using match when I should be using query  
> > string, and the second is the dataset is too small for anything over 2  
> > shards.
> > 
> > Any ideas?
> > 
> > * * *
> > 
> > On Thursday, February 28, 2013 7:15:13 PM UTC-8, Bruno Miranda wrote:
> > 
> > > I am seeing the same exact index and the same exact query return  
> > > different results, could someone please help me understand?
> > > 
> > > curl -X DELETE [http://localhost:9200/search](http://localhost:9200/search)  
> > > curl -X POST [http://localhost:9200/search](http://localhost:9200/search) -d '{  
> > > "mappings": {  
> > > "document": {  
> > > "properties": {  
> > > "first": {  
> > > "type": "string"  
> > > },  
> > > "last": {  
> > > "type": "string",  
> > > "boost": 2.0  
> > > }  
> > > }  
> > > }  
> > > }  
> > > }'
> > > 
> > > curl -X POST "[http://localhost:9200/search/document/](http://localhost:9200/search/document/)" -d '{"first":  
> > > "Kimberly","last":"Leighton"}'  
> > > curl -X POST "[http://localhost:9200/search/document/](http://localhost:9200/search/document/)" -d '{"first":  
> > > "Barbara","last":"Leighton"}'  
> > > curl -X POST "[http://localhost:9200/search/document/](http://localhost:9200/search/document/)" -d '{"first":  
> > > "John","last":"Leighton"}'  
> > > curl -X POST "[http://localhost:9200/search/document/](http://localhost:9200/search/document/)" -d '{"first":  
> > > "Nancy","last":"Mark"}'  
> > > curl -X POST "[http://localhost:9200/search/document/](http://localhost:9200/search/document/)" -d '{"first":  
> > > "Lawrence","last":"Mark"}'  
> > > curl -X POST "[http://localhost:9200/search/document/](http://localhost:9200/search/document/)" -d '{"first":  
> > > "Louis","last":"Mark"}'  
> > > curl -X POST "[http://localhost:9200/search/document/](http://localhost:9200/search/document/)" -d '{"first":  
> > > "Leighton","last":"Mark"}'  
> > > curl -X POST "[http://localhost:9200/search/document/](http://localhost:9200/search/document/)" -d '{"first":  
> > > "Leighton","last":"Sweet"}'  
> > > curl -X POST "[http://localhost:9200/search/\_refresh](http://localhost:9200/search/_refresh)"
> > > 
> > > curl -X GET '[http://localhost:9200/search/\_search?pretty](http://localhost:9200/search/_search?pretty)' -d '{  
> > > "query": {  
> > > "query\_string": {  
> > > "query": "Mark Leighton"  
> > > }  
> > > }  
> > > }'
> > > 
> > > _RESULTS:_ ["Leighton Mark", "Louis Mark", "Kimberly Leighton",  
> > > "Barbara Leighton", "John Leighton", "Nancy Mark", "Lawrence Mark",  
> > > "Leighton Sweet"]
> > > 
> > > _I run the same excact code again and the results are different_  
> > > \*  
> > > \*  
> > > \*  
> > > \*  
> > > curl -X DELETE [http://localhost:9200/search](http://localhost:9200/search)  
> > > curl -X POST [http://localhost:9200/search](http://localhost:9200/search) -d '{  
> > > "mappings": {  
> > > "document": {  
> > > "properties": {  
> > > "first": {  
> > > "type": "string"  
> > > },  
> > > "last": {  
> > > "type": "string",  
> > > "boost": 2.0  
> > > }  
> > > }  
> > > }  
> > > }  
> > > }'
> > > 
> > > curl -X POST "[http://localhost:9200/search/document/](http://localhost:9200/search/document/)" -d '{"first":  
> > > "Kimberly","last":"Leighton"}'  
> > > curl -X POST "[http://localhost:9200/search/document/](http://localhost:9200/search/document/)" -d '{"first":  
> > > "Barbara","last":"Leighton"}'  
> > > curl -X POST "[http://localhost:9200/search/document/](http://localhost:9200/search/document/)" -d '{"first":  
> > > "John","last":"Leighton"}'  
> > > curl -X POST "[http://localhost:9200/search/document/](http://localhost:9200/search/document/)" -d '{"first":  
> > > "Nancy","last":"Mark"}'  
> > > curl -X POST "[http://localhost:9200/search/document/](http://localhost:9200/search/document/)" -d '{"first":  
> > > "Lawrence","last":"Mark"}'  
> > > curl -X POST "[http://localhost:9200/search/document/](http://localhost:9200/search/document/)" -d '{"first":  
> > > "Louis","last":"Mark"}'  
> > > curl -X POST "[http://localhost:9200/search/document/](http://localhost:9200/search/document/)" -d '{"first":  
> > > "Leighton","last":"Mark"}'  
> > > curl -X POST "[http://localhost:9200/search/document/](http://localhost:9200/search/document/)" -d '{"first":  
> > > "Leighton","last":"Sweet"}'  
> > > curl -X POST "[http://localhost:9200/search/\_refresh](http://localhost:9200/search/_refresh)"
> > > 
> > > curl -X GET '[http://localhost:9200/search/\_search?pretty](http://localhost:9200/search/_search?pretty)' -d '{  
> > > "query": {  
> > > "query\_string": {  
> > > "query": "Mark Leighton"  
> > > }  
> > > }  
> > > }'
> > > 
> > > _RESULTS:_ ["Nancy Mark", "Leighton Mark", "Lawrence Mark", "Louis  
> > > Mark", "Leighton Sweet", "Kimberly Leighton", "Barbara Leighton", "John  
> > > Leighton"]
> > > 
> > > The first time the top results was "Leighton Mark" as it should be  
> > > because it matches both terms. The same query seconds later returns a  
> > > different search result.
> > > 
> > > Is scoring broken in Elasticsearch/Lucene?
> > > 
> > > Thank you.

--  
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:** [March 1, 2013, 6:45pm UTC](https://discuss.elastic.co/t/elasticsearch-lucene-scoring-broken/10961/9 "2013-03-01T18:45:21Z")

</div>

I can almost assure you that eventually you will not want query\_and\_fetch  
once you start to have real data.

I was so focused on scoring that I missed the facet you were using the \_all  
field. As you discovered, Simon had the best suggestion so far.

--  
Ivan

On Fri, Mar 1, 2013 at 10:09 AM, Bruno Miranda [bru.miranda@gmail.com](mailto:bru.miranda@gmail.com)wrote:

> Thank you for the answers.
> 
> I found that even at 5 shards, the query\_and\_fetch was very accurate.
> 
> What made by far the biggest difference in accuracy of sorting was the  
> user\_dis\_max: false.
> 
> {  
> "query": {  
> "multi\_match": {  
> "query": "Leighton Mark",  
> "use\_dis\_max": true,  
> "fields": [  
> "first",  
> "last"  
> ]  
> }  
> },  
> "size": 10  
> }
> 
> On Friday, March 1, 2013 1:18:24 AM UTC-8, simonw wrote:
> 
> > Hey,
> > 
> > On Friday, March 1, 2013 6:29:02 AM UTC+1, Bruno Miranda wrote:
> > 
> > > If I lower the shard count to 2, it's much more accurate, almost 100% of  
> > > the time. With 5 shards it falls down to about 75%.
> > > 
> > > The reason I even started looking at such small dataset is because I was  
> > > seeing inconsistent results when using match. Query\_string seems more  
> > > accurate as far as the scoring is concerned.
> > > 
> > > using query\_string I get the desired result order:
> > 
> > if you just use query\_sting without a field you search on \_all and you  
> > will get the right matches since both clauses ("mark" & "leighton") of the  
> > boolean query match
> > 
> > > curl -X GET '[http://localhost:9200/search/\*\*\_search?pretty](http://localhost:9200/search/**_search?pretty)[http://localhost:9200/search/\_search?pretty](http://localhost:9200/search/_search?pretty)  
> > > ' -d '{  
> > > "query": {  
> > > "query\_string": {  
> > > "query": "mark leighton"  
> > > }  
> > > }  
> > > }'
> > > 
> > > ["Leighton Mark", "Nancy Mark", "Lawrence Mark", "Louis Mark", "Kimberly  
> > > Leighton", "Barbara Leighton", "John Leighton", "Leighton Sweet"]
> > > 
> > > Using match:
> > 
> > if you do multi\_match it will automatically build a dismax query which  
> > looks like this:
> > 
> > dismax(  
> > boolean(last:mark, last:leighton),  
> > boolean(first:mark, first:leighton),  
> > )
> > 
> > which will use the score the max scoring boolean in the dismax + some  
> > tiebreaker.  
> > try to use use\_dis\_max = false in the multi\_match query to make the  
> > top level a boolean query this should bring up better results
> > 
> > simon
> > 
> > > curl -X GET '[http://localhost:9200/search/\*\*\_search?pretty](http://localhost:9200/search/**_search?pretty)[http://localhost:9200/search/\_search?pretty](http://localhost:9200/search/_search?pretty)  
> > > ' -d '{  
> > > "query": {  
> > > "multi\_match": {  
> > > "query": "mark leighton",  
> > > "fields": [  
> > > "last",  
> > > "first"  
> > > ]  
> > > }  
> > > }  
> > > }'
> > > 
> > > ["Kimberly Leighton", "Barbara Leighton", "John Leighton", "Nancy Mark", "Lawrence  
> > > Mark", "Louis Mark", "Leighton Mark", "Leighton Sweet"]
> > > 
> > > I get the totally wrong order.
> > > 
> > > I suppose my first issue was using match when I should be using query  
> > > string, and the second is the dataset is too small for anything over 2  
> > > shards.
> > > 
> > > Any ideas?
> > > 
> > > ------------------------------\*\*--
> > > 
> > > On Thursday, February 28, 2013 7:15:13 PM UTC-8, Bruno Miranda wrote:
> > > 
> > > > I am seeing the same exact index and the same exact query return  
> > > > different results, could someone please help me understand?
> > > > 
> > > > curl -X DELETE [http://localhost:9200/search](http://localhost:9200/search)  
> > > > curl -X POST [http://localhost:9200/search](http://localhost:9200/search) -d '{  
> > > > "mappings": {  
> > > > "document": {  
> > > > "properties": {  
> > > > "first": {  
> > > > "type": "string"  
> > > > },  
> > > > "last": {  
> > > > "type": "string",  
> > > > "boost": 2.0  
> > > > }  
> > > > }  
> > > > }  
> > > > }  
> > > > }'
> > > > 
> > > > curl -X POST "[http://localhost:9200/search/\*\*document/](http://localhost:9200/search/**document/)[http://localhost:9200/search/document/](http://localhost:9200/search/document/)"  
> > > > -d '{"first":"Kimberly","last":"\*\*Leighton"}'  
> > > > curl -X POST "[http://localhost:9200/search/\*\*document/](http://localhost:9200/search/**document/)[http://localhost:9200/search/document/](http://localhost:9200/search/document/)"  
> > > > -d '{"first":"Barbara","last":"\*\*Leighton"}'  
> > > > curl -X POST "[http://localhost:9200/search/\*\*document/](http://localhost:9200/search/**document/)[http://localhost:9200/search/document/](http://localhost:9200/search/document/)"  
> > > > -d '{"first":"John","last":"\*\*Leighton"}'  
> > > > curl -X POST "[http://localhost:9200/search/\*\*document/](http://localhost:9200/search/**document/)[http://localhost:9200/search/document/](http://localhost:9200/search/document/)"  
> > > > -d '{"first":"Nancy","last":"\*\*Mark"}'  
> > > > curl -X POST "[http://localhost:9200/search/\*\*document/](http://localhost:9200/search/**document/)[http://localhost:9200/search/document/](http://localhost:9200/search/document/)"  
> > > > -d '{"first":"Lawrence","last":"\*\*Mark"}'  
> > > > curl -X POST "[http://localhost:9200/search/\*\*document/](http://localhost:9200/search/**document/)[http://localhost:9200/search/document/](http://localhost:9200/search/document/)"  
> > > > -d '{"first":"Louis","last":"\*\*Mark"}'  
> > > > curl -X POST "[http://localhost:9200/search/\*\*document/](http://localhost:9200/search/**document/)[http://localhost:9200/search/document/](http://localhost:9200/search/document/)"  
> > > > -d '{"first":"Leighton","last":"\*\*Mark"}'  
> > > > curl -X POST "[http://localhost:9200/search/\*\*document/](http://localhost:9200/search/**document/)[http://localhost:9200/search/document/](http://localhost:9200/search/document/)"  
> > > > -d '{"first":"Leighton","last":"\*\*Sweet"}'  
> > > > curl -X POST "[http://localhost:9200/search/\*\*\_refresh](http://localhost:9200/search/**_refresh)[http://localhost:9200/search/\_refresh](http://localhost:9200/search/_refresh)  
> > > > "
> > > > 
> > > > curl -X GET '[http://localhost:9200/search/\*\*\_search?pretty](http://localhost:9200/search/**_search?pretty)' -d '{  
> > > > "query": {  
> > > > "query\_string": {  
> > > > "query": "Mark Leighton"  
> > > > }  
> > > > }  
> > > > }'
> > > > 
> > > > _RESULTS:_ ["Leighton Mark", "Louis Mark", "Kimberly Leighton",  
> > > > "Barbara Leighton", "John Leighton", "Nancy Mark", "Lawrence Mark",  
> > > > "Leighton Sweet"]
> > > > 
> > > > _I run the same excact code again and the results are different_  
> > > > \*  
> > > > \*  
> > > > \*  
> > > > \*  
> > > > curl -X DELETE [http://localhost:9200/search](http://localhost:9200/search)  
> > > > curl -X POST [http://localhost:9200/search](http://localhost:9200/search) -d '{  
> > > > "mappings": {  
> > > > "document": {  
> > > > "properties": {  
> > > > "first": {  
> > > > "type": "string"  
> > > > },  
> > > > "last": {  
> > > > "type": "string",  
> > > > "boost": 2.0  
> > > > }  
> > > > }  
> > > > }  
> > > > }  
> > > > }'
> > > > 
> > > > curl -X POST "[http://localhost:9200/search/\*\*document/](http://localhost:9200/search/**document/)[http://localhost:9200/search/document/](http://localhost:9200/search/document/)"  
> > > > -d '{"first":"Kimberly","last":"\*\*Leighton"}'  
> > > > curl -X POST "[http://localhost:9200/search/\*\*document/](http://localhost:9200/search/**document/)[http://localhost:9200/search/document/](http://localhost:9200/search/document/)"  
> > > > -d '{"first":"Barbara","last":"\*\*Leighton"}'  
> > > > curl -X POST "[http://localhost:9200/search/\*\*document/](http://localhost:9200/search/**document/)[http://localhost:9200/search/document/](http://localhost:9200/search/document/)"  
> > > > -d '{"first":"John","last":"\*\*Leighton"}'  
> > > > curl -X POST "[http://localhost:9200/search/\*\*document/](http://localhost:9200/search/**document/)[http://localhost:9200/search/document/](http://localhost:9200/search/document/)"  
> > > > -d '{"first":"Nancy","last":"\*\*Mark"}'  
> > > > curl -X POST "[http://localhost:9200/search/\*\*document/](http://localhost:9200/search/**document/)[http://localhost:9200/search/document/](http://localhost:9200/search/document/)"  
> > > > -d '{"first":"Lawrence","last":"\*\*Mark"}'  
> > > > curl -X POST "[http://localhost:9200/search/\*\*document/](http://localhost:9200/search/**document/)[http://localhost:9200/search/document/](http://localhost:9200/search/document/)"  
> > > > -d '{"first":"Louis","last":"\*\*Mark"}'  
> > > > curl -X POST "[http://localhost:9200/search/\*\*document/](http://localhost:9200/search/**document/)[http://localhost:9200/search/document/](http://localhost:9200/search/document/)"  
> > > > -d '{"first":"Leighton","last":"\*\*Mark"}'  
> > > > curl -X POST "[http://localhost:9200/search/\*\*document/](http://localhost:9200/search/**document/)[http://localhost:9200/search/document/](http://localhost:9200/search/document/)"  
> > > > -d '{"first":"Leighton","last":"\*\*Sweet"}'  
> > > > curl -X POST "[http://localhost:9200/search/\*\*\_refresh](http://localhost:9200/search/**_refresh)[http://localhost:9200/search/\_refresh](http://localhost:9200/search/_refresh)  
> > > > "
> > > > 
> > > > curl -X GET '[http://localhost:9200/search/\*\*\_search?pretty](http://localhost:9200/search/**_search?pretty)' -d '{  
> > > > "query": {  
> > > > "query\_string": {  
> > > > "query": "Mark Leighton"  
> > > > }  
> > > > }  
> > > > }'
> > > > 
> > > > _RESULTS:_ ["Nancy Mark", "Leighton Mark", "Lawrence Mark", "Louis  
> > > > Mark", "Leighton Sweet", "Kimberly Leighton", "Barbara Leighton", "John  
> > > > Leighton"]
> > > > 
> > > > The first time the top results was "Leighton Mark" as it should be  
> > > > because it matches both terms. The same query seconds later returns a  
> > > > different search result.
> > > > 
> > > > Is scoring broken in Elasticsearch/Lucene?
> > > > 
> > > > Thank you.
> > > 
> > > --  
> > > 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:** ![Bruno\_Miranda](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/bruno_miranda/32/746_2.png) [@Bruno\_Miranda](https://discuss.elastic.co/u/Bruno_Miranda)\
**Post date:** [March 1, 2013, 6:49pm UTC](https://discuss.elastic.co/t/elasticsearch-lucene-scoring-broken/10961/10 "2013-03-01T18:49:12Z")

</div>

Makes me wonder why use\_dis\_max=false isn’t the default for multi\_match.  
Seems like most use cases would want that.

If I search for "blue sky" in fields color and location, I would always  
expect the doc that has both blue in color and sky in location to come  
first.

On Friday, March 1, 2013 10:45:21 AM UTC-8, Ivan Brusic wrote:

> I can almost assure you that eventually you will not want query\_and\_fetch  
> once you start to have real data.
> 
> I was so focused on scoring that I missed the facet you were using the  
> \_all field. As you discovered, Simon had the best suggestion so far.
> 
> --  
> Ivan
> 
> On Fri, Mar 1, 2013 at 10:09 AM, Bruno Miranda \<[bru.m...@gmail.com](mailto:bru.m...@gmail.com)\<javascript:\>
> 
> > wrote:
> 
> > Thank you for the answers.
> > 
> > I found that even at 5 shards, the query\_and\_fetch was very accurate.
> > 
> > What made by far the biggest difference in accuracy of sorting was the  
> > user\_dis\_max: false.
> > 
> > {  
> > "query": {  
> > "multi\_match": {  
> > "query": "Leighton Mark",  
> > "use\_dis\_max": true,  
> > "fields": [  
> > "first",  
> > "last"  
> > ]  
> > }  
> > },  
> > "size": 10  
> > }
> > 
> > On Friday, March 1, 2013 1:18:24 AM UTC-8, simonw wrote:
> > 
> > > Hey,
> > > 
> > > On Friday, March 1, 2013 6:29:02 AM UTC+1, Bruno Miranda wrote:
> > > 
> > > > If I lower the shard count to 2, it's much more accurate, almost 100%  
> > > > of the time. With 5 shards it falls down to about 75%.
> > > > 
> > > > The reason I even started looking at such small dataset is because I  
> > > > was seeing inconsistent results when using match. Query\_string seems more  
> > > > accurate as far as the scoring is concerned.
> > > > 
> > > > using query\_string I get the desired result order:
> > > 
> > > if you just use query\_sting without a field you search on \_all and you  
> > > will get the right matches since both clauses ("mark" & "leighton") of the  
> > > boolean query match
> > > 
> > > > curl -X GET '[http://localhost:9200/search/\*\*\_search?pretty](http://localhost:9200/search/**_search?pretty)[http://localhost:9200/search/\_search?pretty](http://localhost:9200/search/_search?pretty)  
> > > > ' -d '{  
> > > > "query": {  
> > > > "query\_string": {  
> > > > "query": "mark leighton"  
> > > > }  
> > > > }  
> > > > }'
> > > > 
> > > > ["Leighton Mark", "Nancy Mark", "Lawrence Mark", "Louis Mark", "Kimberly  
> > > > Leighton", "Barbara Leighton", "John Leighton", "Leighton Sweet"]
> > > > 
> > > > Using match:
> > > 
> > > if you do multi\_match it will automatically build a dismax query which  
> > > looks like this:
> > > 
> > > dismax(  
> > > boolean(last:mark, last:leighton),  
> > > boolean(first:mark, first:leighton),  
> > > )
> > > 
> > > which will use the score the max scoring boolean in the dismax + some  
> > > tiebreaker.  
> > > try to use use\_dis\_max = false in the multi\_match query to make the  
> > > top level a boolean query this should bring up better results
> > > 
> > > simon
> > > 
> > > > curl -X GET '[http://localhost:9200/search/\*\*\_search?pretty](http://localhost:9200/search/**_search?pretty)[http://localhost:9200/search/\_search?pretty](http://localhost:9200/search/_search?pretty)  
> > > > ' -d '{  
> > > > "query": {  
> > > > "multi\_match": {  
> > > > "query": "mark leighton",  
> > > > "fields": [  
> > > > "last",  
> > > > "first"  
> > > > ]  
> > > > }  
> > > > }  
> > > > }'
> > > > 
> > > > ["Kimberly Leighton", "Barbara Leighton", "John Leighton", "Nancy Mark"  
> > > > , "Lawrence Mark", "Louis Mark", "Leighton Mark", "Leighton Sweet"]
> > > > 
> > > > I get the totally wrong order.
> > > > 
> > > > I suppose my first issue was using match when I should be using query  
> > > > string, and the second is the dataset is too small for anything over 2  
> > > > shards.
> > > > 
> > > > Any ideas?
> > > > 
> > > > ------------------------------\*\*--
> > > > 
> > > > On Thursday, February 28, 2013 7:15:13 PM UTC-8, Bruno Miranda wrote:
> > > > 
> > > > > I am seeing the same exact index and the same exact query return  
> > > > > different results, could someone please help me understand?
> > > > > 
> > > > > curl -X DELETE [http://localhost:9200/search](http://localhost:9200/search)  
> > > > > curl -X POST [http://localhost:9200/search](http://localhost:9200/search) -d '{  
> > > > > "mappings": {  
> > > > > "document": {  
> > > > > "properties": {  
> > > > > "first": {  
> > > > > "type": "string"  
> > > > > },  
> > > > > "last": {  
> > > > > "type": "string",  
> > > > > "boost": 2.0  
> > > > > }  
> > > > > }  
> > > > > }  
> > > > > }  
> > > > > }'
> > > > > 
> > > > > curl -X POST "[http://localhost:9200/search/\*\*document/](http://localhost:9200/search/**document/)[http://localhost:9200/search/document/](http://localhost:9200/search/document/)"  
> > > > > -d '{"first":"Kimberly","last":"\*\*Leighton"}'  
> > > > > curl -X POST "[http://localhost:9200/search/\*\*document/](http://localhost:9200/search/**document/)[http://localhost:9200/search/document/](http://localhost:9200/search/document/)"  
> > > > > -d '{"first":"Barbara","last":"\*\*Leighton"}'  
> > > > > curl -X POST "[http://localhost:9200/search/\*\*document/](http://localhost:9200/search/**document/)[http://localhost:9200/search/document/](http://localhost:9200/search/document/)"  
> > > > > -d '{"first":"John","last":"\*\*Leighton"}'  
> > > > > curl -X POST "[http://localhost:9200/search/\*\*document/](http://localhost:9200/search/**document/)[http://localhost:9200/search/document/](http://localhost:9200/search/document/)"  
> > > > > -d '{"first":"Nancy","last":"\*\*Mark"}'  
> > > > > curl -X POST "[http://localhost:9200/search/\*\*document/](http://localhost:9200/search/**document/)[http://localhost:9200/search/document/](http://localhost:9200/search/document/)"  
> > > > > -d '{"first":"Lawrence","last":"\*\*Mark"}'  
> > > > > curl -X POST "[http://localhost:9200/search/\*\*document/](http://localhost:9200/search/**document/)[http://localhost:9200/search/document/](http://localhost:9200/search/document/)"  
> > > > > -d '{"first":"Louis","last":"\*\*Mark"}'  
> > > > > curl -X POST "[http://localhost:9200/search/\*\*document/](http://localhost:9200/search/**document/)[http://localhost:9200/search/document/](http://localhost:9200/search/document/)"  
> > > > > -d '{"first":"Leighton","last":"\*\*Mark"}'  
> > > > > curl -X POST "[http://localhost:9200/search/\*\*document/](http://localhost:9200/search/**document/)[http://localhost:9200/search/document/](http://localhost:9200/search/document/)"  
> > > > > -d '{"first":"Leighton","last":"\*\*Sweet"}'  
> > > > > curl -X POST "[http://localhost:9200/search/\*\*\_refresh](http://localhost:9200/search/**_refresh)[http://localhost:9200/search/\_refresh](http://localhost:9200/search/_refresh)  
> > > > > "
> > > > > 
> > > > > curl -X GET '[http://localhost:9200/search/\*\*\_search?pretty](http://localhost:9200/search/**_search?pretty)' -d '{  
> > > > > "query": {  
> > > > > "query\_string": {  
> > > > > "query": "Mark Leighton"  
> > > > > }  
> > > > > }  
> > > > > }'
> > > > > 
> > > > > _RESULTS:_ ["Leighton Mark", "Louis Mark", "Kimberly Leighton",  
> > > > > "Barbara Leighton", "John Leighton", "Nancy Mark", "Lawrence Mark",  
> > > > > "Leighton Sweet"]
> > > > > 
> > > > > _I run the same excact code again and the results are different_  
> > > > > \*  
> > > > > \*  
> > > > > \*  
> > > > > \*  
> > > > > curl -X DELETE [http://localhost:9200/search](http://localhost:9200/search)  
> > > > > curl -X POST [http://localhost:9200/search](http://localhost:9200/search) -d '{  
> > > > > "mappings": {  
> > > > > "document": {  
> > > > > "properties": {  
> > > > > "first": {  
> > > > > "type": "string"  
> > > > > },  
> > > > > "last": {  
> > > > > "type": "string",  
> > > > > "boost": 2.0  
> > > > > }  
> > > > > }  
> > > > > }  
> > > > > }  
> > > > > }'
> > > > > 
> > > > > curl -X POST "[http://localhost:9200/search/\*\*document/](http://localhost:9200/search/**document/)[http://localhost:9200/search/document/](http://localhost:9200/search/document/)"  
> > > > > -d '{"first":"Kimberly","last":"\*\*Leighton"}'  
> > > > > curl -X POST "[http://localhost:9200/search/\*\*document/](http://localhost:9200/search/**document/)[http://localhost:9200/search/document/](http://localhost:9200/search/document/)"  
> > > > > -d '{"first":"Barbara","last":"\*\*Leighton"}'  
> > > > > curl -X POST "[http://localhost:9200/search/\*\*document/](http://localhost:9200/search/**document/)[http://localhost:9200/search/document/](http://localhost:9200/search/document/)"  
> > > > > -d '{"first":"John","last":"\*\*Leighton"}'  
> > > > > curl -X POST "[http://localhost:9200/search/\*\*document/](http://localhost:9200/search/**document/)[http://localhost:9200/search/document/](http://localhost:9200/search/document/)"  
> > > > > -d '{"first":"Nancy","last":"\*\*Mark"}'  
> > > > > curl -X POST "[http://localhost:9200/search/\*\*document/](http://localhost:9200/search/**document/)[http://localhost:9200/search/document/](http://localhost:9200/search/document/)"  
> > > > > -d '{"first":"Lawrence","last":"\*\*Mark"}'  
> > > > > curl -X POST "[http://localhost:9200/search/\*\*document/](http://localhost:9200/search/**document/)[http://localhost:9200/search/document/](http://localhost:9200/search/document/)"  
> > > > > -d '{"first":"Louis","last":"\*\*Mark"}'  
> > > > > curl -X POST "[http://localhost:9200/search/\*\*document/](http://localhost:9200/search/**document/)[http://localhost:9200/search/document/](http://localhost:9200/search/document/)"  
> > > > > -d '{"first":"Leighton","last":"\*\*Mark"}'  
> > > > > curl -X POST "[http://localhost:9200/search/\*\*document/](http://localhost:9200/search/**document/)[http://localhost:9200/search/document/](http://localhost:9200/search/document/)"  
> > > > > -d '{"first":"Leighton","last":"\*\*Sweet"}'  
> > > > > curl -X POST "[http://localhost:9200/search/\*\*\_refresh](http://localhost:9200/search/**_refresh)[http://localhost:9200/search/\_refresh](http://localhost:9200/search/_refresh)  
> > > > > "
> > > > > 
> > > > > curl -X GET '[http://localhost:9200/search/\*\*\_search?pretty](http://localhost:9200/search/**_search?pretty)' -d '{  
> > > > > "query": {  
> > > > > "query\_string": {  
> > > > > "query": "Mark Leighton"  
> > > > > }  
> > > > > }  
> > > > > }'
> > > > > 
> > > > > _RESULTS:_ ["Nancy Mark", "Leighton Mark", "Lawrence Mark", "Louis  
> > > > > Mark", "Leighton Sweet", "Kimberly Leighton", "Barbara Leighton", "John  
> > > > > Leighton"]
> > > > > 
> > > > > The first time the top results was "Leighton Mark" as it should be  
> > > > > because it matches both terms. The same query seconds later returns a  
> > > > > different search result.
> > > > > 
> > > > > Is scoring broken in Elasticsearch/Lucene?
> > > > > 
> > > > > Thank you.
> > > > 
> > > > --  
> > > > 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:\>.  
> > > > 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:** ![simonw\_2](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/simonw_2/32/1130_2.png) [@simonw\_2](https://discuss.elastic.co/u/simonw_2)\
**Post date:** [March 1, 2013, 7:42pm UTC](https://discuss.elastic.co/t/elasticsearch-lucene-scoring-broken/10961/11 "2013-03-01T19:42:41Z")

</div>

On Friday, March 1, 2013 7:49:12 PM UTC+1, Bruno Miranda wrote:

> Makes me wonder why use\_dis\_max=false isn’t the default for multi\_match.  
> Seems like most use cases would want that.
> 
> If I search for "blue sky" in fields color and location, I would always  
> expect the doc that has both blue in color and sky in location to come  
> first.

Well, this is a tricky question. If you use dismax then you are discounting  
matches in fields that are "partial" or where the terms are not  
significant. Here is an example"

2 fields: artist, song  
doc 1: artist: foo fighters song: generator  
doc 2: artist: the fighters song: foo

in this case dismax does a very good job. While in your case it doesn't.  
What you want really as an additional feature is to parse the query into  
cross field dismax queries where your example becomes:  
boolean(  
dismax( color:blue, loc:blue),  
dismax( color:sky loc sky)  
)

which would make both possible which is kind of tricky since it requires  
that both fields produce roughly the same tokens. I think using dismax is a  
ok default but boolean might be more intuitive for new users.

simon

> On Friday, March 1, 2013 10:45:21 AM UTC-8, Ivan Brusic wrote:
> 
> > I can almost assure you that eventually you will not want query\_and\_fetch  
> > once you start to have real data.
> > 
> > I was so focused on scoring that I missed the facet you were using the  
> > \_all field. As you discovered, Simon had the best suggestion so far.
> > 
> > --  
> > Ivan
> > 
> > On Fri, Mar 1, 2013 at 10:09 AM, Bruno Miranda [bru.m...@gmail.com](mailto:bru.m...@gmail.com)wrote:
> > 
> > > Thank you for the answers.
> > > 
> > > I found that even at 5 shards, the query\_and\_fetch was very accurate.
> > > 
> > > What made by far the biggest difference in accuracy of sorting was the  
> > > user\_dis\_max: false.
> > > 
> > > {  
> > > "query": {  
> > > "multi\_match": {  
> > > "query": "Leighton Mark",  
> > > "use\_dis\_max": true,  
> > > "fields": [  
> > > "first",  
> > > "last"  
> > > ]  
> > > }  
> > > },  
> > > "size": 10  
> > > }
> > > 
> > > On Friday, March 1, 2013 1:18:24 AM UTC-8, simonw wrote:
> > > 
> > > > Hey,
> > > > 
> > > > On Friday, March 1, 2013 6:29:02 AM UTC+1, Bruno Miranda wrote:
> > > > 
> > > > > If I lower the shard count to 2, it's much more accurate, almost 100%  
> > > > > of the time. With 5 shards it falls down to about 75%.
> > > > > 
> > > > > The reason I even started looking at such small dataset is because I  
> > > > > was seeing inconsistent results when using match. Query\_string seems more  
> > > > > accurate as far as the scoring is concerned.
> > > > > 
> > > > > using query\_string I get the desired result order:
> > > > 
> > > > if you just use query\_sting without a field you search on \_all and you  
> > > > will get the right matches since both clauses ("mark" & "leighton") of the  
> > > > boolean query match
> > > > 
> > > > > curl -X GET '[http://localhost:9200/search/\*\*\_search?pretty](http://localhost:9200/search/**_search?pretty)[http://localhost:9200/search/\_search?pretty](http://localhost:9200/search/_search?pretty)  
> > > > > ' -d '{  
> > > > > "query": {  
> > > > > "query\_string": {  
> > > > > "query": "mark leighton"  
> > > > > }  
> > > > > }  
> > > > > }'
> > > > > 
> > > > > ["Leighton Mark", "Nancy Mark", "Lawrence Mark", "Louis Mark", "Kimberly  
> > > > > Leighton", "Barbara Leighton", "John Leighton", "Leighton Sweet"]
> > > > > 
> > > > > Using match:
> > > > 
> > > > if you do multi\_match it will automatically build a dismax query which  
> > > > looks like this:
> > > > 
> > > > dismax(  
> > > > boolean(last:mark, last:leighton),  
> > > > boolean(first:mark, first:leighton),  
> > > > )
> > > > 
> > > > which will use the score the max scoring boolean in the dismax + some  
> > > > tiebreaker.  
> > > > try to use use\_dis\_max = false in the multi\_match query to make the  
> > > > top level a boolean query this should bring up better results
> > > > 
> > > > simon
> > > > 
> > > > > curl -X GET '[http://localhost:9200/search/\*\*\_search?pretty](http://localhost:9200/search/**_search?pretty)[http://localhost:9200/search/\_search?pretty](http://localhost:9200/search/_search?pretty)  
> > > > > ' -d '{  
> > > > > "query": {  
> > > > > "multi\_match": {  
> > > > > "query": "mark leighton",  
> > > > > "fields": [  
> > > > > "last",  
> > > > > "first"  
> > > > > ]  
> > > > > }  
> > > > > }  
> > > > > }'
> > > > > 
> > > > > ["Kimberly Leighton", "Barbara Leighton", "John Leighton", "Nancy  
> > > > > Mark", "Lawrence Mark", "Louis Mark", "Leighton Mark", "Leighton  
> > > > > Sweet"]
> > > > > 
> > > > > I get the totally wrong order.
> > > > > 
> > > > > I suppose my first issue was using match when I should be using query  
> > > > > string, and the second is the dataset is too small for anything over 2  
> > > > > shards.
> > > > > 
> > > > > Any ideas?
> > > > > 
> > > > > ------------------------------\*\*--
> > > > > 
> > > > > On Thursday, February 28, 2013 7:15:13 PM UTC-8, Bruno Miranda wrote:
> > > > > 
> > > > > > I am seeing the same exact index and the same exact query return  
> > > > > > different results, could someone please help me understand?
> > > > > > 
> > > > > > curl -X DELETE [http://localhost:9200/search](http://localhost:9200/search)  
> > > > > > curl -X POST [http://localhost:9200/search](http://localhost:9200/search) -d '{  
> > > > > > "mappings": {  
> > > > > > "document": {  
> > > > > > "properties": {  
> > > > > > "first": {  
> > > > > > "type": "string"  
> > > > > > },  
> > > > > > "last": {  
> > > > > > "type": "string",  
> > > > > > "boost": 2.0  
> > > > > > }  
> > > > > > }  
> > > > > > }  
> > > > > > }  
> > > > > > }'
> > > > > > 
> > > > > > curl -X POST "[http://localhost:9200/search/\*\*document/](http://localhost:9200/search/**document/)[http://localhost:9200/search/document/](http://localhost:9200/search/document/)"  
> > > > > > -d '{"first":"Kimberly","last":"\*\*Leighton"}'  
> > > > > > curl -X POST "[http://localhost:9200/search/\*\*document/](http://localhost:9200/search/**document/)[http://localhost:9200/search/document/](http://localhost:9200/search/document/)"  
> > > > > > -d '{"first":"Barbara","last":"\*\*Leighton"}'  
> > > > > > curl -X POST "[http://localhost:9200/search/\*\*document/](http://localhost:9200/search/**document/)[http://localhost:9200/search/document/](http://localhost:9200/search/document/)"  
> > > > > > -d '{"first":"John","last":"\*\*Leighton"}'  
> > > > > > curl -X POST "[http://localhost:9200/search/\*\*document/](http://localhost:9200/search/**document/)[http://localhost:9200/search/document/](http://localhost:9200/search/document/)"  
> > > > > > -d '{"first":"Nancy","last":"\*\*Mark"}'  
> > > > > > curl -X POST "[http://localhost:9200/search/\*\*document/](http://localhost:9200/search/**document/)[http://localhost:9200/search/document/](http://localhost:9200/search/document/)"  
> > > > > > -d '{"first":"Lawrence","last":"\*\*Mark"}'  
> > > > > > curl -X POST "[http://localhost:9200/search/\*\*document/](http://localhost:9200/search/**document/)[http://localhost:9200/search/document/](http://localhost:9200/search/document/)"  
> > > > > > -d '{"first":"Louis","last":"\*\*Mark"}'  
> > > > > > curl -X POST "[http://localhost:9200/search/\*\*document/](http://localhost:9200/search/**document/)[http://localhost:9200/search/document/](http://localhost:9200/search/document/)"  
> > > > > > -d '{"first":"Leighton","last":"\*\*Mark"}'  
> > > > > > curl -X POST "[http://localhost:9200/search/\*\*document/](http://localhost:9200/search/**document/)[http://localhost:9200/search/document/](http://localhost:9200/search/document/)"  
> > > > > > -d '{"first":"Leighton","last":"\*\*Sweet"}'  
> > > > > > curl -X POST "[http://localhost:9200/search/\*\*\_refresh](http://localhost:9200/search/**_refresh)[http://localhost:9200/search/\_refresh](http://localhost:9200/search/_refresh)  
> > > > > > "
> > > > > > 
> > > > > > curl -X GET '[http://localhost:9200/search/\*\*\_search?pretty](http://localhost:9200/search/**_search?pretty)' -d '{  
> > > > > > "query": {  
> > > > > > "query\_string": {  
> > > > > > "query": "Mark Leighton"  
> > > > > > }  
> > > > > > }  
> > > > > > }'
> > > > > > 
> > > > > > _RESULTS:_ ["Leighton Mark", "Louis Mark", "Kimberly Leighton",  
> > > > > > "Barbara Leighton", "John Leighton", "Nancy Mark", "Lawrence Mark",  
> > > > > > "Leighton Sweet"]
> > > > > > 
> > > > > > _I run the same excact code again and the results are different_  
> > > > > > \*  
> > > > > > \*  
> > > > > > \*  
> > > > > > \*  
> > > > > > curl -X DELETE [http://localhost:9200/search](http://localhost:9200/search)  
> > > > > > curl -X POST [http://localhost:9200/search](http://localhost:9200/search) -d '{  
> > > > > > "mappings": {  
> > > > > > "document": {  
> > > > > > "properties": {  
> > > > > > "first": {  
> > > > > > "type": "string"  
> > > > > > },  
> > > > > > "last": {  
> > > > > > "type": "string",  
> > > > > > "boost": 2.0  
> > > > > > }  
> > > > > > }  
> > > > > > }  
> > > > > > }  
> > > > > > }'
> > > > > > 
> > > > > > curl -X POST "[http://localhost:9200/search/\*\*document/](http://localhost:9200/search/**document/)[http://localhost:9200/search/document/](http://localhost:9200/search/document/)"  
> > > > > > -d '{"first":"Kimberly","last":"\*\*Leighton"}'  
> > > > > > curl -X POST "[http://localhost:9200/search/\*\*document/](http://localhost:9200/search/**document/)[http://localhost:9200/search/document/](http://localhost:9200/search/document/)"  
> > > > > > -d '{"first":"Barbara","last":"\*\*Leighton"}'  
> > > > > > curl -X POST "[http://localhost:9200/search/\*\*document/](http://localhost:9200/search/**document/)[http://localhost:9200/search/document/](http://localhost:9200/search/document/)"  
> > > > > > -d '{"first":"John","last":"\*\*Leighton"}'  
> > > > > > curl -X POST "[http://localhost:9200/search/\*\*document/](http://localhost:9200/search/**document/)[http://localhost:9200/search/document/](http://localhost:9200/search/document/)"  
> > > > > > -d '{"first":"Nancy","last":"\*\*Mark"}'  
> > > > > > curl -X POST "[http://localhost:9200/search/\*\*document/](http://localhost:9200/search/**document/)[http://localhost:9200/search/document/](http://localhost:9200/search/document/)"  
> > > > > > -d '{"first":"Lawrence","last":"\*\*Mark"}'  
> > > > > > curl -X POST "[http://localhost:9200/search/\*\*document/](http://localhost:9200/search/**document/)[http://localhost:9200/search/document/](http://localhost:9200/search/document/)"  
> > > > > > -d '{"first":"Louis","last":"\*\*Mark"}'  
> > > > > > curl -X POST "[http://localhost:9200/search/\*\*document/](http://localhost:9200/search/**document/)[http://localhost:9200/search/document/](http://localhost:9200/search/document/)"  
> > > > > > -d '{"first":"Leighton","last":"\*\*Mark"}'  
> > > > > > curl -X POST "[http://localhost:9200/search/\*\*document/](http://localhost:9200/search/**document/)[http://localhost:9200/search/document/](http://localhost:9200/search/document/)"  
> > > > > > -d '{"first":"Leighton","last":"\*\*Sweet"}'  
> > > > > > curl -X POST "[http://localhost:9200/search/\*\*\_refresh](http://localhost:9200/search/**_refresh)[http://localhost:9200/search/\_refresh](http://localhost:9200/search/_refresh)  
> > > > > > "
> > > > > > 
> > > > > > curl -X GET '[http://localhost:9200/search/\*\*\_search?pretty](http://localhost:9200/search/**_search?pretty)' -d '{  
> > > > > > "query": {  
> > > > > > "query\_string": {  
> > > > > > "query": "Mark Leighton"  
> > > > > > }  
> > > > > > }  
> > > > > > }'
> > > > > > 
> > > > > > _RESULTS:_ ["Nancy Mark", "Leighton Mark", "Lawrence Mark", "Louis  
> > > > > > Mark", "Leighton Sweet", "Kimberly Leighton", "Barbara Leighton", "John  
> > > > > > Leighton"]
> > > > > > 
> > > > > > The first time the top results was "Leighton Mark" as it should be  
> > > > > > because it matches both terms. The same query seconds later returns a  
> > > > > > different search result.
> > > > > > 
> > > > > > Is scoring broken in Elasticsearch/Lucene?
> > > > > > 
> > > > > > Thank you.
> > > > > 
> > > > > --  
> > > > > 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).  
> > > > > 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:48am UTC](https://discuss.elastic.co/t/elasticsearch-lucene-scoring-broken/10961/12 "2017-07-06T02:48:46Z")

</div>


