# Mapreduce with filter script?

**URL:** <https://discuss.elastic.co/t/mapreduce-with-filter-script/22386>\
**Category:** Elasticsearch\
**Created:** [February 25, 2015, 2:50pm UTC](https://discuss.elastic.co/t/mapreduce-with-filter-script/22386 "2015-02-25T14:50:19Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![bryan\_rasmussen](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/bryan_rasmussen/32/874_2.png) [@bryan\_rasmussen](https://discuss.elastic.co/u/bryan_rasmussen)\
**Post date:** [February 25, 2015, 2:50pm UTC](https://discuss.elastic.co/t/mapreduce-with-filter-script/22386/1 "2015-02-25T14:50:19Z")

</div>

Hi,

I would like to get a script to work like mapreduce over the results of my  
query, so that if I have a query that returns 4 documents  
{  
brands: "brand1"  
},  
{  
brands: "brand2"  
},  
{  
brands: "brand2"  
},  
{  
brands: "brand3"  
}

and what I want to come out is the documents

{  
brands: "brand1"  
},  
{  
brands: "brand2"  
},  
{  
brands: "brand3"  
}

of course this is a very simplified example, and the query I am doing is  
not on the brands field but it is the brands field I want to reduce / get  
rid of duplicates.

thanks,  
Bryan Rasmussen

--  
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/f5ed9d72-8fe2-44f2-a485-7ac87cfca4df%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/f5ed9d72-8fe2-44f2-a485-7ac87cfca4df%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![javadevmtl](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/javadevmtl/32/45613_2.png) [@javadevmtl](https://discuss.elastic.co/u/javadevmtl)\
**Post date:** [February 25, 2015, 3:44pm UTC](https://discuss.elastic.co/t/mapreduce-with-filter-script/22386/2 "2015-02-25T15:44:11Z")

</div>

So do an agreggation on term = brand?

> **[Elasticsearch Platform — Find real-time answers at scale](https://www.elastic.co)**
>
> Power insights and outcomes with the Elasticsearch Platform and AI. See into your data and find answers that matter with enterprise solutions designed to help you build, observe, and protect. Try Elasticsearch free today.

On Wednesday, 25 February 2015 09:50:19 UTC-5, bryan rasmussen wrote:

> Hi,
> 
> I would like to get a script to work like mapreduce over the results of my  
> query, so that if I have a query that returns 4 documents  
> {  
> brands: "brand1"  
> },  
> {  
> brands: "brand2"  
> },  
> {  
> brands: "brand2"  
> },  
> {  
> brands: "brand3"  
> }
> 
> and what I want to come out is the documents
> 
> {  
> brands: "brand1"  
> },  
> {  
> brands: "brand2"  
> },  
> {  
> brands: "brand3"  
> }
> 
> of course this is a very simplified example, and the query I am doing is  
> not on the brands field but it is the brands field I want to reduce / get  
> rid of duplicates.
> 
> thanks,  
> Bryan Rasmussen

--  
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/d8962c18-124d-4e4c-a01e-8bca6911ec8a%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/d8962c18-124d-4e4c-a01e-8bca6911ec8a%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:30am UTC](https://discuss.elastic.co/t/mapreduce-with-filter-script/22386/3 "2017-07-06T00:30:09Z")

</div>

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


