# Simple\_query\_string and query\_string not working as expected

**URL:** https://discuss.elastic.co/t/simple-query-string-and-query-string-not-working-as-expected/352905
**Category:** Elasticsearch
**Tags:** eql-elastic-query-language
**Created:** [February 9, 2024, 5:05am UTC](https://discuss.elastic.co/t/simple-query-string-and-query-string-not-working-as-expected/352905 "2024-02-09T05:05:27Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Sankar\_S](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sankar_s/32/112213_2.png) [@Sankar\_S](https://discuss.elastic.co/u/Sankar_S)
#### Post date: [February 9, 2024, 5:05am UTC](https://discuss.elastic.co/t/simple-query-string-and-query-string-not-working-as-expected/352905/1 "2024-02-09T05:05:27Z")

</div>

I have a title field in document  
1 document has $kitkat as value and another has "title" : "Testing Special\_character #Elastic Search in $reference entry search"

```auto
{
  "query": {
    "bool": {
      "must": [
        
        {
          "query_string": {
            "query": "$kitka* \\$referen*",
            "fields": ["title", "title.raw", "title.whitespace_split"]
          }
        }
      ]
    }
  }
}

```

Fetches only one document matching for $kitka\*  
But if i pass $ref\* then it fetches both document. Till //$refer\* it works, The moment i add //$refere it is not working. what is the reason?

And I have a document with "title" : "Toddler- $kitkat @taste &roll ^yart !here #you %ice ^oops \*jam (pot) [beat] pep |old {jet} `egg /lol",

```auto
{
  "query": {
    "bool": {
      "must": [
        
        {
          "simple_query_string": { // or query_string
            "query": "jet\\}* pot\\)* beat\\]*",
            "fields": ["title", "title.raw", "title.whitespace_split"]
          }
        }
      ]
    }
  }
}

```

also not fetching the document.

---

<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 8, 2024, 5:06am UTC](https://discuss.elastic.co/t/simple-query-string-and-query-string-not-working-as-expected/352905/2 "2024-03-08T05:06:16Z")

</div>

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