Can we sort on analyzed string


(Abhishek Jajoria) #1

I just want to know can we sort a string alphabetically if it is analyzed .


(Clinton Gormley) #2

On Mon, 2012-07-02 at 11:51 +0530, jajoria abhishek wrote:

I just want to know can we sort a string alphabetically if it is
analyzed .

No. You can't sort on a field that has multiple values, and an analyzed
string has multiple tokens.

Instead, you can use multi_fields to have two versions of the same
field: one analyzed, and one not analyzed (to be used for sorting)

clint


(Patric Weihmayer) #3

But sorting on a field type=keyword does not result in an alphabetic order (in german language we have ä,ö,ü). The only way I found out to result in an alphabetic order, is to mark the field analyzer=german, fielddata=true which takes a lot of memory from the heap.
Any ideas to avoid fielddata for correct alphabetical sorting in german language ?


(Ryan Ernst) #4

Sorting on strings uses unicode codepoint order. To customize this for German, you probably want to use the icu plugin. See https://www.elastic.co/guide/en/elasticsearch/plugins/current/analysis-icu-collation.html.


(natitsdj) #5

:การยิ้มกว้าง: