共用方式為


SearchIndexerAsyncClient Class

  • java.lang.Object
    • com.azure.search.documents.indexes.SearchIndexerAsyncClient

public class SearchIndexerAsyncClient

This class provides a client that contains the operations for creating, getting, listing, updating, or deleting data source connections, indexers, or skillsets and running or resetting indexers in an Azure AI Search service.

Overview

Indexers provide indexing automation. An indexer connects to a data source, reads in the data, and passes it to a skillset pipeline for indexing into a target search index. Indexers read from an external source using connection information in a data source, and serialize the incoming data into JSON search documents. In addition to a data source, an indexer also requires an index. The index specifies the fields and attributes of the search documents.

A skillset adds external processing steps to indexer execution, and is usually used to add AI or deep learning models to analyze or transform content to make it searchable in an index. The contents of a skillset are one or more skills, which can be built-in skills created by Microsoft, custom skills, or a combination of both. Built-in skills exist for image analysis, including OCR, and natural language processing. Other examples of built-in skills include entity recognition, key phrase extraction, chunking text into logical pages, among others. A skillset is high-level standalone object that exists on a level equivalent to indexes, indexers, and data sources, but it's operational only within indexer processing. As a high-level object, you can design a skillset once, and then reference it in multiple indexers.

This client provides an asynchronous API for accessing indexers and skillsets. This client allows you to create, update, list, or delete indexers and skillsets. It can also be used to run or reset indexers.

Getting Started

Authenticating and building instances of this client are handled by SearchIndexerClientBuilder. This sample shows you how to authenticate and build this client:

SearchIndexerAsyncClient searchIndexerAsyncClient = new SearchIndexerClientBuilder()
     .endpoint("{endpoint}")
     .credential(new AzureKeyCredential("{admin-key}"))
     .buildAsyncClient();

For more information on authentication and building, see the SearchIndexerClientBuilder documentation.

Examples

The following examples all use a simple Hotel data set that you can import into your own index from the Azure portal. These are just a few of the basics - please check out our Samples for much more.

Create an Indexer

The following sample creates an indexer.

SearchIndexer indexer = new SearchIndexer("example-indexer", "example-datasource", "example-index");
 SearchIndexer createdIndexer = searchIndexerAsyncClient.createIndexer(indexer).block();
 if (createdIndexer != null) {
     System.out.printf("Created indexer name: %s%n", createdIndexer.getName());
 }

For a synchronous sample, see createIndexer(SearchIndexer indexer).

List all Indexers

The following sample lists all indexers.

searchIndexerAsyncClient.listIndexers().subscribe(indexer ->
     System.out.printf("Retrieved indexer name: %s%n", indexer.getName())
 );

For a synchronous sample, see listIndexers().

Get an Indexer

The following sample gets an indexer.

SearchIndexer indexer = searchIndexerAsyncClient.getIndexer("example-indexer").block();
 if (indexer != null) {
     System.out.printf("Retrieved indexer name: %s%n", indexer.getName());
 }

For a synchronous sample, see getIndexer(String indexerName).

Update an Indexer

The following sample updates an indexer.

SearchIndexer indexer = searchIndexerAsyncClient.getIndexer("example-indexer").block();
 if (indexer != null) {
     System.out.printf("Retrieved indexer name: %s%n", indexer.getName());
     indexer.setDescription("This is a new description for this indexer");
     SearchIndexer updatedIndexer = searchIndexerAsyncClient.createOrUpdateIndexer(indexer).block();

     if (updatedIndexer != null) {
         System.out.printf("Updated indexer name: %s, description: %s%n", updatedIndexer.getName(),
             updatedIndexer.getDescription());
     }
 }

For a synchronous sample, see createOrUpdateIndexer(SearchIndexer indexer).

Delete an Indexer

The following sample deletes an indexer.

searchIndexerAsyncClient.deleteIndexer("example-indexer");

For a synchronous sample, see deleteIndexer(String indexerName).

Run an Indexer

The following sample runs an indexer.

searchIndexerAsyncClient.runIndexer("example-indexer");

For a synchronous sample, see runIndexer(String indexerName).

Reset an Indexer

The following sample resets an indexer.

searchIndexerAsyncClient.resetIndexer("example-indexer");

For a synchronous sample, see resetIndexer(String indexerName).

Create a Skillset

The following sample creates a skillset.

