# Split fields and reindex?

**URL:** <https://discuss.elastic.co/t/split-fields-and-reindex/73338>\
**Category:** Elasticsearch\
**Created:** [January 31, 2017, 10:09am UTC](https://discuss.elastic.co/t/split-fields-and-reindex/73338 "2017-01-31T10:09:43Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![tushar\_chevulkar](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/tushar_chevulkar/32/46270_2.png) [@tushar\_chevulkar](https://discuss.elastic.co/u/tushar_chevulkar)\
**Post date:** [January 31, 2017, 10:09am UTC](https://discuss.elastic.co/t/split-fields-and-reindex/73338/1 "2017-01-31T10:09:43Z")

</div>

I have a mapping in which i have a following field  
\> "full\_name": {  
\> "type": "text"  
\> }

which has 500,000 entries in it. Now the problem is i need to run a **DISTINCT** query on only first name. Can anyone tell me how i write the query. or do I need to re-index the data if yes how do i split the full\_name to first\_name and last name and re-index it

---

<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:** [January 31, 2017, 10:16am UTC](https://discuss.elastic.co/t/split-fields-and-reindex/73338/2 "2017-01-31T10:16:07Z")

</div>

You need to reindex and have a first and last name field.

---

<div class="post-metadata">

**Author:** ![tushar\_chevulkar](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/tushar_chevulkar/32/46270_2.png) [@tushar\_chevulkar](https://discuss.elastic.co/u/tushar_chevulkar)\
**Post date:** [January 31, 2017, 10:29am UTC](https://discuss.elastic.co/t/split-fields-and-reindex/73338/3 "2017-01-31T10:29:14Z")

</div>

is there a way that i can split the existing field and re-index in elastic search without using any external script?

---

<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:** [January 31, 2017, 12:51pm UTC](https://discuss.elastic.co/t/split-fields-and-reindex/73338/4 "2017-01-31T12:51:33Z")

</div>

There is no way to do this automatically, sorry. Also, even splitting while reindexing will be tricky for your `full_name` use case. From my own experience I can tell you that determining "first name" parts in person names can be a real challenge. Depending on the kind of names (cultural context) you might get away with some heuristics though, but this largely depends on your data.

---

<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 28, 2017, 12:51pm UTC](https://discuss.elastic.co/t/split-fields-and-reindex/73338/5 "2017-02-28T12:51:40Z")

</div>

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