# Filtered query with nested filter

**URL:** <https://discuss.elastic.co/t/filtered-query-with-nested-filter/18556>\
**Category:** Elasticsearch\
**Created:** [July 9, 2014, 11:45am UTC](https://discuss.elastic.co/t/filtered-query-with-nested-filter/18556 "2014-07-09T11:45:30Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Michal\_Dabrowski](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/michal_dabrowski/32/1418_2.png) [@Michal\_Dabrowski](https://discuss.elastic.co/u/Michal_Dabrowski)\
**Post date:** [July 9, 2014, 11:45am UTC](https://discuss.elastic.co/t/filtered-query-with-nested-filter/18556/1 "2014-07-09T11:45:30Z")

</div>

Hello,  
i have a question. I have structure which is like:  
events:  
mappings:  
id: { type: integer }  
categoryId: { type: integer }  
countryId: { type: integer }  
cityId: { type: integer }  
active: { type: boolean }  
translations:  
type: "nested"  
properties:  
title: { type: string, boost: 5,  
analyzer: autocomplete }  
description: { type: string, boost: 4 }  
what: { type: string, boost: 3 }  
whenText: { type: string, boost: 3 }  
whereText: { type: string, boost: 3 }  
info: { type: string, boost: 2 }  
locale: { type: string }

And i query like this:  
{  
"query": {  
"filtered": {  
"query": {  
"query\_string": {  
"query": "attente",  
"default\_operator": "OR"  
}  
},  
"filter": {  
"and": [  
{  
"term": {  
"active": true  
}  
},  
{  
"nested": {  
"path": "dates",  
"filter": {  
"range": {  
"dates.datetime": {  
"from": "2014-07-09",  
"to": "2015-07-09"  
}  
}  
},  
"\_cache": true  
}  
}  
]  
}  
}  
},  
"facets": {  
"category": {  
"terms": {  
"field": "categoryId",  
"size": 10000  
}  
},  
"country": {  
"terms": {  
"field": "countryId",  
"size": 10000  
}  
},  
"city": {  
"terms": {  
"field": "venue.city.id",  
"size": 10000  
},  
"nested": "venue.city"  
}  
}  
}

This search query yet searches though all translations. How can i limit  
that query to return nested translations only when locale is en|it etc?

--  
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/ffb6cd4a-4165-45fe-aead-e05d32439c11%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/ffb6cd4a-4165-45fe-aead-e05d32439c11%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, 1:17am UTC](https://discuss.elastic.co/t/filtered-query-with-nested-filter/18556/2 "2017-07-06T01:17:01Z")

</div>


