# Searching substrings in an item of a List

**URL:** <https://discuss.elastic.co/t/searching-substrings-in-an-item-of-a-list/19174>\
**Category:** Elasticsearch\
**Created:** [August 9, 2014, 12:52pm UTC](https://discuss.elastic.co/t/searching-substrings-in-an-item-of-a-list/19174 "2014-08-09T12:52:44Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![PrgKh](https://avatars.discourse-cdn.com/v4/letter/p/a698b9/32.png) [@PrgKh](https://discuss.elastic.co/u/PrgKh)\
**Post date:** [August 9, 2014, 12:52pm UTC](https://discuss.elastic.co/t/searching-substrings-in-an-item-of-a-list/19174/1 "2014-08-09T12:52:44Z")

</div>

HI

I have a document structure like :

{  
"\_index": "a",  
"\_type": "b",  
"\_id": "1",  
"\_score": 1,  
"\_source": {  
"cId": 1,  
"sampleList": [  
"abc rst xyz",  
"def xyz",  
"rst mno"  
],  
}  
}  
{  
"\_index": "a",  
"\_type": "b",  
"\_id": "2",  
"\_score": 1,  
"\_source": {  
"cId": 2,  
"sampleList": [  
"abc rst",  
"def xyz",  
"rst mno"  
],  
}  
}

i want to search for "abc" & "xyz" and it should return only first one i.e. return only those where an item in a list contains both "abc" and "xyz".

What should my query be ?  
please suggest

Thanks

---

<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:09am UTC](https://discuss.elastic.co/t/searching-substrings-in-an-item-of-a-list/19174/2 "2017-07-06T01:09:48Z")

</div>


