# Synonym list combined with wildcards got no more results

**URL:** <https://discuss.elastic.co/t/synonym-list-combined-with-wildcards-got-no-more-results/220683>\
**Category:** Elasticsearch\
**Created:** [February 24, 2020, 3:14pm UTC](https://discuss.elastic.co/t/synonym-list-combined-with-wildcards-got-no-more-results/220683 "2020-02-24T15:14:59Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![JoeLiMo](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/joelimo/32/51127_2.png) [@JoeLiMo](https://discuss.elastic.co/u/JoeLiMo)\
**Post date:** [February 24, 2020, 3:14pm UTC](https://discuss.elastic.co/t/synonym-list-combined-with-wildcards-got-no-more-results/220683/1 "2020-02-24T15:14:59Z")

</div>

Hi,

I hope anyone could help us to develop the right way to solve our little problems with synonyms and wildcards in elastic search.

We are using a synonym list at our search to identified all relevant typings of users at our website. Without wildcard everything works fine, like:

```
curl -XGET --noproxy es01.liqui-moly.com.local:9200, 'es01.liqui-moly.com.local:9200/limo_b2c_de_idx2/_validate/query?explain&pretty' -H 'Content-Type: application/json' -d'

{
    "query": {
        "bool": {
            "must": {
                "query_string": {
                     "query": "vw50200",
                     "default_operator": "and",
                     "analyze_wildcard": true,
                     "allow_leading_wildcard": true,
                     "split_on_whitespace": false,
                     "fields": [
                         "name^5",
                         "sku",
                         "description",
                         "short_description",
                         "viscosity",
                         "all_approvals_recoms",
                         "keywords"
                     ]
                }
            }
        }
    }
}
'

```

An user typed in vw50200 and he got our page for VW 502 00.

```
{
  "valid" : true,
  "_shards" : {
    "total" : 1,
    "successful" : 1,
    "failed" : 0
  },
  "explanations" : [
    {
      "index" : "limo_b2c_de_idx2",
      "valid" : true,
      "explanation" : "+(Synonym(all_approvals_recoms:VW 502 00 all_approvals_recoms:vw50200) | Synonym(description:VW 502 00 description:vw50200) | Synonym(keywords:VW 502 00 keywords:vw50200) | (Synonym(name:VW 502 00 name:vw50200))^5.0 | Synonym(short_description:VW 502 00 short_description:vw50200) | sku:vw50200 | Synonym(viscosity:VW 502 00 viscosity:vw50200))"
    }
  ]
}

```

But if we combinded this search with wildcards our synonym search is not longer working. Look at this case to search for \*vw50200\*

:

```
curl -XGET --noproxy es01.liqui-moly.com.local:9200, 'es01.liqui-moly.com.local:9200/limo_b2c_de_idx2/_validate/query?explain&pretty' -H 'Content-Type: application/json' -d'

{
    "query": {
        "bool": {
            "must": {
                "query_string": {
                     "query": "*vw50200*",
                     "default_operator": "and",
                     "analyze_wildcard": true,
                     "allow_leading_wildcard": true,
                     "split_on_whitespace": false,
                     "fields": [
                         "name^5",
                         "sku",
                         "description",
                         "short_description",
                         "viscosity",
                         "all_approvals_recoms",
                         "keywords"
                     ]
                }
            }
        }
    }
}
'

```

We got no result ☹

```
   "valid" : true,
  "_shards" : {
    "total" : 1,
    "successful" : 1,
    "failed" : 0
  },
  "explanations" : [
    {
      "index" : "limo_b2c_de_idx2",
      "valid" : true,
      "explanation" : "+(all_approvals_recoms:*vw50200* | description:*vw50200* | keywords:*vw50200* | (name:*vw50200*)^5.0 | short_description:*vw50200* | sku:*vw50200* | viscosity:*vw50200*)"
    }
  ]
}

```

Finally the all important question is: Is there a trick to work with wildcards and synonyms in ES ?

Thanks for your help and if you need any further informations I will handle this as soon as possible 🙂

---

<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:** [March 23, 2020, 3:15pm UTC](https://discuss.elastic.co/t/synonym-list-combined-with-wildcards-got-no-more-results/220683/2 "2020-03-23T15:15:02Z")

</div>

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