SearchIndexClient Class

SearchIndexClient.

Constructor

SearchIndexClient(endpoint: str, credential: AzureKeyCredential | AsyncTokenCredential, **kwargs: Any)

Parameters

Name Description
endpoint
Required
str

The endpoint URL of the search service. Required.

credential
Required

Credential used to authenticate requests to the service. Is either a key credential type or a token credential type. Required.

Keyword-Only Parameters

Name Description
api_version
str

The API version to use for this operation. Known values are "2026-04-01" and None. Default value is "2026-04-01". Note that overriding this default value may result in unsupported behavior.

audience
str

Sets the Audience to use for authentication with Microsoft Entra ID. The audience is not considered when using a shared key. If audience is not provided, the public cloud audience will be assumed.

Methods

analyze_text

Shows how an analyzer breaks text into tokens.

close
create_alias

Creates a new search alias.

create_index

Creates a new search index.

create_knowledge_base

Creates a new knowledge base.

create_knowledge_source

Creates a new knowledge source.

create_or_update_alias

Creates a new search alias or updates an alias if it already exists.

create_or_update_index

Creates a new search index or updates an index if it already exists.

create_or_update_knowledge_base

Creates a new knowledge base or updates a knowledge base if it already exists.

create_or_update_knowledge_source

Creates a new knowledge source or updates a knowledge source if it already exists.

create_or_update_synonym_map

Creates a new synonym map or updates a synonym map if it already exists.

create_synonym_map

Creates a new synonym map.

delete_alias

Deletes a search alias and its associated mapping to an index.

delete_index

Deletes a search index and all the documents it contains.

delete_knowledge_base

Deletes a knowledge base.

delete_knowledge_source

Deletes a knowledge source.

delete_synonym_map

Deletes a synonym map.

get_alias

Retrieves an alias definition.

get_index

Retrieves an index definition.

get_index_statistics

Returns statistics for the given index, including a document count and storage usage.

get_knowledge_base

Retrieves a knowledge base definition.

get_knowledge_source

Retrieves a knowledge source definition.

get_knowledge_source_status

Retrieves the status of a knowledge source.

get_search_client

Return a client to perform operations on Search.

get_service_statistics

Gets service level statistics for a search service.

get_synonym_map

Retrieves a synonym map definition.

get_synonym_map_names

Lists the names of all synonym maps available for a search service.

get_synonym_maps

Lists all synonym maps available for a search service.

list_alias_names

List the alias names in an Azure Search service.

list_aliases

Lists all aliases available for a search service.

list_index_names

Lists the names of all indexes available for a search service.

list_indexes

Lists all indexes available for a search service.

list_knowledge_bases

Lists all knowledge bases available for a search service.

list_knowledge_sources

Lists all knowledge sources available for a search service.

send_request

Runs the network request through the client's chained policies.


>>> from azure.core.rest import HttpRequest
>>> request = HttpRequest("GET", "https://www.example.org/")
<HttpRequest [GET], url: 'https://www.example.org/'>
>>> response = await client.send_request(request)
<AsyncHttpResponse: 200 OK>

For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request

analyze_text

Shows how an analyzer breaks text into tokens.

async analyze_text(index_name: str, analyze_request: AnalyzeTextOptions, **kwargs: Any) -> AnalyzeResult

Parameters

Name Description
index_name
Required
str

The name of the index to test an analyzer on. Required.

analyze_request
Required

The text and analyzer or analysis components to test. Required.

Returns

Type Description

AnalyzeResult

Exceptions

Type Description

close

async close() -> None

create_alias

Creates a new search alias.

async create_alias(alias: SearchAlias | MutableMapping[str, Any] | IO[bytes], **kwargs: Any) -> SearchAlias

Parameters

Name Description
alias
Required
SearchAlias or <xref:JSON> or IO[bytes]

The definition of the alias to create. Is one of the following types: SearchAlias, JSON, IO[bytes] Required.

Returns

Type Description

SearchAlias. The SearchAlias is compatible with MutableMapping

Exceptions

Type Description

create_index

Creates a new search index.

async create_index(index: SearchIndex | MutableMapping[str, Any] | IO[bytes], **kwargs: Any) -> SearchIndex

Parameters

Name Description
index
Required
SearchIndex or <xref:JSON> or IO[bytes]

The definition of the index to create. Is one of the following types: SearchIndex, JSON, IO[bytes] Required.

Returns

Type Description

SearchIndex. The SearchIndex is compatible with MutableMapping

Exceptions

Type Description

create_knowledge_base

Creates a new knowledge base.

