# Query : Use of Union feature in elastic search

**URL:** <https://discuss.elastic.co/t/query-use-of-union-feature-in-elastic-search/10707>\
**Category:** Elasticsearch\
**Created:** [February 12, 2013, 5:26am UTC](https://discuss.elastic.co/t/query-use-of-union-feature-in-elastic-search/10707 "2013-02-12T05:26:54Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![mohit\_Kumar](https://avatars.discourse-cdn.com/v4/letter/m/c89c15/32.png) [@mohit\_Kumar](https://discuss.elastic.co/u/mohit_Kumar)\
**Post date:** [February 12, 2013, 5:26am UTC](https://discuss.elastic.co/t/query-use-of-union-feature-in-elastic-search/10707/1 "2013-02-12T05:26:54Z")

</div>

Hello Folks,  
How to union the result of two or more query . Elastic search query.  
I used following Dis Max Query for union  
curl -XGET '[http://localhost:9200/new\_index/n](http://localhost:9200/new_index/n)  
ew\_indext/\_search?size=2' -d'{"query":{

> ```
> "dis_max" : {
> "tie_breaker" : 0.7,
> "queries" : [
> {
> "term" : { "MsgData" : "Aeropostale)" }
> },
> {
> "term" : { "MsgData" : "ebook" }
> }
> ]
> }
> 
> ```
> 
> }  
> }'

expected output: both aeropostale and ebook  
output rcieved from this query : only ebook.  
can you please help me where I am doing wrong.

thanks and regards  
Mohit Kumar Yadav

--  
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).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![sujoysett](https://avatars.discourse-cdn.com/v4/letter/s/2acd7d/32.png) [@sujoysett](https://discuss.elastic.co/u/sujoysett)\
**Post date:** [February 12, 2013, 5:38am UTC](https://discuss.elastic.co/t/query-use-of-union-feature-in-elastic-search/10707/2 "2013-02-12T05:38:11Z")

</div>

Use bool query.

> **[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 Tuesday, February 12, 2013 10:56:54 AM UTC+5:30, Mohit Kumar Yadav wrote:

> Hello Folks,  
> How to union the result of two or more query . Elastic search query.  
> I used following Dis Max Query for union  
> curl -XGET '[http://localhost:9200/new\_index/n](http://localhost:9200/new_index/n)  
> ew\_indext/\_search?size=2' -d'{"query":{
> 
> > ```
> > "dis_max" : {
> > "tie_breaker" : 0.7,
> > "queries" : [
> > {
> > "term" : { "MsgData" : "Aeropostale)" }
> > },
> > {
> > "term" : { "MsgData" : "ebook" }
> > }
> > ]
> > }
> > 
> > ```
> > 
> > }  
> > }'
> 
> expected output: both aeropostale and ebook  
> output rcieved from this query : only ebook.  
> can you please help me where I am doing wrong.
> 
> thanks and regards  
> Mohit Kumar Yadav

--  
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).  
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, 2:51am UTC](https://discuss.elastic.co/t/query-use-of-union-feature-in-elastic-search/10707/3 "2017-07-06T02:51:58Z")

</div>


