Class: IBMWatson::DiscoveryV1
- Inherits:
-
IBMCloudSdkCore::BaseService
- Object
- IBMCloudSdkCore::BaseService
- IBMWatson::DiscoveryV1
- Includes:
- Concurrent::Async
- Defined in:
- lib/ibm_watson/discovery_v1.rb
Overview
The Discovery V1 service.
Constant Summary collapse
- DEFAULT_SERVICE_NAME =
"discovery"- DEFAULT_SERVICE_URL =
"https://api.us-south.discovery.watson.cloud.ibm.com"
Instance Attribute Summary collapse
-
#version ⇒ Object
Returns the value of attribute version.
Instance Method Summary collapse
-
#add_document(environment_id: , collection_id: , file: nil, filename: nil, file_content_type: nil, metadata: nil) ⇒ IBMCloudSdkCore::DetailedResponse
Add a document.
-
#add_training_data(environment_id: , collection_id: , natural_language_query: nil, filter: nil, examples: nil) ⇒ IBMCloudSdkCore::DetailedResponse
Add query to training data.
-
#create_collection(environment_id: , name: , description: nil, configuration_id: nil, language: nil) ⇒ IBMCloudSdkCore::DetailedResponse
Create a collection.
-
#create_configuration(environment_id: , name: , description: nil, conversions: nil, enrichments: nil, normalizations: nil, source: nil) ⇒ IBMCloudSdkCore::DetailedResponse
Add configuration.
-
#create_credentials(environment_id: , source_type: nil, credential_details: nil, status: nil) ⇒ IBMCloudSdkCore::DetailedResponse
Create credentials.
-
#create_environment(name: , description: nil, size: nil) ⇒ IBMCloudSdkCore::DetailedResponse
Create an environment.
-
#create_event(type: , data: ) ⇒ IBMCloudSdkCore::DetailedResponse
Create event.
-
#create_expansions(environment_id: , collection_id: , expansions: ) ⇒ IBMCloudSdkCore::DetailedResponse
Create or update expansion list.
-
#create_gateway(environment_id: , name: nil) ⇒ IBMCloudSdkCore::DetailedResponse
Create Gateway.
-
#create_stopword_list(environment_id: , collection_id: , stopword_file: , stopword_filename: nil) ⇒ IBMCloudSdkCore::DetailedResponse
Create stopword list.
-
#create_tokenization_dictionary(environment_id: , collection_id: , tokenization_rules: nil) ⇒ IBMCloudSdkCore::DetailedResponse
Create tokenization dictionary.
-
#create_training_example(environment_id: , collection_id: , query_id: , document_id: nil, cross_reference: nil, relevance: nil) ⇒ IBMCloudSdkCore::DetailedResponse
Add example to training data query.
-
#delete_all_training_data(environment_id: , collection_id: ) ⇒ nil
Delete all training data.
-
#delete_collection(environment_id: , collection_id: ) ⇒ IBMCloudSdkCore::DetailedResponse
Delete a collection.
-
#delete_configuration(environment_id: , configuration_id: ) ⇒ IBMCloudSdkCore::DetailedResponse
Delete a configuration.
-
#delete_credentials(environment_id: , credential_id: ) ⇒ IBMCloudSdkCore::DetailedResponse
Delete credentials.
-
#delete_document(environment_id: , collection_id: , document_id: ) ⇒ IBMCloudSdkCore::DetailedResponse
Delete a document.
-
#delete_environment(environment_id: ) ⇒ IBMCloudSdkCore::DetailedResponse
Delete environment.
-
#delete_expansions(environment_id: , collection_id: ) ⇒ nil
Delete the expansion list.
-
#delete_gateway(environment_id: , gateway_id: ) ⇒ IBMCloudSdkCore::DetailedResponse
Delete Gateway.
-
#delete_stopword_list(environment_id: , collection_id: ) ⇒ nil
Delete a custom stopword list.
-
#delete_tokenization_dictionary(environment_id: , collection_id: ) ⇒ nil
Delete tokenization dictionary.
-
#delete_training_data(environment_id: , collection_id: , query_id: ) ⇒ nil
Delete a training data query.
-
#delete_training_example(environment_id: , collection_id: , query_id: , example_id: ) ⇒ nil
Delete example for training data query.
-
#delete_user_data(customer_id: ) ⇒ nil
Delete labeled data.
-
#federated_query(environment_id: , collection_ids: , filter: nil, query: nil, natural_language_query: nil, passages: nil, aggregation: nil, count: nil, _return: nil, offset: nil, sort: nil, highlight: nil, passages_fields: nil, passages_count: nil, passages_characters: nil, deduplicate: nil, deduplicate_field: nil, similar: nil, similar_document_ids: nil, similar_fields: nil, bias: nil, x_watson_logging_opt_out: nil) ⇒ IBMCloudSdkCore::DetailedResponse
Query multiple collections.
-
#federated_query_notices(environment_id: , collection_ids: , filter: nil, query: nil, natural_language_query: nil, aggregation: nil, count: nil, _return: nil, offset: nil, sort: nil, highlight: nil, deduplicate_field: nil, similar: nil, similar_document_ids: nil, similar_fields: nil) ⇒ IBMCloudSdkCore::DetailedResponse
Query multiple collection system notices.
-
#get_autocompletion(environment_id: , collection_id: , prefix: , field: nil, count: nil) ⇒ IBMCloudSdkCore::DetailedResponse
Get Autocomplete Suggestions.
-
#get_collection(environment_id: , collection_id: ) ⇒ IBMCloudSdkCore::DetailedResponse
Get collection details.
-
#get_configuration(environment_id: , configuration_id: ) ⇒ IBMCloudSdkCore::DetailedResponse
Get configuration details.
-
#get_credentials(environment_id: , credential_id: ) ⇒ IBMCloudSdkCore::DetailedResponse
View Credentials.
-
#get_document_status(environment_id: , collection_id: , document_id: ) ⇒ IBMCloudSdkCore::DetailedResponse
Get document details.
-
#get_environment(environment_id: ) ⇒ IBMCloudSdkCore::DetailedResponse
Get environment info.
-
#get_gateway(environment_id: , gateway_id: ) ⇒ IBMCloudSdkCore::DetailedResponse
List Gateway Details.
-
#get_metrics_event_rate(start_time: nil, end_time: nil, result_type: nil) ⇒ IBMCloudSdkCore::DetailedResponse
Percentage of queries with an associated event.
-
#get_metrics_query(start_time: nil, end_time: nil, result_type: nil) ⇒ IBMCloudSdkCore::DetailedResponse
Number of queries over time.
-
#get_metrics_query_event(start_time: nil, end_time: nil, result_type: nil) ⇒ IBMCloudSdkCore::DetailedResponse
Number of queries with an event over time.
-
#get_metrics_query_no_results(start_time: nil, end_time: nil, result_type: nil) ⇒ IBMCloudSdkCore::DetailedResponse
Number of queries with no search results over time.
-
#get_metrics_query_token_event(count: nil) ⇒ IBMCloudSdkCore::DetailedResponse
Most frequent query tokens with an event.
-
#get_stopword_list_status(environment_id: , collection_id: ) ⇒ IBMCloudSdkCore::DetailedResponse
Get stopword list status.
-
#get_tokenization_dictionary_status(environment_id: , collection_id: ) ⇒ IBMCloudSdkCore::DetailedResponse
Get tokenization dictionary status.
-
#get_training_data(environment_id: , collection_id: , query_id: ) ⇒ IBMCloudSdkCore::DetailedResponse
Get details about a query.
-
#get_training_example(environment_id: , collection_id: , query_id: , example_id: ) ⇒ IBMCloudSdkCore::DetailedResponse
Get details for training data example.
-
#initialize(args) ⇒ DiscoveryV1
constructor
Construct a new client for the Discovery service.
-
#list_collection_fields(environment_id: , collection_id: ) ⇒ IBMCloudSdkCore::DetailedResponse
List collection fields.
-
#list_collections(environment_id: , name: nil) ⇒ IBMCloudSdkCore::DetailedResponse
List collections.
-
#list_configurations(environment_id: , name: nil) ⇒ IBMCloudSdkCore::DetailedResponse
List configurations.
-
#list_credentials(environment_id: ) ⇒ IBMCloudSdkCore::DetailedResponse
List credentials.
-
#list_environments(name: nil) ⇒ IBMCloudSdkCore::DetailedResponse
List environments.
-
#list_expansions(environment_id: , collection_id: ) ⇒ IBMCloudSdkCore::DetailedResponse
Get the expansion list.
-
#list_fields(environment_id: , collection_ids: ) ⇒ IBMCloudSdkCore::DetailedResponse
List fields across collections.
-
#list_gateways(environment_id: ) ⇒ IBMCloudSdkCore::DetailedResponse
List Gateways.
-
#list_training_data(environment_id: , collection_id: ) ⇒ IBMCloudSdkCore::DetailedResponse
List training data.
-
#list_training_examples(environment_id: , collection_id: , query_id: ) ⇒ IBMCloudSdkCore::DetailedResponse
List examples for a training data query.
-
#query(environment_id: , collection_id: , filter: nil, query: nil, natural_language_query: nil, passages: nil, aggregation: nil, count: nil, _return: nil, offset: nil, sort: nil, highlight: nil, passages_fields: nil, passages_count: nil, passages_characters: nil, deduplicate: nil, deduplicate_field: nil, similar: nil, similar_document_ids: nil, similar_fields: nil, bias: nil, spelling_suggestions: nil, x_watson_logging_opt_out: nil) ⇒ IBMCloudSdkCore::DetailedResponse
Query a collection.
-
#query_log(filter: nil, query: nil, count: nil, offset: nil, sort: nil) ⇒ IBMCloudSdkCore::DetailedResponse
Search the query and event log.
-
#query_notices(environment_id: , collection_id: , filter: nil, query: nil, natural_language_query: nil, passages: nil, aggregation: nil, count: nil, _return: nil, offset: nil, sort: nil, highlight: nil, passages_fields: nil, passages_count: nil, passages_characters: nil, deduplicate_field: nil, similar: nil, similar_document_ids: nil, similar_fields: nil) ⇒ IBMCloudSdkCore::DetailedResponse
Query system notices.
-
#update_collection(environment_id: , collection_id: , name: , description: nil, configuration_id: nil) ⇒ IBMCloudSdkCore::DetailedResponse
Update a collection.
-
#update_configuration(environment_id: , configuration_id: , name: , description: nil, conversions: nil, enrichments: nil, normalizations: nil, source: nil) ⇒ IBMCloudSdkCore::DetailedResponse
Update a configuration.
-
#update_credentials(environment_id: , credential_id: , source_type: nil, credential_details: nil, status: nil) ⇒ IBMCloudSdkCore::DetailedResponse
Update credentials.
-
#update_document(environment_id: , collection_id: , document_id: , file: nil, filename: nil, file_content_type: nil, metadata: nil) ⇒ IBMCloudSdkCore::DetailedResponse
Update a document.
-
#update_environment(environment_id: , name: nil, description: nil, size: nil) ⇒ IBMCloudSdkCore::DetailedResponse
Update an environment.
-
#update_training_example(environment_id: , collection_id: , query_id: , example_id: , cross_reference: nil, relevance: nil) ⇒ IBMCloudSdkCore::DetailedResponse
Change label or cross reference for example.
Constructor Details
#initialize(args) ⇒ DiscoveryV1
Construct a new client for the Discovery service.
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 |
# File 'lib/ibm_watson/discovery_v1.rb', line 51 def initialize(args = {}) @__async_initialized__ = false defaults = {} defaults[:service_url] = DEFAULT_SERVICE_URL defaults[:service_name] = DEFAULT_SERVICE_NAME defaults[:authenticator] = nil defaults[:version] = nil user_service_url = args[:service_url] unless args[:service_url].nil? args = defaults.merge(args) @version = args[:version] raise ArgumentError.new("version must be provided") if @version.nil? args[:authenticator] = IBMCloudSdkCore::ConfigBasedAuthenticatorFactory.new.get_authenticator(service_name: args[:service_name]) if args[:authenticator].nil? super @service_url = user_service_url unless user_service_url.nil? end |
Instance Attribute Details
#version ⇒ Object
Returns the value of attribute version.
38 39 40 |
# File 'lib/ibm_watson/discovery_v1.rb', line 38 def version @version end |
Instance Method Details
#add_document(environment_id: , collection_id: , file: nil, filename: nil, file_content_type: nil, metadata: nil) ⇒ IBMCloudSdkCore::DetailedResponse
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.
1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 |
# File 'lib/ibm_watson/discovery_v1.rb', line 1178 def add_document(environment_id:, collection_id:, file: nil, filename: nil, file_content_type: nil, metadata: nil) raise ArgumentError.new("version must be provided") if version.nil? raise ArgumentError.new("environment_id must be provided") if environment_id.nil? raise ArgumentError.new("collection_id must be provided") if collection_id.nil? headers = { } sdk_headers = Common.new.get_sdk_headers("discovery", "V1", "add_document") headers.merge!(sdk_headers) params = { "version" => @version } form_data = {} unless file.nil? unless file.instance_of?(StringIO) || file.instance_of?(File) file = file.respond_to?(:to_json) ? StringIO.new(file.to_json) : StringIO.new(file) end filename = file.path if filename.nil? && file.respond_to?(:path) form_data[:file] = HTTP::FormData::File.new(file, content_type: file_content_type.nil? ? "application/octet-stream" : file_content_type, filename: filename) end form_data[:metadata] = HTTP::FormData::Part.new(.to_s, content_type: "text/plain") unless .nil? method_url = "/v1/environments/%s/collections/%s/documents" % [ERB::Util.url_encode(environment_id), ERB::Util.url_encode(collection_id)] response = request( method: "POST", url: method_url, headers: headers, params: params, form: form_data, accept_json: true ) response end |
#add_training_data(environment_id: , collection_id: , natural_language_query: nil, filter: nil, examples: nil) ⇒ IBMCloudSdkCore::DetailedResponse
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.
1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 |
# File 'lib/ibm_watson/discovery_v1.rb', line 1899 def add_training_data(environment_id:, collection_id:, natural_language_query: nil, filter: nil, examples: nil) raise ArgumentError.new("version must be provided") if version.nil? raise ArgumentError.new("environment_id must be provided") if environment_id.nil? raise ArgumentError.new("collection_id must be provided") if collection_id.nil? headers = { } sdk_headers = Common.new.get_sdk_headers("discovery", "V1", "add_training_data") headers.merge!(sdk_headers) params = { "version" => @version } data = { "natural_language_query" => natural_language_query, "filter" => filter, "examples" => examples } method_url = "/v1/environments/%s/collections/%s/training_data" % [ERB::Util.url_encode(environment_id), ERB::Util.url_encode(collection_id)] response = request( method: "POST", url: method_url, headers: headers, params: params, json: data, accept_json: true ) response end |
#create_collection(environment_id: , name: , description: nil, configuration_id: nil, language: nil) ⇒ IBMCloudSdkCore::DetailedResponse
Create a collection.
543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 |
# File 'lib/ibm_watson/discovery_v1.rb', line 543 def create_collection(environment_id:, name:, description: nil, configuration_id: nil, language: nil) raise ArgumentError.new("version must be provided") if version.nil? raise ArgumentError.new("environment_id must be provided") if environment_id.nil? raise ArgumentError.new("name must be provided") if name.nil? headers = { } sdk_headers = Common.new.get_sdk_headers("discovery", "V1", "create_collection") headers.merge!(sdk_headers) params = { "version" => @version } data = { "name" => name, "description" => description, "configuration_id" => configuration_id, "language" => language } method_url = "/v1/environments/%s/collections" % [ERB::Util.url_encode(environment_id)] response = request( method: "POST", url: method_url, headers: headers, params: params, json: data, accept_json: true ) response end |
#create_configuration(environment_id: , name: , description: nil, conversions: nil, enrichments: nil, normalizations: nil, source: nil) ⇒ IBMCloudSdkCore::DetailedResponse
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.
321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 |
# File 'lib/ibm_watson/discovery_v1.rb', line 321 def create_configuration(environment_id:, name:, description: nil, conversions: nil, enrichments: nil, normalizations: nil, source: nil) raise ArgumentError.new("version must be provided") if version.nil? raise ArgumentError.new("environment_id must be provided") if environment_id.nil? raise ArgumentError.new("name must be provided") if name.nil? headers = { } sdk_headers = Common.new.get_sdk_headers("discovery", "V1", "create_configuration") headers.merge!(sdk_headers) params = { "version" => @version } data = { "name" => name, "description" => description, "conversions" => conversions, "enrichments" => enrichments, "normalizations" => normalizations, "source" => source } method_url = "/v1/environments/%s/configurations" % [ERB::Util.url_encode(environment_id)] response = request( method: "POST", url: method_url, headers: headers, params: params, json: data, accept_json: true ) response end |
#create_credentials(environment_id: , source_type: nil, credential_details: nil, status: nil) ⇒ IBMCloudSdkCore::DetailedResponse
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.
2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 |
# File 'lib/ibm_watson/discovery_v1.rb', line 2653 def create_credentials(environment_id:, source_type: nil, credential_details: nil, status: nil) raise ArgumentError.new("version must be provided") if version.nil? raise ArgumentError.new("environment_id must be provided") if environment_id.nil? headers = { } sdk_headers = Common.new.get_sdk_headers("discovery", "V1", "create_credentials") headers.merge!(sdk_headers) params = { "version" => @version } data = { "source_type" => source_type, "credential_details" => credential_details, "status" => status } method_url = "/v1/environments/%s/credentials" % [ERB::Util.url_encode(environment_id)] response = request( method: "POST", url: method_url, headers: headers, params: params, json: data, accept_json: true ) response end |
#create_environment(name: , description: nil, size: nil) ⇒ IBMCloudSdkCore::DetailedResponse
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.
85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 |
# File 'lib/ibm_watson/discovery_v1.rb', line 85 def create_environment(name:, description: nil, size: nil) raise ArgumentError.new("version must be provided") if version.nil? raise ArgumentError.new("name must be provided") if name.nil? headers = { } sdk_headers = Common.new.get_sdk_headers("discovery", "V1", "create_environment") headers.merge!(sdk_headers) params = { "version" => @version } data = { "name" => name, "description" => description, "size" => size } method_url = "/v1/environments" response = request( method: "POST", url: method_url, headers: headers, params: params, json: data, accept_json: true ) response end |
#create_event(type: , data: ) ⇒ IBMCloudSdkCore::DetailedResponse
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.
2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 |
# File 'lib/ibm_watson/discovery_v1.rb', line 2318 def create_event(type:, data:) raise ArgumentError.new("version must be provided") if version.nil? raise ArgumentError.new("type must be provided") if type.nil? raise ArgumentError.new("data must be provided") if data.nil? headers = { } sdk_headers = Common.new.get_sdk_headers("discovery", "V1", "create_event") headers.merge!(sdk_headers) params = { "version" => @version } data = { "type" => type, "data" => data } method_url = "/v1/events" response = request( method: "POST", url: method_url, headers: headers, params: params, json: data, accept_json: true ) response end |
#create_expansions(environment_id: , collection_id: , expansions: ) ⇒ IBMCloudSdkCore::DetailedResponse
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.
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.
826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 |
# File 'lib/ibm_watson/discovery_v1.rb', line 826 def create_expansions(environment_id:, collection_id:, expansions:) raise ArgumentError.new("version must be provided") if version.nil? raise ArgumentError.new("environment_id must be provided") if environment_id.nil? raise ArgumentError.new("collection_id must be provided") if collection_id.nil? raise ArgumentError.new("expansions must be provided") if expansions.nil? headers = { } sdk_headers = Common.new.get_sdk_headers("discovery", "V1", "create_expansions") headers.merge!(sdk_headers) params = { "version" => @version } data = { "expansions" => expansions } method_url = "/v1/environments/%s/collections/%s/expansions" % [ERB::Util.url_encode(environment_id), ERB::Util.url_encode(collection_id)] response = request( method: "POST", url: method_url, headers: headers, params: params, json: data, accept_json: true ) response end |
#create_gateway(environment_id: , name: nil) ⇒ IBMCloudSdkCore::DetailedResponse
Create Gateway. Create a gateway configuration to use with a remotely installed gateway.
2859 2860 2861 2862 2863 2864 2865 2866 2867 2868 2869 2870 2871 2872 2873 2874 2875 2876 2877 2878 2879 2880 2881 2882 2883 2884 2885 2886 2887 2888 |
# File 'lib/ibm_watson/discovery_v1.rb', line 2859 def create_gateway(environment_id:, name: nil) raise ArgumentError.new("version must be provided") if version.nil? raise ArgumentError.new("environment_id must be provided") if environment_id.nil? headers = { } sdk_headers = Common.new.get_sdk_headers("discovery", "V1", "create_gateway") headers.merge!(sdk_headers) params = { "version" => @version } data = { "name" => name } method_url = "/v1/environments/%s/gateways" % [ERB::Util.url_encode(environment_id)] response = request( method: "POST", url: method_url, headers: headers, params: params, json: data, accept_json: true ) response end |
#create_stopword_list(environment_id: , collection_id: , stopword_file: , stopword_filename: nil) ⇒ IBMCloudSdkCore::DetailedResponse
Create stopword list. Upload a custom stopword list to use with the specified collection.
1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 |
# File 'lib/ibm_watson/discovery_v1.rb', line 1055 def create_stopword_list(environment_id:, collection_id:, stopword_file:, stopword_filename: nil) raise ArgumentError.new("version must be provided") if version.nil? raise ArgumentError.new("environment_id must be provided") if environment_id.nil? raise ArgumentError.new("collection_id must be provided") if collection_id.nil? raise ArgumentError.new("stopword_file must be provided") if stopword_file.nil? headers = { } sdk_headers = Common.new.get_sdk_headers("discovery", "V1", "create_stopword_list") headers.merge!(sdk_headers) params = { "version" => @version } form_data = {} unless stopword_file.instance_of?(StringIO) || stopword_file.instance_of?(File) stopword_file = stopword_file.respond_to?(:to_json) ? StringIO.new(stopword_file.to_json) : StringIO.new(stopword_file) end stopword_filename = stopword_file.path if stopword_filename.nil? && stopword_file.respond_to?(:path) form_data[:stopword_file] = HTTP::FormData::File.new(stopword_file, content_type: "application/octet-stream", filename: stopword_filename) method_url = "/v1/environments/%s/collections/%s/word_lists/stopwords" % [ERB::Util.url_encode(environment_id), ERB::Util.url_encode(collection_id)] response = request( method: "POST", url: method_url, headers: headers, params: params, form: form_data, accept_json: true ) response end |
#create_tokenization_dictionary(environment_id: , collection_id: , tokenization_rules: nil) ⇒ IBMCloudSdkCore::DetailedResponse
Create tokenization dictionary. Upload a custom tokenization dictionary to use with the specified collection.
943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 |
# File 'lib/ibm_watson/discovery_v1.rb', line 943 def create_tokenization_dictionary(environment_id:, collection_id:, tokenization_rules: nil) raise ArgumentError.new("version must be provided") if version.nil? raise ArgumentError.new("environment_id must be provided") if environment_id.nil? raise ArgumentError.new("collection_id must be provided") if collection_id.nil? headers = { } sdk_headers = Common.new.get_sdk_headers("discovery", "V1", "create_tokenization_dictionary") headers.merge!(sdk_headers) params = { "version" => @version } data = { "tokenization_rules" => tokenization_rules } method_url = "/v1/environments/%s/collections/%s/word_lists/tokenization_dictionary" % [ERB::Util.url_encode(environment_id), ERB::Util.url_encode(collection_id)] response = request( method: "POST", url: method_url, headers: headers, params: params, json: data, accept_json: true ) response end |
#create_training_example(environment_id: , collection_id: , query_id: , document_id: nil, cross_reference: nil, relevance: nil) ⇒ IBMCloudSdkCore::DetailedResponse
Add example to training data query. Adds a example to this training data query.
2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 |
# File 'lib/ibm_watson/discovery_v1.rb', line 2096 def create_training_example(environment_id:, collection_id:, query_id:, document_id: nil, cross_reference: nil, relevance: nil) raise ArgumentError.new("version must be provided") if version.nil? raise ArgumentError.new("environment_id must be provided") if environment_id.nil? raise ArgumentError.new("collection_id must be provided") if collection_id.nil? raise ArgumentError.new("query_id must be provided") if query_id.nil? headers = { } sdk_headers = Common.new.get_sdk_headers("discovery", "V1", "create_training_example") headers.merge!(sdk_headers) params = { "version" => @version } data = { "document_id" => document_id, "cross_reference" => cross_reference, "relevance" => relevance } method_url = "/v1/environments/%s/collections/%s/training_data/%s/examples" % [ERB::Util.url_encode(environment_id), ERB::Util.url_encode(collection_id), ERB::Util.url_encode(query_id)] response = request( method: "POST", url: method_url, headers: headers, params: params, json: data, accept_json: true ) response end |
#delete_all_training_data(environment_id: , collection_id: ) ⇒ nil
Delete all training data. Deletes all training data from a collection.
1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 |
# File 'lib/ibm_watson/discovery_v1.rb', line 1941 def delete_all_training_data(environment_id:, collection_id:) raise ArgumentError.new("version must be provided") if version.nil? raise ArgumentError.new("environment_id must be provided") if environment_id.nil? raise ArgumentError.new("collection_id must be provided") if collection_id.nil? headers = { } sdk_headers = Common.new.get_sdk_headers("discovery", "V1", "delete_all_training_data") headers.merge!(sdk_headers) params = { "version" => @version } method_url = "/v1/environments/%s/collections/%s/training_data" % [ERB::Util.url_encode(environment_id), ERB::Util.url_encode(collection_id)] request( method: "DELETE", url: method_url, headers: headers, params: params, accept_json: false ) nil end |
#delete_collection(environment_id: , collection_id: ) ⇒ IBMCloudSdkCore::DetailedResponse
Delete a collection.
699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 |
# File 'lib/ibm_watson/discovery_v1.rb', line 699 def delete_collection(environment_id:, collection_id:) raise ArgumentError.new("version must be provided") if version.nil? raise ArgumentError.new("environment_id must be provided") if environment_id.nil? raise ArgumentError.new("collection_id must be provided") if collection_id.nil? headers = { } sdk_headers = Common.new.get_sdk_headers("discovery", "V1", "delete_collection") headers.merge!(sdk_headers) params = { "version" => @version } method_url = "/v1/environments/%s/collections/%s" % [ERB::Util.url_encode(environment_id), ERB::Util.url_encode(collection_id)] response = request( method: "DELETE", url: method_url, headers: headers, params: params, accept_json: true ) response end |
#delete_configuration(environment_id: , configuration_id: ) ⇒ IBMCloudSdkCore::DetailedResponse
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.
502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 |
# File 'lib/ibm_watson/discovery_v1.rb', line 502 def delete_configuration(environment_id:, configuration_id:) raise ArgumentError.new("version must be provided") if version.nil? raise ArgumentError.new("environment_id must be provided") if environment_id.nil? raise ArgumentError.new("configuration_id must be provided") if configuration_id.nil? headers = { } sdk_headers = Common.new.get_sdk_headers("discovery", "V1", "delete_configuration") headers.merge!(sdk_headers) params = { "version" => @version } method_url = "/v1/environments/%s/configurations/%s" % [ERB::Util.url_encode(environment_id), ERB::Util.url_encode(configuration_id)] response = request( method: "DELETE", url: method_url, headers: headers, params: params, accept_json: true ) response end |
#delete_credentials(environment_id: , credential_id: ) ⇒ IBMCloudSdkCore::DetailedResponse
Delete credentials. Deletes a set of stored credentials from your Discovery instance.
2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 2802 2803 2804 2805 2806 2807 2808 2809 2810 2811 2812 2813 2814 2815 |
# File 'lib/ibm_watson/discovery_v1.rb', line 2789 def delete_credentials(environment_id:, credential_id:) raise ArgumentError.new("version must be provided") if version.nil? raise ArgumentError.new("environment_id must be provided") if environment_id.nil? raise ArgumentError.new("credential_id must be provided") if credential_id.nil? headers = { } sdk_headers = Common.new.get_sdk_headers("discovery", "V1", "delete_credentials") headers.merge!(sdk_headers) params = { "version" => @version } method_url = "/v1/environments/%s/credentials/%s" % [ERB::Util.url_encode(environment_id), ERB::Util.url_encode(credential_id)] response = request( method: "DELETE", url: method_url, headers: headers, params: params, accept_json: true ) response end |
#delete_document(environment_id: , collection_id: , document_id: ) ⇒ IBMCloudSdkCore::DetailedResponse
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'.
1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 |
# File 'lib/ibm_watson/discovery_v1.rb', line 1336 def delete_document(environment_id:, collection_id:, document_id:) raise ArgumentError.new("version must be provided") if version.nil? raise ArgumentError.new("environment_id must be provided") if environment_id.nil? raise ArgumentError.new("collection_id must be provided") if collection_id.nil? raise ArgumentError.new("document_id must be provided") if document_id.nil? headers = { } sdk_headers = Common.new.get_sdk_headers("discovery", "V1", "delete_document") headers.merge!(sdk_headers) params = { "version" => @version } method_url = "/v1/environments/%s/collections/%s/documents/%s" % [ERB::Util.url_encode(environment_id), ERB::Util.url_encode(collection_id), ERB::Util.url_encode(document_id)] response = request( method: "DELETE", url: method_url, headers: headers, params: params, accept_json: true ) response end |
#delete_environment(environment_id: ) ⇒ IBMCloudSdkCore::DetailedResponse
Delete environment.
229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 |
# File 'lib/ibm_watson/discovery_v1.rb', line 229 def delete_environment(environment_id:) raise ArgumentError.new("version must be provided") if version.nil? raise ArgumentError.new("environment_id must be provided") if environment_id.nil? headers = { } sdk_headers = Common.new.get_sdk_headers("discovery", "V1", "delete_environment") headers.merge!(sdk_headers) params = { "version" => @version } method_url = "/v1/environments/%s" % [ERB::Util.url_encode(environment_id)] response = request( method: "DELETE", url: method_url, headers: headers, params: params, accept_json: true ) response end |
#delete_expansions(environment_id: , collection_id: ) ⇒ nil
Delete the expansion list. Remove the expansion information for this collection. The expansion list must be
deleted to disable query expansion for a collection.
869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 |
# File 'lib/ibm_watson/discovery_v1.rb', line 869 def delete_expansions(environment_id:, collection_id:) raise ArgumentError.new("version must be provided") if version.nil? raise ArgumentError.new("environment_id must be provided") if environment_id.nil? raise ArgumentError.new("collection_id must be provided") if collection_id.nil? headers = { } sdk_headers = Common.new.get_sdk_headers("discovery", "V1", "delete_expansions") headers.merge!(sdk_headers) params = { "version" => @version } method_url = "/v1/environments/%s/collections/%s/expansions" % [ERB::Util.url_encode(environment_id), ERB::Util.url_encode(collection_id)] request( method: "DELETE", url: method_url, headers: headers, params: params, accept_json: false ) nil end |
#delete_gateway(environment_id: , gateway_id: ) ⇒ IBMCloudSdkCore::DetailedResponse
Delete Gateway. Delete the specified gateway configuration.
2932 2933 2934 2935 2936 2937 2938 2939 2940 2941 2942 2943 2944 2945 2946 2947 2948 2949 2950 2951 2952 2953 2954 2955 2956 2957 2958 |
# File 'lib/ibm_watson/discovery_v1.rb', line 2932 def delete_gateway(environment_id:, gateway_id:) raise ArgumentError.new("version must be provided") if version.nil? raise ArgumentError.new("environment_id must be provided") if environment_id.nil? raise ArgumentError.new("gateway_id must be provided") if gateway_id.nil? headers = { } sdk_headers = Common.new.get_sdk_headers("discovery", "V1", "delete_gateway") headers.merge!(sdk_headers) params = { "version" => @version } method_url = "/v1/environments/%s/gateways/%s" % [ERB::Util.url_encode(environment_id), ERB::Util.url_encode(gateway_id)] response = request( method: "DELETE", url: method_url, headers: headers, params: params, accept_json: true ) response end |
#delete_stopword_list(environment_id: , collection_id: ) ⇒ nil
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.
1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 |
# File 'lib/ibm_watson/discovery_v1.rb', line 1102 def delete_stopword_list(environment_id:, collection_id:) raise ArgumentError.new("version must be provided") if version.nil? raise ArgumentError.new("environment_id must be provided") if environment_id.nil? raise ArgumentError.new("collection_id must be provided") if collection_id.nil? headers = { } sdk_headers = Common.new.get_sdk_headers("discovery", "V1", "delete_stopword_list") headers.merge!(sdk_headers) params = { "version" => @version } method_url = "/v1/environments/%s/collections/%s/word_lists/stopwords" % [ERB::Util.url_encode(environment_id), ERB::Util.url_encode(collection_id)] request( method: "DELETE", url: method_url, headers: headers, params: params, accept_json: false ) nil end |
#delete_tokenization_dictionary(environment_id: , collection_id: ) ⇒ nil
Delete tokenization dictionary. Delete the tokenization dictionary from the collection.
983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 |
# File 'lib/ibm_watson/discovery_v1.rb', line 983 def delete_tokenization_dictionary(environment_id:, collection_id:) raise ArgumentError.new("version must be provided") if version.nil? raise ArgumentError.new("environment_id must be provided") if environment_id.nil? raise ArgumentError.new("collection_id must be provided") if collection_id.nil? headers = { } sdk_headers = Common.new.get_sdk_headers("discovery", "V1", "delete_tokenization_dictionary") headers.merge!(sdk_headers) params = { "version" => @version } method_url = "/v1/environments/%s/collections/%s/word_lists/tokenization_dictionary" % [ERB::Util.url_encode(environment_id), ERB::Util.url_encode(collection_id)] request( method: "DELETE", url: method_url, headers: headers, params: params, accept_json: false ) nil end |
#delete_training_data(environment_id: , collection_id: , query_id: ) ⇒ nil
Delete a training data query. Removes the training data query and all associated examples from the training data
set.
2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 |
# File 'lib/ibm_watson/discovery_v1.rb', line 2017 def delete_training_data(environment_id:, collection_id:, query_id:) raise ArgumentError.new("version must be provided") if version.nil? raise ArgumentError.new("environment_id must be provided") if environment_id.nil? raise ArgumentError.new("collection_id must be provided") if collection_id.nil? raise ArgumentError.new("query_id must be provided") if query_id.nil? headers = { } sdk_headers = Common.new.get_sdk_headers("discovery", "V1", "delete_training_data") headers.merge!(sdk_headers) params = { "version" => @version } method_url = "/v1/environments/%s/collections/%s/training_data/%s" % [ERB::Util.url_encode(environment_id), ERB::Util.url_encode(collection_id), ERB::Util.url_encode(query_id)] request( method: "DELETE", url: method_url, headers: headers, params: params, accept_json: false ) nil end |
#delete_training_example(environment_id: , collection_id: , query_id: , example_id: ) ⇒ nil
Delete example for training data query. Deletes the example document with the given ID from the training data query.
2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 |
# File 'lib/ibm_watson/discovery_v1.rb', line 2142 def delete_training_example(environment_id:, collection_id:, query_id:, example_id:) raise ArgumentError.new("version must be provided") if version.nil? raise ArgumentError.new("environment_id must be provided") if environment_id.nil? raise ArgumentError.new("collection_id must be provided") if collection_id.nil? raise ArgumentError.new("query_id must be provided") if query_id.nil? raise ArgumentError.new("example_id must be provided") if example_id.nil? headers = { } sdk_headers = Common.new.get_sdk_headers("discovery", "V1", "delete_training_example") headers.merge!(sdk_headers) params = { "version" => @version } method_url = "/v1/environments/%s/collections/%s/training_data/%s/examples/%s" % [ERB::Util.url_encode(environment_id), ERB::Util.url_encode(collection_id), ERB::Util.url_encode(query_id), ERB::Util.url_encode(example_id)] request( method: "DELETE", url: method_url, headers: headers, params: params, accept_json: false ) nil end |
#delete_user_data(customer_id: ) ⇒ nil
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](https://cloud.ibm.com/docs/discovery?topic=discovery-information-security#information-security).
2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 |
# File 'lib/ibm_watson/discovery_v1.rb', line 2279 def delete_user_data(customer_id:) raise ArgumentError.new("version must be provided") if version.nil? raise ArgumentError.new("customer_id must be provided") if customer_id.nil? headers = { } sdk_headers = Common.new.get_sdk_headers("discovery", "V1", "delete_user_data") headers.merge!(sdk_headers) params = { "version" => @version, "customer_id" => customer_id } method_url = "/v1/user_data" request( method: "DELETE", url: method_url, headers: headers, params: params, accept_json: false ) nil end |
#federated_query(environment_id: , collection_ids: , filter: nil, query: nil, natural_language_query: nil, passages: nil, aggregation: nil, count: nil, _return: nil, offset: nil, sort: nil, highlight: nil, passages_fields: nil, passages_count: nil, passages_characters: nil, deduplicate: nil, deduplicate_field: nil, similar: nil, similar_document_ids: nil, similar_fields: nil, bias: nil, x_watson_logging_opt_out: nil) ⇒ IBMCloudSdkCore::DetailedResponse
Query multiple collections. By using this method, you can construct long queries that search multiple
collection. For details, see the [Discovery
documentation](https://cloud.ibm.com/docs/discovery?topic=discovery-query-concepts#query-concepts).
1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 |
# File 'lib/ibm_watson/discovery_v1.rb', line 1655 def federated_query(environment_id:, collection_ids:, filter: nil, query: nil, natural_language_query: nil, passages: nil, aggregation: nil, count: nil, _return: nil, offset: nil, sort: nil, highlight: nil, passages_fields: nil, passages_count: nil, passages_characters: nil, deduplicate: nil, deduplicate_field: nil, similar: nil, similar_document_ids: nil, similar_fields: nil, bias: nil, x_watson_logging_opt_out: nil) raise ArgumentError.new("version must be provided") if version.nil? raise ArgumentError.new("environment_id must be provided") if environment_id.nil? raise ArgumentError.new("collection_ids must be provided") if collection_ids.nil? headers = { "X-Watson-Logging-Opt-Out" => x_watson_logging_opt_out } sdk_headers = Common.new.get_sdk_headers("discovery", "V1", "federated_query") headers.merge!(sdk_headers) params = { "version" => @version } data = { "collection_ids" => collection_ids, "filter" => filter, "query" => query, "natural_language_query" => natural_language_query, "passages" => passages, "aggregation" => aggregation, "count" => count, "return" => _return, "offset" => offset, "sort" => sort, "highlight" => highlight, "passages.fields" => passages_fields, "passages.count" => passages_count, "passages.characters" => passages_characters, "deduplicate" => deduplicate, "deduplicate.field" => deduplicate_field, "similar" => similar, "similar.document_ids" => similar_document_ids, "similar.fields" => similar_fields, "bias" => bias } method_url = "/v1/environments/%s/query" % [ERB::Util.url_encode(environment_id)] response = request( method: "POST", url: method_url, headers: headers, params: params, json: data, accept_json: true ) response end |
#federated_query_notices(environment_id: , collection_ids: , filter: nil, query: nil, natural_language_query: nil, aggregation: nil, count: nil, _return: nil, offset: nil, sort: nil, highlight: nil, deduplicate_field: nil, similar: nil, similar_document_ids: nil, similar_fields: nil) ⇒ IBMCloudSdkCore::DetailedResponse
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](https://cloud.ibm.com/docs/discovery?topic=discovery-query-concepts#query-concepts)
for more details on the query language.
1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 |
# File 'lib/ibm_watson/discovery_v1.rb', line 1755 def federated_query_notices(environment_id:, collection_ids:, filter: nil, query: nil, natural_language_query: nil, aggregation: nil, count: nil, _return: nil, offset: nil, sort: nil, highlight: nil, deduplicate_field: nil, similar: nil, similar_document_ids: nil, similar_fields: nil) raise ArgumentError.new("version must be provided") if version.nil? raise ArgumentError.new("environment_id must be provided") if environment_id.nil? raise ArgumentError.new("collection_ids must be provided") if collection_ids.nil? headers = { } sdk_headers = Common.new.get_sdk_headers("discovery", "V1", "federated_query_notices") headers.merge!(sdk_headers) collection_ids *= "," unless collection_ids.nil? _return *= "," unless _return.nil? sort *= "," unless sort.nil? similar_document_ids *= "," unless similar_document_ids.nil? similar_fields *= "," unless similar_fields.nil? params = { "version" => @version, "collection_ids" => collection_ids, "filter" => filter, "query" => query, "natural_language_query" => natural_language_query, "aggregation" => aggregation, "count" => count, "return" => _return, "offset" => offset, "sort" => sort, "highlight" => highlight, "deduplicate.field" => deduplicate_field, "similar" => similar, "similar.document_ids" => similar_document_ids, "similar.fields" => similar_fields } method_url = "/v1/environments/%s/notices" % [ERB::Util.url_encode(environment_id)] response = request( method: "GET", url: method_url, headers: headers, params: params, accept_json: true ) response end |
#get_autocompletion(environment_id: , collection_id: , prefix: , field: nil, count: nil) ⇒ IBMCloudSdkCore::DetailedResponse
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.
1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 |
# File 'lib/ibm_watson/discovery_v1.rb', line 1816 def get_autocompletion(environment_id:, collection_id:, prefix:, field: nil, count: nil) raise ArgumentError.new("version must be provided") if version.nil? raise ArgumentError.new("environment_id must be provided") if environment_id.nil? raise ArgumentError.new("collection_id must be provided") if collection_id.nil? raise ArgumentError.new("prefix must be provided") if prefix.nil? headers = { } sdk_headers = Common.new.get_sdk_headers("discovery", "V1", "get_autocompletion") headers.merge!(sdk_headers) params = { "version" => @version, "prefix" => prefix, "field" => field, "count" => count } method_url = "/v1/environments/%s/collections/%s/autocompletion" % [ERB::Util.url_encode(environment_id), ERB::Util.url_encode(collection_id)] response = request( method: "GET", url: method_url, headers: headers, params: params, accept_json: true ) response end |
#get_collection(environment_id: , collection_id: ) ⇒ IBMCloudSdkCore::DetailedResponse
Get collection details.
619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 |
# File 'lib/ibm_watson/discovery_v1.rb', line 619 def get_collection(environment_id:, collection_id:) raise ArgumentError.new("version must be provided") if version.nil? raise ArgumentError.new("environment_id must be provided") if environment_id.nil? raise ArgumentError.new("collection_id must be provided") if collection_id.nil? headers = { } sdk_headers = Common.new.get_sdk_headers("discovery", "V1", "get_collection") headers.merge!(sdk_headers) params = { "version" => @version } method_url = "/v1/environments/%s/collections/%s" % [ERB::Util.url_encode(environment_id), ERB::Util.url_encode(collection_id)] response = request( method: "GET", url: method_url, headers: headers, params: params, accept_json: true ) response end |
#get_configuration(environment_id: , configuration_id: ) ⇒ IBMCloudSdkCore::DetailedResponse
Get configuration details.
399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 |
# File 'lib/ibm_watson/discovery_v1.rb', line 399 def get_configuration(environment_id:, configuration_id:) raise ArgumentError.new("version must be provided") if version.nil? raise ArgumentError.new("environment_id must be provided") if environment_id.nil? raise ArgumentError.new("configuration_id must be provided") if configuration_id.nil? headers = { } sdk_headers = Common.new.get_sdk_headers("discovery", "V1", "get_configuration") headers.merge!(sdk_headers) params = { "version" => @version } method_url = "/v1/environments/%s/configurations/%s" % [ERB::Util.url_encode(environment_id), ERB::Util.url_encode(configuration_id)] response = request( method: "GET", url: method_url, headers: headers, params: params, accept_json: true ) response end |
#get_credentials(environment_id: , credential_id: ) ⇒ IBMCloudSdkCore::DetailedResponse
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.
2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 |
# File 'lib/ibm_watson/discovery_v1.rb', line 2696 def get_credentials(environment_id:, credential_id:) raise ArgumentError.new("version must be provided") if version.nil? raise ArgumentError.new("environment_id must be provided") if environment_id.nil? raise ArgumentError.new("credential_id must be provided") if credential_id.nil? headers = { } sdk_headers = Common.new.get_sdk_headers("discovery", "V1", "get_credentials") headers.merge!(sdk_headers) params = { "version" => @version } method_url = "/v1/environments/%s/credentials/%s" % [ERB::Util.url_encode(environment_id), ERB::Util.url_encode(credential_id)] response = request( method: "GET", url: method_url, headers: headers, params: params, accept_json: true ) response end |
#get_document_status(environment_id: , collection_id: , document_id: ) ⇒ IBMCloudSdkCore::DetailedResponse
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.
1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 |
# File 'lib/ibm_watson/discovery_v1.rb', line 1230 def get_document_status(environment_id:, collection_id:, document_id:) raise ArgumentError.new("version must be provided") if version.nil? raise ArgumentError.new("environment_id must be provided") if environment_id.nil? raise ArgumentError.new("collection_id must be provided") if collection_id.nil? raise ArgumentError.new("document_id must be provided") if document_id.nil? headers = { } sdk_headers = Common.new.get_sdk_headers("discovery", "V1", "get_document_status") headers.merge!(sdk_headers) params = { "version" => @version } method_url = "/v1/environments/%s/collections/%s/documents/%s" % [ERB::Util.url_encode(environment_id), ERB::Util.url_encode(collection_id), ERB::Util.url_encode(document_id)] response = request( method: "GET", url: method_url, headers: headers, params: params, accept_json: true ) response end |
#get_environment(environment_id: ) ⇒ IBMCloudSdkCore::DetailedResponse
Get environment info.
154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 |
# File 'lib/ibm_watson/discovery_v1.rb', line 154 def get_environment(environment_id:) raise ArgumentError.new("version must be provided") if version.nil? raise ArgumentError.new("environment_id must be provided") if environment_id.nil? headers = { } sdk_headers = Common.new.get_sdk_headers("discovery", "V1", "get_environment") headers.merge!(sdk_headers) params = { "version" => @version } method_url = "/v1/environments/%s" % [ERB::Util.url_encode(environment_id)] response = request( method: "GET", url: method_url, headers: headers, params: params, accept_json: true ) response end |
#get_gateway(environment_id: , gateway_id: ) ⇒ IBMCloudSdkCore::DetailedResponse
List Gateway Details. List information about the specified gateway.
2897 2898 2899 2900 2901 2902 2903 2904 2905 2906 2907 2908 2909 2910 2911 2912 2913 2914 2915 2916 2917 2918 2919 2920 2921 2922 2923 |
# File 'lib/ibm_watson/discovery_v1.rb', line 2897 def get_gateway(environment_id:, gateway_id:) raise ArgumentError.new("version must be provided") if version.nil? raise ArgumentError.new("environment_id must be provided") if environment_id.nil? raise ArgumentError.new("gateway_id must be provided") if gateway_id.nil? headers = { } sdk_headers = Common.new.get_sdk_headers("discovery", "V1", "get_gateway") headers.merge!(sdk_headers) params = { "version" => @version } method_url = "/v1/environments/%s/gateways/%s" % [ERB::Util.url_encode(environment_id), ERB::Util.url_encode(gateway_id)] response = request( method: "GET", url: method_url, headers: headers, params: params, accept_json: true ) response end |
#get_metrics_event_rate(start_time: nil, end_time: nil, result_type: nil) ⇒ IBMCloudSdkCore::DetailedResponse
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.
2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 |
# File 'lib/ibm_watson/discovery_v1.rb', line 2530 def get_metrics_event_rate(start_time: nil, end_time: nil, result_type: nil) raise ArgumentError.new("version must be provided") if version.nil? headers = { } sdk_headers = Common.new.get_sdk_headers("discovery", "V1", "get_metrics_event_rate") headers.merge!(sdk_headers) params = { "version" => @version, "start_time" => start_time, "end_time" => end_time, "result_type" => result_type } method_url = "/v1/metrics/event_rate" response = request( method: "GET", url: method_url, headers: headers, params: params, accept_json: true ) response end |
#get_metrics_query(start_time: nil, end_time: nil, result_type: nil) ⇒ IBMCloudSdkCore::DetailedResponse
Number of queries over time. Total number of queries using the natural_language_query parameter over a
specific time window.
2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 |
# File 'lib/ibm_watson/discovery_v1.rb', line 2414 def get_metrics_query(start_time: nil, end_time: nil, result_type: nil) raise ArgumentError.new("version must be provided") if version.nil? headers = { } sdk_headers = Common.new.get_sdk_headers("discovery", "V1", "get_metrics_query") headers.merge!(sdk_headers) params = { "version" => @version, "start_time" => start_time, "end_time" => end_time, "result_type" => result_type } method_url = "/v1/metrics/number_of_queries" response = request( method: "GET", url: method_url, headers: headers, params: params, accept_json: true ) response end |
#get_metrics_query_event(start_time: nil, end_time: nil, result_type: nil) ⇒ IBMCloudSdkCore::DetailedResponse
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.
2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 |
# File 'lib/ibm_watson/discovery_v1.rb', line 2453 def get_metrics_query_event(start_time: nil, end_time: nil, result_type: nil) raise ArgumentError.new("version must be provided") if version.nil? headers = { } sdk_headers = Common.new.get_sdk_headers("discovery", "V1", "get_metrics_query_event") headers.merge!(sdk_headers) params = { "version" => @version, "start_time" => start_time, "end_time" => end_time, "result_type" => result_type } method_url = "/v1/metrics/number_of_queries_with_event" response = request( method: "GET", url: method_url, headers: headers, params: params, accept_json: true ) response end |
#get_metrics_query_no_results(start_time: nil, end_time: nil, result_type: nil) ⇒ IBMCloudSdkCore::DetailedResponse
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.
2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 |
# File 'lib/ibm_watson/discovery_v1.rb', line 2491 def get_metrics_query_no_results(start_time: nil, end_time: nil, result_type: nil) raise ArgumentError.new("version must be provided") if version.nil? headers = { } sdk_headers = Common.new.get_sdk_headers("discovery", "V1", "get_metrics_query_no_results") headers.merge!(sdk_headers) params = { "version" => @version, "start_time" => start_time, "end_time" => end_time, "result_type" => result_type } method_url = "/v1/metrics/number_of_queries_with_no_search_results" response = request( method: "GET", url: method_url, headers: headers, params: params, accept_json: true ) response end |
#get_metrics_query_token_event(count: nil) ⇒ IBMCloudSdkCore::DetailedResponse
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.
2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 |
# File 'lib/ibm_watson/discovery_v1.rb', line 2567 def get_metrics_query_token_event(count: nil) raise ArgumentError.new("version must be provided") if version.nil? headers = { } sdk_headers = Common.new.get_sdk_headers("discovery", "V1", "get_metrics_query_token_event") headers.merge!(sdk_headers) params = { "version" => @version, "count" => count } method_url = "/v1/metrics/top_query_tokens_with_event_rate" response = request( method: "GET", url: method_url, headers: headers, params: params, accept_json: true ) response end |
#get_stopword_list_status(environment_id: , collection_id: ) ⇒ IBMCloudSdkCore::DetailedResponse
Get stopword list status. Returns the current status of the stopword list for the specified collection.
1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 |
# File 'lib/ibm_watson/discovery_v1.rb', line 1018 def get_stopword_list_status(environment_id:, collection_id:) raise ArgumentError.new("version must be provided") if version.nil? raise ArgumentError.new("environment_id must be provided") if environment_id.nil? raise ArgumentError.new("collection_id must be provided") if collection_id.nil? headers = { } sdk_headers = Common.new.get_sdk_headers("discovery", "V1", "get_stopword_list_status") headers.merge!(sdk_headers) params = { "version" => @version } method_url = "/v1/environments/%s/collections/%s/word_lists/stopwords" % [ERB::Util.url_encode(environment_id), ERB::Util.url_encode(collection_id)] response = request( method: "GET", url: method_url, headers: headers, params: params, accept_json: true ) response end |
#get_tokenization_dictionary_status(environment_id: , collection_id: ) ⇒ IBMCloudSdkCore::DetailedResponse
Get tokenization dictionary status. Returns the current status of the tokenization dictionary for the specified
collection.
905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 |
# File 'lib/ibm_watson/discovery_v1.rb', line 905 def get_tokenization_dictionary_status(environment_id:, collection_id:) raise ArgumentError.new("version must be provided") if version.nil? raise ArgumentError.new("environment_id must be provided") if environment_id.nil? raise ArgumentError.new("collection_id must be provided") if collection_id.nil? headers = { } sdk_headers = Common.new.get_sdk_headers("discovery", "V1", "get_tokenization_dictionary_status") headers.merge!(sdk_headers) params = { "version" => @version } method_url = "/v1/environments/%s/collections/%s/word_lists/tokenization_dictionary" % [ERB::Util.url_encode(environment_id), ERB::Util.url_encode(collection_id)] response = request( method: "GET", url: method_url, headers: headers, params: params, accept_json: true ) response end |
#get_training_data(environment_id: , collection_id: , query_id: ) ⇒ IBMCloudSdkCore::DetailedResponse
Get details about a query. Gets details for a specific training data query, including the query string and
all examples.
1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 |
# File 'lib/ibm_watson/discovery_v1.rb', line 1978 def get_training_data(environment_id:, collection_id:, query_id:) raise ArgumentError.new("version must be provided") if version.nil? raise ArgumentError.new("environment_id must be provided") if environment_id.nil? raise ArgumentError.new("collection_id must be provided") if collection_id.nil? raise ArgumentError.new("query_id must be provided") if query_id.nil? headers = { } sdk_headers = Common.new.get_sdk_headers("discovery", "V1", "get_training_data") headers.merge!(sdk_headers) params = { "version" => @version } method_url = "/v1/environments/%s/collections/%s/training_data/%s" % [ERB::Util.url_encode(environment_id), ERB::Util.url_encode(collection_id), ERB::Util.url_encode(query_id)] response = request( method: "GET", url: method_url, headers: headers, params: params, accept_json: true ) response end |
#get_training_example(environment_id: , collection_id: , query_id: , example_id: ) ⇒ IBMCloudSdkCore::DetailedResponse
Get details for training data example. Gets the details for this training example.
2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 |
# File 'lib/ibm_watson/discovery_v1.rb', line 2232 def get_training_example(environment_id:, collection_id:, query_id:, example_id:) raise ArgumentError.new("version must be provided") if version.nil? raise ArgumentError.new("environment_id must be provided") if environment_id.nil? raise ArgumentError.new("collection_id must be provided") if collection_id.nil? raise ArgumentError.new("query_id must be provided") if query_id.nil? raise ArgumentError.new("example_id must be provided") if example_id.nil? headers = { } sdk_headers = Common.new.get_sdk_headers("discovery", "V1", "get_training_example") headers.merge!(sdk_headers) params = { "version" => @version } method_url = "/v1/environments/%s/collections/%s/training_data/%s/examples/%s" % [ERB::Util.url_encode(environment_id), ERB::Util.url_encode(collection_id), ERB::Util.url_encode(query_id), ERB::Util.url_encode(example_id)] response = request( method: "GET", url: method_url, headers: headers, params: params, accept_json: true ) response end |
#list_collection_fields(environment_id: , collection_id: ) ⇒ IBMCloudSdkCore::DetailedResponse
List collection fields. Gets a list of the unique fields (and their types) stored in the index.
734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 |
# File 'lib/ibm_watson/discovery_v1.rb', line 734 def list_collection_fields(environment_id:, collection_id:) raise ArgumentError.new("version must be provided") if version.nil? raise ArgumentError.new("environment_id must be provided") if environment_id.nil? raise ArgumentError.new("collection_id must be provided") if collection_id.nil? headers = { } sdk_headers = Common.new.get_sdk_headers("discovery", "V1", "list_collection_fields") headers.merge!(sdk_headers) params = { "version" => @version } method_url = "/v1/environments/%s/collections/%s/fields" % [ERB::Util.url_encode(environment_id), ERB::Util.url_encode(collection_id)] response = request( method: "GET", url: method_url, headers: headers, params: params, accept_json: true ) response end |
#list_collections(environment_id: , name: nil) ⇒ IBMCloudSdkCore::DetailedResponse
List collections. Lists existing collections for the service instance.
586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 |
# File 'lib/ibm_watson/discovery_v1.rb', line 586 def list_collections(environment_id:, name: nil) raise ArgumentError.new("version must be provided") if version.nil? raise ArgumentError.new("environment_id must be provided") if environment_id.nil? headers = { } sdk_headers = Common.new.get_sdk_headers("discovery", "V1", "list_collections") headers.merge!(sdk_headers) params = { "version" => @version, "name" => name } method_url = "/v1/environments/%s/collections" % [ERB::Util.url_encode(environment_id)] response = request( method: "GET", url: method_url, headers: headers, params: params, accept_json: true ) response end |
#list_configurations(environment_id: , name: nil) ⇒ IBMCloudSdkCore::DetailedResponse
List configurations. Lists existing configurations for the service instance.
366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 |
# File 'lib/ibm_watson/discovery_v1.rb', line 366 def list_configurations(environment_id:, name: nil) raise ArgumentError.new("version must be provided") if version.nil? raise ArgumentError.new("environment_id must be provided") if environment_id.nil? headers = { } sdk_headers = Common.new.get_sdk_headers("discovery", "V1", "list_configurations") headers.merge!(sdk_headers) params = { "version" => @version, "name" => name } method_url = "/v1/environments/%s/configurations" % [ERB::Util.url_encode(environment_id)] response = request( method: "GET", url: method_url, headers: headers, params: params, accept_json: true ) response end |
#list_credentials(environment_id: ) ⇒ IBMCloudSdkCore::DetailedResponse
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.
2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 |
# File 'lib/ibm_watson/discovery_v1.rb', line 2604 def list_credentials(environment_id:) raise ArgumentError.new("version must be provided") if version.nil? raise ArgumentError.new("environment_id must be provided") if environment_id.nil? headers = { } sdk_headers = Common.new.get_sdk_headers("discovery", "V1", "list_credentials") headers.merge!(sdk_headers) params = { "version" => @version } method_url = "/v1/environments/%s/credentials" % [ERB::Util.url_encode(environment_id)] response = request( method: "GET", url: method_url, headers: headers, params: params, accept_json: true ) response end |
#list_environments(name: nil) ⇒ IBMCloudSdkCore::DetailedResponse
List environments. List existing environments for the service instance.
124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 |
# File 'lib/ibm_watson/discovery_v1.rb', line 124 def list_environments(name: nil) raise ArgumentError.new("version must be provided") if version.nil? headers = { } sdk_headers = Common.new.get_sdk_headers("discovery", "V1", "list_environments") headers.merge!(sdk_headers) params = { "version" => @version, "name" => name } method_url = "/v1/environments" response = request( method: "GET", url: method_url, headers: headers, params: params, accept_json: true ) response end |
#list_expansions(environment_id: , collection_id: ) ⇒ IBMCloudSdkCore::DetailedResponse
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.
773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 |
# File 'lib/ibm_watson/discovery_v1.rb', line 773 def list_expansions(environment_id:, collection_id:) raise ArgumentError.new("version must be provided") if version.nil? raise ArgumentError.new("environment_id must be provided") if environment_id.nil? raise ArgumentError.new("collection_id must be provided") if collection_id.nil? headers = { } sdk_headers = Common.new.get_sdk_headers("discovery", "V1", "list_expansions") headers.merge!(sdk_headers) params = { "version" => @version } method_url = "/v1/environments/%s/collections/%s/expansions" % [ERB::Util.url_encode(environment_id), ERB::Util.url_encode(collection_id)] response = request( method: "GET", url: method_url, headers: headers, params: params, accept_json: true ) response end |
#list_fields(environment_id: , collection_ids: ) ⇒ IBMCloudSdkCore::DetailedResponse
List fields across collections. Gets a list of the unique fields (and their types) stored in the indexes of the
specified collections.
263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 |
# File 'lib/ibm_watson/discovery_v1.rb', line 263 def list_fields(environment_id:, collection_ids:) raise ArgumentError.new("version must be provided") if version.nil? raise ArgumentError.new("environment_id must be provided") if environment_id.nil? raise ArgumentError.new("collection_ids must be provided") if collection_ids.nil? headers = { } sdk_headers = Common.new.get_sdk_headers("discovery", "V1", "list_fields") headers.merge!(sdk_headers) collection_ids *= "," unless collection_ids.nil? params = { "version" => @version, "collection_ids" => collection_ids } method_url = "/v1/environments/%s/fields" % [ERB::Util.url_encode(environment_id)] response = request( method: "GET", url: method_url, headers: headers, params: params, accept_json: true ) response end |
#list_gateways(environment_id: ) ⇒ IBMCloudSdkCore::DetailedResponse
List Gateways. List the currently configured gateways.
2826 2827 2828 2829 2830 2831 2832 2833 2834 2835 2836 2837 2838 2839 2840 2841 2842 2843 2844 2845 2846 2847 2848 2849 2850 |
# File 'lib/ibm_watson/discovery_v1.rb', line 2826 def list_gateways(environment_id:) raise ArgumentError.new("version must be provided") if version.nil? raise ArgumentError.new("environment_id must be provided") if environment_id.nil? headers = { } sdk_headers = Common.new.get_sdk_headers("discovery", "V1", "list_gateways") headers.merge!(sdk_headers) params = { "version" => @version } method_url = "/v1/environments/%s/gateways" % [ERB::Util.url_encode(environment_id)] response = request( method: "GET", url: method_url, headers: headers, params: params, accept_json: true ) response end |
#list_training_data(environment_id: , collection_id: ) ⇒ IBMCloudSdkCore::DetailedResponse
List training data. Lists the training data for the specified collection.
1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 |
# File 'lib/ibm_watson/discovery_v1.rb', line 1859 def list_training_data(environment_id:, collection_id:) raise ArgumentError.new("version must be provided") if version.nil? raise ArgumentError.new("environment_id must be provided") if environment_id.nil? raise ArgumentError.new("collection_id must be provided") if collection_id.nil? headers = { } sdk_headers = Common.new.get_sdk_headers("discovery", "V1", "list_training_data") headers.merge!(sdk_headers) params = { "version" => @version } method_url = "/v1/environments/%s/collections/%s/training_data" % [ERB::Util.url_encode(environment_id), ERB::Util.url_encode(collection_id)] response = request( method: "GET", url: method_url, headers: headers, params: params, accept_json: true ) response end |
#list_training_examples(environment_id: , collection_id: , query_id: ) ⇒ IBMCloudSdkCore::DetailedResponse
List examples for a training data query. List all examples for this training data query.
2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 |
# File 'lib/ibm_watson/discovery_v1.rb', line 2055 def list_training_examples(environment_id:, collection_id:, query_id:) raise ArgumentError.new("version must be provided") if version.nil? raise ArgumentError.new("environment_id must be provided") if environment_id.nil? raise ArgumentError.new("collection_id must be provided") if collection_id.nil? raise ArgumentError.new("query_id must be provided") if query_id.nil? headers = { } sdk_headers = Common.new.get_sdk_headers("discovery", "V1", "list_training_examples") headers.merge!(sdk_headers) params = { "version" => @version } method_url = "/v1/environments/%s/collections/%s/training_data/%s/examples" % [ERB::Util.url_encode(environment_id), ERB::Util.url_encode(collection_id), ERB::Util.url_encode(query_id)] response = request( method: "GET", url: method_url, headers: headers, params: params, accept_json: true ) response end |
#query(environment_id: , collection_id: , filter: nil, query: nil, natural_language_query: nil, passages: nil, aggregation: nil, count: nil, _return: nil, offset: nil, sort: nil, highlight: nil, passages_fields: nil, passages_count: nil, passages_characters: nil, deduplicate: nil, deduplicate_field: nil, similar: nil, similar_document_ids: nil, similar_fields: nil, bias: nil, spelling_suggestions: nil, x_watson_logging_opt_out: nil) ⇒ IBMCloudSdkCore::DetailedResponse
Query a collection. By using this method, you can construct long queries. For details, see the
[Discovery
documentation](https://cloud.ibm.com/docs/discovery?topic=discovery-query-concepts#query-concepts).
1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 |
# File 'lib/ibm_watson/discovery_v1.rb', line 1437 def query(environment_id:, collection_id:, filter: nil, query: nil, natural_language_query: nil, passages: nil, aggregation: nil, count: nil, _return: nil, offset: nil, sort: nil, highlight: nil, passages_fields: nil, passages_count: nil, passages_characters: nil, deduplicate: nil, deduplicate_field: nil, similar: nil, similar_document_ids: nil, similar_fields: nil, bias: nil, spelling_suggestions: nil, x_watson_logging_opt_out: nil) raise ArgumentError.new("version must be provided") if version.nil? raise ArgumentError.new("environment_id must be provided") if environment_id.nil? raise ArgumentError.new("collection_id must be provided") if collection_id.nil? headers = { "X-Watson-Logging-Opt-Out" => x_watson_logging_opt_out } sdk_headers = Common.new.get_sdk_headers("discovery", "V1", "query") headers.merge!(sdk_headers) params = { "version" => @version } data = { "filter" => filter, "query" => query, "natural_language_query" => natural_language_query, "passages" => passages, "aggregation" => aggregation, "count" => count, "return" => _return, "offset" => offset, "sort" => sort, "highlight" => highlight, "passages.fields" => passages_fields, "passages.count" => passages_count, "passages.characters" => passages_characters, "deduplicate" => deduplicate, "deduplicate.field" => deduplicate_field, "similar" => similar, "similar.document_ids" => similar_document_ids, "similar.fields" => similar_fields, "bias" => bias, "spelling_suggestions" => spelling_suggestions } method_url = "/v1/environments/%s/collections/%s/query" % [ERB::Util.url_encode(environment_id), ERB::Util.url_encode(collection_id)] response = request( method: "POST", url: method_url, headers: headers, params: params, json: data, accept_json: true ) response end |
#query_log(filter: nil, query: nil, count: nil, offset: nil, sort: nil) ⇒ IBMCloudSdkCore::DetailedResponse
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.
2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 |
# File 'lib/ibm_watson/discovery_v1.rb', line 2373 def query_log(filter: nil, query: nil, count: nil, offset: nil, sort: nil) raise ArgumentError.new("version must be provided") if version.nil? headers = { } sdk_headers = Common.new.get_sdk_headers("discovery", "V1", "query_log") headers.merge!(sdk_headers) sort *= "," unless sort.nil? params = { "version" => @version, "filter" => filter, "query" => query, "count" => count, "offset" => offset, "sort" => sort } method_url = "/v1/logs" response = request( method: "GET", url: method_url, headers: headers, params: params, accept_json: true ) response end |
#query_notices(environment_id: , collection_id: , filter: nil, query: nil, natural_language_query: nil, passages: nil, aggregation: nil, count: nil, _return: nil, offset: nil, sort: nil, highlight: nil, passages_fields: nil, passages_count: nil, passages_characters: nil, deduplicate_field: nil, similar: nil, similar_document_ids: nil, similar_fields: nil) ⇒ IBMCloudSdkCore::DetailedResponse
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](https://cloud.ibm.com/docs/discovery?topic=discovery-query-concepts#query-concepts)
for more details on the query language.
1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 |
# File 'lib/ibm_watson/discovery_v1.rb', line 1543 def query_notices(environment_id:, collection_id:, filter: nil, query: nil, natural_language_query: nil, passages: nil, aggregation: nil, count: nil, _return: nil, offset: nil, sort: nil, highlight: nil, passages_fields: nil, passages_count: nil, passages_characters: nil, deduplicate_field: nil, similar: nil, similar_document_ids: nil, similar_fields: nil) raise ArgumentError.new("version must be provided") if version.nil? raise ArgumentError.new("environment_id must be provided") if environment_id.nil? raise ArgumentError.new("collection_id must be provided") if collection_id.nil? headers = { } sdk_headers = Common.new.get_sdk_headers("discovery", "V1", "query_notices") headers.merge!(sdk_headers) _return *= "," unless _return.nil? sort *= "," unless sort.nil? passages_fields *= "," unless passages_fields.nil? similar_document_ids *= "," unless similar_document_ids.nil? similar_fields *= "," unless similar_fields.nil? params = { "version" => @version, "filter" => filter, "query" => query, "natural_language_query" => natural_language_query, "passages" => passages, "aggregation" => aggregation, "count" => count, "return" => _return, "offset" => offset, "sort" => sort, "highlight" => highlight, "passages.fields" => passages_fields, "passages.count" => passages_count, "passages.characters" => passages_characters, "deduplicate.field" => deduplicate_field, "similar" => similar, "similar.document_ids" => similar_document_ids, "similar.fields" => similar_fields } method_url = "/v1/environments/%s/collections/%s/notices" % [ERB::Util.url_encode(environment_id), ERB::Util.url_encode(collection_id)] response = request( method: "GET", url: method_url, headers: headers, params: params, accept_json: true ) response end |
#update_collection(environment_id: , collection_id: , name: , description: nil, configuration_id: nil) ⇒ IBMCloudSdkCore::DetailedResponse
Update a collection.
656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 |
# File 'lib/ibm_watson/discovery_v1.rb', line 656 def update_collection(environment_id:, collection_id:, name:, description: nil, configuration_id: nil) raise ArgumentError.new("version must be provided") if version.nil? raise ArgumentError.new("environment_id must be provided") if environment_id.nil? raise ArgumentError.new("collection_id must be provided") if collection_id.nil? raise ArgumentError.new("name must be provided") if name.nil? headers = { } sdk_headers = Common.new.get_sdk_headers("discovery", "V1", "update_collection") headers.merge!(sdk_headers) params = { "version" => @version } data = { "name" => name, "description" => description, "configuration_id" => configuration_id } method_url = "/v1/environments/%s/collections/%s" % [ERB::Util.url_encode(environment_id), ERB::Util.url_encode(collection_id)] response = request( method: "PUT", url: method_url, headers: headers, params: params, json: data, accept_json: true ) response end |
#update_configuration(environment_id: , configuration_id: , name: , description: nil, conversions: nil, enrichments: nil, normalizations: nil, source: nil) ⇒ IBMCloudSdkCore::DetailedResponse
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.
450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 |
# File 'lib/ibm_watson/discovery_v1.rb', line 450 def update_configuration(environment_id:, configuration_id:, name:, description: nil, conversions: nil, enrichments: nil, normalizations: nil, source: nil) raise ArgumentError.new("version must be provided") if version.nil? raise ArgumentError.new("environment_id must be provided") if environment_id.nil? raise ArgumentError.new("configuration_id must be provided") if configuration_id.nil? raise ArgumentError.new("name must be provided") if name.nil? headers = { } sdk_headers = Common.new.get_sdk_headers("discovery", "V1", "update_configuration") headers.merge!(sdk_headers) params = { "version" => @version } data = { "name" => name, "description" => description, "conversions" => conversions, "enrichments" => enrichments, "normalizations" => normalizations, "source" => source } method_url = "/v1/environments/%s/configurations/%s" % [ERB::Util.url_encode(environment_id), ERB::Util.url_encode(configuration_id)] response = request( method: "PUT", url: method_url, headers: headers, params: params, json: data, accept_json: true ) response end |
#update_credentials(environment_id: , credential_id: , source_type: nil, credential_details: nil, status: nil) ⇒ IBMCloudSdkCore::DetailedResponse
Update credentials. Updates an existing set of source credentials.
**Note:** All credentials are sent over an encrypted connection and encrypted at
rest.
2747 2748 2749 2750 2751 2752 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 2776 2777 2778 2779 2780 |
# File 'lib/ibm_watson/discovery_v1.rb', line 2747 def update_credentials(environment_id:, credential_id:, source_type: nil, credential_details: nil, status: nil) raise ArgumentError.new("version must be provided") if version.nil? raise ArgumentError.new("environment_id must be provided") if environment_id.nil? raise ArgumentError.new("credential_id must be provided") if credential_id.nil? headers = { } sdk_headers = Common.new.get_sdk_headers("discovery", "V1", "update_credentials") headers.merge!(sdk_headers) params = { "version" => @version } data = { "source_type" => source_type, "credential_details" => credential_details, "status" => status } method_url = "/v1/environments/%s/credentials/%s" % [ERB::Util.url_encode(environment_id), ERB::Util.url_encode(credential_id)] response = request( method: "PUT", url: method_url, headers: headers, params: params, json: data, accept_json: true ) response end |
#update_document(environment_id: , collection_id: , document_id: , file: nil, filename: nil, file_content_type: nil, metadata: nil) ⇒ IBMCloudSdkCore::DetailedResponse
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.
1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 |
# File 'lib/ibm_watson/discovery_v1.rb', line 1283 def update_document(environment_id:, collection_id:, document_id:, file: nil, filename: nil, file_content_type: nil, metadata: nil) raise ArgumentError.new("version must be provided") if version.nil? raise ArgumentError.new("environment_id must be provided") if environment_id.nil? raise ArgumentError.new("collection_id must be provided") if collection_id.nil? raise ArgumentError.new("document_id must be provided") if document_id.nil? headers = { } sdk_headers = Common.new.get_sdk_headers("discovery", "V1", "update_document") headers.merge!(sdk_headers) params = { "version" => @version } form_data = {} unless file.nil? unless file.instance_of?(StringIO) || file.instance_of?(File) file = file.respond_to?(:to_json) ? StringIO.new(file.to_json) : StringIO.new(file) end filename = file.path if filename.nil? && file.respond_to?(:path) form_data[:file] = HTTP::FormData::File.new(file, content_type: file_content_type.nil? ? "application/octet-stream" : file_content_type, filename: filename) end form_data[:metadata] = HTTP::FormData::Part.new(.to_s, content_type: "text/plain") unless .nil? method_url = "/v1/environments/%s/collections/%s/documents/%s" % [ERB::Util.url_encode(environment_id), ERB::Util.url_encode(collection_id), ERB::Util.url_encode(document_id)] response = request( method: "POST", url: method_url, headers: headers, params: params, form: form_data, accept_json: true ) response end |
#update_environment(environment_id: , name: nil, description: nil, size: nil) ⇒ IBMCloudSdkCore::DetailedResponse
Update an environment. Updates an environment. The environment’s name and description parameters
can be changed. You must specify a **name** for the environment.
191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 |
# File 'lib/ibm_watson/discovery_v1.rb', line 191 def update_environment(environment_id:, name: nil, description: nil, size: nil) raise ArgumentError.new("version must be provided") if version.nil? raise ArgumentError.new("environment_id must be provided") if environment_id.nil? headers = { } sdk_headers = Common.new.get_sdk_headers("discovery", "V1", "update_environment") headers.merge!(sdk_headers) params = { "version" => @version } data = { "name" => name, "description" => description, "size" => size } method_url = "/v1/environments/%s" % [ERB::Util.url_encode(environment_id)] response = request( method: "PUT", url: method_url, headers: headers, params: params, json: data, accept_json: true ) response end |
#update_training_example(environment_id: , collection_id: , query_id: , example_id: , cross_reference: nil, relevance: nil) ⇒ IBMCloudSdkCore::DetailedResponse
Change label or cross reference for example. Changes the label or cross reference query for this training data example.
2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 |
# File 'lib/ibm_watson/discovery_v1.rb', line 2185 def update_training_example(environment_id:, collection_id:, query_id:, example_id:, cross_reference: nil, relevance: nil) raise ArgumentError.new("version must be provided") if version.nil? raise ArgumentError.new("environment_id must be provided") if environment_id.nil? raise ArgumentError.new("collection_id must be provided") if collection_id.nil? raise ArgumentError.new("query_id must be provided") if query_id.nil? raise ArgumentError.new("example_id must be provided") if example_id.nil? headers = { } sdk_headers = Common.new.get_sdk_headers("discovery", "V1", "update_training_example") headers.merge!(sdk_headers) params = { "version" => @version } data = { "cross_reference" => cross_reference, "relevance" => relevance } method_url = "/v1/environments/%s/collections/%s/training_data/%s/examples/%s" % [ERB::Util.url_encode(environment_id), ERB::Util.url_encode(collection_id), ERB::Util.url_encode(query_id), ERB::Util.url_encode(example_id)] response = request( method: "PUT", url: method_url, headers: headers, params: params, json: data, accept_json: true ) response end |