vikas gupta
vikas gupta

Reputation: 89

stopword analyser in Elastic Search

I just created a stopword analyser like this

{
"settings": {
"analysis": {
  "filter": {
    "english_stopwords": {
      "type": "stop",
      "stopwords": "_english_"
    }
  },
  "analyzer": {
    "filter_english_stopwords": {
      "type": "custom",
      "tokenizer": "standard",
      "filter": [
        "english_stopwords",
        "porter_stem"
      ]
    }
  }
}}}

and then query in elastic search like this

{
"query": {
"filtered": {
  "query": {
    "multi_match": {
      "query": "an clubbing",
      "fields": [
        "event_name",
        "event_place",
        "event_description"
      ],
      "analyzer": [
        "filter_english_stopwords"
      ]
    }
  }
}}}

it removes the "an" keyword from search which is fine but it shows me all data having word club not clubbing I have to find all data having word clubbing only

        "_source": {
            "event_id": "1669",
            "event_name": "Exclusive Ladies Night Party",
            "regular_id": "56750ee601fcfffc058b4567",
            "event_place": "Asom Club Dwarka, Dwarka, New Delhi, India",

See event_place value. Please help me out. Thanks

Upvotes: 0

Views: 211

Answers (1)

Andrei Stefan
Andrei Stefan

Reputation: 52368

"porter_stem" filter is transforming your clubbing search word in club and this is why it's matching Asom Club Dwarka, Dwarka, New Delhi, India. Remove the porter_stem filter and you should be good to go.

Upvotes: 2

Related Questions