Options
All
  • Public
  • Public/Protected
  • All
Menu

Class DiscoveryV1

IBM Watson™ Discovery is a cognitive search and content analytics engine that you can add to applications to identify patterns, trends and actionable insights to drive better decision-making. Securely unify structured and unstructured data with pre-enriched content, and use a simplified query language to eliminate the need for manual filtering of results. interfaces

API Version: 1.0 See: https://cloud.ibm.com/docs/discovery

Hierarchy

  • BaseService
    • DiscoveryV1

Index

Namespaces

Constructors

Properties

Methods

Constructors

constructor

  • Construct a DiscoveryV1 object.

    Parameters

    Name Type Attribute Description
    options UserOptions

    Options for the service.

    Returns DiscoveryV1

Properties

version

version: string

Release date of the version of the API you want to use. Specify dates in YYYY-MM-DD format. The current version is 2019-04-30.

Static DEFAULT_SERVICE_NAME

DEFAULT_SERVICE_NAME: string = "discovery"

Static DEFAULT_SERVICE_URL

DEFAULT_SERVICE_URL: string = "https://api.us-south.discovery.watson.cloud.ibm.com"

Methods

addDocument

  • Add a document.

    Add a document to a collection with optional metadata.

    • The version query parameter is still required.

    • 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.

    • The user 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 will be 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 containing the following characters after normalization are filtered out before indexing: # and ,

      Note: Documents can be added with a specific document_id by using the _/v1/environments/{environment_id}/collections/{collection_id}/documents method.

    Parameters

    Name Type Attribute Description
    params AddDocumentParams

    The parameters to send to the service.

    Properties

    Name Type Attributes Description
    collectionId string The ID of the collection.
    environmentId string The ID of the environment.
    file ReadableStream | Buffer Optional The content of the document to ingest. The maximum supported file size when adding a file to a collection is 50 megabytes, the maximum supported file size when testing a configuration is 1 megabyte. Files larger than the supported size are rejected.
    fileContentType FileContentType | string Optional The content type of file.
    filename string Optional The filename for file.
    headers OutgoingHttpHeaders Optional
    metadata string Optional The maximum supported metadata file size is 1 MB. Metadata parts larger than 1 MB are rejected. Example: ``` { "Creator": "Johnny Appleseed", "Subject": "Apples" } ```.

    Returns Promise<Response<DocumentAccepted>>

addTrainingData

  • Add query to training data.

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

    Parameters

    Name Type Attribute Description
    params AddTrainingDataParams

    The parameters to send to the service.

    Properties

    Name Type Attributes Description
    collectionId string The ID of the collection.
    environmentId string The ID of the environment.
    examples TrainingExample[] Optional Array of training examples.
    filter string Optional The filter used on the collection before the **natural_language_query** is applied.
    headers OutgoingHttpHeaders Optional
    naturalLanguageQuery string Optional The natural text query for the new training query.

    Returns Promise<Response<TrainingQuery>>

createCollection

  • Create a collection.

    Parameters

    Name Type Attribute Description
    params CreateCollectionParams

    The parameters to send to the service.

    Properties

    Name Type Attributes Description
    environmentId string The ID of the environment.
    name string The name of the collection to be created.
    configurationId string Optional The ID of the configuration in which the collection is to be created.
    description string Optional A description of the collection.
    headers OutgoingHttpHeaders Optional
    language Language | string Optional The language of the documents stored in the collection, in the form of an ISO 639-1 language code.

    Returns Promise<Response<Collection>>

createConfiguration

  • Add configuration.

    Creates a new configuration.

    If the input configuration contains the configuration_id, created, or updated properties, then they are ignored and overridden by the system, and an error is not returned so that the overridden fields do not need to be removed when copying a configuration.

    The configuration can contain unrecognized JSON fields. Any such fields are ignored and do not generate an error. This makes it easier to use newer configuration files with older versions of the API and the service. It also makes it possible for the tooling to add additional metadata and information to the configuration.

    Parameters

    Name Type Attribute Description
    params CreateConfigurationParams

    The parameters to send to the service.

    Properties

    Name Type Attributes Description
    environmentId string The ID of the environment.
    name string The name of the configuration.
    conversions Conversions Optional Document conversion settings.
    description string Optional The description of the configuration, if available.
    enrichments Enrichment[] Optional An array of document enrichment settings for the configuration.
    headers OutgoingHttpHeaders Optional
    normalizations NormalizationOperation[] Optional Defines operations that can be used to transform the final output JSON into a normalized form. Operations are executed in the order that they appear in the array.
    source Source Optional Object containing source parameters for the configuration.

    Returns Promise<Response<Configuration>>

createCredentials

  • Create credentials.

    Creates a set of credentials to connect to a remote source. Created credentials are used in a configuration to associate a collection with the remote source.

    Note: All credentials are sent over an encrypted connection and encrypted at rest.

    Parameters

    Name Type Attribute Description
    params CreateCredentialsParams

    The parameters to send to the service.

    Properties

    Name Type Attributes Description
    environmentId string The ID of the environment.
    credentialDetails CredentialDetails Optional Object containing details of the stored credentials.
    headers OutgoingHttpHeaders Optional
    sourceType SourceType | string Optional The source that this credentials object connects to. - `box` indicates the credentials are used to connect an instance of Enterprise Box. - `salesforce` indicates the credentials are used to connect to Salesforce. - `sharepoint` indicates the credentials are used to connect to Microsoft SharePoint Online. - `web_crawl` indicates the credentials are used to perform a web crawl. = `cloud_object_storage` indicates the credentials are used to connect to an IBM Cloud Object Store.
    status StatusDetails Optional Object that contains details about the status of the authentication process.

    Returns Promise<Response<Credentials>>

