# Alternative approaches to query - Part II

**URL:** <https://discuss.elastic.co/t/alternative-approaches-to-query-part-ii/3325>\
**Category:** Elasticsearch\
**Created:** [September 12, 2010, 8:40pm UTC](https://discuss.elastic.co/t/alternative-approaches-to-query-part-ii/3325 "2010-09-12T20:40:06Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![James\_Cook](https://avatars.discourse-cdn.com/v4/letter/j/898d66/32.png) [@James\_Cook](https://discuss.elastic.co/u/James_Cook)\
**Post date:** [September 12, 2010, 8:40pm UTC](https://discuss.elastic.co/t/alternative-approaches-to-query-part-ii/3325/1 "2010-09-12T20:40:06Z")

</div>

Suppose I am indexing a collection of movie subtitle translations, where  
each document is a translation with properties to show the language and the  
movie it represents. Some subtitles exist where the locale might be "fr\_CA"  
or "fr\_FR" to indicate the difference between French Canada and French  
European. A search term of 'fr' needs to match both 'fr\_CA' and 'fr\_FR'.

My use case is I want to query for a top five list by locale. For example,  
the five most recently added films with french subtitles.

A not-so-nice approach to the problem is performing a query to fetch a  
larger number of subtitles than needed and aggregate the result set based on  
the film id property. This isn't very good on several fronts.

curl -XPOST '[http://localhost:9200/movies/subtitles/\_search](http://localhost:9200/movies/subtitles/_search)' -d '  
{  
"from" : 0,  
"size" : 10,  
"query" : {  
"term" : {  
"locale": "fr"  
}  
}  
}'

Creating a movie's index with a child collection of subtitles is another  
approach, but assume the indexing is by subtitle document alone.

Is there some other techniques or projection capability to assist in these  
types of aggregated queries?

---

<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, 4:19am UTC](https://discuss.elastic.co/t/alternative-approaches-to-query-part-ii/3325/2 "2017-07-06T04:19:26Z")

</div>

Closed on July 6, 2017, 4:19am UTC