List<InputFieldMappingEntry> inputs = Collections.singletonList(
     new InputFieldMappingEntry("image")
         .setSource("/document/normalized_images/*")
 );

 List<OutputFieldMappingEntry> outputs = Arrays.asList(
     new OutputFieldMappingEntry("text")
         .setTargetName("mytext"),
     new OutputFieldMappingEntry("layoutText")
         .setTargetName("myLayoutText")
 );

 List<SearchIndexerSkill> skills = Collections.singletonList(
     new OcrSkill(inputs, outputs)
         .setShouldDetectOrientation(true)
         .setDefaultLanguageCode(null)
         .setName("myocr")
         .setDescription("Extracts text (plain and structured) from image.")
         .setContext("/document/normalized_images/*")
 );

 SearchIndexerSkillset skillset = new SearchIndexerSkillset("skillsetName", skills)
     .setDescription("Extracts text (plain and structured) from image.");

 System.out.println(String.format("Creating OCR skillset '%s'", skillset.getName()));

 SearchIndexerSkillset createdSkillset = searchIndexerAsyncClient.createSkillset(skillset).block();

 if (createdSkillset != null) {
     System.out.println("Created OCR skillset");
     System.out.println(String.format("Name: %s", createdSkillset.getName()));
     System.out.println(String.format("ETag: %s", createdSkillset.getETag()));
 }

For a synchronous sample, see createSkillset(SearchIndexerSkillset skillset).

List all Skillsets

The following sample lists all skillsets.

searchIndexerAsyncClient.listSkillsets().subscribe(skillset ->
     System.out.printf("Retrieved skillset name: %s%n", skillset.getName())
 );

For a synchronous sample, see listSkillsets().

Get a Skillset

The following sample gets a skillset.

SearchIndexerSkillset skillset = searchIndexerAsyncClient.getSkillset("example-skillset").block();
 if (skillset != null) {
     System.out.printf("Retrieved skillset name: %s%n", skillset.getName());
 }

For a synchronous sample, see getSkillset(String skillsetName).

Update a Skillset

The following sample updates a skillset.

SearchIndexerSkillset skillset = searchIndexerAsyncClient.getSkillset("example-skillset").block();
 if (skillset != null) {
     System.out.printf("Retrieved skillset name: %s%n", skillset.getName());
     SearchIndexerSkillset updatedSkillset = searchIndexerAsyncClient.createOrUpdateSkillset(skillset).block();

     if (updatedSkillset != null) {
         System.out.printf("Updated skillset name: %s, description: %s%n", updatedSkillset.getName(),
             updatedSkillset.getDescription());
     }
 }

For a synchronous sample, see createOrUpdateSkillset(SearchIndexerSkillset skillset).

Delete a Skillset

The following sample deletes a skillset.

searchIndexerAsyncClient.deleteSkillset("example-skillset");

For a synchronous sample, see deleteSkillset(String skillsetName).

Method Summary

Modifier and Type Method and Description
Mono<SearchIndexerDataSourceConnection> createDataSourceConnection(SearchIndexerDataSourceConnection dataSource)

Creates a new Azure AI Search data source

Mono<Response<SearchIndexerDataSourceConnection>> createDataSourceConnectionWithResponse(SearchIndexerDataSourceConnection dataSource)

Creates a new Azure AI Search data source

Mono<SearchIndexer> createIndexer(SearchIndexer indexer)

Creates a new Azure AI Search indexer.

Mono<Response<SearchIndexer>> createIndexerWithResponse(SearchIndexer indexer)

Creates a new Azure AI Search indexer.

Mono<SearchIndexerDataSourceConnection> createOrUpdateDataSourceConnection(SearchIndexerDataSourceConnection dataSource)

Creates a new Azure AI Search data source or updates a data source if it already exists.

Mono<Response<SearchIndexerDataSourceConnection>> createOrUpdateDataSourceConnectionWithResponse(SearchIndexerDataSourceConnection dataSource, boolean onlyIfUnchanged)

Creates a new Azure AI Search data source or updates a data source if it already exists.

Mono<SearchIndexer> createOrUpdateIndexer(SearchIndexer indexer)

Creates a new Azure AI Search indexer or updates an indexer if it already exists.

Mono<Response<SearchIndexer>> createOrUpdateIndexerWithResponse(SearchIndexer indexer, boolean onlyIfUnchanged)

Creates a new Azure AI Search indexer or updates an indexer if it already exists.

Mono<SearchIndexerSkillset> createOrUpdateSkillset(SearchIndexerSkillset skillset)

Creates a new Azure AI Search skillset or updates a skillset if it already exists.

Mono<Response<SearchIndexerSkillset>> createOrUpdateSkillsetWithResponse(SearchIndexerSkillset skillset, boolean onlyIfUnchanged)

Creates a new Azure AI Search skillset or updates a skillset if it already exists.

Mono<SearchIndexerSkillset> createSkillset(SearchIndexerSkillset skillset)

Creates a new skillset in an Azure AI Search service.

Mono<Response<SearchIndexerSkillset>> createSkillsetWithResponse(SearchIndexerSkillset skillset)

Creates a new skillset in an Azure AI Search service.

Mono<Void> deleteDataSourceConnection(String dataSourceName)

Delete a DataSource

