A
A
Alexander2017-10-28 20:11:01
elasticsearch
Alexander, 2017-10-28 20:11:01

How to set up ENGLISH morphology in elasticsearch?

Set up elastic. Everything works with Russian morphology, for example, if the text contains the phrase "A Christmas tree was born in the forest", then it finds "forest" on request.
But here in the text the word "wells" is found by the query "wells", but not by the query "well"!
And how to live with it?
Customization:

{
   "settings": {
    "analysis": {
     "analyzer": {
     "my_analyzer": {
      "type": "custom",
      "tokenizer": "standard",
      "filter": ["lowercase", "russian_morphology", "english_morphology", "my_stopwords"]
     }
    },
    "filter": {
     "my_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"
      }
     }
    }
   }
  }

Request:
{
   "query" : {
    
        "match_phrase" : {
            "content" : "wells"
        }
    },
    "_source": ["_id", "filename", "tags"],
    "from": 0,
    "size": 100,
    "highlight": {
        "fields": {
            "content": { }
        }
    }
}

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Dimonchik, 2017-10-28
@dimonchik2013

well, well, it’s in Africa,
and then only wells
in general are getting more and more complicated, and with the forest too
40640df82bf3a031d8820bb29d87235c.gif

A
Alexander, 2017-10-29
@esisl

Mmm... In this case,
well is a well, respectively, wells are wells,
but the remark is fair :)
I checked
tree trees
thing things
forest forests
is not looking for an infection :(

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question