# Search Issue with Long Text keyword

**URL:** <https://discuss.elastic.co/t/search-issue-with-long-text-keyword/266513>\
**Category:** Elasticsearch\
**Created:** [March 8, 2021, 6:44am UTC](https://discuss.elastic.co/t/search-issue-with-long-text-keyword/266513 "2021-03-08T06:44:07Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![sdubey472](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sdubey472/32/85128_2.png) [@sdubey472](https://discuss.elastic.co/u/sdubey472)\
**Post date:** [March 8, 2021, 6:44am UTC](https://discuss.elastic.co/t/search-issue-with-long-text-keyword/266513/1 "2021-03-08T06:44:07Z")

</div>

I'm facing the issue with elastic Search, Actually I've search query given bellow and By using this search query I'm facing the issue with long text, whenever I type long text to search then search isn't giving proper response until search text not matched upto 90%, For example if i search for corporate and I type corp or corpor then it's not giving corporate assets until I type corpora, Instead of long text, In short text it's working if i type for cort then it's giving result  
``  
let SearchQueryWIthMatch ={

```
"size": itemPerPage,

"from":startFrom,

"track_total_hits": true,

  "query": {

    "bool": {

      "must": {

        "multi_match": {

          "fields": ["name^2", "default_keyword^1"],

          "query": `${this.searchQuery}`,

          "fuzziness": 2,

          "operator": "and" 

        }

      },

      "filter": {

        "bool": {

          "must": [

            {

              "term": {

                "is_adult": "no",

              },

            },

            {

              "term": {

                "catlogue": CatlougeTypeConstants.catlogue,

              },

            }

          ]

        }

      }

    },

  }

}

```

``

---

<div class="post-metadata">

**Author:** ![Mark\_Harwood](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mark_harwood/32/10538_2.png) [@Mark\_Harwood](https://discuss.elastic.co/u/Mark_Harwood)\
**Post date:** [March 8, 2021, 8:23am UTC](https://discuss.elastic.co/t/search-issue-with-long-text-keyword/266513/2 "2021-03-08T08:23:28Z")

</div>

> [@sdubey472](#):
>
> it's not giving corporate assets until I type corpora,

That’s the fuzziness:2 setting you passed kicking in. 2 character edits are required to add t then e.  
Fuzziness is about deleting, adding or changing up to 2 characters anywhere inside a word to find a match. If you want to match on just the start of a term see the “prefix” query.

---

<div class="post-metadata">

**Author:** ![sdubey472](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sdubey472/32/85128_2.png) [@sdubey472](https://discuss.elastic.co/u/sdubey472)\
**Post date:** [March 15, 2021, 8:27am UTC](https://discuss.elastic.co/t/search-issue-with-long-text-keyword/266513/3 "2021-03-15T08:27:25Z")

</div>

> [@Mark\_Harwood](#):
>
> Fuzziness is about deleting, adding or changing up to 2 ch

with prefix query "fuzziness" is stop working.

---

<div class="post-metadata">

**Author:** ![Mark\_Harwood](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mark_harwood/32/10538_2.png) [@Mark\_Harwood](https://discuss.elastic.co/u/Mark_Harwood)\
**Post date:** [March 15, 2021, 8:30am UTC](https://discuss.elastic.co/t/search-issue-with-long-text-keyword/266513/4 "2021-03-15T08:30:49Z")

</div>

Yes, at the execution level prefix matching and fuzzy matching are two different query types.

The former matches any number of additional characters after the given search string while the latter only permits a maximum difference of 2 characters between search string and document value.

---

<div class="post-metadata">

**Author:** ![sdubey472](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sdubey472/32/85128_2.png) [@sdubey472](https://discuss.elastic.co/u/sdubey472)\
**Post date:** [March 15, 2021, 8:49am UTC](https://discuss.elastic.co/t/search-issue-with-long-text-keyword/266513/5 "2021-03-15T08:49:38Z")

</div>

> [@Mark\_Harwood](#):
>
> Yes, at the execution level prefix matching and fuzzy matching are two different query types.

OKay but I need fuzziness in my search query, if i search amer then i want american-gods in search.

This is search query.

```auto
"size": itemPerPage,

"from":startFrom,

"track_total_hits": true,

  "query": {

    "bool": {

      "must": {

        "multi_match": {

          "fields": ["name^2", "default_keyword^1"],

          "query": `${this.searchQuery}`,

          "fuzziness": 2,

          "operator": "and" 

        }

      },

      "filter": {

        "bool": {

          "must": [

            {

              "term": {

                "is_adult": "no",

              },

            },

            {

              "term": {

                "catlogue": CatlougeTypeConstants.catlogue,

              },

            }

          ]

        }

      }

    },

  }

}

```

---

<div class="post-metadata">

**Author:** ![sdubey472](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sdubey472/32/85128_2.png) [@sdubey472](https://discuss.elastic.co/u/sdubey472)\
**Post date:** [March 15, 2021, 8:51am UTC](https://discuss.elastic.co/t/search-issue-with-long-text-keyword/266513/6 "2021-03-15T08:51:00Z")

</div>

Please correct my search query, I'm facing problem to correct it as per need.

---

<div class="post-metadata">

**Author:** ![Mark\_Harwood](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mark_harwood/32/10538_2.png) [@Mark\_Harwood](https://discuss.elastic.co/u/Mark_Harwood)\
**Post date:** [March 15, 2021, 9:30am UTC](https://discuss.elastic.co/t/search-issue-with-long-text-keyword/266513/7 "2021-03-15T09:30:34Z")

</div>

> [@sdubey472](#):
>
> I need fuzziness in my search query, if i search amer then i want american-gods in search.

That’s a [prefix query](https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-prefix-query.html) not a fuzzy query.

---

<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 12, 2021, 9:31am UTC](https://discuss.elastic.co/t/search-issue-with-long-text-keyword/266513/8 "2021-04-12T09:31:11Z")

</div>

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