# How to determine which terms where matched in a query using the fuzziness parameter

**URL:** <https://discuss.elastic.co/t/how-to-determine-which-terms-where-matched-in-a-query-using-the-fuzziness-parameter/174318>\
**Category:** Elasticsearch\
**Created:** [March 28, 2019, 11:24am UTC](https://discuss.elastic.co/t/how-to-determine-which-terms-where-matched-in-a-query-using-the-fuzziness-parameter/174318 "2019-03-28T11:24:30Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![SmashingQuasar](https://avatars.discourse-cdn.com/v4/letter/s/ecc23a/32.png) [@SmashingQuasar](https://discuss.elastic.co/u/SmashingQuasar)\
**Post date:** [March 28, 2019, 11:24am UTC](https://discuss.elastic.co/t/how-to-determine-which-terms-where-matched-in-a-query-using-the-fuzziness-parameter/174318/1 "2019-03-28T11:24:30Z")

</div>

Hello!

So I'm working on a search engine for a customer and I'm using the fuzziness parameter in my query.

The query is as follows:

```
{
    "from": 0,
    "size": 12,
    "query": {
        "bool": {
            "should": [
                {
                    "bool": {
                        "should": {
                            "match": {
                                "reference": 0
                            }
                        },
                        "boost": 2
                    }
                },
                {
                    "match": {
                        "name": {
                            "query": "pain au chcolat",
                            "cutoff_frequency": 0.01,
                            "minimum_should_match": "3<75%",
                            "analyzer": "french",
                            "fuzziness": "AUTO"
                        }
                    }
                }
            ]
        }
    }
}

```

As you can see it the search engine is for a french website. In the graphic concept they want to highlight matched results.

In the example I gave you the query will match `pain chocolat`. I'd like to be able to highlight both 'pain' and 'chocolat' but I don't know if Elasticsearch can tell me which terms were matched.

Could you guys please give me a hint?

Thanks a lot!

---

<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 28, 2019, 11:58am UTC](https://discuss.elastic.co/t/how-to-determine-which-terms-where-matched-in-a-query-using-the-fuzziness-parameter/174318/2 "2019-03-28T11:58:20Z")

</div>

Did you try with `chocolatine`? 🤣

Did you try [https://www.elastic.co/guide/en/elasticsearch/reference/current/search-request-highlighting.html](https://www.elastic.co/guide/en/elasticsearch/reference/current/search-request-highlighting.html)?

---

<div class="post-metadata">

**Author:** ![SmashingQuasar](https://avatars.discourse-cdn.com/v4/letter/s/ecc23a/32.png) [@SmashingQuasar](https://discuss.elastic.co/u/SmashingQuasar)\
**Post date:** [March 28, 2019, 12:41pm UTC](https://discuss.elastic.co/t/how-to-determine-which-terms-where-matched-in-a-query-using-the-fuzziness-parameter/174318/3 "2019-03-28T12:41:08Z")

</div>

🤣

Thanks it worked perfectly! I was looking in the fuzzy query section of the documentation.

---

<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:** [April 25, 2019, 12:41pm UTC](https://discuss.elastic.co/t/how-to-determine-which-terms-where-matched-in-a-query-using-the-fuzziness-parameter/174318/4 "2019-04-25T12:41:15Z")

</div>

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