Sort failed in "NOT_ANALYZED" field

Hi,

I have a type user, where I have a field title for search and I added a
field sortable.title for sorting purpose, which is not_analyzed, its
mapping is as follows :

{"user":{
"properties":{
"sortable":{
"type":"object","properties":{
"title":{

"type":"string","index":"not_analyzed"
}
}
},
"title":{
"type":"string","index":"analyzed"
}
}
}
}

and now when I am running the query as follows :

{
"query":{
"match_all":{}
},
"sort":{
"sortable.title":"desc"
}
}

OR
{
"query":{
"text":{
"title":{
"type":"phrase_prefix","query":"nar"
}
}
},
"sort":{
"sortable.title":"desc"
}
}

its returning the following exception :

*{

  • index: es_5
  • shard: 1
  • status: 500
  • reason: QueryPhaseExecutionException[[es_5][1]:
    query[ConstantScore(NotDeleted(:))],from[0],size[10],sort[<custom:"sortable.title":
    org.elasticsearch.index.field.data.strings.StringFieldDataType$1@3f28e2>]:
    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];

},**{*
*

      • index: es_5
      • shard: 3
      • status: 500
      • reason: QueryPhaseExecutionException[[es_5][3]:
        query[ConstantScore(NotDeleted(:))],from[0],size[10],sort[<custom:"sortable.title":
        org.elasticsearch.index.field.data.strings.StringFieldDataType$1@32e46a>]:
        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];
        }
    • {
      • index: es_5
      • shard: 2
      • status: 500
      • reason: QueryPhaseExecutionException[[es_5][2]:
        query[ConstantScore(NotDeleted(:))],from[0],size[10],sort[<custom:"sortable.title":
        org.elasticsearch.index.field.data.strings.StringFieldDataType$1@13204e5>]:
        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];
        }
        ]

*}
It was working fine earlier with the old data, we just reimported the data
to elasticsearch, rather this time we strictly added mapping to every
field,and now its crashing on the same data.
*
*
*
*

Hello!

Do you have more than one value in that field by any chance ?

--

Regards,

Rafał Kuć

Sematext :: http://sematext.com/ :: Solr - Lucene - Nutch - ElasticSearch

Hi,

I have a type user, where I have a field title for search and I added a field sortable.title for sorting purpose, which is not_analyzed, its mapping is as follows :

{"user":{

"properties":{


     "sortable":{


            "type":"object","properties":{


                                      "title":{


                                         "type":"string","index":"not_analyzed"


                                                    }


                                              }


                  },


      "title":{


              "type":"string","index":"analyzed"


              }


              }  


      }

}

and now when I am running the query as follows :

{

   "query":{


     "match_all":{}


              },


     "sort":{


        "sortable.title":"desc"


              }

}

OR

{

   "query":{


     "text":{


           "title":{


               "type":"phrase_prefix","query":"nar"


                   }


              }


            },


     "sort":{


        "sortable.title":"desc"


              }

}

its returning the following exception :

{

  • index: es_5
  • shard: 1
  • status: 500
  • reason: QueryPhaseExecutionException[[es_5][1]: query[ConstantScore(NotDeleted(*:*))],from[0],size[10],sort[<custom:"sortable.title": org.elasticsearch.index.field.data.strings.StringFieldDataType$1@3f28e2>]: 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];

},{

  • index: es_5
  • shard: 3
  • status: 500
  • reason: QueryPhaseExecutionException[[es_5][3]: query[ConstantScore(NotDeleted(*:*))],from[0],size[10],sort[<custom:"sortable.title": org.elasticsearch.index.field.data.strings.StringFieldDataType$1@32e46a>]: 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];

}

  • {
  • index: es_5
  • shard: 2
  • status: 500
  • reason: QueryPhaseExecutionException[[es_5][2]: query[ConstantScore(NotDeleted(*:*))],from[0],size[10],sort[<custom:"sortable.title": org.elasticsearch.index.field.data.strings.StringFieldDataType$1@13204e5>]: 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];

}

]

}

It was working fine earlier with the old data, we just reimported the data to elasticsearch, rather this time we strictly added mapping to every field,and now its crashing on the same data.

Is it something related to multi_field mapping??? I think I am using the
different field for searching and sorting, so It should not be.but please
guide me if I am on wrong way.

On Wednesday, 4 July 2012 15:46:38 UTC+5:30, Narinder Kaur wrote:

Hi,

I have a type user, where I have a field title for search and I added
a field sortable.title for sorting purpose, which is not_analyzed, its
mapping is as follows :

{"user":{
"properties":{
"sortable":{
"type":"object","properties":{
"title":{

"type":"string","index":"not_analyzed"
}
}
},
"title":{
"type":"string","index":"analyzed"
}
}
}
}

and now when I am running the query as follows :

{
"query":{
"match_all":{}
},
"sort":{
"sortable.title":"desc"
}
}

OR
{
"query":{
"text":{
"title":{
"type":"phrase_prefix","query":"nar"
}
}
},
"sort":{
"sortable.title":"desc"
}
}

its returning the following exception :

*{

  • index: es_5
  • shard: 1
  • status: 500
  • reason: QueryPhaseExecutionException[[es_5][1]:
    query[ConstantScore(NotDeleted(:))],from[0],size[10],sort[<custom:"sortable.title":
    org.elasticsearch.index.field.data.strings.StringFieldDataType$1@3f28e2>]:
    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];

},**{*
*

      • index: es_5
      • shard: 3
      • status: 500
      • reason: QueryPhaseExecutionException[[es_5][3]:
        query[ConstantScore(NotDeleted(:))],from[0],size[10],sort[<custom:"sortable.title":
        org.elasticsearch.index.field.data.strings.StringFieldDataType$1@32e46a>]:
        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];
        }
    • {
      • index: es_5
      • shard: 2
      • status: 500
      • reason: QueryPhaseExecutionException[[es_5][2]:
        query[ConstantScore(NotDeleted(:))],from[0],size[10],sort[<custom:"sortable.title":
        org.elasticsearch.index.field.data.strings.StringFieldDataType$1@13204e5>]:
        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];
        }
        ]