async create_knowledge_base(knowledge_base: KnowledgeBase | MutableMapping[str, Any] | IO[bytes], **kwargs: Any) -> KnowledgeBase

Parameters

Name Description
knowledge_base
Required
KnowledgeBase or <xref:JSON> or IO[bytes]

The definition of the knowledge base to create. Is one of the following types: KnowledgeBase, JSON, IO[bytes] Required.

Returns

Type Description

KnowledgeBase. The KnowledgeBase is compatible with MutableMapping

Exceptions

Type Description

create_knowledge_source

Creates a new knowledge source.

async create_knowledge_source(knowledge_source: KnowledgeSource | MutableMapping[str, Any] | IO[bytes], **kwargs: Any) -> KnowledgeSource

Parameters

Name Description
knowledge_source
Required
KnowledgeSource or <xref:JSON> or IO[bytes]

The definition of the knowledge source to create. Is one of the following types: KnowledgeSource, JSON, IO[bytes] Required.

Returns

Type Description

KnowledgeSource. The KnowledgeSource is compatible with MutableMapping

Exceptions

Type Description

create_or_update_alias

Creates a new search alias or updates an alias if it already exists.

async create_or_update_alias(alias: SearchAlias | MutableMapping[str, Any], *, match_condition: MatchConditions = MatchConditions.Unconditionally, **kwargs: Any) -> SearchAlias

Parameters

Name Description
alias
Required
SearchAlias or <xref:JSON>

The SearchAlias object to create or update. Required.

Keyword-Only Parameters

Name Description
match_condition

The match condition to use upon the etag. Default value is None.

Default value: MatchConditions.Unconditionally

Returns

Type Description

SearchAlias

Exceptions

Type Description

create_or_update_index

Creates a new search index or updates an index if it already exists.

async create_or_update_index(index: SearchIndex | MutableMapping[str, Any], allow_index_downtime: bool | None = None, *, match_condition: MatchConditions = MatchConditions.Unconditionally, **kwargs: Any) -> SearchIndex

Parameters

Name Description
index
Required
SearchIndex or <xref:JSON>

The SearchIndex object to create or update. Required.

allow_index_downtime

Allows new analyzers, tokenizers, token filters, or char filters to be added to an index by taking the index offline for at least a few seconds. This temporarily causes indexing and query requests to fail. Performance and write availability of the index can be impaired for several minutes after the index is updated, or longer for very large indexes. Default value is None.

Default value: None

Keyword-Only Parameters

Name Description
match_condition

The match condition to use upon the etag. Default value is None.

Default value: MatchConditions.Unconditionally

Returns

Type Description

SearchIndex

Exceptions

Type Description

create_or_update_knowledge_base

Creates a new knowledge base or updates a knowledge base if it already exists.

async create_or_update_knowledge_base(knowledge_base: KnowledgeBase | MutableMapping[str, Any], *, match_condition: MatchConditions = MatchConditions.Unconditionally, **kwargs: Any) -> KnowledgeBase

Parameters

Name Description
knowledge_base
Required
KnowledgeBase or <xref:JSON>

The KnowledgeBase object to create or update. Required.

Keyword-Only Parameters

Name Description
match_condition

The match condition to use upon the etag. Default value is None.

Default value: MatchConditions.Unconditionally

Returns

Type Description

KnowledgeBase

Exceptions

Type Description

create_or_update_knowledge_source

Creates a new knowledge source or updates a knowledge source if it already exists.

async create_or_update_knowledge_source(knowledge_source: KnowledgeSource | MutableMapping[str, Any], *, match_condition: MatchConditions = MatchConditions.Unconditionally, **kwargs: Any) -> KnowledgeSource

Parameters

Name Description
knowledge_source
Required
KnowledgeSource or <xref:JSON>

The KnowledgeSource object to create or update. Required.

Keyword-Only Parameters

Name Description
match_condition

The match condition to use upon the etag. Default value is None.

Default value: MatchConditions.Unconditionally

Returns

Type Description

KnowledgeSource

Exceptions

Type Description

create_or_update_synonym_map

Creates a new synonym map or updates a synonym map if it already exists.

async create_or_update_synonym_map(synonym_map: SynonymMap | MutableMapping[str, Any], *, match_condition: MatchConditions = MatchConditions.Unconditionally, **kwargs: Any) -> SynonymMap

Parameters

Name Description
synonym_map
Required
SynonymMap or <xref:JSON>

The SynonymMap object to create or update. Required.

Keyword-Only Parameters

Name Description
match_condition

The match condition to use upon the etag. Default value is None.

Default value: MatchConditions.Unconditionally

