# Arrays in arrays

**URL:** https://discuss.elastic.co/t/arrays-in-arrays/86816
**Category:** Logstash
**Created:** [May 23, 2017, 1:23pm UTC](https://discuss.elastic.co/t/arrays-in-arrays/86816 "2017-05-23T13:23:26Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Toony](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/toony/32/18458_2.png) [@Toony](https://discuss.elastic.co/u/Toony)
#### Post date: [May 23, 2017, 1:23pm UTC](https://discuss.elastic.co/t/arrays-in-arrays/86816/1 "2017-05-23T13:23:26Z")

</div>

Hi everyone,

I am trying to index geoshapes from kafka messages ...

I just can not use the merge to put arrays in an array.

For instance, i want to index an envelope geoshape like this in target elasticsearch json:

> [...]  
> "location" : {  
> "type":"envelope",  
> "coordinates": [[x1,y1], [x2,y2] ]  
> },  
> [...]

I tryed this:

> ```
> mutate {
> convert => {
> "x1" => float
> "x2" => float
> "y1" => float
> "y2" => float
> }
> merge => { "x1" => "y1"}
> merge => { "x2" => "y2" }
> merge => { "coordinates" => "x1" }
> merge => { "coordinates" => "x2" }
> 
> ```

But as a result I found:

"coordinates": [x2,y2]

and not

"coordinates":[[x1,y1],[x2,y2]

Any idea on how to achieve this ?  
I thought about the ruby code filter but I definitely do not master the syntax ☹

Thanks for your help !

---

<div class="post-metadata">

### Author: ![Toony](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/toony/32/18458_2.png) [@Toony](https://discuss.elastic.co/u/Toony)
#### Post date: [May 24, 2017, 8:46am UTC](https://discuss.elastic.co/t/arrays-in-arrays/86816/2 "2017-05-24T08:46:53Z")

</div>

I have finally found a solution to add my geohash.

> mutate {  
> convert =\> {  
> "x1" =\> float  
> "x2" =\> float  
> "y1" =\> float  
> "y2" =\> float  
> }  
> merge =\> { "x1" =\> "y1"}  
> merge =\> { "x2" =\> "y2" }  
> }  
> ruby {  
> code =\> 'event.set("[location][type]","envelope");event.set("[location][coordinates]",[event.get("x1"),event.get("x2")])'  
> remove\_field =\> ["x1", "x2", "y1", "y2"]  
> }

---

<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: [June 21, 2017, 8:47am UTC](https://discuss.elastic.co/t/arrays-in-arrays/86816/3 "2017-06-21T08:47:03Z")

</div>

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