# Combining phonetic filter with synonym\_graph filter

**URL:** <https://discuss.elastic.co/t/combining-phonetic-filter-with-synonym-graph-filter/322838>\
**Category:** Elasticsearch\
**Created:** [January 10, 2023, 1:12pm UTC](https://discuss.elastic.co/t/combining-phonetic-filter-with-synonym-graph-filter/322838 "2023-01-10T13:12:25Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![rune](https://avatars.discourse-cdn.com/v4/letter/r/e68b1a/32.png) [@rune](https://discuss.elastic.co/u/rune)\
**Post date:** [January 10, 2023, 1:12pm UTC](https://discuss.elastic.co/t/combining-phonetic-filter-with-synonym-graph-filter/322838/1 "2023-01-10T13:12:25Z")

</div>

So - I want to use the phonetic filter to transform the user query into phonetic hashes as it's supposed to do. F.ex. with "refined\_soundex" i get:

pacemaker -\> P103080309

Then I want to take this hash value to my synonyms file like:

P103080309 =\> heart pacemaker,ventricular pacing

The idea is that I get a sort of spell check on the user query but not on the synonyms and not in the index.

Trying to create this doesn't seem to be possible though:

```auto
  "index": {
    "analysis": {
      "analyzer": {
        "synonym_graph_analyzer_with_phonetics": {
          "filter": [
            "english_possessive_stemmer",
            "lowercase",
            "phonetic",
            "synonym"
          ],
          "tokenizer": "standard"
        }
      },
      "filter": {
        "english_possessive_stemmer": {
          "type": "stemmer",
          "language": "possessive_english"
        },
        "synonym": {
          "type": "synonym_graph",
          "synonyms_path": "elastic-synonyms-phonetic.txt"
        },
        "phonetic": {
          "type": "phonetic",
          "encoder": "refined_soundex" 
        }
      }
    }
  }

```

Throws an error:

"Token filter [phonetic] cannot be used to parse synonyms"

I actually don't understand the message. I'm not using the phonetic filter to parse synonyms. I'm using the filter to alter the user query BEFORE I send it to the synonyms filter.

Or?

---

<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:** [February 7, 2023, 1:12pm UTC](https://discuss.elastic.co/t/combining-phonetic-filter-with-synonym-graph-filter/322838/2 "2023-02-07T13:12:43Z")

</div>

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