# Elasticsearch and picklists?

**URL:** <https://discuss.elastic.co/t/elasticsearch-and-picklists/94706>\
**Category:** Elasticsearch\
**Created:** [July 26, 2017, 9:02pm UTC](https://discuss.elastic.co/t/elasticsearch-and-picklists/94706 "2017-07-26T21:02:40Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![esearch](https://avatars.discourse-cdn.com/v4/letter/e/5fc32e/32.png) [@esearch](https://discuss.elastic.co/u/esearch)\
**Post date:** [July 26, 2017, 9:02pm UTC](https://discuss.elastic.co/t/elasticsearch-and-picklists/94706/1 "2017-07-26T21:02:40Z")

</div>

Is there a way to use Elasticsearch to implement picklists WITHOUT storing all the data?

For example, say I have the following data:

```
POST food/dessert/1
{
    "name" : "banana creme pie",
    "type" : "pie"
}

POST food/dessert/2
{
    "name" : "tiramisu",
    "type" : "cake"
}

POST food/dessert/3
{
    "name" : "black forest",
    "type" : "cake"
}

POST food/dessert/4
{
    "name" : "tiramisu",
    "type" : "cake"
}

```

I'm making an application that shows you all the possible values for any field, so if you're searching for "type", it'll show you "cake" and "pie". If you're searching for "name", it'll show you "tiramisu", "black forest", etc..

Note that there's a lot of duplicate data here. "cake" is repeated multiple times. All I really need to store is a set of strings for each field.

I'm not sure if I'm trying to force Elasticsearch onto my problem or I'm not seeing how to use Elasticsearch correctly.

Please advice. Thanks in advance!

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [July 26, 2017, 9:40pm UTC](https://discuss.elastic.co/t/elasticsearch-and-picklists/94706/2 "2017-07-26T21:40:58Z")

</div>

> [@esearch](#):
>
> I'm not sure if I'm trying to force Elasticsearch onto my problem or I'm not seeing how to use Elasticsearch correctly.

Depends what the problem is. Elasticsearch will do this no problems, it also does compression on fields (but not deduplication), so it'll store things efficiently.

---

<div class="post-metadata">

**Author:** ![esearch](https://avatars.discourse-cdn.com/v4/letter/e/5fc32e/32.png) [@esearch](https://discuss.elastic.co/u/esearch)\
**Post date:** [July 26, 2017, 9:47pm UTC](https://discuss.elastic.co/t/elasticsearch-and-picklists/94706/3 "2017-07-26T21:47:41Z")

</div>

Thanks for your reply. The problem is implementing picklists with Elasticsearch without storing all the data. The example given was just a few examples, but the real data will have tens of millions of entries and there will be a lot of duplicates for a specific field and there will be dozens of fields per record, so I don't want to store the source for each individual record. Does that make sense?

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [July 26, 2017, 11:01pm UTC](https://discuss.elastic.co/t/elasticsearch-and-picklists/94706/4 "2017-07-26T23:01:25Z")

</div>

It does.

However even with tens of millions of records I don't think there's any problem here. If you are so resource restricted that you cannot store this data, then look at setting the field mappings to [`"store": false`](https://www.elastic.co/guide/en/elasticsearch/reference/5.5/mapping-store.html).

---

<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 23, 2017, 11:01pm UTC](https://discuss.elastic.co/t/elasticsearch-and-picklists/94706/5 "2017-08-23T23:01:43Z")

</div>

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