# Problems matching synonyms after stemming

**URL:** https://discuss.elastic.co/t/problems-matching-synonyms-after-stemming/388548
**Category:** Elasticsearch
**Created:** [July 21, 2026, 5:09pm UTC](https://discuss.elastic.co/t/problems-matching-synonyms-after-stemming/388548 "2026-07-21T17:09:09Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![hmpalmeida](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/hmpalmeida/32/147906_2.png) [@hmpalmeida](https://discuss.elastic.co/u/hmpalmeida)
#### Post date: [July 21, 2026, 5:09pm UTC](https://discuss.elastic.co/t/problems-matching-synonyms-after-stemming/388548/1 "2026-07-21T17:09:09Z")

</div>

Hello!

I'm currently having some problems trying to use a synonym\_graph filter after applying a stemmer. My problem can be replicated with the following "\_analyze" request:

````json
```
{
  "tokenizer": "whitespace",
  "filter": [
    {
      "type": "stemmer_override",
      "rules": "recurso-humano => recurso-humano"
    },
    {
      "type": "stemmer",
      "language": "light_portuguese"
    },
    {
      "type": "synonym_graph",
      "synonyms": [
        "recurs human => recurso-humano"
      ]
    },
    "f_flatten_graph"
  ],
  "explain": true,
  "text": "recursos humanos"
}
```

````

The synonym\_graph step of this analyzer reads as following:

````json
```
```
        {
			"name": " __anonymous__ synonym_graph",
			"tokens": [
				{
					"token": "recurs",
					"start_offset": 0,
					"end_offset": 8,
					"type": "word",
					"position": 0,
					"bytes": "[72 65 63 75 72 73]",
					"keyword": false,
					"positionLength": 1,
					"termFrequency": 1
				},
				{
					"token": "human",
					"start_offset": 9,
					"end_offset": 16,
					"type": "word",
					"position": 1,
					"bytes": "[68 75 6d 61 6e]",
					"keyword": false,
					"positionLength": 1,
					"termFrequency": 1
				}
			]
		},
```	

````

So, even though the stemmed tokens are exactly the same defined on the synonyms list, they won't match. However, if I change the synonym to be the ubstemmed version of the string, such as this:

````json
```
{
  "tokenizer": "whitespace",
  "filter": [
    {
      "type": "stemmer_override",
      "rules": "recurso-humano => recurso-humano"
    },
    {
      "type": "stemmer",
      "language": "light_portuguese"
    },
    {
      "type": "synonym_graph",
      "synonyms": [
        "recursos humanos => recurso-humano"
      ]
    },
    "f_flatten_graph"
  ],
  "explain": true,
  "text": "recursos humanos"
}
```

````

Than it will work!

````json
```
            {
				"name": " __anonymous__ synonym_graph",
				"tokens": [
					{
						"token": "recurso-humano",
						"start_offset": 0,
						"end_offset": 16,
						"type": "SYNONYM",
						"position": 0,
						"bytes": "[72 65 63 75 72 73 6f 2d 68 75 6d 61 6e 6f]",
						"keyword": false,
						"positionLength": 1,
						"termFrequency": 1
					}
				]
			},
```

````

Am I missing something? I'm currently using Elasticsearch 9.4.0
