# Getting specific Fields

**URL:** https://discuss.elastic.co/t/getting-specific-fields/15077
**Category:** Elasticsearch
**Created:** [January 2, 2014, 12:27pm UTC](https://discuss.elastic.co/t/getting-specific-fields/15077 "2014-01-02T12:27:38Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![paul1](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/paul1/32/46819_2.png) [@paul1](https://discuss.elastic.co/u/paul1)
#### Post date: [January 2, 2014, 12:27pm UTC](https://discuss.elastic.co/t/getting-specific-fields/15077/1 "2014-01-02T12:27:38Z")

</div>

## My DATA

{  
"rankingList":[  
{  
"value":9,  
"key":"Academic"  
},  
{  
"value":6,  
"key":"Flexibility"  
}  
]  
}

{  
"rankingList":[  
{  
"value":12,  
"key":"Academic"  
},  
{  
"value":6,  
"key":"Flexibility"  
}  
]  
}

## My Mapping

{  
"mappings":{  
"TestNested":{  
"properties":{  
"rankingList":{  
"type":"nested"  
}  
}  
}  
}  
}

## My QUERY

{  
"query": {  
"nested": {  
"path": "rankingList",  
"query": {  
"bool": {  
"must": [  
{  
"match": {  
"rankingList.key": {  
"query": "Academic"  
}  
}  
},  
{  
"range": {  
"rankingList.value": {  
"gt": 5  
}  
}  
}  
]  
}  
}  
}  
}  
}

I want to get only the key value that is related to "Academic" within the  
array is it possible. right now query works fine but returns all the array  
elements.

- Paul

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/6f5c2cd1-a92e-4c8c-8bd3-ca8193033080%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/6f5c2cd1-a92e-4c8c-8bd3-ca8193033080%40googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

### Author: ![Ivan](https://avatars.discourse-cdn.com/v4/letter/i/df788c/32.png) [@Ivan](https://discuss.elastic.co/u/Ivan)
#### Post date: [January 2, 2014, 7:30pm UTC](https://discuss.elastic.co/t/getting-specific-fields/15077/2 "2014-01-02T19:30:58Z")

</div>

Not yet supported:

> <https://github.com/elastic/elasticsearch/issues/3022>
>
> Add support for including the matching nested inner objects per hit element.

Cheers,

Ivan

On Thu, Jan 2, 2014 at 4:27 AM, paul [avinashpaul85@gmail.com](mailto:avinashpaul85@gmail.com) wrote:

> ## My DATA
> 
> {  
> "rankingList":[  
> {  
> "value":9,  
> "key":"Academic"  
> },  
> {  
> "value":6,  
> "key":"Flexibility"  
> }  
> ]  
> }
> 
> {  
> "rankingList":[  
> {  
> "value":12,  
> "key":"Academic"  
> },  
> {  
> "value":6,  
> "key":"Flexibility"  
> }  
> ]  
> }
> 
> ## My Mapping
> 
> {  
> "mappings":{  
> "TestNested":{  
> "properties":{  
> "rankingList":{  
> "type":"nested"  
> }  
> }  
> }  
> }  
> }
> 
> ## My QUERY
> 
> {  
> "query": {  
> "nested": {  
> "path": "rankingList",  
> "query": {  
> "bool": {  
> "must": [  
> {  
> "match": {  
> "rankingList.key": {  
> "query": "Academic"  
> }  
> }  
> },  
> {  
> "range": {  
> "rankingList.value": {  
> "gt": 5  
> }  
> }  
> }  
> ]  
> }  
> }  
> }  
> }  
> }
> 
> I want to get only the key value that is related to "Academic" within the  
> array is it possible. right now query works fine but returns all the array  
> elements.
> 
> - Paul
> 
> --  
> You received this message because you are subscribed to the Google Groups  
> "elasticsearch" group.  
> To unsubscribe from this group and stop receiving emails from it, send an  
> email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> To view this discussion on the web visit  
> [https://groups.google.com/d/msgid/elasticsearch/6f5c2cd1-a92e-4c8c-8bd3-ca8193033080%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/6f5c2cd1-a92e-4c8c-8bd3-ca8193033080%40googlegroups.com)  
> .  
> For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQDqTQy6iVe\_%3DgSQowUE-Gh5Ug%2Bn2b\_Jn2CsDeRN3GwGKA%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQDqTQy6iVe_%3DgSQowUE-Gh5Ug%2Bn2b_Jn2CsDeRN3GwGKA%40mail.gmail.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

### Author: ![paul1](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/paul1/32/46819_2.png) [@paul1](https://discuss.elastic.co/u/paul1)
#### Post date: [January 3, 2014, 8:45am UTC](https://discuss.elastic.co/t/getting-specific-fields/15077/3 "2014-01-03T08:45:01Z")

</div>

Thank you for the quick response.

On Fri, Jan 3, 2014 at 1:00 AM, Ivan Brusic [ivan@brusic.com](mailto:ivan@brusic.com) wrote:

> Not yet supported:  
> [https://github.com/elasticsearch/elasticsearch/issues/3022](https://github.com/elasticsearch/elasticsearch/issues/3022)
> 
> Cheers,
> 
> Ivan
> 
> On Thu, Jan 2, 2014 at 4:27 AM, paul [avinashpaul85@gmail.com](mailto:avinashpaul85@gmail.com) wrote:
> 
> > ## My DATA
> > 
> > {  
> > "rankingList":[  
> > {  
> > "value":9,  
> > "key":"Academic"  
> > },  
> > {  
> > "value":6,  
> > "key":"Flexibility"  
> > }  
> > ]  
> > }
> > 
> > {  
> > "rankingList":[  
> > {  
> > "value":12,  
> > "key":"Academic"  
> > },  
> > {  
> > "value":6,  
> > "key":"Flexibility"  
> > }  
> > ]  
> > }
> > 
> > ## My Mapping
> > 
> > {  
> > "mappings":{  
> > "TestNested":{  
> > "properties":{  
> > "rankingList":{  
> > "type":"nested"  
> > }  
> > }  
> > }  
> > }  
> > }
> > 
> > ## My QUERY
> > 
> > {  
> > "query": {  
> > "nested": {  
> > "path": "rankingList",  
> > "query": {  
> > "bool": {  
> > "must": [  
> > {  
> > "match": {  
> > "rankingList.key": {  
> > "query": "Academic"  
> > }  
> > }  
> > },  
> > {  
> > "range": {  
> > "rankingList.value": {  
> > "gt": 5  
> > }  
> > }  
> > }  
> > ]  
> > }  
> > }  
> > }  
> > }  
> > }
> > 
> > I want to get only the key value that is related to "Academic" within the  
> > array is it possible. right now query works fine but returns all the array  
> > elements.
> > 
> > - Paul
> > 
> > --  
> > You received this message because you are subscribed to the Google Groups  
> > "elasticsearch" group.  
> > To unsubscribe from this group and stop receiving emails from it, send an  
> > email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).
> > 
> > To view this discussion on the web visit  
> > [https://groups.google.com/d/msgid/elasticsearch/6f5c2cd1-a92e-4c8c-8bd3-ca8193033080%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/6f5c2cd1-a92e-4c8c-8bd3-ca8193033080%40googlegroups.com)  
> > .  
> > For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).
> 
> --  
> You received this message because you are subscribed to a topic in the  
> Google Groups "elasticsearch" group.  
> To unsubscribe from this topic, visit  
> [https://groups.google.com/d/topic/elasticsearch/t6ebGDRVR3g/unsubscribe](https://groups.google.com/d/topic/elasticsearch/t6ebGDRVR3g/unsubscribe).  
> To unsubscribe from this group and all its topics, send an email to  
> [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> To view this discussion on the web visit  
> [https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQDqTQy6iVe\_%3DgSQowUE-Gh5Ug%2Bn2b\_Jn2CsDeRN3GwGKA%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CALY%3DcQDqTQy6iVe_%3DgSQowUE-Gh5Ug%2Bn2b_Jn2CsDeRN3GwGKA%40mail.gmail.com)  
> .
> 
> For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/CAO066G38R6iHcp7VHO-9T%3DtV0QtZoCxjPmYeP1-Ps2PLUsaojQ%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAO066G38R6iHcp7VHO-9T%3DtV0QtZoCxjPmYeP1-Ps2PLUsaojQ%40mail.gmail.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<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:58am UTC](https://discuss.elastic.co/t/getting-specific-fields/15077/4 "2017-07-06T01:58:33Z")

</div>


