SearchIndexerClient Class

A client to interact with Azure search service Indexers.

Inheritance
azure.search.documents._headers_mixin.HeadersMixin
SearchIndexerClient

Constructor

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

Parameters

Name Description
endpoint
Required
str

The URL endpoint of an Azure search service

credential
Required

A credential to authorize search client requests

Keyword-Only Parameters

Name Description
api_version
str

The Search API version to use for requests.

audience
str

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. :param data_source_connection: The definition of the data source connection to create. :type data_source_connection: ~azure.search.documents.indexes.models.SearchIndexerDataSourceConnection :return: The created SearchIndexerDataSourceConnection :rtype: ~azure.search.documents.indexes.models.SearchIndexerDataSourceConnection

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 a 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 a 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

async close() -> None

create_data_source_connection

Creates a new data source connection. :param data_source_connection: The definition of the data source connection to create. :type data_source_connection: ~azure.search.documents.indexes.models.SearchIndexerDataSourceConnection :return: The created SearchIndexerDataSourceConnection :rtype: ~azure.search.documents.indexes.models.SearchIndexerDataSourceConnection

async create_data_source_connection(data_source_connection: SearchIndexerDataSourceConnection, **kwargs: Any) -> SearchIndexerDataSourceConnection

Examples

Create a SearchIndexerDataSourceConnection


   container = SearchIndexerDataContainer(name="searchcontainer")
   data_source = SearchIndexerDataSourceConnection(
       name="async-sample-data-source-connection",
       type="azureblob",
       connection_string=connection_string,
       container=container,
   )
   result = await client.create_data_source_connection(data_source)
   print("Create new Data Source Connection - async-sample-data-source-connection")

create_indexer

Creates a new SearchIndexer.

async 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="async-indexer-datasource", type="azureblob", connection_string=connection_string, container=container
   )
   data_source = await indexers_client.create_data_source_connection(data_source_connection)

   # create an indexer
   indexer = SearchIndexer(
       name="async-sample-indexer",
       data_source_name="async-indexer-datasource",
       target_index_name="async-indexer-hotels",
   )
   result = await indexers_client.create_indexer(indexer)
   print("Create new Indexer - async-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

async 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 a indexer if it already exists.

async 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.

async 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

async 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

async 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


   await client.delete_data_source_connection("async-sample-data-source-connection")
   print("Data Source Connection 'async-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.

async delete_indexer(indexer: str | SearchIndexer, *, match_condition: MatchConditions = MatchConditions.Unconditionally, **kwargs: Any) -> None

Parameters

Name Description
indexer
Required

The name or the indexer object to delete.

Keyword-Only Parameters

Name Description
match_condition

The match condition to use upon the etag

Examples

Delete a SearchIndexer


   await indexers_client.delete_indexer("async-sample-indexer")
   print("Indexer 'async-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

async 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.

async get_data_source_connection(name: str, *, select: List[str] | None = None, **kwargs: Any) -> SearchIndexerDataSourceConnection

Parameters

Name Description
name
Required
str

The name of the data source connection to retrieve.

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
SearchIndexerDataSourceConnection<xref:Retrieve> <xref:a> SearchIndexerDataSourceConnection <xref:result> = <xref:await> <xref:client.get_data_source_connection>("<xref:async>-<xref:sample>-<xref:data>-<xref:source>-<xref:connection>") print("<xref:Retrived> <xref:Data> <xref:Source> <xref:Connection> '<xref:async>-<xref:sample>-<xref:data>-<xref:source>-<xref:connection>'") <xref:return> <xref:result>

The SearchIndexerDataSourceConnection that is fetched.

get_data_source_connection_names

Lists all data source connection names available for a search service.

async get_data_source_connection_names(**kwargs) -> 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.

async get_data_source_connections(**kwargs: Any) -> Sequence[SearchIndexerDataSourceConnection]

Returns

Type Description

List of all the data source connections.

Examples

List all SearchIndexerDataSourceConnections


   result = await client.get_data_source_connections()
   names = [x.name for x in result]
   print("Found {} Data Source Connections in the service: {}".format(len(result), ", ".join(names)))

get_indexer

Retrieves a indexer definition.

async get_indexer(name: str, **kwargs: Any) -> SearchIndexer

Parameters

Name Description
name
Required
str

The name of the indexer to retrieve.

Returns

Type Description

The SearchIndexer that is fetched.

Examples

Retrieve a SearchIndexer


   result = await indexers_client.get_indexer("async-sample-indexer")
   print("Retrived Indexer 'async-sample-indexer'")
   return result

get_indexer_names

Lists all indexer names available for a search service.

async get_indexer_names(**kwargs) -> Sequence[str]

Returns

Type Description

List of all the SearchIndexer names.

get_indexer_status

Get the status of the indexer.

async get_indexer_status(name: str, **kwargs: Any) -> SearchIndexerStatus

Parameters

Name Description
name
Required
str

The name of the indexer to fetch the status.

Returns

Type Description

SearchIndexerStatus

Examples

Get a SearchIndexer's status


   result = await indexers_client.get_indexer_status("async-sample-indexer")
   print("Retrived Indexer status for 'async-sample-indexer'")
   return result

get_indexers

Lists all indexers available for a search service.

async get_indexers(*, select: List[str] | None = None, **kwargs) -> 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 = await 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

async get_skillset(name: str, **kwargs) -> SearchIndexerSkillset

Parameters

Name Description
name
Required
str

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.

async get_skillset_names(**kwargs) -> List[str]

Returns

Type Description

List of SearchIndexerSkillset names

Exceptions

Type Description

get_skillsets

List the SearchIndexerSkillsets in an Azure Search service.

async get_skillsets(*, select: List[str] | None = None, **kwargs) -> 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.

async reset_indexer(name: str, **kwargs: Any) -> None

Parameters

Name Description
name
Required
str

The name of the indexer to reset.

Examples

Reset a SearchIndexer's change tracking state


   await indexers_client.reset_indexer("async-sample-indexer")
   print("Reset the Indexer 'async-sample-indexer'")
   return

run_indexer

Run an indexer.

async run_indexer(name: str, **kwargs: Any) -> None

Parameters

Name Description
name
Required
str

The name of the indexer to run.

Examples

Run a SearchIndexer


   await indexers_client.run_indexer("async-sample-indexer")
   print("Ran the Indexer 'async-sample-indexer'")
   return