Returns

Type Description

SynonymMap

Exceptions

Type Description

create_synonym_map

Creates a new synonym map.

async create_synonym_map(synonym_map: SynonymMap | MutableMapping[str, Any] | IO[bytes], **kwargs: Any) -> SynonymMap

Parameters

Name Description
synonym_map
Required
SynonymMap or <xref:JSON> or IO[bytes]

The definition of the synonym map to create. Is one of the following types: SynonymMap, JSON, IO[bytes] Required.

Returns

Type Description

SynonymMap. The SynonymMap is compatible with MutableMapping

Exceptions

Type Description

delete_alias

Deletes a search alias and its associated mapping to an index.

async delete_alias(alias: str | SearchAlias, *, match_condition: MatchConditions = MatchConditions.Unconditionally, **kwargs: Any) -> None

Parameters

Name Description
alias
Required

The name of the alias to delete or a SearchAlias object. Required.

Keyword-Only Parameters

Name Description
match_condition

The match condition to use upon the etag. Default value is None.

Default value: MatchConditions.Unconditionally

Returns

Type Description

None

Exceptions

Type Description

delete_index

Deletes a search index and all the documents it contains.

async delete_index(index: str | SearchIndex, *, match_condition: MatchConditions = MatchConditions.Unconditionally, **kwargs: Any) -> None

Parameters

Name Description
index
Required

The name of the index to delete or a SearchIndex object. Required.

Keyword-Only Parameters

Name Description
match_condition

The match condition to use upon the etag. Default value is None.

Default value: MatchConditions.Unconditionally

Returns

Type Description

None

Exceptions

Type Description

delete_knowledge_base

Deletes a knowledge base.

async delete_knowledge_base(knowledge_base: str | KnowledgeBase, *, match_condition: MatchConditions = MatchConditions.Unconditionally, **kwargs: Any) -> None

Parameters

Name Description
knowledge_base
Required

The name of the knowledge base to delete or a KnowledgeBase object. Required.

Keyword-Only Parameters

Name Description
match_condition

The match condition to use upon the etag. Default value is None.

Default value: MatchConditions.Unconditionally

Returns

Type Description

None

Exceptions

Type Description

delete_knowledge_source

Deletes a knowledge source.

async delete_knowledge_source(knowledge_source: str | KnowledgeSource, *, match_condition: MatchConditions = MatchConditions.Unconditionally, **kwargs: Any) -> None

Parameters

Name Description
knowledge_source
Required

The name of the knowledge source to delete or a KnowledgeSource object. Required.

Keyword-Only Parameters

Name Description
match_condition

The match condition to use upon the etag. Default value is None.

Default value: MatchConditions.Unconditionally

Returns

Type Description

None

Exceptions

Type Description

delete_synonym_map

Deletes a synonym map.

async delete_synonym_map(synonym_map: str | SynonymMap, *, match_condition: MatchConditions = MatchConditions.Unconditionally, **kwargs: Any) -> None

Parameters

Name Description
synonym_map
Required

The name of the synonym map to delete or a SynonymMap object. Required.

Keyword-Only Parameters

Name Description
match_condition

The match condition to use upon the etag. Default value is None.

Default value: MatchConditions.Unconditionally

Returns

Type Description

None

Exceptions

Type Description

get_alias

Retrieves an alias definition.

async get_alias(name: str, **kwargs: Any) -> SearchAlias

Parameters

Name Description
name
Required
str

The name of the alias. Required.

Returns

Type Description

SearchAlias. The SearchAlias is compatible with MutableMapping

Exceptions

Type Description

get_index

Retrieves an index definition.

async get_index(name: str, **kwargs: Any) -> SearchIndex

Parameters

Name Description
name
Required
str

The name of the index. Required.

Returns

Type Description

SearchIndex. The SearchIndex is compatible with MutableMapping

Exceptions

Type Description

get_index_statistics

Returns statistics for the given index, including a document count and storage usage.

async get_index_statistics(index_name: str, **kwargs: Any) -> GetIndexStatisticsResult

Parameters

Name Description
index_name
Required
str

The name of the index to retrieve statistics for. Required.

Returns

Type Description

GetIndexStatisticsResult

Exceptions

Type Description

get_knowledge_base

Retrieves a knowledge base definition.

async get_knowledge_base(name: str, **kwargs: Any) -> KnowledgeBase

Parameters

Name Description
name
Required
str

The name of the knowledge base. Required.

Returns

Type Description

KnowledgeBase. The KnowledgeBase is compatible with MutableMapping

Exceptions

Type Description

