# Char\_filter how to replace backslashes with slashes

**URL:** <https://discuss.elastic.co/t/char-filter-how-to-replace-backslashes-with-slashes/153785>\
**Category:** Elasticsearch\
**Created:** [October 24, 2018, 11:36am UTC](https://discuss.elastic.co/t/char-filter-how-to-replace-backslashes-with-slashes/153785 "2018-10-24T11:36:23Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![16318a22907f3cbfa04b](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/16318a22907f3cbfa04b/32/36875_2.png) [@16318a22907f3cbfa04b](https://discuss.elastic.co/u/16318a22907f3cbfa04b)\
**Post date:** [October 24, 2018, 11:36am UTC](https://discuss.elastic.co/t/char-filter-how-to-replace-backslashes-with-slashes/153785/1 "2018-10-24T11:36:23Z")

</div>

```auto
"analysis": {
      "char_filter": {
        "replace_bad_slash": {
          "type": "mapping",
          "mappings": [
            "\\ => /"
          ]
        }
      },
      "normalizer": {
        "my_normalizer": {
          "type": "custom",
          "char_filter": ["replace_bad_slash"],
          "filter": ["lowercase"]
        }
      }
    }

```

When attept to load tempate:

```auto
elasticsearch.exceptions.TransportError: TransportError(500, 'runtime_exception', 'Invalid escaped char in [\\]')
```

---

<div class="post-metadata">

**Author:** ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)\
**Post date:** [October 24, 2018, 12:15pm UTC](https://discuss.elastic.co/t/char-filter-how-to-replace-backslashes-with-slashes/153785/2 "2018-10-24T12:15:34Z")

</div>

you may have to do some double escaping here, like `\\\\`... also what language are you testing this?

---

<div class="post-metadata">

**Author:** ![16318a22907f3cbfa04b](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/16318a22907f3cbfa04b/32/36875_2.png) [@16318a22907f3cbfa04b](https://discuss.elastic.co/u/16318a22907f3cbfa04b)\
**Post date:** [October 24, 2018, 3:10pm UTC](https://discuss.elastic.co/t/char-filter-how-to-replace-backslashes-with-slashes/153785/3 "2018-10-24T15:10:41Z")

</div>

Thank you! Its work.

---

<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:** [November 21, 2018, 3:10pm UTC](https://discuss.elastic.co/t/char-filter-how-to-replace-backslashes-with-slashes/153785/4 "2018-11-21T15:10:43Z")

</div>

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