Watson Developer Cloud .NET Standard SDK  6.1.0
The .NET SDK uses the Watson Developer Cloud services, a collection of REST APIs and SDKs that use cognitive computing to solve complex problems.
IBM.Watson.Discovery.v2.DiscoveryService Class Reference
Inheritance diagram for IBM.Watson.Discovery.v2.DiscoveryService:
IBM.Watson.Discovery.v2.IDiscoveryService

Classes

class  UpdateDocumentEnums
 Enum values for UpdateDocument. More...
 

Public Member Functions

 DiscoveryService (string version, WebProxy webProxy=null)
 
 DiscoveryService (string version, IAuthenticator authenticator, WebProxy webProxy=null)
 
 DiscoveryService (string version, string serviceName, WebProxy webProxy=null)
 
 DiscoveryService (IClient httpClient)
 
 DiscoveryService (string version, string serviceName, IAuthenticator authenticator, WebProxy webProxy=null)
 
DetailedResponse< ListProjectsResponseListProjects ()
 List projects. More...
 
DetailedResponse< ProjectDetailsCreateProject (string name, string type, DefaultQueryParams defaultQueryParameters=null)
 Create a project. More...
 
DetailedResponse< ProjectDetailsGetProject (string projectId)
 Get project. More...
 
DetailedResponse< ProjectDetailsUpdateProject (string projectId, string name=null)
 Update a project. More...
 
DetailedResponse< object > DeleteProject (string projectId)
 Delete a project. More...
 
DetailedResponse< ListFieldsResponseListFields (string projectId, List< string > collectionIds=null)
 List fields. More...
 
DetailedResponse< ListCollectionsResponseListCollections (string projectId)
 List collections. More...
 
DetailedResponse< CollectionDetailsCreateCollection (string projectId, string name, string description=null, string language=null, List< CollectionEnrichment > enrichments=null)
 Create a collection. More...
 
DetailedResponse< CollectionDetailsGetCollection (string projectId, string collectionId)
 Get collection. More...
 
DetailedResponse< CollectionDetailsUpdateCollection (string projectId, string collectionId, string name=null, string description=null, List< CollectionEnrichment > enrichments=null)
 Update a collection. More...
 
DetailedResponse< object > DeleteCollection (string projectId, string collectionId)
 Delete a collection. More...
 
DetailedResponse< ListDocumentsResponseListDocuments (string projectId, string collectionId, long? count=null, string status=null, bool? hasNotices=null, bool? isParent=null, string parentDocumentId=null, string sha256=null)
 List documents. More...
 
DetailedResponse< DocumentAcceptedUpdateDocument (string projectId, string collectionId, string documentId, System.IO.MemoryStream file=null, string filename=null, string fileContentType=null, string metadata=null, bool? xWatsonDiscoveryForce=null)
 Add a document. More...
 
DetailedResponse< DeleteDocumentResponseDeleteDocument (string projectId, string collectionId, string documentId, bool? xWatsonDiscoveryForce=null)
 Delete a document. More...
 
DetailedResponse< QueryResponseQuery (string projectId, List< string > collectionIds=null, string filter=null, string query=null, string naturalLanguageQuery=null, string aggregation=null, long? count=null, List< string > _return=null, long? offset=null, string sort=null, bool? highlight=null, bool? spellingSuggestions=null, QueryLargeTableResults tableResults=null, QueryLargeSuggestedRefinements suggestedRefinements=null, QueryLargePassages passages=null, QueryLargeSimilar similar=null)
 Query a project. More...
 
DetailedResponse< CompletionsGetAutocompletion (string projectId, string prefix, List< string > collectionIds=null, string field=null, long? count=null)
 Get Autocomplete Suggestions. More...
 
DetailedResponse< QueryNoticesResponseQueryCollectionNotices (string projectId, string collectionId, string filter=null, string query=null, string naturalLanguageQuery=null, long? count=null, long? offset=null)
 Query collection notices. More...
 
DetailedResponse< QueryNoticesResponseQueryNotices (string projectId, string filter=null, string query=null, string naturalLanguageQuery=null, long? count=null, long? offset=null)
 Query project notices. More...
 
DetailedResponse< StopWordListGetStopwordList (string projectId, string collectionId)
 Get a custom stop words list. More...
 
DetailedResponse< StopWordListCreateStopwordList (string projectId, string collectionId, List< string > stopwords=null)
 Create a custom stop words list. More...
 
DetailedResponse< object > DeleteStopwordList (string projectId, string collectionId)
 Delete a custom stop words list. More...
 
DetailedResponse< ExpansionsListExpansions (string projectId, string collectionId)
 Get the expansion list. More...
 
DetailedResponse< ExpansionsCreateExpansions (string projectId, string collectionId, List< Expansion > expansions)
 Create or update an expansion list. More...
 
DetailedResponse< object > DeleteExpansions (string projectId, string collectionId)
 Delete the expansion list. More...
 
DetailedResponse< ComponentSettingsResponseGetComponentSettings (string projectId)
 List component settings. More...
 
DetailedResponse< TrainingQuerySetListTrainingQueries (string projectId)
 List training queries. More...
 
DetailedResponse< object > DeleteTrainingQueries (string projectId)
 Delete training queries. More...
 
DetailedResponse< TrainingQueryCreateTrainingQuery (string projectId, string naturalLanguageQuery, List< TrainingExample > examples, string filter=null)
 Create training query. More...
 
DetailedResponse< TrainingQueryGetTrainingQuery (string projectId, string queryId)
 Get a training data query. More...
 
DetailedResponse< TrainingQueryUpdateTrainingQuery (string projectId, string queryId, string naturalLanguageQuery, List< TrainingExample > examples, string filter=null)
 Update a training query. More...
 
DetailedResponse< object > DeleteTrainingQuery (string projectId, string queryId)
 Delete a training data query. More...
 
DetailedResponse< EnrichmentsListEnrichments (string projectId)
 List enrichments. More...
 
DetailedResponse< EnrichmentCreateEnrichment (string projectId, CreateEnrichment enrichment, System.IO.MemoryStream file=null)
 Create an enrichment. More...
 
DetailedResponse< EnrichmentGetEnrichment (string projectId, string enrichmentId)
 Get enrichment. More...
 
DetailedResponse< EnrichmentUpdateEnrichment (string projectId, string enrichmentId, string name, string description=null)
 Update an enrichment. More...
 
DetailedResponse< object > DeleteEnrichment (string projectId, string enrichmentId)
 Delete an enrichment. More...
 
DetailedResponse< DocumentClassifiersListDocumentClassifiers (string projectId)
 List document classifiers. More...
 
DetailedResponse< DocumentClassifierCreateDocumentClassifier (string projectId, System.IO.MemoryStream trainingData, CreateDocumentClassifier classifier, System.IO.MemoryStream testData=null)
 Create a document classifier. More...
 
DetailedResponse< DocumentClassifierGetDocumentClassifier (string projectId, string classifierId)
 Get a document classifier. More...
 
