# What happens with analyzed fields if the length of indexed field is longer than the "max\_gram" of an edge\_ngram?

**URL:** <https://discuss.elastic.co/t/what-happens-with-analyzed-fields-if-the-length-of-indexed-field-is-longer-than-the-max-gram-of-an-edge-ngram/191881>\
**Category:** Elasticsearch\
**Created:** [July 23, 2019, 5:41pm UTC](https://discuss.elastic.co/t/what-happens-with-analyzed-fields-if-the-length-of-indexed-field-is-longer-than-the-max-gram-of-an-edge-ngram/191881 "2019-07-23T17:41:59Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Forrest\_Townsend](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/forrest_townsend/32/44609_2.png) [@Forrest\_Townsend](https://discuss.elastic.co/u/Forrest_Townsend)\
**Post date:** [July 23, 2019, 5:41pm UTC](https://discuss.elastic.co/t/what-happens-with-analyzed-fields-if-the-length-of-indexed-field-is-longer-than-the-max-gram-of-an-edge-ngram/191881/1 "2019-07-23T17:41:59Z")

</div>

What happens if there is an email entered that's longer than 15 characters? In our tests, it appears to stop using edge\_ngram, which make sense since it's a "starts with" analyzer but just wanted to be sure on what happens.

Since we don't know how long emails can really be, is it better to use a different analyzer for an email or would it be easier to just bump the "max\_gram" to be a higher value?

**Mapping field**

```auto
"email": {
    "type": "text",
    "index_options": "offsets",
    "analyzer": "min_1_max_15_prefix_string_partial_match_index_analyzer",
    "search_analyzer": "min_1_string_partial_match_search_analyzer"
}

```

**Analyzer used upon indexing the field**

```auto
"min_1_max_15_string_edgeNGram_tokenizer": {
    "token_chars": [
        "letter",
        "digit"
    ],
    "min_gram": "1",
    "type": "edge_ngram",
    "max_gram": "15"
}

```

**The search analyzer used for that field**

```auto
"min_1_string_partial_match_search_analyzer": {
        "filter": [
            "standard",
            "lowercase"
        ],
        "char_filter": [
            "period_mapping_character_filter"
        ],
        "type": "custom",
        "tokenizer": "standard"
    }

```

**The char\_filter for the above search analyzer**

```auto
 "char_filter": {
        "period_mapping_character_filter": {
            "type": "mapping",
            "mappings": ".=>@"
        }
    }

```

---

<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:** [August 20, 2019, 5:46pm UTC](https://discuss.elastic.co/t/what-happens-with-analyzed-fields-if-the-length-of-indexed-field-is-longer-than-the-max-gram-of-an-edge-ngram/191881/2 "2019-08-20T17:46:55Z")

</div>

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