*}
It was working fine earlier with the old data, we just reimported the
data to elasticsearch, rather this time we strictly added mapping to every
field,and now its crashing on the same data.
*
*
*
*

sortable.title basically contains the name(including first name and last
name). but as the sortable.title is not_analyzed field, so it should be
treated as a single string, correct me if I am wrong.

On Wednesday, 4 July 2012 15:48:51 UTC+5:30, Rafał Kuć wrote:

Hello!

Do you have more than one value in that field by any chance ?

*--
Regards,
Rafał Kuć
Sematext :: http://sematext.com/ :: Solr - Lucene - Nutch -
Elasticsearch

Hi,

I have a type user, where I have a field title for search and I added
a field sortable.title for sorting purpose, which is not_analyzed, its
mapping is as follows :

{"user":{
"properties":{
"sortable":{
"type":"object","properties":{
"title":{

"type":"string","index":"not_analyzed"
}
}
},
"title":{
"type":"string","index":"analyzed"
}
}
}
}

and now when I am running the query as follows :

{
"query":{
"match_all":{}
},
"sort":{
"sortable.title":"desc"
}
}

OR
{
"query":{
"text":{
"title":{
"type":"phrase_prefix","query":"nar"
}
}
},
"sort":{
"sortable.title":"desc"
}
}

its returning the following exception :

*{
*

  • index: es_5
  • shard: 1
  • status: 500
  • reason: QueryPhaseExecutionException[[es_5][1]:
    query[ConstantScore(NotDeleted(
    :*))],from[0],size[10],sort[<custom:"sortable.title":
    org.elasticsearch.index.field.data.strings.StringFieldDataType$1@3f28e2>]:
    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]; *

*},{
*

  • index: es_5
  • shard: 3
  • status: 500
  • reason: QueryPhaseExecutionException[[es_5][3]:
    query[ConstantScore(NotDeleted(
    :*))],from[0],size[10],sort[<custom:"sortable.title":
    org.elasticsearch.index.field.data.strings.StringFieldDataType$1@32e46a>]:
    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]; *

*}
*

  • {

  • index: es_5

  • shard: 2

  • status: 500

  • reason: QueryPhaseExecutionException[[es_5][2]:
    query[ConstantScore(NotDeleted(
    :*))],from[0],size[10],sort[<custom:"sortable.title":
    org.elasticsearch.index.field.data.strings.StringFieldDataType$1@13204e5>]:
    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]; *

*}

]

}

  • It was working fine earlier with the old data, we just reimported the
    data to elasticsearch, rather this time we strictly added mapping to every
    field,and now its crashing on the same data.

Hello!

Are you indexing it as a concatenated value or as two separate values, but in a single field ? If the second option is true, than you have two separate values in the field, of course not analyzed.

--

Regards,

Rafał Kuć

Sematext :: http://sematext.com/ :: Solr - Lucene - Nutch - ElasticSearch

sortable.title basically contains the name(including first name and last name). but as the sortable.title is not_analyzed field, so it should be treated as a single string, correct me if I am wrong.

On Wednesday, 4 July 2012 15:48:51 UTC+5:30, Rafał Kuć wrote:

Hello!

Do you have more than one value in that field by any chance ?

--

Regards,

Rafał Kuć

Sematext :: http://sematext.com/ :: Solr - Lucene - Nutch - ElasticSearch

Hi,

I have a type user, where I have a field title for search and I added a field sortable.title for sorting purpose, which is not_analyzed, its mapping is as follows :

{"user":{

"properties":{


     "sortable":{


            "type":"object","properties":{


                                      "title":{


                                         "type":"string","index":"not_analyzed"


                                                    }


                                              }


                  },


      "title":{


              "type":"string","index":"analyzed"


              }


              }  


      }

}

and now when I am running the query as follows :

{

   "query":{


     "match_all":{}


              },


     "sort":{


        "sortable.title":"desc"


              }

}

OR

{

   "query":{


     "text":{


           "title":{


               "type":"phrase_prefix","query":"nar"


                   }


              }


            },


     "sort":{


        "sortable.title":"desc"


              }

}

its returning the following exception :

{

  • index: es_5
  • shard: 1
  • status: 500
  • reason: QueryPhaseExecutionException[[es_5][1]: query[ConstantScore(NotDeleted(*:*))],from[0],size[10],sort[<custom:"sortable.title": org.elasticsearch.index.field.data.strings.StringFieldDataType$1@3f28e2>]: 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];

},{

  • index: es_5
  • shard: 3
  • status: 500
  • reason: QueryPhaseExecutionException[[es_5][3]: query[ConstantScore(NotDeleted(*:*))],from[0],size[10],sort[<custom:"sortable.title": org.elasticsearch.index.field.data.strings.StringFieldDataType$1@32e46a>]: 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];

}

  • {
  • index: es_5
  • shard: 2
  • status: 500
  • reason: QueryPhaseExecutionException[[es_5][2]: query[ConstantScore(NotDeleted(*:*))],from[0],size[10],sort[<custom:"sortable.title": org.elasticsearch.index.field.data.strings.StringFieldDataType$1@13204e5>]: 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];

}

]

}

It was working fine earlier with the old data, we just reimported the data to elasticsearch, rather this time we strictly added mapping to every field,and now its crashing on the same data.