createEnvironment

  • Create an environment.

    Creates a new environment for private data. An environment must be created before collections can be created.

    Note: You can create only one environment for private data per service instance. An attempt to create another environment results in an error.

    Parameters

    Name Type Attribute Description
    params CreateEnvironmentParams

    The parameters to send to the service.

    Properties

    Name Type Attributes Description
    name string Name that identifies the environment.
    description string Optional Description of the environment.
    headers OutgoingHttpHeaders Optional
    size Size | string Optional Size of the environment. In the Lite plan the default and only accepted value is `LT`, in all other plans the default is `S`.

    Returns Promise<Response<Environment>>

createEvent

  • Create event.

    The Events API can be used to create log entries that are associated with specific queries. For example, you can record which documents in the results set were "clicked" by a user and when that click occurred.

    Parameters

    Name Type Attribute Description
    params CreateEventParams

    The parameters to send to the service.

    Properties

    Name Type Attributes Description
    data EventData Query event data object.
    type Type | string The event type to be created.
    headers OutgoingHttpHeaders Optional

    Returns Promise<Response<CreateEventResponse>>

createExpansions

  • Create or update expansion list.

    Create or replace the Expansion list for this collection. The maximum number of expanded terms per collection is 500. The current expansion list is replaced with the uploaded content.

    Parameters

    Name Type Attribute Description
    params CreateExpansionsParams

    The parameters to send to the service.

    Properties

    Name Type Attributes Description
    collectionId string The ID of the collection.
    environmentId string The ID of the environment.
    expansions Expansion[] An array of query expansion definitions.
    headers OutgoingHttpHeaders Optional

    Returns Promise<Response<Expansions>>

createGateway

  • Create Gateway.

    Create a gateway configuration to use with a remotely installed gateway.

    Parameters

    Name Type Attribute Description
    params CreateGatewayParams

    The parameters to send to the service.

    Properties

    Name Type Attributes Description
    environmentId string The ID of the environment.
    headers OutgoingHttpHeaders Optional
    name string Optional User-defined name.

    Returns Promise<Response<Gateway>>

createStopwordList

  • Create stopword list.

    Upload a custom stopword list to use with the specified collection.

    Parameters

    Name Type Attribute Description
    params CreateStopwordListParams

    The parameters to send to the service.

    Properties

    Name Type Attributes Description
    collectionId string The ID of the collection.
    environmentId string The ID of the environment.
    stopwordFile ReadableStream | Buffer The content of the stopword list to ingest.
    stopwordFilename string The filename for stopwordFile.
    headers OutgoingHttpHeaders Optional

    Returns Promise<Response<TokenDictStatusResponse>>

createTokenizationDictionary

  • Create tokenization dictionary.

    Upload a custom tokenization dictionary to use with the specified collection.

    Parameters

    Name Type Attribute Description
    params CreateTokenizationDictionaryParams

    The parameters to send to the service.

    Properties

    Name Type Attributes Description
    collectionId string The ID of the collection.
    environmentId string The ID of the environment.
    headers OutgoingHttpHeaders Optional
    tokenizationRules TokenDictRule[] Optional An array of tokenization rules. Each rule contains, the original `text` string, component `tokens`, any alternate character set `readings`, and which `part_of_speech` the text is from.

    Returns Promise<Response<TokenDictStatusResponse>>

createTrainingExample

  • Add example to training data query.

    Adds a example to this training data query.

    Parameters

    Name Type Attribute Description
    params CreateTrainingExampleParams

    The parameters to send to the service.

    Properties

    Name Type Attributes Description
    collectionId string The ID of the collection.
    environmentId string The ID of the environment.
    queryId string The ID of the query used for training.
    crossReference string Optional The cross reference associated with this training example.
    documentId string Optional The document ID associated with this training example.
    headers OutgoingHttpHeaders Optional
    relevance number Optional The relevance of the training example.

    Returns Promise<Response<TrainingExample>>

deleteAllTrainingData

  • Delete all training data.

    Deletes all training data from a collection.

    Parameters

    Name Type Attribute Description
    params DeleteAllTrainingDataParams

    The parameters to send to the service.

    Properties

    Name Type Attributes Description
    collectionId string The ID of the collection.
    environmentId string The ID of the environment.
    headers OutgoingHttpHeaders Optional

    Returns Promise<Response<Empty>>

deleteCollection

  • Delete a collection.

    Parameters

    Name Type Attribute Description
    params DeleteCollectionParams

    The parameters to send to the service.

    Properties

    Name Type Attributes Description
    collectionId string The ID of the collection.
    environmentId string The ID of the environment.
    headers OutgoingHttpHeaders Optional

    Returns Promise<Response<DeleteCollectionResponse>>

deleteConfiguration

  • Delete a configuration.

    The deletion is performed unconditionally. A configuration deletion 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.

    Parameters

    Name Type Attribute Description
    params DeleteConfigurationParams

    The parameters to send to the service.

    Properties

    Name Type Attributes Description
    configurationId string The ID of the configuration.
    environmentId string The ID of the environment.
    headers OutgoingHttpHeaders Optional

    Returns Promise<Response<DeleteConfigurationResponse>>

deleteCredentials

  • Delete credentials.

    Deletes a set of stored credentials from your Discovery instance.

    Parameters

    Name Type Attribute Description
    params DeleteCredentialsParams

    The parameters to send to the service.

    Properties

    Name Type Attributes Description
    credentialId string The unique identifier for a set of source credentials.
    environmentId string The ID of the environment.
    headers OutgoingHttpHeaders Optional

    Returns Promise<Response<DeleteCredentials>>

