com.google.cloud.discoveryengine.v1beta
A client to Discovery Engine API
The interfaces provided are listed below, along with usage samples.
DocumentServiceClient
Service Description: Service for ingesting Document information of the customer's website.
Sample for DocumentServiceClient:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (DocumentServiceClient documentServiceClient = DocumentServiceClient.create()) {
DocumentName name =
DocumentName.of("[PROJECT]", "[LOCATION]", "[DATA_STORE]", "[BRANCH]", "[DOCUMENT]");
Document response = documentServiceClient.getDocument(name);
}
RecommendationServiceClient
Service Description: Service for making recommendations.
Sample for RecommendationServiceClient:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (RecommendationServiceClient recommendationServiceClient =
RecommendationServiceClient.create()) {
RecommendRequest request =
RecommendRequest.newBuilder()
.setServingConfig(
ServingConfigName.of(
"[PROJECT]", "[LOCATION]", "[DATA_STORE]", "[SERVING_CONFIG]")
.toString())
.setUserEvent(UserEvent.newBuilder().build())
.setPageSize(883849137)
.setFilter("filter-1274492040")
.setValidateOnly(true)
.putAllParams(new HashMap<String, Value>())
.putAllUserLabels(new HashMap<String, String>())
.build();
RecommendResponse response = recommendationServiceClient.recommend(request);
}
UserEventServiceClient
Service Description: Service for ingesting end user actions on a website to Discovery Engine API.
Sample for UserEventServiceClient:
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in
// https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
try (UserEventServiceClient userEventServiceClient = UserEventServiceClient.create()) {
WriteUserEventRequest request =
WriteUserEventRequest.newBuilder()
.setParent(DataStoreName.of("[PROJECT]", "[LOCATION]", "[DATA_STORE]").toString())
.setUserEvent(UserEvent.newBuilder().build())
.build();
UserEvent response = userEventServiceClient.writeUserEvent(request);
}