Geo_distance sort removes scoring -- bug?


(Allison A.) #1

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

--


(Ivan Brusic) #2

Be sure to set track_scores to true:

http://www.elasticsearch.org/guide/reference/api/search/sort.html

--
Ivan

On Fri, Sep 7, 2012 at 11:56 AM, Allison A.
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

--

--


(system) #3