deleteDocument

  • 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'.

    Parameters

    Name Type Attribute Description
    params DeleteDocumentParams

    The parameters to send to the service.

    Properties

    Name Type Attributes Description
    collectionId string The ID of the collection.
    documentId string The ID of the document.
    environmentId string The ID of the environment.
    headers OutgoingHttpHeaders Optional

    Returns Promise<Response<DeleteDocumentResponse>>

deleteEnvironment

deleteExpansions

  • Delete the expansion list.

    Remove the expansion information for this collection. The expansion list must be deleted to disable query expansion for a collection.

    Parameters

    Name Type Attribute Description
    params DeleteExpansionsParams

    The parameters to send to the service.

    Properties

    Name Type Attributes Description
    collectionId string The ID of the collection.
    environmentId string The ID of the environment.
    headers OutgoingHttpHeaders Optional

    Returns Promise<Response<Empty>>

deleteGateway

  • Delete Gateway.

    Delete the specified gateway configuration.

    Parameters

    Name Type Attribute Description
    params DeleteGatewayParams

    The parameters to send to the service.

    Properties

    Name Type Attributes Description
    environmentId string The ID of the environment.
    gatewayId string The requested gateway ID.
    headers OutgoingHttpHeaders Optional

    Returns Promise<Response<GatewayDelete>>

deleteStopwordList

  • Delete a custom stopword list.

    Delete a custom stopword list from the collection. After a custom stopword list is deleted, the default list is used for the collection.

    Parameters

    Name Type Attribute Description
    params DeleteStopwordListParams

    The parameters to send to the service.

    Properties

    Name Type Attributes Description
    collectionId string The ID of the collection.
    environmentId string The ID of the environment.
    headers OutgoingHttpHeaders Optional

    Returns Promise<Response<Empty>>

deleteTokenizationDictionary

  • Delete tokenization dictionary.

    Delete the tokenization dictionary from the collection.

    Parameters

    Name Type Attribute Description
    params DeleteTokenizationDictionaryParams

    The parameters to send to the service.

    Properties

    Name Type Attributes Description
    collectionId string The ID of the collection.
    environmentId string The ID of the environment.
    headers OutgoingHttpHeaders Optional

    Returns Promise<Response<Empty>>

deleteTrainingData

  • Delete a training data query.

    Removes the training data query and all associated examples from the training data set.

    Parameters

    Name Type Attribute Description
    params DeleteTrainingDataParams

    The parameters to send to the service.

    Properties

    Name Type Attributes Description
    collectionId string The ID of the collection.
    environmentId string The ID of the environment.
    queryId string The ID of the query used for training.
    headers OutgoingHttpHeaders Optional

    Returns Promise<Response<Empty>>

deleteTrainingExample

  • Delete example for training data query.

    Deletes the example document with the given ID from the training data query.

    Parameters

    Name Type Attribute Description
    params DeleteTrainingExampleParams

    The parameters to send to the service.

    Properties

    Name Type Attributes Description
    collectionId string The ID of the collection.
    environmentId string The ID of the environment.
    exampleId string The ID of the document as it is indexed.
    queryId string The ID of the query used for training.
    headers OutgoingHttpHeaders Optional

    Returns Promise<Response<Empty>>

deleteUserData

  • 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.

    Parameters

    Name Type Attribute Description
    params DeleteUserDataParams

    The parameters to send to the service.

    Properties

    Name Type Attributes Description
    customerId string The customer ID for which all data is to be deleted.
    headers OutgoingHttpHeaders Optional

    Returns Promise<Response<Empty>>

disableRetries

  • disableRetries(): void
  • Disables retries.

    Returns void

enableRetries

  • enableRetries(retryOptions?: RetryOptions): void
  • Enable retries for unfulfilled requests.

    Parameters

    Name Type Attribute Description
    retryOptions RetryOptions Optional

    configuration for retries

    Returns void

federatedQuery

  • Query multiple collections.

    By using this method, you can construct long queries that search multiple collection. For details, see the Discovery documentation.

    Parameters

    Name Type Attribute Description
    params FederatedQueryParams

    The parameters to send to the service.

    Properties

    Name Type Attributes Description
    collectionIds string A comma-separated list of collection IDs to be queried against.
    environmentId string The ID of the environment.
    _return string Optional A comma-separated list of the portion of the document hierarchy to return.
    aggregation string Optional An aggregation search that returns an exact answer by combining query search with filters. Useful for applications to build lists, tables, and time series. For a full list of possible aggregations, see the Query reference.
    bias string Optional Field which the returned results will be biased against. The specified field must be either a **date** or **number** format. When a **date** type field is specified returned results are biased towards field values closer to the current date. When a **number** type field is specified, returned results are biased towards higher field values. This parameter cannot be used in the same query as the **sort** parameter.
    count number Optional Number of results to return.
    deduplicate boolean Optional When `true`, and used with a Watson Discovery News collection, duplicate results (based on the contents of the **title** field) are removed. Duplicate comparison is limited to the current query only; **offset** is not considered. This parameter is currently Beta functionality.
    deduplicateField string Optional When specified, duplicate results based on the field specified are removed from the returned results. Duplicate comparison is limited to the current query only, **offset** is not considered. This parameter is currently Beta functionality.
    filter string Optional A cacheable query that excludes documents that don't mention the query content. Filter searches are better for metadata-type searches and for assessing the concepts in the data set.
    headers OutgoingHttpHeaders Optional
    highlight boolean Optional When true, a highlight field is returned for each result which contains the fields which match the query with `<em></em>` tags around the matching query terms.
    naturalLanguageQuery string Optional A natural language query that returns relevant documents by utilizing training data and natural language understanding.
    offset number Optional The 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.
    passages boolean Optional A passages query that returns the most relevant passages from the results.
    passagesCharacters number Optional The approximate number of characters that any one passage will have.
    passagesCount number Optional The maximum number of passages to return. The search returns fewer passages if the requested total is not found. The default is `10`. The maximum is `100`.
    passagesFields string Optional A comma-separated list of fields that passages are drawn from. If this parameter not specified, then all top-level fields are included.
    query string Optional A query search returns all documents in your data set with full enrichments and full text, but with the most relevant documents listed first. Use a query search when you want to find the most relevant search results.
    similar boolean Optional When `true`, results are returned based on their similarity to the document IDs specified in the **similar.document_ids** parameter.
    similarDocumentIds string Optional A comma-separated list of document IDs to find similar documents.
    similarFields string Optional A comma-separated list of field names that are used as a basis for comparison to identify similar documents. If not specified, the entire document is used for comparison.
    sort string Optional A 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. This parameter cannot be used in the same query as the **bias** parameter.
    xWatsonLoggingOptOut boolean Optional If `true`, queries are not stored in the Discovery **Logs** endpoint.

    Returns Promise<Response<QueryResponse>>

