Can't sort on string types with more than one value per doc, or more than one token per field


(pcdinh) #1

I got an issue with sorting. Sorting worked after I sent a mapping
request and did indexing.

Mapping

{
'username': {
'boost': 1.0,
'index': 'not_analyzed',
'store': 'yes',
'type': 'string'
},
'fullname_idx': {
'boost': 1.5,
'index': 'analyzed',
'store': 'yes',
'type': 'string',
"term_vector" : "with_positions_offsets"
},
# Used for sorting
'fullname': {
'index': 'not_analyzed',
'store': 'no',
'type': 'string'
}
}

Searching had worked until I restarted ElasticSearch

{
"size": 100,
"from" : 0,
"sort": ["_score",
{ "fullname": {"reverse" : False }},
{ "username": "asc" }
],
"fields": [ "username", "fullname"],
"query": {
"query_string": {
"fields" : ["username^2",

"fullname_idx^3"],
"query" : keyword,
"use_dis_max" : True
}
}
}

After I restarted ES server, the query failed

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];

Also, I can not find where ES store the mapping

Am I missing something?

Regards,


(Shay Banon) #2

When you do a GET mapping, do you see the mapping you specified?
On Wednesday, May 4, 2011 at 7:26 AM, pcdinh wrote:

I got an issue with sorting. Sorting worked after I sent a mapping
request and did indexing.

Mapping

{
'username': {
'boost': 1.0,
'index': 'not_analyzed',
'store': 'yes',
'type': 'string'
},
'fullname_idx': {
'boost': 1.5,
'index': 'analyzed',
'store': 'yes',
'type': 'string',
"term_vector" : "with_positions_offsets"
},

Used for sorting

'fullname': {
'index': 'not_analyzed',
'store': 'no',
'type': 'string'
}
}

Searching had worked until I restarted ElasticSearch

{
"size": 100,
"from" : 0,
"sort": ["_score",
{ "fullname": {"reverse" : False }},
{ "username": "asc" }
],
"fields": [ "username", "fullname"],
"query": {
"query_string": {
"fields" : ["username^2",

"fullname_idx^3"],
"query" : keyword,
"use_dis_max" : True
}
}
}

After I restarted ES server, the query failed

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];

Also, I can not find where ES store the mapping

Am I missing something?

Regards,


(system) #3