# How to merge the result after multi search, then I can sort them like sorting in queryDSL?

**URL:** <https://discuss.elastic.co/t/how-to-merge-the-result-after-multi-search-then-i-can-sort-them-like-sorting-in-querydsl/17019>\
**Category:** Elasticsearch\
**Created:** [April 15, 2014, 8:15am UTC](https://discuss.elastic.co/t/how-to-merge-the-result-after-multi-search-then-i-can-sort-them-like-sorting-in-querydsl/17019 "2014-04-15T08:15:01Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![yyh3011](https://avatars.discourse-cdn.com/v4/letter/y/6de8d8/32.png) [@yyh3011](https://discuss.elastic.co/u/yyh3011)\
**Post date:** [April 15, 2014, 8:15am UTC](https://discuss.elastic.co/t/how-to-merge-the-result-after-multi-search-then-i-can-sort-them-like-sorting-in-querydsl/17019/1 "2014-04-15T08:15:01Z")

</div>

I have a multi search like:

{"index" : "news"}  
{"query":{ "bool":{ "must":[{ "more\_like\_this\_field" : { "content"  
:{"like\_text" : "James", "min\_term\_freq":1, "max\_query\_terms" : 12}} }, {  
"match":{"topic":"Business"} }] }}, "from" : 0, "size" : 4}  
{"index" : "news"}  
{"query":{ "bool":{ "must":[{ "more\_like\_this\_field" : { "content"  
:{"like\_text" : "James", "min\_term\_freq":1, "max\_query\_terms" : 12}} }, {  
"match":{"topic":"Sport"} }] }}, "from" : 0, "size" : 2}

but the result is an array, I expect I can merge them, and sort them by  
date and \_score, is there a best way to do this?  
Can I sort them like in ES, adding " "sort" : [ { "date" : {"order" :  
"desc"} }]" ?

thanks  
johnson

--  
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/cbb1c318-2ca5-4519-9408-f882732f04c5%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/cbb1c318-2ca5-4519-9408-f882732f04c5%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![Binh\_Ly\_2](https://avatars.discourse-cdn.com/v4/letter/b/d07c76/32.png) [@Binh\_Ly\_2](https://discuss.elastic.co/u/Binh_Ly_2)\
**Post date:** [April 16, 2014, 5:32pm UTC](https://discuss.elastic.co/t/how-to-merge-the-result-after-multi-search-then-i-can-sort-them-like-sorting-in-querydsl/17019/2 "2014-04-16T17:32:54Z")

</div>

Unfortunately not at the moment, each result is independent and you'll need  
to "merge" them yourself if necessary. However, I don't know it this helps,  
but you definitely can search multiple indexes/types in 1 search call, if  
it helps.

--  
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/e3ad3013-50e4-4d65-8c3d-d940d728a59f%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/e3ad3013-50e4-4d65-8c3d-d940d728a59f%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:35am UTC](https://discuss.elastic.co/t/how-to-merge-the-result-after-multi-search-then-i-can-sort-them-like-sorting-in-querydsl/17019/3 "2017-07-06T01:35:26Z")

</div>