federatedQueryNotices

  • Query multiple collection system notices.

    Queries for notices (errors or warnings) that might have been generated by the system. Notices are generated when ingesting documents and performing relevance training. See the Discovery documentation for more details on the query language.

    Parameters

    Name Type Attribute Description
    params FederatedQueryNoticesParams

    The parameters to send to the service.

    Properties

    Name Type Attributes Description
    collectionIds string[] A comma-separated list of collection IDs to be queried against.
    environmentId string The ID of the environment.
    _return string[] Optional A comma-separated list of the portion of the document hierarchy to return.
    aggregation string Optional An aggregation search that returns an exact answer by combining query search with filters. Useful for applications to build lists, tables, and time series. For a full list of possible aggregations, see the Query reference.
    count number Optional Number of results to return. The maximum for the **count** and **offset** values together in any one query is **10000**.
    deduplicateField string Optional When specified, duplicate results based on the field specified are removed from the returned results. Duplicate comparison is limited to the current query only, **offset** is not considered. This parameter is currently Beta functionality.
    filter string Optional A cacheable query that excludes documents that don't mention the query content. Filter searches are better for metadata-type searches and for assessing the concepts in the data set.
    headers OutgoingHttpHeaders Optional
    highlight boolean Optional When true, a highlight field is returned for each result which contains the fields which match the query with `<em></em>` tags around the matching query terms.
    naturalLanguageQuery string Optional A natural language query that returns relevant documents by utilizing training data and natural language understanding.
    offset number Optional The 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**.
    query string Optional A query search returns all documents in your data set with full enrichments and full text, but with the most relevant documents listed first.
    similar boolean Optional When `true`, results are returned based on their similarity to the document IDs specified in the **similar.document_ids** parameter.
    similarDocumentIds string[] Optional A comma-separated list of document IDs to find similar documents.
    similarFields string[] Optional A comma-separated list of field names that are used as a basis for comparison to identify similar documents. If not specified, the entire document is used for comparison.
    sort string[] Optional A 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.

    Returns Promise<Response<QueryNoticesResponse>>

getAuthenticator

  • getAuthenticator(): any
  • Get the instance of the authenticator set on the service.

    Returns any

getAutocompletion

  • Get Autocomplete Suggestions.

    Returns completion query suggestions for the specified prefix. /n/n Important: this method is only valid when using the Cloud Pak version of Discovery.

    Parameters

    Name Type Attribute Description
    params GetAutocompletionParams

    The parameters to send to the service.

    Properties

    Name Type Attributes Description
    collectionId string The ID of the collection.
    environmentId string The ID of the environment.
    prefix string The prefix to use for autocompletion. For example, the prefix `Ho` could autocomplete to `hot`, `housing`, or `how`.
    count number Optional The number of autocompletion suggestions to return.
    field string Optional The field in the result documents that autocompletion suggestions are identified from.
    headers OutgoingHttpHeaders Optional

    Returns Promise<Response<Completions>>

getCollection

  • Get collection details.

    Parameters

    Name Type Attribute Description
    params GetCollectionParams

    The parameters to send to the service.

    Properties

    Name Type Attributes Description
    collectionId string The ID of the collection.
    environmentId string The ID of the environment.
    headers OutgoingHttpHeaders Optional

    Returns Promise<Response<Collection>>

getConfiguration

  • Get configuration details.

    Parameters

    Name Type Attribute Description
    params GetConfigurationParams

    The parameters to send to the service.

    Properties

    Name Type Attributes Description
    configurationId string The ID of the configuration.
    environmentId string The ID of the environment.
    headers OutgoingHttpHeaders Optional

    Returns Promise<Response<Configuration>>

getCredentials

  • View Credentials.

    Returns details about the specified credentials.

    Note: Secure credential information such as a password or SSH key is never returned and must be obtained from the source system.

    Parameters

    Name Type Attribute Description
    params GetCredentialsParams

    The parameters to send to the service.

    Properties

    Name Type Attributes Description
    credentialId string The unique identifier for a set of source credentials.
    environmentId string The ID of the environment.
    headers OutgoingHttpHeaders Optional

    Returns Promise<Response<Credentials>>

