gregavola
gregavola

Reputation: 2539

ElasticSearch Sort on Multi-Value Not Working

Pretty simple issue here - I have a instance where I am searching for a wildcard value using "query_string", but the sort order is not working. Here is my query:

query": {
  "query_string": {
     "query": "60* Min*",
     "fields": [
        "beer_name",
        "beer_index",
        "spelling_alt",
        "brewery_alias",
        "alias_alt"
     ]
  }
 },
 "sort": [
   { "popularity" : {"order" : "desc"} }
 ]

This should return the values in descending order (popularity is an "interger"), from heighest to lowest, but this doesn't sort anything, it's done by random order it appears. Any gudiance here?

Upvotes: 0

Views: 245

Answers (1)

gregavola
gregavola

Reputation: 2539

The problem here was the _mapping popularity was set to string. I simply updated the _mapping to a LONG or INT and the problem was solved.

Upvotes: 1

Related Questions