The IBM Watson™ Discovery service makes it possible to rapidly build cognitive, cloud-based exploration applications that unlock actionable insights hidden in unstructured data - including your own proprietary data, as well as public and third-party data.
PM > Install-Package IBM.WatsonDeveloperCloud.Discovery.v1
<ItemGroup>
<PackageReference Include="IBM.WatsonDeveloperCloud.Discovery.v1" Version="2.5.0" />
</ItemGroup>
The IBM Watson™ Discovery Service uses data analysis combined with cognitive intuition in order to take your unstructured data and enrich it so that you can query it to return the information that you need from it.
Creates an environment for the service instance. Note: You can create only one environment per service instance. Attempting to create another environment for the same service instance results in an error. See the Discovery service home page for additional information about sizing and pricing. To create a free trial environment, specify the value of size as 0 (zero).
CreateEnvironmentRequest createEnvironmentRequest = new CreateEnvironmentRequest()
{
Name = <environment-name>,
Description = <environment-description>,
Size = <environment-size>
};
var result = _discovery.CreateEnvironment(createEnvironmentRequest);
List existing environments for the service instance.
var result = _discovery.ListEnvironments();
Gets detailed information about the specified environment.
var result = _discovery.GetEnvironment(<environmentId>);
Updates an existing environment.
UpdateEnvironmentRequest updateEnvironmentRequest = new UpdateEnvironmentRequest()
{
Name = <updated-environment-name>,
Description = <updated-environment-description>
};
var result = _discovery.UpdateEnvironment(updateEnvironmentRequest);
Deletes an existing environment.
var result = _discovery.DeleteEnvironment(<environmentId>);
Adds a configuration to the service instance.
Configuration configuration = new Configuration()
{
Name = <configuration-name>,
Description = <configuration-description>,
[...]
};
var result = _discovery.CreateConfiguration(<environmentId>, configuration);
Lists existing configurations for the service instance.
var result = _discovery.ListConfigurations(<environmentId>);
Get information about the specified configuration.
var result = _discovery.GetConfiguration(<environmentId>, <configurationId>);
Replaces an existing configuration. This operation completely replaces the previous configuration. Important: Do not attempt to replace the default configuration.
The new configuration can contain one or more of the configuration_id, updated, or created elements, but the elements are ignored and do not generate errors to enable pasting in another existing configuration. You can also provide a new configuration with none of the three elements.
Documents are processed with a snapshot of the configuration that was in place at the time the document was submitted for ingestion. This means documents that were already submitted are not processed with the new configuration.
Configuration configuration = new Configuration()
{
Name = <configuration-name>,
Description = <configuration-description>,
[...]
};
var result = _discovery.UpdateConfiguration(<environmentId>, <configurationId>, configuration);
Deletes an existing configuration from the service instance.
The delete operation is performed unconditionally. A delete request succeeds even if the configuration is referenced by a collection or document ingestion. However, documents that have already been submitted for processing continue to use the deleted configuration; documents are always processed with a snapshot of the configuration as it existed at the time the document was submitted.
var result = _discovery.DeleteConfiguration(<environmentId>, <configurationId>);
Creates a new collection for storing documents.
CreateCollectionRequest createCollectionRequest = new CreateCollectionRequest()
{
Language = <collectionLanguage>,
Name = <collectionName>,
Description = <collectionDescription>,
ConfigurationId = <configurationId>
};
var result = _discovery.CreateCollection(<environmentId>, createCollectionRequest);
Display a list of existing collections.
var result = _discovery.ListCollections(<environmentId>);
Show detailed information about an existing collection.
Creates a new collection for storing documents.
var result = _discovery.GetCollection(<environmentId>, <collectionId>);
Gets a list of the unique fields, and each field's type, that are stored in a collection's index.
var result = _discovery.ListCollectionFields(<environmentId>, <collectionId>);
Deletes an existing collection.
var result = _discovery.DeleteCollection(<environmentId>, <collectionId>);
Add a document to your collection.
using (FileStream fs = File.OpenRead(<filepath>))
{
var result = _discovery.AddDocument(<environmentId>, <collectionId>, fs as Stream);
}
Update or partially update a document to create or replace an existing document.
using (FileStream fs = File.OpenRead(<filepath>))
{
var result = _discovery.UpdateDocument(<environmentId>, <collectionId>, <documentId>, <configurationId>, fs as Stream);
}
Display status information about a submitted document.
var result = _discovery.GetDocumentStatus(<environmentId, <collectionId>, <documentId>);
Delete a document from a collection.
var result = _discovery.DeleteDocument(<environmentId>, <collectionId>, <documentId>);
Query the documents in your collection.
Once your content is uploaded and enriched by the Discovery service, you can build queries to search your content. For a deep dive into queries, see Building Queries and Delivering Content.
var result = _discovery.Query(<environmentId>, <collectionId>, <query>);