getDocumentStatus

  • Get document details.

    Fetch status details about a submitted document. Note: this operation does not return the document itself. Instead, it returns only the document's processing status and any notices (warnings or errors) that were generated when the document was ingested. Use the query API to retrieve the actual document content.

    Parameters

    Name Type Attribute Description
    params GetDocumentStatusParams

    The parameters to send to the service.

    Properties

    Name Type Attributes Description
    collectionId string The ID of the collection.
    documentId string The ID of the document.
    environmentId string The ID of the environment.
    headers OutgoingHttpHeaders Optional

    Returns Promise<Response<DocumentStatus>>

getEnvironment

  • Get environment info.

    Parameters

    Name Type Attribute Description
    params GetEnvironmentParams

    The parameters to send to the service.

    Properties

    Name Type Attributes Description
    environmentId string The ID of the environment.
    headers OutgoingHttpHeaders Optional

    Returns Promise<Response<Environment>>

getGateway

  • List Gateway Details.

    List information about the specified gateway.

    Parameters

    Name Type Attribute Description
    params GetGatewayParams

    The parameters to send to the service.

    Properties

    Name Type Attributes Description
    environmentId string The ID of the environment.
    gatewayId string The requested gateway ID.
    headers OutgoingHttpHeaders Optional

    Returns Promise<Response<Gateway>>

getHttpClient

  • getHttpClient(): AxiosInstance
  • Get the Axios instance set on the service. All requests will be made using this instance.

    Returns AxiosInstance

getMetricsEventRate

  • Percentage of queries with an associated event.

    The percentage of queries using the natural_language_query parameter that have a corresponding "click" event over a specified time window. This metric requires having integrated event tracking in your application using the Events API.

    Parameters

    Name Type Attribute Description
    params GetMetricsEventRateParams Optional

    Properties

    Name Type Attributes Description
    endTime string Optional Metric is computed from data recorded before this timestamp; must be in `YYYY-MM-DDThh:mm:ssZ` format.
    headers OutgoingHttpHeaders Optional
    resultType ResultType | string Optional The type of result to consider when calculating the metric.
    startTime string Optional Metric is computed from data recorded after this timestamp; must be in `YYYY-MM-DDThh:mm:ssZ` format.

    Returns Promise<Response<MetricResponse>>

getMetricsQuery

  • Number of queries over time.

    Total number of queries using the natural_language_query parameter over a specific time window.

    Parameters

    Name Type Attribute Description
    params GetMetricsQueryParams Optional

    Properties

    Name Type Attributes Description
    endTime string Optional Metric is computed from data recorded before this timestamp; must be in `YYYY-MM-DDThh:mm:ssZ` format.
    headers OutgoingHttpHeaders Optional
    resultType ResultType | string Optional The type of result to consider when calculating the metric.
    startTime string Optional Metric is computed from data recorded after this timestamp; must be in `YYYY-MM-DDThh:mm:ssZ` format.

    Returns Promise<Response<MetricResponse>>

getMetricsQueryEvent

  • Number of queries with an event over time.

    Total number of queries using the natural_language_query parameter that have a corresponding "click" event over a specified time window. This metric requires having integrated event tracking in your application using the Events API.

    Parameters

    Name Type Attribute Description
    params GetMetricsQueryEventParams Optional

    Properties

    Name Type Attributes Description
    endTime string Optional Metric is computed from data recorded before this timestamp; must be in `YYYY-MM-DDThh:mm:ssZ` format.
    headers OutgoingHttpHeaders Optional
    resultType ResultType | string Optional The type of result to consider when calculating the metric.
    startTime string Optional Metric is computed from data recorded after this timestamp; must be in `YYYY-MM-DDThh:mm:ssZ` format.

    Returns Promise<Response<MetricResponse>>

getMetricsQueryNoResults

  • Number of queries with no search results over time.

    Total number of queries using the natural_language_query parameter that have no results returned over a specified time window.

    Parameters

    Name Type Attribute Description
    params GetMetricsQueryNoResultsParams Optional

    Properties

    Name Type Attributes Description
    endTime string Optional Metric is computed from data recorded before this timestamp; must be in `YYYY-MM-DDThh:mm:ssZ` format.
    headers OutgoingHttpHeaders Optional
    resultType ResultType | string Optional The type of result to consider when calculating the metric.
    startTime string Optional Metric is computed from data recorded after this timestamp; must be in `YYYY-MM-DDThh:mm:ssZ` format.

    Returns Promise<Response<MetricResponse>>

getMetricsQueryTokenEvent

  • Most frequent query tokens with an event.

    The most frequent query tokens parsed from the natural_language_query parameter and their corresponding "click" event rate within the recording period (queries and events are stored for 30 days). A query token is an individual word or unigram within the query string.

    Parameters

    Name Type Attribute Description
    params GetMetricsQueryTokenEventParams Optional

    Properties

    Name Type Attributes Description
    count number Optional Number of results to return. The maximum for the **count** and **offset** values together in any one query is **10000**.
    headers OutgoingHttpHeaders Optional

    Returns Promise<Response<MetricTokenResponse>>

getStopwordListStatus

  • Get stopword list status.

    Returns the current status of the stopword list for the specified collection.

    Parameters

    Name Type Attribute Description
    params GetStopwordListStatusParams

    The parameters to send to the service.

    Properties

    Name Type Attributes Description
    collectionId string The ID of the collection.
    environmentId string The ID of the environment.
    headers OutgoingHttpHeaders Optional

    Returns Promise<Response<TokenDictStatusResponse>>

getTokenizationDictionaryStatus

  • Get tokenization dictionary status.

    Returns the current status of the tokenization dictionary for the specified collection.

    Parameters

    Name Type Attribute Description
    params GetTokenizationDictionaryStatusParams

    The parameters to send to the service.

    Properties

    Name Type Attributes Description
    collectionId string The ID of the collection.
    environmentId string The ID of the environment.
    headers OutgoingHttpHeaders Optional

    Returns Promise<Response<TokenDictStatusResponse>>