Mono<Response<Void>> deleteDataSourceConnectionWithResponse(SearchIndexerDataSourceConnection dataSource, boolean onlyIfUnchanged)

Deletes an Azure AI Search data source.

Mono<Void> deleteIndexer(String indexerName)

Deletes an Azure AI Search indexer.

Mono<Response<Void>> deleteIndexerWithResponse(SearchIndexer indexer, boolean onlyIfUnchanged)

Deletes an Azure AI Search indexer.

Mono<Void> deleteSkillset(String skillsetName)

Deletes a cognitive skillset in an Azure AI Search service.

Mono<Response<Void>> deleteSkillsetWithResponse(SearchIndexerSkillset skillset, boolean onlyIfUnchanged)

Deletes a cognitive skillset in an Azure AI Search service.

Mono<SearchIndexerDataSourceConnection> getDataSourceConnection(String dataSourceName)

Retrieves a DataSource from an Azure AI Search service.

Mono<Response<SearchIndexerDataSourceConnection>> getDataSourceConnectionWithResponse(String dataSourceName)

Retrieves a DataSource from an Azure AI Search service.

String getEndpoint()

Gets the endpoint for the Azure AI Search service.

Mono<SearchIndexer> getIndexer(String indexerName)

Retrieves an indexer definition.

Mono<SearchIndexerStatus> getIndexerStatus(String indexerName)

Returns the current status and execution history of an indexer.

Mono<Response<SearchIndexerStatus>> getIndexerStatusWithResponse(String indexerName)

Returns the current status and execution history of an indexer.

Mono<Response<SearchIndexer>> getIndexerWithResponse(String indexerName)

Retrieves an indexer definition.

Mono<SearchIndexerSkillset> getSkillset(String skillsetName)

Retrieves a skillset definition.

Mono<Response<SearchIndexerSkillset>> getSkillsetWithResponse(String skillsetName)

Retrieves a skillset definition.

PagedFlux<String> listDataSourceConnectionNames()

List all DataSource names from an Azure AI Search service.

PagedFlux<SearchIndexerDataSourceConnection> listDataSourceConnections()

List all DataSources from an Azure AI Search service.

PagedFlux<String> listIndexerNames()

Lists all indexers available for an Azure AI Search service.

PagedFlux<SearchIndexer> listIndexers()

Lists all indexers available for an Azure AI Search service.

PagedFlux<String> listSkillsetNames()

Lists all skillset names for an Azure AI Search service.

PagedFlux<SearchIndexerSkillset> listSkillsets()

Lists all skillsets available for an Azure AI Search service.

Mono<Void> resetIndexer(String indexerName)

Resets the change tracking state associated with an indexer.

Mono<Response<Void>> resetIndexerWithResponse(String indexerName)

Resets the change tracking state associated with an indexer.

Mono<Void> runIndexer(String indexerName)

Runs an indexer on-demand.

Mono<Response<Void>> runIndexerWithResponse(String indexerName)

Runs an indexer on-demand.

Methods inherited from java.lang.Object

Method Details

createDataSourceConnection

public Mono createDataSourceConnection(SearchIndexerDataSourceConnection dataSource)

Creates a new Azure AI Search data source

Code Sample

Create search indexer data source connection named "dataSource".

SearchIndexerDataSourceConnection dataSource = new SearchIndexerDataSourceConnection("dataSource",
     com.azure.search.documents.indexes.models.SearchIndexerDataSourceType.AZURE_BLOB, "{connectionString}",
     new com.azure.search.documents.indexes.models.SearchIndexerDataContainer("container"));
 SEARCH_INDEXER_ASYNC_CLIENT.createDataSourceConnection(dataSource)
     .subscribe(dataSourceFromService ->
         System.out.printf("The data source name is %s. The ETag of data source is %s.%n",
             dataSourceFromService.getName(), dataSourceFromService.getETag()));

Parameters:

dataSource - The definition of the dataSource to create.

Returns:

a Mono which performs the network request upon subscription.

createDataSourceConnectionWithResponse

public Mono> createDataSourceConnectionWithResponse(SearchIndexerDataSourceConnection dataSource)

Creates a new Azure AI Search data source

Code Sample

Create search indexer data source connection named "dataSource".

SearchIndexerDataSourceConnection dataSource = new SearchIndexerDataSourceConnection("dataSource",
     SearchIndexerDataSourceType.AZURE_BLOB, "{connectionString}",
     new SearchIndexerDataContainer("container"));
 SEARCH_INDEXER_ASYNC_CLIENT.createDataSourceConnectionWithResponse(dataSource)
     .subscribe(dataSourceFromService ->
         System.out.printf("The status code of the response is %s. The data source name is %s.%n",
         dataSourceFromService.getStatusCode(), dataSourceFromService.getValue().getName()));

Parameters:

