# Unrecognized character escape ':'

**URL:** https://discuss.elastic.co/t/unrecognized-character-escape/318393
**Category:** Elasticsearch
**Created:** [November 8, 2022, 7:10am UTC](https://discuss.elastic.co/t/unrecognized-character-escape/318393 "2022-11-08T07:10:29Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![MStrauch](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mstrauch/32/77883_2.png) [@MStrauch](https://discuss.elastic.co/u/MStrauch)
#### Post date: [November 8, 2022, 7:10am UTC](https://discuss.elastic.co/t/unrecognized-character-escape/318393/1 "2022-11-08T07:10:29Z")

</div>

Hi,

I'm executing follow fulltext query string:

```auto
"query": {
    "bool": {
      "filter": [
        {
          "nested": {
            "path": "@payload.identifier",
            "query": {
              "query_string": {
                "query": "@payload.identifier.system:http\:\/\/mein-krankenhaus.de\/NamingSystem\/patient-identifier"
              }
            }
          }
        }
      ]
    }
  }

```

In the query string I escaped all reserved characters as described within the documentation.

But I get follow error:

```auto
{
  "error" : {
    "root_cause" : [
      {
        "type" : "x_content_parse_exception",
        "reason" : "[10:26] [bool] failed to parse field [filter]"
      }
    ],
    "type" : "x_content_parse_exception",
    "reason" : "[10:26] [bool] failed to parse field [filter]",
    "caused_by" : {
      "type" : "json_parse_exception",
      "reason" : "Unrecognized character escape ':' (code 58)\n at [Source: (org.elasticsearch.common.io.stream.ByteBufferStreamInput); line: 10, column: 60]"
    }
  },
  "status" : 400
}

```

It seems that the escape of the ":" (in "http:") is not allowed. So I removed that escape and get another exception.

```auto
{
  "error" : {
    "root_cause" : [
      {
        "type" : "query_shard_exception",
        "reason" : "Failed to parse query [@payload.identifier.system:http://mein-krankenhaus.de/NamingSystem/patient-identifier]",
        "index_uuid" : "PuwRBYjWSk-hgwC96Ta1mQ",
        "index" : "idx_fhir_patient_001"
      }
    ],
    "type" : "search_phase_execution_exception",
    "reason" : "all shards failed",
    "phase" : "query",
    "grouped" : true,
    "failed_shards" : [
      {
        "shard" : 0,
        "index" : "idx_fhir_patient_001",
        "node" : "3JjnNKaeSd25qnAaK-W82g",
        "reason" : {
          "type" : "query_shard_exception",
          "reason" : "Failed to parse query [@payload.identifier.system:http://mein-krankenhaus.de/NamingSystem/patient-identifier]",
          "index_uuid" : "PuwRBYjWSk-hgwC96Ta1mQ",
          "index" : "idx_fhir_patient_001",
          "caused_by" : {
            "type" : "parse_exception",
            "reason" : "Cannot parse '@payload.identifier.system:http://mein-krankenhaus.de/NamingSystem/patient-identifier': Encountered \" \":\" \": \"\" at line 1, column 31.\r\nWas expecting one of:\r\n <EOF> \r\n <AND> ...\r\n <OR> ...\r\n <NOT> ...\r\n \"+\" ...\r\n \"-\" ...\r\n <BAREOPER> ...\r\n \"(\" ...\r\n \"*\" ...\r\n \"^\" ...\r\n <QUOTED> ...\r\n <TERM> ...\r\n <FUZZY_SLOP> ...\r\n <PREFIXTERM> ...\r\n <WILDTERM> ...\r\n <REGEXPTERM> ...\r\n \"[\" ...\r\n \"{\" ...\r\n <NUMBER> ...\r\n ",
            "caused_by" : {
              "type" : "parse_exception",
              "reason" : "Encountered \" \":\" \": \"\" at line 1, column 31.\r\nWas expecting one of:\r\n <EOF> \r\n <AND> ...\r\n <OR> ...\r\n <NOT> ...\r\n \"+\" ...\r\n \"-\" ...\r\n <BAREOPER> ...\r\n \"(\" ...\r\n \"*\" ...\r\n \"^\" ...\r\n <QUOTED> ...\r\n <TERM> ...\r\n <FUZZY_SLOP> ...\r\n <PREFIXTERM> ...\r\n <WILDTERM> ...\r\n <REGEXPTERM> ...\r\n \"[\" ...\r\n \"{\" ...\r\n <NUMBER> ...\r\n "
            }
          }
        }
      }
    ]
  },
  "status" : 400
}

```

Is this a bug or have I did something wrong?

I'm using Elastic Search Version 8.1.3

Regards  
Marco

---

<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: [December 6, 2022, 7:11am UTC](https://discuss.elastic.co/t/unrecognized-character-escape/318393/2 "2022-12-06T07:11:09Z")

</div>

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