getTrainingData

  • Get details about a query.

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

    Parameters

    Name Type Attribute Description
    params GetTrainingDataParams

    The parameters to send to the service.

    Properties

    Name Type Attributes Description
    collectionId string The ID of the collection.
    environmentId string The ID of the environment.
    queryId string The ID of the query used for training.
    headers OutgoingHttpHeaders Optional

    Returns Promise<Response<TrainingQuery>>

getTrainingExample

  • Get details for training data example.

    Gets the details for this training example.

    Parameters

    Name Type Attribute Description
    params GetTrainingExampleParams

    The parameters to send to the service.

    Properties

    Name Type Attributes Description
    collectionId string The ID of the collection.
    environmentId string The ID of the environment.
    exampleId string The ID of the document as it is indexed.
    queryId string The ID of the query used for training.
    headers OutgoingHttpHeaders Optional

    Returns Promise<Response<TrainingExample>>

listCollectionFields

  • List collection fields.

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

    Parameters

    Name Type Attribute Description
    params ListCollectionFieldsParams

    The parameters to send to the service.

    Properties

    Name Type Attributes Description
    collectionId string The ID of the collection.
    environmentId string The ID of the environment.
    headers OutgoingHttpHeaders Optional

    Returns Promise<Response<ListCollectionFieldsResponse>>

listCollections

  • List collections.

    Lists existing collections for the service instance.

    Parameters

    Name Type Attribute Description
    params ListCollectionsParams

    The parameters to send to the service.

    Properties

    Name Type Attributes Description
    environmentId string The ID of the environment.
    headers OutgoingHttpHeaders Optional
    name string Optional Find collections with the given name.

    Returns Promise<Response<ListCollectionsResponse>>

listConfigurations

  • List configurations.

    Lists existing configurations for the service instance.

    Parameters

    Name Type Attribute Description
    params ListConfigurationsParams

    The parameters to send to the service.

    Properties

    Name Type Attributes Description
    environmentId string The ID of the environment.
    headers OutgoingHttpHeaders Optional
    name string Optional Find configurations with the given name.

    Returns Promise<Response<ListConfigurationsResponse>>

listCredentials

  • List credentials.

    List all the source credentials that have been created for this service instance.

    Note: All credentials are sent over an encrypted connection and encrypted at rest.

    Parameters

    Name Type Attribute Description
    params ListCredentialsParams

    The parameters to send to the service.

    Properties

    Name Type Attributes Description
    environmentId string The ID of the environment.
    headers OutgoingHttpHeaders Optional

    Returns Promise<Response<CredentialsList>>

listEnvironments

  • List environments.

    List existing environments for the service instance.

    Parameters

    Name Type Attribute Description
    params ListEnvironmentsParams Optional

    Properties

    Name Type Attributes Description
    headers OutgoingHttpHeaders Optional
    name string Optional Show only the environment with the given name.

    Returns Promise<Response<ListEnvironmentsResponse>>

listExpansions

  • Get the expansion list.

    Returns the current expansion list for the specified collection. If an expansion list is not specified, an object with empty expansion arrays is returned.

    Parameters

    Name Type Attribute Description
    params ListExpansionsParams

    The parameters to send to the service.

    Properties

    Name Type Attributes Description
    collectionId string The ID of the collection.
    environmentId string The ID of the environment.
    headers OutgoingHttpHeaders Optional

    Returns Promise<Response<Expansions>>

listFields

  • List fields across collections.

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

    Parameters

    Name Type Attribute Description
    params ListFieldsParams

    The parameters to send to the service.

    Properties

    Name Type Attributes Description
    collectionIds string[] A comma-separated list of collection IDs to be queried against.
    environmentId string The ID of the environment.
    headers OutgoingHttpHeaders Optional

    Returns Promise<Response<ListCollectionFieldsResponse>>

listGateways

  • List Gateways.

    List the currently configured gateways.

    Parameters

    Name Type Attribute Description
    params ListGatewaysParams

    The parameters to send to the service.

    Properties

    Name Type Attributes Description
    environmentId string The ID of the environment.
    headers OutgoingHttpHeaders Optional

    Returns Promise<Response<GatewayList>>

listTrainingData

  • List training data.

    Lists the training data for the specified collection.

    Parameters

    Name Type Attribute Description
    params ListTrainingDataParams

    The parameters to send to the service.

    Properties

    Name Type Attributes Description
    collectionId string The ID of the collection.
    environmentId string The ID of the environment.
    headers OutgoingHttpHeaders Optional

    Returns Promise<Response<TrainingDataSet>>

listTrainingExamples

  • List examples for a training data query.

    List all examples for this training data query.

    Parameters

    Name Type Attribute Description
    params ListTrainingExamplesParams

    The parameters to send to the service.

    Properties

    Name Type Attributes Description
    collectionId string The ID of the collection.
    environmentId string The ID of the environment.
    queryId string The ID of the query used for training.
    headers OutgoingHttpHeaders Optional

    Returns Promise<Response<TrainingExampleList>>

