# Metaphone analyzer being too ambigous

**URL:** <https://discuss.elastic.co/t/metaphone-analyzer-being-too-ambigous/221516>\
**Category:** Elasticsearch\
**Created:** [February 29, 2020, 10:51am UTC](https://discuss.elastic.co/t/metaphone-analyzer-being-too-ambigous/221516 "2020-02-29T10:51:22Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![abhijith\_chandran](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/abhijith_chandran/32/60470_2.png) [@abhijith\_chandran](https://discuss.elastic.co/u/abhijith_chandran)\
**Post date:** [February 29, 2020, 10:51am UTC](https://discuss.elastic.co/t/metaphone-analyzer-being-too-ambigous/221516/1 "2020-02-29T10:51:22Z")

</div>

Hi,  
I am currently using the Metaphone analyzer and it is acting too ambiguous. For example, here is the result for `Murder` using the `_analyze` API.

```auto
{
    "tokens": [
        {
            "token": "MRTR",
            "start_offset": 0,
            "end_offset": 8,
            "type": "<ALPHANUM>",
            "position": 0
        }
    ]
}

```

Now, If I search for `Mehtrotra`, the result is same, although the phonetics (pronounciations )of both are radically different. How do I make do of this?

Here is the settings I used while setting up the index:

```auto
{
    "settings": {
        "index": {
            "analysis": {
                "analyzer": {
                    "my_analyzer": {
                        "tokenizer": "standard",
                        "filter": [
                            "lowercase",
                            "my_metaphone"
                        ]
                    }
                },
                "filter": {
                    "my_metaphone": {
                        "type": "phonetic",
                        "encoder": "metaphone",
                        "replace": true
                    }
                }
            }
        }
    },
    "mappings": {
        "properties": {
            "author": {
                "type": "text",
                "analyzer": "my_analyzer"
            },
            "bench": {
                "type": "text",
                "analyzer": "my_analyzer"
            },
            "citation": {
                "type": "text"
            },
            "court": {
                "type": "text"
            },
            "date": {
                "type": "text"
            },
            "id_": {
                "type": "text"
            },
            "verdict": {
                "type": "text"
            },
            "title": {
                "type": "text",
                "analyzer": "my_analyzer",
                "fields": {
                    "standard": {
                        "type": "text"
                    }
                }
            },
            "content": {
                "type": "text",
                "analyzer": "my_analyzer",
                "fields": {
                    "standard": {
                        "type": "text"
                    }
                }
            }
        }
    }
}

```

Thanks,

---

<div class="post-metadata">

**Author:** ![abhijith\_chandran](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/abhijith_chandran/32/60470_2.png) [@abhijith\_chandran](https://discuss.elastic.co/u/abhijith_chandran)\
**Post date:** [March 1, 2020, 3:37am UTC](https://discuss.elastic.co/t/metaphone-analyzer-being-too-ambigous/221516/2 "2020-03-01T03:37:43Z")

</div>

Can someone please answer this? Thanks.

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [March 1, 2020, 6:05am UTC](https://discuss.elastic.co/t/metaphone-analyzer-being-too-ambigous/221516/3 "2020-03-01T06:05:01Z")

</div>

Read [this](https://discuss.elastic.co/t/about-the-elasticsearch-category/21) and specifically the "Also be patient" part.

It's fine to answer on your own thread after 2 or 3 days (not including weekends) if you don't have an answer.

---

<div class="post-metadata">

**Author:** ![abhijith\_chandran](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/abhijith_chandran/32/60470_2.png) [@abhijith\_chandran](https://discuss.elastic.co/u/abhijith_chandran)\
**Post date:** [March 2, 2020, 1:11pm UTC](https://discuss.elastic.co/t/metaphone-analyzer-being-too-ambigous/221516/4 "2020-03-02T13:11:14Z")

</div>

Will remember.

---

<div class="post-metadata">

**Author:** ![Mark\_Harwood](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mark_harwood/32/10538_2.png) [@Mark\_Harwood](https://discuss.elastic.co/u/Mark_Harwood)\
**Post date:** [March 2, 2020, 1:52pm UTC](https://discuss.elastic.co/t/metaphone-analyzer-being-too-ambigous/221516/5 "2020-03-02T13:52:55Z")

</div>

False positives are an inevitable result of using phonetic indexing.  
Phonetic algorithms aim to improve recall while suffering a loss in precision.  
It's always a trade-off.

If you want ranking to prefer exact matches to sounds-like matches then index your content as both normal text tokens and phonetic tokens using multi-fields. Then in your searches uses a `bool` query and 2 `should` clauses -one for matching the normal text field (using exact tokens) and one for the fuzzier phonetic field. Documents which match both clauses will appear first in the results

---

<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:** [March 30, 2020, 1:53pm UTC](https://discuss.elastic.co/t/metaphone-analyzer-being-too-ambigous/221516/6 "2020-03-30T13:53:05Z")

</div>

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