DetailedResponse< DocumentClassifierUpdateDocumentClassifier (string projectId, string classifierId, UpdateDocumentClassifier classifier, System.IO.MemoryStream trainingData=null, System.IO.MemoryStream testData=null)
 Update a document classifier. More...
 
DetailedResponse< object > DeleteDocumentClassifier (string projectId, string classifierId)
 Delete a document classifier. More...
 
DetailedResponse< DocumentClassifierModelsListDocumentClassifierModels (string projectId, string classifierId)
 List document classifier models. More...
 
DetailedResponse< DocumentClassifierModelCreateDocumentClassifierModel (string projectId, string classifierId, string name, string description=null, double? learningRate=null, List< double?> l1RegularizationStrengths=null, List< double?> l2RegularizationStrengths=null, long? trainingMaxSteps=null, double? improvementRatio=null)
 Create a document classifier model. More...
 
DetailedResponse< DocumentClassifierModelGetDocumentClassifierModel (string projectId, string classifierId, string modelId)
 Get a document classifier model. More...
 
DetailedResponse< DocumentClassifierModelUpdateDocumentClassifierModel (string projectId, string classifierId, string modelId, string name=null, string description=null)
 Update a document classifier model. More...
 
DetailedResponse< object > DeleteDocumentClassifierModel (string projectId, string classifierId, string modelId)
 Delete a document classifier model. More...
 
- Public Member Functions inherited from IBM.Watson.Discovery.v2.IDiscoveryService
DetailedResponse< DocumentAcceptedAddDocument (string projectId, string collectionId, System.IO.MemoryStream file=null, string filename=null, string fileContentType=null, string metadata=null, bool? xWatsonDiscoveryForce=null)
 
DetailedResponse< DocumentDetailsGetDocument (string projectId, string collectionId, string documentId)
 
DetailedResponse< AnalyzedDocumentAnalyzeDocument (string projectId, string collectionId, System.IO.MemoryStream file=null, string filename=null, string fileContentType=null, string metadata=null)
 
DetailedResponse< object > DeleteUserData (string customerId)
 

Properties

string Version [get, set]
 

Constructor & Destructor Documentation

◆ DiscoveryService() [1/5]

IBM.Watson.Discovery.v2.DiscoveryService.DiscoveryService ( string  version,
WebProxy  webProxy = null 
)
inline

◆ DiscoveryService() [2/5]

IBM.Watson.Discovery.v2.DiscoveryService.DiscoveryService ( string  version,
IAuthenticator  authenticator,
WebProxy  webProxy = null 
)
inline

◆ DiscoveryService() [3/5]

IBM.Watson.Discovery.v2.DiscoveryService.DiscoveryService ( string  version,
string  serviceName,
WebProxy  webProxy = null 
)
inline

◆ DiscoveryService() [4/5]

IBM.Watson.Discovery.v2.DiscoveryService.DiscoveryService ( IClient  httpClient)
inline

◆ DiscoveryService() [5/5]

IBM.Watson.Discovery.v2.DiscoveryService.DiscoveryService ( string  version,
string  serviceName,
IAuthenticator  authenticator,
WebProxy  webProxy = null 
)
inline

Member Function Documentation

◆ CreateCollection()

DetailedResponse<CollectionDetails> IBM.Watson.Discovery.v2.DiscoveryService.CreateCollection ( string  projectId,
string  name,
string  description = null,
string  language = null,
List< CollectionEnrichment enrichments = null 
)
inline

Create a collection.

Create a new collection in the specified project.

Parameters
projectIdThe ID of the project. This information can be found from the Integrate and Deploy page in Discovery.
nameThe name of the collection.
descriptionA description of the collection. (optional)
languageThe language of the collection. For a list of supported languages, see the product documentation. (optional, default to en)
enrichmentsAn array of enrichments that are applied to this collection. To get a list of enrichments that are available for a project, use the List enrichments method.

If no enrichments are specified when the collection is created, the default enrichments for the project type are applied. For more information about project default settings, see the product documentation. (optional)

Returns
CollectionDetailsCollectionDetails

Implements IBM.Watson.Discovery.v2.IDiscoveryService.

◆ CreateDocumentClassifier()

DetailedResponse<DocumentClassifier> IBM.Watson.Discovery.v2.DiscoveryService.CreateDocumentClassifier ( string  projectId,
System.IO.MemoryStream  trainingData,
CreateDocumentClassifier  classifier,
System.IO.MemoryStream  testData = null 
)
inline

Create a document classifier.

Create a document classifier. You can use the API to create a document classifier in any project type. After you create a document classifier, you can use the Enrichments API to create a classifier enrichment, and then the Collections API to apply the enrichment to a collection in the project.

Note: This method is supported on installed instances (IBM Cloud Pak for Data) or IBM Cloud-managed Premium or Enterprise plan instances.

Parameters
projectIdThe ID of the project. This information can be found from the Integrate and Deploy page in Discovery.
trainingDataThe training data CSV file to upload. The CSV file must have headers. The file must include a field that contains the text you want to classify and a field that contains the classification labels that you want to use to classify your data. If you want to specify multiple values in a single field, use a semicolon as the value separator. For a sample file, see the product documentation.
classifierAn object that manages the settings and data that is required to train a document classification model.
testDataThe CSV with test data to upload. The column values in the test file must be the same as the column values in the training data file. If no test data is provided, the training data is split into two separate groups of training and test data. (optional)
Returns
DocumentClassifierDocumentClassifier

Implements IBM.Watson.Discovery.v2.IDiscoveryService.

◆ CreateDocumentClassifierModel()

DetailedResponse<DocumentClassifierModel> IBM.Watson.Discovery.v2.DiscoveryService.CreateDocumentClassifierModel ( string  projectId,
string  classifierId,
string  name,
string  description = null,
double?  learningRate = null,
List< double?>  l1RegularizationStrengths = null,
List< double?>  l2RegularizationStrengths = null,
long?  trainingMaxSteps = null,
double?  improvementRatio = null 
)
inline

Create a document classifier model.

Create a document classifier model by training a model that uses the data and classifier settings defined in the specified document classifier.

Note: This method is supported on installed intances (IBM Cloud Pak for Data) or IBM Cloud-managed Premium or Enterprise plan instances.

Parameters
projectIdThe ID of the project. This information can be found from the Integrate and Deploy page in Discovery.
classifierIdThe ID of the classifier.
nameThe name of the document classifier model.
descriptionA description of the document classifier model. (optional)
learningRateA tuning parameter in an optimization algorithm that determines the step size at each iteration of the training process. It influences how much of any newly acquired information overrides the existing information, and therefore is said to represent the speed at which a machine learning model learns. The default value is 0.1. (optional)
l1RegularizationStrengthsAvoids overfitting by shrinking the coefficient of less important features to zero, which removes some features altogether. You can specify many values for hyper-parameter optimization. The default value is [0.000001]. (optional, default to [1.0E-6])
l2RegularizationStrengthsA method you can apply to avoid overfitting your model on the training data. You can specify many values for hyper-parameter optimization. The default value is [0.000001]. (optional, default to [1.0E-6])
trainingMaxStepsMaximum number of training steps to complete. This setting is useful if you need the training process to finish in a specific time frame to fit into an automated process. The default value is ten million. (optional)
improvementRatioStops the training run early if the improvement ratio is not met by the time the process reaches a certain point. The default value is 0.00001. (optional)
Returns
DocumentClassifierModelDocumentClassifierModel

