# Rescore Sorting

**URL:** <https://discuss.elastic.co/t/rescore-sorting/19244>\
**Category:** Elasticsearch\
**Created:** [August 13, 2014, 8:53am UTC](https://discuss.elastic.co/t/rescore-sorting/19244 "2014-08-13T08:53:45Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![kayngee](https://avatars.discourse-cdn.com/v4/letter/k/43a26b/32.png) [@kayngee](https://discuss.elastic.co/u/kayngee)\
**Post date:** [August 13, 2014, 8:53am UTC](https://discuss.elastic.co/t/rescore-sorting/19244/1 "2014-08-13T08:53:45Z")

</div>

Hi Guys,

I'm getting weird score from my rescore anyone mind explaining why the  
rescore score is getting ignored in my query?

{

> ```
> "from": 0,
> 
> "size": 10,
> 
> "explain": false,
> 
> "sort": ["_score", {
> 
> "networks": {
> 
> "order": "desc",
> 
> "mode": "sum"
> 
> }
> 
> }, {
> 
> "rich": {
> 
> "order": "desc",
> 
> "mode": "sum"
> 
> }
> 
> }, {
> 
> "picture": {
> 
> "order": "desc",
> 
> "mode": "sum"
> 
> }
> 
> }],
> 
> "query": {
> 
> "filtered": {
> 
> "query": {
> 
> "bool": {
> 
> "should": [{
> 
> "constant_score": {
> 
> "query": {
> 
> "match": {
> 
> "_all": {
> 
> "query": "Daryl"
> 
> }
> 
> }
> 
> },
> 
> "boost": 1.0
> 
> }
> 
> }, {
> 
> "constant_score": {
> 
> "query": {
> 
> "match": {
> 
> "_all": {
> 
> "query": "Davies"
> 
> }
> 
> }
> 
> },
> 
> "boost": 1.0
> 
> }
> 
> }],
> 
> "disable_coord": 1
> 
> }
> 
> },
> 
> "filter": [{
> 
> "or": [{
> 
> "query": {
> 
> "match": {
> 
> "_all": {
> 
> "query": "Daryl"
> 
> }
> 
> }
> 
> }
> 
> }, {
> 
> "query": {
> 
> "match": {
> 
> "_all": {
> 
> "query": "Davies"
> 
> }
> 
> }
> 
> }
> 
> }]
> 
> }]
> 
> }
> 
> },
> 
> "rescore": [{
> 
> "query": {
> 
> "query_weight": 0.0,
> 
> "rescore_query_weight": 1.0,
> 
> "score_mode": "total",
> 
> "rescore_query": {
> 
> "bool": {
> 
> "should": [{
> 
> "match_all": {
> 
> "boost": 20.0
> 
> }
> 
> }],
> 
> "disable_coord": 1
> 
> }
> 
> }
> 
> },
> 
> "window_size": 50
> 
> }]
> 
> ```
> 
> }

Results showing weird scores when the scores should all total up to 20.0

{

"took" : 470,

"timed\_out" : false,

"\_shards" : {

```
"total" : 8,

"successful" : 8,

"failed" : 0

```

},

"hits" : {

```
"total" : 84244,

"max_score" : null,

"hits" : [ {

  "_index" : "crawledpeople_completepeople_v1",

  "_type" : "zeepexmanager_buisnessobjects_zeepexsearch_zeepexprofile",

  "_id" : "51c3c56f6dd2bc0854e9e333",

  "_score" : 1.4142135,

  "sort" : [1.4142135, 2, 66, 1]

}, {

  "_index" : "crawledpeople_completepeople_v1",

  "_type" : "zeepexmanager_buisnessobjects_zeepexsearch_zeepexprofile",

  "_id" : "51c6d25e6dd2bc08543fa577",

  "_score" : 1.4142135,

  "sort" : [1.4142135, 2, 54, 1]

}, {

  "_index" : "crawledpeople_completepeople_v1",

  "_type" : "zeepexmanager_buisnessobjects_zeepexsearch_zeepexprofile",

  "_id" : "51f342e06dd2bc0b788c6372",

  "_score" : 1.4142135,

  "sort" : [1.4142135, 1, 298, -9223372036854775808]

}, {

  "_index" : "crawledpeople_completepeople_v1",

  "_type" : "zeepexmanager_buisnessobjects_zeepexsearch_zeepexprofile",

  "_id" : "51e162e16dd2bc08549fb2b5",

  "_score" : 1.4142135,

  "sort" : [1.4142135, 1, 253, -9223372036854775808]

}, {

  "_index" : "crawledpeople_completepeople_v1",

  "_type" : "zeepexmanager_buisnessobjects_zeepexsearch_zeepexprofile",

  "_id" : "52a3b8ad6dd2bc053c372722",

  "_score" : 1.4142135,

  "sort" : [1.4142135, 1, 104, 1]

}, {

  "_index" : "crawledpeople_completepeople_v1",

  "_type" : "zeepexmanager_buisnessobjects_zeepexsearch_zeepexprofile",

  "_id" : "5155e11bd25e9d09d0602aa9",

  "_score" : 1.4142135,

  "sort" : [1.4142135, 1, 97, 1]

}, {

  "_index" : "crawledpeople_completepeople_v1",

  "_type" : "zeepexmanager_buisnessobjects_zeepexsearch_zeepexprofile",

  "_id" : "52a798656dd2bc053c7e6950",

  "_score" : 1.4142135,

  "sort" : [1.4142135, 1, 67, 1]

}, {

  "_index" : "crawledpeople_completepeople_v1",

  "_type" : "zeepexmanager_buisnessobjects_zeepexsearch_zeepexprofile",

  "_id" : "51db66f86dd2bc0854e0ddc2",

  "_score" : 1.4142135,

  "sort" : [1.4142135, 1, 63, 1]

}, {

  "_index" : "crawledpeople_completepeople_v1",

  "_type" : "zeepexmanager_buisnessobjects_zeepexsearch_zeepexprofile",

  "_id" : "522727cb6dd2bc0b7836f937",

  "_score" : 1.4142135,

  "sort" : [1.4142135, 1, 55, 1]

}, {

  "_index" : "crawledpeople_completepeople_v1",

  "_type" : "zeepexmanager_buisnessobjects_zeepexsearch_zeepexprofile",

  "_id" : "529ba9736dd2bc053c908471",

  "_score" : 1.4142135,

  "sort" : [1.4142135, 1, 45, 1]

} ]

```

}

}

--  
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).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/89c8a4aa-9524-4f42-82cd-c285495f418a%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/89c8a4aa-9524-4f42-82cd-c285495f418a%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![kayngee](https://avatars.discourse-cdn.com/v4/letter/k/43a26b/32.png) [@kayngee](https://discuss.elastic.co/u/kayngee)\
**Post date:** [August 13, 2014, 9:50am UTC](https://discuss.elastic.co/t/rescore-sorting/19244/2 "2014-08-13T09:50:06Z")

</div>

Tried simplfying the query but no luck still getting the original query  
score

Tried Simplifying the Query but with no luck still getting the same scores

> > 
> 
> {
> 
> ```
> "from": 0,
> 
> "size": 10,
> 
> "explain": false,
> 
> "sort": ["_score", {
> 
> "networks": {
> 
> "order": "desc",
> 
> "mode": "sum"
> 
> }
> 
> }, {
> 
> "rich": {
> 
> "order": "desc",
> 
> "mode": "sum"
> 
> }
> 
> }, {
> 
> "picture": {
> 
> "order": "desc",
> 
> "mode": "sum"
> 
> }
> 
> }],
> 
> "query": {
> 
> "filtered": {
> 
> "query": {
> 
> "bool": {
> 
> "should": [{
> 
> "constant_score": {
> 
> "query": {
> 
> "match": {
> 
> "_all": {
> 
> "query": "Daryl"
> 
> }
> 
> }
> 
> },
> 
> "boost": 1.0
> 
> }
> 
> }, {
> 
> "constant_score": {
> 
> "query": {
> 
> "match": {
> 
> "_all": {
> 
> "query": "Davies"
> 
> }
> 
> }
> 
> },
> 
> "boost": 1.0
> 
> }
> 
> }],
> 
> "disable_coord": 1
> 
> }
> 
> },
> 
> "filter": [{
> 
> "or": [{
> 
> "query": {
> 
> "match": {
> 
> "_all": {
> 
> "query": "Daryl"
> 
> }
> 
> }
> 
> }
> 
> }, {
> 
> "query": {
> 
> "match": {
> 
> "_all": {
> 
> "query": "Davies"
> 
> }
> 
> }
> 
> }
> 
> }]
> 
> }]
> 
> }
> 
> },
> 
> "rescore": [{
> 
> "query": {
> 
> "query_weight": 0.0,
> 
> "rescore_query_weight": 1.0,
> 
> "score_mode": "total",
> 
> "rescore_query": {
> 
> "constant_score": {
> 
> "query": {
> 
> "match_all": {}
> 
> },
> 
> "boost": 20.0
> 
> }
> 
> }
> 
> },
> 
> "window_size": 50
> 
> }]
> 
> ```
> 
> }

On Wednesday, 13 August 2014 10:53:45 UTC+2, Shawn Ritchie wrote:

> Hi Guys,
> 
> I'm getting weird score from my rescore anyone mind explaining why the  
> rescore score is getting ignored in my query?
> 
> {
> 
> ```
> "from": 0,
> 
> "size": 10,
> 
> "explain": false,
> 
> "sort": ["_score", {
> 
> "networks": {
> 
> "order": "desc",
> 
> "mode": "sum"
> 
> }
> 
> }, {
> 
> "rich": {
> 
> "order": "desc",
> 
> "mode": "sum"
> 
> }
> 
> }, {
> 
> "picture": {
> 
> "order": "desc",
> 
> "mode": "sum"
> 
> }
> 
> }],
> 
> "query": {
> 
> "filtered": {
> 
> "query": {
> 
> "bool": {
> 
> "should": [{
> 
> "constant_score": {
> 
> "query": {
> 
> "match": {
> 
> "_all": {
> 
> "query": "Daryl"
> 
> }
> 
> }
> 
> },
> 
> "boost": 1.0
> 
> }
> 
> }, {
> 
> "constant_score": {
> 
> "query": {
> 
> "match": {
> 
> "_all": {
> 
> "query": "Davies"
> 
> }
> 
> }
> 
> },
> 
> "boost": 1.0
> 
> }
> 
> }],
> 
> "disable_coord": 1
> 
> }
> 
> },
> 
> "filter": [{
> 
> "or": [{
> 
> "query": {
> 
> "match": {
> 
> "_all": {
> 
> "query": "Daryl"
> 
> }
> 
> }
> 
> }
> 
> }, {
> 
> "query": {
> 
> "match": {
> 
> "_all": {
> 
> "query": "Davies"
> 
> }
> 
> }
> 
> }
> 
> }]
> 
> }]
> 
> }
> 
> },
> 
> "rescore": [{
> 
> "query": {
> 
> "query_weight": 0.0,
> 
> "rescore_query_weight": 1.0,
> 
> "score_mode": "total",
> 
> "rescore_query": {
> 
> "bool": {
> 
> "should": [{
> 
> "match_all": {
> 
> "boost": 20.0
> 
> }
> 
> }],
> 
> "disable_coord": 1
> 
> }
> 
> }
> 
> },
> 
> "window_size": 50
> 
> }]
> 
> ```
> 
> }
> 
> Results showing weird scores when the scores should all total up to 20.0
> 
> {
> 
> "took" : 470,
> 
> "timed\_out" : false,
> 
> "\_shards" : {
> 
> ```
> "total" : 8,
> 
> "successful" : 8,
> 
> "failed" : 0
> 
> ```
> 
> },
> 
> "hits" : {
> 
> ```
> "total" : 84244,
> 
> "max_score" : null,
> 
> "hits" : [ {
> 
> "_index" : "crawledpeople_completepeople_v1",
> 
> "_type" : "zeepexmanager_buisnessobjects_zeepexsearch_zeepexprofile",
> 
> "_id" : "51c3c56f6dd2bc0854e9e333",
> 
> "_score" : 1.4142135,
> 
> "sort" : [1.4142135, 2, 66, 1]
> 
> }, {
> 
> "_index" : "crawledpeople_completepeople_v1",
> 
> "_type" : "zeepexmanager_buisnessobjects_zeepexsearch_zeepexprofile",
> 
> "_id" : "51c6d25e6dd2bc08543fa577",
> 
> "_score" : 1.4142135,
> 
> "sort" : [1.4142135, 2, 54, 1]
> 
> }, {
> 
> "_index" : "crawledpeople_completepeople_v1",
> 
> "_type" : "zeepexmanager_buisnessobjects_zeepexsearch_zeepexprofile",
> 
> "_id" : "51f342e06dd2bc0b788c6372",
> 
> "_score" : 1.4142135,
> 
> "sort" : [1.4142135, 1, 298, -9223372036854775808]
> 
> }, {
> 
> "_index" : "crawledpeople_completepeople_v1",
> 
> "_type" : "zeepexmanager_buisnessobjects_zeepexsearch_zeepexprofile",
> 
> "_id" : "51e162e16dd2bc08549fb2b5",
> 
> "_score" : 1.4142135,
> 
> "sort" : [1.4142135, 1, 253, -9223372036854775808]
> 
> }, {
> 
> "_index" : "crawledpeople_completepeople_v1",
> 
> "_type" : "zeepexmanager_buisnessobjects_zeepexsearch_zeepexprofile",
> 
> "_id" : "52a3b8ad6dd2bc053c372722",
> 
> "_score" : 1.4142135,
> 
> "sort" : [1.4142135, 1, 104, 1]
> 
> }, {
> 
> "_index" : "crawledpeople_completepeople_v1",
> 
> "_type" : "zeepexmanager_buisnessobjects_zeepexsearch_zeepexprofile",
> 
> "_id" : "5155e11bd25e9d09d0602aa9",
> 
> "_score" : 1.4142135,
> 
> "sort" : [1.4142135, 1, 97, 1]
> 
> }, {
> 
> "_index" : "crawledpeople_completepeople_v1",
> 
> "_type" : "zeepexmanager_buisnessobjects_zeepexsearch_zeepexprofile",
> 
> "_id" : "52a798656dd2bc053c7e6950",
> 
> "_score" : 1.4142135,
> 
> "sort" : [1.4142135, 1, 67, 1]
> 
> }, {
> 
> "_index" : "crawledpeople_completepeople_v1",
> 
> "_type" : "zeepexmanager_buisnessobjects_zeepexsearch_zeepexprofile",
> 
> "_id" : "51db66f86dd2bc0854e0ddc2",
> 
> "_score" : 1.4142135,
> 
> "sort" : [1.4142135, 1, 63, 1]
> 
> }, {
> 
> "_index" : "crawledpeople_completepeople_v1",
> 
> "_type" : "zeepexmanager_buisnessobjects_zeepexsearch_zeepexprofile",
> 
> "_id" : "522727cb6dd2bc0b7836f937",
> 
> "_score" : 1.4142135,
> 
> "sort" : [1.4142135, 1, 55, 1]
> 
> }, {
> 
> "_index" : "crawledpeople_completepeople_v1",
> 
> ```
> 
> > elasticsearch+unsubscribe@googlegroups.com.  
> > To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/9743310e-853b-4620-8554-69873c1ef7e4%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/9743310e-853b-4620-8554-69873c1ef7e4%40googlegroups.com).  
> > For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![kayngee](https://avatars.discourse-cdn.com/v4/letter/k/43a26b/32.png) [@kayngee](https://discuss.elastic.co/u/kayngee)\
**Post date:** [August 13, 2014, 10:25am UTC](https://discuss.elastic.co/t/rescore-sorting/19244/3 "2014-08-13T10:25:40Z")

</div>

Ok,

So I managed to fix this issue but I'm not entirely sure if I found a Bug  
or if the functionality is intended to work like so.

Basically if I remove the sort functionality the query works as intended,  
If I use any kind of Sort, the rescore query is totally ignored and sorting  
is done on the original query score.

--  
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).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/73aa1295-82ee-4341-8d53-b815806bee73%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/73aa1295-82ee-4341-8d53-b815806bee73%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<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, 1:08am UTC](https://discuss.elastic.co/t/rescore-sorting/19244/4 "2017-07-06T01:08:56Z")

</div>


