java - Elastic Search: Combining multiple search results -


i have tricky case dont know how solve.

i have 2 queries: q1 , q2 2 queries result in r1 , r2

each of results sorted in special order.

as overall search result want return concatenation of r1+r2 before returning application.

the reason break pagination if later.

any idea? probalby easy question stuck on this...

ps:

we experimented sorting first priary sort criteria , score.. score breaks first sort criteria somehow cant score working within bucket.

you can boost fruits factor, score higher vegetable score, yet preserving order. can simple weight function score query

put /test  post /test/fruits/1 {     "field": "hello world" }  post /test/fruits/2 {     "field":"hello" }  post /test/veges/1 {     "field": "hello world" }  post /test/veges/2 {     "field":"hello" }  post /test/_search {      "query": {          "function_score": {             "query": {                 "match": {                    "field": "hello"                 }                },             "functions": [                 {                     "filter": {                         "type": {                            "value": "fruits"                         }                     },                     "weight": 2                 }             ]         }     } } 

however please note if on big database resource consuming page down first vegetable. consider rebuilding ux fruits , vegetables separate requests. can _bulk endpoint , send 2 separate queries per each document type in 1 server api call, , return both results back.


Comments

Popular posts from this blog

How has firefox/gecko HTML+CSS rendering changed in version 38? -

javascript - Complex json ng-repeat -

jquery - Cloning of rows and columns from the old table into the new with colSpan and rowSpan -