Implements IBM.Watson.Discovery.v2.IDiscoveryService.

◆ CreateEnrichment()

DetailedResponse<Enrichment> IBM.Watson.Discovery.v2.DiscoveryService.CreateEnrichment ( string  projectId,
CreateEnrichment  enrichment,
System.IO.MemoryStream  file = null 
)
inline

Create an enrichment.

Create an enrichment for use with the specified project. To apply the enrichment to a collection in the project, use the Collections API.

Parameters
projectIdThe ID of the project. This information can be found from the Integrate and Deploy page in Discovery.
enrichmentInformation about a specific enrichment.
fileThe enrichment file to upload. Expected file types per enrichment are as follows:
  • CSV for dictionary
  • PEAR for uima_annotator and rule_based (Explorer)
  • ZIP for watson_knowledge_studio_model and rule_based (Studio Advanced Rule Editor). (optional)
Returns
EnrichmentEnrichment

Implements IBM.Watson.Discovery.v2.IDiscoveryService.

◆ CreateExpansions()

DetailedResponse<Expansions> IBM.Watson.Discovery.v2.DiscoveryService.CreateExpansions ( string  projectId,
string  collectionId,
List< Expansion expansions 
)
inline

Create or update an expansion list.

Creates or replaces the expansion list for this collection. An expansion list introduces alternative wording for key terms that are mentioned in your collection. By identifying synonyms or common misspellings, you expand the scope of a query beyond exact matches. The maximum number of expanded terms allowed per collection is 5,000.

Parameters
projectIdThe ID of the project. This information can be found from the Integrate and Deploy page in Discovery.
collectionIdThe ID of the collection.
expansionsAn array of query expansion definitions.

Each object in the expansions array represents a term or set of terms that will be expanded into other terms. Each expansion object can be configured as bidirectional or unidirectional.

  • Bidirectional: Each entry in the expanded_terms list expands to include all expanded terms. For example, a query for ibm expands to ibm OR international business machines OR big blue.
  • Unidirectional: The terms in input_terms in the query are replaced by the terms in expanded_terms. For example, a query for the often misused term on premise is converted to on premises OR on-premises and does not contain the original term. If you want an input term to be included in the query, then repeat the input term in the expanded terms list.
Returns
ExpansionsExpansions

Implements IBM.Watson.Discovery.v2.IDiscoveryService.

◆ CreateProject()

DetailedResponse<ProjectDetails> IBM.Watson.Discovery.v2.DiscoveryService.CreateProject ( string  name,
string  type,
DefaultQueryParams  defaultQueryParameters = null 
)
inline

Create a project.

Create a new project for this instance.

Parameters
nameThe human readable name of this project.
typeThe type of project.

The content_intelligence type is a Document Retrieval for Contracts project and the other type is a Custom project.

The content_mining and content_intelligence types are available with Premium plan managed deployments and installed deployments only.

Parameters
defaultQueryParametersDefault query parameters for this project. (optional)
Returns
ProjectDetailsProjectDetails

Implements IBM.Watson.Discovery.v2.IDiscoveryService.

◆ CreateStopwordList()

DetailedResponse<StopWordList> IBM.Watson.Discovery.v2.DiscoveryService.CreateStopwordList ( string  projectId,
string  collectionId,
List< string >  stopwords = null 
)
inline

Create a custom stop words list.

Adds a list of custom stop words. Stop words are words that you want the service to ignore when they occur in a query because they're not useful in distinguishing the semantic meaning of the query. The stop words list cannot contain more than 1 million characters.

A default stop words list is used by all collections. The default list is applied both at indexing time and at query time. A custom stop words list that you add is used at query time only.

The custom stop words list augments the default stop words list; you cannot remove stop words. For information about the default stop words lists per language, see the product documentation.

Parameters
projectIdThe ID of the project. This information can be found from the Integrate and Deploy page in Discovery.
collectionIdThe ID of the collection.
stopwordsList of stop words. (optional)
Returns
StopWordListStopWordList

Implements IBM.Watson.Discovery.v2.IDiscoveryService.

◆ CreateTrainingQuery()

DetailedResponse<TrainingQuery> IBM.Watson.Discovery.v2.DiscoveryService.CreateTrainingQuery ( string  projectId,
string  naturalLanguageQuery,
List< TrainingExample examples,
string  filter = null 
)
inline

Create training query.

Add a query to the training data for this project. The query can contain a filter and natural language query.

Parameters
projectIdThe ID of the project. This information can be found from the Integrate and Deploy page in Discovery.
naturalLanguageQueryThe natural text query that is used as the training query.
examplesArray of training examples.
filterThe filter used on the collection before the natural_language_query is applied. (optional)
Returns
TrainingQueryTrainingQuery

Implements IBM.Watson.Discovery.v2.IDiscoveryService.

◆ DeleteCollection()

DetailedResponse<object> IBM.Watson.Discovery.v2.DiscoveryService.DeleteCollection ( string  projectId,
string  collectionId 
)
inline

Delete a collection.

Deletes the specified collection from the project. All documents stored in the specified collection and not shared is also deleted.

Parameters
projectIdThe ID of the project. This information can be found from the Integrate and Deploy page in Discovery.
collectionIdThe ID of the collection.
Returns
objectobject

Implements IBM.Watson.Discovery.v2.IDiscoveryService.

◆ DeleteDocument()

DetailedResponse<DeleteDocumentResponse> IBM.Watson.Discovery.v2.DiscoveryService.DeleteDocument ( string  projectId,
string  collectionId,
string  documentId,
bool?  xWatsonDiscoveryForce = null 
)
inline

Delete a document.

Deletes the document with the document ID that you specify from the collection. Removes uploaded documents from the collection permanently. If you delete a document that was added by crawling an external data source, the document will be added again with the next scheduled crawl of the data source. The delete function removes the document from the collection, not from the external data source.

Note: Files such as CSV or JSON files generate subdocuments when they are added to a collection. If you delete a subdocument, and then repeat the action that created it, the deleted document is added back in to your collection. To remove subdocuments that are generated by an uploaded file, delete the original document instead. You can get the document ID of the original document from the parent_document_id of the subdocument result.

Parameters
projectIdThe ID of the project. This information can be found from the Integrate and Deploy page in Discovery.
collectionIdThe ID of the collection.
documentIdThe ID of the document.
xWatsonDiscoveryForceWhen true, the uploaded document is added to the collection even if the data for that collection is shared with other collections. (optional, default to false)
Returns
DeleteDocumentResponseDeleteDocumentResponse

Implements IBM.Watson.Discovery.v2.IDiscoveryService.

◆ DeleteDocumentClassifier()

DetailedResponse<object> IBM.Watson.Discovery.v2.DiscoveryService.DeleteDocumentClassifier ( string  projectId,
string  classifierId 
)
inline

Delete a document classifier.

Deletes an existing document classifier from the specified project.

