# Strings query

**URL:** <https://discuss.elastic.co/t/strings-query/114814>\
**Category:** Kibana\
**Created:** [January 10, 2018, 8:36am UTC](https://discuss.elastic.co/t/strings-query/114814 "2018-01-10T08:36:40Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![jerrychen](https://avatars.discourse-cdn.com/v4/letter/j/839c29/32.png) [@jerrychen](https://discuss.elastic.co/u/jerrychen)\
**Post date:** [January 10, 2018, 8:36am UTC](https://discuss.elastic.co/t/strings-query/114814/1 "2018-01-10T08:36:40Z")

</div>

kibana 5.4 + es 5.4  
I want to terms the suffix of the url.keyword,such as docs or doc or zip...etc.

url.keyword field content like 'abcde.html','abcde11.zip','abcde\*\*222.doc'...

How to do that.

Thanks for your help.

---

<div class="post-metadata">

**Author:** ![Marius\_Dragomir](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/marius_dragomir/32/42087_2.png) [@Marius\_Dragomir](https://discuss.elastic.co/u/Marius_Dragomir)\
**Post date:** [January 10, 2018, 2:08pm UTC](https://discuss.elastic.co/t/strings-query/114814/2 "2018-01-10T14:08:14Z")

</div>

Best way to do this is to create url.keyword.extension at ingest, but if that is not possible, you could create a scripted field to parse the string and create a new scripted field that only has the data from last . to the end of the string.  
You can find good examples here: [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:** ![jerrychen](https://avatars.discourse-cdn.com/v4/letter/j/839c29/32.png) [@jerrychen](https://discuss.elastic.co/u/jerrychen)\
**Post date:** [January 11, 2018, 7:33am UTC](https://discuss.elastic.co/t/strings-query/114814/3 "2018-01-11T07:33:53Z")

</div>

Thanks for your advice.Scripted field is good idea.

If don't want to add field,just do query in es.Can I do that such as using distinct(substr) by SQL.

---

<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:** [February 8, 2018, 7:34am UTC](https://discuss.elastic.co/t/strings-query/114814/4 "2018-02-08T07:34:23Z")

</div>

Closed on February 8, 2018, 7:34am UTC

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