# Synonym Graph giving incorrect results

**URL:** <https://discuss.elastic.co/t/synonym-graph-giving-incorrect-results/347966>\
**Category:** Elasticsearch\
**Created:** [November 25, 2023, 6:10am UTC](https://discuss.elastic.co/t/synonym-graph-giving-incorrect-results/347966 "2023-11-25T06:10:45Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![bhavya](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/bhavya/32/45679_2.png) [@bhavya](https://discuss.elastic.co/u/bhavya)\
**Post date:** [November 25, 2023, 6:10am UTC](https://discuss.elastic.co/t/synonym-graph-giving-incorrect-results/347966/1 "2023-11-25T06:10:45Z")

</div>

I am trying to implement Multi-Word Synonyms

This is the index setting

```auto
{
  "settings": {
    "analysis": {
      "filter": {
        "synonym_filter": {
          "type": "synonym_graph",
          "synonyms": [
            "roti making machine, bread making machine => chapati making machine",
            "chapati making machine => phulka making machine",
            "bread machine, bread pressing machine => bread making machine"
          ]
        }
      },
      "analyzer": {
        "custom_analyzer": {
          "tokenizer": "standard",
          "filter": ["lowercase", "synonym_filter"]
        }
      }
    }
  },
  "mappings": {
    "properties": {
      "name": {
        "type": "text",
        "analyzer": "custom_analyzer"
      }
    }
  }
}

```

These are the sample documents

```auto
{"index":{}}
{"name":"Roti Making Machine"}
{"index":{}}
{"name":"Bread Pressing Machine"}
{"index":{}}
{"name":"Chapati Making Machine"}

```

When I search for "Roti Making Machine", I get this

Search Query:

```auto
{
  "query": {
    "match": {
      "name": "Roti Making Machine"
    }
  }
}

```

Search Results:

```auto
{
    "took": 12,
    "timed_out": false,
    "_shards": {
        "total": 1,
        "successful": 1,
        "skipped": 0,
        "failed": 0
    },
    "hits": {
        "total": {
            "value": 3,
            "relation": "eq"
        },
        "max_score": 1.2478919,
        "hits": [
            {
                "_index": "product",
                "_id": "UJcRBYwBN6t5MCbzznDr",
                "_score": 1.2478919,
                "_source": {
                    "name": "Roti Making Machine"
                }
            },
            {
                "_index": "product",
                "_id": "UZcRBYwBN6t5MCbzznDr",
                "_score": 0.26706278,
                "_source": {
                    "name": "Bread Pressing Machine"
                }
            },
            {
                "_index": "product",
                "_id": "UpcRBYwBN6t5MCbzznDr",
                "_score": 0.26706278,
                "_source": {
                    "name": "Chapati Making Machine"
                }
            }
        ]
    }
}

```

Ideally, the first result that I should get is "Chapati Making Machine", because it is the synonym of the searched term. Can anyone please help me identify what is the issue?

---

<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:** [December 23, 2023, 6:11am UTC](https://discuss.elastic.co/t/synonym-graph-giving-incorrect-results/347966/2 "2023-12-23T06:11:42Z")

</div>

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