Parameters
projectIdThe ID of the project. This information can be found from the Integrate and Deploy page in Discovery.
classifierIdThe ID of the classifier.
Returns
objectobject

Implements IBM.Watson.Discovery.v2.IDiscoveryService.

◆ DeleteDocumentClassifierModel()

DetailedResponse<object> IBM.Watson.Discovery.v2.DiscoveryService.DeleteDocumentClassifierModel ( string  projectId,
string  classifierId,
string  modelId 
)
inline

Delete a document classifier model.

Deletes an existing document classifier model from the specified project.

Parameters
projectIdThe ID of the project. This information can be found from the Integrate and Deploy page in Discovery.
classifierIdThe ID of the classifier.
modelIdThe ID of the classifier model.
Returns
objectobject

Implements IBM.Watson.Discovery.v2.IDiscoveryService.

◆ DeleteEnrichment()

DetailedResponse<object> IBM.Watson.Discovery.v2.DiscoveryService.DeleteEnrichment ( string  projectId,
string  enrichmentId 
)
inline

Delete an enrichment.

Deletes an existing enrichment from the specified project.

Note: Only enrichments that have been manually created can be deleted.

Parameters
projectIdThe ID of the project. This information can be found from the Integrate and Deploy page in Discovery.
enrichmentIdThe ID of the enrichment.
Returns
objectobject

Implements IBM.Watson.Discovery.v2.IDiscoveryService.

◆ DeleteExpansions()

DetailedResponse<object> IBM.Watson.Discovery.v2.DiscoveryService.DeleteExpansions ( string  projectId,
string  collectionId 
)
inline

Delete the expansion list.

Removes the expansion information for this collection. To disable query expansion for a collection, delete the expansion list.

Parameters
projectIdThe ID of the project. This information can be found from the Integrate and Deploy page in Discovery.
collectionIdThe ID of the collection.
Returns
objectobject

Implements IBM.Watson.Discovery.v2.IDiscoveryService.

◆ DeleteProject()

DetailedResponse<object> IBM.Watson.Discovery.v2.DiscoveryService.DeleteProject ( string  projectId)
inline

Delete a project.

Deletes the specified project.

Important: Deleting a project deletes everything that is part of the specified project, including all collections.

Parameters
projectIdThe ID of the project. This information can be found from the Integrate and Deploy page in Discovery.
Returns
objectobject

Implements IBM.Watson.Discovery.v2.IDiscoveryService.

◆ DeleteStopwordList()

DetailedResponse<object> IBM.Watson.Discovery.v2.DiscoveryService.DeleteStopwordList ( string  projectId,
string  collectionId 
)
inline

Delete a custom stop words list.

Deletes a custom stop words list to stop using it in queries against the collection. After a custom stop words list is deleted, the default stop words list is used.

Parameters
projectIdThe ID of the project. This information can be found from the Integrate and Deploy page in Discovery.
collectionIdThe ID of the collection.
Returns
objectobject

Implements IBM.Watson.Discovery.v2.IDiscoveryService.

◆ DeleteTrainingQueries()

DetailedResponse<object> IBM.Watson.Discovery.v2.DiscoveryService.DeleteTrainingQueries ( string  projectId)
inline

Delete training queries.

Removes all training queries for the specified project.

Parameters
projectIdThe ID of the project. This information can be found from the Integrate and Deploy page in Discovery.
Returns
objectobject

Implements IBM.Watson.Discovery.v2.IDiscoveryService.

◆ DeleteTrainingQuery()

DetailedResponse<object> IBM.Watson.Discovery.v2.DiscoveryService.DeleteTrainingQuery ( string  projectId,
string  queryId 
)
inline

Delete a training data query.

Removes details from a training data query, including the query string and all examples.

Parameters
projectIdThe ID of the project. This information can be found from the Integrate and Deploy page in Discovery.
queryIdThe ID of the query used for training.
Returns
objectobject

Implements IBM.Watson.Discovery.v2.IDiscoveryService.

◆ GetAutocompletion()

DetailedResponse<Completions> IBM.Watson.Discovery.v2.DiscoveryService.GetAutocompletion ( string  projectId,
string  prefix,
List< string >  collectionIds = null,
string  field = null,
long?  count = null 
)
inline

Get Autocomplete Suggestions.

Returns completion query suggestions for the specified prefix.

Parameters
projectIdThe ID of the project. This information can be found from the Integrate and Deploy page in Discovery.
prefixThe prefix to use for autocompletion. For example, the prefix Ho could autocomplete to hot, housing, or how.
collectionIdsComma separated list of the collection IDs. If this parameter is not specified, all collections in the project are used. (optional)
fieldThe field in the result documents that autocompletion suggestions are identified from. (optional)
countThe number of autocompletion suggestions to return. (optional)
Returns
CompletionsCompletions

Implements IBM.Watson.Discovery.v2.IDiscoveryService.

◆ GetCollection()

DetailedResponse<CollectionDetails> IBM.Watson.Discovery.v2.DiscoveryService.GetCollection ( string  projectId,
string  collectionId 
)
inline

Get collection.

Get details about the specified collection.

Parameters
projectIdThe ID of the project. This information can be found from the Integrate and Deploy page in Discovery.
collectionIdThe ID of the collection.
Returns
CollectionDetailsCollectionDetails

Implements IBM.Watson.Discovery.v2.IDiscoveryService.

◆ GetComponentSettings()

DetailedResponse<ComponentSettingsResponse> IBM.Watson.Discovery.v2.DiscoveryService.GetComponentSettings ( string  projectId)
inline

List component settings.

Returns default configuration settings for components.

Parameters
projectIdThe ID of the project. This information can be found from the Integrate and Deploy page in Discovery.
Returns
ComponentSettingsResponseComponentSettingsResponse

Implements IBM.Watson.Discovery.v2.IDiscoveryService.

◆ GetDocumentClassifier()

DetailedResponse<DocumentClassifier> IBM.Watson.Discovery.v2.DiscoveryService.GetDocumentClassifier ( string  projectId,
string  classifierId 
)
inline

Get a document classifier.

Get details about a specific document classifier.

Parameters
projectIdThe ID of the project. This information can be found from the Integrate and Deploy page in Discovery.
classifierIdThe ID of the classifier.
Returns
DocumentClassifierDocumentClassifier

Implements IBM.Watson.Discovery.v2.IDiscoveryService.

◆ GetDocumentClassifierModel()

DetailedResponse<DocumentClassifierModel> IBM.Watson.Discovery.v2.DiscoveryService.GetDocumentClassifierModel ( string  projectId,
string  classifierId,
string  modelId 
)
inline

Get a document classifier model.

Get details about a specific document classifier model.

Parameters
projectIdThe ID of the project. This information can be found from the Integrate and Deploy page in Discovery.
classifierIdThe ID of the classifier.
modelIdThe ID of the classifier model.
Returns
DocumentClassifierModelDocumentClassifierModel

Implements IBM.Watson.Discovery.v2.IDiscoveryService.

◆ GetEnrichment()

