Shard failure for the sorting case

   I am running the following query:

{
"size": 10,
"from": 0,
"sort": {
"is_usa": {
"order": "desc"
},
"state_title": {
"order": "asc"
},
"sortable.title": {
"order": "asc"
}
},
"query": {
"match_all": {}
}
}

and its giving me the following error:

{

  • took: 10
  • timed_out: false
  • _shards: {
    • total: 5
    • successful: 4
    • failed: 1
    • failures: [
      • {
        • index: es_5
        • shard: 3
        • status: 500
        • reason: QueryPhaseExecutionException[[es_5][3]:
          query[filtered(ConstantScore(:))->FilterCacheFilterWrapper(_type:IzapGeoCity)],from[0],size[10],sort[<custom:"is_usa":
          org.elasticsearch.index.field.data.strings.StringFieldDataType$1@9dcf62>!,<custom:"state_title":
          org.elasticsearch.index.field.data.strings.StringFieldDataType$1@9a3166>,<custom:"sortable.title":
          org.elasticsearch.index.field.data.strings.StringFieldDataType$1@12146d4>]:
          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];
          }
          ]
          }

and if I remove the sorting on sortable.title, it gives all results. I dn't
understand why the mapping in one shard is not available while it is in
other four.

state_title is analyzed, you need to have a version of it that is not analyzed to sort on it.

On Wednesday, February 1, 2012 at 12:41 PM, Narinder Kaur wrote:

   I am running the following query:

{
"size": 10,
"from": 0,
"sort": {
"is_usa": {
"order": "desc"
},
"state_title": {
"order": "asc"
},
"sortable.title": {
"order": "asc"
}
},
"query": {
"match_all": {}
}
}

and its giving me the following error:

{
took: 10
timed_out: false
_shards: {
total: 5
successful: 4
failed: 1
failures: [
{
index: es_5
shard: 3
status: 500
reason: QueryPhaseExecutionException[[es_5][3]: query[filtered(ConstantScore(:))->FilterCacheFilterWrapper(_type:IzapGeoCity)],from[0],size[10],sort[<custom:"is_usa": org.elasticsearch.index.field.data.strings.StringFieldDataType$1@9dcf62>!,<custom:"state_title": org.elasticsearch.index.field.data.strings.StringFieldDataType$1@9a3166>,<custom:"sortable.title": org.elasticsearch.index.field.data.strings.StringFieldDataType$1@12146d4>]: 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];

}

]

}

and if I remove the sorting on sortable.title, it gives all results. I dn't understand why the mapping in one shard is not available while it is in other four.