# Mapping optimizations for Aggregations

**URL:** <https://discuss.elastic.co/t/mapping-optimizations-for-aggregations/43594>\
**Category:** Elasticsearch\
**Created:** [March 6, 2016, 10:05am UTC](https://discuss.elastic.co/t/mapping-optimizations-for-aggregations/43594 "2016-03-06T10:05:43Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![shaharmor](https://avatars.discourse-cdn.com/v4/letter/s/58f4c7/32.png) [@shaharmor](https://discuss.elastic.co/u/shaharmor)\
**Post date:** [March 6, 2016, 10:05am UTC](https://discuss.elastic.co/t/mapping-optimizations-for-aggregations/43594/1 "2016-03-06T10:05:43Z")

</div>

Hi,

We are using ES + Kibana for aggregations only.

Is there anything we can do to optimize the mapping and remove stuff we don't need?

Our main concern is memory usage. Maybe specific filteres/terms/norms or things like that that are not really documented anywhere...

Our ES version is 1.5.2

---

<div class="post-metadata">

**Author:** ![rusty](https://avatars.discourse-cdn.com/v4/letter/r/f17d59/32.png) [@rusty](https://discuss.elastic.co/u/rusty)\
**Post date:** [March 6, 2016, 1:11pm UTC](https://discuss.elastic.co/t/mapping-optimizations-for-aggregations/43594/2 "2016-03-06T13:11:00Z")

</div>

Hi! Just disable indexing fields you never needed `index: no` and enable `doc_values: true` for fields you are using for aggregations. Of course you can also set `not_analized` for strings and other fields that should not be analyzed at all. Hope that help.

PS. try to upgrade to latest 1.7.x because there were some optimizations and bugfixes.

---

<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:** [March 6, 2016, 8:21pm UTC](https://discuss.elastic.co/t/mapping-optimizations-for-aggregations/43594/3 "2016-03-06T20:21:44Z")

</div>

Upgrade to 2.X instead, you'll get better performance 🙂

---

<div class="post-metadata">

**Author:** ![shaharmor](https://avatars.discourse-cdn.com/v4/letter/s/58f4c7/32.png) [@shaharmor](https://discuss.elastic.co/u/shaharmor)\
**Post date:** [March 7, 2016, 7:37am UTC](https://discuss.elastic.co/t/mapping-optimizations-for-aggregations/43594/4 "2016-03-07T07:37:25Z")

</div>

I would really like to do that, but i can't take my whole cluster down.

I need a way to reindex all the data to a new cluster. @warkolm know any?

---

<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:** [March 7, 2016, 8:56pm UTC](https://discuss.elastic.co/t/mapping-optimizations-for-aggregations/43594/5 "2016-03-07T20:56:56Z")

</div>

Do you need to reindex though? Have you run the migration plugin to check?

---

<div class="post-metadata">

**Author:** ![shaharmor](https://avatars.discourse-cdn.com/v4/letter/s/58f4c7/32.png) [@shaharmor](https://discuss.elastic.co/u/shaharmor)\
**Post date:** [March 7, 2016, 9:14pm UTC](https://discuss.elastic.co/t/mapping-optimizations-for-aggregations/43594/6 "2016-03-07T21:14:34Z")

</div>

I ran the migration plugin and there were no errors.

However, when i tried to reindex some data to a new cluster i faced some issues with a geoip field.  
I don't see any other way without reindexing as i can't take the cluster down.

---

<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:** [March 7, 2016, 9:15pm UTC](https://discuss.elastic.co/t/mapping-optimizations-for-aggregations/43594/7 "2016-03-07T21:15:44Z")

</div>

But why are you reindexing?  
If the migration plugin found nothing then you can do an in-situ upgrade! (Of course I'd still take a backup)

---

<div class="post-metadata">

**Author:** ![shaharmor](https://avatars.discourse-cdn.com/v4/letter/s/58f4c7/32.png) [@shaharmor](https://discuss.elastic.co/u/shaharmor)\
**Post date:** [March 7, 2016, 9:30pm UTC](https://discuss.elastic.co/t/mapping-optimizations-for-aggregations/43594/8 "2016-03-07T21:30:52Z")

</div>

Following the table here: [https://www.elastic.co/guide/en/elasticsearch/reference/current/setup-upgrade.html](https://www.elastic.co/guide/en/elasticsearch/reference/current/setup-upgrade.html) i must do a complete cluster restart no?

---

<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:** [March 7, 2016, 9:44pm UTC](https://discuss.elastic.co/t/mapping-optimizations-for-aggregations/43594/9 "2016-03-07T21:44:43Z")

</div>

Ah right, sorry I missed that bit. You do yes.

I use Logstash for reindexing - [https://gist.github.com/markwalkom/8a7201e3f6ea4354ae06](https://gist.github.com/markwalkom/8a7201e3f6ea4354ae06)

---

<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:** [July 5, 2017, 11:10pm UTC](https://discuss.elastic.co/t/mapping-optimizations-for-aggregations/43594/10 "2017-07-05T23:10:34Z")

</div>


