# Pull only fields with given value

**URL:** <https://discuss.elastic.co/t/pull-only-fields-with-given-value/22710>\
**Category:** Elasticsearch\
**Created:** [March 17, 2015, 2:11pm UTC](https://discuss.elastic.co/t/pull-only-fields-with-given-value/22710 "2015-03-17T14:11:15Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Adrian\_M](https://avatars.discourse-cdn.com/v4/letter/a/bbce88/32.png) [@Adrian\_M](https://discuss.elastic.co/u/Adrian_M)\
**Post date:** [March 17, 2015, 2:11pm UTC](https://discuss.elastic.co/t/pull-only-fields-with-given-value/22710/1 "2015-03-17T14:11:15Z")

</div>

I have a JSON like this for a document

\_source: {  
timestamp: 213234234,  
links: [ {  
mention: "audi",  
entity: {rank:3, name:"some name"}  
}, {  
mention: "ford",  
entity: {rank:0, name:"some other name"},  
}  
]  
}  
}

I'm interested in retrieving only the mention and rank fields where  
rank==0.  
I am able to specify which fields I want using "fields" like this  
"fields":["timestamp","links.mention","links.entity.rank"] and I can even  
filter (query {filtered { query { term { links.entity.rank = 0 }}}} ) so  
that it returns only documents that have rank=0

Such a query returns all fields I mention and all the objects in the links  
array.

\_source: {  
timestamp: [213234234],  
links.mention: ["audi", "ford"],  
links.entity.rank: [3, 0]  
}  
}

I don't want to have 3 in links.entity.rank. Is there a way to re filter  
the result of a query?

--  
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/e9cdf199-f8f0-4fcc-8642-ef7a1f4eab58%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/e9cdf199-f8f0-4fcc-8642-ef7a1f4eab58%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<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, 12:26am UTC](https://discuss.elastic.co/t/pull-only-fields-with-given-value/22710/2 "2017-07-06T00:26:14Z")

</div>

Closed on July 6, 2017, 12:26am UTC


