# SQL REST API - Need to return part of a text field

**URL:** <https://discuss.elastic.co/t/sql-rest-api-need-to-return-part-of-a-text-field/153191>\
**Category:** Elasticsearch\
**Created:** [October 19, 2018, 2:33pm UTC](https://discuss.elastic.co/t/sql-rest-api-need-to-return-part-of-a-text-field/153191 "2018-10-19T14:33:20Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![byoungman](https://avatars.discourse-cdn.com/v4/letter/b/838e76/32.png) [@byoungman](https://discuss.elastic.co/u/byoungman)\
**Post date:** [October 19, 2018, 2:33pm UTC](https://discuss.elastic.co/t/sql-rest-api-need-to-return-part-of-a-text-field/153191/1 "2018-10-19T14:33:20Z")

</div>

I'm on ES 6.4 and am trying to write a sql query using the SQL REST API and one of the requirements is that I display a time which is part of a text field. So far I'm not able to find anything like SUBSTRING & PATINDEX equivalent that I can use so how could I go about doing this?

Example:

 65.7

I need to be able to pull out the value (65.7) and return it in my query so that I can build a report off of it.

TIA,  
Bill Youngman

---

<div class="post-metadata">

**Author:** ![nik9000](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nik9000/32/44947_2.png) [@nik9000](https://discuss.elastic.co/u/nik9000)\
**Post date:** [October 19, 2018, 4:38pm UTC](https://discuss.elastic.co/t/sql-rest-api-need-to-return-part-of-a-text-field/153191/2 "2018-10-19T16:38:14Z")

</div>

Substring is showing up in [6.5](https://github.com/elastic/elasticsearch/pull/32356). Until then I think you are stuck doing it on the client side if possible.

---

<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:** [November 16, 2018, 4:38pm UTC](https://discuss.elastic.co/t/sql-rest-api-need-to-return-part-of-a-text-field/153191/3 "2018-11-16T16:38:15Z")

</div>

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