# Geo\_distance sort removes scoring -- bug?

**URL:** https://discuss.elastic.co/t/geo-distance-sort-removes-scoring-bug/8957
**Category:** Elasticsearch
**Created:** [September 7, 2012, 6:56pm UTC](https://discuss.elastic.co/t/geo-distance-sort-removes-scoring-bug/8957 "2012-09-07T18:56:35Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Allison\_A](https://avatars.discourse-cdn.com/v4/letter/a/7ba0ec/32.png) [@Allison\_A](https://discuss.elastic.co/u/Allison_A)
#### Post date: [September 7, 2012, 6:56pm UTC](https://discuss.elastic.co/t/geo-distance-sort-removes-scoring-bug/8957/1 "2012-09-07T18:56:35Z")

</div>

hi, i'm using the following query:

```
        var json = new {
            query = new {
                query_string = new {
                    fields = new string[] {
                                "BusinessName^1.0", "Teaser^0.2", 

```

"ReviewText^0.7",  
"CategoryMajor^2.0",  
"CategoryMinor^0.5",  
"State^0.5", "City^0.5"  
},  
query = "restaurants",  
use\_dis\_max = true  
}  
},  
sort = new {  
\_geo\_distance = new {  
Location = "40.748470,-73.939180",  
order = "asc",  
unit = "mi"  
}  
},  
from = 0,  
size = 5  
};

my results have \_score = null

but if i remove the sort, the \_score comes back

is this a bug?

Allison

--

---

<div class="post-metadata">

### Author: ![Ivan](https://avatars.discourse-cdn.com/v4/letter/i/df788c/32.png) [@Ivan](https://discuss.elastic.co/u/Ivan)
#### Post date: [September 7, 2012, 6:59pm UTC](https://discuss.elastic.co/t/geo-distance-sort-removes-scoring-bug/8957/2 "2012-09-07T18:59:48Z")

</div>

Be sure to set track\_scores to true:

> **[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 Fri, Sep 7, 2012 at 11:56 AM, Allison A.  
[allisonandrews@feranassociates.com](mailto:allisonandrews@feranassociates.com) wrote:

> hi, i'm using the following query:
> 
> ```
> var json = new {
> query = new {
> query_string = new {
> fields = new string[] {
> "BusinessName^1.0", "Teaser^0.2",
> 
> ```
> 
> "ReviewText^0.7",  
> "CategoryMajor^2.0",  
> "CategoryMinor^0.5",  
> "State^0.5", "City^0.5"  
> },  
> query = "restaurants",  
> use\_dis\_max = true  
> }  
> },  
> sort = new {  
> \_geo\_distance = new {  
> Location = "40.748470,-73.939180",  
> order = "asc",  
> unit = "mi"  
> }  
> },  
> from = 0,  
> size = 5  
> };
> 
> my results have \_score = null
> 
> but if i remove the sort, the \_score comes back
> 
> is this a bug?
> 
> Allison
> 
> --

--

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)
#### Post date: [July 6, 2017, 3:13am UTC](https://discuss.elastic.co/t/geo-distance-sort-removes-scoring-bug/8957/3 "2017-07-06T03:13:39Z")

</div>