dataSource - The definition of the SearchIndexerDataSourceConnection to create.

Returns:

a Mono which performs the network request upon subscription.

createIndexer

public Mono createIndexer(SearchIndexer indexer)

Creates a new Azure AI Search indexer.

Code Sample

Create search indexer named "searchIndexer".

SearchIndexer searchIndexer = new SearchIndexer("searchIndexer", "dataSource",
     "searchIndex");
 SEARCH_INDEXER_ASYNC_CLIENT.createIndexer(searchIndexer)
     .subscribe(indexerFromService ->
         System.out.printf("The indexer name is %s. The ETag of indexer is %s.%n", indexerFromService.getName(),
         indexerFromService.getETag()));

Parameters:

indexer - definition of the indexer to create.

Returns:

the created Indexer.

createIndexerWithResponse

public Mono> createIndexerWithResponse(SearchIndexer indexer)

Creates a new Azure AI Search indexer.

Code Sample

Create search indexer named "searchIndexer".

SearchIndexer searchIndexer = new SearchIndexer("searchIndexer", "dataSource",
     "searchIndex");
 SEARCH_INDEXER_ASYNC_CLIENT.createIndexerWithResponse(searchIndexer)
     .subscribe(indexerFromServiceResponse ->
         System.out.printf("The status code of the response is %s. The indexer name is %s.%n",
             indexerFromServiceResponse.getStatusCode(), indexerFromServiceResponse.getValue().getName()));

Parameters:

indexer - definition of the indexer to create

Returns:

a response containing the created Indexer.

createOrUpdateDataSourceConnection

public Mono createOrUpdateDataSourceConnection(SearchIndexerDataSourceConnection dataSource)

Creates a new Azure AI Search data source or updates a data source if it already exists.

Code Sample

Create or update search indexer data source connection named "dataSource".

SearchIndexerDataSourceConnection dataSource = SEARCH_INDEXER_CLIENT.getDataSourceConnection("dataSource");
 dataSource.setContainer(new SearchIndexerDataContainer("updatecontainer"));

 SearchIndexerDataSourceConnection updateDataSource = SEARCH_INDEXER_CLIENT
     .createOrUpdateDataSourceConnection(dataSource);
 System.out.printf("The dataSource name is %s. The container name of dataSource is %s.%n",
     updateDataSource.getName(), updateDataSource.getContainer().getName());

Parameters:

dataSource - The definition of the SearchIndexerDataSourceConnection to create or update.

Returns:

the data source that was created or updated.

createOrUpdateDataSourceConnectionWithResponse

public Mono> createOrUpdateDataSourceConnectionWithResponse(SearchIndexerDataSourceConnection dataSource, boolean onlyIfUnchanged)

Creates a new Azure AI Search data source or updates a data source if it already exists.

Code Sample

Create or update search indexer data source connection named "dataSource".

SEARCH_INDEXER_ASYNC_CLIENT.getDataSourceConnection("dataSource")
     .flatMap(dataSource -> {
         dataSource.setContainer(new SearchIndexerDataContainer("updatecontainer"));
         return SEARCH_INDEXER_ASYNC_CLIENT.createOrUpdateDataSourceConnectionWithResponse(dataSource, true);
     })
     .subscribe(updateDataSource ->
         System.out.printf("The status code of the response is %s.%nThe dataSource name is %s. "
             + "The container name of dataSource is %s.%n", updateDataSource.getStatusCode(),
         updateDataSource.getValue().getName(), updateDataSource.getValue().getContainer().getName()));

Parameters:

dataSource - The definition of the SearchIndexerDataSourceConnection to create or update.
onlyIfUnchanged - true to update if the dataSource is the same as the current service value. false to always update existing value.

Returns:

a data source response.

createOrUpdateIndexer

public Mono createOrUpdateIndexer(SearchIndexer indexer)

Creates a new Azure AI Search indexer or updates an indexer if it already exists.

Code Sample

Create or update search indexer named "searchIndexer".

SEARCH_INDEXER_ASYNC_CLIENT.getIndexer("searchIndexer")
     .flatMap(searchIndexerFromService -> {
         searchIndexerFromService.setFieldMappings(Collections.singletonList(
             new FieldMapping("hotelName").setTargetFieldName("HotelName")));
         return SEARCH_INDEXER_ASYNC_CLIENT.createOrUpdateIndexer(searchIndexerFromService);
     })
     .subscribe(updatedIndexer ->
         System.out.printf("The indexer name is %s. The target field name of indexer is %s.%n",
         updatedIndexer.getName(), updatedIndexer.getFieldMappings().get(0).getTargetFieldName()));

Parameters:

indexer - The definition of the indexer to create or update.

Returns:

a response containing the created Indexer.

createOrUpdateIndexerWithResponse

