# How to Filter the results and show certain array from the list

**URL:** <https://discuss.elastic.co/t/how-to-filter-the-results-and-show-certain-array-from-the-list/195542>\
**Category:** Elasticsearch\
**Created:** [August 16, 2019, 6:01pm UTC](https://discuss.elastic.co/t/how-to-filter-the-results-and-show-certain-array-from-the-list/195542 "2019-08-16T18:01:40Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![har1pra](https://avatars.discourse-cdn.com/v4/letter/h/9fc348/32.png) [@har1pra](https://discuss.elastic.co/u/har1pra)\
**Post date:** [August 16, 2019, 6:01pm UTC](https://discuss.elastic.co/t/how-to-filter-the-results-and-show-certain-array-from-the-list/195542/1 "2019-08-16T18:01:40Z")

</div>

Hi,

I am leveraging Elasticsearch logs to retrieve the critical Metrics and showing in BI tool. I am currently facing a challenge in Elasticsearch query:

The json document that I am retrieving have multiple segments in a list. I am able to write a query to match specific segment and filter the right document. However, in the resultset I want to get only specific arrays from the list.

So from the "List\_Array", I want to get the segmentId in GE or IEA4 to show in the resukt. Is this possible?  
"List\_Array":  
[  
{  
"element\_raw\_1": "1213",  
"element\_raw\_0": "11",  
"segmentId": "SE",  
"segmentIndex": 12,  
"element\_1": "1213",  
"element\_0": "11"  
},  
{  
"element\_raw\_1": "1213",  
"element\_raw\_0": "1",  
"segmentId": "GE",  
"segmentIndex": 13,  
"element\_1": "1213",  
"element\_0": "1"  
},  
{  
"element\_raw\_1": "000001217",  
"element\_raw\_0": "1",  
"segmentId": "IEA",  
"segmentIndex": 14,  
"element\_1": "000001217",  
"element\_0": "1"  
}  
]

---

<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 19, 2019, 7:24am UTC](https://discuss.elastic.co/t/how-to-filter-the-results-and-show-certain-array-from-the-list/195542/2 "2019-08-19T07:24:37Z")

</div>

check out the [inner\_hits feature](https://www.elastic.co/guide/en/elasticsearch/reference/7.3/search-request-body.html#nested-inner-hits) of the nested datatype.

---

<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 16, 2019, 7:24am UTC](https://discuss.elastic.co/t/how-to-filter-the-results-and-show-certain-array-from-the-list/195542/3 "2019-09-16T07:24:41Z")

</div>

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