Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Note
Foundry IQ (Azure AI Search) provides direct indexing and query APIs alongside higher-level knowledge source and knowledge base APIs for managed retrieval. Use the Azure portal, REST APIs, or Azure SDKs to configure these capabilities, or connect agents to knowledge bases in the Microsoft Foundry portal.
This article explains how to filter list results by name prefix and how server-side paging works. It demonstrates both by listing the indexes in a multitenant application.
List operations in the 2026-10-01 and 2026-11-01-preview REST APIs use server-side paging, also known as cursor pagination. Use search to filter a list by name prefix and pageSize to set the number of results you want in each page.
When more results are available, the response includes a continuation URL. The continuation token in that URL tells the service where to resume. To scroll through the full list, follow each continuation URL until a response omits it.
The REST examples use 2026-10-01. The C# and Python examples use 2026-08-01-preview and preview SDK packages.
Prerequisites
A Foundry IQ (Azure AI Search) service that contains objects for one of the supported list operations.
Permission to list objects on the service. Configure keyless authentication with the Search Service Contributor role assigned to your user account (recommended) or use an admin API key.
The latest
Azure.Search.Documentspreview package:dotnet add package Azure.Search.Documents --prereleaseFor keyless authentication, the
Azure.Identitypackage:dotnet add package Azure.IdentityNote
The client library must support the
2026-10-01or2026-08-01-previewversion of the Search Service REST API. Versions earlier than2026-08-01-previewignore the filter and paging parameters shown in this article.
The latest
azure-search-documentspreview package:pip install --pre azure-search-documentsFor keyless authentication, the
azure-identitypackage:pip install azure-identityNote
The client library must support the
2026-10-01or2026-08-01-previewversion of the Search Service REST API. Versions earlier than2026-08-01-previewignore the filter and paging parameters shown in this article.
The 2026-10-01 version of the Search Service REST API.
For keyless authentication, include a Microsoft Entra ID token in the
Authorizationheader of each HTTP request.
Set up the SDK examples
Configure your development environment to run the sample.
Set the
AZURE_SEARCH_ENDPOINTenvironment variable to your Foundry IQ service endpoint. The examples read this value to tell the client which Foundry IQ service to connect to.Install Azure CLI and sign in with
az login.DefaultAzureCredentialcan use this signed-in account for authentication. The account's Search Service Contributor role authorizes the list operations.
For other local sign-in options, see Authentication for local development.
Choose a list operation
The 2026-10-01 REST API supports server-side paging for the following list operations:
| Operation | Resource path |
|---|---|
| List Aliases | /aliases |
| List Data Sources | /datasources |
| List Indexers | /indexers |
| List Indexes | /indexes |
| Get Index Statistics Summary | /indexstats |
| List Knowledge Bases | /knowledgebases |
| List Knowledge Sources | /knowledgesources |
| List Knowledge Source Files | /knowledgesources('{knowledge-source-name}')/files |
| List Skillsets | /skillsets |
| List Synonym Maps | /synonymmaps |
For REST requests, $select is supported for data sources, indexers, skillsets, synonym maps, and the index list overload that returns selected properties. Don't assume every list operation supports it.
Filter by name prefix
Use the search parameter to narrow a list to the objects whose names start with the text you provide.
Except for file names, the names returned by these list operations are lowercase. Name-prefix matching ignores case. The API rejects uppercase search values as invalid input rather than converting them to lowercase.
The following parameters control the filter:
| Parameter | Description |
|---|---|
search |
A name prefix. A nonempty value must start with a lowercase letter (a-z) or digit (0-9) and contain only lowercase letters, digits, hyphens, and underscores. The maximum length is 128 characters. Invalid values return HTTP 400. Omitted or empty values don't narrow the list. |
searchType |
How the service interprets search. prefix is the only supported value and the default. Other values return HTTP 400. |
For file listings, search matches the returned fileName value, including any relative path, without regard to case. File names can contain uppercase letters. The separate prefix path filter is case-sensitive.
Choose tenant prefixes that don't overlap. For example, search=contoso- returns contoso-orders and contoso-products but excludes contoso2-orders. A request with search=toso returns an empty value array because the filter matches the start of the name.
Code example
The following code lists the indexes for one tenant in a multitenant application. Each index name starts with a tenant prefix, such as contoso- or contoso2-.
The code filters the list by the contoso- prefix and requests up to 10 indexes per page. For a tenant with 27 matching indexes, the service can return pages containing 10, 10, and 7 indexes.
The loop starts at the beginning of the filtered list. To resume, pass a saved page.ContinuationToken value to AsPages(token).
using System;
using Azure;
using Azure.Identity;
using Azure.Search.Documents;
using Azure.Search.Documents.Indexes;
using Azure.Search.Documents.Indexes.Models;
using Azure.Search.Documents.Models;
string endpoint = Environment.GetEnvironmentVariable(
"AZURE_SEARCH_ENDPOINT")!;
var options = new SearchClientOptions(
SearchClientOptions.ServiceVersion.V2026_08_01_Preview);
var client = new SearchIndexClient(
new Uri(endpoint),
new DefaultAzureCredential(),
options);
// Filter by the tenant prefix and limit each page to 10 indexes
AsyncPageable<SearchIndex> indexes = client.GetIndexesAsync(
search: "contoso-",
pageSize: 10,
searchType: ListingSearchType.Prefix);
// Fetch pages until the service returns no continuation token
await foreach (Page<SearchIndex> page in indexes.AsPages())
{
// Read the indexes in this page without fetching another page
foreach (SearchIndex index in page.Values)
{
Console.WriteLine(index.Name);
}
}
Reference: SearchIndexClient.GetIndexesAsync, AsPages, ContinuationToken, and DefaultAzureCredential
The outer loop calls AsPages() once and the SDK fetches a page on each iteration, keeping its continuation token for the next request. The outer loop uses await to wait for each service response without blocking the thread, while the inner loop reads indexes in memory. When the last page has a null continuation token, the SDK reports that there are no more pages and the loop ends.
The outer loop iterates over the pages. The inner loop iterates over the indexes on each page.
import os
from azure.identity import DefaultAzureCredential
from azure.search.documents.indexes import SearchIndexClient
endpoint = os.getenv("AZURE_SEARCH_ENDPOINT")
with SearchIndexClient(
endpoint,
DefaultAzureCredential(),
api_version="2026-08-01-preview",
) as client:
# Filter by the tenant prefix and limit each page to 10 indexes
indexes = client.list_indexes(
select=["name"],
search="contoso-",
page_size=10,
search_type="prefix",
)
# Create the page iterator once, starting at the first page
pages = indexes.by_page()
# Fetch pages until the service returns no continuation token
for page in pages:
# Read the indexes in this page without fetching another page
for index in page:
print(index.name)
Reference: SearchIndexClient.list_indexes, ItemPaged.by_page, and DefaultAzureCredential
by_page() creates the page iterator once, then for page in pages requests each page using the continuation token stored in that iterator. The inner loop reads one page's indexes without another request while the outer loop stops when the last page has a None continuation token. A new iterator starts at the first page with no token or None, while by_page(continuation_token=token) resumes from a saved token.
Send an initial request to list the indexes whose names start with contoso-. The request returns up to 10 index names:
GET https://<search-service-name>.search.windows.net/indexes?api-version=2026-10-01&search=contoso-&searchType=prefix&pageSize=10&$select=name
Authorization: Bearer <access-token>
Accept: application/json
Reference: List Indexes
When more results are available, the response includes @odata.nextLink, which contains the complete continuation URL and an opaque token. A page can contain fewer than 10 results and still include a continuation URL. The following response is abbreviated:
{
"value": [
{
"name": "<index-name>"
}
],
"@odata.nextLink": "https://<search-service-name>.search.windows.net/indexes?api-version=2026-10-01&searchType=prefix&%24select=name&%24skiptoken=<opaque-token>"
}
To request the next page, send a GET request to the complete @odata.nextLink value exactly as returned. The search value and page size are encoded in the continuation token. Keep the same authentication header:
GET <complete-@odata.nextLink-value>
Authorization: Bearer <access-token>
Accept: application/json
Reference: List Indexes
Repeat the request with each new @odata.nextLink value. The last page contains the remaining index names and omits @odata.nextLink, which indicates that no more pages are available:
{
"value": [
{
"name": "<next-index-name>"
}
]
}
Server-side paging behavior
Detect the last page: Continue paging while the response contains
@odata.nextLink, even if a page contains fewer results than requested. The last page omits this property. Responses don't include@odata.count.Preserve continuation state: Use the complete
@odata.nextLinkexactly as returned. Don't construct, modify, or decode the continuation token (the$skiptokenvalue) and don't use it with a different list operation. The token supports forward paging only.Change request parameters: Start a new initial request to change the resource path, API version, search prefix, selected properties, or page size. Combining
$skiptokenwithsearchorpageSizereturns HTTP 400.Account for collection changes: Forward paging is stable only while the collection remains unchanged. Adding, updating, or deleting objects during enumeration can produce duplicate or omitted results.
Don't rely on result order: The service doesn't guarantee the order of results.
Set the page size:
pageSizedefaults to 3,000 items per page and has a maximum allowed value of 3,000.