# Discard non-letter characters during Completion Suggestor indexing

**URL:** https://discuss.elastic.co/t/discard-non-letter-characters-during-completion-suggestor-indexing/323561
**Category:** Elasticsearch
**Created:** [January 20, 2023, 3:58am UTC](https://discuss.elastic.co/t/discard-non-letter-characters-during-completion-suggestor-indexing/323561 "2023-01-20T03:58:31Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![vikk](https://avatars.discourse-cdn.com/v4/letter/v/74df32/32.png) [@vikk](https://discuss.elastic.co/u/vikk)
#### Post date: [January 20, 2023, 3:58am UTC](https://discuss.elastic.co/t/discard-non-letter-characters-during-completion-suggestor-indexing/323561/1 "2023-01-20T03:58:31Z")

</div>

Here's my index:

```auto
PUT autocomplete-food
{
  "mappings": {
    "properties": {
      "suggest": {
        "type": "completion"
      }
    }
  }
}

```

Adding a document to this index:

```auto
PUT autocomplete-food/_doc/1?refresh
{
  "suggest": [
    {
      "input": "Starbucks",
      "weight": 10
    },
    {
      "input": ["+(Coffee","Latte","Flat White"],
      "weight": 5
    }
  ]
}

```

Search query for suggestions:

```auto
POST autocomplete-food/_search?pretty
{
  "suggest": {
    "suggest": {
      "prefix": "coff",        
      "completion": {         
          "field": "suggest"
      }
    }
  }
}

```

Search result:

```auto
{
  "took" : 1,
  "timed_out" : false,
  "_shards" : {
    "total" : 1,
    "successful" : 1,
    "skipped" : 0,
    "failed" : 0
  },
  "hits" : {
    "total" : {
      "value" : 0,
      "relation" : "eq"
    },
    "max_score" : null,
    "hits" : []
  },
  "suggest" : {
    "suggest" : [
      {
        "text" : "coff",
        "offset" : 0,
        "length" : 4,
        "options" : [
          {
            "text" : "+(Coffee",
            "_index" : "autocomplete-food",
            "_type" : "_doc",
            "_id" : "1",
            "_score" : 5.0,
            "_source" : {
              "suggest" : [
                {
                  "input" : "Starbucks",
                  "weight" : 10
                },
                {
                  "input" : [
                    "+(Coffee",
                    "Latte",
                    "Flat White"
                  ],
                  "weight" : 5
                }
              ]
            }
          }
        ]
      }
    ]
  }
}

```

Notice the "text" value is "+(Coffee". I don't want to index/get the non-letter characters. I was expecting that as the default analyzer is "simple" analyzer, this won't happen. But the "input" field in the response also contains the special characters.

How do I achieve discarding the non-letter characters?  
P.S - Elasticsearch version 7.17

---

<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: [February 17, 2023, 3:59am UTC](https://discuss.elastic.co/t/discard-non-letter-characters-during-completion-suggestor-indexing/323561/2 "2023-02-17T03:59:30Z")

</div>

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