public class SearchIndexerClient extends Object
SearchIndexerClientBuilder
Modifier and Type | Method and Description |
---|---|
SearchIndexerDataSourceConnection |
createDataSourceConnection(SearchIndexerDataSourceConnection dataSourceConnection)
Creates a new Azure Cognitive Search data source
|
com.azure.core.http.rest.Response<SearchIndexerDataSourceConnection> |
createDataSourceConnectionWithResponse(SearchIndexerDataSourceConnection dataSourceConnection,
com.azure.core.util.Context context)
Creates a new Azure Cognitive Search data source
|
SearchIndexer |
createIndexer(SearchIndexer indexer)
Creates a new Azure Cognitive Search indexer.
|
com.azure.core.http.rest.Response<SearchIndexer> |
createIndexerWithResponse(SearchIndexer indexer,
com.azure.core.util.Context context)
Creates a new Azure Cognitive Search indexer.
|
SearchIndexerDataSourceConnection |
createOrUpdateDataSourceConnection(SearchIndexerDataSourceConnection dataSourceConnection)
Creates a new Azure Cognitive Search data source or updates a data source if it already exists
|
com.azure.core.http.rest.Response<SearchIndexerDataSourceConnection> |
createOrUpdateDataSourceConnectionWithResponse(CreateOrUpdateDataSourceConnectionOptions options,
com.azure.core.util.Context context)
Creates a new Azure Cognitive Search data source or updates a data source if it already exists.
|
com.azure.core.http.rest.Response<SearchIndexerDataSourceConnection> |
createOrUpdateDataSourceConnectionWithResponse(SearchIndexerDataSourceConnection dataSourceConnection,
boolean onlyIfUnchanged,
com.azure.core.util.Context context)
Creates a new Azure Cognitive Search data source or updates a data source if it already exists.
|
SearchIndexer |
createOrUpdateIndexer(SearchIndexer indexer)
Creates a new Azure Cognitive Search indexer or updates an indexer if it already exists.
|
com.azure.core.http.rest.Response<SearchIndexer> |
createOrUpdateIndexerWithResponse(CreateOrUpdateIndexerOptions options,
com.azure.core.util.Context context)
Creates a new Azure Cognitive Search indexer or updates an indexer if it already exists.
|
com.azure.core.http.rest.Response<SearchIndexer> |
createOrUpdateIndexerWithResponse(SearchIndexer indexer,
boolean onlyIfUnchanged,
com.azure.core.util.Context context)
Creates a new Azure Cognitive Search indexer or updates an indexer if it already exists.
|
SearchIndexerSkillset |
createOrUpdateSkillset(SearchIndexerSkillset skillset)
Creates a new Azure Cognitive Search skillset or updates a skillset if it already exists.
|
com.azure.core.http.rest.Response<SearchIndexerSkillset> |
createOrUpdateSkillsetWithResponse(CreateOrUpdateSkillsetOptions options,
com.azure.core.util.Context context)
Creates a new Azure Cognitive Search skillset or updates a skillset if it already exists.
|
com.azure.core.http.rest.Response<SearchIndexerSkillset> |
createOrUpdateSkillsetWithResponse(SearchIndexerSkillset skillset,
boolean onlyIfUnchanged,
com.azure.core.util.Context context)
Creates a new Azure Cognitive Search skillset or updates a skillset if it already exists.
|
SearchIndexerSkillset |
createSkillset(SearchIndexerSkillset skillset)
Creates a new skillset in an Azure Cognitive Search service.
|
com.azure.core.http.rest.Response<SearchIndexerSkillset> |
createSkillsetWithResponse(SearchIndexerSkillset skillset,
com.azure.core.util.Context context)
Creates a new skillset in an Azure Cognitive Search service.
|
void |
deleteDataSourceConnection(String dataSourceConnectionName)
Delete a DataSource
|
com.azure.core.http.rest.Response<Void> |
deleteDataSourceConnectionWithResponse(SearchIndexerDataSourceConnection dataSourceConnection,
boolean onlyIfUnchanged,
com.azure.core.util.Context context)
Delete a DataSource with Response
|
void |
deleteIndexer(String indexerName)
Deletes an Azure Cognitive Search indexer.
|
com.azure.core.http.rest.Response<Void> |
deleteIndexerWithResponse(SearchIndexer indexer,
boolean onlyIfUnchanged,
com.azure.core.util.Context context)
Deletes an Azure Cognitive Search indexer.
|
void |
deleteSkillset(String skillsetName)
Deletes a cognitive skillset in an Azure Cognitive Search service.
|
com.azure.core.http.rest.Response<Void> |
deleteSkillsetWithResponse(SearchIndexerSkillset skillset,
boolean onlyIfUnchanged,
com.azure.core.util.Context context)
Deletes a cognitive skillset in an Azure Cognitive Search service.
|
SearchIndexerDataSourceConnection |
getDataSourceConnection(String dataSourceConnectionName)
Retrieves a DataSource from an Azure Cognitive Search service.
|
com.azure.core.http.rest.Response<SearchIndexerDataSourceConnection> |
getDataSourceConnectionWithResponse(String dataSourceConnectionName,
com.azure.core.util.Context context)
Retrieves a DataSource from an Azure Cognitive Search service.
|
String |
getEndpoint()
Gets the endpoint for the Azure Cognitive Search service.
|
SearchIndexer |
getIndexer(String indexerName)
Retrieves an indexer definition.
|
SearchIndexerStatus |
getIndexerStatus(String indexerName)
Returns the current status and execution history of an indexer.
|
com.azure.core.http.rest.Response<SearchIndexerStatus> |
getIndexerStatusWithResponse(String indexerName,
com.azure.core.util.Context context)
Returns the current status and execution history of an indexer.
|
com.azure.core.http.rest.Response<SearchIndexer> |
getIndexerWithResponse(String indexerName,
com.azure.core.util.Context context)
Retrieves an indexer definition.
|
SearchIndexerSkillset |
getSkillset(String skillsetName)
Retrieves a skillset definition.
|
com.azure.core.http.rest.Response<SearchIndexerSkillset> |
getSkillsetWithResponse(String skillsetName,
com.azure.core.util.Context context)
Retrieves a skillset definition.
|
com.azure.core.http.rest.PagedIterable<String> |
listDataSourceConnectionNames()
List all DataSource names from an Azure Cognitive Search service.
|
com.azure.core.http.rest.PagedIterable<String> |
listDataSourceConnectionNames(com.azure.core.util.Context context)
List all DataSources names from an Azure Cognitive Search service.
|
com.azure.core.http.rest.PagedIterable<SearchIndexerDataSourceConnection> |
listDataSourceConnections()
List all DataSources from an Azure Cognitive Search service.
|
com.azure.core.http.rest.PagedIterable<SearchIndexerDataSourceConnection> |
listDataSourceConnections(com.azure.core.util.Context context)
List all DataSources from an Azure Cognitive Search service.
|
com.azure.core.http.rest.PagedIterable<String> |
listIndexerNames()
Lists all indexers names for an Azure Cognitive Search service.
|
com.azure.core.http.rest.PagedIterable<String> |
listIndexerNames(com.azure.core.util.Context context)
Lists all indexers names for an Azure Cognitive Search service.
|
com.azure.core.http.rest.PagedIterable<SearchIndexer> |
listIndexers()
Lists all indexers available for an Azure Cognitive Search service.
|
com.azure.core.http.rest.PagedIterable<SearchIndexer> |
listIndexers(com.azure.core.util.Context context)
Lists all indexers available for an Azure Cognitive Search service.
|
com.azure.core.http.rest.PagedIterable<String> |
listSkillsetNames()
Lists all skillset names for an Azure Cognitive Search service.
|
com.azure.core.http.rest.PagedIterable<String> |
listSkillsetNames(com.azure.core.util.Context context)
Lists all skillset names for an Azure Cognitive Search service.
|
com.azure.core.http.rest.PagedIterable<SearchIndexerSkillset> |
listSkillsets()
Lists all skillsets available for an Azure Cognitive Search service.
|
com.azure.core.http.rest.PagedIterable<SearchIndexerSkillset> |
listSkillsets(com.azure.core.util.Context context)
Lists all skillsets available for an Azure Cognitive Search service.
|
void |
resetIndexer(String indexerName)
Resets the change tracking state associated with an indexer.
|
com.azure.core.http.rest.Response<Void> |
resetIndexerWithResponse(String indexerName,
com.azure.core.util.Context context)
Resets the change tracking state associated with an indexer.
|
void |
runIndexer(String indexerName)
Runs an indexer on-demand.
|
com.azure.core.http.rest.Response<Void> |
runIndexerWithResponse(String indexerName,
com.azure.core.util.Context context)
Runs an indexer on-demand.
|
public String getEndpoint()
public SearchIndexerDataSourceConnection createOrUpdateDataSourceConnection(SearchIndexerDataSourceConnection dataSourceConnection)
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());
dataSourceConnection
- The definition of the data source to create or update.public com.azure.core.http.rest.Response<SearchIndexerDataSourceConnection> createOrUpdateDataSourceConnectionWithResponse(SearchIndexerDataSourceConnection dataSourceConnection, boolean onlyIfUnchanged, com.azure.core.util.Context context)
Code Sample
Create or update search indexer data source connection named "dataSource".
SearchIndexerDataSourceConnection dataSource = searchIndexerClient.getDataSourceConnection("dataSource"); dataSource.setContainer(new SearchIndexerDataContainer("updatecontainer")); Response<SearchIndexerDataSourceConnection> updateDataSource = searchIndexerClient .createOrUpdateDataSourceConnectionWithResponse(dataSource, true, new Context(key1, value1)); 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());
dataSourceConnection
- the SearchIndexerDataSourceConnection
to create or updateonlyIfUnchanged
- true
to update if the dataSourceConnection
is the same as the current
service value. false
to always update existing value.context
- additional context that is passed through the HTTP pipeline during the service callpublic com.azure.core.http.rest.Response<SearchIndexerDataSourceConnection> createOrUpdateDataSourceConnectionWithResponse(CreateOrUpdateDataSourceConnectionOptions options, com.azure.core.util.Context context)
Code Sample
Create or update search indexer data source connection named "dataSource".
SearchIndexerDataSourceConnection dataSource = searchIndexerClient.getDataSourceConnection("dataSource"); dataSource.setContainer(new SearchIndexerDataContainer("updatecontainer")); CreateOrUpdateDataSourceConnectionOptions options = new CreateOrUpdateDataSourceConnectionOptions(dataSource) .setOnlyIfUnchanged(true) .setCacheResetRequirementsIgnored(true); Response<SearchIndexerDataSourceConnection> updateDataSource = searchIndexerClient .createOrUpdateDataSourceConnectionWithResponse(options, new Context(key1, value1)); 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());
options
- The options used to create or update the data source
connection
.context
- additional context that is passed through the HTTP pipeline during the service callNullPointerException
- If options
is null.public SearchIndexerDataSourceConnection createDataSourceConnection(SearchIndexerDataSourceConnection dataSourceConnection)
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")); SearchIndexerDataSourceConnection dataSourceFromService = searchIndexerClient.createDataSourceConnection(dataSource); System.out.printf("The data source name is %s. The ETag of data source is %s.%n", dataSourceFromService.getName(), dataSourceFromService.getETag());
dataSourceConnection
- The definition of the data source to createpublic com.azure.core.http.rest.Response<SearchIndexerDataSourceConnection> createDataSourceConnectionWithResponse(SearchIndexerDataSourceConnection dataSourceConnection, com.azure.core.util.Context context)
Code Sample
Create search indexer data source connection named "dataSource".
SearchIndexerDataSourceConnection dataSource = new SearchIndexerDataSourceConnection("dataSource", SearchIndexerDataSourceType.AZURE_BLOB, "{connectionString}", new SearchIndexerDataContainer("container")); Response<SearchIndexerDataSourceConnection> dataSourceFromService = searchIndexerClient.createDataSourceConnectionWithResponse(dataSource, new Context(key1, value1)); System.out.printf("The status code of the response is %s. The data source name is %s.%n", dataSourceFromService.getStatusCode(), dataSourceFromService.getValue().getName());
dataSourceConnection
- the definition of the data source to create doesn't match specified valuescontext
- additional context that is passed through the HTTP pipeline during the service callpublic SearchIndexerDataSourceConnection getDataSourceConnection(String dataSourceConnectionName)
Code Sample
Get search indexer data source connection named "dataSource".
SearchIndexerDataSourceConnection dataSource = searchIndexerClient.getDataSourceConnection("dataSource"); System.out.printf("The dataSource name is %s. The ETag of dataSource is %s.%n", dataSource.getName(), dataSource.getETag());
dataSourceConnectionName
- the name of the data source to retrievepublic com.azure.core.http.rest.Response<SearchIndexerDataSourceConnection> getDataSourceConnectionWithResponse(String dataSourceConnectionName, com.azure.core.util.Context context)
Code Sample
Get search indexer data source connection named "dataSource".
Response<SearchIndexerDataSourceConnection> dataSource = searchIndexerClient.getDataSourceConnectionWithResponse( "dataSource", new Context(key1, value1)); System.out.printf("The status code of the response is %s. The data source name is %s.%n", dataSource.getStatusCode(), dataSource.getValue().getName());
dataSourceConnectionName
- the name of the data source to retrievecontext
- additional context that is passed through the HTTP pipeline during the service callpublic com.azure.core.http.rest.PagedIterable<SearchIndexerDataSourceConnection> listDataSourceConnections()
Code Sample
List all search indexer data source connections.
PagedIterable<SearchIndexerDataSourceConnection> dataSources = searchIndexerClient.listDataSourceConnections(); for (SearchIndexerDataSourceConnection dataSource: dataSources) { System.out.printf("The dataSource name is %s. The ETag of dataSource is %s.%n", dataSource.getName(), dataSource.getETag()); }
public com.azure.core.http.rest.PagedIterable<SearchIndexerDataSourceConnection> listDataSourceConnections(com.azure.core.util.Context context)
Code Sample
List all search indexer data source connections.
PagedIterable<SearchIndexerDataSourceConnection> dataSources = searchIndexerClient.listDataSourceConnections(new Context(key1, value1)); System.out.println("The status code of the response is" + dataSources.iterableByPage().iterator().next().getStatusCode()); for (SearchIndexerDataSourceConnection dataSource: dataSources) { System.out.printf("The dataSource name is %s. The ETag of dataSource is %s.%n", dataSource.getName(), dataSource.getETag()); }
context
- Additional context that is passed through the HTTP pipeline during the service call.public com.azure.core.http.rest.PagedIterable<String> listDataSourceConnectionNames()
Code Sample
List all search indexer data source connection names.
PagedIterable<String> dataSources = searchIndexerClient.listDataSourceConnectionNames(); for (String dataSourceName: dataSources) { System.out.printf("The dataSource name is %s.%n", dataSourceName); }
public com.azure.core.http.rest.PagedIterable<String> listDataSourceConnectionNames(com.azure.core.util.Context context)
Code Sample
List all search indexer data source connection names.
PagedIterable<String> dataSources = searchIndexerClient.listDataSourceConnectionNames(new Context(key1, value1)); System.out.println("The status code of the response is" + dataSources.iterableByPage().iterator().next().getStatusCode()); for (String dataSourceName: dataSources) { System.out.printf("The dataSource name is %s.%n", dataSourceName); }
context
- Additional context that is passed through the HTTP pipeline during the service call.public void deleteDataSourceConnection(String dataSourceConnectionName)
Code Sample
Delete all search indexer data source connection named "dataSource".
searchIndexerClient.deleteDataSourceConnection("dataSource");
dataSourceConnectionName
- the name of the data source to be deletedpublic com.azure.core.http.rest.Response<Void> deleteDataSourceConnectionWithResponse(SearchIndexerDataSourceConnection dataSourceConnection, boolean onlyIfUnchanged, com.azure.core.util.Context context)
Code Sample
Delete all search indexer data source connection named "dataSource".
SearchIndexerDataSourceConnection dataSource = searchIndexerClient.getDataSourceConnection("dataSource"); Response<Void> deleteResponse = searchIndexerClient.deleteDataSourceConnectionWithResponse(dataSource, true, new Context(key1, value1)); System.out.printf("The status code of the response is %d.%n", deleteResponse.getStatusCode());
dataSourceConnection
- the SearchIndexerDataSourceConnection
to be deleted.onlyIfUnchanged
- true
to delete if the dataSourceConnection
is the same as the current
service value. false
to always delete existing value.context
- additional context that is passed through the HTTP pipeline during the service callpublic SearchIndexer createIndexer(SearchIndexer indexer)
Code Sample
Create search indexer named "searchIndexer".
SearchIndexer searchIndexer = new SearchIndexer("searchIndexer", "dataSource", "searchIndex"); SearchIndexer indexerFromService = searchIndexerClient.createIndexer(searchIndexer); System.out.printf("The indexer name is %s. The ETag of indexer is %s.%n", indexerFromService.getName(), indexerFromService.getETag());
indexer
- definition of the indexer to create.public com.azure.core.http.rest.Response<SearchIndexer> createIndexerWithResponse(SearchIndexer indexer, com.azure.core.util.Context context)
Code Sample
Create search indexer named "searchIndexer".
SearchIndexer searchIndexer = new SearchIndexer("searchIndexer", "dataSource", "searchIndex"); Response<SearchIndexer> indexerFromServiceResponse = searchIndexerClient.createIndexerWithResponse( searchIndexer, new Context(key1, value1)); System.out.printf("The status code of the response is %s. The indexer name is %s.%n", indexerFromServiceResponse.getStatusCode(), indexerFromServiceResponse.getValue().getName());
indexer
- definition of the indexer to createcontext
- additional context that is passed through the HTTP pipeline during the service callpublic SearchIndexer createOrUpdateIndexer(SearchIndexer indexer)
Code Sample
Create or update search indexer named "searchIndexer".
SearchIndexer searchIndexerFromService = searchIndexerClient.getIndexer("searchIndexer"); searchIndexerFromService.setFieldMappings(Collections.singletonList( new FieldMapping("hotelName").setTargetFieldName("HotelName"))); SearchIndexer updateIndexer = searchIndexerClient.createOrUpdateIndexer(searchIndexerFromService); System.out.printf("The indexer name is %s. The target field name of indexer is %s.%n", updateIndexer.getName(), updateIndexer.getFieldMappings().get(0).getTargetFieldName());
indexer
- The definition of the indexer to create or update.public com.azure.core.http.rest.Response<SearchIndexer> createOrUpdateIndexerWithResponse(SearchIndexer indexer, boolean onlyIfUnchanged, com.azure.core.util.Context context)
Code Sample
Create or update search indexer named "searchIndexer".
SearchIndexer searchIndexerFromService = searchIndexerClient.getIndexer("searchIndexer"); searchIndexerFromService.setFieldMappings(Collections.singletonList( new FieldMapping("hotelName").setTargetFieldName("HotelName"))); Response<SearchIndexer> indexerFromService = searchIndexerClient.createOrUpdateIndexerWithResponse( searchIndexerFromService, true, new Context(key1, value1)); 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());
indexer
- 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.context
- additional context that is passed through the HTTP pipeline during the service callpublic com.azure.core.http.rest.Response<SearchIndexer> createOrUpdateIndexerWithResponse(CreateOrUpdateIndexerOptions options, com.azure.core.util.Context context)
Code Sample
Create or update search indexer named "searchIndexer".
SearchIndexer searchIndexerFromService = searchIndexerClient.getIndexer("searchIndexer"); searchIndexerFromService.setFieldMappings(Collections.singletonList( new FieldMapping("hotelName").setTargetFieldName("HotelName"))); CreateOrUpdateIndexerOptions options = new CreateOrUpdateIndexerOptions(searchIndexerFromService) .setOnlyIfUnchanged(true) .setCacheReprocessingChangeDetectionDisabled(false) .setCacheResetRequirementsIgnored(true); Response<SearchIndexer> indexerFromService = searchIndexerClient.createOrUpdateIndexerWithResponse( options, new Context(key1, value1)); 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());
options
- The options used to create or update the indexer
.context
- additional context that is passed through the HTTP pipeline during the service callNullPointerException
- If options
is null.public com.azure.core.http.rest.PagedIterable<SearchIndexer> listIndexers()
Code Sample
List all search indexers.
PagedIterable<SearchIndexer> indexers = searchIndexerClient.listIndexers(); for (SearchIndexer indexer: indexers) { System.out.printf("The indexer name is %s. The ETag of indexer is %s.%n", indexer.getName(), indexer.getETag()); }
public com.azure.core.http.rest.PagedIterable<SearchIndexer> listIndexers(com.azure.core.util.Context context)
Code Sample
List all search indexers.
PagedIterable<SearchIndexer> indexers = searchIndexerClient.listIndexers(new Context(key1, value1)); System.out.println("The status code of the response is" + indexers.iterableByPage().iterator().next().getStatusCode()); for (SearchIndexer indexer: indexers) { System.out.printf("The indexer name is %s. The ETag of index is %s.%n", indexer.getName(), indexer.getETag()); }
context
- additional context that is passed through the HTTP pipeline during the service callpublic com.azure.core.http.rest.PagedIterable<String> listIndexerNames()
Code Sample
List all search indexer names.
PagedIterable<String> indexers = searchIndexerClient.listIndexerNames(); for (String indexerName: indexers) { System.out.printf("The indexer name is %s.%n", indexerName); }
public com.azure.core.http.rest.PagedIterable<String> listIndexerNames(com.azure.core.util.Context context)
Code Sample
List all search indexer names.
PagedIterable<String> indexers = searchIndexerClient.listIndexerNames(new Context(key1, value1)); System.out.println("The status code of the response is" + indexers.iterableByPage().iterator().next().getStatusCode()); for (String indexerName: indexers) { System.out.printf("The indexer name is %s.%n", indexerName); }
context
- additional context that is passed through the HTTP pipeline during the service callpublic SearchIndexer getIndexer(String indexerName)
Code Sample
Get search indexer with name "searchIndexer".
SearchIndexer indexerFromService = searchIndexerClient.getIndexer("searchIndexer"); System.out.printf("The indexer name is %s. The ETag of indexer is %s.%n", indexerFromService.getName(), indexerFromService.getETag());
indexerName
- the name of the indexer to retrievepublic com.azure.core.http.rest.Response<SearchIndexer> getIndexerWithResponse(String indexerName, com.azure.core.util.Context context)
Code Sample
Get search indexer with name "searchIndexer".
Response<SearchIndexer> indexerFromServiceResponse = searchIndexerClient.getIndexerWithResponse( "searchIndexer", new Context(key1, value1)); System.out.printf("The status code of the response is %s. The indexer name is %s.%n", indexerFromServiceResponse.getStatusCode(), indexerFromServiceResponse.getValue().getName());
indexerName
- the name of the indexer to retrievecontext
- additional context that is passed through the HTTP pipeline during the service callpublic void deleteIndexer(String indexerName)
Code Sample
Delete search indexer named "searchIndexer".
searchIndexerClient.deleteIndexer("searchIndexer");
indexerName
- the name of the indexer to deletepublic com.azure.core.http.rest.Response<Void> deleteIndexerWithResponse(SearchIndexer indexer, boolean onlyIfUnchanged, com.azure.core.util.Context context)
Code Sample
Delete search index named "searchIndexer".
SearchIndexer searchIndexer = searchIndexerClient.getIndexer("searchIndexer"); Response<Void> deleteResponse = searchIndexerClient.deleteIndexerWithResponse(searchIndexer, true, new Context(key1, value1)); System.out.printf("The status code of the response is %d.%n", deleteResponse.getStatusCode());
indexer
- the search SearchIndexer
onlyIfUnchanged
- true
to delete if the indexer
is the same as the current service value.
false
to always delete existing value.context
- the contextpublic void resetIndexer(String indexerName)
Code Sample
Reset search indexer named "searchIndexer".
searchIndexerClient.resetIndexer("searchIndexer");
indexerName
- the name of the indexer to resetpublic com.azure.core.http.rest.Response<Void> resetIndexerWithResponse(String indexerName, com.azure.core.util.Context context)
Code Sample
Reset search indexer named "searchIndexer".
Response<Void> response = searchIndexerClient.resetIndexerWithResponse("searchIndexer", new Context(key1, value1)); System.out.println("The status code of the response is " + response.getStatusCode());
indexerName
- the name of the indexer to resetcontext
- additional context that is passed through the HTTP pipeline during the service callpublic void runIndexer(String indexerName)
Code Sample
Run search indexer named "searchIndexer".
searchIndexerClient.runIndexer("searchIndexer");
indexerName
- the name of the indexer to runpublic com.azure.core.http.rest.Response<Void> runIndexerWithResponse(String indexerName, com.azure.core.util.Context context)
Code Sample
Run search indexer named "searchIndexer".
Response<Void> response = searchIndexerClient.runIndexerWithResponse("searchIndexer", new Context(key1, value1)); System.out.println("The status code of the response is " + response.getStatusCode());
indexerName
- the name of the indexer to runcontext
- additional context that is passed through the HTTP pipeline during the service callpublic SearchIndexerStatus getIndexerStatus(String indexerName)
Code Sample
Get search indexer status.
SearchIndexerStatus indexerStatus = searchIndexerClient.getIndexerStatus("searchIndexer"); System.out.printf("The indexer status is %s.%n", indexerStatus.getStatus());
indexerName
- the name of the indexer for which to retrieve statuspublic com.azure.core.http.rest.Response<SearchIndexerStatus> getIndexerStatusWithResponse(String indexerName, com.azure.core.util.Context context)
Code Sample
Get search indexer status.
Response<SearchIndexerStatus> response = searchIndexerClient.getIndexerStatusWithResponse("searchIndexer", new Context(key1, value1)); System.out.printf("The status code of the response is %s.%nThe indexer status is %s.%n", response.getStatusCode(), response.getValue().getStatus());
indexerName
- the name of the indexer for which to retrieve statuscontext
- additional context that is passed through the HTTP pipeline during the service callpublic SearchIndexerSkillset createSkillset(SearchIndexerSkillset skillset)
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/*"))); SearchIndexerSkillset skillset = searchIndexerClient.createSkillset(searchIndexerSkillset); System.out.printf("The indexer skillset name is %s. The ETag of indexer skillset is %s.%n", skillset.getName(), skillset.getETag());
skillset
- definition of the skillset containing one or more cognitive skillspublic com.azure.core.http.rest.Response<SearchIndexerSkillset> createSkillsetWithResponse(SearchIndexerSkillset skillset, com.azure.core.util.Context context)
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/*"))); Response<SearchIndexerSkillset> skillsetWithResponse = searchIndexerClient.createSkillsetWithResponse(searchIndexerSkillset, new Context(key1, value1)); System.out.printf("The status code of the response is %s. The indexer skillset name is %s.%n", skillsetWithResponse.getStatusCode(), skillsetWithResponse.getValue().getName());
skillset
- definition of the skillset containing one or more cognitive skillscontext
- additional context that is passed through the HTTP pipeline during the service callpublic SearchIndexerSkillset getSkillset(String skillsetName)
Code Sample
Get search indexer skillset "searchIndexerSkillset".
SearchIndexerSkillset indexerSkillset = searchIndexerClient.getSkillset("searchIndexerSkillset"); System.out.printf("The indexer skillset name is %s. The ETag of indexer skillset is %s.%n", indexerSkillset.getName(), indexerSkillset.getETag());
skillsetName
- the name of the skillset to retrievepublic com.azure.core.http.rest.Response<SearchIndexerSkillset> getSkillsetWithResponse(String skillsetName, com.azure.core.util.Context context)
Code Sample
Get search indexer skillset "searchIndexerSkillset".
Response<SearchIndexerSkillset> skillsetWithResponse = searchIndexerClient.getSkillsetWithResponse( "searchIndexerSkillset", new Context(key1, value1)); System.out.printf("The status code of the response is %s. The indexer skillset name is %s.%n", skillsetWithResponse.getStatusCode(), skillsetWithResponse.getValue().getName());
skillsetName
- the name of the skillset to retrievecontext
- additional context that is passed through the HTTP pipeline during the service callpublic com.azure.core.http.rest.PagedIterable<SearchIndexerSkillset> listSkillsets()
Code Sample
List all search indexer skillsets.
PagedIterable<SearchIndexerSkillset> indexerSkillsets = searchIndexerClient.listSkillsets(); for (SearchIndexerSkillset skillset: indexerSkillsets) { System.out.printf("The skillset name is %s. The ETag of skillset is %s.%n", skillset.getName(), skillset.getETag()); }
public com.azure.core.http.rest.PagedIterable<SearchIndexerSkillset> listSkillsets(com.azure.core.util.Context context)
Code Sample
List all search indexer skillsets.
PagedIterable<SearchIndexerSkillset> indexerSkillsets = searchIndexerClient.listSkillsets(new Context(key1, value1)); System.out.println("The status code of the response is" + indexerSkillsets.iterableByPage().iterator().next().getStatusCode()); for (SearchIndexerSkillset skillset: indexerSkillsets) { System.out.printf("The skillset name is %s. The ETag of skillset is %s.%n", skillset.getName(), skillset.getETag()); }
context
- additional context that is passed through the HTTP pipeline during the service callpublic com.azure.core.http.rest.PagedIterable<String> listSkillsetNames()
Code Sample
List all search indexer skillset names.
PagedIterable<String> skillsetNames = searchIndexerClient.listSkillsetNames(); for (String skillsetName: skillsetNames) { System.out.printf("The indexer skillset name is %s.%n", skillsetName); }
public com.azure.core.http.rest.PagedIterable<String> listSkillsetNames(com.azure.core.util.Context context)
Code Sample
List all search indexer skillset names with response.
PagedIterable<String> skillsetNames = searchIndexerClient.listSkillsetNames(new Context(key1, value1)); System.out.println("The status code of the response is" + skillsetNames.iterableByPage().iterator().next().getStatusCode()); for (String skillsetName: skillsetNames) { System.out.printf("The indexer skillset name is %s.%n", skillsetName); }
context
- additional context that is passed through the HTTP pipeline during the service callpublic SearchIndexerSkillset createOrUpdateSkillset(SearchIndexerSkillset skillset)
Code Sample
Create or update search indexer skillset "searchIndexerSkillset".
SearchIndexerSkillset indexerSkillset = searchIndexerClient.getSkillset("searchIndexerSkillset"); indexerSkillset.setDescription("This is new description!"); SearchIndexerSkillset updateSkillset = searchIndexerClient.createOrUpdateSkillset(indexerSkillset); System.out.printf("The indexer skillset name is %s. The description of indexer skillset is %s.%n", updateSkillset.getName(), updateSkillset.getDescription());
skillset
- the SearchIndexerSkillset
to create or update.public com.azure.core.http.rest.Response<SearchIndexerSkillset> createOrUpdateSkillsetWithResponse(SearchIndexerSkillset skillset, boolean onlyIfUnchanged, com.azure.core.util.Context context)
Code Sample
Create or update search indexer skillset "searchIndexerSkillset".
SearchIndexerSkillset indexerSkillset = searchIndexerClient.getSkillset("searchIndexerSkillset"); indexerSkillset.setDescription("This is new description!"); Response<SearchIndexerSkillset> updateSkillsetResponse = searchIndexerClient.createOrUpdateSkillsetWithResponse( indexerSkillset, true, new Context(key1, value1)); 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());
skillset
- the SearchIndexerSkillset
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.context
- additional context that is passed through the HTTP pipeline during the service callpublic com.azure.core.http.rest.Response<SearchIndexerSkillset> createOrUpdateSkillsetWithResponse(CreateOrUpdateSkillsetOptions options, com.azure.core.util.Context context)
Code Sample
Create or update search indexer skillset "searchIndexerSkillset".
SearchIndexerSkillset indexerSkillset = searchIndexerClient.getSkillset("searchIndexerSkillset"); indexerSkillset.setDescription("This is new description!"); CreateOrUpdateSkillsetOptions options = new CreateOrUpdateSkillsetOptions(indexerSkillset) .setOnlyIfUnchanged(true) .setCacheReprocessingChangeDetectionDisabled(false) .setCacheResetRequirementsIgnored(true); Response<SearchIndexerSkillset> updateSkillsetResponse = searchIndexerClient.createOrUpdateSkillsetWithResponse( options, new Context(key1, value1)); 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());
options
- The options used to create or update the skillset
.context
- additional context that is passed through the HTTP pipeline during the service callNullPointerException
- If options
is null.public void deleteSkillset(String skillsetName)
Code Sample
Delete search indexer skillset "searchIndexerSkillset".
searchIndexerClient.deleteSkillset("searchIndexerSkillset");
skillsetName
- the name of the skillset to deletepublic com.azure.core.http.rest.Response<Void> deleteSkillsetWithResponse(SearchIndexerSkillset skillset, boolean onlyIfUnchanged, com.azure.core.util.Context context)
Code Sample
Delete search indexer skillset "searchIndexerSkillset".
SearchIndexerSkillset searchIndexerSkillset = searchIndexerClient.getSkillset("searchIndexerSkillset"); Response<Void> deleteResponse = searchIndexerClient.deleteSkillsetWithResponse(searchIndexerSkillset, true, new Context(key1, value1)); System.out.printf("The status code of the response is %d.%n", deleteResponse.getStatusCode());
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.context
- additional context that is passed through the HTTP pipeline during the service callCopyright © 2021 Microsoft Corporation. All rights reserved.