public Mono> createOrUpdateIndexerWithResponse(SearchIndexer indexer, boolean onlyIfUnchanged)

Creates a new Azure AI Search indexer or updates an indexer if it already exists.

Code Sample

Create or update search indexer named "searchIndexer".

SEARCH_INDEXER_ASYNC_CLIENT.getIndexer("searchIndexer")
     .flatMap(searchIndexerFromService -> {
         searchIndexerFromService.setFieldMappings(Collections.singletonList(
             new FieldMapping("hotelName").setTargetFieldName("HotelName")));
         return SEARCH_INDEXER_ASYNC_CLIENT.createOrUpdateIndexerWithResponse(searchIndexerFromService, true);
     })
     .subscribe(indexerFromService ->
         System.out.printf("The status code of the response is %s.%nThe indexer name is %s. "
             + "The target field name of indexer is %s.%n", indexerFromService.getStatusCode(),
         indexerFromService.getValue().getName(),
         indexerFromService.getValue().getFieldMappings().get(0).getTargetFieldName()));

Parameters:

indexer - the definition of the SearchIndexer to create or update
onlyIfUnchanged - true to update if the indexer is the same as the current service value. false to always update existing value.

Returns:

a response containing the created Indexer.

createOrUpdateSkillset

public Mono createOrUpdateSkillset(SearchIndexerSkillset skillset)

Creates a new Azure AI Search skillset or updates a skillset if it already exists.

Code Sample

Create or update search indexer skillset "searchIndexerSkillset".

SEARCH_INDEXER_ASYNC_CLIENT.getSkillset("searchIndexerSkillset")
     .flatMap(indexerSkillset -> {
         indexerSkillset.setDescription("This is new description!");
         return SEARCH_INDEXER_ASYNC_CLIENT.createOrUpdateSkillset(indexerSkillset);
     }).subscribe(updateSkillset ->
         System.out.printf("The indexer skillset name is %s. The description of indexer skillset is %s.%n",
         updateSkillset.getName(), updateSkillset.getDescription()));

Parameters:

skillset - the definition of the skillset to create or update

Returns:

the skillset that was created or updated.

createOrUpdateSkillsetWithResponse

public Mono> createOrUpdateSkillsetWithResponse(SearchIndexerSkillset skillset, boolean onlyIfUnchanged)

Creates a new Azure AI Search skillset or updates a skillset if it already exists.

Code Sample

Create or update search indexer skillset "searchIndexerSkillset".

SEARCH_INDEXER_ASYNC_CLIENT.getSkillset("searchIndexerSkillset")
     .flatMap(indexerSkillset -> {
         indexerSkillset.setDescription("This is new description!");
         return SEARCH_INDEXER_ASYNC_CLIENT.createOrUpdateSkillsetWithResponse(indexerSkillset, true);
     })
     .subscribe(updateSkillsetResponse ->
         System.out.printf("The status code of the response is %s.%nThe indexer skillset name is %s. "
             + "The description of indexer skillset is %s.%n", updateSkillsetResponse.getStatusCode(),
         updateSkillsetResponse.getValue().getName(),
         updateSkillsetResponse.getValue().getDescription()));

Parameters:

skillset - the definition of the skillset to create or update
onlyIfUnchanged - true to update if the skillset is the same as the current service value. false to always update existing value.

Returns:

a response containing the skillset that was created or updated.

createSkillset

public Mono createSkillset(SearchIndexerSkillset skillset)

Creates a new skillset in an Azure AI Search service.

Code Sample

Create search indexer skillset "searchIndexerSkillset".

List<InputFieldMappingEntry> inputs = Collections.singletonList(
     new InputFieldMappingEntry("image")
         .setSource("/document/normalized_images/*")
 );

 List<OutputFieldMappingEntry> outputs = Arrays.asList(
     new OutputFieldMappingEntry("text")
         .setTargetName("mytext"),
     new OutputFieldMappingEntry("layoutText")
         .setTargetName("myLayoutText")
 );
 SearchIndexerSkillset searchIndexerSkillset = new SearchIndexerSkillset("searchIndexerSkillset",
     Collections.singletonList(new OcrSkill(inputs, outputs)
         .setShouldDetectOrientation(true)
         .setDefaultLanguageCode(null)
         .setName("myocr")
         .setDescription("Extracts text (plain and structured) from image.")
         .setContext("/document/normalized_images/*")));
 SEARCH_INDEXER_ASYNC_CLIENT.createSkillset(searchIndexerSkillset)
     .subscribe(skillset ->
         System.out.printf("The indexer skillset name is %s. The ETag of indexer skillset is %s.%n",
         skillset.getName(), skillset.getETag()));

Parameters:

skillset - definition of the skillset containing one or more cognitive skills

Returns:

the created Skillset.

createSkillsetWithResponse

public Mono> createSkillsetWithResponse(SearchIndexerSkillset skillset)

