# Add\_field to write object & array values

**URL:** <https://discuss.elastic.co/t/add-field-to-write-object-array-values/1095>\
**Category:** Logstash\
**Created:** [May 21, 2015, 2:24pm UTC](https://discuss.elastic.co/t/add-field-to-write-object-array-values/1095 "2015-05-21T14:24:12Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![kyunam](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kyunam/32/3576_2.png) [@kyunam](https://discuss.elastic.co/u/kyunam)\
**Post date:** [May 21, 2015, 2:24pm UTC](https://discuss.elastic.co/t/add-field-to-write-object-array-values/1095/1 "2015-05-21T14:24:13Z")

</div>

Hi!

I'm trying to create geo\_point field in a filter.  
I can create a string representation of geo\_point fine.  
But I can't figure out how to write object representation & array representation of geo\_point by using add\_field. (I'm sure embarrassingly I'm not understanding something very simple....)

Can you show me how to write both object & array representations?

filter {  
mutate {  
convert =\> { "x" =\> "float" }  
convert =\> { "y" =\> "float" }  
add\_field =\> { "location" =\> "%{y},%{x}" }  
# Following adds string values, not float values..  
# add\_field =\> { "location" =\> ["%{x}","%{y}"] }  
}

Thanks,  
Q

---

<div class="post-metadata">

**Author:** ![jcfrench](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jcfrench/32/8138_2.png) [@jcfrench](https://discuss.elastic.co/u/jcfrench)\
**Post date:** [April 4, 2017, 3:56am UTC](https://discuss.elastic.co/t/add-field-to-write-object-array-values/1095/2 "2017-04-04T03:56:15Z")

</div>

There are a couple tricks.

1. load your values into nested object fields instead of normal fields

2. convert the entire object.

3. adjust your elasticsearch mapping to let it know that your field is a geo\_point (not shown)

R-  
-J

---

<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 6, 2017, 4:27am UTC](https://discuss.elastic.co/t/add-field-to-write-object-array-values/1095/3 "2017-07-06T04:27:22Z")

</div>


