SearchIndexerClient Class
A client to interact with Azure search service Indexers.
- Inheritance
-
azure.search.documents._headers_mixin.HeadersMixinSearchIndexerClient
Constructor
SearchIndexerClient(endpoint: str, credential: AzureKeyCredential | TokenCredential, **kwargs: Any)
Parameters
Name | Description |
---|---|
endpoint
Required
|
The URL endpoint of an Azure search service |
credential
Required
|
A credential to authorize search client requests |
Keyword-Only Parameters
Name | Description |
---|---|
api_version
|
The Search API version to use for requests. |
audience
|
sets the Audience to use for authentication with Azure Active Directory (AAD). The audience is not considered when using a shared key. If audience is not provided, the public cloud audience will be assumed. |
Methods
close |
Close the session. :return: None :rtype: None |
create_data_source_connection |
Creates a new data source connection. |
create_indexer |
Creates a new SearchIndexer. |
create_or_update_data_source_connection |
Creates a new data source connection or updates a data source connection if it already exists. :param data_source_connection: The definition of the data source connection to create or update. :type data_source_connection: ~azure.search.documents.indexes.models.SearchIndexerDataSourceConnection :keyword match_condition: The match condition to use upon the etag :paramtype match_condition: ~azure.core.MatchConditions :return: The created SearchIndexerDataSourceConnection :rtype: ~azure.search.documents.indexes.models.SearchIndexerDataSourceConnection |
create_or_update_indexer |
Creates a new indexer or updates an indexer if it already exists. |
create_or_update_skillset |
Create a new SearchIndexerSkillset in an Azure Search service, or update an existing one. |
create_skillset |
Create a new SearchIndexerSkillset in an Azure Search service |
delete_data_source_connection |
Deletes a data source connection. To use access conditions, the SearchIndexerDataSourceConnection model must be provided instead of the name. It is enough to provide the name of the data source connection to delete unconditionally |
delete_indexer |
Deletes an indexer. To use access conditions, the SearchIndexer model must be provided instead of the name. It is enough to provide the name of the indexer to delete unconditionally. |
delete_skillset |
Delete a named SearchIndexerSkillset in an Azure Search service. To use access conditions, the SearchIndexerSkillset model must be provided instead of the name. It is enough to provide the name of the skillset to delete unconditionally |
get_data_source_connection |
Retrieves a data source connection definition. |
get_data_source_connection_names |
Lists all data source connection names available for a search service. |
get_data_source_connections |
Lists all data source connections available for a search service. |
get_indexer |
Retrieves an indexer definition. |
get_indexer_names |
Lists all indexer names available for a search service. |
get_indexer_status |
Get the status of the indexer. |
get_indexers |
Lists all indexers available for a search service. |
get_skillset |
Retrieve a named SearchIndexerSkillset in an Azure Search service |
get_skillset_names |
List the SearchIndexerSkillset names in an Azure Search service. |
get_skillsets |
List the SearchIndexerSkillsets in an Azure Search service. |
reset_indexer |
Resets the change tracking state associated with an indexer. |
run_indexer |
Run an indexer. |
close
Close the session. :return: None :rtype: None
close() -> None
create_data_source_connection
Creates a new data source connection.
create_data_source_connection(data_source_connection: SearchIndexerDataSourceConnection, **kwargs: Any) -> SearchIndexerDataSourceConnection
Parameters
Name | Description |
---|---|
data_source_connection
Required
|
The definition of the data source connection to create. |
Returns
Type | Description |
---|---|
The created SearchIndexerDataSourceConnection |
Examples
Create a Data Source
container = SearchIndexerDataContainer(name="searchcontainer")
data_source_connection = SearchIndexerDataSourceConnection(
name="sample-data-source-connection", type="azureblob", connection_string=connection_string, container=container
)
result = client.create_data_source_connection(data_source_connection)
print(result)
print("Create new Data Source Connection - sample-data-source-connection")
create_indexer
Creates a new SearchIndexer.
create_indexer(indexer: SearchIndexer, **kwargs: Any) -> SearchIndexer
Parameters
Name | Description |
---|---|
indexer
Required
|
The definition of the indexer to create. |
Returns
Type | Description |
---|---|
The created SearchIndexer |
Examples
Create a SearchIndexer
# create a datasource
container = SearchIndexerDataContainer(name="searchcontainer")
data_source_connection = SearchIndexerDataSourceConnection(
name="indexer-datasource", type="azureblob", connection_string=connection_string, container=container
)
data_source = indexers_client.create_data_source_connection(data_source_connection)
# create an indexer
indexer = SearchIndexer(
name="sample-indexer", data_source_name="indexer-datasource", target_index_name="indexer-hotels"
)
result = indexers_client.create_indexer(indexer)
print("Create new Indexer - sample-indexer")
create_or_update_data_source_connection
Creates a new data source connection or updates a data source connection if it already exists. :param data_source_connection: The definition of the data source connection to create or update. :type data_source_connection: ~azure.search.documents.indexes.models.SearchIndexerDataSourceConnection :keyword match_condition: The match condition to use upon the etag :paramtype match_condition: ~azure.core.MatchConditions :return: The created SearchIndexerDataSourceConnection :rtype: ~azure.search.documents.indexes.models.SearchIndexerDataSourceConnection
create_or_update_data_source_connection(data_source_connection: SearchIndexerDataSourceConnection, *, match_condition: MatchConditions = MatchConditions.Unconditionally, **kwargs: Any) -> SearchIndexerDataSourceConnection
create_or_update_indexer
Creates a new indexer or updates an indexer if it already exists.
create_or_update_indexer(indexer: SearchIndexer, *, match_condition: MatchConditions = MatchConditions.Unconditionally, **kwargs: Any) -> SearchIndexer
Parameters
Name | Description |
---|---|
indexer
Required
|
The definition of the indexer to create or update. |
Keyword-Only Parameters
Name | Description |
---|---|
match_condition
|
The match condition to use upon the etag |
Returns
Type | Description |
---|---|
The created SearchIndexer |
create_or_update_skillset
Create a new SearchIndexerSkillset in an Azure Search service, or update an existing one.
create_or_update_skillset(skillset: SearchIndexerSkillset, *, match_condition: MatchConditions = MatchConditions.Unconditionally, **kwargs: Any) -> SearchIndexerSkillset
Parameters
Name | Description |
---|---|
skillset
Required
|
The SearchIndexerSkillset object to create or update |
Keyword-Only Parameters
Name | Description |
---|---|
match_condition
|
The match condition to use upon the etag |
Returns
Type | Description |
---|---|
The created or updated SearchIndexerSkillset |
create_skillset
Create a new SearchIndexerSkillset in an Azure Search service
create_skillset(skillset: SearchIndexerSkillset, **kwargs: Any) -> SearchIndexerSkillset
Parameters
Name | Description |
---|---|
skillset
Required
|
The SearchIndexerSkillset object to create |
Returns
Type | Description |
---|---|
The created SearchIndexerSkillset |
delete_data_source_connection
Deletes a data source connection. To use access conditions, the SearchIndexerDataSourceConnection model must be provided instead of the name. It is enough to provide the name of the data source connection to delete unconditionally
delete_data_source_connection(data_source_connection: str | SearchIndexerDataSourceConnection, *, match_condition: MatchConditions = MatchConditions.Unconditionally, **kwargs: Any) -> None
Parameters
Name | Description |
---|---|
data_source_connection
Required
|
The data source connection to delete. |
Keyword-Only Parameters
Name | Description |
---|---|
match_condition
|
The match condition to use upon the etag |
Examples
Delete a SearchIndexerDataSourceConnection
client.delete_data_source_connection("sample-data-source-connection")
print("Data Source Connection 'sample-data-source-connection' successfully deleted")
delete_indexer
Deletes an indexer. To use access conditions, the SearchIndexer model must be provided instead of the name. It is enough to provide the name of the indexer to delete unconditionally.
delete_indexer(indexer: str | SearchIndexer, *, match_condition: MatchConditions = MatchConditions.Unconditionally, **kwargs: Any) -> None
Parameters
Name | Description |
---|---|
indexer
Required
|
str or
SearchIndexer
The indexer to delete. |
Keyword-Only Parameters
Name | Description |
---|---|
match_condition
|
The match condition to use upon the etag |
Examples
Delete a SearchIndexer
indexers_client.delete_indexer("sample-indexer")
print("Indexer 'sample-indexer' successfully deleted")
delete_skillset
Delete a named SearchIndexerSkillset in an Azure Search service. To use access conditions, the SearchIndexerSkillset model must be provided instead of the name. It is enough to provide the name of the skillset to delete unconditionally
delete_skillset(skillset: str | SearchIndexerSkillset, *, match_condition: MatchConditions = MatchConditions.Unconditionally, **kwargs: Any) -> None
Parameters
Name | Description |
---|---|
skillset
Required
|
The SearchIndexerSkillset to delete |
Keyword-Only Parameters
Name | Description |
---|---|
match_condition
|
The match condition to use upon the etag |
get_data_source_connection
Retrieves a data source connection definition.
get_data_source_connection(name: str, **kwargs: Any) -> SearchIndexerDataSourceConnection
Parameters
Name | Description |
---|---|
name
Required
|
The name of the data source connection to retrieve. |
Returns
Type | Description |
---|---|
The SearchIndexerDataSourceConnection that is fetched. |
Examples
Retrieve a SearchIndexerDataSourceConnection
result = client.get_data_source_connection("sample-data-source-connection")
print("Retrived Data Source Connection 'sample-data-source-connection'")
get_data_source_connection_names
Lists all data source connection names available for a search service.
get_data_source_connection_names(**kwargs: Any) -> Sequence[str]
Returns
Type | Description |
---|---|
List of all the data source connection names. |
get_data_source_connections
Lists all data source connections available for a search service.
get_data_source_connections(*, select: List[str] | None = None, **kwargs: Any) -> Sequence[SearchIndexerDataSourceConnection]
Keyword-Only Parameters
Name | Description |
---|---|
select
|
Selects which top-level properties of the skillsets to retrieve. Specified as a list of JSON property names, or '*' for all properties. The default is all properties. |
Returns
Type | Description |
---|---|
List of all the data source connections. |
Examples
List all the SearchIndexerDataSourceConnections
result = client.get_data_source_connections()
names = [ds.name for ds in result]
print("Found {} Data Source Connections in the service: {}".format(len(result), ", ".join(names)))
get_indexer
Retrieves an indexer definition.
get_indexer(name: str, **kwargs: Any) -> SearchIndexer
Parameters
Name | Description |
---|---|
name
Required
|
The name of the indexer to retrieve. |
Returns
Type | Description |
---|---|
The SearchIndexer that is fetched. |
Examples
Retrieve a SearchIndexer
result = indexers_client.get_indexer("sample-indexer")
print("Retrived Indexer 'sample-indexer'")
return result
get_indexer_names
Lists all indexer names available for a search service.
get_indexer_names(**kwargs: Any) -> Sequence[str]
Returns
Type | Description |
---|---|
List of all the SearchIndexers. |
Examples
List all the SearchIndexers
result = indexers_client.get_indexers()
names = [x.name for x in result]
print("Found {} Indexers in the service: {}".format(len(result), ", ".join(names)))
get_indexer_status
Get the status of the indexer.
get_indexer_status(name: str, **kwargs: Any) -> SearchIndexerStatus
Parameters
Name | Description |
---|---|
name
Required
|
The name of the indexer to fetch the status. |
Returns
Type | Description |
---|---|
SearchIndexerStatus |
Examples
Get a SearchIndexer's status
result = indexers_client.get_indexer_status("sample-indexer")
print("Retrived Indexer status for 'sample-indexer'")
return result
get_indexers
Lists all indexers available for a search service.
get_indexers(*, select: List[str] | None = None, **kwargs: Any) -> Sequence[SearchIndexer]
Keyword-Only Parameters
Name | Description |
---|---|
select
|
Selects which top-level properties of the skillsets to retrieve. Specified as a list of JSON property names, or '*' for all properties. The default is all properties. |
Returns
Type | Description |
---|---|
List of all the SearchIndexers. |
Examples
List all the SearchIndexers
result = indexers_client.get_indexers()
names = [x.name for x in result]
print("Found {} Indexers in the service: {}".format(len(result), ", ".join(names)))
get_skillset
Retrieve a named SearchIndexerSkillset in an Azure Search service
get_skillset(name: str, **kwargs: Any) -> SearchIndexerSkillset
Parameters
Name | Description |
---|---|
name
Required
|
The name of the SearchIndexerSkillset to get |
Returns
Type | Description |
---|---|
The retrieved SearchIndexerSkillset |
Exceptions
Type | Description |
---|---|
get_skillset_names
List the SearchIndexerSkillset names in an Azure Search service.
get_skillset_names(**kwargs: Any) -> List[str]
Returns
Type | Description |
---|---|
List of SearchIndexerSkillset names |
Exceptions
Type | Description |
---|---|
get_skillsets
List the SearchIndexerSkillsets in an Azure Search service.
get_skillsets(*, select: List[str] | None = None, **kwargs: Any) -> List[SearchIndexerSkillset]
Keyword-Only Parameters
Name | Description |
---|---|
select
|
Selects which top-level properties of the skillsets to retrieve. Specified as a list of JSON property names, or '*' for all properties. The default is all properties. |
Returns
Type | Description |
---|---|
List of SearchIndexerSkillsets |
Exceptions
Type | Description |
---|---|
reset_indexer
Resets the change tracking state associated with an indexer.
reset_indexer(name: str, **kwargs: Any) -> None
Parameters
Name | Description |
---|---|
name
Required
|
The name of the indexer to reset. |
Examples
Reset a SearchIndexer's change tracking state
result = indexers_client.reset_indexer("sample-indexer")
print("Reset the Indexer 'sample-indexer'")
return result
run_indexer
Run an indexer.
run_indexer(name: str, **kwargs: Any) -> None
Parameters
Name | Description |
---|---|
name
Required
|
The name of the indexer to run. |
Examples
Run a SearchIndexer
result = indexers_client.run_indexer("sample-indexer")
print("Ran the Indexer 'sample-indexer'")
return result
Azure SDK for Python