Creates a new skillset in an Azure AI Search service.

Code Sample

Create search indexer skillset "searchIndexerSkillset".

List<InputFieldMappingEntry> inputs = Collections.singletonList(
     new InputFieldMappingEntry("image")
         .setSource("/document/normalized_images/*")
 );

 List<OutputFieldMappingEntry> outputs = Arrays.asList(
     new OutputFieldMappingEntry("text")
         .setTargetName("mytext"),
     new OutputFieldMappingEntry("layoutText")
         .setTargetName("myLayoutText")
 );
 SearchIndexerSkillset searchIndexerSkillset = new SearchIndexerSkillset("searchIndexerSkillset",
     Collections.singletonList(new OcrSkill(inputs, outputs)
         .setShouldDetectOrientation(true)
         .setDefaultLanguageCode(null)
         .setName("myocr")
         .setDescription("Extracts text (plain and structured) from image.")
         .setContext("/document/normalized_images/*")));
 SEARCH_INDEXER_ASYNC_CLIENT.createSkillsetWithResponse(searchIndexerSkillset)
     .subscribe(skillsetWithResponse ->
         System.out.printf("The status code of the response is %s. The indexer skillset name is %s.%n",
         skillsetWithResponse.getStatusCode(), skillsetWithResponse.getValue().getName()));

Parameters:

skillset - definition of the skillset containing one or more cognitive skills

Returns:

a response containing the created Skillset.

deleteDataSourceConnection

public Mono deleteDataSourceConnection(String dataSourceName)

Delete a DataSource

Code Sample

Delete the search indexer data source connection named "dataSource".

SEARCH_INDEXER_ASYNC_CLIENT.deleteDataSourceConnection("dataSource")
     .subscribe();

Parameters:

dataSourceName - the name of the SearchIndexerDataSourceConnection for deletion

Returns:

a void Mono

deleteDataSourceConnectionWithResponse

public Mono> deleteDataSourceConnectionWithResponse(SearchIndexerDataSourceConnection dataSource, boolean onlyIfUnchanged)

Deletes an Azure AI Search data source.

Code Sample

Delete the search indexer data source connection named "dataSource".

SEARCH_INDEXER_ASYNC_CLIENT.getDataSourceConnection("dataSource")
     .flatMap(dataSource -> SEARCH_INDEXER_ASYNC_CLIENT.deleteDataSourceConnectionWithResponse(dataSource, true))
     .subscribe(deleteResponse ->
         System.out.printf("The status code of the response is %d.%n", deleteResponse.getStatusCode()));

Parameters:

dataSource - The SearchIndexerDataSourceConnection to delete.
onlyIfUnchanged - true to delete if the dataSource is the same as the current service value. false to always delete existing value.

Returns:

a mono response

deleteIndexer

public Mono deleteIndexer(String indexerName)

Deletes an Azure AI Search indexer.

Code Sample

Delete search indexer named "searchIndexer".

SEARCH_INDEXER_ASYNC_CLIENT.deleteIndexer("searchIndexer")
     .subscribe();

Parameters:

indexerName - the name of the indexer to delete

Returns:

a response signalling completion.

deleteIndexerWithResponse

public Mono> deleteIndexerWithResponse(SearchIndexer indexer, boolean onlyIfUnchanged)

Deletes an Azure AI Search indexer.

Code Sample

Delete search indexer named "searchIndexer".

SEARCH_INDEXER_ASYNC_CLIENT.getIndexer("searchIndexer")
     .flatMap(searchIndexer ->
         SEARCH_INDEXER_ASYNC_CLIENT.deleteIndexerWithResponse(searchIndexer, true))
     .subscribe(deleteResponse ->
         System.out.printf("The status code of the response is %d.%n", deleteResponse.getStatusCode()));

Parameters:

indexer - the SearchIndexer to delete
onlyIfUnchanged - true to delete if the indexer is the same as the current service value. false to always delete existing value.

Returns:

a response signalling completion.

deleteSkillset

public Mono deleteSkillset(String skillsetName)

Deletes a cognitive skillset in an Azure AI Search service.

Code Sample

Delete search indexer skillset "searchIndexerSkillset".

SEARCH_INDEXER_ASYNC_CLIENT.deleteSkillset("searchIndexerSkillset")
     .subscribe();

Parameters:

skillsetName - the name of the skillset to delete

Returns:

a response signalling completion.

deleteSkillsetWithResponse

public Mono> deleteSkillsetWithResponse(SearchIndexerSkillset skillset, boolean onlyIfUnchanged)

Deletes a cognitive skillset in an Azure AI Search service.

Code Sample

Delete search indexer skillset "searchIndexerSkillset".

