FTS Multi collections Conjunction Query

Hi,
I have two collections of same scope and created a multicollection index. CollectionA has userInfo and collectionB has user type. Is it possible to do a Conjunction between these collections.? example {
“conjuncts”:[
{“field”:“userName”, “match”: “userOne”},–> field in collectionA
{“field”:“userType”, “match”: “type1”} → field in collectionB
]
}
Thanks

No, the search engine by itself will not support this even though we allow ingesting fields from multiple collections within a scope in 7.0+ indexes - because note that the documents from each of the collections are not the same. Couchbase search will only support compound operations such as intersections and unions on fields within a single document, because all results are document hits tied to the collection where they reside.

For what you’re trying to achieve - you should be able to use SQL++ over the same search index which treats each collection within the index as a separate keyspace.

Here’s a query that’d work once you set up the search index -

select meta().id from `bucket`.`scope`.`collectionB` as x
WHERE search(x, {"query": {"field":"userType", "match": "type1"}})
INTERSECT select meta().id from `bucket`.`scope`.`collectionA` as y
WHERE search(y, {"query": {"field":"userName", "match": "userOne"}})