Class: DiscoveryV1

DiscoveryV1

new DiscoveryV1(options)

Parameters:
Name Type Description
options Object
Source:

Members

(static) VERSION_DATE_2016_12_15 :string

Initial release

Type:
  • string
Source:

(static) VERSION_DATE_2017_04_27 :string

Release exposing the sort parameter on the /query endpoint

Type:
  • string
Source:

Methods

addDocument(params, callback) → {ReadableStream|undefined}

Add a document to a collection

Parameters:
Name Type Description
params
Properties
Name Type Attributes Description
environment_id String

environment guid for the collection

collection_id string

the guid of the collection to delete

file Buffer | ReadableStream | Object

a file to post (smaller than 50mb)

configuration_id string <optional>

config guid

metadata string <optional>

file metadata, including content-type (will infer if missing)

callback
Source:
Returns:
Type
ReadableStream | undefined

createCollection(params)

Create a new collection

Parameters:
Name Type Description
params Object
Properties
Name Type Description
environment_id String

environment guid for the collection

name string
description string
configuration_id string

configuration to create the collection in

language_code string

currently, only en_us is supported

Source:

createConfiguration()

Create a new configuration

Parameters:
Name Type Description
params.environment_id String

the ID of your environment

params.file Object

Input a JSON object that enables you to customize how your content is ingested and what enrichments are added to your data.

Source:

createEnvironment(name, description, size)

Create a new environment

Parameters:
Name Type Description
name string
description string
size int

(optional)

Source:

deleteCollection(params)

Delete a collection

Parameters:
Name Type Description
params Object
Properties
Name Type Description
environment_id String

environment guid for the collection

collection_id string

the guid of the collection to delete

Source:

deleteDocument(params, callback) → {ReadableStream|undefined}

Delete a specific document

Parameters:
Name Type Description
params
Properties
Name Type Description
environment_id String

environment guid for the collection

collection_id string

the guid of the collection to delete

document_id string

the guid of the document to delete

callback
Source:
Returns:
Type
ReadableStream | undefined

deleteEnvironment(params)

Get details about an environment

Parameters:
Name Type Description
params Object
Properties
Name Type Description
environment_id String
Source:

getCollection(params)

Get details about a collection

Parameters:
Name Type Description
params Object
Properties
Name Type Description
environment_id String
collection_id string
Source:

getCollections(params)

Return the list of collections in the given environment

Parameters:
Name Type Description
params Object
Properties
Name Type Description
environment_id String
Source:

getConfiguration(params)

Get details about a configuration

Parameters:
Name Type Description
params Object
Properties
Name Type Description
environment_id String
configuration_id String
Source:

getConfigurations(params)

List all configurations

Parameters:
Name Type Description
params Object
Properties
Name Type Description
environment_id String
Source:

getEnvironment(params)

Get details about an environment

Parameters:
Name Type Description
params Object
Properties
Name Type Description
environment_id String
Source:

getEnvironments(params)

Return the list of environments

Parameters:
Name Type Description
params Object
Source:

query(params)

Queries the collection

Parameters:
Name Type Description
params Object
Properties
Name Type Attributes Default Description
environment_id String
collection_id string
query String <optional>

A query search returns all possible results, even when it's not very relevant, with the most relevant documents listed first. Use a query search when you want to find the most relevant search results. Results are scored between 0 and 1, with 1 being an exact match and 0 being not a match at all.

natural_language_query String <optional>

BETA - A natural language query that returns relevant documents by using training data and natural language understanding. You cannot use this parameter and the query parameter in the same query.

filter String <optional>

A cacheable query that allows you to limit the information returned to exclude anything that isn't related to what you are searching. Filter searches are better for metadata type searches and when you are trying to get a sense of concepts in the dataset.

aggregation String <optional>

An aggregation search uses combinations of filters and query search to return an exact answer. Aggregations are useful for building applications, because you can use them to build lists, tables, and time series. For a full list of possible aggregrations, see the Query reference.

count Number <optional>
10

Number of documents to return

offset Number <optional>
0

For pagination purposes. Returns additional pages of results. Deep pagination is highly unperformant, and should be avoided.

return String <optional>

A comma separated list of the portion of the document hierarchy to return.

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.

passages Boolean <optional>
false

BETA - A boolean that specifies whether the service returns a set of the most relevant passages from the documents returned by a query. The passages parameter works only on private collections. It does not work in the Watson Discovery News collection.

Source:

updateConfiguration()

Update an existing configuration for a given environment

Parameters:
Name Type Description
params.environment_id String

the ID of your environment

params.configuration_id String

the ID of your configuration

params.file Object

Input a JSON object that enables you to update and customize how your data is ingested and what enrichments are added to your data.

Source:

updateDocument(params, callback) → {ReadableStream|undefined}

Update or partially update a document to create or replace an existing document

Parameters:
Name Type Description
params
Properties
Name Type Attributes Description
environment_id String

environment guid for the collection

collection_id string

the guid of the collection

document_id string

the guid of the document to update

file Buffer | ReadableStream | Object

a file to post (smaller than 50mb)

configuration_id string <optional>

config guid

metadata string <optional>

file metadata, including content-type (will infer if missing)

callback
Source:
Returns:
Type
ReadableStream | undefined

updateEnvironment(environment_id(required), name(required), description(optional))

Update an existing environment

Parameters:
Name Type Description
environment_id(required) string
name(required) string
description(optional) string
Source: