# Forming query with unreserved characters

**URL:** <https://discuss.elastic.co/t/forming-query-with-unreserved-characters/265391>\
**Category:** Elasticsearch\
**Created:** [February 24, 2021, 6:31pm UTC](https://discuss.elastic.co/t/forming-query-with-unreserved-characters/265391 "2021-02-24T18:31:35Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Shahsha\_21](https://avatars.discourse-cdn.com/v4/letter/s/77aa72/32.png) [@Shahsha\_21](https://discuss.elastic.co/u/Shahsha_21)\
**Post date:** [February 24, 2021, 6:31pm UTC](https://discuss.elastic.co/t/forming-query-with-unreserved-characters/265391/1 "2021-02-24T18:31:35Z")

</div>

I am trying to query a keyword that has a dot (.) appended to it. The query works fine on Kibana's console but not on my application's function. This is the function that creates the query given a keyword:

```auto
    searchOperation(keyWord:String){
    
    {
  "query": {
    "bool": {
      "must": [
        {
          "query_string": {
            "fields": ["message"],
            "query": keyWord + " AND \"DateID\""
          }
        }]
    }}}}

```

An example keyword that contains that character is: "BAD.IJH.KLM"

I append an escape character ('\') before and after the quotation marks so it becomes \"BAD.IJH.KLM\" and my query would look like this :

```auto
    

    {
  "query": {
    "bool": {
      "must": [
        {
          "query_string": {
            "fields": ["message"],
            "query": "\"BAD.IJH.KLM\" AND \"DateID\""
          }
        }]
    }}}

```

but my query doesn't search for the exact keyword with the dots and instead searches for subtrings within "BAD.IJH.KLM". How can I modify my keyword/query so the query searches for the exact string with characters that are not part of the reserved characters?

---

<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 24, 2021, 6:31pm UTC](https://discuss.elastic.co/t/forming-query-with-unreserved-characters/265391/2 "2021-03-24T18:31:36Z")

</div>

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