# Synonym ÅÄÖ exception

**URL:** <https://discuss.elastic.co/t/synonym-aao-exception/99276>\
**Category:** Elasticsearch\
**Created:** [September 4, 2017, 10:21am UTC](https://discuss.elastic.co/t/synonym-aao-exception/99276 "2017-09-04T10:21:32Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![aslamy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/aslamy/32/18254_2.png) [@aslamy](https://discuss.elastic.co/u/aslamy)\
**Post date:** [September 4, 2017, 10:21am UTC](https://discuss.elastic.co/t/synonym-aao-exception/99276/1 "2017-09-04T10:21:33Z")

</div>

Hi !  
I got some exception when I use swedish ÅÄÖ on my synonym words.

```
{
  "error" : {
    "root_cause" : [
      {
        "type" : "illegal_argument_exception",
        "reason" : "failed to build synonyms"
      }
    ],
    "type" : "illegal_argument_exception",
    "reason" : "failed to build synonyms",
    "caused_by" : {
      "type" : "malformed_input_exception",
      "reason" : "Input length = 1"
    }
  },
  "status" : 400
}

```

The problem occur when I use a file to read synonyms.  
This works fine.

```
{
	"settings": {
		"index": {
			"analysis": {
				"filter": {
					"synonym": {
						"type": "synonym",
						"synonyms": [
							"Äpple, App"
						]
					}
				}
			}
		}
	}
}

```

But not when reading from a file:

```
{
    "settings": {
        "index" : {
            "analysis" : {
                "filter" : {
                    "synonym" : {
                        "type" : "synonym", 
                        "synonyms_path" : "synonym.txt",
                        "tokenizer" : "standard" 
                    }
                }
            }
        }
    }
}

```

I already read this:

> [@Synonym using a file is not working: malformed\_input\_exception](https://discuss.elastic.co/t/synonym-using-a-file-is-not-working-malformed-input-exception/60487/5):
>
> Hi David and thanx. I must correct myself. Acutally it's not the 2 tokens synonym to create the error but the diacritic. the original row was: abbattere, ammainare, peggiorare, tirare giù =\> this causes the malformed error because of the ù If ireplace ù with u' it works! abbattere, ammainare, peggiorare, tirare giu' =\> OK Therefore i think i'm going to replace all the diacritics Thanx valerio

I have already applied an asciifolding token filter before the synonym filter in the filter chain but still not working.

```
   "analysis": {
      "analyzer": {
        "custom_swedish_analyzer": {
          "type": "custom",
          "filter": [
            "asciifolding",
            "lowercase",
            "synonym",
            "swedish_stemmer_filter",
            "swedish_stopwords_filter"
          ],
          "tokenizer": "standard"
        }

```

---

<div class="post-metadata">

**Author:** ![aslamy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/aslamy/32/18254_2.png) [@aslamy](https://discuss.elastic.co/u/aslamy)\
**Post date:** [September 4, 2017, 12:19pm UTC](https://discuss.elastic.co/t/synonym-aao-exception/99276/2 "2017-09-04T12:19:55Z")

</div>

The solution was using UTF8 encoded file .

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [October 2, 2017, 12:19pm UTC](https://discuss.elastic.co/t/synonym-aao-exception/99276/3 "2017-10-02T12:19:55Z")

</div>

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