简体   繁体   中英

Custom sort analyser for Elastic search

How can we sort tokens before indexing to elastic search. for Eg. i want to index

 "a b" => "ab" 
 "b a" => "ab"
 "java language" => "javalanguage"
 "requirement analysis" => "analysisrequirement"

After sorting we are concatenating all tokens for our use case.

How can we achieve this using custom sort analyser?.

EDIT: so we have applied couple of custom analyser on Elastic search mapping for our use case. For eg. we have

token
stemming
custom_words_concatenation

I want to sorting of words using analyser. like below,

token
stemming
sort
custom_words_concatenation

Created a custom sort analyzer.

link github https://github.com/ranjeet-floyd/plugin-sortchar.git

Convert input string to char[] and sort using Arrays.sort .

For eg:

requirement analysis  =>  aaeeeiilmnnqrrsstuy
analysis requirement => aaeeeiilmnnqrrsstuy

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM