# String contains Substring Search across one or more fields

**URL:** <https://discuss.elastic.co/t/string-contains-substring-search-across-one-or-more-fields/196828>\
**Category:** Elasticsearch\
**Created:** [August 26, 2019, 7:35pm UTC](https://discuss.elastic.co/t/string-contains-substring-search-across-one-or-more-fields/196828 "2019-08-26T19:35:55Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![TeraInferno](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/terainferno/32/40302_2.png) [@TeraInferno](https://discuss.elastic.co/u/TeraInferno)\
**Post date:** [August 26, 2019, 7:35pm UTC](https://discuss.elastic.co/t/string-contains-substring-search-across-one-or-more-fields/196828/1 "2019-08-26T19:35:55Z")

</div>

Hello. I am looking for analysis and mapping setting recommendations that would allow me to perform searches that answer 'does string Y contain substring X?'.

For example, given the sample data:

```auto
[
  {
    "name": {
      "first": "Garrett",
      "last": "Lee"
    },
    "company": "NORALI",
    "email": "garrett.lee@norali.biz",
    "phone": "+1 (815) 425-2523",
    "address": "795 Truxton Street, Kiskimere, New Mexico, 7346",
    "serialNumber": "64167f877a47",
    "ipAddress": "10.240.246.103",
    "registered": "Monday, February 5, 2018 2:40 AM"
  },
  {
    "name": {
      "first": "Kramer",
      "last": "Harper"
    },
    "company": "NSPIRE",
    "email": "kramer.harper@nspire.org",
    "phone": "+1 (860) 567-3581",
    "address": "678 Willoughby Street, Catherine, Marshall Islands, 4958",
    "serialNumber": "8219064D033CF2",
    "ipAddress": "10.12.64.47",
    "registered": "Sunday, January 17, 2016 12:42 PM"
  },
  {
    "name": {
      "first": "Mitzi",
      "last": "Merrill"
    },
    "company": "SPRINGBEE",
    "email": "mitzi.merrill@springbee.biz",
    "phone": "+1 (881) 520-2254",
    "address": "398 Madison Place, Nutrioso, Florida, 3089",
    "serialNumber": "64167f3c5687",
    "ipAddress": "192.22.6.2",
    "registered": "Thursday, June 8, 2017 6:22 PM"
  }
]

```

I would like to be able to perform a search on one or more fields for an arbitary substring, such as:

- Find all documents where the email contains 'bee'
- Find all documents where ipAddress, SerialNumber, or phone contains '22.'

Recommendations?

Thanks!

---

<div class="post-metadata">

**Author:** ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)\
**Post date:** [August 28, 2019, 11:29am UTC](https://discuss.elastic.co/t/string-contains-substring-search-across-one-or-more-fields/196828/2 "2019-08-28T11:29:23Z")

</div>

Even though the book is already a bit older, the section on [partial matching from the definitive guide](https://www.elastic.co/guide/en/elasticsearch/guide/current/partial-matching.html) still applies - you might want to to read the whole `Search in Depth` chapter as I personally find it really useful to understand how search works (which also requires you to understand how data is stored in the inverted index).

---

<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:** [September 25, 2019, 11:29am UTC](https://discuss.elastic.co/t/string-contains-substring-search-across-one-or-more-fields/196828/3 "2019-09-25T11:29:29Z")

</div>

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