# How can I allow for fuzziness in a multimatch query for elasticsearch?

**URL:** <https://discuss.elastic.co/t/how-can-i-allow-for-fuzziness-in-a-multimatch-query-for-elasticsearch/242043>\
**Category:** Elasticsearch\
**Created:** [July 21, 2020, 2:20pm UTC](https://discuss.elastic.co/t/how-can-i-allow-for-fuzziness-in-a-multimatch-query-for-elasticsearch/242043 "2020-07-21T14:20:04Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![securisec](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/securisec/32/61412_2.png) [@securisec](https://discuss.elastic.co/u/securisec)\
**Post date:** [July 21, 2020, 2:20pm UTC](https://discuss.elastic.co/t/how-can-i-allow-for-fuzziness-in-a-multimatch-query-for-elasticsearch/242043/1 "2020-07-21T14:20:04Z")

</div>

Consider an index containing thousands of flowers and their descriptions in my ES. For example, a redacted json document would look like this:

```json
{
  "name": "rose",
  "description": "some long description about roses",
  "categories": [
    "flowers",
    "red",
    "thorn",
    "perfume"
  ]
}

```

For some other needs, I have the following mapping to convert all the `categories` into a text field like this:

```json
{
	"mappings": {
		"properties": {
			"categories": {
				"type": "keyword",
				"copy_to": "m_cats"
			},
			"m_cats": { "type": "text" }
		}
	}
}

```

The issue that I am facing is that when I run a multimatchquery, i can get a hit if i search for `red flowers`, but if i search for `red flower`, i cannot get a match because the `s` in `flowers` is missing.

I have tried to solve this by using various fuzziness values including `0` and `AUTO`, but I can never get the rose document to show up for `red flower`, only shows up for `red flowers`. I am aware that the fuzziness applies to either `keyword` or `text` fields, and my index for `flowers` is showing `m_cats` as text correctly.

My code is using the olivere elasticsearch for golang, and is structured in the following way currently:

```auto
fields := []string{"m_cats", "description"}
q := elastic.NewMultiMatchQuery(query, fields...).Fuzziness("AUTO:1,6").MinimumShouldMatch("1")
result, err := helpers.Client.Search().Index(index).Size(limit).Query(q).Do(helpers.Ctx)

```

The JSON query roughly breaks down to

```json
{
  "query": {
    "multi_match": {
      "query": "red flower",
      "fields": ["m_cats", "description"],
      "fuzziness": "AUTO:1,6",
      "minimum_should_match": 1
    }
  }
}

```

What else can I do/try so that I can get the `rose document` as a hit when I search for `red flower`? Notice the missing `s`.

Please note, I am not having issues with keyword searches, but because I want to provide additional results whenever possible, I am using `minimum_should_match` and avoiding using `operator`.

---

<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:** [August 18, 2020, 2:20pm UTC](https://discuss.elastic.co/t/how-can-i-allow-for-fuzziness-in-a-multimatch-query-for-elasticsearch/242043/2 "2020-08-18T14:20:13Z")

</div>

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