query

  • Query a collection.

    By using this method, you can construct long queries. For details, see the Discovery documentation.

    Parameters

    Name Type Attribute Description
    params QueryParams

    The parameters to send to the service.

    Properties

    Name Type Attributes Description
    collectionId string The ID of the collection.
    environmentId string The ID of the environment.
    _return string Optional A comma-separated list of the portion of the document hierarchy to return.
    aggregation string Optional An aggregation search that returns an exact answer by combining query search with filters. Useful for applications to build lists, tables, and time series. For a full list of possible aggregations, see the Query reference.
    bias string Optional Field which the returned results will be biased against. The specified field must be either a **date** or **number** format. When a **date** type field is specified returned results are biased towards field values closer to the current date. When a **number** type field is specified, returned results are biased towards higher field values. This parameter cannot be used in the same query as the **sort** parameter.
    count number Optional Number of results to return.
    deduplicate boolean Optional When `true`, and used with a Watson Discovery News collection, duplicate results (based on the contents of the **title** field) are removed. Duplicate comparison is limited to the current query only; **offset** is not considered. This parameter is currently Beta functionality.
    deduplicateField string Optional When specified, duplicate results based on the field specified are removed from the returned results. Duplicate comparison is limited to the current query only, **offset** is not considered. This parameter is currently Beta functionality.
    filter string Optional A cacheable query that excludes documents that don't mention the query content. Filter searches are better for metadata-type searches and for assessing the concepts in the data set.
    headers OutgoingHttpHeaders Optional
    highlight boolean Optional When true, a highlight field is returned for each result which contains the fields which match the query with `<em></em>` tags around the matching query terms.
    naturalLanguageQuery string Optional A natural language query that returns relevant documents by utilizing training data and natural language understanding.
    offset number Optional The 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.
    passages boolean Optional A passages query that returns the most relevant passages from the results.
    passagesCharacters number Optional The approximate number of characters that any one passage will have.
    passagesCount number Optional The maximum number of passages to return. The search returns fewer passages if the requested total is not found. The default is `10`. The maximum is `100`.
    passagesFields string Optional A comma-separated list of fields that passages are drawn from. If this parameter not specified, then all top-level fields are included.
    query string Optional A query search returns all documents in your data set with full enrichments and full text, but with the most relevant documents listed first. Use a query search when you want to find the most relevant search results.
    similar boolean Optional When `true`, results are returned based on their similarity to the document IDs specified in the **similar.document_ids** parameter.
    similarDocumentIds string Optional A comma-separated list of document IDs to find similar documents.
    similarFields string Optional A comma-separated list of field names that are used as a basis for comparison to identify similar documents. If not specified, the entire document is used for comparison.
    sort string Optional A 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. This parameter cannot be used in the same query as the **bias** parameter.
    spellingSuggestions boolean Optional When `true` and the **natural_language_query** parameter is used, the **natural_languge_query** parameter is spell checked. The most likely correction is returned in the **suggested_query** field of the response (if one exists).
    xWatsonLoggingOptOut boolean Optional If `true`, queries are not stored in the Discovery **Logs** endpoint.

    Returns Promise<Response<QueryResponse>>

queryLog

  • Search the query and event log.

    Searches the query and event log to find query sessions that match the specified criteria. Searching the logs endpoint uses the standard Discovery query syntax for the parameters that are supported.

    Parameters

    Name Type Attribute Description
    params QueryLogParams Optional

    Properties

    Name Type Attributes Description
    count number Optional Number of results to return. The maximum for the **count** and **offset** values together in any one query is **10000**.
    filter string Optional A cacheable query that excludes documents that don't mention the query content. Filter searches are better for metadata-type searches and for assessing the concepts in the data set.
    headers OutgoingHttpHeaders Optional
    offset number Optional The 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**.
    query string Optional A query search returns all documents in your data set with full enrichments and full text, but with the most relevant documents listed first.
    sort string[] Optional A 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.

    Returns Promise<Response<LogQueryResponse>>

queryNotices

  • Query system notices.

    Queries for notices (errors or warnings) that might have been generated by the system. Notices are generated when ingesting documents and performing relevance training. See the Discovery documentation for more details on the query language.

    Parameters

    Name Type Attribute Description
    params QueryNoticesParams

    The parameters to send to the service.

    Properties

    Name Type Attributes Description
    collectionId string The ID of the collection.
    environmentId string The ID of the environment.
    _return string[] Optional A comma-separated list of the portion of the document hierarchy to return.
    aggregation string Optional An aggregation search that returns an exact answer by combining query search with filters. Useful for applications to build lists, tables, and time series. For a full list of possible aggregations, see the Query reference.
    count number Optional Number of results to return. The maximum for the **count** and **offset** values together in any one query is **10000**.
    deduplicateField string Optional When specified, duplicate results based on the field specified are removed from the returned results. Duplicate comparison is limited to the current query only, **offset** is not considered. This parameter is currently Beta functionality.
    filter string Optional A cacheable query that excludes documents that don't mention the query content. Filter searches are better for metadata-type searches and for assessing the concepts in the data set.
    headers OutgoingHttpHeaders Optional
    highlight boolean Optional When true, a highlight field is returned for each result which contains the fields which match the query with `<em></em>` tags around the matching query terms.
    naturalLanguageQuery string Optional A natural language query that returns relevant documents by utilizing training data and natural language understanding.
    offset number Optional The 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**.
    passages boolean Optional A passages query that returns the most relevant passages from the results.
    passagesCharacters number Optional The approximate number of characters that any one passage will have.
    passagesCount number Optional The maximum number of passages to return. The search returns fewer passages if the requested total is not found.
    passagesFields string[] Optional A comma-separated list of fields that passages are drawn from. If this parameter not specified, then all top-level fields are included.
    query string Optional A query search returns all documents in your data set with full enrichments and full text, but with the most relevant documents listed first.
    similar boolean Optional When `true`, results are returned based on their similarity to the document IDs specified in the **similar.document_ids** parameter.
    similarDocumentIds string[] Optional A comma-separated list of document IDs to find similar documents.
    similarFields string[] Optional A comma-separated list of field names that are used as a basis for comparison to identify similar documents. If not specified, the entire document is used for comparison.
    sort string[] Optional A 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.

    Returns Promise<Response<QueryNoticesResponse>>

