Unrecognized character escape ':'

Hi,

I'm executing follow fulltext query string:

"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:

{
  "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.

{
  "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

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