Hi all,
I have a use case where I have to run two elastic search Queries which are paginated, have a sorting criteria, but the number of results are same, I would like to know if there is a possibility to UNION both queries, besides doing it my self by iterating results of both the queries at application end.
Sample Type definition :
{
"lineNo": 4,
"x1": 1556,
"x2": 1758,
"snippetText": "This is my text",
}
x1 and x2 are numric values per line, there are multiple documents with same lineNo and multiple x1, x2 values
what I want is a list of relative x1 sorted by x1 and line number
list of relative x2 sorted by x2 and line number
My Current Queries are:
{
"size": 192,
"query": {
"filtered": {
"filter": {
"range": {
"x1": {
"gt": 0
}
}
}
}
},
"track_scores": true,
"sort": {
"x1": {
"order": "asc"
},
"lineNo": {
"order": "asc"
}
}
}
{
"size": 192,
"query": {
"filtered": {
"filter": {
"range": {
"x2": {
"gt": 0
}
}
}
}
},
"track_scores": true,
"sort": {
"x2": {
"order": "asc"
},
"lineNo": {
"order": "asc"
}
}
}
Both Queries work fine separately, I just want to run them in single request, resulting in a single hits[] object.