Group result by query which returned them


(Venkata Sreekanth Bhagavatula) #1

For a query like the one below, is there a way to identify which bool actually resulted in the result

GET /_search
{
"query": {
"bool": {
"should": [
{ "match": {
"title": {
"query": "War and Peace",
"boost": 2
}}},
{ "match": {
"author": {
"query": "Leo Tolstoy",
"boost": 2
}}},
{ "bool": {
"should": [
{ "match": { "translator": "Constance Garnett" }},
{ "match": { "translator": "Louise Maude" }}
]
}}
]
}
}
}


(Xavier Facq) #2

To my mind, I would say not, it's not possible. If you really need this information, you can run a multiget with one "should" per query.


(Mark Harwood) #3

See https://www.elastic.co/guide/en/elasticsearch/reference/5.2/search-request-named-queries-and-filters.html


(Venkata Sreekanth Bhagavatula) #4

looks like you are right


(system) #5

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.