# How to split URL in kibana

**URL:** <https://discuss.elastic.co/t/how-to-split-url-in-kibana/64873>\
**Category:** Kibana\
**Created:** [November 3, 2016, 1:47pm UTC](https://discuss.elastic.co/t/how-to-split-url-in-kibana/64873 "2016-11-03T13:47:53Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![florentmair](https://avatars.discourse-cdn.com/v4/letter/f/8e7dd6/32.png) [@florentmair](https://discuss.elastic.co/u/florentmair)\
**Post date:** [November 3, 2016, 1:47pm UTC](https://discuss.elastic.co/t/how-to-split-url-in-kibana/64873/1 "2016-11-03T13:47:53Z")

</div>

Hello

Is it possible to parse URL, keep the first argument and graph it.  
For example, i have some datas like this :  
site1/page1.html  
site1/page2.html  
site1/dir/index.html  
site2/index.php  
site3/index.php

i want visualise only the number of site1, site2, site3, ...

does it possible?

Regards  
Florent

---

<div class="post-metadata">

**Author:** ![jbudz](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jbudz/32/45922_2.png) [@jbudz](https://discuss.elastic.co/u/jbudz)\
**Post date:** [November 3, 2016, 3:35pm UTC](https://discuss.elastic.co/t/how-to-split-url-in-kibana/64873/2 "2016-11-03T15:35:27Z")

</div>

If this is something you'll need frequently I would suggest splitting this out into its own field before ingesting into elasticsearch, using something like logstash.

If not, you can use a scripted field. The scripting language painless is available in 5.0+ and a script for this would look something like:

 ![](https://us1.discourse-cdn.com/elastic/original/2X/0/0814c500b997a9bf0bbe03c20ab82d6f204a046c.png)

Other scripting languages are available in previous versions but working with strings is disabled by default. [https://www.elastic.co/guide/en/elasticsearch/reference/2.4/modules-scripting.html](https://www.elastic.co/guide/en/elasticsearch/reference/2.4/modules-scripting.html) has more info on why, and how to enable them.

---

<div class="post-metadata">

**Author:** ![florentmair](https://avatars.discourse-cdn.com/v4/letter/f/8e7dd6/32.png) [@florentmair](https://discuss.elastic.co/u/florentmair)\
**Post date:** [November 7, 2016, 1:03pm UTC](https://discuss.elastic.co/t/how-to-split-url-in-kibana/64873/3 "2016-11-07T13:03:32Z")

</div>

Great, i will try this method

And yes, it's just need this one time

Thanks

---

<div class="post-metadata">

**Author:** ![tbragin](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/tbragin/32/45166_2.png) [@tbragin](https://discuss.elastic.co/u/tbragin)\
**Post date:** [December 13, 2016, 8:27pm UTC](https://discuss.elastic.co/t/how-to-split-url-in-kibana/64873/4 "2016-12-13T20:27:09Z")

</div>

There is now a new blog post on using Painless scripting in Kibana scripted fields with examples and best practices: [https://www.elastic.co/blog/using-painless-kibana-scripted-fields](https://www.elastic.co/blog/using-painless-kibana-scripted-fields)

---

<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, 1:33pm UTC](https://discuss.elastic.co/t/how-to-split-url-in-kibana/64873/5 "2017-07-06T13:33:45Z")

</div>


