Elasticsearch synonym_graph filter not giving all tokens

183 views Asked by At

I'm trying to use synonym_graph filter in the analyzer but it is not generating the result we need.

This is my curl command to analyze text:

curl -X GET "localhost:9200/_analyze?pretty" -H 'Content-Type: application/json' -d'
{
   "tokenizer": "whitespace",
   "filter": [
   
      {
       "type": "synonym_graph",
       "lenient": true,
       "synonyms": [ "one market,responsis", "one,1"]
      }
   ],
   "text": "responsis"
}'

I got analyzed tokens: one, responsis and market

Given response:

{
  "tokens" : [
    {
      "token" : "one",
      "start_offset" : 0,
      "end_offset" : 9,
      "type" : "SYNONYM",
      "position" : 0
    },
    {
      "token" : "responsis",
      "start_offset" : 0,
      "end_offset" : 9,
      "type" : "word",
      "position" : 0,
      "positionLength" : 2
    },
    {
      "token" : "market",
      "start_offset" : 0,
      "end_offset" : 9,
      "type" : "SYNONYM",
      "position" : 1
    }
  ]
}

But i want the analyzed tokens to be: Responis, One, Market and 1

Some how it is not giving all tokens to generate the result.

[Note: I don't want to add synonyms in one group.]

Thank you for your answer in advance.

0

There are 0 answers