# What is the default edit distance for query\_string

**URL:** <https://discuss.elastic.co/t/what-is-the-default-edit-distance-for-query-string/249810>\
**Category:** Elasticsearch\
**Created:** [September 24, 2020, 12:22pm UTC](https://discuss.elastic.co/t/what-is-the-default-edit-distance-for-query-string/249810 "2020-09-24T12:22:11Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![eclipse](https://avatars.discourse-cdn.com/v4/letter/e/6a8cbe/32.png) [@eclipse](https://discuss.elastic.co/u/eclipse)\
**Post date:** [September 24, 2020, 12:22pm UTC](https://discuss.elastic.co/t/what-is-the-default-edit-distance-for-query-string/249810/1 "2020-09-24T12:22:11Z")

</div>

Hi,  
I wonder about the default edit distance of query\_string

For a document containing `quick`, the following query

```auto
 {
   "query": {
     "query_string": {
       "query": "quakc~2"
     }
   }
 }

```

can return the document. But the following query won't:

```auto
 {
  "query": {
     "query_string": {
       "query": "quakc~"
     }
   }
 }

```

But according to the documentation [https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-query-string-query.html](https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-query-string-query.html), if omit the number after tilde ~, the default edit distance is `2`, the above two queries should have the same search result. Am I misunderstanding the documentation?

Thanks!

---

<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:** [October 22, 2020, 12:22pm UTC](https://discuss.elastic.co/t/what-is-the-default-edit-distance-for-query-string/249810/2 "2020-10-22T12:22:13Z")

</div>

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