Skip to content

Commit 7fe212e

Browse files
committed
[XPACK] Updates ml/preview_datafeed and graph/explore.
General source code documentation updates (deprecations, parameters doc)
1 parent 70c0a78 commit 7fe212e

File tree

7 files changed

+35
-14
lines changed

7 files changed

+35
-14
lines changed

elasticsearch-xpack/lib/elasticsearch/xpack/api/actions/async_search/submit.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ module Actions
5858
# @option arguments [String] :suggest_text The source text for which the suggestions should be returned
5959
# @option arguments [Time] :timeout Explicit operation timeout
6060
# @option arguments [Boolean] :track_scores Whether to calculate and return scores even if they are not used for sorting
61-
# @option arguments [Boolean|long] :track_total_hits Indicate if the number of documents that match the query should be tracked. A number can also be specified, to accurately track the total hit count up to the number.
61+
# @option arguments [Boolean] :track_total_hits Indicate if the number of documents that match the query should be tracked
6262
# @option arguments [Boolean] :allow_partial_search_results Indicate if an error should be returned if there is a partial search failure or timeout
6363
# @option arguments [Boolean] :typed_keys Specify whether aggregation and suggester names should be prefixed by their respective types in the response
6464
# @option arguments [Boolean] :version Specify whether to return document version as part of a hit

elasticsearch-xpack/lib/elasticsearch/xpack/api/actions/graph/explore.rb

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,17 @@ module Actions
2323
# Explore extracted and summarized information about the documents and terms in an index.
2424
#
2525
# @option arguments [List] :index A comma-separated list of index names to search; use `_all` or empty string to perform the operation on all indices
26+
# @option arguments [List] :type A comma-separated list of document types to search; leave empty to perform the operation on all types *Deprecated*
2627
# @option arguments [String] :routing Specific routing value
2728
# @option arguments [Time] :timeout Explicit operation timeout
2829
# @option arguments [Hash] :headers Custom HTTP headers
2930
# @option arguments [Hash] :body Graph Query DSL
3031
#
32+
# *Deprecation notice*:
33+
# Specifying types in urls has been deprecated
34+
# Deprecated since version 7.0.0
35+
#
36+
#
3137
# @see https://www.elastic.co/guide/en/elasticsearch/reference/7.x/graph-explore-api.html
3238
#
3339
def explore(arguments = {})
@@ -39,13 +45,19 @@ def explore(arguments = {})
3945

4046
_index = arguments.delete(:index)
4147

48+
_type = arguments.delete(:type)
49+
4250
method = if arguments[:body]
4351
Elasticsearch::API::HTTP_POST
4452
else
4553
Elasticsearch::API::HTTP_GET
4654
end
4755

48-
path = "#{Elasticsearch::API::Utils.__listify(_index)}/_graph/explore"
56+
path = if _index && _type
57+
"#{Elasticsearch::API::Utils.__listify(_index)}/#{Elasticsearch::API::Utils.__listify(_type)}/_graph/explore"
58+
else
59+
"#{Elasticsearch::API::Utils.__listify(_index)}/_graph/explore"
60+
end
4961
params = Elasticsearch::API::Utils.__validate_and_extract_params arguments, ParamsRegistry.get(__method__)
5062

5163
body = arguments[:body]

elasticsearch-xpack/lib/elasticsearch/xpack/api/actions/info.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ module Actions
2222
# Retrieves information about the installed X-Pack features.
2323
#
2424
# @option arguments [List] :categories Comma-separated list of info categories. Can be any of: build, license, features
25-
# @option arguments [Boolean] :accept_enterprise If this param is used it must be set to true *Deprecated*
25+
# @option arguments [Boolean] :accept_enterprise If an enterprise license is installed, return the type and mode as 'enterprise' (default: false)
2626
# @option arguments [Hash] :headers Custom HTTP headers
2727
#
2828
# @see https://www.elastic.co/guide/en/elasticsearch/reference/7.x/info-api.html

