Can you please try "queryString": "sample AND (Path:https://contoso.sharepoint.com/sites/sitename1 OR Path:https://contoso.sharepoint.com/sites/sitename2)" in queryString to get the files.
Option 1-
Below is the sample request:
POST /search/query
{
"requests": [
{
"entityTypes": [
"driveItem"
],
"query": {
"queryString": "sample AND (Path:https://contoso.sharepoint.com/sites/sitename1 OR Path:https://contoso.sharepoint.com/sites/sitename2)"
}
}
]
}
Documentation reference- https://learn.microsoft.com/en-us/graph/search-concept-files#example-5-use-filters-in-search-queries
Option 2-
Below is the sample request:
POST/search/query
{
"requests": [
{
"entityTypes": [
"driveItem"
],
"query": {
"queryString": "may AND (SiteId:a6424d2a-39c1-471d-af44-5b65d1611889 OR SiteId:e3a2252f-d91d-4c03-a670-682e77bbe8ba)"
}
}
]
}
Please use Site Collection unique ID (GUID) in queryString to get the files.
Documentation reference-https://learn.microsoft.com/en-us/graph/api/resources/site?view=graph-rest-1.0#id-property
Hope this helps.
If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have further questions about this answer, please click "Comment".