I'm implemented Tire wih elasticsearch. Locally my project runs fine and I have no trouble searching my index. But when I deployed my app to my server I got this error message:
Tire::Search::SearchRequestFailed (500 : {"error":"SearchPhaseExecutionException[Failed to execute phase [query_fetch], total failure; shardFailures {[hDTlT_K_Sl6P5regwKNJyg][articles] [0]: QueryPhaseExecutionException[[articles][0]: query[ConstantScore(NotDeleted(cache(_type:article)))],from[0],size[25],sort[!]: Query Failed [Failed to execute main query]]; nested: IOException[Can't sort on string types with more than one value per doc, or more than one token per field]; }]","status":500}):
I believe my articles are stored in my index because I didn't receive any errors creating them. I also tried to run the same query manually with this:
curl -XPOST 'http://localhost:9200/articles/article/_search' -d '{
"sort": [
{
"supplier_code": "desc"
}
]
}'
And I got practically the same response:
{"error":"SearchPhaseExecutionException[Failed to execute phase [query_fetch], total failure; shardFailures {[hDTlT_K_Sl6P5regwKNJyg][articles][0]: QueryPhaseExecutionException[[articles][0]: query[ConstantScore(NotDeleted(cache(_type:article)))],from[0],size[10],sort[!]: Query Failed [Failed to execute main query]]; nested: IOException[Can't sort on string types with more than one value per doc, or more than one token per field]; }]","status":500}
So can Anybody point me in the right direction? I copied the exact sam config I use on my local machine. So strange it doesn't work on the server.
What am I missing here?
Thanks a lot in advance
EDIT:
I found out that the sort I'm trying to perform is causing the issue. Also that is has something to do with the mapping of my article object to elastic search.
Something with the field I'm trying to sort put on not_analyzed I'm I correct? Do I need to explicitly map all my fields if I map one field only?