# Which gives better search performance? Search in list element or search in text

**URL:** <https://discuss.elastic.co/t/which-gives-better-search-performance-search-in-list-element-or-search-in-text/72451>\
**Category:** Elasticsearch\
**Created:** [January 23, 2017, 8:57am UTC](https://discuss.elastic.co/t/which-gives-better-search-performance-search-in-list-element-or-search-in-text/72451 "2017-01-23T08:57:13Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![heeren](https://avatars.discourse-cdn.com/v4/letter/h/a3d4f5/32.png) [@heeren](https://discuss.elastic.co/u/heeren)\
**Post date:** [January 23, 2017, 8:57am UTC](https://discuss.elastic.co/t/which-gives-better-search-performance-search-in-list-element-or-search-in-text/72451/1 "2017-01-23T08:57:13Z")

</div>

To give a better context, if I have a field called "countries".  
Value of countries can be put as a space separated string (type string) e.g. "de en es"  
or it can be saved as a proper list (type object) e.g. ["de", "en", "es"].  
I want to use this field for filtering of my search queries.  
My concern is about the search performance (scaling) over real time searches (a lot).  
Thank you for your insights.

---

<div class="post-metadata">

**Author:** ![xavierfacq](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/xavierfacq/32/8744_2.png) [@xavierfacq](https://discuss.elastic.co/u/xavierfacq)\
**Post date:** [January 23, 2017, 9:17am UTC](https://discuss.elastic.co/t/which-gives-better-search-performance-search-in-list-element-or-search-in-text/72451/2 "2017-01-23T09:17:37Z")

</div>

Hi, I suggest you to use an array of String not\_analyzed.

---

<div class="post-metadata">

**Author:** ![heeren](https://avatars.discourse-cdn.com/v4/letter/h/a3d4f5/32.png) [@heeren](https://discuss.elastic.co/u/heeren)\
**Post date:** [January 23, 2017, 9:21am UTC](https://discuss.elastic.co/t/which-gives-better-search-performance-search-in-list-element-or-search-in-text/72451/3 "2017-01-23T09:21:27Z")

</div>

Thank you for your reply.  
Can you give some more reasoning how array is better than plain string ?

---

<div class="post-metadata">

**Author:** ![xavierfacq](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/xavierfacq/32/8744_2.png) [@xavierfacq](https://discuss.elastic.co/u/xavierfacq)\
**Post date:** [January 23, 2017, 9:27am UTC](https://discuss.elastic.co/t/which-gives-better-search-performance-search-in-list-element-or-search-in-text/72451/4 "2017-01-23T09:27:48Z")

</div>

Because your field doesn't need to be analysed and will be used as a filter (faster) So values need to be splitted. Moreover, you will be able build aggregation on it.

---

<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:** [February 20, 2017, 9:27am UTC](https://discuss.elastic.co/t/which-gives-better-search-performance-search-in-list-element-or-search-in-text/72451/5 "2017-02-20T09:27:49Z")

</div>

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