Group result by query which returned them

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" }}
]
}}
]
}
}
}

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.

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

1 Like

looks like you are right

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