# Elastic search with retreving 1st element of array

**URL:** <https://discuss.elastic.co/t/elastic-search-with-retreving-1st-element-of-array/52456>\
**Category:** Elasticsearch\
**Created:** [June 10, 2016, 3:26pm UTC](https://discuss.elastic.co/t/elastic-search-with-retreving-1st-element-of-array/52456 "2016-06-10T15:26:11Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Fryder](https://avatars.discourse-cdn.com/v4/letter/f/76d3ee/32.png) [@Fryder](https://discuss.elastic.co/u/Fryder)\
**Post date:** [June 10, 2016, 3:26pm UTC](https://discuss.elastic.co/t/elastic-search-with-retreving-1st-element-of-array/52456/1 "2016-06-10T15:26:11Z")

</div>

hello all, my current problem with search criteria is as below  
data:- person{  
name...bunch of props  
cards:[  
amexcostco:[nbr:123456789  
nbr:xxxxx89]  
]  
}

is there anyway i can search based on a criteria and just retrieve masked property every time unless specifically asked for?

i mean i should get all persons that match a property(match query) and retrieve all cards but each card result get nbr-attribute's 2nd property(plz note the nbr field's name is same for masked and unmasked values)

result: person:{props.... cards:[amexcostco:[nbr:xxxxxx],amexmacy:[nbr:xxxx]]

---

<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 5, 2017, 10:44pm UTC](https://discuss.elastic.co/t/elastic-search-with-retreving-1st-element-of-array/52456/2 "2017-07-05T22:44:41Z")

</div>

Closed on July 5, 2017, 10:44pm UTC


