# Scripted fields and type conversion with Kibana4B3

**URL:** <https://discuss.elastic.co/t/scripted-fields-and-type-conversion-with-kibana4b3/21303>\
**Category:** Elasticsearch\
**Created:** [December 18, 2014, 2:56am UTC](https://discuss.elastic.co/t/scripted-fields-and-type-conversion-with-kibana4b3/21303 "2014-12-18T02:56:31Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jay\_Swan](https://avatars.discourse-cdn.com/v4/letter/j/e9a140/32.png) [@Jay\_Swan](https://discuss.elastic.co/u/Jay_Swan)\
**Post date:** [December 18, 2014, 2:56am UTC](https://discuss.elastic.co/t/scripted-fields-and-type-conversion-with-kibana4b3/21303/1 "2014-12-18T02:56:31Z")

</div>

I just started playing with scripted fields in Kibana4 Beta3.

I'm looking for guidance on how to do type conversions with the new  
scripted fields feature. Specifically, I have some ES fields that I've  
typed as "ip" to (obviously) store IPv4 addresses. I'd line to convert  
these to strings when creating my scripted field. Since 1) I didn't know  
anything about Groovy until yesterday, and 2) Groovy doesn't appear to have  
a native IP type, I'm at a loss as to how to approach this. Anybody know?

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/6f6ff411-95f9-4003-bc9a-d355f3a3165c%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/6f6ff411-95f9-4003-bc9a-d355f3a3165c%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![Jay\_Swan](https://avatars.discourse-cdn.com/v4/letter/j/e9a140/32.png) [@Jay\_Swan](https://discuss.elastic.co/u/Jay_Swan)\
**Post date:** [December 18, 2014, 5:08am UTC](https://discuss.elastic.co/t/scripted-fields-and-type-conversion-with-kibana4b3/21303/2 "2014-12-18T05:08:22Z")

</div>

Well, I figured out that I can use doc['field\_name'].value.toString(), but  
that returns the integer version of the IP address as a string rather than  
the dotted decimal version. I see some discussion of this problem in the ES  
Github issues, but I can't tell if there's a solution.

On Wednesday, December 17, 2014 7:56:31 PM UTC-7, Jay Swan wrote:

> I just started playing with scripted fields in Kibana4 Beta3.
> 
> I'm looking for guidance on how to do type conversions with the new  
> scripted fields feature. Specifically, I have some ES fields that I've  
> typed as "ip" to (obviously) store IPv4 addresses. I'd line to convert  
> these to strings when creating my scripted field. Since 1) I didn't know  
> anything about Groovy until yesterday, and 2) Groovy doesn't appear to have  
> a native IP type, I'm at a loss as to how to approach this. Anybody know?

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/3147a62a-9efb-4a17-af97-4b6c02acc082%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/3147a62a-9efb-4a17-af97-4b6c02acc082%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<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, 12:43am UTC](https://discuss.elastic.co/t/scripted-fields-and-type-conversion-with-kibana4b3/21303/3 "2017-07-06T00:43:03Z")

</div>


