Sorting in a double field

Hi,

I'm trying to sort on a double field(score based sorting) and I'm
unable to sort based on score values. My score mapping looks something
like this.

score" : {
"omit_term_freq_and_positions" : false,
"index_name" : "score",
"index" : "analyzed",
"analyzer" : "sortable",
"omit_norms" : false,
"store" : "no",
"boost" : 1.0,
"precision_step" : 4,
"term_vector" : "no",
"type" : "double"
},

And the way i call is
http://***...:9200/tournament/detail/_search?q=tournamentid:686&sort=score:forward&analyzer=sortable
. But i get random scores. I have another mapping for userid like:

userid" : {
"omit_term_freq_and_positions" : true,
"index_name" : "userid",
"index" : "not_analyzed",
"omit_norms" : true,
"store" : "no",
"boost" : 1.0,
"term_vector" : "no",
"type" : "string"
}

And when i do a sort on userid i get the results sorted based on
userid properly. What am i missing here, i suppose my mapping
configuration for score needs a tweak.

Kind Regards.

Hi,

We managed to solve the issue. It turned out to be that score is a keyword
and changing it to userscore did the trick. The mapping now is:

          "userscore" : {
            "omit_term_freq_and_positions" : true,
            "index_name" : "userscore",
            "index" : "not_analyzed",
            "omit_norms" : true,
            "store" : "no",
            "boost" : 1.0,
            "precision_step" : 4,
            "term_vector" : "no",
            "type" : "double"
          },

Kind Regards.

On Thu, Jul 22, 2010 at 12:16 PM, ajgamer abie.joseph14@gmail.com wrote:

Hi,

I'm trying to sort on a double field(score based sorting) and I'm
unable to sort based on score values. My score mapping looks something
like this.

score" : {
"omit_term_freq_and_positions" : false,
"index_name" : "score",
"index" : "analyzed",
"analyzer" : "sortable",
"omit_norms" : false,
"store" : "no",
"boost" : 1.0,
"precision_step" : 4,
"term_vector" : "no",
"type" : "double"
},

And the way i call is
http://
..*.**:9200/tournament/detail/_search?q=tournamentid:686&sort=score:forward&analyzer=sortable
. But i get random scores. I have another mapping for userid like:

userid" : {
"omit_term_freq_and_positions" : true,
"index_name" : "userid",
"index" : "not_analyzed",
"omit_norms" : true,
"store" : "no",
"boost" : 1.0,
"term_vector" : "no",
"type" : "string"
}

And when i do a sort on userid i get the results sorted based on
userid properly. What am i missing here, i suppose my mapping
configuration for score needs a tweak.

Kind Regards.

Actually, you are correct, its in the sort parsing stage, where "score" is
used to denote sorting by the score of a doc... . Not sure what I took when
I coded it, but its a mistake. It should have been _score, as is the
convention for "internal" fields or constants in elasticsearch. Damn, need
to be changed, I will open an issue and change it, even though it breaks
backward, its important!

-shay.banon

On Thu, Jul 22, 2010 at 12:49 PM, Abbie Joseph abie.joseph14@gmail.comwrote:

Hi,

We managed to solve the issue. It turned out to be that score is a keyword
and changing it to userscore did the trick. The mapping now is:

          "userscore" : {

            "omit_term_freq_and_positions" : true,
            "index_name" : "userscore",

            "index" : "not_analyzed",
            "omit_norms" : true,
            "store" : "no",
            "boost" : 1.0,
            "precision_step" : 4,
            "term_vector" : "no",
            "type" : "double"
          },

Kind Regards.

On Thu, Jul 22, 2010 at 12:16 PM, ajgamer abie.joseph14@gmail.com wrote:

Hi,

I'm trying to sort on a double field(score based sorting) and I'm
unable to sort based on score values. My score mapping looks something
like this.

score" : {
"omit_term_freq_and_positions" : false,
"index_name" : "score",
"index" : "analyzed",
"analyzer" : "sortable",
"omit_norms" : false,
"store" : "no",
"boost" : 1.0,
"precision_step" : 4,
"term_vector" : "no",
"type" : "double"
},

And the way i call is
http://
..*.**:9200/tournament/detail/_search?q=tournamentid:686&sort=score:forward&analyzer=sortable
. But i get random scores. I have another mapping for userid like:

userid" : {
"omit_term_freq_and_positions" : true,
"index_name" : "userid",
"index" : "not_analyzed",
"omit_norms" : true,
"store" : "no",
"boost" : 1.0,
"term_vector" : "no",
"type" : "string"
}

And when i do a sort on userid i get the results sorted based on
userid properly. What am i missing here, i suppose my mapping
configuration for score needs a tweak.

Kind Regards.