# Query String Query and leading wildcard

**URL:** <https://discuss.elastic.co/t/query-string-query-and-leading-wildcard/68753>\
**Category:** Elasticsearch\
**Created:** [December 12, 2016, 7:02pm UTC](https://discuss.elastic.co/t/query-string-query-and-leading-wildcard/68753 "2016-12-12T19:02:51Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Philippe\_Busque](https://avatars.discourse-cdn.com/v4/letter/p/7bcc69/32.png) [@Philippe\_Busque](https://discuss.elastic.co/u/Philippe_Busque)\
**Post date:** [December 12, 2016, 7:02pm UTC](https://discuss.elastic.co/t/query-string-query-and-leading-wildcard/68753/1 "2016-12-12T19:02:52Z")

</div>

Hello guys,

I have some issue with a certain query string query with a leading wildcard in an indexed array of strings.

I'm using ElasticSearch 5.0.1  
The mapping for the document type is the following:

```
  "templates" : {
    "properties" : {
      "id" : {
        "type" : "string",
        "index" : "not_analyzed"
      },
      "name" : {
        "type" : "string",
        "index" : "not_analyzed"
      },
      "keys" : {
        "type" : "string",
        "index" : "not_analyzed"
      }
    }
  }

```

The indexed contents in the 'keys' fields are array of dot separated string of a flattened hierarchy.  
Exemple. DEV.ES.GeneralInfo.Home , PROD.ES.GenraralInfo.Home, etc.

When I preform the following query  
"keys:\*ES.GeneralInfo.Home" no results are returned.  
However, if I perform a plain "\*ES.GeneralInfo.Home" I get results.

I have no idea why specifying the fields return no results, but not specifying the field (which I assume fallback to \_all) give me results.

Does anyone have an idea about what is wrong with the query or the mapping? For this field, I'm only interested in full matches or prefix / suffix matches. Partial (A\*Z) is not required.

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:** [January 9, 2017, 7:02pm UTC](https://discuss.elastic.co/t/query-string-query-and-leading-wildcard/68753/2 "2017-01-09T19:02:52Z")

</div>

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