Undesired Stopwords in Elastic Search


(Jack Tan) #1

I am using Elastic Search 6.This is query

PUT /semtesttest
{
    "settings": {
        "index" : {
            "analysis" : {
              "filter": {
                "my_stop": {
                    "type": "stop",
                    "stopwords_path": "analysis1/stopwords.csv"
                  },
                 "synonym" : {
                        "type" : "synonym",
                        "synonyms_path" : "analysis1/synonym.txt"
                    }
                },
                "analyzer" : {
                    "my_analyzer" : {
                        "tokenizer" : "standard",
                        "filter" : ["synonym","my_stop"]
                    }
                }
            }
        }
    },
    "mappings": {
      "all_questions": {
         "dynamic": "strict",
          "properties": {
            "kbaid":{
              "type": "integer"
            },
            "answer":{
              "type": "text"
            },
            "question":    {
              "type": "text",
              "analyzer": "my_analyzer"
            }
          }
        }
    }
}

PUT /semtesttest/all_questions/1
{
  "question":"this is hippie"
}

GET /semtesttest/all_questions/_search
{
    "query":{
      "fuzzy":{"question":{"value":"hippie","fuzziness":2}}
    }
}

GET /semtesttest/all_questions/_search
{
    "query":{
      "fuzzy":{"question":{"value":"this is","fuzziness":2}}
    }
}

in synonym.txt it is

this, that, money => sainai

in stopwords.csv it is

hello
how
are
you

The first get ('hippie') return empty
only the second get ('this is') return results

what is the problem? It looks like the stop word "this is" is filtered in the first query, but I have specified my stop words explicitly?


(system) #2

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.