# Query\_string using special character work and dont work without escaping

**URL:** <https://discuss.elastic.co/t/query-string-using-special-character-work-and-dont-work-without-escaping/323794>\
**Category:** Elasticsearch\
**Created:** [January 24, 2023, 8:17am UTC](https://discuss.elastic.co/t/query-string-using-special-character-work-and-dont-work-without-escaping/323794 "2023-01-24T08:17:57Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![eladonline](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/eladonline/32/116313_2.png) [@eladonline](https://discuss.elastic.co/u/eladonline)\
**Post date:** [January 24, 2023, 8:17am UTC](https://discuss.elastic.co/t/query-string-using-special-character-work-and-dont-work-without-escaping/323794/1 "2023-01-24T08:17:57Z")

</div>

Hey,  
what is the diferent that the first works and the others does not?

```auto
GET /forensics/_search
{

  "query": {
   "query_string": {
     "fields": ["referer"],
     "query": "http://10.26.30.206*"
     // but these doesnt
    // "http://10.26.30.206:*" or "http://10.26.30.206:31006/"
   }
  }
}

```

another thing  
this works in the devTools but not from the js Api

```auto
GET /forensics/_search
{

  "query": {
   "query_string": {
     "fields": ["referer"],
     "query": "http\\:\\/\\/10.26.30.206\\:31006\\/"
   }
  }
}

```

and here is the api payload

```auto
 {
  "query": {
    "query_string": {
      "fields": [
        "referer"
      ],
      "query": "(\"http\\\\:\\\\/\\\\/10.26.30.206\\\\:31006\\\\*\") AND @timestamp:[2023-01-24T08:41:36.198Z TO 2023-01-24T08:56:36.198Z]"
    }
  },
  "sort": [
    {
      "@timestamp": {
        "order": "desc",
        "format": "strict_date_optional_time_nanos"
      }
    }
  ]
}

```

---

<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 21, 2023, 8:18am UTC](https://discuss.elastic.co/t/query-string-using-special-character-work-and-dont-work-without-escaping/323794/2 "2023-02-21T08:18:14Z")

</div>

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