DetailedResponse<Enrichment> IBM.Watson.Discovery.v2.DiscoveryService.GetEnrichment ( string  projectId,
string  enrichmentId 
)
inline

Get enrichment.

Get details about a specific enrichment.

Parameters
projectIdThe ID of the project. This information can be found from the Integrate and Deploy page in Discovery.
enrichmentIdThe ID of the enrichment.
Returns
EnrichmentEnrichment

Implements IBM.Watson.Discovery.v2.IDiscoveryService.

◆ GetProject()

DetailedResponse<ProjectDetails> IBM.Watson.Discovery.v2.DiscoveryService.GetProject ( string  projectId)
inline

Get project.

Get details on the specified project.

Parameters
projectIdThe ID of the project. This information can be found from the Integrate and Deploy page in Discovery.
Returns
ProjectDetailsProjectDetails

Implements IBM.Watson.Discovery.v2.IDiscoveryService.

◆ GetStopwordList()

DetailedResponse<StopWordList> IBM.Watson.Discovery.v2.DiscoveryService.GetStopwordList ( string  projectId,
string  collectionId 
)
inline

Get a custom stop words list.

Returns the custom stop words list that is used by the collection. For information about the default stop words lists that are applied to queries, see the product documentation.

Parameters
projectIdThe ID of the project. This information can be found from the Integrate and Deploy page in Discovery.
collectionIdThe ID of the collection.
Returns
StopWordListStopWordList

Implements IBM.Watson.Discovery.v2.IDiscoveryService.

◆ GetTrainingQuery()

DetailedResponse<TrainingQuery> IBM.Watson.Discovery.v2.DiscoveryService.GetTrainingQuery ( string  projectId,
string  queryId 
)
inline

Get a training data query.

Get details for a specific training data query, including the query string and all examples.

Parameters
projectIdThe ID of the project. This information can be found from the Integrate and Deploy page in Discovery.
queryIdThe ID of the query used for training.
Returns
TrainingQueryTrainingQuery

Implements IBM.Watson.Discovery.v2.IDiscoveryService.

◆ ListCollections()

DetailedResponse<ListCollectionsResponse> IBM.Watson.Discovery.v2.DiscoveryService.ListCollections ( string  projectId)
inline

List collections.

Lists existing collections for the specified project.

Parameters
projectIdThe ID of the project. This information can be found from the Integrate and Deploy page in Discovery.
Returns
ListCollectionsResponseListCollectionsResponse

Implements IBM.Watson.Discovery.v2.IDiscoveryService.

◆ ListDocumentClassifierModels()

DetailedResponse<DocumentClassifierModels> IBM.Watson.Discovery.v2.DiscoveryService.ListDocumentClassifierModels ( string  projectId,
string  classifierId 
)
inline

List document classifier models.

Get a list of the document classifier models in a project. Returns only the name and model ID of each document classifier model.

Parameters
projectIdThe ID of the project. This information can be found from the Integrate and Deploy page in Discovery.
classifierIdThe ID of the classifier.
Returns
DocumentClassifierModelsDocumentClassifierModels

Implements IBM.Watson.Discovery.v2.IDiscoveryService.

◆ ListDocumentClassifiers()

DetailedResponse<DocumentClassifiers> IBM.Watson.Discovery.v2.DiscoveryService.ListDocumentClassifiers ( string  projectId)
inline

List document classifiers.

Get a list of the document classifiers in a project. Returns only the name and classifier ID of each document classifier.

Parameters
projectIdThe ID of the project. This information can be found from the Integrate and Deploy page in Discovery.
Returns
DocumentClassifiersDocumentClassifiers

Implements IBM.Watson.Discovery.v2.IDiscoveryService.

◆ ListDocuments()

DetailedResponse<ListDocumentsResponse> IBM.Watson.Discovery.v2.DiscoveryService.ListDocuments ( string  projectId,
string  collectionId,
long?  count = null,
string  status = null,
bool?  hasNotices = null,
bool?  isParent = null,
string  parentDocumentId = null,
string  sha256 = null 
)
inline

List documents.

Lists the documents in the specified collection. The list includes only the document ID of each document and returns information for up to 10,000 documents.

Note: This method is available only from Cloud Pak for Data version 4.0.9 and later installed instances and from Plus and Enterprise plan IBM Cloud-managed instances. It is not currently available from Premium plan instances.

Parameters
projectIdThe ID of the project. This information can be found from the Integrate and Deploy page in Discovery.
collectionIdThe ID of the collection.
countThe maximum number of documents to return. Up to 1,000 documents are returned by default. The maximum number allowed is 10,000. (optional)
statusFilters the documents to include only documents with the specified ingestion status. The options include:
  • available: Ingestion is finished and the document is indexed.
  • failed: Ingestion is finished, but the document is not indexed because of an error.
  • pending: The document is uploaded, but the ingestion process is not started.
  • processing: Ingestion is in progress.

You can specify one status value or add a comma-separated list of more than one status value. For example, available,failed. (optional)

Parameters
hasNoticesIf set to true, only documents that have notices, meaning documents for which warnings or errors were generated during the ingestion, are returned. If set to false, only documents that don't have notices are returned. If unspecified, no filter based on notices is applied.

Notice details are not available in the result, but you can use the Query collection notices method to find details by adding the parameter query=notices.document_id:{document-id}. (optional)

Parameters
isParentIf set to true, only parent documents, meaning documents that were split during the ingestion process and resulted in two or more child documents, are returned. If set to false, only child documents are returned. If unspecified, no filter based on the parent or child relationship is applied.

CSV files, for example, are split into separate documents per line and JSON files are split into separate documents per object. (optional)

Parameters
parentDocumentIdFilters the documents to include only child documents that were generated when the specified parent document was processed. (optional)
sha256Filters the documents to include only documents with the specified SHA-256 hash. Format the hash as a hexadecimal string. (optional)
Returns
ListDocumentsResponseListDocumentsResponse

Implements IBM.Watson.Discovery.v2.IDiscoveryService.

◆ ListEnrichments()

DetailedResponse<Enrichments> IBM.Watson.Discovery.v2.DiscoveryService.ListEnrichments ( string  projectId)
inline

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
projectIdThe ID of the project. This information can be found from the Integrate and Deploy page in Discovery.
Returns
EnrichmentsEnrichments

Implements IBM.Watson.Discovery.v2.IDiscoveryService.

◆ ListExpansions()

DetailedResponse<Expansions> IBM.Watson.Discovery.v2.DiscoveryService.ListExpansions ( string  projectId,
string  collectionId 
)
inline

Get the expansion list.

Returns the current expansion list for the specified collection. If an expansion list is not specified, an empty expansions array is returned.

Parameters
projectIdThe ID of the project. This information can be found from the Integrate and Deploy page in Discovery.
collectionIdThe ID of the collection.
Returns
ExpansionsExpansions

Implements IBM.Watson.Discovery.v2.IDiscoveryService.

◆ ListFields()

DetailedResponse<ListFieldsResponse> IBM.Watson.Discovery.v2.DiscoveryService.ListFields ( string  projectId,
List< string >  collectionIds = null 
)
inline

List fields.