elasticsearch-xpack/lib/elasticsearch/xpack/api/actions/license/get.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ module Actions
2323
# Retrieves licensing information for the cluster
2424
#
2525
# @option arguments [Boolean] :local Return local information, do not retrieve the state from master node (default: false)
26-
# @option arguments [Boolean] :accept_enterprise Supported for backwards compatibility with 7.x. If this param is used it must be set to true *Deprecated*
26+
# @option arguments [Boolean] :accept_enterprise If the active license is an enterprise license, return type as 'enterprise' (default: false)
2727
# @option arguments [Hash] :headers Custom HTTP headers
2828
#
2929
# @see https://www.elastic.co/guide/en/elasticsearch/reference/7.x/get-license.html

elasticsearch-xpack/lib/elasticsearch/xpack/api/actions/machine_learning/find_file_structure.rb

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,12 @@ module Actions
4343
# @option arguments [Hash] :headers Custom HTTP headers
4444
# @option arguments [Hash] :body The contents of the file to be analyzed (*Required*)
4545
#
46-
# @see https://www.elastic.co/guide/en/elasticsearch/reference/7.x/ml-find-file-structure.html
46+
# *Deprecation notice*:
47+
# This endpoint has changed to _text_structure/find_structure, please use that API instead
48+
# Deprecated since version 7.12.0
49+
#
50+
#
51+
# @see https://www.elastic.co/guide/en/elasticsearch/reference/7.x/find-structure.html
4752
#
4853
def find_file_structure(arguments = {})
4954
raise ArgumentError, "Required argument 'body' missing" unless arguments[:body]

elasticsearch-xpack/lib/elasticsearch/xpack/api/actions/machine_learning/preview_datafeed.rb

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,23 +24,31 @@ module Actions
2424
#
2525
# @option arguments [String] :datafeed_id The ID of the datafeed to preview
2626
# @option arguments [Hash] :headers Custom HTTP headers
27+
# @option arguments [Hash] :body The datafeed config and job config with which to execute the preview
2728
#
2829
# @see https://www.elastic.co/guide/en/elasticsearch/reference/7.x/ml-preview-datafeed.html
2930
#
3031
def preview_datafeed(arguments = {})
31-
raise ArgumentError, "Required argument 'datafeed_id' missing" unless arguments[:datafeed_id]
32-
3332
headers = arguments.delete(:headers) || {}
3433

3534
arguments = arguments.clone
3635

3736
_datafeed_id = arguments.delete(:datafeed_id)
3837

39-
method = Elasticsearch::API::HTTP_GET
40-
path = "_ml/datafeeds/#{Elasticsearch::API::Utils.__listify(_datafeed_id)}/_preview"
38+
method = if arguments[:body]
39+
Elasticsearch::API::HTTP_POST
40+
else
41+
Elasticsearch::API::HTTP_GET
42+
end
43+
44+
path = if _datafeed_id
45+
"_ml/datafeeds/#{Elasticsearch::API::Utils.__listify(_datafeed_id)}/_preview"
46+
else
47+
"_ml/datafeeds/_preview"
48+
end
4149
params = {}
4250

43-
body = nil
51+
body = arguments[:body]
4452
perform_request(method, path, params, body, headers).body
4553
end
4654
end

elasticsearch-xpack/lib/elasticsearch/xpack/api/actions/text_structure/find_structure.rb

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,6 @@ module API
2121
module TextStructure
2222
module Actions
2323
# Finds the structure of a text file. The text file must contain data that is suitable to be ingested into Elasticsearch.
24-
# This functionality is Experimental and may be changed or removed
25-
# completely in a future release. Elastic will take a best effort approach
26-
# to fix any issues, but experimental features are not subject to the
27-
# support SLA of official GA features.
2824
#
2925
# @option arguments [Int] :lines_to_sample How many lines of the file should be included in the analysis
3026
# @option arguments [Int] :line_merge_size_limit Maximum number of characters permitted in a single message when lines are merged to create messages.

0 commit comments

Comments
 (0)