# For autocompletion feature What is recommended type of the field? keyword or text

**URL:** <https://discuss.elastic.co/t/for-autocompletion-feature-what-is-recommended-type-of-the-field-keyword-or-text/126004>\
**Category:** Elasticsearch\
**Created:** [March 29, 2018, 1:58am UTC](https://discuss.elastic.co/t/for-autocompletion-feature-what-is-recommended-type-of-the-field-keyword-or-text/126004 "2018-03-29T01:58:28Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tarun\_Jangra](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/tarun_jangra/32/1426_2.png) [@Tarun\_Jangra](https://discuss.elastic.co/u/Tarun_Jangra)\
**Post date:** [March 29, 2018, 1:58am UTC](https://discuss.elastic.co/t/for-autocompletion-feature-what-is-recommended-type-of-the-field-keyword-or-text/126004/1 "2018-03-29T01:58:28Z")

</div>

String type has been removed and [index time search as you type](https://www.elastic.co/guide/en/elasticsearch/guide/master/_index_time_search_as_you_type.html) example is using "string" type. I did that by replacing it with text but i'm not getting expected results yet. May be i should use "keyword" type.

Any recommendation is appreciable.

Thanks

---

<div class="post-metadata">

**Author:** ![Tarun\_Jangra](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/tarun_jangra/32/1426_2.png) [@Tarun\_Jangra](https://discuss.elastic.co/u/Tarun_Jangra)\
**Post date:** [March 29, 2018, 2:27am UTC](https://discuss.elastic.co/t/for-autocompletion-feature-what-is-recommended-type-of-the-field-keyword-or-text/126004/2 "2018-03-29T02:27:58Z")

</div>

Oh, i think custom analyser can not be defined on field of type "keyword" during mapping creation. So i'm left with type "text".

---

<div class="post-metadata">

**Author:** ![forloop](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/forloop/32/9021_2.png) [@forloop](https://discuss.elastic.co/u/forloop)\
**Post date:** [March 31, 2018, 11:43am UTC](https://discuss.elastic.co/t/for-autocompletion-feature-what-is-recommended-type-of-the-field-keyword-or-text/126004/3 "2018-03-31T11:43:18Z")

</div>

From Elasticsearch 5.2.0+, `keyword` field data type supports a [normalizer](https://www.elastic.co/guide/en/elasticsearch/reference/5.2/normalizer.html), which is essentially an analysis chain that produces only a single token.

There's also the `completion` field data type used by [completion suggesters](https://www.elastic.co/guide/en/elasticsearch/reference/current/search-suggesters-completion.html)

---

<div class="post-metadata">

**Author:** ![Tarun\_Jangra](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/tarun_jangra/32/1426_2.png) [@Tarun\_Jangra](https://discuss.elastic.co/u/Tarun_Jangra)\
**Post date:** [March 31, 2018, 12:17pm UTC](https://discuss.elastic.co/t/for-autocompletion-feature-what-is-recommended-type-of-the-field-keyword-or-text/126004/4 "2018-03-31T12:17:30Z")

</div>

@forloop thanks to update here. It has worked the way you suggested. BTW, [completion suggesters](https://www.elastic.co/guide/en/elasticsearch/reference/current/search-suggesters-completion.html) are really cool.

---

<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:** [April 28, 2018, 12:17pm UTC](https://discuss.elastic.co/t/for-autocompletion-feature-what-is-recommended-type-of-the-field-keyword-or-text/126004/5 "2018-04-28T12:17:51Z")

</div>

Closed on April 28, 2018, 12:17pm UTC

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