# Query\_string containing the "/" character

**URL:** <https://discuss.elastic.co/t/query-string-containing-the-character/156104>\
**Category:** Elasticsearch\
**Created:** [November 9, 2018, 8:13pm UTC](https://discuss.elastic.co/t/query-string-containing-the-character/156104 "2018-11-09T20:13:26Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ffknob](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ffknob/32/37008_2.png) [@ffknob](https://discuss.elastic.co/u/ffknob)\
**Post date:** [November 9, 2018, 8:13pm UTC](https://discuss.elastic.co/t/query-string-containing-the-character/156104/1 "2018-11-09T20:13:26Z")

</div>

Hello,  
does anyone know why I'm getting the following error when trying to search for a string that contains the "/" character? It is not listed in the Lucene special characters (and even trying to escape it doesn't help).  
Thank you

Search:

```
"query": {
  "query_string": {
    "query": "2593-0200/92-1",

```

Error:

```
{
  "error": {
    "root_cause": [
      {
        "type": "query_shard_exception",
        "reason": "Failed to parse query [2593-0200/92-1]",
        "index_uuid": "WW-lh_mKT7ewuqL6lMUCdA",
        "index": "jurisprudencia-decisoes"
      }
    ],
    "type": "search_phase_execution_exception",
    "reason": "all shards failed",
    "phase": "query",
    "grouped": true,
    "failed_shards": [
      {
        "shard": 0,
        "index": "jurisprudencia-decisoes",
        "node": "aS_7gmiHRcO5s4XCkkg4Zw",
        "reason": {
          "type": "query_shard_exception",
          "reason": "Failed to parse query [2593-0200/92-1]",
          "index_uuid": "WW-lh_mKT7ewuqL6lMUCdA",
          "index": "jurisprudencia-decisoes",
          "caused_by": {
            "type": "parse_exception",
            "reason": "Cannot parse '2593-0200/92-1': Lexical error at line 1, column 15. Encountered: <EOF> after : \"/92-1\"",
            "caused_by": {
              "type": "token_mgr_error",
              "reason": "Lexical error at line 1, column 15. Encountered: <EOF> after : \"/92-1\""
            }
          }
        }
      }
    ]
  },
  "status": 400
}
```

---

<div class="post-metadata">

**Author:** ![ffknob](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ffknob/32/37008_2.png) [@ffknob](https://discuss.elastic.co/u/ffknob)\
**Post date:** [November 9, 2018, 8:21pm UTC](https://discuss.elastic.co/t/query-string-containing-the-character/156104/2 "2018-11-09T20:21:52Z")

</div>

Ok, but it is a reerved character for Elasticsearch

I changed my query to `"query": "982\\-0200\\/11\\-9"` but it now it fails with:

```
      "caused_by": {
        "type": "number_format_exception",
        "reason": "For input string: \"982-0200/11-9\""
      }

```

[https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-query-string-query.html#\_reserved\_characters](https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-query-string-query.html#_reserved_characters)

---

<div class="post-metadata">

**Author:** ![Jaspreet\_Singh](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jaspreet_singh/32/58296_2.png) [@Jaspreet\_Singh](https://discuss.elastic.co/u/Jaspreet_Singh)\
**Post date:** [November 14, 2018, 7:41pm UTC](https://discuss.elastic.co/t/query-string-containing-the-character/156104/3 "2018-11-14T19:41:10Z")

</div>

A couple of things ...

1. it worked for query string `2593-0200/92-1` by double escaping ... `2593-0200\\/92-1`.
2. Can you use text query via match etc instead of query\_string? It worked for me even without escaping.

---

<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 12, 2018, 7:41pm UTC](https://discuss.elastic.co/t/query-string-containing-the-character/156104/4 "2018-12-12T19:41:20Z")

</div>

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