Last active
January 13, 2022 12:21
-
-
Save svartalf/4465752 to your computer and use it in GitHub Desktop.
Example of the ElasticSearch configuration for russian stemming and morphology
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
requests.put('http://localhost:9200/site/', data=json.dumps({ | |
'settings': { | |
'analysis': { | |
'analyzer': { | |
'ru': { | |
'type': 'custom', | |
'tokenizer': 'standard', | |
"filter": ['lowercase', 'russian_morphology', 'english_morphology', 'ru_stopwords'], | |
}, | |
}, | |
'filter': { | |
'ru_stopwords': { | |
'type': 'stop', | |
'stopwords': u'а,без,более,бы,был,была,были,было,быть,в,вам,вас,весь,во,вот,все,всего,всех,вы,где,да,даже,для,до,его,ее,если,есть,еще,же,за,здесь,и,из,или,им,их,к,как,ко,когда,кто,ли,либо,мне,может,мы,на,надо,наш,не,него,нее,нет,ни,них,но,ну,о,об,однако,он,она,они,оно,от,очень,по,под,при,с,со,так,также,такой,там,те,тем,то,того,тоже,той,только,том,ты,у,уже,хотя,чего,чей,чем,что,чтобы,чье,чья,эта,эти,это,я,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', | |
}, | |
'ru_stemming': { | |
'type': 'snowball', | |
'language': 'Russian', | |
} | |
}, | |
} | |
} | |
})) |
Спасибо за этот gist.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Немного более подробное описание на русском: http://blog.svartalf.info/post/39828062189/elasticsearch-vs-sphinx
И дополнение про бесполезность фильтра
ru_stemming
при использованииrussian_morphology
: https://groups.google.com/forum/#!topic/elasticsearch-ru/2RFQ3VC9BDk