Java.io.IOException: Can't sort on string types with more than one value per doc, or more than one token per field


(tlyakhov) #1

Hi. I have a string field I would like to use for sorting. As of some
recent version of ES, I've started getting this IOException:
"Can't sort on string types with more than one value per doc, or more
than one token per field"

After reading some information about it, I gather that I need to mark
the field as "not analyzed". I'm using NEST, a C# library, for my ES
adapter and this is my class:

[DataContract]
[ElasticType()]
public class SearchKey
{
	[DataMember]
	public string Id
	{
		get;
		set;
	}

	[DataMember]
	public int Length
	{
		get;
		set;
	}

	[DataMember]

[ElasticProperty(Index=ElasticSearch.Client.FieldIndexOption.not_analyzed,
IncludeInAll=false)]
public string SortHelper
{
get;
set;
}

	...

}

Pretty simple stuff really, but it doesn't work. The same message is
being put out when I try to search. I've also tried to change the
mapping manually using the ES head plugin, with no luck either - the
field isn't being marked "not analyzed".

Any ideas?
Thanks,
-Tim


(Shay Banon) #2

CAn you make sure that the field is actually not analyzed using the get
mapping API?

On Tue, Mar 27, 2012 at 8:33 PM, tlyakhov tlyakhov@gmail.com wrote:

Hi. I have a string field I would like to use for sorting. As of some
recent version of ES, I've started getting this IOException:
"Can't sort on string types with more than one value per doc, or more
than one token per field"

After reading some information about it, I gather that I need to mark
the field as "not analyzed". I'm using NEST, a C# library, for my ES
adapter and this is my class:

   [DataContract]
   [ElasticType()]
   public class SearchKey
   {
           [DataMember]
           public string Id
           {
                   get;
                   set;
           }

           [DataMember]
           public int Length
           {
                   get;
                   set;
           }

           [DataMember]

[ElasticProperty(Index=ElasticSearch.Client.FieldIndexOption.not_analyzed,
IncludeInAll=false)]
public string SortHelper
{
get;
set;
}

           ...

}

Pretty simple stuff really, but it doesn't work. The same message is
being put out when I try to search. I've also tried to change the
mapping manually using the ES head plugin, with no luck either - the
field isn't being marked "not analyzed".

Any ideas?
Thanks,
-Tim


(tlyakhov) #3

That's exactly the problem - it's not being marked "not analyzed".

On Mar 28, 3:28 am, Shay Banon kim...@gmail.com wrote:

CAn you make sure that the field is actually not analyzed using the get
mapping API?

On Tue, Mar 27, 2012 at 8:33 PM, tlyakhov tlyak...@gmail.com wrote:

Hi. I have a string field I would like to use for sorting. As of some
recent version of ES, I've started getting this IOException:
"Can't sort on string types with more than one value per doc, or more
than one token per field"

After reading some information about it, I gather that I need to mark
the field as "not analyzed". I'm using NEST, a C# library, for my ES
adapter and this is my class:

   [DataContract]
   [ElasticType()]
   public class SearchKey
   {
           [DataMember]
           public string Id
           {
                   get;
                   set;
           }
           [DataMember]
           public int Length
           {
                   get;
                   set;
           }
           [DataMember]

[ElasticProperty(Index=ElasticSearch.Client.FieldIndexOption.not_analyzed,
IncludeInAll=false)]
public string SortHelper
{
get;
set;
}

           ...

}

Pretty simple stuff really, but it doesn't work. The same message is
being put out when I try to search. I've also tried to change the
mapping manually using the ES head plugin, with no luck either - the
field isn't being marked "not analyzed".

Any ideas?
Thanks,
-Tim


(system) #4