# Search by digits doesn't work with edge\_ngram

**URL:** https://discuss.elastic.co/t/search-by-digits-doesnt-work-with-edge-ngram/134433
**Category:** Elasticsearch
**Created:** [June 4, 2018, 1:47pm UTC](https://discuss.elastic.co/t/search-by-digits-doesnt-work-with-edge-ngram/134433 "2018-06-04T13:47:31Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![mikhail.tin](https://avatars.discourse-cdn.com/v4/letter/m/8edcca/32.png) [@mikhail.tin](https://discuss.elastic.co/u/mikhail.tin)
#### Post date: [June 4, 2018, 1:47pm UTC](https://discuss.elastic.co/t/search-by-digits-doesnt-work-with-edge-ngram/134433/1 "2018-06-04T13:47:31Z")

</div>

Hi there,

I am using a edge ngram tokenizer in order to provide partial matching .  
My scripts:

```
PUT docs
{
  "settings": {
    "analysis": {
      "analyzer": {
        "autocomplete": {
          "tokenizer": "autocomplete",
          "filter": ["lowercase"]
        },
        "autocomplete_search": {
          "tokenizer": "lowercase"
        }
      },
      "tokenizer": {
        "autocomplete": {
          "type": "edge_ngram",
          "min_gram": 1,
          "max_gram": 30,
          "token_chars": [	"letter","digit","punctuation","symbol"]
        }
      }
    }
  },
  "mappings": {
    "doc": {
      "properties": {
        "name": {"type": "text","analyzer": "autocomplete","search_analyzer": "autocomplete_search"}
      }
    }
  }
}

PUT docs/doc/1
{ "name" : "111"}

PUT docs/doc/2
{"name" : "first"}

PUT docs/doc/3 
{"name" : "123456789й"}

PUT docs/doc/4
{"name" : "fir123"}

```

So, I expect I can find my documents(3 and 4) use next query:

```
GET docs/_search
{
  "query": {
    "match": {
      "name": "12"
    }
  }
}

```

Also, I expect I can find my documents(2 and 4) use next query:

```
GET docs/_search
{
  "query": {
    "match": {
      "name": "Fi"
    }
  }
}

```

What could be wrong?

Thanks!

---

<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: [June 4, 2018, 7:12pm UTC](https://discuss.elastic.co/t/search-by-digits-doesnt-work-with-edge-ngram/134433/2 "2018-06-04T19:12:05Z")

</div>

Have a look at what your text is transformed at search time:

```auto
POST docs/_analyze
{
  "analyzer": "autocomplete_search",
  "text": ["123456789й"]
}

```

```auto
{
  "tokens": [
    {
      "token": "й",
      "start_offset": 9,
      "end_offset": 10,
      "type": "word",
      "position": 0
    }
  ]
}

```

Have a look at the [Doc](https://www.elastic.co/guide/en/elasticsearch/reference/current/analysis-lowercase-tokenizer.html).

---

<div class="post-metadata">

### Author: ![mikhail.tin](https://avatars.discourse-cdn.com/v4/letter/m/8edcca/32.png) [@mikhail.tin](https://discuss.elastic.co/u/mikhail.tin)
#### Post date: [June 5, 2018, 7:00am UTC](https://discuss.elastic.co/t/search-by-digits-doesnt-work-with-edge-ngram/134433/3 "2018-06-05T07:00:52Z")

</div>

Hi, Thanks for your answer. I have found solution:

I have set up my analyzer like that:

```
"autocomplete_search" : {
          "type" : "custom",
          "tokenizer": "keyword",
          "filter": "lowercase"
        }
```

---

<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 3, 2018, 7:00am UTC](https://discuss.elastic.co/t/search-by-digits-doesnt-work-with-edge-ngram/134433/4 "2018-07-03T07:00:52Z")

</div>

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