Class SearchIndexerAsyncClient
- java.lang.Object
-
- com.azure.search.documents.indexes.SearchIndexerAsyncClient
-
public class SearchIndexerAsyncClient extends Object
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 Cognitive Search service.- See Also:
SearchIndexerClientBuilder
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Mono<SearchIndexerDataSourceConnection>
createDataSourceConnection(SearchIndexerDataSourceConnection dataSource)
Creates a new Azure Cognitive Search data sourceMono<com.azure.core.http.rest.Response<SearchIndexerDataSourceConnection>>
createDataSourceConnectionWithResponse(SearchIndexerDataSourceConnection dataSource)
Creates a new Azure Cognitive Search data sourceMono<SearchIndexer>
createIndexer(SearchIndexer indexer)
Creates a new Azure Cognitive Search indexer.Mono<com.azure.core.http.rest.Response<SearchIndexer>>
createIndexerWithResponse(SearchIndexer indexer)
Creates a new Azure Cognitive Search indexer.Mono<SearchIndexerDataSourceConnection>
createOrUpdateDataSourceConnection(SearchIndexerDataSourceConnection dataSource)
Creates a new Azure Cognitive Search data source or updates a data source if it already exists.Mono<com.azure.core.http.rest.Response<SearchIndexerDataSourceConnection>>
createOrUpdateDataSourceConnectionWithResponse(CreateOrUpdateDataSourceConnectionOptions options)
Creates a new Azure Cognitive Search data source or updates a data source if it already exists.Mono<com.azure.core.http.rest.Response<SearchIndexerDataSourceConnection>>
createOrUpdateDataSourceConnectionWithResponse(SearchIndexerDataSourceConnection dataSource, boolean onlyIfUnchanged)
Creates a new Azure Cognitive Search data source or updates a data source if it already exists.Mono<SearchIndexer>
createOrUpdateIndexer(SearchIndexer indexer)
Creates a new Azure Cognitive Search indexer or updates an indexer if it already exists.Mono<com.azure.core.http.rest.Response<SearchIndexer>>
createOrUpdateIndexerWithResponse(CreateOrUpdateIndexerOptions options)
Creates a new Azure Cognitive Search indexer or updates an indexer if it already exists.Mono<com.azure.core.http.rest.Response<SearchIndexer>>
createOrUpdateIndexerWithResponse(SearchIndexer indexer, boolean onlyIfUnchanged)
Creates a new Azure Cognitive Search indexer or updates an indexer if it already exists.Mono<SearchIndexerSkillset>
createOrUpdateSkillset(SearchIndexerSkillset skillset)
Creates a new Azure Cognitive Search skillset or updates a skillset if it already exists.Mono<com.azure.core.http.rest.Response<SearchIndexerSkillset>>
createOrUpdateSkillsetWithResponse(CreateOrUpdateSkillsetOptions options)
Creates a new Azure Cognitive Search skillset or updates a skillset if it already exists.Mono<com.azure.core.http.rest.Response<SearchIndexerSkillset>>
createOrUpdateSkillsetWithResponse(SearchIndexerSkillset skillset, boolean onlyIfUnchanged)
Creates a new Azure Cognitive Search skillset or updates a skillset if it already exists.Mono<SearchIndexerSkillset>
createSkillset(SearchIndexerSkillset skillset)
Creates a new skillset in an Azure Cognitive Search service.Mono<com.azure.core.http.rest.Response<SearchIndexerSkillset>>
createSkillsetWithResponse(SearchIndexerSkillset skillset)
Creates a new skillset in an Azure Cognitive Search service.Mono<Void>
deleteDataSourceConnection(String dataSourceName)
Delete a DataSourceMono<com.azure.core.http.rest.Response<Void>>
deleteDataSourceConnectionWithResponse(SearchIndexerDataSourceConnection dataSource, boolean onlyIfUnchanged)
Deletes an Azure Cognitive Search data source.Mono<Void>
deleteIndexer(String indexerName)
Deletes an Azure Cognitive Search indexer.Mono<com.azure.core.http.rest.Response<Void>>
deleteIndexerWithResponse(SearchIndexer indexer, boolean onlyIfUnchanged)
Deletes an Azure Cognitive Search indexer.Mono<Void>
deleteSkillset(String skillsetName)
Deletes a cognitive skillset in an Azure Cognitive Search service.Mono<com.azure.core.http.rest.Response<Void>>
deleteSkillsetWithResponse(SearchIndexerSkillset skillset, boolean onlyIfUnchanged)
Deletes a cognitive skillset in an Azure Cognitive Search service.Mono<SearchIndexerDataSourceConnection>
getDataSourceConnection(String dataSourceName)
Retrieves a DataSource from an Azure Cognitive Search service.Mono<com.azure.core.http.rest.Response<SearchIndexerDataSourceConnection>>
getDataSourceConnectionWithResponse(String dataSourceName)
Retrieves a DataSource from an Azure Cognitive Search service.String
getEndpoint()
Gets the endpoint for the Azure Cognitive 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<com.azure.core.http.rest.Response<SearchIndexerStatus>>
getIndexerStatusWithResponse(String indexerName)
Returns the current status and execution history of an indexer.Mono<com.azure.core.http.rest.Response<SearchIndexer>>
getIndexerWithResponse(String indexerName)
Retrieves an indexer definition.Mono<SearchIndexerSkillset>
getSkillset(String skillsetName)
Retrieves a skillset definition.Mono<com.azure.core.http.rest.Response<SearchIndexerSkillset>>
getSkillsetWithResponse(String skillsetName)
Retrieves a skillset definition.com.azure.core.http.rest.PagedFlux<String>
listDataSourceConnectionNames()
List all DataSource names from an Azure Cognitive Search service.com.azure.core.http.rest.PagedFlux<SearchIndexerDataSourceConnection>
listDataSourceConnections()
List all DataSources from an Azure Cognitive Search service.com.azure.core.http.rest.PagedFlux<String>
listIndexerNames()
Lists all indexers available for an Azure Cognitive Search service.com.azure.core.http.rest.PagedFlux<SearchIndexer>
listIndexers()
Lists all indexers available for an Azure Cognitive Search service.com.azure.core.http.rest.PagedFlux<String>
listSkillsetNames()
Lists all skillset names for an Azure Cognitive Search service.com.azure.core.http.rest.PagedFlux<SearchIndexerSkillset>
listSkillsets()
Lists all skillsets available for an Azure Cognitive Search service.Mono<Void>
resetDocuments(String indexerName, Boolean overwrite, List<String> documentKeys, List<String> datasourceDocumentIds)
Resets specific documents in the datasource to be selectively re-ingested by the indexer.Mono<com.azure.core.http.rest.Response<Void>>
resetDocumentsWithResponse(SearchIndexer indexer, Boolean overwrite, List<String> documentKeys, List<String> datasourceDocumentIds)
Resets specific documents in the datasource to be selectively re-ingested by the indexer.Mono<Void>
resetIndexer(String indexerName)
Resets the change tracking state associated with an indexer.Mono<com.azure.core.http.rest.Response<Void>>
resetIndexerWithResponse(String indexerName)
Resets the change tracking state associated with an indexer.Mono<Void>
resetSkills(String skillsetName, List<String> skillNames)
Resets skills in an existing skillset in an Azure Cognitive Search service.Mono<com.azure.core.http.rest.Response<Void>>
resetSkillsWithResponse(SearchIndexerSkillset skillset, List<String> skillNames)
Resets skills in an existing skillset in an Azure Cognitive Search service.Mono<Void>
runIndexer(String indexerName)
Runs an indexer on-demand.Mono<com.azure.core.http.rest.Response<Void>>
runIndexerWithResponse(String indexerName)
Runs an indexer on-demand.
-
-
-
Method Detail
-
getEndpoint
public String getEndpoint()
Gets the endpoint for the Azure Cognitive Search service.- Returns:
- the endpoint value.
-
createOrUpdateDataSourceConnection
public Mono<SearchIndexerDataSourceConnection> createOrUpdateDataSourceConnection(SearchIndexerDataSourceConnection dataSource)
Creates a new Azure Cognitive 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 = searchIndexerClient.getDataSourceConnection("dataSource"); dataSource.setContainer(new SearchIndexerDataContainer("updatecontainer")); SearchIndexerDataSourceConnection updateDataSource = searchIndexerClient.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 theSearchIndexerDataSourceConnection
to create or update.- Returns:
- the data source that was created or updated.
-
createOrUpdateDataSourceConnectionWithResponse
public Mono<com.azure.core.http.rest.Response<SearchIndexerDataSourceConnection>> createOrUpdateDataSourceConnectionWithResponse(SearchIndexerDataSourceConnection dataSource, boolean onlyIfUnchanged)
Creates a new Azure Cognitive Search data source or updates a data source if it already exists.Code Sample
Create or update search indexer data source connection named "dataSource".
searchIndexerAsyncClient.getDataSourceConnection("dataSource") .flatMap(dataSource -> { dataSource.setContainer(new SearchIndexerDataContainer("updatecontainer")); return searchIndexerAsyncClient.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 theSearchIndexerDataSourceConnection
to create or update.onlyIfUnchanged
-true
to update if thedataSource
is the same as the current service value.false
to always update existing value.- Returns:
- a data source response.
-
createOrUpdateDataSourceConnectionWithResponse
public Mono<com.azure.core.http.rest.Response<SearchIndexerDataSourceConnection>> createOrUpdateDataSourceConnectionWithResponse(CreateOrUpdateDataSourceConnectionOptions options)
Creates a new Azure Cognitive Search data source or updates a data source if it already exists.Code Sample
Create or update search indexer data source connection named "dataSource".
searchIndexerAsyncClient.getDataSourceConnection("dataSource") .flatMap(dataSource -> { dataSource.setContainer(new SearchIndexerDataContainer("updatecontainer")); return searchIndexerAsyncClient.createOrUpdateDataSourceConnectionWithResponse( new CreateOrUpdateDataSourceConnectionOptions(dataSource) .setOnlyIfUnchanged(true) .setCacheResetRequirementsIgnored(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:
options
- The options used to create or update thedata source connection
.- Returns:
- a data source response.
- Throws:
NullPointerException
- Ifoptions
is null.
-
createDataSourceConnection
public Mono<SearchIndexerDataSourceConnection> createDataSourceConnection(SearchIndexerDataSourceConnection dataSource)
Creates a new Azure Cognitive Search data sourceCode 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")); searchIndexerAsyncClient.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<com.azure.core.http.rest.Response<SearchIndexerDataSourceConnection>> createDataSourceConnectionWithResponse(SearchIndexerDataSourceConnection dataSource)
Creates a new Azure Cognitive Search data sourceCode Sample
Create search indexer data source connection named "dataSource".
SearchIndexerDataSourceConnection dataSource = new SearchIndexerDataSourceConnection("dataSource", SearchIndexerDataSourceType.AZURE_BLOB, "{connectionString}", new SearchIndexerDataContainer("container")); searchIndexerAsyncClient.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 theSearchIndexerDataSourceConnection
to create.- Returns:
- a Mono which performs the network request upon subscription.
-
getDataSourceConnection
public Mono<SearchIndexerDataSourceConnection> getDataSourceConnection(String dataSourceName)
Retrieves a DataSource from an Azure Cognitive Search service.Code Sample
Get search indexer data source connection named "dataSource".
searchIndexerAsyncClient.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 theSearchIndexerDataSourceConnection
to retrieve.- Returns:
- the DataSource.
-
getDataSourceConnectionWithResponse
public Mono<com.azure.core.http.rest.Response<SearchIndexerDataSourceConnection>> getDataSourceConnectionWithResponse(String dataSourceName)
Retrieves a DataSource from an Azure Cognitive Search service.Code Sample
Get search indexer data source connection named "dataSource".
searchIndexerAsyncClient.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 theSearchIndexerDataSourceConnection
to retrieve.- Returns:
- a response containing the DataSource.
-
listDataSourceConnections
public com.azure.core.http.rest.PagedFlux<SearchIndexerDataSourceConnection> listDataSourceConnections()
List all DataSources from an Azure Cognitive Search service.Code Sample
List all search indexer data source connections.
searchIndexerAsyncClient.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
-
listDataSourceConnectionNames
public com.azure.core.http.rest.PagedFlux<String> listDataSourceConnectionNames()
List all DataSource names from an Azure Cognitive Search service.Code Sample
List all search indexer data source connection names.
searchIndexerAsyncClient.listDataSourceConnectionNames() .subscribe(dataSourceName -> System.out.printf("The dataSource name is %s.%n", dataSourceName));
- Returns:
- a list of DataSource names
-
deleteDataSourceConnection
public Mono<Void> deleteDataSourceConnection(String dataSourceName)
Delete a DataSourceCode Sample
Delete the search indexer data source connection named "dataSource".
searchIndexerAsyncClient.deleteDataSourceConnection("dataSource") .subscribe();
- Parameters:
dataSourceName
- the name of theSearchIndexerDataSourceConnection
for deletion- Returns:
- a void Mono
-
deleteDataSourceConnectionWithResponse
public Mono<com.azure.core.http.rest.Response<Void>> deleteDataSourceConnectionWithResponse(SearchIndexerDataSourceConnection dataSource, boolean onlyIfUnchanged)
Deletes an Azure Cognitive Search data source.Code Sample
Delete the search indexer data source connection named "dataSource".
searchIndexerAsyncClient.getDataSourceConnection("dataSource") .flatMap(dataSource -> searchIndexerAsyncClient.deleteDataSourceConnectionWithResponse(dataSource, true)) .subscribe(deleteResponse -> System.out.printf("The status code of the response is %d.%n", deleteResponse.getStatusCode()));
- Parameters:
dataSource
- TheSearchIndexerDataSourceConnection
to delete.onlyIfUnchanged
-true
to delete if thedataSource
is the same as the current service value.false
to always delete existing value.- Returns:
- a mono response
-
createIndexer
public Mono<SearchIndexer> createIndexer(SearchIndexer indexer)
Creates a new Azure Cognitive Search indexer.Code Sample
Create search indexer named "searchIndexer".
SearchIndexer searchIndexer = new SearchIndexer("searchIndexer", "dataSource", "searchIndex"); searchIndexerAsyncClient.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<com.azure.core.http.rest.Response<SearchIndexer>> createIndexerWithResponse(SearchIndexer indexer)
Creates a new Azure Cognitive Search indexer.Code Sample
Create search indexer named "searchIndexer".
SearchIndexer searchIndexer = new SearchIndexer("searchIndexer", "dataSource", "searchIndex"); searchIndexerAsyncClient.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.
-
createOrUpdateIndexer
public Mono<SearchIndexer> createOrUpdateIndexer(SearchIndexer indexer)
Creates a new Azure Cognitive Search indexer or updates an indexer if it already exists.Code Sample
Create or update search indexer named "searchIndexer".
searchIndexerAsyncClient.getIndexer("searchIndexer") .flatMap(searchIndexerFromService -> { searchIndexerFromService.setFieldMappings(Collections.singletonList( new FieldMapping("hotelName").setTargetFieldName("HotelName"))); return searchIndexerAsyncClient.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<com.azure.core.http.rest.Response<SearchIndexer>> createOrUpdateIndexerWithResponse(SearchIndexer indexer, boolean onlyIfUnchanged)
Creates a new Azure Cognitive Search indexer or updates an indexer if it already exists.Code Sample
Create or update search indexer named "searchIndexer".
searchIndexerAsyncClient.getIndexer("searchIndexer") .flatMap(searchIndexerFromService -> { searchIndexerFromService.setFieldMappings(Collections.singletonList( new FieldMapping("hotelName").setTargetFieldName("HotelName"))); return searchIndexerAsyncClient.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 theSearchIndexer
to create or updateonlyIfUnchanged
-true
to update if theindexer
is the same as the current service value.false
to always update existing value.- Returns:
- a response containing the created Indexer.
-
createOrUpdateIndexerWithResponse
public Mono<com.azure.core.http.rest.Response<SearchIndexer>> createOrUpdateIndexerWithResponse(CreateOrUpdateIndexerOptions options)
Creates a new Azure Cognitive Search indexer or updates an indexer if it already exists.Code Sample
Create or update search indexer named "searchIndexer".
searchIndexerAsyncClient.getIndexer("searchIndexer") .flatMap(searchIndexerFromService -> { searchIndexerFromService.setFieldMappings(Collections.singletonList( new FieldMapping("hotelName").setTargetFieldName("HotelName"))); return searchIndexerAsyncClient.createOrUpdateIndexerWithResponse( new CreateOrUpdateIndexerOptions(searchIndexerFromService) .setOnlyIfUnchanged(true) .setCacheReprocessingChangeDetectionDisabled(false) .setCacheResetRequirementsIgnored(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:
options
- The options used to create or update theindexer
.- Returns:
- a response containing the created Indexer.
- Throws:
NullPointerException
- Ifoptions
is null.
-
getIndexer
public Mono<SearchIndexer> getIndexer(String indexerName)
Retrieves an indexer definition.Code Sample
Get search indexer with name "searchIndexer".
searchIndexerAsyncClient.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.
-
getIndexerWithResponse
public Mono<com.azure.core.http.rest.Response<SearchIndexer>> getIndexerWithResponse(String indexerName)
Retrieves an indexer definition.Code Sample
Get search indexer with name "searchIndexer".
searchIndexerAsyncClient.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.
-
listIndexers
public com.azure.core.http.rest.PagedFlux<SearchIndexer> listIndexers()
Lists all indexers available for an Azure Cognitive Search service.Code Sample
List all search indexers.
searchIndexerAsyncClient.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.
-
listIndexerNames
public com.azure.core.http.rest.PagedFlux<String> listIndexerNames()
Lists all indexers available for an Azure Cognitive Search service.Code Sample
List all search indexer names.
searchIndexerAsyncClient.listIndexerNames() .subscribe(indexerName -> System.out.printf("The indexer name is %s.%n", indexerName));
- Returns:
- a response containing all Indexers from the Search service.
-
deleteIndexer
public Mono<Void> deleteIndexer(String indexerName)
Deletes an Azure Cognitive Search indexer.Code Sample
Delete search indexer named "searchIndexer".
searchIndexerAsyncClient.deleteIndexer("searchIndexer") .subscribe();
- Parameters:
indexerName
- the name of the indexer to delete- Returns:
- a response signalling completion.
-
deleteIndexerWithResponse
public Mono<com.azure.core.http.rest.Response<Void>> deleteIndexerWithResponse(SearchIndexer indexer, boolean onlyIfUnchanged)
Deletes an Azure Cognitive Search indexer.Code Sample
Delete search indexer named "searchIndexer".
searchIndexerAsyncClient.getIndexer("searchIndexer") .flatMap(searchIndexer -> searchIndexerAsyncClient.deleteIndexerWithResponse(searchIndexer, true)) .subscribe(deleteResponse -> System.out.printf("The status code of the response is %d.%n", deleteResponse.getStatusCode()));
- Parameters:
indexer
- theSearchIndexer
to deleteonlyIfUnchanged
-true
to delete if theindexer
is the same as the current service value.false
to always delete existing value.- Returns:
- a response signalling completion.
-
resetIndexer
public Mono<Void> resetIndexer(String indexerName)
Resets the change tracking state associated with an indexer.Code Sample
Reset search indexer named "searchIndexer".
searchIndexerAsyncClient.resetIndexer("searchIndexer") .subscribe();
- Parameters:
indexerName
- the name of the indexer to reset- Returns:
- a response signalling completion.
-
resetIndexerWithResponse
public Mono<com.azure.core.http.rest.Response<Void>> resetIndexerWithResponse(String indexerName)
Resets the change tracking state associated with an indexer.Code Sample
Reset search indexer named "searchIndexer".
searchIndexerAsyncClient.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<Void> runIndexer(String indexerName)
Runs an indexer on-demand.Code Sample
Run search indexer named "searchIndexer".
searchIndexerAsyncClient.runIndexer("searchIndexer") .subscribe();
- Parameters:
indexerName
- the name of the indexer to run- Returns:
- a response signalling completion.
-
runIndexerWithResponse
public Mono<com.azure.core.http.rest.Response<Void>> runIndexerWithResponse(String indexerName)
Runs an indexer on-demand.Code Sample
Run search indexer named "searchIndexer".
searchIndexerAsyncClient.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.
-
getIndexerStatus
public Mono<SearchIndexerStatus> getIndexerStatus(String indexerName)
Returns the current status and execution history of an indexer.Code Sample
Get status for search indexer "searchIndexer".
searchIndexerAsyncClient.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<com.azure.core.http.rest.Response<SearchIndexerStatus>> getIndexerStatusWithResponse(String indexerName)
Returns the current status and execution history of an indexer.Code Sample
Get search indexer status.
searchIndexerAsyncClient.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.
-
resetDocuments
public Mono<Void> resetDocuments(String indexerName, Boolean overwrite, List<String> documentKeys, List<String> datasourceDocumentIds)
Resets specific documents in the datasource to be selectively re-ingested by the indexer.// Reset the documents with keys 1234 and 4321. searchIndexerAsyncClient.resetDocuments("searchIndexer", false, Arrays.asList("1234", "4321"), null) // Clear the previous documents to be reset and replace them with documents 1235 and 5231. .then(searchIndexerAsyncClient.resetDocuments("searchIndexer", true, Arrays.asList("1235", "5321"), null)) .subscribe();
- Parameters:
indexerName
- The name of the indexer to reset documents for.overwrite
- If false, keys or IDs will be appended to existing ones. If true, only the keys or IDs in this payload will be queued to be re-ingested.documentKeys
- Document keys to be reset.datasourceDocumentIds
- Datasource document identifiers to be reset.- Returns:
- A response signalling completion.
-
resetDocumentsWithResponse
public Mono<com.azure.core.http.rest.Response<Void>> resetDocumentsWithResponse(SearchIndexer indexer, Boolean overwrite, List<String> documentKeys, List<String> datasourceDocumentIds)
Resets specific documents in the datasource to be selectively re-ingested by the indexer.searchIndexerAsyncClient.getIndexer("searchIndexer") .flatMap(searchIndexer -> searchIndexerAsyncClient.resetDocumentsWithResponse(searchIndexer, false, Arrays.asList("1234", "4321"), null) .flatMap(resetDocsResult -> { System.out.printf("Requesting documents to be reset completed with status code %d.%n", resetDocsResult.getStatusCode()); // Clear the previous documents to be reset and replace them with documents 1235 and 5231. return searchIndexerAsyncClient.resetDocumentsWithResponse(searchIndexer, true, Arrays.asList("1235", "5321"), null); })) .subscribe(resetDocsResult -> System.out.printf("Overwriting the documents to be reset completed with status code %d.%n", resetDocsResult.getStatusCode()));
- Parameters:
indexer
- The indexer to reset documents for.overwrite
- If false, keys or IDs will be appended to existing ones. If true, only the keys or IDs in this payload will be queued to be re-ingested.documentKeys
- Document keys to be reset.datasourceDocumentIds
- Datasource document identifiers to be reset.- Returns:
- A response signalling completion.
- Throws:
NullPointerException
- Ifindexer
is null.
-
createSkillset
public Mono<SearchIndexerSkillset> createSkillset(SearchIndexerSkillset skillset)
Creates a new skillset in an Azure Cognitive 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/*"))); searchIndexerAsyncClient.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<com.azure.core.http.rest.Response<SearchIndexerSkillset>> createSkillsetWithResponse(SearchIndexerSkillset skillset)
Creates a new skillset in an Azure Cognitive 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/*"))); searchIndexerAsyncClient.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.
-
getSkillset
public Mono<SearchIndexerSkillset> getSkillset(String skillsetName)
Retrieves a skillset definition.Code Sample
Get search indexer skillset "searchIndexerSkillset".
searchIndexerAsyncClient.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<com.azure.core.http.rest.Response<SearchIndexerSkillset>> getSkillsetWithResponse(String skillsetName)
Retrieves a skillset definition.Code Sample
Get search indexer skillset "searchIndexerSkillset".
searchIndexerAsyncClient.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.
-
listSkillsets
public com.azure.core.http.rest.PagedFlux<SearchIndexerSkillset> listSkillsets()
Lists all skillsets available for an Azure Cognitive Search service.Code Sample
List all search indexer skillsets.
searchIndexerAsyncClient.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.
-
listSkillsetNames
public com.azure.core.http.rest.PagedFlux<String> listSkillsetNames()
Lists all skillset names for an Azure Cognitive Search service.Code Sample
List all search indexer skillset names.
searchIndexerAsyncClient.listSkillsetNames() .subscribe(skillsetName -> System.out.printf("The indexer skillset name is %s.%n", skillsetName));
- Returns:
- a reactive response emitting the list of skillset names.
-
createOrUpdateSkillset
public Mono<SearchIndexerSkillset> createOrUpdateSkillset(SearchIndexerSkillset skillset)
Creates a new Azure Cognitive Search skillset or updates a skillset if it already exists.Code Sample
Create or update search indexer skillset "searchIndexerSkillset".
searchIndexerAsyncClient.getSkillset("searchIndexerSkillset") .flatMap(indexerSkillset -> { indexerSkillset.setDescription("This is new description!"); return searchIndexerAsyncClient.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<com.azure.core.http.rest.Response<SearchIndexerSkillset>> createOrUpdateSkillsetWithResponse(SearchIndexerSkillset skillset, boolean onlyIfUnchanged)
Creates a new Azure Cognitive Search skillset or updates a skillset if it already exists.Code Sample
Create or update search indexer skillset "searchIndexerSkillset".
searchIndexerAsyncClient.getSkillset("searchIndexerSkillset") .flatMap(indexerSkillset -> { indexerSkillset.setDescription("This is new description!"); return searchIndexerAsyncClient.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 updateonlyIfUnchanged
-true
to update if theskillset
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.
-
createOrUpdateSkillsetWithResponse
public Mono<com.azure.core.http.rest.Response<SearchIndexerSkillset>> createOrUpdateSkillsetWithResponse(CreateOrUpdateSkillsetOptions options)
Creates a new Azure Cognitive Search skillset or updates a skillset if it already exists.Code Sample
Create or update search indexer skillset "searchIndexerSkillset".
searchIndexerAsyncClient.getSkillset("searchIndexerSkillset") .flatMap(indexerSkillset -> { indexerSkillset.setDescription("This is new description!"); return searchIndexerAsyncClient.createOrUpdateSkillsetWithResponse( new CreateOrUpdateSkillsetOptions(indexerSkillset) .setOnlyIfUnchanged(true) .setCacheReprocessingChangeDetectionDisabled(false) .setCacheResetRequirementsIgnored(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:
options
- The options used to create or update theskillset
.- Returns:
- a response containing the skillset that was created or updated.
- Throws:
NullPointerException
- Ifoptions
is null.
-
deleteSkillset
public Mono<Void> deleteSkillset(String skillsetName)
Deletes a cognitive skillset in an Azure Cognitive Search service.Code Sample
Delete search indexer skillset "searchIndexerSkillset".
searchIndexerAsyncClient.deleteSkillset("searchIndexerSkillset") .subscribe();
- Parameters:
skillsetName
- the name of the skillset to delete- Returns:
- a response signalling completion.
-
deleteSkillsetWithResponse
public Mono<com.azure.core.http.rest.Response<Void>> deleteSkillsetWithResponse(SearchIndexerSkillset skillset, boolean onlyIfUnchanged)
Deletes a cognitive skillset in an Azure Cognitive Search service.Code Sample
Delete search indexer skillset "searchIndexerSkillset".
searchIndexerAsyncClient.getSkillset("searchIndexerSkillset") .flatMap(searchIndexerSkillset -> searchIndexerAsyncClient.deleteSkillsetWithResponse(searchIndexerSkillset, true)) .subscribe(deleteResponse -> System.out.printf("The status code of the response is %d.%n", deleteResponse.getStatusCode()));
- Parameters:
skillset
- theSearchIndexerSkillset
to delete.onlyIfUnchanged
-true
to delete if theskillset
is the same as the current service value.false
to always delete existing value.- Returns:
- a response signalling completion.
-
resetSkills
public Mono<Void> resetSkills(String skillsetName, List<String> skillNames)
Resets skills in an existing skillset in an Azure Cognitive Search service.// Reset the "myOcr" and "myText" skills. searchIndexerAsyncClient.resetSkills("searchIndexerSkillset", Arrays.asList("myOcr", "myText")) .subscribe();
- Parameters:
skillsetName
- The name of the skillset to reset.skillNames
- The skills to reset.- Returns:
- A response signalling completion.
-
resetSkillsWithResponse
public Mono<com.azure.core.http.rest.Response<Void>> resetSkillsWithResponse(SearchIndexerSkillset skillset, List<String> skillNames)
Resets skills in an existing skillset in an Azure Cognitive Search service.searchIndexerAsyncClient.getSkillset("searchIndexerSkillset") .flatMap(searchIndexerSkillset -> searchIndexerAsyncClient.resetSkillsWithResponse(searchIndexerSkillset, Arrays.asList("myOcr", "myText"))) .subscribe(resetSkillsResponse -> System.out.printf("Resetting skills completed with status code %d.%n", resetSkillsResponse.getStatusCode()));
- Parameters:
skillset
- The skillset to reset.skillNames
- The skills to reset.- Returns:
- A response signalling completion.
- Throws:
NullPointerException
- Ifskillset
is null.
-
-