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:
```
{
"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:
```
```
{
"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:
```
{
"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!
```
{
"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