When using synonyms, got exception "term: xxx analyzed to a token (xxx) with position increment != 1 (got: 0)

Hi team,
We tried to find the root cause of an exception while using synonyms.

This is the synonym filter:

"japanese_index_synonym": {
            "type": "synonym_graph",
            "lenient": false,
            "synonyms": [
              "kfc,ケンタ,ケンタッキーフライドチキン"
            ]
          },

We have ONLY this filter in the analyzer we're using for indexing (I tried using it only for searching analyzer, it throws the same exception.)

This is the error message I see:

{
  "error": {
    "root_cause": [
      {
        "type": "remote_transport_exception",
        "reason": "[BssdTVj][x.x.x.x:9300][indices:admin/create]"
      }
    ],
    "type": "illegal_argument_exception",
    "reason": "failed to build synonyms",
    "caused_by": {
      "type": "parse_exception",
      "reason": "parse_exception: Invalid synonym rule at line 1",
      "caused_by": {
        "type": "illegal_argument_exception",
        "reason": "term: ケンタッキーフライドチキン analyzed to a token (ケンタッキーフライドチキン) with position increment != 1 (got: 0)"
      }
    }
  },
  "status": 400
}

The thing I found about this ケンタッキーフライドチキン (KFC's japanese name) is that

{
      "token": "ケンタッキーフライドチキン",
      "start_offset": 0,
      "end_offset": 13,
      "type": "word",
      "position": 0,
      "positionLength": 2
    }

because it's 名詞-固有名詞-組織 (a specific company name).

How shall we resolve this exception? Thank you so much!

Can you create a full reproduction including index and mapping creation for this on Elasticsearch 8.1.0 using a few curl commands/Kibana Dev Tools - and optionally create a bug report out of that (which I am happy to do as well). That would allow for further debugging.

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