# Search a substring in a field

**URL:** <https://discuss.elastic.co/t/search-a-substring-in-a-field/222452>\
**Category:** Elasticsearch\
**Created:** [March 6, 2020, 12:03pm UTC](https://discuss.elastic.co/t/search-a-substring-in-a-field/222452 "2020-03-06T12:03:09Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![McElroy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mcelroy/32/24639_2.png) [@McElroy](https://discuss.elastic.co/u/McElroy)\
**Post date:** [March 6, 2020, 12:03pm UTC](https://discuss.elastic.co/t/search-a-substring-in-a-field/222452/1 "2020-03-06T12:03:09Z")

</div>

Hi,

I'd like to search for a substring in the message field of my document, but I can't get it done.  
The substring is "Error while initializing socket". I'd like to get it via curl. I already search a lot in the documentation and while trying I always get the wrong documents back.

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [March 6, 2020, 3:46pm UTC](https://discuss.elastic.co/t/search-a-substring-in-a-field/222452/2 "2020-03-06T15:46:05Z")

</div>

Could you provide a full recreation script as described in [About the Elasticsearch category](https://discuss.elastic.co/t/about-the-elasticsearch-category/21). It will help to better understand what you are doing. Please, try to keep the example as simple as possible.

A full reproduction script will help readers to understand, reproduce and if needed fix your problem. It will also most likely help to get a faster answer.

---

<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:** [April 3, 2020, 3:46pm UTC](https://discuss.elastic.co/t/search-a-substring-in-a-field/222452/3 "2020-04-03T15:46:06Z")

</div>

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