# How to filter data despite the spelling mistake and according to the max gap between passed words

**URL:** <https://discuss.elastic.co/t/how-to-filter-data-despite-the-spelling-mistake-and-according-to-the-max-gap-between-passed-words/208092>\
**Category:** Elasticsearch\
**Created:** [November 15, 2019, 2:33pm UTC](https://discuss.elastic.co/t/how-to-filter-data-despite-the-spelling-mistake-and-according-to-the-max-gap-between-passed-words/208092 "2019-11-15T14:33:16Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![akhut13](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/akhut13/32/57771_2.png) [@akhut13](https://discuss.elastic.co/u/akhut13)\
**Post date:** [November 15, 2019, 2:33pm UTC](https://discuss.elastic.co/t/how-to-filter-data-despite-the-spelling-mistake-and-according-to-the-max-gap-between-passed-words/208092/1 "2019-11-15T14:33:16Z")

</div>

If I have these two strings:

1. George Orwell is my favorite writer
2. My favorite writers name is George, who was born in 1903 and whose last name is Orwell

Here's the criteria that i would like to apply to my search when searching for 2+ words:

- **search despite spelling mistake (whats does fuzziness)**

- **filter result according distance between passed words (for example in first sentence distance between George and Orwell is 0, cause they are side by side, and in second one I have 10 other words between them). So I want to passed words be side by side in returned result. (what does max\_gaps in intervals query)**

So to tell directly I need to work together in intervals query "fuzziness" and "max\_gaps"

Example:  
Let's search by spelling mistake "George Orwel" - my query should return only first sentence, because it must recognize that George Orwel -\> George Orwell and also distance between these two words is 0;

As I said for me It will be ideal if intervals query had the fuzziness :

```
POST /cases/_search
{
  "query": {
    "intervals" : {
      "firstName" : {
        "match" : {
          "query" : "George Orwl ",
          "max_gaps" : 0,
           **"fuzziness": 6**
        }
      }
    }
  }
}

```

but it doesn't have. So Have you any ideas how should solve such kind of problem

---

<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 13, 2019, 2:33pm UTC](https://discuss.elastic.co/t/how-to-filter-data-despite-the-spelling-mistake-and-according-to-the-max-gap-between-passed-words/208092/2 "2019-12-13T14:33:27Z")

</div>

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