Gets a list of the unique fields (and their types) stored in the specified collections.

Parameters
projectIdThe ID of the project. This information can be found from the Integrate and Deploy page in Discovery.
collectionIdsComma separated list of the collection IDs. If this parameter is not specified, all collections in the project are used. (optional)
Returns
ListFieldsResponseListFieldsResponse

Implements IBM.Watson.Discovery.v2.IDiscoveryService.

◆ ListProjects()

DetailedResponse<ListProjectsResponse> IBM.Watson.Discovery.v2.DiscoveryService.ListProjects ( )
inline

List projects.

Lists existing projects for this instance.

Returns
ListProjectsResponseListProjectsResponse

Implements IBM.Watson.Discovery.v2.IDiscoveryService.

◆ ListTrainingQueries()

DetailedResponse<TrainingQuerySet> IBM.Watson.Discovery.v2.DiscoveryService.ListTrainingQueries ( string  projectId)
inline

List training queries.

List the training queries for the specified project.

Parameters
projectIdThe ID of the project. This information can be found from the Integrate and Deploy page in Discovery.
Returns
TrainingQuerySetTrainingQuerySet

Implements IBM.Watson.Discovery.v2.IDiscoveryService.

◆ Query()

DetailedResponse<QueryResponse> IBM.Watson.Discovery.v2.DiscoveryService.Query ( string  projectId,
List< string >  collectionIds = null,
string  filter = null,
string  query = null,
string  naturalLanguageQuery = null,
string  aggregation = null,
long?  count = null,
List< string >  _return = null,
long?  offset = null,
string  sort = null,
bool?  highlight = null,
bool?  spellingSuggestions = null,
QueryLargeTableResults  tableResults = null,
QueryLargeSuggestedRefinements  suggestedRefinements = null,
QueryLargePassages  passages = null,
QueryLargeSimilar  similar = null 
)
inline

Query a project.

Search your data by submitting queries that are written in natural language or formatted in the Discovery Query Language. For more information, see the Discovery documentation. The default query parameters differ by project type. For more information about the project default settings, see the Discovery documentation. See the Projects API documentation for details about how to set custom default query settings.

The length of the UTF-8 encoding of the POST body cannot exceed 10,000 bytes, which is roughly equivalent to 10,000 characters in English.

Parameters
projectIdThe ID of the project. This information can be found from the Integrate and Deploy page in Discovery.
collectionIdsA comma-separated list of collection IDs to be queried against. (optional)
filterSearches for documents that match the Discovery Query Language criteria that is specified as input. Filter calls are cached and are faster than query calls because the results are not ordered by relevance. When used with the aggregation, query, or natural_language_query parameters, the filter parameter runs first. This parameter is useful for limiting results to those that contain specific metadata values. (optional)
queryA query search that is written in the Discovery Query Language and returns all matching documents in your data set with full enrichments and full text, and with the most relevant documents listed first. Use a query search when you want to find the most relevant search results. (optional)
naturalLanguageQueryA natural language query that returns relevant documents by using training data and natural language understanding. (optional)
aggregationAn aggregation search that returns an exact answer by combining query search with filters. Useful for applications to build lists, tables, and time series. For more information about the supported types of aggregations, see the Discovery documentation. (optional)
countNumber of results to return. (optional)
_returnA list of the fields in the document hierarchy to return. You can specify both root-level (text) and nested (extracted_metadata.filename) fields. If this parameter is an empty list, then all fields are returned. (optional)
offsetThe number of query results to skip at the beginning. For example, if the total number of results that are returned is 10 and the offset is 8, it returns the last two results. (optional)
sortA comma-separated list of fields in the document to sort on. You can optionally specify a sort direction by prefixing the field with - for descending or + for ascending. Ascending is the default sort direction if no prefix is specified. (optional)
highlightWhen true, a highlight field is returned for each result that contains fields that match the query. The matching query terms are emphasized with surrounding <em></em> tags. This parameter is ignored if passages.enabled and passages.per_document are true, in which case passages are returned for each document instead of highlights. (optional)
spellingSuggestionsWhen true and the natural_language_query parameter is used, the natural_language_query parameter is spell checked. The most likely correction is returned in the suggested_query field of the response (if one exists). (optional)
tableResultsConfiguration for table retrieval. (optional)
suggestedRefinementsConfiguration for suggested refinements.

Note: The suggested_refinements parameter that identified dynamic facets from the data is deprecated. (optional)

Parameters
passagesConfiguration for passage retrieval. (optional)
similarFinds results from documents that are similar to documents of interest. Use this parameter to add a More like these function to your search. You can include this parameter with or without a query, filter or natural_language_query parameter. (optional)
Returns
QueryResponseQueryResponse

Implements IBM.Watson.Discovery.v2.IDiscoveryService.

◆ QueryCollectionNotices()

DetailedResponse<QueryNoticesResponse> IBM.Watson.Discovery.v2.DiscoveryService.QueryCollectionNotices ( string  projectId,
string  collectionId,
string  filter = null,
string  query = null,
string  naturalLanguageQuery = null,
long?  count = null,
long?  offset = null 
)
inline

Query collection notices.

Finds collection-level notices (errors and warnings) that are generated when documents are ingested.

Parameters
projectIdThe ID of the project. This information can be found from the Integrate and Deploy page in Discovery.
collectionIdThe ID of the collection.
filterSearches for documents that match the Discovery Query Language criteria that is specified as input. Filter calls are cached and are faster than query calls because the results are not ordered by relevance. When used with the aggregation, query, or natural_language_query parameters, the filter parameter runs first. This parameter is useful for limiting results to those that contain specific metadata values. (optional)
queryA query search that is written in the Discovery Query Language and returns all matching documents in your data set with full enrichments and full text, and with the most relevant documents listed first. (optional)
naturalLanguageQueryA natural language query that returns relevant documents by using training data and natural language understanding. (optional)
countNumber of results to return. The maximum for the count and offset values together in any one query is 10,000. (optional)
offsetThe number of query results to skip at the beginning. For example, if the total number of results that are returned is 10 and the offset is 8, it returns the last two results. The maximum for the count and offset values together in any one query is 10000. (optional)
Returns
QueryNoticesResponseQueryNoticesResponse

Implements IBM.Watson.Discovery.v2.IDiscoveryService.

◆ QueryNotices()

DetailedResponse<QueryNoticesResponse> IBM.Watson.Discovery.v2.DiscoveryService.QueryNotices ( string  projectId,
string  filter = null,
string  query = null,
string  naturalLanguageQuery = null,
long?  count = null,
long?  offset = null 
)
inline

Query project notices.

Finds project-level notices (errors and warnings). Currently, project-level notices are generated by relevancy training.

