# Best way to add a field as "sessionize" of another field+date

**URL:** <https://discuss.elastic.co/t/best-way-to-add-a-field-as-sessionize-of-another-field-date/63313>\
**Category:** Elasticsearch\
**Created:** [October 18, 2016, 4:58pm UTC](https://discuss.elastic.co/t/best-way-to-add-a-field-as-sessionize-of-another-field-date/63313 "2016-10-18T16:58:42Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ebuildy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ebuildy/32/6070_2.png) [@ebuildy](https://discuss.elastic.co/u/ebuildy)\
**Post date:** [October 18, 2016, 4:58pm UTC](https://discuss.elastic.co/t/best-way-to-add-a-field-as-sessionize-of-another-field-date/63313/1 "2016-10-18T16:58:42Z")

</div>

Hello guys, in my pocket I have:

- 3 data-nodes
- 7 daily indices
- 12.000.000 doc/day \<-\> 20Go/day

Documents are:

{"date" : "01/10/2002 10:20", "user\_uid": "0032840238-3049309" ....}

I would like scan all documents (for a given day) and change user\_uid to an integer (like a hash, same user\_uid have same integer value, I don't know the name of this process..).

What is the best and cleanest way to achieve this with ES 2.4?

Thanks you,

---

<div class="post-metadata">

**Author:** ![cbuescher](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/cbuescher/32/60402_2.png) [@cbuescher](https://discuss.elastic.co/u/cbuescher)\
**Post date:** [October 18, 2016, 6:35pm UTC](https://discuss.elastic.co/t/best-way-to-add-a-field-as-sessionize-of-another-field-date/63313/2 "2016-10-18T18:35:07Z")

</div>

Hi,

Just a few questions:

- Do you want to discard the original field or would it be okay to also keep the original value?
- Why do you need to convert it? After all, "user\_uid" already sounds like it is unique.
- Whats your current indexing process (do you go through logstash, if so, why not do the transformation there)?

---

<div class="post-metadata">

**Author:** ![ebuildy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ebuildy/32/6070_2.png) [@ebuildy](https://discuss.elastic.co/u/ebuildy)\
**Post date:** [October 18, 2016, 6:48pm UTC](https://discuss.elastic.co/t/best-way-to-add-a-field-as-sessionize-of-another-field-date/63313/3 "2016-10-18T18:48:46Z")

</div>

Hello,

- I must discard it at the end
- user\_uid is string, from HASH(IP), my company asks me to not store that, but something "daily reseted"
- I have logstash at the front, but I don't have full access to it whereas I have full access to elasticsearch

Just curious if it's possible via reindex API or update API. Else, I am using a small Java script for that but its slow and consume CPU and network 😕

---

<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, 10:11pm UTC](https://discuss.elastic.co/t/best-way-to-add-a-field-as-sessionize-of-another-field-date/63313/4 "2017-07-05T22:11:30Z")

</div>


