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


(yyh3011) #1

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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/cbb1c318-2ca5-4519-9408-f882732f04c5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


(Binh Ly-2) #2

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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/e3ad3013-50e4-4d65-8c3d-d940d728a59f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


(system) #3