watson-developer-cloud
Version:
Client library to use the IBM Watson Services
740 lines • 215 kB
TypeScript
/**
* Copyright 2018 IBM All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/// <reference types="node" />
import { AxiosResponse } from 'axios';
import { BaseService } from 'ibm-cloud-sdk-core';
import { FileObject } from 'ibm-cloud-sdk-core';
/**
* The IBM Watson™ Discovery Service 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.
*/
declare class DiscoveryV1 extends BaseService {
static URL: string;
name: string;
serviceVersion: string;
/**
* Construct a DiscoveryV1 object.
*
* @param {Object} options - Options for the service.
* @param {string} options.version - The API version date to use with the service, in "YYYY-MM-DD" format. Whenever the API is changed in a backwards incompatible way, a new minor version of the API is released. The service uses the API version for the date you specify, or the most recent version before that date. Note that you should not programmatically specify the current date at runtime, in case the API has been updated since your application's release. Instead, specify a version date that is compatible with your application, and don't change it until your application is ready for a later version.
* @param {string} [options.url] - The base url to use when contacting the service (e.g. 'https://gateway.watsonplatform.net/discovery/api'). The base url may differ between Bluemix regions.
* @param {string} [options.username] - The username used to authenticate with the service. Username and password credentials are only required to run your application locally or outside of Bluemix. When running on Bluemix, the credentials will be automatically loaded from the `VCAP_SERVICES` environment variable.
* @param {string} [options.password] - The password used to authenticate with the service. Username and password credentials are only required to run your application locally or outside of Bluemix. When running on Bluemix, the credentials will be automatically loaded from the `VCAP_SERVICES` environment variable.
* @param {string} [options.iam_access_token] - An IAM access token fully managed by the application. Responsibility falls on the application to refresh the token, either before it expires or reactively upon receiving a 401 from the service, as any requests made with an expired token will fail.
* @param {string} [options.iam_apikey] - An API key that can be used to request IAM tokens. If this API key is provided, the SDK will manage the token and handle the refreshing.
* @param {string} [options.iam_url] - An optional URL for the IAM service API. Defaults to 'https://iam.bluemix.net/identity/token'.
* @param {boolean} [options.use_unauthenticated] - Set to `true` to avoid including an authorization header. This option may be useful for requests that are proxied.
* @param {Object} [options.headers] - Default headers that shall be included with every request to the service.
* @param {boolean} [options.headers.X-Watson-Learning-Opt-Out] - Set to `true` to opt-out of data collection. By default, all IBM Watson services log requests and their results. Logging is done only to improve the services for future users. The logged data is not shared or made public. If you are concerned with protecting the privacy of users' personal information or otherwise do not want your requests to be logged, you can opt out of logging.
* @constructor
* @returns {DiscoveryV1}
* @throws {Error}
*/
constructor(options: DiscoveryV1.Options);
/*************************
* environments
************************/
/**
* 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.
*
* @param {Object} params - The parameters to send to the service.
* @param {string} params.name - Name that identifies the environment.
* @param {string} [params.description] - Description of the environment.
* @param {string} [params.size] - Size of the environment. In the Lite plan the default and only accepted value is
* `LT`, in all other plans the default is `S`.
* @param {Object} [params.headers] - Custom request headers
* @param {Function} [callback] - The callback that handles the response.
* @returns {Promise<any>|void}
*/
createEnvironment(params: DiscoveryV1.CreateEnvironmentParams, callback?: DiscoveryV1.Callback<DiscoveryV1.Environment>): Promise<any> | void;
/**
* Delete environment.
*
* @param {Object} params - The parameters to send to the service.
* @param {string} params.environment_id - The ID of the environment.
* @param {Object} [params.headers] - Custom request headers
* @param {Function} [callback] - The callback that handles the response.
* @returns {Promise<any>|void}
*/
deleteEnvironment(params: DiscoveryV1.DeleteEnvironmentParams, callback?: DiscoveryV1.Callback<DiscoveryV1.DeleteEnvironmentResponse>): Promise<any> | void;
/**
* Get environment info.
*
* @param {Object} params - The parameters to send to the service.
* @param {string} params.environment_id - The ID of the environment.
* @param {Object} [params.headers] - Custom request headers
* @param {Function} [callback] - The callback that handles the response.
* @returns {Promise<any>|void}
*/
getEnvironment(params: DiscoveryV1.GetEnvironmentParams, callback?: DiscoveryV1.Callback<DiscoveryV1.Environment>): Promise<any> | void;
/**
* List environments.
*
* List existing environments for the service instance.
*
* @param {Object} [params] - The parameters to send to the service.
* @param {string} [params.name] - Show only the environment with the given name.
* @param {Object} [params.headers] - Custom request headers
* @param {Function} [callback] - The callback that handles the response.
* @returns {Promise<any>|void}
*/
listEnvironments(params?: DiscoveryV1.ListEnvironmentsParams, callback?: DiscoveryV1.Callback<DiscoveryV1.ListEnvironmentsResponse>): Promise<any> | void;
/**
* List fields across collections.
*
* Gets a list of the unique fields (and their types) stored in the indexes of the specified collections.
*
* @param {Object} params - The parameters to send to the service.
* @param {string} params.environment_id - The ID of the environment.
* @param {string[]} params.collection_ids - A comma-separated list of collection IDs to be queried against.
* @param {Object} [params.headers] - Custom request headers
* @param {Function} [callback] - The callback that handles the response.
* @returns {Promise<any>|void}
*/
listFields(params: DiscoveryV1.ListFieldsParams, callback?: DiscoveryV1.Callback<DiscoveryV1.ListCollectionFieldsResponse>): Promise<any> | void;
/**
* Update an environment.
*
* Updates an environment. The environment's **name** and **description** parameters can be changed. You must specify
* a **name** for the environment.
*
* @param {Object} params - The parameters to send to the service.
* @param {string} params.environment_id - The ID of the environment.
* @param {string} [params.name] - Name that identifies the environment.
* @param {string} [params.description] - Description of the environment.
* @param {string} [params.size] - 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.
* @param {Object} [params.headers] - Custom request headers
* @param {Function} [callback] - The callback that handles the response.
* @returns {Promise<any>|void}
*/
updateEnvironment(params: DiscoveryV1.UpdateEnvironmentParams, callback?: DiscoveryV1.Callback<DiscoveryV1.Environment>): Promise<any> | void;
/*************************
* configurations
************************/
/**
* 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.
*
* @param {Object} params - The parameters to send to the service.
* @param {string} params.environment_id - The ID of the environment.
* @param {string} params.name - The name of the configuration.
* @param {string} [params.description] - The description of the configuration, if available.
* @param {Conversions} [params.conversions] - Document conversion settings.
* @param {Enrichment[]} [params.enrichments] - An array of document enrichment settings for the configuration.
* @param {NormalizationOperation[]} [params.normalizations] - 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.
* @param {Source} [params.source] - Object containing source parameters for the configuration.
* @param {Object} [params.headers] - Custom request headers
* @param {Function} [callback] - The callback that handles the response.
* @returns {Promise<any>|void}
*/
createConfiguration(params: DiscoveryV1.CreateConfigurationParams, callback?: DiscoveryV1.Callback<DiscoveryV1.Configuration>): Promise<any> | void;
/**
* 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.
*
* @param {Object} params - The parameters to send to the service.
* @param {string} params.environment_id - The ID of the environment.
* @param {string} params.configuration_id - The ID of the configuration.
* @param {Object} [params.headers] - Custom request headers
* @param {Function} [callback] - The callback that handles the response.
* @returns {Promise<any>|void}
*/
deleteConfiguration(params: DiscoveryV1.DeleteConfigurationParams, callback?: DiscoveryV1.Callback<DiscoveryV1.DeleteConfigurationResponse>): Promise<any> | void;
/**
* Get configuration details.
*
* @param {Object} params - The parameters to send to the service.
* @param {string} params.environment_id - The ID of the environment.
* @param {string} params.configuration_id - The ID of the configuration.
* @param {Object} [params.headers] - Custom request headers
* @param {Function} [callback] - The callback that handles the response.
* @returns {Promise<any>|void}
*/
getConfiguration(params: DiscoveryV1.GetConfigurationParams, callback?: DiscoveryV1.Callback<DiscoveryV1.Configuration>): Promise<any> | void;
/**
* List configurations.
*
* Lists existing configurations for the service instance.
*
* @param {Object} params - The parameters to send to the service.
* @param {string} params.environment_id - The ID of the environment.
* @param {string} [params.name] - Find configurations with the given name.
* @param {Object} [params.headers] - Custom request headers
* @param {Function} [callback] - The callback that handles the response.
* @returns {Promise<any>|void}
*/
listConfigurations(params: DiscoveryV1.ListConfigurationsParams, callback?: DiscoveryV1.Callback<DiscoveryV1.ListConfigurationsResponse>): Promise<any> | void;
/**
* 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.
*
* @param {Object} params - The parameters to send to the service.
* @param {string} params.environment_id - The ID of the environment.
* @param {string} params.configuration_id - The ID of the configuration.
* @param {string} params.name - The name of the configuration.
* @param {string} [params.description] - The description of the configuration, if available.
* @param {Conversions} [params.conversions] - Document conversion settings.
* @param {Enrichment[]} [params.enrichments] - An array of document enrichment settings for the configuration.
* @param {NormalizationOperation[]} [params.normalizations] - 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.
* @param {Source} [params.source] - Object containing source parameters for the configuration.
* @param {Object} [params.headers] - Custom request headers
* @param {Function} [callback] - The callback that handles the response.
* @returns {Promise<any>|void}
*/
updateConfiguration(params: DiscoveryV1.UpdateConfigurationParams, callback?: DiscoveryV1.Callback<DiscoveryV1.Configuration>): Promise<any> | void;
/*************************
* testYourConfigurationOnADocument
************************/
/**
* Test configuration.
*
* Runs a sample document through the default or your configuration and returns diagnostic information designed to
* help you understand how the document was processed. The document is not added to the index.
*
* @param {Object} params - The parameters to send to the service.
* @param {string} params.environment_id - The ID of the environment.
* @param {string} [params.configuration] - The configuration to use to process the document. If this part is
* provided, then the provided configuration is used to process the document. If the **configuration_id** is also
* provided (both are present at the same time), then request is rejected. The maximum supported configuration size is
* 1 MB. Configuration parts larger than 1 MB are rejected.
* See the `GET /configurations/{configuration_id}` operation for an example configuration.
* @param {NodeJS.ReadableStream|FileObject|Buffer} [params.file] - 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 confiruration is 1 megabyte. Files larger than the supported size are rejected.
* @param {string} [params.filename] - The filename for file.
* @param {string} [params.file_content_type] - The content type of file.
* @param {string} [params.metadata] - If you're using the Data Crawler to upload your documents, you can test a
* document against the type of metadata that the Data Crawler might send. The maximum supported metadata file size is
* 1 MB. Metadata parts larger than 1 MB are rejected.
* Example: ``` {
* "Creator": "Johnny Appleseed",
* "Subject": "Apples"
* } ```.
* @param {string} [params.step] - Specify to only run the input document through the given step instead of running
* the input document through the entire ingestion workflow. Valid values are `convert`, `enrich`, and `normalize`.
* @param {string} [params.configuration_id] - The ID of the configuration to use to process the document. If the
* **configuration** form part is also provided (both are present at the same time), then the request will be
* rejected.
* @param {Object} [params.headers] - Custom request headers
* @param {Function} [callback] - The callback that handles the response.
* @returns {Promise<any>|void}
*/
testConfigurationInEnvironment(params: DiscoveryV1.TestConfigurationInEnvironmentParams, callback?: DiscoveryV1.Callback<DiscoveryV1.TestDocument>): Promise<any> | void;
/*************************
* collections
************************/
/**
* Create a collection.
*
* @param {Object} params - The parameters to send to the service.
* @param {string} params.environment_id - The ID of the environment.
* @param {string} params.name - The name of the collection to be created.
* @param {string} [params.description] - A description of the collection.
* @param {string} [params.configuration_id] - The ID of the configuration in which the collection is to be created.
* @param {string} [params.language] - The language of the documents stored in the collection, in the form of an ISO
* 639-1 language code.
* @param {Object} [params.headers] - Custom request headers
* @param {Function} [callback] - The callback that handles the response.
* @returns {Promise<any>|void}
*/
createCollection(params: DiscoveryV1.CreateCollectionParams, callback?: DiscoveryV1.Callback<DiscoveryV1.Collection>): Promise<any> | void;
/**
* Delete a collection.
*
* @param {Object} params - The parameters to send to the service.
* @param {string} params.environment_id - The ID of the environment.
* @param {string} params.collection_id - The ID of the collection.
* @param {Object} [params.headers] - Custom request headers
* @param {Function} [callback] - The callback that handles the response.
* @returns {Promise<any>|void}
*/
deleteCollection(params: DiscoveryV1.DeleteCollectionParams, callback?: DiscoveryV1.Callback<DiscoveryV1.DeleteCollectionResponse>): Promise<any> | void;
/**
* Get collection details.
*
* @param {Object} params - The parameters to send to the service.
* @param {string} params.environment_id - The ID of the environment.
* @param {string} params.collection_id - The ID of the collection.
* @param {Object} [params.headers] - Custom request headers
* @param {Function} [callback] - The callback that handles the response.
* @returns {Promise<any>|void}
*/
getCollection(params: DiscoveryV1.GetCollectionParams, callback?: DiscoveryV1.Callback<DiscoveryV1.Collection>): Promise<any> | void;
/**
* List collection fields.
*
* Gets a list of the unique fields (and their types) stored in the index.
*
* @param {Object} params - The parameters to send to the service.
* @param {string} params.environment_id - The ID of the environment.
* @param {string} params.collection_id - The ID of the collection.
* @param {Object} [params.headers] - Custom request headers
* @param {Function} [callback] - The callback that handles the response.
* @returns {Promise<any>|void}
*/
listCollectionFields(params: DiscoveryV1.ListCollectionFieldsParams, callback?: DiscoveryV1.Callback<DiscoveryV1.ListCollectionFieldsResponse>): Promise<any> | void;
/**
* List collections.
*
* Lists existing collections for the service instance.
*
* @param {Object} params - The parameters to send to the service.
* @param {string} params.environment_id - The ID of the environment.
* @param {string} [params.name] - Find collections with the given name.
* @param {Object} [params.headers] - Custom request headers
* @param {Function} [callback] - The callback that handles the response.
* @returns {Promise<any>|void}
*/
listCollections(params: DiscoveryV1.ListCollectionsParams, callback?: DiscoveryV1.Callback<DiscoveryV1.ListCollectionsResponse>): Promise<any> | void;
/**
* Update a collection.
*
* @param {Object} params - The parameters to send to the service.
* @param {string} params.environment_id - The ID of the environment.
* @param {string} params.collection_id - The ID of the collection.
* @param {string} params.name - The name of the collection.
* @param {string} [params.description] - A description of the collection.
* @param {string} [params.configuration_id] - The ID of the configuration in which the collection is to be updated.
* @param {Object} [params.headers] - Custom request headers
* @param {Function} [callback] - The callback that handles the response.
* @returns {Promise<any>|void}
*/
updateCollection(params: DiscoveryV1.UpdateCollectionParams, callback?: DiscoveryV1.Callback<DiscoveryV1.Collection>): Promise<any> | void;
/*************************
* queryModifications
************************/
/**
* 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.
*
* @param {Object} params - The parameters to send to the service.
* @param {string} params.environment_id - The ID of the environment.
* @param {string} params.collection_id - The ID of the collection.
* @param {Expansion[]} params.expansions - An 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 means that all terms are
* expanded to all other terms in the object. Unidirectional means that a set list of terms can be expanded into a
* second list of terms.
*
* To create a bi-directional expansion specify an **expanded_terms** array. When found in a query, all items in the
* **expanded_terms** array are then expanded to the other items in the same array.
*
* To create a uni-directional expansion, specify both an array of **input_terms** and an array of
* **expanded_terms**. When items in the **input_terms** array are present in a query, they are expanded using the
* items listed in the **expanded_terms** array.
* @param {Object} [params.headers] - Custom request headers
* @param {Function} [callback] - The callback that handles the response.
* @returns {Promise<any>|void}
*/
createExpansions(params: DiscoveryV1.CreateExpansionsParams, callback?: DiscoveryV1.Callback<DiscoveryV1.Expansions>): Promise<any> | void;
/**
* Create stopword list.
*
* Upload a custom stopword list to use with the specified collection.
*
* @param {Object} params - The parameters to send to the service.
* @param {string} params.environment_id - The ID of the environment.
* @param {string} params.collection_id - The ID of the collection.
* @param {NodeJS.ReadableStream|FileObject|Buffer} params.stopword_file - The content of the stopword list to ingest.
* @param {string} params.stopword_filename - The filename for stopword_file.
* @param {Object} [params.headers] - Custom request headers
* @param {Function} [callback] - The callback that handles the response.
* @returns {Promise<any>|void}
*/
createStopwordList(params: DiscoveryV1.CreateStopwordListParams, callback?: DiscoveryV1.Callback<DiscoveryV1.TokenDictStatusResponse>): Promise<any> | void;
/**
* Create tokenization dictionary.
*
* Upload a custom tokenization dictionary to use with the specified collection.
*
* @param {Object} params - The parameters to send to the service.
* @param {string} params.environment_id - The ID of the environment.
* @param {string} params.collection_id - The ID of the collection.
* @param {TokenDictRule[]} [params.tokenization_rules] - 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.
* @param {Object} [params.headers] - Custom request headers
* @param {Function} [callback] - The callback that handles the response.
* @returns {Promise<any>|void}
*/
createTokenizationDictionary(params: DiscoveryV1.CreateTokenizationDictionaryParams, callback?: DiscoveryV1.Callback<DiscoveryV1.TokenDictStatusResponse>): Promise<any> | void;
/**
* Delete the expansion list.
*
* Remove the expansion information for this collection. The expansion list must be deleted to disable query expansion
* for a collection.
*
* @param {Object} params - The parameters to send to the service.
* @param {string} params.environment_id - The ID of the environment.
* @param {string} params.collection_id - The ID of the collection.
* @param {Object} [params.headers] - Custom request headers
* @param {Function} [callback] - The callback that handles the response.
* @returns {Promise<any>|void}
*/
deleteExpansions(params: DiscoveryV1.DeleteExpansionsParams, callback?: DiscoveryV1.Callback<DiscoveryV1.Empty>): Promise<any> | void;
/**
* 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.
*
* @param {Object} params - The parameters to send to the service.
* @param {string} params.environment_id - The ID of the environment.
* @param {string} params.collection_id - The ID of the collection.
* @param {Object} [params.headers] - Custom request headers
* @param {Function} [callback] - The callback that handles the response.
* @returns {Promise<any>|void}
*/
deleteStopwordList(params: DiscoveryV1.DeleteStopwordListParams, callback?: DiscoveryV1.Callback<DiscoveryV1.Empty>): Promise<any> | void;
/**
* Delete tokenization dictionary.
*
* Delete the tokenization dictionary from the collection.
*
* @param {Object} params - The parameters to send to the service.
* @param {string} params.environment_id - The ID of the environment.
* @param {string} params.collection_id - The ID of the collection.
* @param {Object} [params.headers] - Custom request headers
* @param {Function} [callback] - The callback that handles the response.
* @returns {Promise<any>|void}
*/
deleteTokenizationDictionary(params: DiscoveryV1.DeleteTokenizationDictionaryParams, callback?: DiscoveryV1.Callback<DiscoveryV1.Empty>): Promise<any> | void;
/**
* Get stopword list status.
*
* Returns the current status of the stopword list for the specified collection.
*
* @param {Object} params - The parameters to send to the service.
* @param {string} params.environment_id - The ID of the environment.
* @param {string} params.collection_id - The ID of the collection.
* @param {Object} [params.headers] - Custom request headers
* @param {Function} [callback] - The callback that handles the response.
* @returns {Promise<any>|void}
*/
getStopwordListStatus(params: DiscoveryV1.GetStopwordListStatusParams, callback?: DiscoveryV1.Callback<DiscoveryV1.TokenDictStatusResponse>): Promise<any> | void;
/**
* Get tokenization dictionary status.
*
* Returns the current status of the tokenization dictionary for the specified collection.
*
* @param {Object} params - The parameters to send to the service.
* @param {string} params.environment_id - The ID of the environment.
* @param {string} params.collection_id - The ID of the collection.
* @param {Object} [params.headers] - Custom request headers
* @param {Function} [callback] - The callback that handles the response.
* @returns {Promise<any>|void}
*/
getTokenizationDictionaryStatus(params: DiscoveryV1.GetTokenizationDictionaryStatusParams, callback?: DiscoveryV1.Callback<DiscoveryV1.TokenDictStatusResponse>): Promise<any> | void;
/**
* 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.
*
* @param {Object} params - The parameters to send to the service.
* @param {string} params.environment_id - The ID of the environment.
* @param {string} params.collection_id - The ID of the collection.
* @param {Object} [params.headers] - Custom request headers
* @param {Function} [callback] - The callback that handles the response.
* @returns {Promise<any>|void}
*/
listExpansions(params: DiscoveryV1.ListExpansionsParams, callback?: DiscoveryV1.Callback<DiscoveryV1.Expansions>): Promise<any> | void;
/*************************
* documents
************************/
/**
* 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.
*
* @param {Object} params - The parameters to send to the service.
* @param {string} params.environment_id - The ID of the environment.
* @param {string} params.collection_id - The ID of the collection.
* @param {NodeJS.ReadableStream|FileObject|Buffer} [params.file] - 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 confiruration is 1 megabyte. Files larger than the supported size are rejected.
* @param {string} [params.filename] - The filename for file.
* @param {string} [params.file_content_type] - The content type of file.
* @param {string} [params.metadata] - If you're using the Data Crawler to upload your documents, you can test a
* document against the type of metadata that the Data Crawler might send. The maximum supported metadata file size is
* 1 MB. Metadata parts larger than 1 MB are rejected.
* Example: ``` {
* "Creator": "Johnny Appleseed",
* "Subject": "Apples"
* } ```.
* @param {Object} [params.headers] - Custom request headers
* @param {Function} [callback] - The callback that handles the response.
* @returns {Promise<any>|void}
*/
addDocument(params: DiscoveryV1.AddDocumentParams, callback?: DiscoveryV1.Callback<DiscoveryV1.DocumentAccepted>): Promise<any> | void;
/**
* 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'.
*
* @param {Object} params - The parameters to send to the service.
* @param {string} params.environment_id - The ID of the environment.
* @param {string} params.collection_id - The ID of the collection.
* @param {string} params.document_id - The ID of the document.
* @param {Object} [params.headers] - Custom request headers
* @param {Function} [callback] - The callback that handles the response.
* @returns {Promise<any>|void}
*/
deleteDocument(params: DiscoveryV1.DeleteDocumentParams, callback?: DiscoveryV1.Callback<DiscoveryV1.DeleteDocumentResponse>): Promise<any> | void;
/**
* 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.
*
* @param {Object} params - The parameters to send to the service.
* @param {string} params.environment_id - The ID of the environment.
* @param {string} params.collection_id - The ID of the collection.
* @param {string} params.document_id - The ID of the document.
* @param {Object} [params.headers] - Custom request headers
* @param {Function} [callback] - The callback that handles the response.
* @returns {Promise<any>|void}
*/
getDocumentStatus(params: DiscoveryV1.GetDocumentStatusParams, callback?: DiscoveryV1.Callback<DiscoveryV1.DocumentStatus>): Promise<any> | void;
/**
* 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.
*
* @param {Object} params - The parameters to send to the service.
* @param {string} params.environment_id - The ID of the environment.
* @param {string} params.collection_id - The ID of the collection.
* @param {string} params.document_id - The ID of the document.
* @param {NodeJS.ReadableStream|FileObject|Buffer} [params.file] - 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 confiruration is 1 megabyte. Files larger than the supported size are rejected.
* @param {string} [params.filename] - The filename for file.
* @param {string} [params.file_content_type] - The content type of file.
* @param {string} [params.metadata] - If you're using the Data Crawler to upload your documents, you can test a
* document against the type of metadata that the Data Crawler might send. The maximum supported metadata file size is
* 1 MB. Metadata parts larger than 1 MB are rejected.
* Example: ``` {
* "Creator": "Johnny Appleseed",
* "Subject": "Apples"
* } ```.
* @param {Object} [params.headers] - Custom request headers
* @param {Function} [callback] - The callback that handles the response.
* @returns {Promise<any>|void}
*/
updateDocument(params: DiscoveryV1.UpdateDocumentParams, callback?: DiscoveryV1.Callback<DiscoveryV1.DocumentAccepted>): Promise<any> | void;
/*************************
* queries
************************/
/**
* Long environment queries.
*
* Complex queries might be too long for a standard method query. By using this method, you can construct longer
* queries. However, these queries may take longer to complete than the standard method. For details, see the
* [Discovery service
* documentation](https://cloud.ibm.com/docs/services/discovery?topic=discovery-query-concepts#query-concepts).
*
* @param {Object} params - The parameters to send to the service.
* @param {string} params.environment_id - The ID of the environment.
* @param {string} [params.filter] - 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.
* @param {string} [params.query] - 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. You cannot use **natural_language_query** and **query** at the same time.
* @param {string} [params.natural_language_query] - A natural language query that returns relevant documents by
* utilizing training data and natural language understanding. You cannot use **natural_language_query** and **query**
* at the same time.
* @param {boolean} [params.passages] - A passages query that returns the most relevant passages from the results.
* @param {string} [params.aggregation] - 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.
* @param {number} [params.count] - Number of results to return.
* @param {string} [params.return_fields] - A comma-separated list of the portion of the document hierarchy to return.
* @param {number} [params.offset] - 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.
* @param {string} [params.sort] - 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.
* @param {boolean} [params.highlight] - 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.
* @param {string} [params.passages_fields] - A comma-separated list of fields that passages are drawn from. If this
* parameter not specified, then all top-level fields are included.
* @param {number} [params.passages_count] - 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`.
* @param {number} [params.passages_characters] - The approximate number of characters that any one passage will have.
* @param {boolean} [params.deduplicate] - 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.
* @param {string} [params.deduplicate_field] - 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.
* @param {string} [params.collection_ids] - A comma-separated list of collection IDs to be queried against. Required
* when querying multiple collections, invalid when performing a single collection query.
* @param {boolean} [params.similar] - When `true`, results are returned based on their similarity to the document IDs
* specified in the **similar.document_ids** parameter.
* @param {string} [params.similar_document_ids] - A comma-separated list of document IDs to find similar documents.
*
* **Tip:** Include the **natural_language_query** parameter to expand the scope of the document similarity search
* with the natural language query. Other query parameters, such as **filter** and **query**, are subsequently applied
* and reduce the scope.
* @param {string} [params.similar_fields] - 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.
* @param {string} [params.bias] - 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.
* @param {boolean} [params.logging_opt_out] - If `true`, queries are not stored in the Discovery **Logs** endpoint.
* @param {Object} [params.headers] - Custom request headers
* @param {Function} [callback] - The callback that handles the response.
* @returns {Promise<any>|void}
*/
federatedQuery(params: DiscoveryV1.FederatedQueryParams, callback?: DiscoveryV1.Callback<DiscoveryV1.QueryResponse>): Promise<any> | void;
/**
* 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 service
* documentation](https://cloud.ibm.com/docs/services/discovery?topic=discovery-query-concepts#query-concepts) for
* more details on the query language.
*
* @param {Object} params - The parameters to send to the service.
* @param {string} params.environment_id - The ID of the environment.
* @param {string[]} params.collection_ids - A comma-separated list of collection IDs to be queried against.
* @param {string} [params.filter] - 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.
* @param {string} [params.query] - 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. You cannot use **natural_language_query** and **query** at the same time.
* @param {string} [params.natural_language_query] - A natural language query that returns relevant documents by
* utilizing training data and natural language understanding. You cannot use **natural_language_query** and **query**
* at the same time.
* @param {string} [params.aggregation] - 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.
* @param {number} [params.count] - Number of results to return. The maximum for the **count** and **offset** values
* together in any one query is **10000**.
* @param {string[]} [params.return_fields] - A comma-separated list of the portion of the document hierarchy to
* return.
* @param {number} [params.offset] - 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**.
* @param {string[]} [params.sort] - 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.
* @param {boolean} [params.highlight] - 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.
* @param {string} [params.deduplicate_field] - 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.
* @param {boolean} [params.similar] - When `true`, results are returned based on their similarity to the document IDs
* specified in the **similar.document_ids** parameter.
* @param {string[]} [params.similar_document_ids] - A comma-separated list of document IDs to find similar documents.
*
* **Tip:** Include the **natural_language_query** parameter to expand the scope of the document similarity search
* with the natural language query. Other query parameters, such as **filter** and **query**, are subsequently applied
* and reduce the scope.
* @param {string[]} [params.similar_fields] - 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.
* @param {Object} [params.headers] - Custom request headers
* @param {Function} [callback] - The callback that handles the response.
* @returns {Promise<any>|void}
*/
federatedQueryNotices(params: DiscoveryV1.FederatedQueryNoticesParams, callback?: DiscoveryV1.Callback<DiscoveryV1.QueryNoticesResponse>): Promise<any> | void;
/**
* Long collection queries.
*
* Complex queries might be too long for a standard method query. By using this method, you can construct longer
* queries. However, these queries may take longer to complete than the standard method. For details, see the
* [Discovery service
* documentation](https://cloud.ibm.com/docs/services/discovery?topic=discovery-query-concepts#query-concepts).
*
* @param {Object} params - The parameters to send to the service.
* @param {string} params.environment_id - The ID of the environment.
* @param {string} params.collection_id - The ID of the collection.
* @param {string} [params.filter] - 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.
* @param {string} [params.query] - 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. You cannot use **natural_language_query** and **query** at the same time.
* @param {string} [params.natural_language_query] - A natural language query that returns relevant documents by
* utilizing training data and natural language understanding. You cannot use **natural_language_query** and **query**
* at the same time.
* @param {boolean} [params.passages] - A passages query that returns the most relevant passages from the results.
* @param {string} [params.aggregation] - 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.
* @param {number} [params.count] - Number of results to return.
* @param {string} [params.return_fields] - A comma-separated list of the portion of the document hierarchy to return.
* @param {number} [params.offset] - The number of query results to skip at the beginning. For example, if the total
* number of results that are returned is