get_knowledge_source

Retrieves a knowledge source definition.

async get_knowledge_source(name: str, **kwargs: Any) -> KnowledgeSource

Parameters

Name Description
name
Required
str

The name of the knowledge source. Required.

Returns

Type Description

KnowledgeSource. The KnowledgeSource is compatible with MutableMapping

Exceptions

Type Description

get_knowledge_source_status

Retrieves the status of a knowledge source.

async get_knowledge_source_status(name: str, **kwargs: Any) -> KnowledgeSourceStatus

Parameters

Name Description
name
Required
str

The name of the knowledge source. Required.

Returns

Type Description

KnowledgeSourceStatus. The KnowledgeSourceStatus is compatible with MutableMapping

Exceptions

Type Description

get_search_client

Return a client to perform operations on Search.

get_search_client(index_name: str, **kwargs: Any) -> azure.search.documents.aio.SearchClient

Parameters

Name Description
index_name
Required
str

The name of the index. Required.

Returns

Type Description

A SearchClient for operations on the named index.

get_service_statistics

Gets service level statistics for a search service.

async get_service_statistics(**kwargs: Any) -> SearchServiceStatistics

Returns

Type Description

SearchServiceStatistics. The SearchServiceStatistics is compatible with MutableMapping

Exceptions

Type Description

get_synonym_map

Retrieves a synonym map definition.

async get_synonym_map(name: str, **kwargs: Any) -> SynonymMap

Parameters

Name Description
name
Required
str

The name of the synonym map. Required.

Returns

Type Description

SynonymMap. The SynonymMap is compatible with MutableMapping

Exceptions

Type Description

get_synonym_map_names

Lists the names of all synonym maps available for a search service.

async get_synonym_map_names(**kwargs: Any) -> List[str]

Returns

Type Description

List of synonym map names

Exceptions

Type Description

get_synonym_maps

Lists all synonym maps available for a search service.

async get_synonym_maps(*, select: List[str] | None = None, **kwargs: Any) -> List[SynonymMap]

Keyword-Only Parameters

Name Description
select

Selects which top-level properties of the synonym maps to retrieve. Specified as a comma-separated list of JSON property names, or '*' for all properties. The default is all properties. Default value is None.

Default value: None

Returns

Type Description

List of synonym maps

Exceptions

Type Description

list_alias_names

List the alias names in an Azure Search service.

list_alias_names(**kwargs) -> AsyncItemPaged[str]

Returns

Type Description

List of alias names

Exceptions

Type Description

If the operation fails.

list_aliases

Lists all aliases available for a search service.

list_aliases(**kwargs: Any) -> AsyncItemPaged[SearchAlias]

Returns

Type Description

An iterator like instance of SearchAlias

Exceptions

Type Description

list_index_names

Lists the names of all indexes available for a search service.

list_index_names(**kwargs: Any) -> AsyncItemPaged[str]

Returns

Type Description

An async iterator like instance of index names

Exceptions

Type Description

list_indexes

Lists all indexes available for a search service.

list_indexes(*, select: List[str] | None = None, **kwargs: Any) -> AsyncItemPaged[SearchIndex]

Keyword-Only Parameters

Name Description
select

Selects which top-level properties to retrieve. Specified as a comma-separated list of JSON property names, or '*' for all properties. The default is all properties. Default value is None.

Default value: None

Returns

Type Description

An async iterator like instance of SearchIndex

Exceptions

Type Description

list_knowledge_bases

Lists all knowledge bases available for a search service.

list_knowledge_bases(**kwargs: Any) -> AsyncItemPaged[KnowledgeBase]

Returns

Type Description

An iterator like instance of KnowledgeBase

Exceptions

Type Description

list_knowledge_sources

Lists all knowledge sources available for a search service.

list_knowledge_sources(**kwargs: Any) -> AsyncItemPaged[KnowledgeSource]

Returns

Type Description

An iterator like instance of KnowledgeSource

Exceptions

Type Description

send_request

Runs the network request through the client's chained policies.


>>> from azure.core.rest import HttpRequest
>>> request = HttpRequest("GET", "https://www.example.org/")
<HttpRequest [GET], url: 'https://www.example.org/'>
>>> response = await client.send_request(request)
<AsyncHttpResponse: 200 OK>

For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request

send_request(request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> Awaitable[AsyncHttpResponse]

Parameters

Name Description
request
Required

The network request you want to make. Required.

Keyword-Only Parameters

Name Description
stream

Whether the response payload will be streamed. Defaults to False.

Default value: False

Returns

Type Description

The response of your network call. Does not do error handling on your response.