Wildcards with query_string query and custom analyzer

I have a query_string query I'm using with wildcards and a custom analyzer. The query behaves as expected for some words and not for others.

Here's the query:

    "query_string": {
      "query": "Abdulla*",
      "analyze_wildcard": true,
      "allow_leading_wildcard": true,
      "analyzer": "custom_common_grams_analyzer",
      "fields": ["text"],
      "lenient": true
    }
  }

When I use either ? or * wildcards anywhere in the query term Abdullah, I get the expected results. *bdullah, Abd?llah, and Abdull* return all documents that contain Abdullah.

The query term grandfathered, however, doesn't work the same way. I get zero results if I use any ? wildcards in the word. If I use a * wildcard I also get zero results, unless the * is in the last two characters of the word, and the number of results that come back differ if I use grandfather*d or grandfathere*. With grandfathere* I get back the full, correct set of results. My custom analyzer does incorporate stemming.

Can you please add setting of your custom analyzer. it will help to understand issue.

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