setEnableGzipCompression

  • setEnableGzipCompression(setting: boolean): void
  • Turn request body compression on or off.

    Parameters

    Name Type Attribute Description
    setting boolean

    Will turn it on if 'true', off if 'false'.

    Returns void

setServiceUrl

  • setServiceUrl(url: string): void
  • Set the service URL to send requests to.

    Parameters

    Name Type Attribute Description
    url string

    The base URL for the service.

    Returns void

updateCollection

  • Update a collection.

    Parameters

    Name Type Attribute Description
    params UpdateCollectionParams

    The parameters to send to the service.

    Properties

    Name Type Attributes Description
    collectionId string The ID of the collection.
    environmentId string The ID of the environment.
    name string The name of the collection.
    configurationId string Optional The ID of the configuration in which the collection is to be updated.
    description string Optional A description of the collection.
    headers OutgoingHttpHeaders Optional

    Returns Promise<Response<Collection>>

updateConfiguration

  • Update a configuration.

    Replaces an existing configuration.

    • Completely replaces the original configuration.
    • The configuration_id, updated, and created fields are accepted in the request, but they are ignored, and an error is not generated. It is also acceptable for users to submit an updated configuration with none of the three properties.
    • Documents are processed with a snapshot of the configuration as it was at the time the document was submitted to be ingested. This means that already submitted documents will not see any updates made to the configuration.

    Parameters

    Name Type Attribute Description
    params UpdateConfigurationParams

    The parameters to send to the service.

    Properties

    Name Type Attributes Description
    configurationId string The ID of the configuration.
    environmentId string The ID of the environment.
    name string The name of the configuration.
    conversions Conversions Optional Document conversion settings.
    description string Optional The description of the configuration, if available.
    enrichments Enrichment[] Optional An array of document enrichment settings for the configuration.
    headers OutgoingHttpHeaders Optional
    normalizations NormalizationOperation[] Optional Defines operations that can be used to transform the final output JSON into a normalized form. Operations are executed in the order that they appear in the array.
    source Source Optional Object containing source parameters for the configuration.

    Returns Promise<Response<Configuration>>

updateCredentials

  • Update credentials.

    Updates an existing set of source credentials.

    Note: All credentials are sent over an encrypted connection and encrypted at rest.

    Parameters

    Name Type Attribute Description
    params UpdateCredentialsParams

    The parameters to send to the service.

    Properties

    Name Type Attributes Description
    credentialId string The unique identifier for a set of source credentials.
    environmentId string The ID of the environment.
    credentialDetails CredentialDetails Optional Object containing details of the stored credentials.
    headers OutgoingHttpHeaders Optional
    sourceType SourceType | string Optional The source that this credentials object connects to. - `box` indicates the credentials are used to connect an instance of Enterprise Box. - `salesforce` indicates the credentials are used to connect to Salesforce. - `sharepoint` indicates the credentials are used to connect to Microsoft SharePoint Online. - `web_crawl` indicates the credentials are used to perform a web crawl. = `cloud_object_storage` indicates the credentials are used to connect to an IBM Cloud Object Store.
    status StatusDetails Optional Object that contains details about the status of the authentication process.

    Returns Promise<Response<Credentials>>

updateDocument

  • Update a document.

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

    Note: When uploading a new document with this method it automatically replaces any document stored with the same document_id if it exists.

    Parameters

    Name Type Attribute Description
    params UpdateDocumentParams

    The parameters to send to the service.

    Properties

    Name Type Attributes Description
    collectionId string The ID of the collection.
    documentId string The ID of the document.
    environmentId string The ID of the environment.
    file ReadableStream | Buffer Optional The content of the document to ingest. The maximum supported file size when adding a file to a collection is 50 megabytes, the maximum supported file size when testing a configuration is 1 megabyte. Files larger than the supported size are rejected.
    fileContentType FileContentType | string Optional The content type of file.
    filename string Optional The filename for file.
    headers OutgoingHttpHeaders Optional
    metadata string Optional The maximum supported metadata file size is 1 MB. Metadata parts larger than 1 MB are rejected. Example: ``` { "Creator": "Johnny Appleseed", "Subject": "Apples" } ```.

    Returns Promise<Response<DocumentAccepted>>

updateEnvironment

  • Update an environment.

    Updates an environment. The environment's name and description parameters can be changed. You must specify a name for the environment.

    Parameters

    Name Type Attribute Description
    params UpdateEnvironmentParams

    The parameters to send to the service.

    Properties

    Name Type Attributes Description
    environmentId string The ID of the environment.
    description string Optional Description of the environment.
    headers OutgoingHttpHeaders Optional
    name string Optional Name that identifies the environment.
    size Size | string Optional Size that the environment should be increased to. Environment size cannot be modified when using a Lite plan. Environment size can only increased and not decreased.

    Returns Promise<Response<Environment>>

updateTrainingExample

  • Change label or cross reference for example.

    Changes the label or cross reference query for this training data example.

    Parameters

    Name Type Attribute Description
    params UpdateTrainingExampleParams

    The parameters to send to the service.

    Properties

    Name Type Attributes Description
    collectionId string The ID of the collection.
    environmentId string The ID of the environment.
    exampleId string The ID of the document as it is indexed.
    queryId string The ID of the query used for training.
    crossReference string Optional The example to add.
    headers OutgoingHttpHeaders Optional
    relevance number Optional The relevance value for this example.

    Returns Promise<Response<TrainingExample>>

Generated using TypeDoc