# Query\_string with wildcard and whitespace or dash

**URL:** <https://discuss.elastic.co/t/query-string-with-wildcard-and-whitespace-or-dash/163545>\
**Category:** Elasticsearch\
**Created:** [January 9, 2019, 1:58pm UTC](https://discuss.elastic.co/t/query-string-with-wildcard-and-whitespace-or-dash/163545 "2019-01-09T13:58:43Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![kmprr](https://avatars.discourse-cdn.com/v4/letter/k/e95f7d/32.png) [@kmprr](https://discuss.elastic.co/u/kmprr)\
**Post date:** [January 9, 2019, 1:58pm UTC](https://discuss.elastic.co/t/query-string-with-wildcard-and-whitespace-or-dash/163545/1 "2019-01-09T13:58:43Z")

</div>

Hello,  
I have problem with creating query\_string with wildcard and some special characters (whitespace, dash etc.)  
I have field myText (type text), which can be pretty long. And it can contains something like this - **Name : anytexthere**.  
When i`m looking for this text i can create query like this below, and I have correct match.

```
GET mylogs/_search
{
  "query": {
    "simple_query_string": {
      "fields": [
        "myText"
      ],
      "query": "(Name\\ \\:\\ anytexthere)",
      "default_operator": "AND"
    }
  }
}

```

But sometimes I want to do more complicated search and find all documents that match pattern like this **Name : a??texthere**

I tried to find it by query like this below, but it return 0 matches

```
GET mylogs/_search
{
  "query": {
    "simple_query_string": {
      "fields": [
        "myText"
      ],
      "query": "(Name\\ \\:\\ a??texthere)",
      "default_operator": "AND"
    }
  }
}

```

Could someone help me with that? I tried to set analyzer to keyword, but still the same.

---

<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:** [February 6, 2019, 1:58pm UTC](https://discuss.elastic.co/t/query-string-with-wildcard-and-whitespace-or-dash/163545/2 "2019-02-06T13:58:54Z")

</div>

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