# Relating two fields

**URL:** <https://discuss.elastic.co/t/relating-two-fields/123788>\
**Category:** Kibana\
**Created:** [March 13, 2018, 6:04pm UTC](https://discuss.elastic.co/t/relating-two-fields/123788 "2018-03-13T18:04:26Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Francisco1](https://avatars.discourse-cdn.com/v4/letter/f/96bed5/32.png) [@Francisco1](https://discuss.elastic.co/u/Francisco1)\
**Post date:** [March 13, 2018, 6:04pm UTC](https://discuss.elastic.co/t/relating-two-fields/123788/1 "2018-03-13T18:04:27Z")

</div>

Hello,

I don't know if I'm righting post the question here or if it would be more correct post it in elasticforum.

So, I got two arrays of strings in the same document. The first array is an array of names, and the second is an array of integer. Is there any way it's possible concatenate them by position, for example? Like the first position of array 1 matches the first position of array 2.

And yes, this is a kinda of workaround of Kibana not supporting nested objects.

If you guys got any solutions, or you think this is impossible please tell.

Cheers!

---

<div class="post-metadata">

**Author:** ![vinodr](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/vinodr/32/28759_2.png) [@vinodr](https://discuss.elastic.co/u/vinodr)\
**Post date:** [March 14, 2018, 2:32am UTC](https://discuss.elastic.co/t/relating-two-fields/123788/2 "2018-03-14T02:32:20Z")

</div>

@Francisco1 This may be possible using Scripted Fields in Kibana. A scripted string field with painless script similar to: **doc['field1'][0] + doc['field2'][0]** should give a new field with the concatenated values for position 0. You should be able to apply the above logic in a loop to concatenate and store all the array elements in a new scripted string field.  
**References:**  
[https://www.elastic.co/blog/using-painless-kibana-scripted-fields](https://www.elastic.co/blog/using-painless-kibana-scripted-fields)  
[https://www.elastic.co/guide/en/elasticsearch/painless/current/\_operators.html](https://www.elastic.co/blog/using-painless-kibana-scripted-fields)

---

<div class="post-metadata">

**Author:** ![Francisco1](https://avatars.discourse-cdn.com/v4/letter/f/96bed5/32.png) [@Francisco1](https://discuss.elastic.co/u/Francisco1)\
**Post date:** [March 14, 2018, 9:35am UTC](https://discuss.elastic.co/t/relating-two-fields/123788/3 "2018-03-14T09:35:41Z")

</div>

That's one hell of a idea. I'll try it out bro and then I'll give you feedback, thank you 🙂

---

<div class="post-metadata">

**Author:** ![Francisco1](https://avatars.discourse-cdn.com/v4/letter/f/96bed5/32.png) [@Francisco1](https://discuss.elastic.co/u/Francisco1)\
**Post date:** [March 14, 2018, 2:08pm UTC](https://discuss.elastic.co/t/relating-two-fields/123788/4 "2018-03-14T14:08:58Z")

</div>

Hello mate!

I've tryed what you said and it makes sense 🙂

I've ended up posting each element one by one so I can visualize it on Kibana. If someone would like more info please contact.

Thanks @vinodr

---

<div class="post-metadata">

**Author:** ![vinodr](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/vinodr/32/28759_2.png) [@vinodr](https://discuss.elastic.co/u/vinodr)\
**Post date:** [March 14, 2018, 3:07pm UTC](https://discuss.elastic.co/t/relating-two-fields/123788/5 "2018-03-14T15:07:48Z")

</div>

@Francisco1 Awesome! Glad it worked 🙂

---

<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:** [April 11, 2018, 3:08pm UTC](https://discuss.elastic.co/t/relating-two-fields/123788/6 "2018-04-11T15:08:01Z")

</div>

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