# Why Completion Suggester with Edge Ngram analyzer takes 15 to 17 times more index size as compared to default

**URL:** <https://discuss.elastic.co/t/why-completion-suggester-with-edge-ngram-analyzer-takes-15-to-17-times-more-index-size-as-compared-to-default/133467>\
**Category:** Elasticsearch\
**Created:** [May 28, 2018, 6:16am UTC](https://discuss.elastic.co/t/why-completion-suggester-with-edge-ngram-analyzer-takes-15-to-17-times-more-index-size-as-compared-to-default/133467 "2018-05-28T06:16:39Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![sharma.puneet3](https://avatars.discourse-cdn.com/v4/letter/s/eada6e/32.png) [@sharma.puneet3](https://discuss.elastic.co/u/sharma.puneet3)\
**Post date:** [May 28, 2018, 6:16am UTC](https://discuss.elastic.co/t/why-completion-suggester-with-edge-ngram-analyzer-takes-15-to-17-times-more-index-size-as-compared-to-default/133467/1 "2018-05-28T06:16:40Z")

</div>

I am implementing **completion suggester** on **multiple field** having alphanumeric and colon( **AA:890090:xyz:9090** ).  
When I use **default analyzer** for completion suggester(simple analyzer), I am not able to get suggestions(AA:890) as simple analyzer **tokenize alphabets only**.  
To overcome this issue, we used **edge ngram analyzer** , which solves the suggestion issues but index size is more than **15 to 17 times** as compared to default analyzer.  
Foreg. index size is around **3GB with default analyzer** and **with ngram analyzer size become 50 GB**.

Why index size with ngram analyzer is **that much high** as compare to default analyzer, **Elastic search mapping** can be find below.  
Please suggest, if there is any better way to do the same.

Sample data:  
AA:890090:xyz:9090

Sample Mapping :

```
 {
  "settings": {
    "analysis": {
      "filter": {
        "ngram_filter": {
          "type": "edge_ngram",
          "min_gram": 3,
          "max_gram": 40
        }
      },
      "analyzer": {
        "ngram_analyzer": {
          "type": "custom",
          "tokenizer": "whitespace",
          "filter": [
            "lowercase",
            "ngram_filter"
          ]
        }
      }
    }
  },
  "mappings": {
    "doc": {
      "properties": {
        "field1Suggest": {
          "type": "completion",
          "analyzer": "ngram_analyzer",
          "search_analyzer": "whitespace"
        },
        "field2Suggest": {
          "type": "completion",
          "analyzer": "ngram_analyzer",
          "search_analyzer": "whitespace"
        }
      }
    }
  }
}
```

---

<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:** [May 29, 2018, 7:02am UTC](https://discuss.elastic.co/t/why-completion-suggester-with-edge-ngram-analyzer-takes-15-to-17-times-more-index-size-as-compared-to-default/133467/2 "2018-05-29T07:02:00Z")

</div>

You have a price to pay:

- At index time, using ngrams: that's slowing down the ingestion and take much more space
- At search time, using wildcards: that's slowing down the search.

Something you can look at: [https://www.elastic.co/guide/en/elasticsearch/reference/current/search-suggesters.html](https://www.elastic.co/guide/en/elasticsearch/reference/current/search-suggesters.html)

May be that can help but I'm not sure though.

---

<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:** [June 26, 2018, 7:02am UTC](https://discuss.elastic.co/t/why-completion-suggester-with-edge-ngram-analyzer-takes-15-to-17-times-more-index-size-as-compared-to-default/133467/3 "2018-06-26T07:02:03Z")

</div>

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