Using ES 0.17.9, the following query is successful if I execute using the
elasticsearch-head web ui, but fails when using the Java client:
I get the following ShardSearchFailure:
sort[<custom:"owner.username":
org.elasticsearch.index.field.data.strings.StringFieldDataType$1@173aa68>!]:
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];
The field in question (owner.username) should only have a single value.
Any suggestions on why I'm getting inconsistent results and what I can do
to fix?
sort[<custom:"owner.username":
org.elasticsearch.index.field.data.strings.StringFieldDataType$1@173aa68>!]:
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];
The field in question (owner.username) should only have a single value.
Any suggestions on why I'm getting inconsistent results and what I can do
to fix?
Thanks for the replies. Unfortunately I'm still not able to resolve this.
Shay's suggestion of adding "not_analyzed" to the mapping for username
works for the sort but doesn't allow the field to be searchable. Since my
last post I'm now creating an explicit mapping shown here:
As before, if I try to sort on the owner.ownerUsername field, I get the
following error:
SEARCH FAILURE: status=INTERNAL_SERVER_ERROR,
reason=QueryPhaseExecutionException[[threads][1]:
query[ConstantScore(org.elasticsearch.common.lucene.search.OrFilter@3d0d96f)],from[0],size[25],sort[<custom:"owner.ownerUsername":
org.elasticsearch.index.field.data.strings.StringFieldDataType$1@709d70b4>!]:
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];
What do I need to do in order to have this field searchable AND sortable?
Thanks for the replies. Unfortunately I'm still not able to resolve this.
Shay's suggestion of adding "not_analyzed" to the mapping for username
works for the sort but doesn't allow the field to be searchable. Since my
last post I'm now creating an explicit mapping shown here:
As before, if I try to sort on the owner.ownerUsername field, I get the
following error:
SEARCH FAILURE: status=INTERNAL_SERVER_ERROR,
reason=QueryPhaseExecutionException[[threads][1]:
query[ConstantScore(org.elasticsearch.common.lucene.search.OrFilter@3d0d96f)],from[0],size[25],sort[<custom:"owner.ownerUsername":
org.elasticsearch.index.field.data.strings.StringFieldDataType$1@709d70b4>!]:
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];
What do I need to do in order to have this field searchable AND sortable?
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.