Search Issue with Long Text keyword

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,

              },

            }

          ]

        }

      }

    },

  }

}

``

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.

with prefix query "fuzziness" is stop working.

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.

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

This is search query.

"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,

              },

            }

          ]

        }

      }

    },

  }

}

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

That’s a prefix query not a fuzzy query.

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