How to get the intersection of the search results of a multi-search in App-search?

Query:
"queries": [
{
"search_fields": {
"fruit_name": {}
},
"query": "apples"
},
{
"search_fields": {
"type": {}
},
"query": "gala"
}
]

Result:

[
{
"results": [
{
"fruit_id": {
"raw": "9"
},
"fruit_name": {
"raw": "apple"
},
"type": {
"raw": "gala"
}
"id": {
"raw": "9"
}
},
{
"fruit_id": {
"raw": "1"
},
"fruit_name": {
"raw": "apple"
},
"type": {
"raw": "red"
}
"id": {
"raw": "1"
}
}
]
},

{
"results": [
{
"fruit_id": {
"raw": "9"
},
"fruit_name": {
"raw": "apple"
},
"type": {
"raw": "gala"
}
"id": {
"raw": "9"
}
},
{
"fruit_id": {
"raw": "10"
},
"festival_name": {
"raw": "festival"
},
"type": {
"raw": "gala"
}
"id": {
"raw": "10"
}
}
]
}
]

Is there any way to get the common result from both the result sets??

Hey @teja_sri.

To my knowledge, these queries are entirely separate. There is no way to get the intersection automatically, this is something you'd need to do programmatically on the response.

What is your use case for having multiple queries like this? I'm wondering if there's a way to achieve what you are trying to do with a single query and some filtering.

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