Class Discovery
public class Discovery
extends com.ibm.cloud.sdk.core.service.BaseService
API Version: 2.0 See: https://cloud.ibm.com/docs/discovery-data
-
Field Summary
Fields Modifier and Type Field Description static String
DEFAULT_SERVICE_NAME
static String
DEFAULT_SERVICE_URL
Fields inherited from class com.ibm.cloud.sdk.core.service.BaseService
PROPNAME_DISABLE_SSL, PROPNAME_ENABLE_GZIP, PROPNAME_URL
-
Constructor Summary
Constructors Constructor Description Discovery(String version)
Constructs an instance of the `Discovery` client.Discovery(String version, com.ibm.cloud.sdk.core.security.Authenticator authenticator)
Constructs an instance of the `Discovery` client.Discovery(String version, String serviceName)
Constructs an instance of the `Discovery` client.Discovery(String version, String serviceName, com.ibm.cloud.sdk.core.security.Authenticator authenticator)
Constructs an instance of the `Discovery` client. -
Method Summary
Modifier and Type Method Description com.ibm.cloud.sdk.core.http.ServiceCall<DocumentAccepted>
addDocument(AddDocumentOptions addDocumentOptions)
Add a document.com.ibm.cloud.sdk.core.http.ServiceCall<AnalyzedDocument>
analyzeDocument(AnalyzeDocumentOptions analyzeDocumentOptions)
Analyze a Document.com.ibm.cloud.sdk.core.http.ServiceCall<CollectionDetails>
createCollection(CreateCollectionOptions createCollectionOptions)
Create a collection.com.ibm.cloud.sdk.core.http.ServiceCall<Enrichment>
createEnrichment(CreateEnrichmentOptions createEnrichmentOptions)
Create an enrichment.com.ibm.cloud.sdk.core.http.ServiceCall<ProjectDetails>
createProject(CreateProjectOptions createProjectOptions)
Create a Project.com.ibm.cloud.sdk.core.http.ServiceCall<TrainingQuery>
createTrainingQuery(CreateTrainingQueryOptions createTrainingQueryOptions)
Create training query.com.ibm.cloud.sdk.core.http.ServiceCall<Void>
deleteCollection(DeleteCollectionOptions deleteCollectionOptions)
Delete a collection.com.ibm.cloud.sdk.core.http.ServiceCall<DeleteDocumentResponse>
deleteDocument(DeleteDocumentOptions deleteDocumentOptions)
Delete a document.com.ibm.cloud.sdk.core.http.ServiceCall<Void>
deleteEnrichment(DeleteEnrichmentOptions deleteEnrichmentOptions)
Delete an enrichment.com.ibm.cloud.sdk.core.http.ServiceCall<Void>
deleteProject(DeleteProjectOptions deleteProjectOptions)
Delete a project.com.ibm.cloud.sdk.core.http.ServiceCall<Void>
deleteTrainingQueries(DeleteTrainingQueriesOptions deleteTrainingQueriesOptions)
Delete training queries.com.ibm.cloud.sdk.core.http.ServiceCall<Void>
deleteTrainingQuery(DeleteTrainingQueryOptions deleteTrainingQueryOptions)
Delete a training data query.com.ibm.cloud.sdk.core.http.ServiceCall<Void>
deleteUserData(DeleteUserDataOptions deleteUserDataOptions)
Delete labeled data.com.ibm.cloud.sdk.core.http.ServiceCall<Completions>
getAutocompletion(GetAutocompletionOptions getAutocompletionOptions)
Get Autocomplete Suggestions.com.ibm.cloud.sdk.core.http.ServiceCall<CollectionDetails>
getCollection(GetCollectionOptions getCollectionOptions)
Get collection.com.ibm.cloud.sdk.core.http.ServiceCall<ComponentSettingsResponse>
getComponentSettings(GetComponentSettingsOptions getComponentSettingsOptions)
List component settings.com.ibm.cloud.sdk.core.http.ServiceCall<Enrichment>
getEnrichment(GetEnrichmentOptions getEnrichmentOptions)
Get enrichment.com.ibm.cloud.sdk.core.http.ServiceCall<ProjectDetails>
getProject(GetProjectOptions getProjectOptions)
Get project.com.ibm.cloud.sdk.core.http.ServiceCall<TrainingQuery>
getTrainingQuery(GetTrainingQueryOptions getTrainingQueryOptions)
Get a training data query.String
getVersion()
Gets the version.com.ibm.cloud.sdk.core.http.ServiceCall<ListCollectionsResponse>
listCollections(ListCollectionsOptions listCollectionsOptions)
List collections.com.ibm.cloud.sdk.core.http.ServiceCall<Enrichments>
listEnrichments(ListEnrichmentsOptions listEnrichmentsOptions)
List Enrichments.com.ibm.cloud.sdk.core.http.ServiceCall<ListFieldsResponse>
listFields(ListFieldsOptions listFieldsOptions)
List fields.com.ibm.cloud.sdk.core.http.ServiceCall<ListProjectsResponse>
listProjects()
List projects.com.ibm.cloud.sdk.core.http.ServiceCall<ListProjectsResponse>
listProjects(ListProjectsOptions listProjectsOptions)
List projects.com.ibm.cloud.sdk.core.http.ServiceCall<TrainingQuerySet>
listTrainingQueries(ListTrainingQueriesOptions listTrainingQueriesOptions)
List training queries.com.ibm.cloud.sdk.core.http.ServiceCall<QueryResponse>
query(QueryOptions queryOptions)
Query a project.com.ibm.cloud.sdk.core.http.ServiceCall<QueryNoticesResponse>
queryCollectionNotices(QueryCollectionNoticesOptions queryCollectionNoticesOptions)
Query collection notices.com.ibm.cloud.sdk.core.http.ServiceCall<QueryNoticesResponse>
queryNotices(QueryNoticesOptions queryNoticesOptions)
Query project notices.void
setVersion(String version)
Sets the version.com.ibm.cloud.sdk.core.http.ServiceCall<CollectionDetails>
updateCollection(UpdateCollectionOptions updateCollectionOptions)
Update a collection.com.ibm.cloud.sdk.core.http.ServiceCall<DocumentAccepted>
updateDocument(UpdateDocumentOptions updateDocumentOptions)
Update a document.com.ibm.cloud.sdk.core.http.ServiceCall<Enrichment>
updateEnrichment(UpdateEnrichmentOptions updateEnrichmentOptions)
Update an enrichment.com.ibm.cloud.sdk.core.http.ServiceCall<ProjectDetails>
updateProject(UpdateProjectOptions updateProjectOptions)
Update a project.com.ibm.cloud.sdk.core.http.ServiceCall<TrainingQuery>
updateTrainingQuery(UpdateTrainingQueryOptions updateTrainingQueryOptions)
Update a training query.Methods inherited from class com.ibm.cloud.sdk.core.service.BaseService
configureClient, configureService, constructServiceUrl, constructServiceURL, enableGzipCompression, getAuthenticator, getClient, getEndPoint, getName, getServiceUrl, isJsonMimeType, isJsonPatchMimeType, setClient, setDefaultHeaders, setEndPoint, setServiceUrl, toString
-
Field Details
-
DEFAULT_SERVICE_NAME
- See Also:
- Constant Field Values
-
DEFAULT_SERVICE_URL
- See Also:
- Constant Field Values
-
-
Constructor Details
-
Discovery
Constructs an instance of the `Discovery` client. The default service name is used to configure the client instance.- Parameters:
version
- Release date of the version of the API you want to use. Specify dates in YYYY-MM-DD format. The current version is `2020-08-30`.
-
Discovery
Constructs an instance of the `Discovery` client. The default service name and specified authenticator are used to configure the client instance.- Parameters:
version
- Release date of the version of the API you want to use. Specify dates in YYYY-MM-DD format. The current version is `2020-08-30`.authenticator
- theAuthenticator
instance to be configured for this client
-
Discovery
Constructs an instance of the `Discovery` client. The specified service name is used to configure the client instance.- Parameters:
version
- Release date of the version of the API you want to use. Specify dates in YYYY-MM-DD format. The current version is `2020-08-30`.serviceName
- the service name to be used when configuring the client instance
-
Discovery
public Discovery(String version, String serviceName, com.ibm.cloud.sdk.core.security.Authenticator authenticator)Constructs an instance of the `Discovery` client. The specified service name and authenticator are used to configure the client instance.- Parameters:
version
- Release date of the version of the API you want to use. Specify dates in YYYY-MM-DD format. The current version is `2020-08-30`.serviceName
- the service name to be used when configuring the client instanceauthenticator
- theAuthenticator
instance to be configured for this client
-
-
Method Details
-
getVersion
Gets the version.Release date of the version of the API you want to use. Specify dates in YYYY-MM-DD format. The current version is `2020-08-30`.
- Returns:
- the version
-
setVersion
Sets the version.- Parameters:
version
- the new version
-
listCollections
public com.ibm.cloud.sdk.core.http.ServiceCall<ListCollectionsResponse> listCollections(ListCollectionsOptions listCollectionsOptions)List collections.Lists existing collections for the specified project.
- Parameters:
listCollectionsOptions
- theListCollectionsOptions
containing the options for the call- Returns:
- a
ServiceCall
with a result of typeListCollectionsResponse
-
createCollection
public com.ibm.cloud.sdk.core.http.ServiceCall<CollectionDetails> createCollection(CreateCollectionOptions createCollectionOptions)Create a collection.Create a new collection in the specified project.
- Parameters:
createCollectionOptions
- theCreateCollectionOptions
containing the options for the call- Returns:
- a
ServiceCall
with a result of typeCollectionDetails
-
getCollection
public com.ibm.cloud.sdk.core.http.ServiceCall<CollectionDetails> getCollection(GetCollectionOptions getCollectionOptions)Get collection.Get details about the specified collection.
- Parameters:
getCollectionOptions
- theGetCollectionOptions
containing the options for the call- Returns:
- a
ServiceCall
with a result of typeCollectionDetails
-
updateCollection
public com.ibm.cloud.sdk.core.http.ServiceCall<CollectionDetails> updateCollection(UpdateCollectionOptions updateCollectionOptions)Update a collection.Updates the specified collection's name, description, and enrichments.
- Parameters:
updateCollectionOptions
- theUpdateCollectionOptions
containing the options for the call- Returns:
- a
ServiceCall
with a result of typeCollectionDetails
-
deleteCollection
public com.ibm.cloud.sdk.core.http.ServiceCall<Void> deleteCollection(DeleteCollectionOptions deleteCollectionOptions)Delete a collection.Deletes the specified collection from the project. All documents stored in the specified collection and not shared is also deleted.
- Parameters:
deleteCollectionOptions
- theDeleteCollectionOptions
containing the options for the call- Returns:
- a
ServiceCall
with a void result
-
query
Query a project.By using this method, you can construct queries. For details, see the [Discovery documentation](https://cloud.ibm.com/docs/discovery-data?topic=discovery-data-query-concepts). The default query parameters are defined by the settings for this project, see the [Discovery documentation](https://cloud.ibm.com/docs/discovery-data?topic=discovery-data-project-defaults) for an overview of the standard default settings, and see [the Projects API documentation](#create-project) for details about how to set custom default query settings.
- Parameters:
queryOptions
- theQueryOptions
containing the options for the call- Returns:
- a
ServiceCall
with a result of typeQueryResponse
-
getAutocompletion
public com.ibm.cloud.sdk.core.http.ServiceCall<Completions> getAutocompletion(GetAutocompletionOptions getAutocompletionOptions)Get Autocomplete Suggestions.Returns completion query suggestions for the specified prefix.
- Parameters:
getAutocompletionOptions
- theGetAutocompletionOptions
containing the options for the call- Returns:
- a
ServiceCall
with a result of typeCompletions
-
queryCollectionNotices
public com.ibm.cloud.sdk.core.http.ServiceCall<QueryNoticesResponse> queryCollectionNotices(QueryCollectionNoticesOptions queryCollectionNoticesOptions)Query collection notices.Finds collection-level notices (errors and warnings) that are generated when documents are ingested.
- Parameters:
queryCollectionNoticesOptions
- theQueryCollectionNoticesOptions
containing the options for the call- Returns:
- a
ServiceCall
with a result of typeQueryNoticesResponse
-
queryNotices
public com.ibm.cloud.sdk.core.http.ServiceCall<QueryNoticesResponse> queryNotices(QueryNoticesOptions queryNoticesOptions)Query project notices.Finds project-level notices (errors and warnings). Currently, project-level notices are generated by relevancy training.
- Parameters:
queryNoticesOptions
- theQueryNoticesOptions
containing the options for the call- Returns:
- a
ServiceCall
with a result of typeQueryNoticesResponse
-
listFields
public com.ibm.cloud.sdk.core.http.ServiceCall<ListFieldsResponse> listFields(ListFieldsOptions listFieldsOptions)List fields.Gets a list of the unique fields (and their types) stored in the the specified collections.
- Parameters:
listFieldsOptions
- theListFieldsOptions
containing the options for the call- Returns:
- a
ServiceCall
with a result of typeListFieldsResponse
-
getComponentSettings
public com.ibm.cloud.sdk.core.http.ServiceCall<ComponentSettingsResponse> getComponentSettings(GetComponentSettingsOptions getComponentSettingsOptions)List component settings.Returns default configuration settings for components.
- Parameters:
getComponentSettingsOptions
- theGetComponentSettingsOptions
containing the options for the call- Returns:
- a
ServiceCall
with a result of typeComponentSettingsResponse
-
addDocument
public com.ibm.cloud.sdk.core.http.ServiceCall<DocumentAccepted> addDocument(AddDocumentOptions addDocumentOptions)Add a document.Add a document to a collection with optional metadata.
Returns immediately after the system has accepted the document for processing.
* The user must provide document content, metadata, or both. If the request is missing both document content and metadata, it is rejected.
* You can set the **Content-Type** parameter on the **file** part to indicate the media type of the document. If the **Content-Type** parameter is missing or is one of the generic media types (for example, `application/octet-stream`), then the service attempts to automatically detect the document's media type.
* The following field names are reserved and are filtered out if present after normalization: `id`, `score`, `highlight`, and any field with the prefix of: `_`, `+`, or `-`
* Fields with empty name values after normalization are filtered out before indexing.
* Fields that contain the following characters after normalization are filtered out before indexing: `#` and `,`
If the document is uploaded to a collection that shares its data with another collection, the **X-Watson-Discovery-Force** header must be set to `true`.
**Note:** You can assign an ID to a document that you add by appending the ID to the endpoint (`/v2/projects/{project_id}/collections/{collection_id}/documents/{document_id}`). If a document already exists with the specified ID, it is replaced.
**Note:** This operation works with a file upload collection. It cannot be used to modify a collection that crawls an external data source.
- Parameters:
addDocumentOptions
- theAddDocumentOptions
containing the options for the call- Returns:
- a
ServiceCall
with a result of typeDocumentAccepted
-
updateDocument
public com.ibm.cloud.sdk.core.http.ServiceCall<DocumentAccepted> updateDocument(UpdateDocumentOptions updateDocumentOptions)Update a document.Replace an existing document or add a document with a specified **document_id**. Starts ingesting a document with optional metadata.
If the document is uploaded to a collection that shares its data with another collection, the **X-Watson-Discovery-Force** header must be set to `true`.
**Note:** When uploading a new document with this method it automatically replaces any document stored with the same **document_id** if it exists.
**Note:** This operation only works on collections created to accept direct file uploads. It cannot be used to modify a collection that connects to an external source such as Microsoft SharePoint.
**Note:** If an uploaded document is segmented, all segments are overwritten, even if the updated version of the document has fewer segments.
- Parameters:
updateDocumentOptions
- theUpdateDocumentOptions
containing the options for the call- Returns:
- a
ServiceCall
with a result of typeDocumentAccepted
-
deleteDocument
public com.ibm.cloud.sdk.core.http.ServiceCall<DeleteDocumentResponse> deleteDocument(DeleteDocumentOptions deleteDocumentOptions)Delete a document.If the given document ID is invalid, or if the document is not found, then the a success response is returned (HTTP status code `200`) with the status set to 'deleted'.
**Note:** This operation only works on collections created to accept direct file uploads. It cannot be used to modify a collection that connects to an external source such as Microsoft SharePoint.
**Note:** Segments of an uploaded document cannot be deleted individually. Delete all segments by deleting using the `parent_document_id` of a segment result.
- Parameters:
deleteDocumentOptions
- theDeleteDocumentOptions
containing the options for the call- Returns:
- a
ServiceCall
with a result of typeDeleteDocumentResponse
-
listTrainingQueries
public com.ibm.cloud.sdk.core.http.ServiceCall<TrainingQuerySet> listTrainingQueries(ListTrainingQueriesOptions listTrainingQueriesOptions)List training queries.List the training queries for the specified project.
- Parameters:
listTrainingQueriesOptions
- theListTrainingQueriesOptions
containing the options for the call- Returns:
- a
ServiceCall
with a result of typeTrainingQuerySet
-
deleteTrainingQueries
public com.ibm.cloud.sdk.core.http.ServiceCall<Void> deleteTrainingQueries(DeleteTrainingQueriesOptions deleteTrainingQueriesOptions)Delete training queries.Removes all training queries for the specified project.
- Parameters:
deleteTrainingQueriesOptions
- theDeleteTrainingQueriesOptions
containing the options for the call- Returns:
- a
ServiceCall
with a void result
-
createTrainingQuery
public com.ibm.cloud.sdk.core.http.ServiceCall<TrainingQuery> createTrainingQuery(CreateTrainingQueryOptions createTrainingQueryOptions)Create training query.Add a query to the training data for this project. The query can contain a filter and natural language query.
- Parameters:
createTrainingQueryOptions
- theCreateTrainingQueryOptions
containing the options for the call- Returns:
- a
ServiceCall
with a result of typeTrainingQuery
-
getTrainingQuery
public com.ibm.cloud.sdk.core.http.ServiceCall<TrainingQuery> getTrainingQuery(GetTrainingQueryOptions getTrainingQueryOptions)Get a training data query.Get details for a specific training data query, including the query string and all examples.
- Parameters:
getTrainingQueryOptions
- theGetTrainingQueryOptions
containing the options for the call- Returns:
- a
ServiceCall
with a result of typeTrainingQuery
-
updateTrainingQuery
public com.ibm.cloud.sdk.core.http.ServiceCall<TrainingQuery> updateTrainingQuery(UpdateTrainingQueryOptions updateTrainingQueryOptions)Update a training query.Updates an existing training query and it's examples.
- Parameters:
updateTrainingQueryOptions
- theUpdateTrainingQueryOptions
containing the options for the call- Returns:
- a
ServiceCall
with a result of typeTrainingQuery
-
deleteTrainingQuery
public com.ibm.cloud.sdk.core.http.ServiceCall<Void> deleteTrainingQuery(DeleteTrainingQueryOptions deleteTrainingQueryOptions)Delete a training data query.Removes details from a training data query, including the query string and all examples.
- Parameters:
deleteTrainingQueryOptions
- theDeleteTrainingQueryOptions
containing the options for the call- Returns:
- a
ServiceCall
with a void result
-
analyzeDocument
public com.ibm.cloud.sdk.core.http.ServiceCall<AnalyzedDocument> analyzeDocument(AnalyzeDocumentOptions analyzeDocumentOptions)Analyze a Document.Process a document and return it for realtime use. Supports JSON files only.
The document is processed according to the collection's configuration settings but is not stored in the collection.
**Note:** This method is supported on installed instances of Discovery only.
- Parameters:
analyzeDocumentOptions
- theAnalyzeDocumentOptions
containing the options for the call- Returns:
- a
ServiceCall
with a result of typeAnalyzedDocument
-
listEnrichments
public com.ibm.cloud.sdk.core.http.ServiceCall<Enrichments> listEnrichments(ListEnrichmentsOptions listEnrichmentsOptions)List Enrichments.Lists the enrichments available to this project. The *Part of Speech* and *Sentiment of Phrases* enrichments might be listed, but are reserved for internal use only.
- Parameters:
listEnrichmentsOptions
- theListEnrichmentsOptions
containing the options for the call- Returns:
- a
ServiceCall
with a result of typeEnrichments
-
createEnrichment
public com.ibm.cloud.sdk.core.http.ServiceCall<Enrichment> createEnrichment(CreateEnrichmentOptions createEnrichmentOptions)Create an enrichment.Create an enrichment for use with the specified project.
- Parameters:
createEnrichmentOptions
- theCreateEnrichmentOptions
containing the options for the call- Returns:
- a
ServiceCall
with a result of typeEnrichment
-
getEnrichment
public com.ibm.cloud.sdk.core.http.ServiceCall<Enrichment> getEnrichment(GetEnrichmentOptions getEnrichmentOptions)Get enrichment.Get details about a specific enrichment.
- Parameters:
getEnrichmentOptions
- theGetEnrichmentOptions
containing the options for the call- Returns:
- a
ServiceCall
with a result of typeEnrichment
-
updateEnrichment
public com.ibm.cloud.sdk.core.http.ServiceCall<Enrichment> updateEnrichment(UpdateEnrichmentOptions updateEnrichmentOptions)Update an enrichment.Updates an existing enrichment's name and description.
- Parameters:
updateEnrichmentOptions
- theUpdateEnrichmentOptions
containing the options for the call- Returns:
- a
ServiceCall
with a result of typeEnrichment
-
deleteEnrichment
public com.ibm.cloud.sdk.core.http.ServiceCall<Void> deleteEnrichment(DeleteEnrichmentOptions deleteEnrichmentOptions)Delete an enrichment.Deletes an existing enrichment from the specified project.
**Note:** Only enrichments that have been manually created can be deleted.
- Parameters:
deleteEnrichmentOptions
- theDeleteEnrichmentOptions
containing the options for the call- Returns:
- a
ServiceCall
with a void result
-
listProjects
public com.ibm.cloud.sdk.core.http.ServiceCall<ListProjectsResponse> listProjects(ListProjectsOptions listProjectsOptions)List projects.Lists existing projects for this instance.
- Parameters:
listProjectsOptions
- theListProjectsOptions
containing the options for the call- Returns:
- a
ServiceCall
with a result of typeListProjectsResponse
-
listProjects
List projects.Lists existing projects for this instance.
- Returns:
- a
ServiceCall
with a result of typeListProjectsResponse
-
createProject
public com.ibm.cloud.sdk.core.http.ServiceCall<ProjectDetails> createProject(CreateProjectOptions createProjectOptions)Create a Project.Create a new project for this instance.
- Parameters:
createProjectOptions
- theCreateProjectOptions
containing the options for the call- Returns:
- a
ServiceCall
with a result of typeProjectDetails
-
getProject
public com.ibm.cloud.sdk.core.http.ServiceCall<ProjectDetails> getProject(GetProjectOptions getProjectOptions)Get project.Get details on the specified project.
- Parameters:
getProjectOptions
- theGetProjectOptions
containing the options for the call- Returns:
- a
ServiceCall
with a result of typeProjectDetails
-
updateProject
public com.ibm.cloud.sdk.core.http.ServiceCall<ProjectDetails> updateProject(UpdateProjectOptions updateProjectOptions)Update a project.Update the specified project's name.
- Parameters:
updateProjectOptions
- theUpdateProjectOptions
containing the options for the call- Returns:
- a
ServiceCall
with a result of typeProjectDetails
-
deleteProject
public com.ibm.cloud.sdk.core.http.ServiceCall<Void> deleteProject(DeleteProjectOptions deleteProjectOptions)Delete a project.Deletes the specified project.
**Important:** Deleting a project deletes everything that is part of the specified project, including all collections.
- Parameters:
deleteProjectOptions
- theDeleteProjectOptions
containing the options for the call- Returns:
- a
ServiceCall
with a void result
-
deleteUserData
public com.ibm.cloud.sdk.core.http.ServiceCall<Void> deleteUserData(DeleteUserDataOptions deleteUserDataOptions)Delete labeled data.Deletes all data associated with a specified customer ID. The method has no effect if no data is associated with the customer ID.
You associate a customer ID with data by passing the **X-Watson-Metadata** header with a request that passes data. For more information about personal data and customer IDs, see [Information security](https://cloud.ibm.com/docs/discovery-data?topic=discovery-data-information-security#information-security).
**Note:** This method is only supported on IBM Cloud instances of Discovery.
- Parameters:
deleteUserDataOptions
- theDeleteUserDataOptions
containing the options for the call- Returns:
- a
ServiceCall
with a void result
-