# Searching special characters in elastic

**URL:** https://discuss.elastic.co/t/searching-special-characters-in-elastic/355016
**Category:** Elasticsearch
**Created:** [March 8, 2024, 8:57am UTC](https://discuss.elastic.co/t/searching-special-characters-in-elastic/355016 "2024-03-08T08:57:07Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![peter\_falk](https://avatars.discourse-cdn.com/v4/letter/p/c68b51/32.png) [@peter\_falk](https://discuss.elastic.co/u/peter_falk)
#### Post date: [March 8, 2024, 8:57am UTC](https://discuss.elastic.co/t/searching-special-characters-in-elastic/355016/1 "2024-03-08T08:57:07Z")

</div>

Hello, I have a problem I could not index special characters in Elasticsearch. I try to do it like that:

```auto
PUT my-index-000001
{
    "settings": {
        "index": {
            "max_result_window": 100000,
            "number_of_replicas": 0
        },
        "analysis": {
            "filter": {
                "autocomplete_filter": {
                    "type": "edge_ngram",
                    "min_gram": 1,
                    "max_gram": 35
                }
            },
            "analyzer": {
                "autocomplete": {
                    "type": "custom",
                    "tokenizer": "my_tokenizer",
                    "filter": [
                        "lowercase",
                        "autocomplete_filter"
                    ]
                }
            },
            "tokenizer": {
                "my_tokenizer": {
                    "type": "edge_ngram",
                    "min_gram": 1,
                    "max_gram": 35,
                    "tokenize_on_chars": [
                        "%"
                    ]
                }
            }
        }
    },
    "mappings": {
        "properties": {
        }
    }
}

```

```auto
POST my-index-000001/_doc/
{
  "@timestamp": "2099-11-15T13:12:00",
  "message": "GET /search HTTP/1.1 200 1070000",
  "user": {
    "id": "kimchy % D"
  }
}

```

but I could not receive anything by search request:

```auto
GET my-index-000001/_search
{
    "size": 10000,
    "query": {
        "term": {
            "user.id": "%"
        }
    }
}

```

Could you help me please?

---

<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: [March 8, 2024, 3:17pm UTC](https://discuss.elastic.co/t/searching-special-characters-in-elastic/355016/2 "2024-03-08T15:17:31Z")

</div>

Welcome!

In the mapping you did not define any field and the analyzer to apply on the fields. So `user.id` is using the `standard` analyzer by default.  
You must fix that part.

---

<div class="post-metadata">

### Author: ![peter\_falk](https://avatars.discourse-cdn.com/v4/letter/p/c68b51/32.png) [@peter\_falk](https://discuss.elastic.co/u/peter_falk)
#### Post date: [March 13, 2024, 8:27am UTC](https://discuss.elastic.co/t/searching-special-characters-in-elastic/355016/3 "2024-03-13T08:27:57Z")

</div>

Could you please show me how to fix this?

---

<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: [March 13, 2024, 12:30pm UTC](https://discuss.elastic.co/t/searching-special-characters-in-elastic/355016/4 "2024-03-13T12:30:18Z")

</div>

Sure. Look at: [Specify an analyzer | Elasticsearch Guide [8.12] | Elastic](https://www.elastic.co/guide/en/elasticsearch/reference/current/specify-analyzer.html#specify-index-field-analyzer)

---

<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: [April 10, 2024, 12:30pm UTC](https://discuss.elastic.co/t/searching-special-characters-in-elastic/355016/5 "2024-04-10T12:30:54Z")

</div>

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