SEARCH_INDEXER_ASYNC_CLIENT.getSkillset("searchIndexerSkillset")
     .flatMap(searchIndexerSkillset ->
         SEARCH_INDEXER_ASYNC_CLIENT.deleteSkillsetWithResponse(searchIndexerSkillset, true))
     .subscribe(deleteResponse ->
         System.out.printf("The status code of the response is %d.%n", deleteResponse.getStatusCode()));

Parameters:

skillset - the SearchIndexerSkillset to delete.
onlyIfUnchanged - true to delete if the skillset is the same as the current service value. false to always delete existing value.

Returns:

a response signalling completion.

getDataSourceConnection

public Mono getDataSourceConnection(String dataSourceName)

Retrieves a DataSource from an Azure AI Search service.

Code Sample

Get search indexer data source connection named "dataSource".

SEARCH_INDEXER_ASYNC_CLIENT.getDataSourceConnection("dataSource")
     .subscribe(dataSource ->
         System.out.printf("The dataSource name is %s. The ETag of dataSource is %s.%n", dataSource.getName(),
         dataSource.getETag()));

Parameters:

dataSourceName - the name of the SearchIndexerDataSourceConnection to retrieve.

Returns:

the DataSource.

getDataSourceConnectionWithResponse

public Mono> getDataSourceConnectionWithResponse(String dataSourceName)

Retrieves a DataSource from an Azure AI Search service.

Code Sample

Get search indexer data source connection named "dataSource".

SEARCH_INDEXER_ASYNC_CLIENT.getDataSourceConnectionWithResponse("dataSource")
     .subscribe(dataSource ->
         System.out.printf("The status code of the response is %s. The data source name is %s.%n",
         dataSource.getStatusCode(), dataSource.getValue().getName()));

Parameters:

dataSourceName - the name of the SearchIndexerDataSourceConnection to retrieve.

Returns:

a response containing the DataSource.

getEndpoint

public String getEndpoint()

Gets the endpoint for the Azure AI Search service.

Returns:

the endpoint value.

getIndexer

public Mono getIndexer(String indexerName)

Retrieves an indexer definition.

Code Sample

Get search indexer with name "searchIndexer".

SEARCH_INDEXER_ASYNC_CLIENT.getIndexer("searchIndexer")
     .subscribe(indexerFromService ->
         System.out.printf("The indexer name is %s. The ETag of indexer is %s.%n", indexerFromService.getName(),
             indexerFromService.getETag()));

Parameters:

indexerName - the name of the indexer to retrieve

Returns:

the indexer.

getIndexerStatus

public Mono getIndexerStatus(String indexerName)

Returns the current status and execution history of an indexer.

Code Sample

Get status for search indexer "searchIndexer".

SEARCH_INDEXER_ASYNC_CLIENT.getIndexerStatus("searchIndexer")
     .subscribe(indexerStatus ->
         System.out.printf("The indexer status is %s.%n", indexerStatus.getStatus()));

Parameters:

indexerName - the name of the indexer for which to retrieve status

Returns:

the indexer execution info.

getIndexerStatusWithResponse

public Mono> getIndexerStatusWithResponse(String indexerName)

Returns the current status and execution history of an indexer.

Code Sample

Get search indexer status.

SEARCH_INDEXER_ASYNC_CLIENT.getIndexerStatusWithResponse("searchIndexer")
     .subscribe(response ->
         System.out.printf("The status code of the response is %s.%nThe indexer status is %s.%n",
         response.getStatusCode(), response.getValue().getStatus()));

Parameters:

indexerName - the name of the indexer for which to retrieve status

Returns:

a response with the indexer execution info.

getIndexerWithResponse

public Mono> getIndexerWithResponse(String indexerName)

Retrieves an indexer definition.

Code Sample

Get search indexer with name "searchIndexer".

SEARCH_INDEXER_ASYNC_CLIENT.getIndexerWithResponse("searchIndexer")
     .subscribe(indexerFromServiceResponse ->
         System.out.printf("The status code of the response is %s. The indexer name is %s.%n",
         indexerFromServiceResponse.getStatusCode(), indexerFromServiceResponse.getValue().getName()));

Parameters:

indexerName - the name of the indexer to retrieve

Returns:

a response containing the indexer.

getSkillset

public Mono getSkillset(String skillsetName)

Retrieves a skillset definition.

Code Sample

Get search indexer skillset "searchIndexerSkillset".

SEARCH_INDEXER_ASYNC_CLIENT.getSkillset("searchIndexerSkillset")
     .subscribe(indexerSkillset ->
         System.out.printf("The indexer skillset name is %s. The ETag of indexer skillset is %s.%n",
         indexerSkillset.getName(), indexerSkillset.getETag()));

Parameters:

skillsetName - the name of the skillset to retrieve

Returns:

the Skillset.

getSkillsetWithResponse

public Mono> getSkillsetWithResponse(String skillsetName)

