I have a few hundred sharepoint sites. I want to search only a few of them for files of extension 'fmp12'. After a lot of trial and error I found a KQL query that searchs for such files:
{
"requests": [
{
"entityTypes": [
"driveItem"
],
"query": {
"queryString": "FileType:fmp12"
},
"region": "EMEA"
}
]
}
(I need the region since I'm using an application account)
When I run this query I get matches from all sites. How can I change the query so that it returns items only from those specific sites, or from one site?
If you need to reduce searching to one specific site, it can be achieved by adding site
keyword to the queryString
{
"requests": [
{
"entityTypes": [
"driveItem"
],
"query": {
"queryString": "FileType:fmp12 AND site:\"https://tenant.sharepoint.com/sites/{site_name}\""
},
"region": "EMEA"
}
]
}
For more sites, use OR
"queryString": "FileType:fmp12 AND (site:\"https://tenant.sharepoint.com/sites/{site1_name}\" OR site:\"https://tenant.sharepoint.com/sites/{site2_name}\")"