# Saving windows paths that start with capital letter that is escape character

**URL:** <https://discuss.elastic.co/t/saving-windows-paths-that-start-with-capital-letter-that-is-escape-character/60376>\
**Category:** Elasticsearch\
**Created:** [September 13, 2016, 11:53am UTC](https://discuss.elastic.co/t/saving-windows-paths-that-start-with-capital-letter-that-is-escape-character/60376 "2016-09-13T11:53:14Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mark.S](https://avatars.discourse-cdn.com/v4/letter/m/ccd318/32.png) [@Mark.S](https://discuss.elastic.co/u/Mark.S)\
**Post date:** [September 13, 2016, 11:53am UTC](https://discuss.elastic.co/t/saving-windows-paths-that-start-with-capital-letter-that-is-escape-character/60376/1 "2016-09-13T11:53:14Z")

</div>

Hi,  
I would like to save windows paths in elastic search and get an exception.

Here is what I do:

Create new index:  
`PUT test1`

Put Mapping of index is:

```
PUT test1/type1/_mapping
{
  "properties": {
    "name" : {
      "type": "string"
    }
  }
}

```

I have the following path `C:\temp\RDATA\test`  
When I try to index the following document i get and exception:

```
PUT test1/type1/0
{
  "name" : "C:\temp\RDATA\test"
}

```

Exception:  
"json\_parse\_exception: Unrecognized character escape 'R' (code 82)\n at [Source: org.elasticsearch.common.io.stream.InputStreamStreamInput@2865ad4; line: 2, column: 22]"

I can escape it by adding "" but then i get the json field value with double "".  
This audit files data so i want it to be saved as it arrived without any changes.  
The issue does not happen when i have path that starts with lower letters such as "\r".  
How I can save the path exactly as I want?

Thanks in advance,  
Mark

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [September 13, 2016, 12:07pm UTC](https://discuss.elastic.co/t/saving-windows-paths-that-start-with-capital-letter-that-is-escape-character/60376/2 "2016-09-13T12:07:40Z")

</div>

Please format your code using `</>` icon. It will make your post more readable.

You can try with `\\` instead of `\`.

Remember that elasticsearch stores your document as you sent it.  
So when you get it back, you'll have the escaped version.

---

<div class="post-metadata">

**Author:** ![Mark.S](https://avatars.discourse-cdn.com/v4/letter/m/ccd318/32.png) [@Mark.S](https://discuss.elastic.co/u/Mark.S)\
**Post date:** [September 13, 2016, 12:11pm UTC](https://discuss.elastic.co/t/saving-windows-paths-that-start-with-capital-letter-that-is-escape-character/60376/3 "2016-09-13T12:11:28Z")

</div>

I tried but then it is saved as double.  
I don't want to change the original text.  
I want to save only one `\`.  
Is it possible?

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [September 13, 2016, 3:02pm UTC](https://discuss.elastic.co/t/saving-windows-paths-that-start-with-capital-letter-that-is-escape-character/60376/4 "2016-09-13T15:02:18Z")

</div>

I don't believe so. To me it would be an incorrect JSON document but I might be wrong.

---

<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:** [July 5, 2017, 10:20pm UTC](https://discuss.elastic.co/t/saving-windows-paths-that-start-with-capital-letter-that-is-escape-character/60376/5 "2017-07-05T22:20:37Z")

</div>