Retrieves a skillset definition.

Code Sample

Get search indexer skillset "searchIndexerSkillset".

SEARCH_INDEXER_ASYNC_CLIENT.getSkillsetWithResponse("searchIndexerSkillset")
     .subscribe(skillsetWithResponse ->
         System.out.printf("The status code of the response is %s. The indexer skillset name is %s.%n",
         skillsetWithResponse.getStatusCode(), skillsetWithResponse.getValue().getName()));

Parameters:

skillsetName - the name of the skillset to retrieve

Returns:

a response containing the Skillset.

listDataSourceConnectionNames

public PagedFlux listDataSourceConnectionNames()

List all DataSource names from an Azure AI Search service.

Code Sample

List all search indexer data source connection names.

SEARCH_INDEXER_ASYNC_CLIENT.listDataSourceConnectionNames()
     .subscribe(dataSourceName -> System.out.printf("The dataSource name is %s.%n", dataSourceName));

Returns:

a list of DataSource names

listDataSourceConnections

public PagedFlux listDataSourceConnections()

List all DataSources from an Azure AI Search service.

Code Sample

List all search indexer data source connections.

SEARCH_INDEXER_ASYNC_CLIENT.listDataSourceConnections()
     .subscribe(dataSource ->
         System.out.printf("The dataSource name is %s. The ETag of dataSource is %s.%n",
             dataSource.getName(), dataSource.getETag())
     );

Returns:

a list of DataSources

listIndexerNames

public PagedFlux listIndexerNames()

Lists all indexers available for an Azure AI Search service.

Code Sample

List all search indexer names.

SEARCH_INDEXER_ASYNC_CLIENT.listIndexerNames()
     .subscribe(indexerName -> System.out.printf("The indexer name is %s.%n", indexerName));

Returns:

a response containing all Indexers from the Search service.

listIndexers

public PagedFlux listIndexers()

Lists all indexers available for an Azure AI Search service.

Code Sample

List all search indexers.

SEARCH_INDEXER_ASYNC_CLIENT.listIndexers()
     .subscribe(indexer ->
         System.out.printf("The indexer name is %s. The ETag of indexer is %s.%n", indexer.getName(),
         indexer.getETag()));

Returns:

a response containing all Indexers from the Search service.

listSkillsetNames

public PagedFlux listSkillsetNames()

Lists all skillset names for an Azure AI Search service.

Code Sample

List all search indexer skillset names.

SEARCH_INDEXER_ASYNC_CLIENT.listSkillsetNames()
     .subscribe(skillsetName -> System.out.printf("The indexer skillset name is %s.%n", skillsetName));

Returns:

a reactive response emitting the list of skillset names.

listSkillsets

public PagedFlux listSkillsets()

Lists all skillsets available for an Azure AI Search service.

Code Sample

List all search indexer skillsets.

SEARCH_INDEXER_ASYNC_CLIENT.listSkillsets()
     .subscribe(skillset ->
         System.out.printf("The skillset name is %s. The ETag of skillset is %s.%n", skillset.getName(),
         skillset.getETag()));

Returns:

a reactive response emitting the list of skillsets.

resetIndexer

public Mono resetIndexer(String indexerName)

Resets the change tracking state associated with an indexer.

Code Sample

Reset search indexer named "searchIndexer".

SEARCH_INDEXER_ASYNC_CLIENT.resetIndexer("searchIndexer")
     .subscribe();

Parameters:

indexerName - the name of the indexer to reset

Returns:

a response signalling completion.

resetIndexerWithResponse

public Mono> resetIndexerWithResponse(String indexerName)

Resets the change tracking state associated with an indexer.

Code Sample

Reset search indexer named "searchIndexer".

SEARCH_INDEXER_ASYNC_CLIENT.resetIndexerWithResponse("searchIndexer")
     .subscribe(response ->
         System.out.println("The status code of the response is " + response.getStatusCode()));

Parameters:

indexerName - the name of the indexer to reset

Returns:

a response signalling completion.

runIndexer

public Mono runIndexer(String indexerName)

Runs an indexer on-demand.

Code Sample

Run search indexer named "searchIndexer".

SEARCH_INDEXER_ASYNC_CLIENT.runIndexer("searchIndexer")
     .subscribe();

Parameters:

indexerName - the name of the indexer to run

Returns:

a response signalling completion.

runIndexerWithResponse

public Mono> runIndexerWithResponse(String indexerName)

Runs an indexer on-demand.

Code Sample

Run search indexer named "searchIndexer".

SEARCH_INDEXER_ASYNC_CLIENT.runIndexerWithResponse("searchIndexer")
     .subscribe(response ->
         System.out.println("The status code of the response is " + response.getStatusCode()));

Parameters:

indexerName - the name of the indexer to run

Returns:

a response signalling completion.

Applies to