You can use named queries and then in the results you'll get the name of the query that matched.
{
"query": {
"bool": {
"should": [
{"multi_match": {
"fields": ["field1", "field2"],
"query": self.cleaned_stemmed_phrase,
"type": "phrase",
"fuzziness":"AUTO",
add name ---> "_name": "query1"
}},
{"multi_match": {
"fields": ["field3"],
"query": self.cleaned_stemmed_phrase,
"fuzziness":"AUTO",
"boost": 4,
add name ---> "_name": "query2"
}},
{"multi_match": {
"fields": ["field4"],
"query": self.cleaned_stemmed_phrase,
"fuzziness":"AUTO",
add name ---> "_name": "query3"
}},
{"multi_match": {
"fields": ["field5", "filed6"],
"query": self.spaces_removed,
"fuzziness":"AUTO",
add name ---> "_name": "query4"
}},
{"multi_match": {
"fields": ["field7", "field8"],
"query": self.no_space_stems,
"fuzziness":"AUTO",
add name ---> "_name": "query5"
}}
]
}
}
}
Then in the results you'll get a matched_queries
array with the name of the query/ies that matched the document.
"_source": {
...
},
"matched_queries": [
"title_query"
],
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…