elasticsearch-xpack 5.5.0 → 6.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +7 -4
- data/Rakefile +16 -30
- data/elasticsearch-xpack.gemspec +3 -4
- data/examples/watcher/error_500.rb +23 -14
- data/lib/elasticsearch/xpack/api/actions/license/delete.rb +1 -1
- data/lib/elasticsearch/xpack/api/actions/license/get.rb +1 -1
- data/lib/elasticsearch/xpack/api/actions/license/post.rb +1 -1
- data/lib/elasticsearch/xpack/api/actions/machine_learning/close_job.rb +3 -1
- data/lib/elasticsearch/xpack/api/actions/machine_learning/delete_datafeed.rb +1 -1
- data/lib/elasticsearch/xpack/api/actions/machine_learning/delete_expired_data.rb +0 -5
- data/lib/elasticsearch/xpack/api/actions/machine_learning/delete_filter.rb +0 -4
- data/lib/elasticsearch/xpack/api/actions/machine_learning/delete_job.rb +2 -2
- data/lib/elasticsearch/xpack/api/actions/machine_learning/delete_model_snapshot.rb +2 -2
- data/lib/elasticsearch/xpack/api/actions/machine_learning/flush_job.rb +6 -3
- data/lib/elasticsearch/xpack/api/actions/machine_learning/forecast.rb +31 -0
- data/lib/elasticsearch/xpack/api/actions/machine_learning/get_buckets.rb +2 -2
- data/lib/elasticsearch/xpack/api/actions/machine_learning/get_categories.rb +2 -2
- data/lib/elasticsearch/xpack/api/actions/machine_learning/get_datafeed_stats.rb +6 -2
- data/lib/elasticsearch/xpack/api/actions/machine_learning/get_datafeeds.rb +9 -5
- data/lib/elasticsearch/xpack/api/actions/machine_learning/get_filters.rb +1 -5
- data/lib/elasticsearch/xpack/api/actions/machine_learning/get_influencers.rb +2 -2
- data/lib/elasticsearch/xpack/api/actions/machine_learning/get_job_stats.rb +5 -1
- data/lib/elasticsearch/xpack/api/actions/machine_learning/get_jobs.rb +7 -3
- data/lib/elasticsearch/xpack/api/actions/machine_learning/get_model_snapshots.rb +2 -2
- data/lib/elasticsearch/xpack/api/actions/machine_learning/get_overall_buckets.rb +44 -0
- data/lib/elasticsearch/xpack/api/actions/machine_learning/get_records.rb +4 -2
- data/lib/elasticsearch/xpack/api/actions/machine_learning/open_job.rb +2 -2
- data/lib/elasticsearch/xpack/api/actions/machine_learning/post_data.rb +2 -2
- data/lib/elasticsearch/xpack/api/actions/machine_learning/preview_datafeed.rb +2 -2
- data/lib/elasticsearch/xpack/api/actions/machine_learning/put_datafeed.rb +2 -2
- data/lib/elasticsearch/xpack/api/actions/machine_learning/put_filter.rb +0 -4
- data/lib/elasticsearch/xpack/api/actions/machine_learning/put_job.rb +2 -2
- data/lib/elasticsearch/xpack/api/actions/machine_learning/revert_model_snapshot.rb +4 -2
- data/lib/elasticsearch/xpack/api/actions/machine_learning/start_datafeed.rb +4 -2
- data/lib/elasticsearch/xpack/api/actions/machine_learning/stop_datafeed.rb +4 -2
- data/lib/elasticsearch/xpack/api/actions/machine_learning/update_datafeed.rb +3 -2
- data/lib/elasticsearch/xpack/api/actions/machine_learning/update_job.rb +2 -2
- data/lib/elasticsearch/xpack/api/actions/machine_learning/update_model_snapshot.rb +3 -2
- data/lib/elasticsearch/xpack/api/actions/machine_learning/validate.rb +1 -4
- data/lib/elasticsearch/xpack/api/actions/machine_learning/validate_detector.rb +0 -4
- data/lib/elasticsearch/xpack/api/actions/migration/deprecations.rb +26 -0
- data/lib/elasticsearch/xpack/api/actions/migration/get_assistance.rb +33 -0
- data/lib/elasticsearch/xpack/api/actions/migration/upgrade.rb +31 -0
- data/lib/elasticsearch/xpack/api/actions/security/put_user.rb +1 -0
- data/lib/elasticsearch/xpack/api/actions/ssl/certificates.rb +19 -0
- data/lib/elasticsearch/xpack/api/namespace/migration.rb +18 -0
- data/lib/elasticsearch/xpack/api/namespace/ssl.rb +18 -0
- data/lib/elasticsearch/xpack/version.rb +1 -1
- metadata +19 -25
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6d48434e595d29f97917ce830f882a8ed59adae3
|
4
|
+
data.tar.gz: e0ccd6d9d03a15b5903c4f29ee2c1c65b68abd39
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7e500cb2dc4facffc1861535c6a036d6959511519df85da4b3d833f9ee227ae857785f378ccd9c43794deefc1ab167cdc96b0dc74ed43fbd646c19da681b5a05
|
7
|
+
data.tar.gz: 6d463b5c155cb048b0d4528114b21d0c5fa703c7591a8a71a91245d000fa10f076be40bde5f50a12c5e3fbfe30cd05cd665976bb4b615b88ad58849d0f1cfff7
|
data/README.md
CHANGED
@@ -1,18 +1,17 @@
|
|
1
1
|
# Elasticsearch::XPack
|
2
2
|
|
3
|
-
A Ruby integration for the [X-Pack
|
4
|
-
for Elasticsearch.
|
3
|
+
A Ruby integration for the [X-Pack extension](https://www.elastic.co/guide/en/x-pack/current/xpack-introduction.html) for Elasticsearch.
|
5
4
|
|
6
5
|
|
7
6
|
## Installation
|
8
7
|
|
9
8
|
Install the package from [Rubygems](https://rubygems.org):
|
10
9
|
|
11
|
-
gem install elasticsearch-xpack
|
10
|
+
gem install elasticsearch-xpack
|
12
11
|
|
13
12
|
To use an unreleased version, either add it to your `Gemfile` for [Bundler](http://gembundler.com):
|
14
13
|
|
15
|
-
gem 'elasticsearch-xpack', git: '
|
14
|
+
gem 'elasticsearch-xpack', git: 'https://github.com/elastic/elasticsearch-x-pack-ruby.git'
|
16
15
|
|
17
16
|
or install it from a source code checkout:
|
18
17
|
|
@@ -43,6 +42,10 @@ official [X-Pack for the Elastic Stack](https://www.elastic.co/guide/en/x-pack/c
|
|
43
42
|
|
44
43
|
For examples, look into the [`examples`](examples) folder in this repository.
|
45
44
|
|
45
|
+
You can use the provided `test:server` Rake task to launch
|
46
|
+
a [Docker-based](https://www.elastic.co/guide/en/elasticsearch/reference/6.1/docker.html#_image_types)
|
47
|
+
Elasticsearch node with the full X-Pack license preinstalled.
|
48
|
+
|
46
49
|
## License
|
47
50
|
|
48
51
|
This software is licensed under the Apache 2 license, quoted below.
|
data/Rakefile
CHANGED
@@ -9,8 +9,8 @@ end
|
|
9
9
|
Rake::TestTask.new('test:unit') do |test|
|
10
10
|
test.libs << 'test'
|
11
11
|
test.test_files = FileList['test/unit/**/*_test.rb']
|
12
|
-
|
13
|
-
|
12
|
+
test.verbose = false
|
13
|
+
test.warning = false
|
14
14
|
end
|
15
15
|
|
16
16
|
namespace :test do
|
@@ -19,12 +19,7 @@ namespace :test do
|
|
19
19
|
require 'ansi'
|
20
20
|
|
21
21
|
suites = %w[
|
22
|
-
|
23
|
-
x-plugins/elasticsearch/x-pack/graph/src/test/resources/rest-api-spec/test
|
24
|
-
x-plugins/elasticsearch/x-pack/monitoring/src/test/resources/rest-api-spec/test/monitoring
|
25
|
-
x-plugins/elasticsearch/x-pack/security/src/test/resources/rest-api-spec/test
|
26
|
-
x-plugins/elasticsearch/x-pack/watcher/src/test/resources/rest-api-spec/test/xpack/watcher
|
27
|
-
x-plugins/elasticsearch/x-pack/license-plugin/src/test/resources/rest-api-spec/test
|
22
|
+
plugin/src/test/resources/rest-api-spec/test/
|
28
23
|
]
|
29
24
|
|
30
25
|
# TEMPORARY
|
@@ -59,7 +54,7 @@ namespace :test do
|
|
59
54
|
suites.each do |suite|
|
60
55
|
begin
|
61
56
|
sh <<-COMMAND
|
62
|
-
TEST_REST_API_SPEC
|
57
|
+
TEST_REST_API_SPEC=../x-pack-elasticsearch/#{suite} bundle exec ruby -I lib:test test/integration/yaml_test_runner.rb
|
63
58
|
COMMAND
|
64
59
|
executed_suites << { suite => 0 }
|
65
60
|
rescue RuntimeError
|
@@ -69,27 +64,18 @@ namespace :test do
|
|
69
64
|
puts '', '-'*80, ''
|
70
65
|
end
|
71
66
|
end
|
72
|
-
end
|
73
|
-
|
74
|
-
namespace :elasticsearch do
|
75
|
-
desc "Start Elasticsearch node for tests"
|
76
|
-
task :start do
|
77
|
-
require 'elasticsearch/extensions/test/cluster'
|
78
|
-
Elasticsearch::Extensions::Test::Cluster.start(port: ENV.fetch('TEST_CLUSTER_PORT', 9260), nodes: 1, path_logs: '/tmp')
|
79
|
-
end
|
80
67
|
|
81
|
-
desc "
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
68
|
+
desc "Run Elasticsearch with X-Pack installed (Docker)"
|
69
|
+
task :server do
|
70
|
+
sh <<-COMMAND.gsub(/^\s*/, '').gsub(/\s{1,}/, ' ')
|
71
|
+
docker run \
|
72
|
+
--name elasticsearch-xpack \
|
73
|
+
--env ELASTIC_PASSWORD=changeme \
|
74
|
+
--env cluster.name=elasticsearch-xpack-test \
|
75
|
+
--publish 9260:9200 \
|
76
|
+
--memory 4g \
|
77
|
+
--rm \
|
78
|
+
docker.elastic.co/elasticsearch/elasticsearch-platinum:6.1.1
|
79
|
+
COMMAND
|
93
80
|
end
|
94
|
-
end
|
95
81
|
end
|
data/elasticsearch-xpack.gemspec
CHANGED
@@ -21,15 +21,14 @@ Gem::Specification.new do |spec|
|
|
21
21
|
spec.add_development_dependency "bundler", "~> 1.10"
|
22
22
|
spec.add_development_dependency "rake", "~> 11.1"
|
23
23
|
|
24
|
-
spec.add_dependency "elasticsearch-api"
|
24
|
+
spec.add_dependency "elasticsearch-api", '~> 6'
|
25
25
|
|
26
|
-
spec.add_development_dependency "elasticsearch", '~>
|
27
|
-
spec.add_development_dependency "elasticsearch-transport", '~>
|
26
|
+
spec.add_development_dependency "elasticsearch", '~> 6'
|
27
|
+
spec.add_development_dependency "elasticsearch-transport", '~> 6'
|
28
28
|
spec.add_development_dependency "elasticsearch-extensions"
|
29
29
|
|
30
30
|
spec.add_development_dependency "activesupport"
|
31
31
|
spec.add_development_dependency "ansi"
|
32
|
-
spec.add_development_dependency "turn"
|
33
32
|
spec.add_development_dependency "minitest"
|
34
33
|
spec.add_development_dependency "minitest-reporters"
|
35
34
|
spec.add_development_dependency "shoulda-context"
|
@@ -2,21 +2,24 @@
|
|
2
2
|
#
|
3
3
|
# Execute this file from the root of the repository:
|
4
4
|
#
|
5
|
-
# bundle exec ruby -I lib ./examples/watcher/error_500.rb
|
5
|
+
# ALERT_EMAIL=email@example.com bundle exec ruby -I lib ./examples/watcher/error_500.rb
|
6
6
|
#
|
7
7
|
# The watch searches for `500` errors in a specific index on a periodic basis, and performs three
|
8
8
|
# actions when at least 3 errors have been received in the last 5 minutes:
|
9
9
|
#
|
10
10
|
# 1. indexes the error documents and aggregations returned from search,
|
11
11
|
# 2. sends a notification via e-mail, and
|
12
|
-
# 3. sends the data to a
|
12
|
+
# 3. sends the data to a webhook.
|
13
13
|
#
|
14
14
|
# If you want to test sending the e-mail, you have to configure Watcher:
|
15
15
|
# <https://www.elastic.co/guide/en/x-pack/current/actions-email.html#configuring-email>
|
16
16
|
#
|
17
|
-
#
|
17
|
+
# NOTE: If you want to use Gmail and you have 2-factor authentication enabled,
|
18
|
+
# generate an "App password", and use it in the `password` field.
|
18
19
|
#
|
19
|
-
#
|
20
|
+
# You can run a simple Sinatra application to test the webhook action with this script:
|
21
|
+
#
|
22
|
+
# $ ruby -r sinatra -r json -e 'post("/") { json = JSON.parse(request.body.read); puts %Q~Received [#{json["watch_id"]}] with payload: #{json["payload"]}~ }'
|
20
23
|
#
|
21
24
|
|
22
25
|
require 'elasticsearch'
|
@@ -25,16 +28,18 @@ require 'elasticsearch/xpack'
|
|
25
28
|
client = Elasticsearch::Client.new url: 'http://elastic:changeme@localhost:9260', log: true
|
26
29
|
client.transport.logger.formatter = proc do |severity, datetime, progname, msg| "\e[2m#{msg}\e[0m\n" end
|
27
30
|
|
31
|
+
# Print information about the Watcher plugin
|
32
|
+
#
|
33
|
+
cluster_info = client.info
|
34
|
+
xpack_info = client.xpack.info
|
35
|
+
puts "Elasticsearch #{cluster_info['version']['number']} | X-Pack build [#{xpack_info['build']['hash']}]"
|
36
|
+
|
28
37
|
# Delete the Watcher and test indices
|
29
38
|
#
|
30
39
|
['test_errors', 'alerts', '.watcher-history-*'].each do |index|
|
31
40
|
client.indices.delete index: index, ignore: 404
|
32
41
|
end
|
33
42
|
|
34
|
-
# Print information about the Watcher plugin
|
35
|
-
#
|
36
|
-
puts "X-Pack #{client.xpack.info['build']['hash']}"
|
37
|
-
|
38
43
|
# Register a new watch
|
39
44
|
#
|
40
45
|
client.xpack.watcher.put_watch id: 'error_500', body: {
|
@@ -86,11 +91,10 @@ client.xpack.watcher.put_watch id: 'error_500', body: {
|
|
86
91
|
# Transform the data for the template
|
87
92
|
#
|
88
93
|
script: {
|
89
|
-
|
90
|
-
inline: "[ 'total': ctx.payload.hits.total, 'hosts': ctx.payload.aggregations.hosts.buckets.collect(bucket -> [ 'host': bucket.key, 'errors': bucket.doc_count ]), 'errors': ctx.payload.hits.hits.collect(d -> d._source) ]"
|
94
|
+
source: "[ 'total': ctx.payload.hits.total, 'hosts': ctx.payload.aggregations.hosts.buckets.collect(bucket -> [ 'host': bucket.key, 'errors': bucket.doc_count ]), 'errors': ctx.payload.hits.hits.collect(d -> d._source) ]"
|
91
95
|
}
|
92
96
|
},
|
93
|
-
email: { to: '
|
97
|
+
email: { to: ENV.fetch('ALERT_EMAIL', 'alert@example.com'),
|
94
98
|
subject: '[ALERT] {{ctx.watch_id}}',
|
95
99
|
body: <<-BODY.gsub(/^ {28}/, ''),
|
96
100
|
Received {{ctx.payload.total}} errors in the last 5 minutes.
|
@@ -111,7 +115,7 @@ client.xpack.watcher.put_watch id: 'error_500', body: {
|
|
111
115
|
transform: {
|
112
116
|
script: {
|
113
117
|
lang: 'painless',
|
114
|
-
|
118
|
+
source: "[ 'watch_id': ctx.watch_id, 'payload': ctx.payload ]"
|
115
119
|
}
|
116
120
|
},
|
117
121
|
index: { index: 'alerts', doc_type: 'alert' }
|
@@ -155,9 +159,14 @@ end; puts "\n"
|
|
155
159
|
# Display information about watch execution
|
156
160
|
#
|
157
161
|
client.search(index: '.watcher-history-*', q: 'watch_id:error_500', sort: 'trigger_event.triggered_time:asc')['hits']['hits'].each do |r|
|
158
|
-
|
162
|
+
print "[#{r['_source']['watch_id']}] #{r['_source']['state'].upcase} at #{r['_source']['result']['execution_time']}"
|
163
|
+
if r['_source']['state'] == 'executed'
|
164
|
+
print " > Actions: "
|
165
|
+
print r['_source']['result']['actions'].map { |a| "[#{a['id']}] #{a['status']}#{a['error'] ? ': '+a['error']['type'] : ''}" }.join(', ')
|
166
|
+
end
|
167
|
+
print "\n"
|
159
168
|
end
|
160
169
|
|
161
170
|
# Delete the watch
|
162
171
|
#
|
163
|
-
client.xpack.watcher.delete_watch id: 'error_500', master_timeout: '30s'
|
172
|
+
client.xpack.watcher.delete_watch id: 'error_500', master_timeout: '30s'
|
@@ -6,7 +6,7 @@ module Elasticsearch
|
|
6
6
|
|
7
7
|
# Delete a license
|
8
8
|
#
|
9
|
-
# @see https://www.elastic.co/guide/en/
|
9
|
+
# @see https://www.elastic.co/guide/en/x-pack/current/license-management.html
|
10
10
|
#
|
11
11
|
def delete(arguments={})
|
12
12
|
method = Elasticsearch::API::HTTP_DELETE
|
@@ -8,7 +8,7 @@ module Elasticsearch
|
|
8
8
|
#
|
9
9
|
# @option arguments [Boolean] :local Return local information (default: false)
|
10
10
|
#
|
11
|
-
# @see https://www.elastic.co/guide/en/
|
11
|
+
# @see https://www.elastic.co/guide/en/x-pack/current/license-management.html
|
12
12
|
#
|
13
13
|
def get(arguments={})
|
14
14
|
valid_params = [ :local ]
|
@@ -10,7 +10,7 @@ module Elasticsearch
|
|
10
10
|
# @option arguments [Boolean] :acknowledge Whether the user has acknowledged acknowledge messages
|
11
11
|
# (default: false)
|
12
12
|
#
|
13
|
-
# @see https://www.elastic.co/guide/en/
|
13
|
+
# @see https://www.elastic.co/guide/en/x-pack/current/license-management.html
|
14
14
|
#
|
15
15
|
def post(arguments={})
|
16
16
|
valid_params = [ :acknowledge ]
|
@@ -7,14 +7,16 @@ module Elasticsearch
|
|
7
7
|
# TODO: Description
|
8
8
|
#
|
9
9
|
# @option arguments [String] :job_id The name of the job to close (*Required*)
|
10
|
+
# @option arguments [Boolean] :allow_no_jobs Whether to ignore if a wildcard expression matches no jobs. (This includes `_all` string or when no jobs have been specified)
|
10
11
|
# @option arguments [Boolean] :force True if the job should be forcefully closed
|
11
12
|
# @option arguments [Time] :timeout Controls the time to wait until a job has closed. Default to 30 minutes
|
12
13
|
#
|
13
|
-
# @see http://www.elastic.co/guide/en/
|
14
|
+
# @see http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-close-job.html
|
14
15
|
#
|
15
16
|
def close_job(arguments={})
|
16
17
|
raise ArgumentError, "Required argument 'job_id' missing" unless arguments[:job_id]
|
17
18
|
valid_params = [
|
19
|
+
:allow_no_jobs,
|
18
20
|
:force,
|
19
21
|
:timeout ]
|
20
22
|
method = Elasticsearch::API::HTTP_POST
|
@@ -9,7 +9,7 @@ module Elasticsearch
|
|
9
9
|
# @option arguments [String] :datafeed_id The ID of the datafeed to delete (*Required*)
|
10
10
|
# @option arguments [Boolean] :force True if the datafeed should be forcefully deleted
|
11
11
|
#
|
12
|
-
# @see http://www.elastic.co/guide/en/
|
12
|
+
# @see http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-delete-datafeed.html
|
13
13
|
#
|
14
14
|
def delete_datafeed(arguments={})
|
15
15
|
raise ArgumentError, "Required argument 'datafeed_id' missing" unless arguments[:datafeed_id]
|
@@ -4,12 +4,8 @@ module Elasticsearch
|
|
4
4
|
module MachineLearning
|
5
5
|
module Actions
|
6
6
|
|
7
|
-
# TODO: Description
|
8
|
-
#
|
9
7
|
# @option arguments [String] :filter_id The ID of the filter to delete (*Required*)
|
10
8
|
#
|
11
|
-
# @see [TODO]
|
12
|
-
#
|
13
9
|
def delete_filter(arguments={})
|
14
10
|
raise ArgumentError, "Required argument 'filter_id' missing" unless arguments[:filter_id]
|
15
11
|
method = Elasticsearch::API::HTTP_DELETE
|
@@ -4,12 +4,12 @@ module Elasticsearch
|
|
4
4
|
module MachineLearning
|
5
5
|
module Actions
|
6
6
|
|
7
|
-
#
|
7
|
+
# Delete an existing anomaly detection job
|
8
8
|
#
|
9
9
|
# @option arguments [String] :job_id The ID of the job to delete (*Required*)
|
10
10
|
# @option arguments [Boolean] :force True if the job should be forcefully deleted
|
11
11
|
#
|
12
|
-
# @see http://www.elastic.co/guide/en/
|
12
|
+
# @see http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-delete-job.html
|
13
13
|
#
|
14
14
|
def delete_job(arguments={})
|
15
15
|
raise ArgumentError, "Required argument 'job_id' missing" unless arguments[:job_id]
|
@@ -4,12 +4,12 @@ module Elasticsearch
|
|
4
4
|
module MachineLearning
|
5
5
|
module Actions
|
6
6
|
|
7
|
-
#
|
7
|
+
# Delete an existing model snapshot
|
8
8
|
#
|
9
9
|
# @option arguments [String] :job_id The ID of the job to fetch (*Required*)
|
10
10
|
# @option arguments [String] :snapshot_id The ID of the snapshot to delete (*Required*)
|
11
11
|
#
|
12
|
-
# @see http://www.elastic.co/guide/en/
|
12
|
+
# @see http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-delete-snapshot.html
|
13
13
|
#
|
14
14
|
def delete_model_snapshot(arguments={})
|
15
15
|
raise ArgumentError, "Required argument 'job_id' missing" unless arguments[:job_id]
|
@@ -4,7 +4,7 @@ module Elasticsearch
|
|
4
4
|
module MachineLearning
|
5
5
|
module Actions
|
6
6
|
|
7
|
-
#
|
7
|
+
# Force any buffered data to be processed by the job
|
8
8
|
#
|
9
9
|
# @option arguments [String] :job_id The name of the job to flush (*Required*)
|
10
10
|
# @option arguments [Hash] :body Flush parameters
|
@@ -12,8 +12,10 @@ module Elasticsearch
|
|
12
12
|
# @option arguments [String] :start When used in conjunction with calc_interim, specifies the range of buckets on which to calculate interim results
|
13
13
|
# @option arguments [String] :end When used in conjunction with calc_interim, specifies the range of buckets on which to calculate interim results
|
14
14
|
# @option arguments [String] :advance_time Setting this tells the Engine API that no data prior to advance_time is expected
|
15
|
+
# @option arguments [String] :skip_time Skips time to the given value without generating results or updating the model for the skipped interval
|
15
16
|
#
|
16
|
-
#
|
17
|
+
#
|
18
|
+
# @see http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-flush-job.html
|
17
19
|
#
|
18
20
|
def flush_job(arguments={})
|
19
21
|
raise ArgumentError, "Required argument 'job_id' missing" unless arguments[:job_id]
|
@@ -21,7 +23,8 @@ module Elasticsearch
|
|
21
23
|
:calc_interim,
|
22
24
|
:start,
|
23
25
|
:end,
|
24
|
-
:advance_time
|
26
|
+
:advance_time,
|
27
|
+
:skip_time ]
|
25
28
|
method = Elasticsearch::API::HTTP_POST
|
26
29
|
path = "_xpack/ml/anomaly_detectors/#{arguments[:job_id]}/_flush"
|
27
30
|
params = Elasticsearch::API::Utils.__validate_and_extract_params arguments, valid_params
|
@@ -0,0 +1,31 @@
|
|
1
|
+
module Elasticsearch
|
2
|
+
module XPack
|
3
|
+
module API
|
4
|
+
module MachineLearning
|
5
|
+
module Actions
|
6
|
+
|
7
|
+
# Predict the future behavior of a time series
|
8
|
+
#
|
9
|
+
# @option arguments [String] :job_id The ID of the job to forecast for (*Required*)
|
10
|
+
# @option arguments [Time] :duration The duration of the forecast
|
11
|
+
# @option arguments [Time] :expires_in The time interval after which the forecast expires. Expired forecasts will be deleted at the first opportunity.
|
12
|
+
#
|
13
|
+
# @see https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-forecast.html
|
14
|
+
#
|
15
|
+
def forecast(arguments={})
|
16
|
+
raise ArgumentError, "Required argument 'job_id' missing" unless arguments[:job_id]
|
17
|
+
valid_params = [
|
18
|
+
:duration,
|
19
|
+
:expires_in ]
|
20
|
+
method = Elasticsearch::API::HTTP_POST
|
21
|
+
path = "_xpack/ml/anomaly_detectors/#{arguments[:job_id]}/_forecast"
|
22
|
+
params = Elasticsearch::API::Utils.__validate_and_extract_params arguments, valid_params
|
23
|
+
body = nil
|
24
|
+
|
25
|
+
perform_request(method, path, params, body).body
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -4,7 +4,7 @@ module Elasticsearch
|
|
4
4
|
module MachineLearning
|
5
5
|
module Actions
|
6
6
|
|
7
|
-
#
|
7
|
+
# Retrieve job results for one or more buckets
|
8
8
|
#
|
9
9
|
# @option arguments [String] :job_id ID of the job to get bucket results from (*Required*)
|
10
10
|
# @option arguments [String] :timestamp The timestamp of the desired single bucket result
|
@@ -19,7 +19,7 @@ module Elasticsearch
|
|
19
19
|
# @option arguments [String] :sort Sort buckets by a particular field
|
20
20
|
# @option arguments [Boolean] :desc Set the sort direction
|
21
21
|
#
|
22
|
-
# @see http://www.elastic.co/guide/en/
|
22
|
+
# @see http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-bucket.html
|
23
23
|
#
|
24
24
|
def get_buckets(arguments={})
|
25
25
|
raise ArgumentError, "Required argument 'job_id' missing" unless arguments[:job_id]
|
@@ -4,7 +4,7 @@ module Elasticsearch
|
|
4
4
|
module MachineLearning
|
5
5
|
module Actions
|
6
6
|
|
7
|
-
#
|
7
|
+
# Retrieve job results for one or more categories
|
8
8
|
#
|
9
9
|
# @option arguments [String] :job_id The name of the job (*Required*)
|
10
10
|
# @option arguments [Long] :category_id The identifier of the category definition of interest
|
@@ -12,7 +12,7 @@ module Elasticsearch
|
|
12
12
|
# @option arguments [Int] :from skips a number of categories
|
13
13
|
# @option arguments [Int] :size specifies a max number of categories to get
|
14
14
|
#
|
15
|
-
# @see http://www.elastic.co/guide/en/
|
15
|
+
# @see http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-category.html
|
16
16
|
#
|
17
17
|
def get_categories(arguments={})
|
18
18
|
raise ArgumentError, "Required argument 'job_id' missing" unless arguments[:job_id]
|
@@ -4,13 +4,17 @@ module Elasticsearch
|
|
4
4
|
module MachineLearning
|
5
5
|
module Actions
|
6
6
|
|
7
|
-
#
|
7
|
+
# Retrieve usage information for datafeeds
|
8
8
|
#
|
9
9
|
# @option arguments [String] :datafeed_id The ID of the datafeeds stats to fetch
|
10
|
+
# @option arguments [Boolean] :allow_no_datafeeds Whether to ignore if a wildcard expression matches no datafeeds. (This includes `_all` string or when no datafeeds have been specified)
|
10
11
|
#
|
11
|
-
# @see http://www.elastic.co/guide/en/
|
12
|
+
# @see http://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-datafeed-stats.html
|
12
13
|
#
|
13
14
|
def get_datafeed_stats(arguments={})
|
15
|
+
valid_params = [
|
16
|
+
:allow_no_datafeeds ]
|
17
|
+
|
14
18
|
method = Elasticsearch::API::HTTP_GET
|
15
19
|
path = Elasticsearch::API::Utils.__pathify "_xpack/ml/datafeeds", arguments[:datafeed_id], "/_stats"
|
16
20
|
params = {}
|