Plugin for ElasticSearch (8.4.1) implements the analyzer for Russian and English languages, the dictionaries of the project http://aot.ru are used. The original plugin was taken from here https://github.com/imotov/elasticsearch-analysis-morphology which in turn uses russian_morphology and english_morphology from the Russian Morphology for Apache Lucene project https://github.com/AKuznetsov/russianmorphology The plugin adds two analyzers and token filter: "russian_morphology" and "english_morphology"
When creating an index, we specify the settings indicating the analyzer and create a mapping based on the settings. Example
PUT /products
{
"settings": {
"index": {
"analysis": {
"analyzer": {
"product_name_analyzer": {
"type": "custom",
"tokenizer": "standard",
"filter": [
"lowercase",
"search_synonym",
"russian_morphology",
"english_morphology",
"ru_stopwords"
]
}
},
"filter": {
"search_synonym": {
"ignore_case": "true",
"type": "synonym",
"synonyms": [
"bosch,бош"
]
},
"ru_stopwords": {
"type": "stop",
"stopwords": "а,без,более,бы,был,была,были,было,быть,в,вам,вас,весь,во,вот,все,всего,всех,вы,где,да,даже,для,до,его,ее,если,есть,еще,же,за,здесь,и,из,или,им,их,к,как,ко,когда,кто,ли,либо,мне,может,мы,на,надо,наш,не,него,нее,нет,ни,них,но,ну,о,об,однако,он,она,они,оно,от,очень,по,под,при,с,со,так,также,такой,там,те,тем,то,того,тоже,той,только,том,ты,у,уже,хотя,чего,чей,чем,что,чтобы,чье,чья,эта,эти,это,я,a,an,and,are,as,at,be,but,by,for,if,in,into,is,it,no,not,of,on,or,such,that,the,their,then,there,these,they,this,to,was,will,with"
}
}
}
}
},
"mappings": {
"properties": {
"name": {
"type": "text",
"analyzer": "product_name_analyzer"
},
"code": {
"type": "keyword"
},
"description": {
"type": "text",
"analyzer": "product_name_analyzer"
},
"brand": {
"type": "keyword"
}
}
}
}
An image of the original elasticsearch 8.4.1 with the step of installing the analysis-morphology plugin
tests are not implemented, collect mvn clean package -Dmaven.test.skip=true
and then copy the resulting /target/releases/elasticsearch-analysis-morphology-8.4.1.zip to an existing cluster and install via bin/elasticsearch-plugin install file: elasticsearch-analysis-morphology-8.4.1.zip