Synonym example with i pod doesn't work


(Marek K) #1

Hi.

I have introduced the synonyms into our index. I followed steps described here:
https://www.elastic.co/guide/en/elasticsearch/reference/current/analysis-synonym-tokenfilter.html

Basically it works for most of the cases, however it doesn't work with the given example "i pod, i-pod, ipod"
I tried it on 5.5 and additionally I have checked it on 6.5, same results on both versions.
Can you tell me if i am doing something wrong, or this example in the docs is invalid ?
What I am doing:
Filter definition:

    "syn" : {
      "type" : "synonym_graph",
      "synonyms" : [
        "ipod, i-pod, i pod"
      ]
    }

Analyzer:

        "my_analyzer": {
      "type": "custom",
      "tokenizer": "standard",
      "filter": [
        "lowercase",
        "english_stop",
        "edge_ngram_filter"
      ]
    },

Search analyzer:

    "search_analyzer": {
      "type": "custom",
      "tokenizer": "standard",
      "filter": [
        "lowercase",
        "english_stop",
        "syn"
      ]
    }

I will just add that I made it work by using custom tokenizer and fuzzy query with fuzzines set to 2, below you can find the tokenizer definition:

"tokenizer": {
        "punctuation": { 
          "type": "pattern",
          "pattern": "[.,!?]"
        }
      },

(Christoph) #2

Can you also post an example document and a query that doesn't return the results you are expecting?


(system) closed #3

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