# Issue with Edge NGram Tokenizer in elastic search

**URL:** <https://discuss.elastic.co/t/issue-with-edge-ngram-tokenizer-in-elastic-search/69257>\
**Category:** Elasticsearch\
**Created:** [December 16, 2016, 7:59am UTC](https://discuss.elastic.co/t/issue-with-edge-ngram-tokenizer-in-elastic-search/69257 "2016-12-16T07:59:32Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Anurag\_srivastava](https://avatars.discourse-cdn.com/v4/letter/a/90db22/32.png) [@Anurag\_srivastava](https://discuss.elastic.co/u/Anurag_srivastava)\
**Post date:** [December 16, 2016, 7:59am UTC](https://discuss.elastic.co/t/issue-with-edge-ngram-tokenizer-in-elastic-search/69257/1 "2016-12-16T07:59:32Z")

</div>

i am using a edge ngram tokenizer in order to provide partial matching .  
My document looks like

```
Name
Labson series LTD 2014
Labson PLO LTD 2014A
Labson PLO LTD 2014-I
Labson PLO LTD. 2014-II

```

My mapping is as follows

```
PUT my_index
{
  "settings": {
    "analysis": {
      "analyzer": {
        "autocomplete": {
          "tokenizer": "autocomplete",
          "filter": [
            "lowercase"
          ]
        },
        "autocomplete_search": {
          "tokenizer": "lowercase"
        }
      },
      "tokenizer": {
        "autocomplete": {
          "type": "edge_ngram",
          "min_gram": 2,
          "max_gram": 40,
          "token_chars": [
            "letter",
            "digit"
          ]
        }
      }
    }
  },
  "mappings": {
    "doc": {
      "properties": {
        "title": {
          "type": "string",
          "analyzer": "autocomplete",
          "search_analyzer": "autocomplete_search"
        }
      }
    }
  }
}

PUT my_index/doc/1
{
  "title": "Labson Series LTD 2014" 
}

PUT my_index/doc/2
{
  "title": "Labson PLO LTD 2014A" 
}

PUT my_index/doc/3
{
  "title": "Labson PLO LTD 2014-I" 
}

PUT my_index/doc/4
{
  "title": "Labson PLO LTD. 2014-II" 
}

```

My query is as follows :This query give me 3 documents which is correct (Labson PLO LTD 2014A  
Labson PLO LTD 2014-I,Labson PLO LTD. 2014-II)

GET my\_index/\_search

```
{
  "query": {
    "match": {
      "title": {
        "query": "labson plo", 
        "operator": "and"
      }
    }
  }
}

```

But when i type in Labson PLO 2014A it gives me 0 documents  
GET my\_index/\_search

```
{
  "query": {
    "match": {
      "title": {
        "query": "Labson PLO 2014A", 
        "operator": "and"
      }
    }
  }
}

```

I expect this to return me 1 document Labson PLO LTD 2014A ,for some reason it seems like it is not indexing the digits in token .Let me know if i am missing thing anything over here .Thanks for the help.

---

<div class="post-metadata">

**Author:** ![mikemccand](https://avatars.discourse-cdn.com/v4/letter/m/f04885/32.png) [@mikemccand](https://discuss.elastic.co/u/mikemccand)\
**Post date:** [December 16, 2016, 7:53pm UTC](https://discuss.elastic.co/t/issue-with-edge-ngram-tokenizer-in-elastic-search/69257/2 "2016-12-16T19:53:52Z")

</div>

The `lowercase` tokenizer, which you are using for searching, splits on non-letters: [https://www.elastic.co/guide/en/elasticsearch/reference/2.3//analysis-lowercase-tokenizer.html](https://www.elastic.co/guide/en/elasticsearch/reference/2.3//analysis-lowercase-tokenizer.html)

Try instead using the `keyword` tokenizer with a `lowercase` token filter?

Mike McCandless

---

<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:** [January 13, 2017, 7:54pm UTC](https://discuss.elastic.co/t/issue-with-edge-ngram-tokenizer-in-elastic-search/69257/3 "2017-01-13T19:54:37Z")

</div>

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