Parameters
projectIdThe ID of the project. This information can be found from the Integrate and Deploy page in Discovery.
filterSearches for documents that match the Discovery Query Language criteria that is specified as input. Filter calls are cached and are faster than query calls because the results are not ordered by relevance. When used with the aggregation, query, or natural_language_query parameters, the filter parameter runs first. This parameter is useful for limiting results to those that contain specific metadata values. (optional)
queryA query search that is written in the Discovery Query Language and returns all matching documents in your data set with full enrichments and full text, and with the most relevant documents listed first. (optional)
naturalLanguageQueryA natural language query that returns relevant documents by using training data and natural language understanding. (optional)
countNumber of results to return. The maximum for the count and offset values together in any one query is 10,000. (optional)
offsetThe number of query results to skip at the beginning. For example, if the total number of results that are returned is 10 and the offset is 8, it returns the last two results. The maximum for the count and offset values together in any one query is 10000. (optional)
Returns
QueryNoticesResponseQueryNoticesResponse

Implements IBM.Watson.Discovery.v2.IDiscoveryService.

◆ UpdateCollection()

DetailedResponse<CollectionDetails> IBM.Watson.Discovery.v2.DiscoveryService.UpdateCollection ( string  projectId,
string  collectionId,
string  name = null,
string  description = null,
List< CollectionEnrichment enrichments = null 
)
inline

Update a collection.

Updates the specified collection's name, description, and enrichments.

Parameters
projectIdThe ID of the project. This information can be found from the Integrate and Deploy page in Discovery.
collectionIdThe ID of the collection.
nameThe new name of the collection. (optional)
descriptionThe new description of the collection. (optional)
enrichmentsAn array of enrichments that are applied to this collection. (optional)
Returns
CollectionDetailsCollectionDetails

Implements IBM.Watson.Discovery.v2.IDiscoveryService.

◆ UpdateDocument()

DetailedResponse<DocumentAccepted> IBM.Watson.Discovery.v2.DiscoveryService.UpdateDocument ( string  projectId,
string  collectionId,
string  documentId,
System.IO.MemoryStream  file = null,
string  filename = null,
string  fileContentType = null,
string  metadata = null,
bool?  xWatsonDiscoveryForce = null 
)
inline

Add a document.

Add a document to a collection with optional metadata.

Returns immediately after the system has accepted the document for processing.

Use this method to upload a file to the collection. You cannot use this method to crawl an external data source.

  • For a list of supported file types, see the product documentation.
  • You 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.
  • 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.
  • In curl requests only, 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.

For more information about how certain file types and field names are handled when a file is added to a collection, see the product documentation.

Parameters
projectIdThe ID of the project. This information can be found from the Integrate and Deploy page in Discovery.
collectionIdThe ID of the collection.
fileWhen adding a document, the content of the document to ingest. For maximum supported file size limits, see the documentation.

When analyzing a document, the content of the document to analyze but not ingest. Only the application/json content type is supported currently. For maximum supported file size limits, see the product documentation. (optional)

Parameters
filenameThe filename for file. (optional)
fileContentTypeThe content type of file. (optional)
metadataAdd information about the file that you want to include in the response.

The maximum supported metadata file size is 1 MB. Metadata parts larger than 1 MB are rejected.

Example:

``` { "filename": "favorites2.json", "file_type": "json" }. (optional)

Parameters
xWatsonDiscoveryForceWhen true, the uploaded document is added to the collection even if the data for that collection is shared with other collections. (optional, default to false)
Returns
DocumentAcceptedDocumentAccepted

*/ public DetailedResponse<DocumentAccepted> AddDocument(string projectId, string collectionId, System.IO.MemoryStream file = null, string filename = null, string fileContentType = null, string metadata = null, bool? xWatsonDiscoveryForce = null) { if (string.IsNullOrEmpty(Version)) { throw new ArgumentNullException("`Version` is required"); } if (string.IsNullOrEmpty(projectId)) { throw new ArgumentNullException("`projectId` is required for `AddDocument`"); } else { projectId = Uri.EscapeDataString(projectId); } if (string.IsNullOrEmpty(collectionId)) { throw new ArgumentNullException("`collectionId` is required for `AddDocument`"); } else { collectionId = Uri.EscapeDataString(collectionId); } DetailedResponse<DocumentAccepted> result = null;

try { var formData = new MultipartFormDataContent();

if (file != null) { var fileContent = new ByteArrayContent(file.ToArray()); System.Net.Http.Headers.MediaTypeHeaderValue contentType; System.Net.Http.Headers.MediaTypeHeaderValue.TryParse(fileContentType, out contentType); fileContent.Headers.ContentType = contentType; formData.Add(fileContent, "file", filename); }

if (metadata != null) { var metadataContent = new StringContent(metadata, Encoding.UTF8, HttpMediaType.TEXT_PLAIN); metadataContent.Headers.ContentType = null; formData.Add(metadataContent, "metadata"); }

IClient client = this.Client; SetAuthentication();

var restRequest = client.PostAsync($"{this.Endpoint}/v2/projects/{projectId}/collections/{collectionId}/documents");

restRequest.WithHeader("Accept", "application/json");

if (xWatsonDiscoveryForce != null) { restRequest.WithHeader("X-Watson-Discovery-Force", (bool)xWatsonDiscoveryForce ? "true" : "false"); } if (!string.IsNullOrEmpty(Version)) { restRequest.WithArgument("version", Version); } restRequest.WithBodyContent(formData);

restRequest.WithHeaders(Common.GetSdkHeaders("discovery", "v2", "AddDocument")); restRequest.WithHeaders(customRequestHeaders); ClearCustomRequestHeaders();

result = restRequest.As<DocumentAccepted>().Result; if (result == null) { result = new DetailedResponse<DocumentAccepted>(); } } catch (AggregateException ae) { throw ae.Flatten(); }

return result; }

/**

Enum values for AddDocument.

*/ public class AddDocumentEnums { /**

The content type of file.

*/ public class FileContentTypeValue { /**

Constant APPLICATION_JSON for application/json

*/ public const string APPLICATION_JSON = "application/json"; /**

Constant APPLICATION_MSWORD for application/msword

*/ public const string APPLICATION_MSWORD = "application/msword"; /**

Constant APPLICATION_VND_OPENXMLFORMATS_OFFICEDOCUMENT_WORDPROCESSINGML_DOCUMENT for application/vnd.openxmlformats-officedocument.wordprocessingml.document

*/ public const string APPLICATION_VND_OPENXMLFORMATS_OFFICEDOCUMENT_WORDPROCESSINGML_DOCUMENT = "application/vnd.openxmlformats-officedocument.wordprocessingml.document"; /**

Constant APPLICATION_PDF for application/pdf

*/ public const string APPLICATION_PDF = "application/pdf"; /**

Constant TEXT_HTML for text/html

*/ public const string TEXT_HTML = "text/html"; /**

Constant APPLICATION_XHTML_XML for application/xhtml+xml

*/ public const string APPLICATION_XHTML_XML = "application/xhtml+xml";

} }

/**

Get document details.

Get details about a specific document, whether the document is added by uploading a file or by crawling an external data source.

Note: This method is available only from Cloud Pak for Data version 4.0.9 and later installed instances and from Plus and Enterprise plan IBM Cloud-managed instances. It is not currently available from Premium plan instances.

Parameters
projectIdThe ID of the project. This information can be found from the Integrate and Deploy page in Discovery.
collectionIdThe ID of the collection.
documentIdThe ID of the document.
Returns
DocumentDetailsDocumentDetails

*/ public DetailedResponse<DocumentDetails> GetDocument(string projectId, string collectionId, string documentId) { if (string.IsNullOrEmpty(Version)) { throw new ArgumentNullException("`Version` is required"); } if (string.IsNullOrEmpty(projectId)) { throw new ArgumentNullException("`projectId` is required for `GetDocument`"); } else { projectId = Uri.EscapeDataString(projectId); } if (string.IsNullOrEmpty(collectionId)) { throw new ArgumentNullException("`collectionId` is required for `GetDocument`"); } else { collectionId = Uri.EscapeDataString(collectionId); } if (string.IsNullOrEmpty(documentId)) { throw new ArgumentNullException("`documentId` is required for `GetDocument`"); } else { documentId = Uri.EscapeDataString(documentId); } DetailedResponse<DocumentDetails> result = null;

try { IClient client = this.Client; SetAuthentication();

var restRequest = client.GetAsync($"{this.Endpoint}/v2/projects/{projectId}/collections/{collectionId}/documents/{documentId}");

restRequest.WithHeader("Accept", "application/json"); if (!string.IsNullOrEmpty(Version)) { restRequest.WithArgument("version", Version); }

restRequest.WithHeaders(Common.GetSdkHeaders("discovery", "v2", "GetDocument")); restRequest.WithHeaders(customRequestHeaders); ClearCustomRequestHeaders();

result = restRequest.As<DocumentDetails>().Result; if (result == null) { result = new DetailedResponse<DocumentDetails>(); } } catch (AggregateException ae) { throw ae.Flatten(); }

return result; }

/**

Update a document.

Replace an existing document or add a document with a specified document ID. Starts ingesting a document with optional metadata.

Use this method to upload a file to a collection. You cannot use this method to crawl an external data source.

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.

Notes:

  • Uploading a new document with this method automatically replaces any existing document stored with the same document ID.
  • If an uploaded document is split into child documents during ingestion, all existing child documents are overwritten, even if the updated version of the document has fewer child documents.
Parameters
projectIdThe ID of the project. This information can be found from the Integrate and Deploy page in Discovery.
collectionIdThe ID of the collection.
documentIdThe ID of the document.
fileWhen adding a document, the content of the document to ingest. For maximum supported file size limits, see the documentation.

When analyzing a document, the content of the document to analyze but not ingest. Only the application/json content type is supported currently. For maximum supported file size limits, see the product documentation. (optional)

Parameters
filenameThe filename for file. (optional)
fileContentTypeThe content type of file. (optional)
metadataAdd information about the file that you want to include in the response.

The maximum supported metadata file size is 1 MB. Metadata parts larger than 1 MB are rejected.

Example:

``` { "filename": "favorites2.json", "file_type": "json" }. (optional)

