How to index specific document libraries in SharePoint using Azure AI Search

08382095 65 Reputation points
2024-01-31T07:42:11.3166667+00:00

Hi, I have been trying to index SharePoint data using Azure AI search. I am following https://learn.microsoft.com/en-us/azure/search/search-howto-index-sharepoint-online documentation. I have a requirement to index specific document libraries but not all of them in a SharePoint site. In the https://learn.microsoft.com/en-us/azure/search/search-howto-index-sharepoint-online#controlling-which-documents-are-indexed documentation, we have useQuery parameter to index all site libraries or single document library but I couldn't get anything about indexing multiple site libraries. Please assist me with the issue. Thank you!

Azure AI Search
Azure AI Search
An Azure search service with built-in artificial intelligence capabilities that enrich information to help identify and explore relevant content at scale.
1,339 questions
Microsoft 365 and Office SharePoint For business Windows
0 comments No comments
{count} votes

Accepted answer
  1. Grmacjon-MSFT 19,151 Reputation points Moderator
    2024-02-01T21:23:17.7133333+00:00

    Hi @08382095
    To index specific document libraries, you can use the useQuery parameter in the search indexing pipeline. The useQuery parameter allows you to specify a KQL query that filters the documents to be indexed. Here’s an example of how you can use the useQuery parameter to index multiple document libraries:

    {
      "name": "indexer-name",
      "dataSourceName": "datasource-name",
      "targetIndexName": "index-name",
      "parameters": {
        "configuration": {
          "useQuery": "path:\"https://your-sharepoint-site.sharepoint.com/sites/your-site-name/DocumentLibrary1\" OR path:\"https://your-sharepoint-site.sharepoint.com/sites/your-site-name/DocumentLibrary2\""
        }
      }
    }
    

    In the above example, the useQuery parameter specifies a KQL query that filters documents based on the path of the document library. You can modify the query to include the paths of the document libraries that you want to index -Grace


0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.