Parameters
xWatsonDiscoveryForceWhen true, the uploaded document is added to the collection even if the data for that collection is shared with other collections. (optional, default to false)
Returns
DocumentAcceptedDocumentAccepted

Implements IBM.Watson.Discovery.v2.IDiscoveryService.

◆ UpdateDocumentClassifier()

DetailedResponse<DocumentClassifier> IBM.Watson.Discovery.v2.DiscoveryService.UpdateDocumentClassifier ( string  projectId,
string  classifierId,
UpdateDocumentClassifier  classifier,
System.IO.MemoryStream  trainingData = null,
System.IO.MemoryStream  testData = null 
)
inline

Update a document classifier.

Update the document classifier name or description, update the training data, or add or update the test data.

Parameters
projectIdThe ID of the project. This information can be found from the Integrate and Deploy page in Discovery.
classifierIdThe ID of the classifier.
classifierAn object that contains a new name or description for a document classifier, updated training data, or new or updated test data.
trainingDataThe training data CSV file to upload. The CSV file must have headers. The file must include a field that contains the text you want to classify and a field that contains the classification labels that you want to use to classify your data. If you want to specify multiple values in a single column, use a semicolon as the value separator. For a sample file, see the product documentation. (optional)
testDataThe CSV with test data to upload. The column values in the test file must be the same as the column values in the training data file. If no test data is provided, the training data is split into two separate groups of training and test data. (optional)
Returns
DocumentClassifierDocumentClassifier

Implements IBM.Watson.Discovery.v2.IDiscoveryService.

◆ UpdateDocumentClassifierModel()

DetailedResponse<DocumentClassifierModel> IBM.Watson.Discovery.v2.DiscoveryService.UpdateDocumentClassifierModel ( string  projectId,
string  classifierId,
string  modelId,
string  name = null,
string  description = null 
)
inline

Update a document classifier model.

Update the document classifier model name or description.

Parameters
projectIdThe ID of the project. This information can be found from the Integrate and Deploy page in Discovery.
classifierIdThe ID of the classifier.
modelIdThe ID of the classifier model.
nameA new name for the enrichment. (optional)
descriptionA new description for the enrichment. (optional)
Returns
DocumentClassifierModelDocumentClassifierModel

Implements IBM.Watson.Discovery.v2.IDiscoveryService.

◆ UpdateEnrichment()

DetailedResponse<Enrichment> IBM.Watson.Discovery.v2.DiscoveryService.UpdateEnrichment ( string  projectId,
string  enrichmentId,
string  name,
string  description = null 
)
inline

Update an enrichment.

Updates an existing enrichment's name and description.

Parameters
projectIdThe ID of the project. This information can be found from the Integrate and Deploy page in Discovery.
enrichmentIdThe ID of the enrichment.
nameA new name for the enrichment.
descriptionA new description for the enrichment. (optional)
Returns
EnrichmentEnrichment

Implements IBM.Watson.Discovery.v2.IDiscoveryService.

◆ UpdateProject()

DetailedResponse<ProjectDetails> IBM.Watson.Discovery.v2.DiscoveryService.UpdateProject ( string  projectId,
string  name = null 
)
inline

Update a project.

Update the specified project's name.

Parameters
projectIdThe ID of the project. This information can be found from the Integrate and Deploy page in Discovery.
nameThe new name to give this project. (optional)
Returns
ProjectDetailsProjectDetails

Implements IBM.Watson.Discovery.v2.IDiscoveryService.

◆ UpdateTrainingQuery()

DetailedResponse<TrainingQuery> IBM.Watson.Discovery.v2.DiscoveryService.UpdateTrainingQuery ( string  projectId,
string  queryId,
string  naturalLanguageQuery,
List< TrainingExample examples,
string  filter = null 
)
inline

Update a training query.

Updates an existing training query and it's examples.

Parameters
projectIdThe ID of the project. This information can be found from the Integrate and Deploy page in Discovery.
queryIdThe ID of the query used for training.
naturalLanguageQueryThe natural text query that is used as the training query.
examplesArray of training examples.
filterThe filter used on the collection before the natural_language_query is applied. (optional)
Returns
TrainingQueryTrainingQuery

Implements IBM.Watson.Discovery.v2.IDiscoveryService.

Property Documentation

◆ Version

string IBM.Watson.Discovery.v2.DiscoveryService.Version
getset

The documentation for this class was generated from the following file: