Commit Graph

796 Commits

Author SHA1 Message Date
Jay Modi 1c1837fddd Reduce spamming of logs on common SSL exceptions (elastic/x-pack-elasticsearch#1083)
This commit reduces spamming of the logs when a common SSL exception is encountered such as a
client not trusting the server's certificate or a plaintext request sent to a channel that expects
TLS traffic.

relates elastic/x-pack-elasticsearch#1062

Original commit: elastic/x-pack-elasticsearch@94959e79f6
2017-04-24 07:51:24 -04:00
Jay Modi f063af9ee3 Log INFO message when reloading SSL configuration file changes (elastic/x-pack-elasticsearch#1082)
This commit adds a INFO level log message to indicate that a file was reloaded and the SSL contexts
using the file were also updated.

relates elastic/x-pack-elasticsearch#1063

Original commit: elastic/x-pack-elasticsearch@f53f7019de
2017-04-24 07:46:14 -04:00
David Kyle 2c6a4d8627 [ML] Fix filter influencers by score
Add more test coverage

Original commit: elastic/x-pack-elasticsearch@45b06d2a5b
2017-04-24 11:31:51 +01:00
Martijn van Groningen 5dc8c71e65 [TEST] Increased datafeed logging
Original commit: elastic/x-pack-elasticsearch@403bc28dea
2017-04-24 10:48:53 +02:00
Ryan Ernst c5b14197d4 Remove uses of ScriptService.executable which takes Script (elastic/x-pack-elasticsearch#1164)
This is the xpack side of elastic/elasticsearch#24264

Original commit: elastic/x-pack-elasticsearch@ac36bc32aa
2017-04-21 17:52:27 -07:00
David Kyle 72a9bffff8 [ML] Proceed on conflict when deleting job docs. (elastic/x-pack-elasticsearch#1157)
Original commit: elastic/x-pack-elasticsearch@b1b98ec268
2017-04-21 16:45:14 +01:00
Dimitris Athanasiou e0b6630e3d [ML] Add the current job state in conflict error messages (elastic/x-pack-elasticsearch#1158)
Relates elastic/x-pack-elasticsearch#878

Original commit: elastic/x-pack-elasticsearch@2be8b6c9a1
2017-04-21 16:42:39 +01:00
Dimitrios Athanasiou 73feee6317 [ML] Reduce timeout to 5s while indexing notifications
Original commit: elastic/x-pack-elasticsearch@b144f366f4
2017-04-21 14:58:21 +01:00
Dimitris Athanasiou 546faa3b9b [ML] Ignore non-bulk-action blocks in StateProcessor (elastic/x-pack-elasticsearch#1154)
This is in preparation for the autodetect process writing out
a block of spaces in order to flush the buffer at the end of
state persisting.

Relates elastic/x-pack-elasticsearch#1140

Original commit: elastic/x-pack-elasticsearch@fedf1d204c
2017-04-21 11:30:04 +01:00
David Kyle 52c8469225 [ML] Fix test failure by preventing random string from being ‘by’, ‘over’ or ‘count’
Original commit: elastic/x-pack-elasticsearch@8c79af0b77
2017-04-21 11:04:22 +01:00
David Roberts e549bc4ef9 [ML] Index the audit notification before responding to a delete request (elastic/x-pack-elasticsearch#1150)
This change prevents the situation where cleanup of ML indices immediately
after deleting a job leaves the audit notification in limbo because the index
it was due to be indexed into has been deleted.

Relates elastic/x-pack-elasticsearch#1142

Original commit: elastic/x-pack-elasticsearch@300e9c36ce
2017-04-21 10:17:33 +01:00
Luca Cavanna fc316bd947 [TEST] adapt to Aggregations being an abstract class with final methods (elastic/x-pack-elasticsearch#1128)
Original commit: elastic/x-pack-elasticsearch@080548e411
2017-04-20 21:31:42 +02:00
David Kyle a11e52fea2 [ML] Add check to prevent NoSuchElementException (elastic/x-pack-elasticsearch#1147)
Original commit: elastic/x-pack-elasticsearch@dca4020734
2017-04-20 18:10:32 +01:00
Chris Earle f9b8c82137 [Security] Remove cluster:monitor Privilege from kibana_user (elastic/x-pack-elasticsearch#1097)
Ordinary Kibana users should not have access to the cluster state of ES,
and therefore they should not be able to access ML jobs without explicit
permission.

Original commit: elastic/x-pack-elasticsearch@77273d561a
2017-04-20 12:50:11 -04:00
Dimitrios Athanasiou 1f9ddb6937 [TEST] Increase ml datafeed logging to understand test failure
DatafeedJobsIT has been failing. This change increases logging
to investigate those failures.

Original commit: elastic/x-pack-elasticsearch@0c7c29ac29
2017-04-20 17:18:11 +01:00
Alexander Reelsen 50dff91a3a Watcher: Fix resetting of ack status on unmet condition (elastic/x-pack-elasticsearch#1141)
When a condition is unmet, the ack status of the actions needs to be
resetted again, so that new alerts can be triggered.

Due to a bugfix this functionality was removed from ES 5.0.0-alpha5
onwards.

relates elastic/x-pack-elasticsearch#1123

Original commit: elastic/x-pack-elasticsearch@83db2cecf9
2017-04-20 15:19:25 +01:00
Dimitris Athanasiou 13d3b353c6 [TEST] Wait for pending tasks on test clean up... (elastic/x-pack-elasticsearch#1137)
.. in MlNativeAutodetectIntegTestCase.

We wait for pending tasks to finish from REST tests but not
from the ones using a native autodetect. This commit adds the
waiting in those tests too.

Relates elastic/x-pack-elasticsearch#1136

Original commit: elastic/x-pack-elasticsearch@a7a5455c78
2017-04-20 14:03:38 +01:00
Dimitris Athanasiou a2124b68e1 [ML] Invert interim result inclusion strategy (elastic/x-pack-elasticsearch#1139)
This changes the get-result actions to include interim
results by default. The former include_interim param is
now changed into an exclude_interim param.

relates elastic/x-pack-elasticsearch#1091

Original commit: elastic/x-pack-elasticsearch@c55a9a89d7
2017-04-20 13:52:35 +01:00
David Roberts bf543f0735 [TEST] Report more detail if waitForPendingTasks times out
Original commit: elastic/x-pack-elasticsearch@63ca54b851
2017-04-20 13:10:48 +01:00
David Roberts bd58856e6f [ML] Remove obsolete comment
Original commit: elastic/x-pack-elasticsearch@5637f95311
2017-04-20 11:00:27 +01:00
David Roberts 99def2bd33 [ML] Increase the wait time for AWS credentials to propagate
This was timing out a lot yesterday from the London office

Original commit: elastic/x-pack-elasticsearch@a0989c2a0f
2017-04-20 09:54:00 +01:00
Igor Motov 7656e4a67b Persistent tasks: require allocation id on task completion (elastic/x-pack-elasticsearch#1107)
Persistent tasks should verify that completion notification is done for correct version of the task, otherwise a delayed notification from an old node can accidentally close a newly reassigned task.

Original commit: elastic/x-pack-elasticsearch@478bb6e730
2017-04-19 15:42:55 -04:00
Dimitrios Athanasiou a0099cace6 [TEST] Call get on update job action from DetectionRulesIT
This was the reason for the intermittent failures of this test.

Original commit: elastic/x-pack-elasticsearch@e8605590a1
2017-04-19 19:52:16 +01:00
Martijn van Groningen 7ee48846ec [ML] Auto job close should use the current node as coordinating node.
Original commit: elastic/x-pack-elasticsearch@4f3f8f9915
2017-04-19 20:23:16 +02:00
Colin Goodheart-Smithe 7cb2be2e5c Adds a check to wait for active tasks for XPackRestIT (elastic/x-pack-elasticsearch#964)
* Adds a check to wait for active tasks for XPackRestIT

* uses test logger

* Change to use assertBusy instead of awaitBusy

* fixes failures with active tasks remaining

* Moves wait for pending tasks into MlRestTestStateCleaner

* remove unecessary log line

Original commit: elastic/x-pack-elasticsearch@1f098dbb64
2017-04-19 17:36:30 +01:00
Martijn van Groningen 06c4a3223b [ML] Having no datafeed tasks can happen.
Original commit: elastic/x-pack-elasticsearch@b752ce4f0f
2017-04-19 16:49:19 +02:00
David Roberts 4255f6dae6 [ML] Further reduce log file noise (elastic/x-pack-elasticsearch#1126)
Original commit: elastic/x-pack-elasticsearch@65301281d2
2017-04-19 15:19:15 +01:00
Dimitrios Athanasiou 8e7fd1421c [ML] Fix typo: decending -> descending
Original commit: elastic/x-pack-elasticsearch@d0b3a6a4b9
2017-04-19 15:18:01 +01:00
Dimitris Athanasiou 96cfbc8f4c [ML] Remove partition_field param from GetBucketsAction (elastic/x-pack-elasticsearch#1122)
Relates elastic/x-pack-elasticsearch#1119


Original commit: elastic/x-pack-elasticsearch@c87fdbc031
2017-04-19 14:07:51 +01:00
Dimitrios Athanasiou 03170d870b [ML] Remove expand from get-records REST spec
Relates elastic/x-pack-elasticsearch#1119

Original commit: elastic/x-pack-elasticsearch@d034a7ee5d
2017-04-19 13:30:34 +01:00
Dimitrios Athanasiou 02d1350778 [TEST] Change the serialization order back to keep tests happy
Original commit: elastic/x-pack-elasticsearch@2b83697395
2017-04-19 13:27:48 +01:00
Dimitris Athanasiou 9865d5b955 [ML] Fix detector rules and add integ test (elastic/x-pack-elasticsearch#1084)
Relates elastic/x-pack-elasticsearch#882

Original commit: elastic/x-pack-elasticsearch@fd1cc0d402
2017-04-19 12:23:38 +01:00
David Kyle d8a70138cd [TEST] Give jobs meaningful names in ML integ tests (elastic/x-pack-elasticsearch#1103)
Original commit: elastic/x-pack-elasticsearch@aaf1807172
2017-04-19 12:00:53 +01:00
Ryan Ernst b86cdd6c8e Test: Update rest base class parameters signature (elastic/x-pack-elasticsearch#1101)
This is the xpack side of elastic/elasticsearch#21392

Original commit: elastic/x-pack-elasticsearch@b760815f54
2017-04-18 15:07:14 -07:00
Chris Earle b1c0631e46 [TEST] Test explicitly for the watch we're interested in
Original commit: elastic/x-pack-elasticsearch@71bd0aee7e
2017-04-18 17:00:30 -04:00
Chris Earle 165291a23c Check for specific watch in watch test
Original commit: elastic/x-pack-elasticsearch@e778f14714
2017-04-18 15:57:52 -04:00
Chris Earle c27bb16141 [Monitoring] Use Exporter to create watches in Monitoring Cluster (elastic/x-pack-elasticsearch#994)
By creating the watches via the exporter, we get to afford ourselves
with a much more automatic and simpler set of security permissions.

This does limit us in a few ways (e.g., every exporter has to deal with
cluster alerts itself, which means that newer releases of Kibana cannot
help by adding newer cluster alerts for older, still-monitored
clusters).

Original commit: elastic/x-pack-elasticsearch@448ef313c3
2017-04-18 12:59:46 -04:00
Chris Earle a11f77aea0 [Monitoring] Convert "" _id to null (elastic/x-pack-elasticsearch#1098)
When Logstash 5.2 - 5.3 submit documents via the `_xpack/monitoring/_bulk`
endpoint, it sends its time-based documents with an explicit `_id` of
`""`.

This used to be automatically ignored by Monitoring, but we now accept the
_id that we are given (including `null`). ES, prior to 5.3.1, accepted
`""` as a valid `_id` through the `_bulk` endpoint, which means that it
blindly accepted and overwrote documents given that ID, meaning that all
Logstash instances "shared" the exact same document and therefore the UI
becomes useless.

This change allows `""` to be used and it simply replaces that value, and
only that value, with `null`. This enables backwards compatibility with LS
5.2 - 5.3.0.

Original commit: elastic/x-pack-elasticsearch@889578e61e
2017-04-18 12:24:15 -04:00
Adrien Grand 98c4dc6a92 Upgrade to a snapshot of Lucene 7. (elastic/x-pack-elasticsearch#1102)
Original commit: elastic/x-pack-elasticsearch@2c145e4160
2017-04-18 15:35:55 +02:00
Colin Goodheart-Smithe 51de15dcf1 Fixes compile errors in Eclipse due to generics
PersistentTasksCustomMetadata was using a generic param named `Params`. This conflicted with the imported interface `ToXContent.Params`. The java compiler was preferring the generic param over the interface so everything was fine but Eclipse apparently prefers the interface int his case which was screwing up the Hierarchy and causing compile errors in Eclipse. This changes fixes it by renaming the Generic param to `P`

Original commit: elastic/x-pack-elasticsearch@8528870684
2017-04-18 12:50:05 +01:00
Tim Vernum 4d557afaa4 Improvements in preparation for multiple security indices (elastic/x-pack-elasticsearch#1074)
- Mark all security indices (that is all indices managed by SecurityLifecycleService) as "superuser only" (only superuser role can have direct permissions)
- Add unit tests for IndexLifecycleManager

Original commit: elastic/x-pack-elasticsearch@e4478825e0
2017-04-18 15:22:19 +10:00
Jay Modi b59b6bbdd4 Remove SecuredString and use SecureString from elasticsearch core (elastic/x-pack-elasticsearch#1092)
This commit removes the SecuredString class that was previously used throughout the security code
and replaces it with the SecureString class from core that was added as part of the new secure
settings infrastructure.

relates elastic/x-pack-elasticsearch#421

Original commit: elastic/x-pack-elasticsearch@e9cd117ca1
2017-04-17 13:28:46 -04:00
jaymode 453bf907ca Test: expand wildcards when testing wildcard expression
Original commit: elastic/x-pack-elasticsearch@f5b74383a9
2017-04-14 10:05:25 -04:00
jaymode 492439fc70 Test: fix test bug with incorrect date math expressions
Original commit: elastic/x-pack-elasticsearch@ff88e947cd
2017-04-14 08:19:38 -04:00
Jay Modi 6f352260d6 Fix resolution of indices names with both date math and wildcards (elastic/x-pack-elasticsearch#1067)
When a index name pattern contains both date math and wildcards, the name resolution does not
return the expected result. This change moves the date math resolution to before our attempts to
match wildcards so that both can be used in the same pattern.

relates elastic/x-pack-elasticsearch#1065

Original commit: elastic/x-pack-elasticsearch@9f48b42fad
2017-04-14 07:44:52 -04:00
Martijn van Groningen d114a55b99 [ML] Make open job and start datafeed apis master node actions and
let close job and stop datafeed apis redirect to elected master node.

This is for cluster state observation purposes, so that a subsequent open and then close job or
start and then stop datafeed see the same local cluster state and sanity validation doesn't fail.

Original commit: elastic/x-pack-elasticsearch@21a63184b9
2017-04-14 10:43:21 +02:00
Martijn van Groningen e93b447b9c [ML] Only check licensing in the transport action of the open job and start datafeed apis.
Original commit: elastic/x-pack-elasticsearch@a59ef8884c
2017-04-14 08:57:44 +02:00
Martijn van Groningen 8f1d11df18 [ML] Split persistent job params from action request and
introduced separate task names to register the persistent tasks executors and params.

Also renamed start and stop datafeed action names to be singular in order to be consistent with open and close action names.

Original commit: elastic/x-pack-elasticsearch@21f7b242cf
2017-04-13 21:08:00 +02:00
Jason Tedor 8e2299f994 Remove support default settings
Support for default settings has been removed in core and so some
methods were refactored. This commit responds to this change in core.

Original commit: elastic/x-pack-elasticsearch@b22c612de4
2017-04-13 14:28:54 -04:00
Dimitrios Athanasiou 4245672acd [TEST] Unmute tests as the fix is now picked by CI
relates elastic/x-pack-elasticsearch#1079

Original commit: elastic/x-pack-elasticsearch@15d801fed2
2017-04-13 18:01:51 +01:00
Alexander Reelsen 733c1077f7 Tests: Reenable and fix watcher tests for ackable state
Original commit: elastic/x-pack-elasticsearch@8a53f508b7
2017-04-13 16:50:17 +01:00
Ali Beyad 4ec819706e [TEST] AwaitsFix annotation on periodically failing ML tests
Relates elastic/x-pack-elasticsearch#1079

Original commit: elastic/x-pack-elasticsearch@bc10e87869
2017-04-13 11:48:33 -04:00
David Kyle 1dd6207ce7 Revert "[TEST] mute failing ML test for now"
This reverts commit elastic/x-pack-elasticsearch@e04c3d0fa4.

Original commit: elastic/x-pack-elasticsearch@5c5240144a
2017-04-13 16:40:46 +01:00
David Kyle 00cfa78056 [TEST] Remove out of date tests. (elastic/x-pack-elasticsearch#1078)
The path has changed so it’s no longer possible to distinguish between data feed and job tasks.
The preceding test get_datafeed provides ample coverage anyway.

Original commit: elastic/x-pack-elasticsearch@780b1beb6b
2017-04-13 16:40:38 +01:00
Ali Beyad 8f61530dba [TEST] mute failing ML test for now
Original commit: elastic/x-pack-elasticsearch@26ca6bd65d
2017-04-13 11:20:40 -04:00
Alexander Reelsen 32a46f0595 Tests: Remove broken tests for now
Original commit: elastic/x-pack-elasticsearch@62fdbfc996
2017-04-13 15:32:19 +01:00
Alexander Reelsen 80e7babe3d Watcher: Provide real watch status on execute watch API (elastic/x-pack-elasticsearch#1076)
When the execute watch API is called without recording the execution
in the watch history, the watch status is not updated, in order to not
divert the in-memory object status and the one persisted on disk.

In order to work around this issue, the execute watch API can simply
clone a new watch status and a new watch, which means the object in
the watch store is never updated. This allows for execution and changing
of the watch status, before it is returned to the client.

relates elastic/x-pack-elasticsearch#889

Original commit: elastic/x-pack-elasticsearch@6a0d9c9a78
2017-04-13 14:56:14 +01:00
Igor Motov 450d47d1f5 Persistent Tasks: force writeable name of params and status to be the same as their task (elastic/x-pack-elasticsearch#1072)
Changes persistent task serialization and forces params and status to have the same writeable name as the task itself.

Original commit: elastic/x-pack-elasticsearch@59cf3dca39
2017-04-13 09:49:55 -04:00
David Kyle 468507e788 Revert "Muted test."
This reverts commit elastic/x-pack-elasticsearch@a4d8a72023.

Original commit: elastic/x-pack-elasticsearch@a2d5100ed2
2017-04-13 14:16:32 +01:00
David Kyle ac0e2a72cc Prevent the stop data feed listener from being called multiple times (elastic/x-pack-elasticsearch#1075)
Original commit: elastic/x-pack-elasticsearch@464d5ae6ba
2017-04-13 14:02:03 +01:00
Martijn van Groningen 911cfc9623 [ML] Made `max_running_jobs` a cluster wide setting and
remove `node.attr.max_running_jobs` node attribute and use `node.attr.ml.enabled` node attribute instead to know whether a node is a ml node or not.

Also renamed `max_running_jobs` setting to `xpack.ml.max_running_jobs`.

Original commit: elastic/x-pack-elasticsearch@798732886b
2017-04-13 15:00:50 +02:00
Dimitrios Athanasiou 2385619158 [TEST] Add missing clean up in UpdateInterimResultsIT
Original commit: elastic/x-pack-elasticsearch@bb1a495c8e
2017-04-13 12:53:03 +01:00
Martijn van Groningen f1b529291a [TEST] Use cluster state api to check whether job state is closed.
Original commit: elastic/x-pack-elasticsearch@27c9aa0c41
2017-04-13 13:39:43 +02:00
Martijn van Groningen 81abd29598 [ML] Empty task response is ok.
Original commit: elastic/x-pack-elasticsearch@9da321c531
2017-04-13 12:12:44 +02:00
Dimitrios Athanasiou 783a552b13 [TEST] Add integ test for updating interim results
Relates elastic/x-pack-elasticsearch#882

Original commit: elastic/x-pack-elasticsearch@e05b566188
2017-04-13 01:10:23 +01:00
Dimitrios Athanasiou 0c23d5174e [TEST] Extract base integ test case for ml with native autodetect
Original commit: elastic/x-pack-elasticsearch@7bf192527e
2017-04-12 22:50:32 +01:00
Martijn van Groningen 5461c87345 [ML] use correct id
Original commit: elastic/x-pack-elasticsearch@2801ef9f35
2017-04-12 20:32:17 +02:00
David Kyle 647c3aef53 [ML] Delete model snapshot and state before results (elastic/x-pack-elasticsearch#1066)
Original commit: elastic/x-pack-elasticsearch@65152e9735
2017-04-12 16:07:09 +01:00
Martijn van Groningen f72967eb7f [TEST] Use task builder instead of creating persistent tasks directly.
Original commit: elastic/x-pack-elasticsearch@f74792b23b
2017-04-12 16:21:13 +02:00
Jay Modi 666e87c29b Resolve paths from the current working directory instead of the config directory (elastic/x-pack-elasticsearch#637)
This commit changes the resolution of the output and input files so that relative paths will be resolved from the
current working directory instead of the x-pack config directory.

relates elastic/x-pack-elasticsearch#621

Original commit: elastic/x-pack-elasticsearch@bbfd83c2d5
2017-04-12 10:18:56 -04:00
Igor Motov 253340a597 Persistent Tasks: PersistentTaskRequest -> PersistTaskParams (elastic/x-pack-elasticsearch#1057)
Removes the last pieces of ActionRequest from PersistentTaskRequest and renames it into PersistTaskParams, which is now just an interface that extends NamedWriteable and ToXContent.

Original commit: elastic/x-pack-elasticsearch@5a298b924f
2017-04-12 09:58:15 -04:00
David Kyle a0dcae97db Add more checks for debugging test failure (elastic/x-pack-elasticsearch#1061)
Original commit: elastic/x-pack-elasticsearch@8dde009549
2017-04-12 12:32:38 +01:00
David Roberts 17d9d6aea3 [ML] Be nicer on platforms that don't have the ML binaries (elastic/x-pack-elasticsearch#1060)
Following this change, if the user runs on a platform that we don't ship
ML binaries for:

* If ML is enabled the node still refuses to start, but clearly says why
* If ML is disabled the node starts up without logging any errors

Original commit: elastic/x-pack-elasticsearch@af4fb8c411
2017-04-12 10:02:26 +01:00
Martijn van Groningen 9d683dfe13 [ML] Use datafeed and job id as task id.
Now that task id are strings instead of longs (elastic/x-pack-elasticsearch#1035), ml can use the job and datafeed as task id.
This removes logic that would otherwise iterate over all tasks and check if the task's request id was equal to the provided id and instead just do lookup in the task map.
Job and datafeed task ids are prefixed with either 'job-' or 'datafeed-', because job and datafeed ids don't have to be unique as they are stored separately from each other.

Original commit: elastic/x-pack-elasticsearch@b48c2b368a
2017-04-12 10:15:18 +02:00
Martijn van Groningen f8f7454130 [TEST] Actually perform the intended close...
Original commit: elastic/x-pack-elasticsearch@1333d78509
2017-04-12 09:23:48 +02:00
Martijn van Groningen 272d1b269e Muted test.
Original commit: elastic/x-pack-elasticsearch@a4d8a72023
2017-04-12 09:08:06 +02:00
Igor Motov 428af93f7b Persistent Tasks: switch from long task ids to string task ids (elastic/x-pack-elasticsearch#1035)
This commit switches from long persistent task ids to caller-supplied string persistent task ids.

Original commit: elastic/x-pack-elasticsearch@2dff985df7
2017-04-11 12:24:54 -04:00
Zachary Tong 6f643ffba5 [ML] If snapshot list is empty, return after signaling failure
Original commit: elastic/x-pack-elasticsearch@a89f88da11
2017-04-11 11:37:25 -04:00
Alexander Reelsen 71852c7215 Security: Add watcher_user and watcher_admin role (elastic/x-pack-elasticsearch#983)
This built-in watcher_admin role is able to execute all watcher actions,
read the watch history indices and read the watches index
index. The watcher_user role allows to GET a watch and to get the stats and thats it.

relates elastic/x-pack-elasticsearch#978

Original commit: elastic/x-pack-elasticsearch@11b33a413b
2017-04-11 16:28:55 +01:00
Dimitrios Athanasiou a5f0a74b67 [ML] Remove unused imports in GetDatafeedsStatsAction
Original commit: elastic/x-pack-elasticsearch@83abaae58e
2017-04-11 16:26:13 +01:00
Ali Beyad c468a4d3a3 [TEST] Security index template/mappings check on tests (elastic/x-pack-elasticsearch#1031)
Extends the security index check that ensure the template/mappings
are up-to-date to other security integration tests that depend on this
check.

relates elastic/x-pack-elasticsearch#794

Original commit: elastic/x-pack-elasticsearch@ec8e5b37bd
2017-04-11 11:22:41 -04:00
Martijn van Groningen 0e508d1bfb [TEST] Adjusted log levels to better track failure elastic/x-pack-elasticsearch#1048
Original commit: elastic/x-pack-elasticsearch@8f8b9fe17e
2017-04-11 16:58:49 +02:00
Dimitris Athanasiou 3fa43093eb [ML] Improve handling of job errors from datafeed (elastic/x-pack-elasticsearch#1049)
- stops the datafeed when post/flush throw a conflict exception.
A conflict exception signifies the job state is not opened, thus
we are better off stopping the datafeed.
- handles flushing the job the same way as posting to the job.

relates elastic/x-pack-elasticsearch#855

Original commit: elastic/x-pack-elasticsearch@49a54912c2
2017-04-11 15:55:05 +01:00
David Roberts 9525cb4784 [ML] Replace UTF-8 infinity symbol with ASCII word (elastic/x-pack-elasticsearch#1041)
Makes the log more readable in editors not set to UTF-8.
Customers may well be in this situation on Linux/Windows.

Original commit: elastic/x-pack-elasticsearch@4e59fc90cf
2017-04-11 15:25:50 +01:00
David Kyle 78a3c32ec4 [ML] Reduce frequency of data counts log message (elastic/x-pack-elasticsearch#1030)
* Reduce data counts log message frequency

* Start logging at 10,000 records

Original commit: elastic/x-pack-elasticsearch@af6c791b6e
2017-04-11 15:12:41 +01:00
David Kyle f11df2c0c7 [ML] Give the jobs in index_layout.yaml more meaningful names (elastic/x-pack-elasticsearch#1047)
For debugging the CI failures

Original commit: elastic/x-pack-elasticsearch@5f6a3d1c6d
2017-04-11 14:58:48 +01:00
Martijn van Groningen e1aac25f2d [TEST] Ensure all nodes indicate job has been stopped
Original commit: elastic/x-pack-elasticsearch@39184b6c69
2017-04-11 15:14:41 +02:00
jaymode cb735b5f69 Test: add missng action cluster:monitor/remote/info
Original commit: elastic/x-pack-elasticsearch@11429d81a7
2017-04-11 09:04:34 -04:00
Tanguy Leroux 1243c64671 [TEST] Remove log traces and change how LocalExporterTests stops
The commit changes how LocalExporterTests stops: it now uses the
node_stats document collected on each node and check if it's older
than a given number of seconds (10). It also removes log traces.

Original commit: elastic/x-pack-elasticsearch@0384690b41
2017-04-11 14:50:44 +02:00
Dimitris Athanasiou 4da1c5b9dc [ML] Remove batch_span and period from analysis config (elastic/x-pack-elasticsearch#1043)
relates elastic/x-pack-elasticsearch#1040

Original commit: elastic/x-pack-elasticsearch@aed5e9912c
2017-04-11 12:57:58 +01:00
Hendrik Muhs 7ef9a16f45 [ML] implement '_all' for stopping datafeeds (elastic/x-pack-elasticsearch#995)
Add a '_all' functionality for stopping ML datafeeds.

For cluster shutdown due to maintenance and major upgrades we recommend the user to stop all datafeeds and jobs. This change add the ability to stop all datafeeds at once where previously it was required to iterate over all feeds and do a explicit stop. This is part two of elastic/x-pack-elasticsearch#795, part one can be found in elastic/x-pack-elasticsearch#962 .

relates elastic/x-pack-elasticsearch#795

Original commit: elastic/x-pack-elasticsearch@ed1eff83d5
2017-04-11 13:39:22 +02:00
David Roberts d2c90e798f [ML] Make open/close job timeouts consistent (elastic/x-pack-elasticsearch#1039)
Before this change the persistent task operations related to opening
and closing jobs would time out a long time before the operations
related to native processes.

Original commit: elastic/x-pack-elasticsearch@23076b773b
2017-04-11 11:45:48 +01:00
Dimitrios Athanasiou 1760677b0e [ML] Remove redundant logging
Relates elastic/x-pack-elasticsearch#1027

Original commit: elastic/x-pack-elasticsearch@ddbe390e6f
2017-04-11 10:44:00 +01:00
Simon Willnauer 617c3ead5c Add tests for _remote/info API (elastic/x-pack-elasticsearch#1009)
Relates to elastic/elasticsearch#23925
Depends on elastic/elasticsearch#23969

Original commit: elastic/x-pack-elasticsearch@d1e8754a57
2017-04-11 11:24:22 +02:00
Colin Goodheart-Smithe 29c64d83e1 Removes version 2.x constants from Version (elastic/x-pack-elasticsearch#1022)
Original commit: elastic/x-pack-elasticsearch@39ef909aec
2017-04-11 08:30:59 +01:00
Tim Vernum 8840042751 Only log LDAP errors if authentication failed overall (elastic/x-pack-elasticsearch#960)
Changes the logging of LDAP authentication failures from "always" to "only if the user failed to be authenticated"

Previously there were cases (such has having 2 AD realms) where successful user authentication would still cause an INFO message to be written to the log for every request. 
Now that message is suppressed, but a WARN message is added _if-and-only-if_ the user cannot be authenticated by any realm.

This is implemented via a new value stored in the ThreadContext that the AuthenticationService choses to log (or not log) depending on the result of the authenticate process.
  
Closes: elastic/x-pack-elasticsearch#887

Original commit: elastic/x-pack-elasticsearch@b81b363729
2017-04-11 09:37:21 +10:00
Zachary Tong 43f1fb2bb1 [ML] Correctly parse stream of SMILE documents in JsonDataToProcessWriter (elastic/x-pack-elasticsearch#982)
The PR detects if SMILE is being provided, then correctly slices the stream such that each document is parsed individually. This is required because jackson's SMILE parser is stricter than it's JSON parser and will stop parsing when it hits a streamSeparator (unlike JSON, which will eagerly try to find more objects to parse).

Removes the forced-headers from the various REST tests.

relates elastic/x-pack-elasticsearch#642 

Original commit: elastic/x-pack-elasticsearch@c0e97cd545
2017-04-10 17:55:15 -04:00
Igor Motov 49223a8782 Persistent Tasks: remove listener from PersistentTasksExecutor#nodeOperation (elastic/x-pack-elasticsearch#1032)
Instead of having a separate listener for indicating that the current task is finished, this commit is switching to use allocated object itself.

Original commit: elastic/x-pack-elasticsearch@7ad5362121
2017-04-10 17:32:30 -04:00
Martijn van Groningen 018a3d197d [ML] Index job and datafeed assignment notifications via a separate cluster state listener.
`PersistentTasksExecutor#getAssignment(...)` should be a cheap and side-effect free method,
but in case of `OpenJobPersistentTasksExecutor` and `StartDatafeedPersistentTasksExecutor` before this change it would index a document each time `getAssignment(...)` was invoked

Original commit: elastic/x-pack-elasticsearch@5ca5890baf
2017-04-10 20:20:48 +02:00
Martijn van Groningen ecc19d9948 [TEST] Fixed typos in @TestLogging annotations
Original commit: elastic/x-pack-elasticsearch@3152765d4c
2017-04-10 20:13:50 +02:00
Martijn van Groningen 9201a5d640 [TEST] Changed test log levels
Original commit: elastic/x-pack-elasticsearch@73bd1251fa
2017-04-10 19:48:56 +02:00
Dimitris Athanasiou 1e1b5405b3 [ML] Also chunk aggregated datafeed by default (elastic/x-pack-elasticsearch#999)
The change applies chunking by default on aggregated datafeeds.
The chunking is set to a manual mode with time_span being
1000 histogram buckets.

The motivation for the change is two-fold:

1. It helps to avoid memory pressure/blowing.
Users may perform a lookback on a very long period of time. In that
case, we may hold a search response for all that time which could
include too many buckets. By chunking, we avoid that situation
as we know we'll only keep results for 1000 buckets at a time.

2. It makes cancellation more responsive.
In elastic/x-pack-elasticsearch#862 we made the processing of a search response cancellable in a
responsive manner. However, the search phase cannot be cancelled at
the moment. Chunking makes the search phase shorter, which will
result to a better user experience when they stop an aggregated
datafeed.

Also note the change sets the default chunking_config on datafeed
creation so the setting is no longer hidden.

Relates to elastic/x-pack-elasticsearch#803

Original commit: elastic/x-pack-elasticsearch@ae8f120f5f
2017-04-10 18:20:48 +01:00
Dimitris Athanasiou 0b6ac175da [ML] Check datafeed can be assigned before creating task (elastic/x-pack-elasticsearch#1027)
When a datafeed task is created but it cannot be assigned the task
has a null status. This means _stats report it as stopped, however
deleting it fails. In addition, it's a better experience to error
the start datafeed request all together and give the user the chance
to fix his data indices.

This change fails a datafeed-start if it cannot be assigned.

relates elastic/x-pack-elasticsearch#1018

Original commit: elastic/x-pack-elasticsearch@532288fda0
2017-04-10 18:19:46 +01:00
Igor Motov 105ba131e0 Persistent Tasks: remove retries on notification failures (elastic/x-pack-elasticsearch#977)
Retries should be already handled by TransportMasterNodeAction, there is no need to introduce another retry layer in Persistent Tasks code.

Original commit: elastic/x-pack-elasticsearch@967ac7f7fa
2017-04-10 12:26:09 -04:00
David Kyle 00bc35cf9f [ML] Consistently throw missing resource exception on all endpoints if the job id is not known. (elastic/x-pack-elasticsearch#1024)
Original commit: elastic/x-pack-elasticsearch@6676a03599
2017-04-10 15:23:08 +01:00
Tanguy Leroux 310b85083d [Test] Change how LocalExporterTests stops
This commit changes how LocalExporterTests stops the monitoring
components: it first stops the monitoring service (but keeps the
local exporter enabled), deletes and checks if monitoring indices
are recreated, and then disables the local exporter.

Original commit: elastic/x-pack-elasticsearch@4c4809a660
2017-04-10 15:14:49 +02:00
Martijn van Groningen 454d6b3390 [ML] Reintroduced the closing job state
Closing a job may take a while. In the meantime it is possible to start a datafeed, because before this change the job state remained OPENED.
With this change when the executor node receives the close job request, it will first set the status to CLOSING and after that closes the job (closing autodetect process, etc.).

relates elastic/x-pack-elasticsearch#990

Original commit: elastic/x-pack-elasticsearch@d8d89c0756
2017-04-10 15:08:50 +02:00
Tanguy Leroux 6396edc6a7 [Test] Add Monitoring Bulk API REST tests with privileges (elastic/x-pack-elasticsearch#968)
This commit removes the smoke-test-monitoring-with-security project
and replaces it with a REST test.

Original commit: elastic/x-pack-elasticsearch@f1665815c2
2017-04-10 15:08:19 +02:00
javanna 07a99c4792 [TEST] exclude num_reduce_phases from the SearchTransformTests comparisons
Original commit: elastic/x-pack-elasticsearch@d3a5c7e86b
2017-04-10 14:21:38 +02:00
David Roberts e8337344a6 [ML] Include C++ 3rd party notices in X-Pack combined NOTICES file (elastic/x-pack-elasticsearch#953)
relates elastic/x-pack-elasticsearch#620

Original commit: elastic/x-pack-elasticsearch@5d73bd340c
2017-04-10 12:40:07 +01:00
Martijn van Groningen 63c04ef19d [ML] Change close job api to no longer extend from TransportJobTaskAction.
The execution has diverged too much from post data, flush and update process apis, since the close all jobs have been added.
The logic is now easier to understand as it exist in a single source file instead of in both CloseJobAction and TransportJobTaskAction.

Original commit: elastic/x-pack-elasticsearch@daf5fabad5
2017-04-10 13:33:12 +02:00
Luca Cavanna cb07e93fde Adapt to getProperty move out of MultiBucketsAggregation.Bucket (elastic/x-pack-elasticsearch#1015)
Adapt to getProperty move out of MultiBucketsAggregation.Bucket

Original commit: elastic/x-pack-elasticsearch@3e8ca753cd
2017-04-10 13:28:37 +02:00
Tim Vernum 18835fe4df Expand debug logging for authentication / realms (elastic/x-pack-elasticsearch#641)
Users currently have difficulty diagnosing authentication failures.
Some logging messages mislead them, and in other cases there are unexpected behaviours that are not logged at all.
These additional DEBUG log messages and change some existing messages in an attempt to alleviate that problem.

Original commit: elastic/x-pack-elasticsearch@c6ea98b038
2017-04-10 21:21:40 +10:00
Luca Cavanna ef4de13ca4 Adapt ChunkedDataExtractor to removal of Aggregations#getProperty (elastic/x-pack-elasticsearch#1008)
Adapt ChunkedDataExtractor to removal of Aggregations#getProperty

Original commit: elastic/x-pack-elasticsearch@01ee2fee58
2017-04-10 12:32:11 +02:00
Martijn van Groningen 0ae0f93994 [ML] Stop immediately when job isn't opened
Original commit: elastic/x-pack-elasticsearch@cdb4cf47f5
2017-04-10 10:54:40 +02:00
Martijn van Groningen 0c2ef5608e [ML] Use same CS for validating job
Original commit: elastic/x-pack-elasticsearch@00b593e8c2
2017-04-10 10:32:42 +02:00
Dimitris Athanasiou a1cb22836c [ML] Add more categorization validations (elastic/x-pack-elasticsearch#1019)
- validates that when mlcategory is used, categorization_field_name is
set
- validates that when categorization_field_name is set, mlcategory is
used

relates elastic/x-pack-elasticsearch#986

Original commit: elastic/x-pack-elasticsearch@e861a3ed58
2017-04-09 18:18:17 +01:00
Dimitrios Athanasiou 0df726f6dd [ML] Fix logger usage
Original commit: elastic/x-pack-elasticsearch@f85148e0ff
2017-04-08 15:52:44 +01:00
Dimitrios Athanasiou 16d8dc6815 [ML] Log when no node found to open job/start datafeed
Relates elastic/x-pack-elasticsearch#878

Original commit: elastic/x-pack-elasticsearch@a64b7eaa80
2017-04-08 15:18:48 +01:00
Dimitris Athanasiou 5c9364d5fe [ML] Increase stop datafeed default timeout to 5 minutes (elastic/x-pack-elasticsearch#992)
Increase the timeout to give enough time for a datafeed to
stop smoothly.

This is the second step to avoid hitting the default timeout.
The first was ensuring aggregated datafeed is cancellable in
a responsive manner. The third and final step will be to
apply chunking in aggregated datafeeds in order to shorten
the duration of the search, which will make cancellation even
more responsive.

Relates elastic/x-pack-elasticsearch#803

Original commit: elastic/x-pack-elasticsearch@db642330ec
2017-04-08 14:44:08 +01:00
Dimitrios Athanasiou 734243a4df [TEST] Remove unused logger from CategorizationIT
Original commit: elastic/x-pack-elasticsearch@7b812eeede
2017-04-08 14:42:47 +01:00
Jay Modi cdfcfc5540 Do not contact AWS in offline mode (elastic/x-pack-elasticsearch#1001)
This commit restores the ability to build x-pack-elasticsearch without issues when running without
access to the internet. When the `--offline` flag is used, we will not try to contact vault and the
aws apis to retrieve the ml-cpp binaries but instead gradle will use a cached version even though
it may be expired.

relates elastic/x-pack-elasticsearch#726

Original commit: elastic/x-pack-elasticsearch@b0915d8fa9
2017-04-08 07:08:28 -06:00
Dimitrios Athanasiou 10df00beb1 [ML] Fix typo in assignment_explanation field name
Closes  elastic/x-pack-elasticsearch#1017

Original commit: elastic/x-pack-elasticsearch@b18e2a38fc
2017-04-08 13:17:14 +01:00
Ryan Ernst e8399cfccf Build: Build 5.x version of xpack for bwc tests to use (elastic/x-pack-elasticsearch#885)
This is analagous of the bwc-zip for elasticsearch. The one caveat is
due to the structure of how ES+xpack must be checked out, we end up with
a third clone of elasticsearch (the second being in :distribution:bwc-zip).
But the rolling upgrade integ test passes with this change.

relates elastic/x-pack-elasticsearch#870

Original commit: elastic/x-pack-elasticsearch@34bdce6e99
2017-04-07 22:19:30 -07:00
Jay Modi 984055392e Rename ml delete by query to xpack delete by query (elastic/x-pack-elasticsearch#1005)
This commit renames and moves the forked delete by query classes from being ml specific to being a
xpack common class since an upcoming security feature plans to make use of this. Additionally, this
commit fixes a issue where the dbq action was being executed by the calling user instead of the
xpack user for certain requests. This was found when adding a authorization change that restricts
this action's execution to the xpack user only.

Original commit: elastic/x-pack-elasticsearch@d5967e7255
2017-04-07 19:06:01 -06:00
Tanguy Leroux 9246261bc5 [Test] Generate less fields in LocalExporterTests
The test creates random documents, it looks like it generates too
   many fields.

Original commit: elastic/x-pack-elasticsearch@f55a3d1fc7
2017-04-07 20:47:40 +02:00
Dimitrios Athanasiou 54b72dc938 [TEST] Add ML categorization integ test
Original commit: elastic/x-pack-elasticsearch@ba8c2a1d64
2017-04-07 18:46:01 +01:00
David Roberts b9941de39d [TEST] Fix some assertions to match prior code change
Original commit: elastic/x-pack-elasticsearch@be4cc9cbef
2017-04-07 18:01:32 +01:00
Zachary Tong 8e2e26fc44 [ML] Forbid 'by' and 'over' as fieldnames for by/over (elastic/x-pack-elasticsearch#1007)
relates elastic/x-pack-elasticsearch#1002

Original commit: elastic/x-pack-elasticsearch@ba9005a58e
2017-04-07 16:09:22 +00:00
Dimitris Athanasiou bf111dde7e [ML] Add notification when no suitable nodes exist to allocate job (elastic/x-pack-elasticsearch#1006)
Relates elastic/x-pack-elasticsearch#878

Original commit: elastic/x-pack-elasticsearch@5a96484662
2017-04-07 16:55:10 +01:00
David Roberts 3986235d93 [ML] Fix large state persistence performance (elastic/x-pack-elasticsearch#1004)
There was a problem with the way CompositeBytesReference was used in the
StateProcessor.  In the case of a large state document we ended up with a
deeply nested CompositeBytesReference that then caused a deep stack and N^2
processing in the bulk action processor.

This change uses an intermediate list of byte arrays that get combined into
a single CompositeBytesReference to avoid the deep nesting.

Additionally, errors in state processing now bubble up to close the state
stream, which will cause the C++ process to stop trying to persist more state.

Finally, the results processor also times out after a similar period (30 minutes)
to that used by the state processor.

Original commit: elastic/x-pack-elasticsearch@ceb31481d1
2017-04-07 15:57:21 +01:00
Hendrik Muhs c7fd1aacff [ML] implement _all for closing jobs (elastic/x-pack-elasticsearch#962)
Add a '_all' functionality for closing ML jobs.

For cluster shutdown due to maintenance and major upgrades we recommend the user to stop all datafeeds and jobs. This change add the ability to close all jobs at once where previously it was required to iterate over all jobs and do a explicit close. This is part one of elastic/x-pack-elasticsearch#795, part two can be found in elastic/x-pack-elasticsearch#995.

relates elastic/x-pack-elasticsearch#795

Original commit: elastic/x-pack-elasticsearch@9b251ed7e1
2017-04-07 14:51:13 +02:00
Dimitrios Athanasiou b41288592c [ML] Some logging improvements
- Downgrade flush logging as it's called too often from datafeeds
- Add log info for job opening

Original commit: elastic/x-pack-elasticsearch@a262069f78
2017-04-07 13:36:04 +01:00
Adrien Grand df3cc61c5b Mute ActivateWatchTests.testDeactivateAndActivate.
Relates elastic/x-pack-elasticsearch#395

Original commit: elastic/x-pack-elasticsearch@bdf5a0dfed
2017-04-07 11:03:31 +02:00
Martijn van Groningen d8170861ea [TEST] Check whether datafeed is stopped differently
Original commit: elastic/x-pack-elasticsearch@9bde2cc2c2
2017-04-07 10:50:48 +02:00
Martijn van Groningen b248b6dbfc [TEST] [ML] Run ensureStableCluster(...) on all nodes and run synched flush before executing the disrupt
Original commit: elastic/x-pack-elasticsearch@d10beacb73
2017-04-07 09:51:13 +02:00
Martijn van Groningen 3986a2a06c [ML] Remove PersistentTask#isCurrentStatus() usages
Original commit: elastic/x-pack-elasticsearch@efe7e1e770
2017-04-06 21:32:54 +02:00
Zachary Tong e2a30331ba Refactor StartDataFeed to more intelligently wait on shard status (elastic/x-pack-elasticsearch#974)
Rather than using an async call, this leverages
the Assignment logic while selecting nodes.

Now with 300% more tests!

Original commit: elastic/x-pack-elasticsearch@300d628f72
2017-04-06 18:14:51 +00:00
David Kyle 9a9ae5edc7 [ML] Restore categoriser state after the anomaly detector (elastic/x-pack-elasticsearch#993)
Original commit: elastic/x-pack-elasticsearch@fc4205f1d6
2017-04-06 18:12:52 +01:00
Martijn van Groningen 5585283216 [ML] Added cause to exception.
Relates to elastic/x-pack-elasticsearch#990

Original commit: elastic/x-pack-elasticsearch@a66bc958b7
2017-04-06 16:34:24 +02:00
David Roberts 97866eb0e8 [ML] Increase timeouts for named pipe connections to native processes (elastic/x-pack-elasticsearch#987)
It has been observed that Amazon EBS volumes created from snapshots can
have very high latency the first time a given block is accessed.  This
can lead to named pipes taking longer than 2 seconds to create.
Since the native processes create their named pipes immediately after
startup, and this only takes a fraction of a second on a local disk, 2
seconds was considered a generous timeout, but it seems that in the case
of a remote NAS with lazy provisioning it's not long enough.  During
debugging a latency of just over 3 seconds was observed.  The timeouts
have been increased to 10 seconds.

relates elastic/x-pack-elasticsearch#922

Original commit: elastic/x-pack-elasticsearch@c90434c948
2017-04-06 14:42:27 +01:00
Jay Modi 92942c9327 Add support for IndexOrDocValuesQuery in FieldExtractor (elastic/x-pack-elasticsearch#976)
This commit adds support for extracting the fields from a IndexOrDocValuesQuery so that we can
still take advantage of the cache when this query is used.

relates elastic/x-pack-elasticsearch#973

Original commit: elastic/x-pack-elasticsearch@0b97202a41
2017-04-06 12:44:25 +01:00
Tim Vernum 573b421446 Support multiple indices in SecurityLifecycleService (elastic/x-pack-elasticsearch#961)
Moves the direct management of the security index from SecurityLifecycleService to IndexLifecycleManager, so that the SecurityLifecycleService can take responsibility for several indices.

Multiple security indices are required as we move away from storing multiple types in a single index.

Original commit: elastic/x-pack-elasticsearch@fde3a42b4d
2017-04-06 21:37:33 +10:00
jaymode 7efc9e1270 Test: Fix IndexAuditTrailMutedTests to set the threadpool
The IndexAuditTrailMutedTests have a threadpool but fail to set it on the test client, which causes
a NPE and tests to fail.

Original commit: elastic/x-pack-elasticsearch@d34a4ce080
2017-04-05 13:50:00 -04:00
Alexander Reelsen 16f5f44d41 Watcher: Dont check index auto creation if disabled/transportclient (elastic/x-pack-elasticsearch#975)
When watcher is disabled, no auto index creation checks should happen.

Relates elastic/elasticsearch#23919

Original commit: elastic/x-pack-elasticsearch@d924838b4d
2017-04-05 18:39:54 +01:00
jaymode a53026498f Test: mute SearchGroupsResolverInMemoryTests
This commit mutes SearchGroupsResolverInMemoryTests as they fail with a thread leak. See elastic/x-pack-elasticsearch#971

Original commit: elastic/x-pack-elasticsearch@be7c988e20
2017-04-05 13:23:53 -04:00
Dimitrios Athanasiou e97035af87 Add missing logging param
Original commit: elastic/x-pack-elasticsearch@30ee528798
2017-04-05 17:00:12 +01:00
Dimitris Athanasiou 0be4082ad7 [ML] Add notification for loading snapshot (elastic/x-pack-elasticsearch#970)
As the snapshot that is loaded is an important operational
aspect of a job, this change adds a notification that displays
the loaded snapshot with its latest_record_timestamp and the
job's latest_record_timestamp. Having both allows us to discover
when a job is recovering after a node failure.

relates elastic/x-pack-elasticsearch#872

Original commit: elastic/x-pack-elasticsearch@c2dee495a2
2017-04-05 16:43:14 +01:00
Tanguy Leroux 7b48bac9f4 [Test] Gives more time to LocalExporterTests to delete indices
The test fails on slow machines because of inflight bulk requests
that hit one node while the others are stopping. This commit adds
more time (10s), equivalent to 2 to 3 collection interval, to delete
the monitoring indices. It also add TRACE logging level for the test.

Original commit: elastic/x-pack-elasticsearch@b433937946
2017-04-05 16:38:12 +02:00
Martijn van Groningen 2edbd0efeb [ML] Removed unused methods
Original commit: elastic/x-pack-elasticsearch@8b3c606147
2017-04-05 14:30:21 +02:00
Martijn van Groningen cbbc3cfe20 [ML] Slightly adjust JobProvider#getAutodetectParams(...)
Original commit: elastic/x-pack-elasticsearch@2aaf618d78
2017-04-05 14:18:00 +02:00
Colin Goodheart-Smithe 00a5759d54 [ML] Adds jobType to Job (elastic/x-pack-elasticsearch#947)
* [ML] Adds jobType to Job

This change adds `jobType` field to teh `Job` class so that when the job is written to the index a `job_type` field is written int he document. This will help separate this type of job from other new job types in the future so migrating the index to allow those new type of jobs will be easer

relates elastic/x-pack-elasticsearch#798

* Addresses review comments

Original commit: elastic/x-pack-elasticsearch@d9fd11edb3
2017-04-05 11:12:26 +01:00
Alexander Reelsen 4b2680dac7 Tests: Ensure watch index is deleted to execute test correctly
The test requires no watch index or alias to exist, so making
sure this is deleted as part of the test.

relates elastic/x-pack-elasticsearch#920

Original commit: elastic/x-pack-elasticsearch@c1cc953ce3
2017-04-05 10:36:43 +01:00
Tim Vernum 7f0fd9e1a3 Failed LDAP SearchResults should be Exceptions (elastic/x-pack-elasticsearch#773)
When the LDAP SDK returns a SearchResult that has a non-success ResultCode, convert it to an exception and call onFailure

A configuration setting controls whether failures in referrals should be fatal (defaults to ignoring errors)

Closes: elastic/x-pack-elasticsearch#717

Original commit: elastic/x-pack-elasticsearch@4159758c2a
2017-04-05 18:40:17 +10:00
David Kyle 7c45cb7ccf Fix check style line length failure
Original commit: elastic/x-pack-elasticsearch@d37595db2b
2017-04-05 09:00:16 +01:00
David Kyle f8bb762a59 [TEST] Revert "Tests: Disable `ml/index_layout/Test unrelated index`."
This reverts commit elastic/x-pack-elasticsearch@097f559d0b.

Original commit: elastic/x-pack-elasticsearch@1f63456866
2017-04-05 08:48:23 +01:00
David Kyle 7b45460951 [ML] Wait for dataCounts to be persisted (elastic/x-pack-elasticsearch#952)
Original commit: elastic/x-pack-elasticsearch@48ca4d7363
2017-04-05 08:45:01 +01:00
Igor Motov d11fbfa70c Persistent Tasks: refactor PersistentTasksService to use ActionListener (elastic/x-pack-elasticsearch#937)
PersistentTasksService methods are not using ActionListener<PersistentTask<?>> instead of PersistentTaskOperationListener.

Original commit: elastic/x-pack-elasticsearch@f95d8bda3d
2017-04-04 13:56:22 -04:00
Zachary Tong bac8f010b4 Remove unnecessary headers in Model yaml tests
Original commit: elastic/x-pack-elasticsearch@74e2a5e29a
2017-04-04 13:51:40 -04:00
Tim Vernum 26fb1a6997 Don't assume FLS arrays are pre-sorted (elastic/x-pack-elasticsearch#939)
The `FieldPermissions` class incorrectly assumed that the `granted` and `denied` arrays were
sorted, so it could do a `binarySearch` to see if `_all` was in the arrays.

Original commit: elastic/x-pack-elasticsearch@49b5875602
2017-04-04 18:14:20 +01:00
Jay Modi 1e42473f77 Remove incorrect usages of Arrays.binarySearch (elastic/x-pack-elasticsearch#954)
This is a follow-on to elastic/x-pack-elasticsearch#939, which removes the use of Arrays.binarySearch in the FieldPermissions
class. This change removes other incorrect uses in the rest of the x-pack code and replaces them
with a stream based implementation.

Original commit: elastic/x-pack-elasticsearch@ccca7e9bad
2017-04-04 17:48:58 +01:00
Dimitris Athanasiou c9834bc826 [ML] Require max time aggregation to ensure correct datafeed restart (elastic/x-pack-elasticsearch#948)
Before this change, aggregation datafeeds used the histogram bucket
key as the record timestamp that is posted to the job. That meant
that the latest_record_timestamp at the end of a datafeed run was
the start of the latest seen histogram bucket. Upon continuing the
datafeed, the search starts from one millisecond after the
latest_record_timestamp. Hence, data may be fetched for a second time.

This change requires a max aggregation on the time_field nested in
the histogram bucket. It then reads the timestamp from that agg.
This ensures datafeed can restart without duplicating data.

relates elastic/x-pack-elasticsearch#874

Original commit: elastic/x-pack-elasticsearch@f820efa866
2017-04-04 17:15:44 +01:00
Zachary Tong 2153c71e8f Wait for datafeed index to hit yellow before proceeding (elastic/x-pack-elasticsearch#940)
relates elastic/x-pack-elasticsearch#783

Original commit: elastic/x-pack-elasticsearch@838482e645
2017-04-04 16:14:02 +00:00
Dimitris Athanasiou 4fdcedb9f9 [ML] Enable datafeed preview with future data (elastic/x-pack-elasticsearch#949)
Original commit: elastic/x-pack-elasticsearch@7f9e450edc
2017-04-04 17:08:01 +01:00
Dimitris Athanasiou 38706faec7 [ML] Improve datafeed notifications (elastic/x-pack-elasticsearch#951)
- include 'real-time' instead of now as the end time for real-time
  datafeeds
- do not notify lookback is completed when datafeed was stopped
- do not notify datafeed switch to real-time when datafeed was stopped

Relates elastic/x-pack-elasticsearch#878

Original commit: elastic/x-pack-elasticsearch@aa22f9b86f
2017-04-04 17:04:41 +01:00
Jason Tedor dee1bd1825 Respond to rename random ASCII helper methods
This commit is response to the renaming of the random ASCII helper
methods in ESTestCase. The name of this method was changed because these
methods only produce random strings generated from [a-zA-Z], not from
all ASCII characters.

Relates elastic/x-pack-elasticsearch#942

Original commit: elastic/x-pack-elasticsearch@a6085964d3
2017-04-04 11:04:37 -04:00
Martijn van Groningen 71149fb6d4 [ML] Fix NPE
Original commit: elastic/x-pack-elasticsearch@421491bce0
2017-04-04 16:15:56 +02:00
Martijn van Groningen 543319f966 [ML] Small cleanup
Original commit: elastic/x-pack-elasticsearch@78a99258dd
2017-04-04 16:10:09 +02:00
David Kyle 778e960d3e [ML] Remove periodic persistence of datacounts (elastic/x-pack-elasticsearch#944)
Original commit: elastic/x-pack-elasticsearch@756f06d316
2017-04-04 14:45:15 +01:00
Igor Motov eb79be392c Persistent Tasks: check the current state in waitForPersistentTaskStatus (elastic/x-pack-elasticsearch#935)
Add a check for the current state waitForPersistentTaskStatus before waiting for the next one. This fixes sporadic failure in testPersistentActionStatusUpdate test.

relates elastic/x-pack-elasticsearch#928

Original commit: elastic/x-pack-elasticsearch@0db4ac92d2
2017-04-04 09:44:56 -04:00
David Kyle 5716b2bf16 [ML] Create job index before adding job to cluster state (elastic/x-pack-elasticsearch#943)
Original commit: elastic/x-pack-elasticsearch@1b586c7763
2017-04-04 14:25:09 +01:00
Martijn van Groningen 8a87a91897 [ML] Renamed DatafeedJobRunner to DatafeedManager
Original commit: elastic/x-pack-elasticsearch@1228488a2e
2017-04-04 14:55:58 +02:00
Tanguy Leroux 4f1115d7f5 [Test] Reenable Monitoring Bulk tests (elastic/x-pack-elasticsearch#908)
This commit reenables the Monitoring Bulk Api REST tests. The XPackRestIT
now enables/disables the local default exporter before executing the monitoring
 tests, and also waits for the monitoring service to be started before executing
 the test.

Original commit: elastic/x-pack-elasticsearch@10b696198c
2017-04-04 14:44:40 +02:00
Martijn van Groningen 0f9bd3a08d [ML] Removed unused vars / params.
Original commit: elastic/x-pack-elasticsearch@5d3280dbec
2017-04-04 14:21:27 +02:00
David Roberts 1465711762 [ML] Wait for state processing to complete before log processing (elastic/x-pack-elasticsearch#946)
State processing can take a lot longer than log processing, even after
the C++ process has closed its end of the pipe.  The pipe has a buffer,
and indexing the state document(s) in that buffer can take more than a
second.

relates elastic/x-pack-elasticsearch#945

Original commit: elastic/x-pack-elasticsearch@65f5075028
2017-04-04 12:04:01 +01:00
Dimitrios Athanasiou edb8c543ed [ML] Downgrade missing snapshot/quantiles log msg to warn
Original commit: elastic/x-pack-elasticsearch@fb763757d1
2017-04-03 22:18:05 +01:00
Martijn van Groningen 77dff92bef [ML] Use PersistentTasksService#waitForPersistentTaskStatus(...) to wait for job and datafeed status and
use PersistentTasksService#removeTask(...) to force close job and force stop datafeed.

Original commit: elastic/x-pack-elasticsearch@4abcf99f93
2017-04-03 20:40:31 +02:00
David Kyle 5b66c7a7ba [ML] Set job create time on server (elastic/x-pack-elasticsearch#910)
* [ML] Set job create time on server

* Job.Builder serialisation tests

* Make setCreateTime package private

Original commit: elastic/x-pack-elasticsearch@d2d75e0d7b
2017-04-03 18:30:47 +01:00
Dimitris Athanasiou 758b689f51 [ML] Improve validations for datafeed with aggregations (elastic/x-pack-elasticsearch#917)
Adds following validations:

- aggregations must contain date_histogram or histogram at the top level
- a date_histogram has to have its time_zone to UTC (or unset which
  defaults to UTC)
- a date_histogram supports calendar intervals only up to 1 week
to avoid the length variability of longer intervals
- aggregation interval must be greater than zero
- aggregation interval must be less than or equal to the bucket_span

Original commit: elastic/x-pack-elasticsearch@404496a886
2017-04-03 17:55:26 +01:00
Alexander Reelsen 84f08ee02c Tests: Ensure test does not accidentally create similar data structures
Original commit: elastic/x-pack-elasticsearch@e683de4039
2017-04-03 16:55:06 +01:00
Martijn van Groningen f0364b1218 [TEST] increased logging
Original commit: elastic/x-pack-elasticsearch@6aeac48889
2017-04-03 15:45:30 +02:00
David Roberts c0c0818d87 [ML] Fix query of all buckets with expand=true (elastic/x-pack-elasticsearch#932)
Previously if you queried all buckets with the expand=true option
you'd get an error as the code would try to do a search with
from=10000&size=10000.  This PR fixes this problem.

Followup for elastic/x-pack-elasticsearch#832

Original commit: elastic/x-pack-elasticsearch@2a5ca0998c
2017-04-03 14:15:35 +01:00
Martijn van Groningen 51662c83eb [TEST] If bulk item failed then log why.
Original commit: elastic/x-pack-elasticsearch@e7cc96460d
2017-04-03 13:49:43 +02:00
David Kyle 622c5ae166 [ML] Remove JobManagers dependency on JobResultsPerister (elastic/x-pack-elasticsearch#915)
* Remove JobManagers dependency on JobResultsPerister

* Remove unneeded call to refresh the state index

Original commit: elastic/x-pack-elasticsearch@0b2351bba7
2017-04-03 12:00:52 +01:00
David Roberts 2d01c3884b [ML] Don't get stats for jobs that are being deleted (elastic/x-pack-elasticsearch#899)
If jobs are being deleted then the operations required to get stats
could fail with unexpected exceptions.  When stats for multiple jobs
were being requested, this would previously cause the whole operation
to fail.

This commit changes the stats endpoint to ignore jobs that are being
deleted.

Fixes elastic/prelert-legacy#837

Original commit: elastic/x-pack-elasticsearch@6ac141a987
2017-04-03 11:04:34 +01:00
David Roberts c5a2fba70a [ML] Ignore ResourceNotFoundException executing C++ process update (elastic/x-pack-elasticsearch#927)
When this happens it means the job has been deleted, which in turn means
the C++ process has been stopped, so there's no need to send it a message
and hence no problem worth logging a stack trace for.

This differs from elastic/x-pack-elasticsearch#896 because elastic/x-pack-elasticsearch#896 was for a similar situation with
closed jobs, whereas this one is for deleted jobs.

Original commit: elastic/x-pack-elasticsearch@9bb4e98fe7
2017-04-03 10:53:32 +01:00
David Kyle 30745b8dd7 [ML] Wait for model snapshot update when closing the results processor (elastic/x-pack-elasticsearch#916)
* [ML] Wait for model snapshot update when closing the results processor

* Review comments

Original commit: elastic/x-pack-elasticsearch@eeb6c3b8d8
2017-04-03 10:01:21 +01:00
Tanguy Leroux 73ddc2323b [Test] Relax LocalExporterTests on node_stats checks
The test is too rigid on checking the right number of node_stats documented that are collected. It happens if a node takes time to start, the node_stats count % numNodes will always be different than 0.

It also adds more logging for LocalBulk failures.

Original commit: elastic/x-pack-elasticsearch@1ebb20b6f6
2017-04-03 10:36:12 +02:00
Simon Willnauer 5e6bfb9a82 Fix cross cluster search with security (elastic/x-pack-elasticsearch#904)
This commit adds an integration test that runs basic cross cluster search
actions across 2 clusters with security installed. This commit also fixes
several issues with respect to internal actions and proxy actions in the context
of cross cluster search.

Relates to elastic/elasticsearch#23830
relates elastic/x-pack-elasticsearch#892

Original commit: elastic/x-pack-elasticsearch@2e5486c259
2017-04-03 09:53:48 +02:00
Igor Motov 4115336f5a Persistent Tasks: require correct allocation id for status updates (elastic/x-pack-elasticsearch#923)
In order to prevent tasks state updates by stale executors, this commit adds a check for correct allocation id during status update operation.

Original commit: elastic/x-pack-elasticsearch@b94eb0e863
2017-04-01 18:17:07 -04:00
Tanguy Leroux b5a285fd83 [Monitoring] Update LocalExporterTests (elastic/x-pack-elasticsearch#835)
This commit changes the LocalExporterTests so that it now test
various randomized cases in a single test. This should speed up
the test as well as minimize the failures due to multiple start
/stop of the exporter. It also uses the MonitoringBulk API
instead of calling the Exporter instances, which makes more sense
since it is the normal way to index monitoring documents.

Related  elastic/x-pack-elasticsearch#416

Original commit: elastic/x-pack-elasticsearch@f8a4af15cd
2017-04-01 10:42:09 +02:00
Chris Earle 16d963b8e3 [Monitoring] Use 'index_patterns' instead of 'template' (elastic/x-pack-elasticsearch#883)
Original commit: elastic/x-pack-elasticsearch@f1a217b597
2017-03-31 17:17:02 -04:00
Igor Motov d7e4390490 Persistent Tasks: Add waitForPersistentTaskStatus method (elastic/x-pack-elasticsearch#901)
This method allows to wait for tasks to change their status to match the supplied predicate.

Original commit: elastic/x-pack-elasticsearch@9f5d4104a0
2017-03-31 16:05:34 -04:00
Jim Ferenczi 232190df97 Fix field_caps handler expectations
Original commit: elastic/x-pack-elasticsearch@628b96bf4b
2017-03-31 18:49:11 +02:00
Jim Ferenczi 2b9ea83eca Add new field_caps API to the list of known actions and handlers
Original commit: elastic/x-pack-elasticsearch@126b369e1e
2017-03-31 16:52:43 +02:00
David Kyle 461bf314fa [ML] Clear bulk requests after execution (elastic/x-pack-elasticsearch#912)
Original commit: elastic/x-pack-elasticsearch@31a4c7e99a
2017-03-31 15:37:01 +01:00
Martijn van Groningen 878c7a4eb9 [ML] Set the correct close timeout
Original commit: elastic/x-pack-elasticsearch@aa0245cc28
2017-03-31 14:01:49 +02:00
David Kyle 9da2853d12 [ML] Hide AnalysisConfig.latency field if not set (elastic/x-pack-elasticsearch#895)
Original commit: elastic/x-pack-elasticsearch@b2b3567820
2017-03-31 12:08:44 +01:00
Alexander Reelsen d7f3a260fd HttpClient: Add support to limit response size (elastic/x-pack-elasticsearch#765)
In order to be stuck with big responses in the HttpClient, this commit
adds a maximum limit for the response. Defaults to 10MB, can be set to
50 MB max.

relates elastic/x-pack-elasticsearch#263

Original commit: elastic/x-pack-elasticsearch@05c449d4c1
2017-03-31 12:39:25 +02:00
David Roberts 95fd6777a0 [ML] Add 'xpack' into action names to match what the rest of X-Pack does (elastic/x-pack-elasticsearch#909)
Original commit: elastic/x-pack-elasticsearch@36be904ad9
2017-03-31 11:22:53 +01:00
David Roberts 23123b9219 [ML] Add extra Java-side detector validation (elastic/x-pack-elasticsearch#894)
Detector configs are validated both by our C++ and by our Java code.
If the C++ is stricter than the Java then error reporting is poor.
This commit adds two extra validation checks to the Java code that
were already present in the C++ validation.

relates elastic/x-pack-elasticsearch#856

Original commit: elastic/x-pack-elasticsearch@bd4ce2377c
2017-03-31 11:06:30 +01:00
David Roberts 21bac70d87 [ML] Don't log a stack trace when updating a non-open process (elastic/x-pack-elasticsearch#896)
It's possible for a C++ process to exit between the time when a
config update message for it is queued and the time that message
is processed.  This commit ensures we don't spam the log with a
stack trace in this situation, as it's not a problem at all.

relates elastic/x-pack-elasticsearch#891

Original commit: elastic/x-pack-elasticsearch@81af8eaf70
2017-03-31 10:56:46 +01:00
Dimitris Athanasiou 0cb2b18265 [ML] Implement cancellation policy for aggregated datafeeds (elastic/x-pack-elasticsearch#862)
Aggregated data extraction is done in 2 phases:

1. search
2. process response

The first phase cannot be currently cancelled. However, it usually
is the fastest of the two.

The second phase processes the histogram buckets in the search
response into flat JSON and then posts the result stream to the job.
This phase can be split into batches where a few buckets are posted
to the job at a time. Cancelling can then work between batches.

This commit changes the AggregationDataExtractor to process the
search response in batches. The definition of a batch is crucial
as it has to be short enough to allow for responsive cancelling,
yet long enough to minimise overhead due to multiple calls to the
post data action. The number of key-value pairs written by the
processor is a good candidate for a batch size measure. By testing,
1000 seems to be an effective number.

relates elastic/x-pack-elasticsearch#802

Original commit: elastic/x-pack-elasticsearch@ce3a172411
2017-03-31 10:15:43 +01:00
Martijn van Groningen cbfa5b5f0e [TEST] adjusted log levels in tests
Original commit: elastic/x-pack-elasticsearch@eb4e0c2450
2017-03-31 10:58:46 +02:00
Martijn van Groningen fb5ccc7d14 [TEST] increased log level
Original commit: elastic/x-pack-elasticsearch@a8ea83dca0
2017-03-31 10:44:06 +02:00
Martijn van Groningen b4bebfb12f [TEST] Increased timeout
Original commit: elastic/x-pack-elasticsearch@a7170e66dd
2017-03-31 10:34:51 +02:00
Martijn van Groningen aba4760b02 [ML] Fix native process threading protection and restructure ml threadpools
The native process can only handle one operation at a time, so in order the protect against multiple operation at a time (e.g. post data and flush or multiple post data operations) there should be protection in place to guarantee that at most only a single thread interacts with the native process. The current protection is broken when a job close is executed, more specifically the wait logic is broken here.

This commit changes the threading logic when interacting with the native process by using a custom `ExecutorService` that that uses a single worker thread from `ml_autodetect_process` thread pool to interact with the native process. Requests from the ml apis are initially being queued and this worker thread executes these requests one by one in the order they were specified.

Removed the general `ml` threadpool and replaced its usages with `ml_autodetect_process` or `management` threadpool.
Added a new threadpool just for (re)normalizer, so that these operations are isolated from other operations.

relates elastic/x-pack-elasticsearch#582

Original commit: elastic/x-pack-elasticsearch@ff0c8dce0b
2017-03-31 10:07:03 +02:00
Martijn van Groningen 7da4724b15 [ML] Start using AllocatedPersistentTask#updatePersistentStatus(...) instead of PersistentTasksService directly
Original commit: elastic/x-pack-elasticsearch@82a7db17e2
2017-03-31 08:28:40 +02:00
Martijn van Groningen 510be083de [TEST] Verify differently that job has closed due to invalid license
Original commit: elastic/x-pack-elasticsearch@70cc389ca7
2017-03-30 22:28:24 +02:00
Martijn van Groningen 93ee4104fb [TEST] increased logging
Original commit: elastic/x-pack-elasticsearch@4d5f35b9a6
2017-03-30 20:09:16 +02:00
Adrien Grand 52a7f956f4 Tests: Disable `ml/index_layout/Test unrelated index`.
Relates elastic/x-pack-elasticsearch#903

Original commit: elastic/x-pack-elasticsearch@097f559d0b
2017-03-30 19:00:50 +02:00
Simon Willnauer 3abe7a2058 Fix compilation issues after elastic/elasticsearch#23788
Original commit: elastic/x-pack-elasticsearch@ea24170b41
2017-03-30 15:00:41 +02:00
Martijn van Groningen f6d8f92d40 [ML] Use volatile boolean to stop blackhole process
Original commit: elastic/x-pack-elasticsearch@3788c7f0cf
2017-03-30 14:54:21 +02:00
Alexander Reelsen 5b2351fad0 Watcher: Improve assertion output in flaky test
The slack tests seem to fail periodically with not output
This commit tries to add some more verbose output by
making the query more broad and take failures into account
to uncover, what happens in this test.

Relates elastic/x-pack-elasticsearch#836

Original commit: elastic/x-pack-elasticsearch@e601b3a0df
2017-03-30 14:50:55 +02:00
Alexander Reelsen dfc21c56be Watcher: Fix BasicSecurityTests.testWatcherMonitorRole
The test tried to create a watches index, that could have been
created by the test infrastructure already (to check if aliases
are supported).

relates elastic/x-pack-elasticsearch#837

Original commit: elastic/x-pack-elasticsearch@29714b2368
2017-03-30 14:03:37 +02:00
David Roberts f49dee89cb [TEST] Adjust expected error message
This was forgotten in elastic/x-pack-elasticsearch@2dbe41caaa

Original commit: elastic/x-pack-elasticsearch@8f7c4c32f4
2017-03-30 11:56:36 +01:00
Dimitris Athanasiou d33bce2ed2 [ML] Add job closing notification (elastic/x-pack-elasticsearch#893)
relates elastic/x-pack-elasticsearch#878

Original commit: elastic/x-pack-elasticsearch@921c25537a
2017-03-30 11:53:00 +01:00
Dimitris Athanasiou 12fd8e04e5 [ML] Allow marking a model snapshot with retain (elastic/x-pack-elasticsearch#880)
This change adds a retain field to model snapshots.
A user can set retain to true/false via the update model snapshot API.
Model snapshots with retain set to true will not be deleted by
the daily maintenance service regardless of whether they expired.

This allows users to keep always keep certain snapshots around for
potentially reverting to in the future.

relates elastic/x-pack-elasticsearch#758

Original commit: elastic/x-pack-elasticsearch@2283989a33
2017-03-30 11:48:36 +01:00
Dimitris Athanasiou 379b800c9f [ML] Handle usage call when MlMetadata is not yet installed (elastic/x-pack-elasticsearch#890)
Original commit: elastic/x-pack-elasticsearch@495286d4ba
2017-03-30 10:55:36 +01:00
David Roberts 72f5e92972 [ML] Adjust error to make sense for FAILED as well as CLOSED jobs (elastic/x-pack-elasticsearch#888)
Previously trying to perform an operation on a FAILED job would tell
you that it hadn't been opened.  This was very confusing if you knew
very well you'd just opened the job.

Relates elastic/x-pack-elasticsearch#879

Original commit: elastic/x-pack-elasticsearch@2dbe41caaa
2017-03-30 10:33:56 +01:00
Martijn van Groningen 9f63dba26c [ML] No need to create an InternalClient instance, because it can be injected.
Original commit: elastic/x-pack-elasticsearch@0cca0cd569
2017-03-30 09:11:46 +02:00
Martijn van Groningen f2654b5872 [ML] Changed job and datafeed lifecycle management
* Removed OPENING and CLOSING job states. Instead when persistent task has been created and
   status hasn't been set then this means we haven't yet started, when the executor changes it to STARTED we have.
   The coordinating node will monitor cs for a period of time until that happens and then returns or times out.
* Refactored job close api to go to node running job task and close job there.
* Changed unexpected job and datafeed exception messages to not mention the state and instead mention that job/datafeed haven't yet started/stopped.

Original commit: elastic/x-pack-elasticsearch@37e778b585
2017-03-29 20:35:10 +02:00
Chris Earle 905fa16f81 [Monitoring] Add .monitoring-alerts-2 Index Template (elastic/x-pack-elasticsearch#819)
Add the `.monitoring-alerts-2` index template via the exporter. This
avoids a very common problem where the user wipes out their monitoring
indices manually, which means that the watches would then create an index
with a dynamic mappings.

This adds a mechanism for posting a template that is not associated with a
Resolver (convenient for the forthcoming work _and_ for a future Logstash
index).

Original commit: elastic/x-pack-elasticsearch@a4cfc48191
2017-03-29 13:24:22 -04:00
Igor Motov 4bb9e00dbf Persistent Tasks: Remove unused stopped and removeOnCompletion flags (elastic/x-pack-elasticsearch#853)
The stopped and removeOnCompletion flags are not currently used, this commit removes them for now to simplify things.

Original commit: elastic/x-pack-elasticsearch@c636c2817e
2017-03-29 12:54:44 -04:00
Zachary Tong 0d202d3d36 Bump ChunkedDataExtractor logging down to DEBUG
Related elastic/x-pack-elasticsearch#866

Original commit: elastic/x-pack-elasticsearch@f510101be2
2017-03-29 12:16:36 -04:00
David Roberts 979d232faa [ML] Set jobs to FAILED state if C++ process dies unexpectedly (elastic/x-pack-elasticsearch#876)
Previously a `kill -9` on the `autodetect` process associated with a
job would leave the job in the OPENED state.

Now if the C++ process dies before a request to close the job is made
then the job state is set to FAILED.

For this purpose C++ process death is defined as end-of-file on the
log stream.  (Technically it would be possible to get end-of-file on
the log stream while the C++ process was still running, but this
would also represent an unexpected and undesirable situation.)

Original commit: elastic/x-pack-elasticsearch@2b74c56a79
2017-03-29 16:23:58 +01:00
Robin Clarke de061597fa Fix grammar in users tool help message
This commit fixes some grammar in the additional help provided by the
users tool.

Relates elastic/x-pack-elasticsearch#826

Original commit: elastic/x-pack-elasticsearch@49c86576d6
2017-03-29 10:42:19 -04:00
David Kyle a85b18e70b Don’t write the usePerPartitionNormalization field unless it is set to true (elastic/x-pack-elasticsearch#873)
Original commit: elastic/x-pack-elasticsearch@db7cd6993d
2017-03-29 15:09:14 +01:00
Daniel Mitterdorfer e5b7148fee Silence ExpirationCallbackTests#testPreExpirationScheduleTime()
Relates elastic/x-pack-elasticsearch#869

Original commit: elastic/x-pack-elasticsearch@fcba6847a0
2017-03-29 09:00:35 +02:00
David Roberts 7eece908b2 [ML] Remove obsolete TODO
It has been decided that filebeat will be used to index ES logs

Original commit: elastic/x-pack-elasticsearch@98f2169429
2017-03-28 16:58:41 +01:00
Martijn van Groningen 2357afd91b [TEST] Use search api to retrieve data counts instead of via get job stats api.
This to avoid to lose data counts when the job gets restarted on another node.
The job stats api returns live data counts, which may not have been persisted to an index,
so getting the data counts via search api will give us a better guarantee that when
the job gets restarted the datacounts are there too. During job restart a get call is being
done to get data counts in the order to initialize the job.

Original commit: elastic/x-pack-elasticsearch@901952da85
2017-03-28 17:10:25 +02:00
David Kyle 42e3eb7ba5 [ML] Use default number of replicas (elastic/x-pack-elasticsearch#861)
Original commit: elastic/x-pack-elasticsearch@7d3d00d196
2017-03-28 15:50:16 +01:00
Tanguy Leroux 642bdb6cd9 [Test] Mute IndicesStatsTests
See https://github.com/elastic/x-pack-elasticsearch/issues/496

Original commit: elastic/x-pack-elasticsearch@80aa60bc27
2017-03-28 16:29:57 +02:00
Colin Goodheart-Smithe b5dadc733b Make Filter actions extend HandledTransportAction (elastic/x-pack-elasticsearch#859)
Previously the GET/PUT/DELETE filters actions were master node actions. This is not necessary since the filters are stored in an index rather than the cluster state. This change makes the actions extend `HandledTransportAction` so they can be run on any node.

The change also makes PutFilterAction.TransportAction use the TransportBulkAction instead of the deprecated TransportIndexAction.

relates elastic/x-pack-elasticsearch#756

Original commit: elastic/x-pack-elasticsearch@c6df04382e
2017-03-28 15:02:39 +01:00
Tanguy Leroux b642ba6351 [Monitoring] Make MonitoringDoc immutable (elastic/x-pack-elasticsearch#785)
This commit makes the MonitoringDoc immutable and removes the type() and id() methods from "resolvers" so that they are not anymore in charge of computing the documents types and ids. Now each MonitoringDoc knows its type and is able to compute its own id if needed.

Original commit: elastic/x-pack-elasticsearch@5161cedcc8
2017-03-28 15:20:08 +02:00
David Roberts 70f621ed7e Remove duplicate actions from transport actions list
Original commit: elastic/x-pack-elasticsearch@da1226ee46
2017-03-28 11:10:44 +01:00
David Kyle fca0feb02d Tidy up (elastic/x-pack-elasticsearch#854)
Original commit: elastic/x-pack-elasticsearch@701407ecf5
2017-03-28 09:56:54 +01:00
Colin Goodheart-Smithe 99db6013ea [ML] Adds a test for ml transport client (elastic/x-pack-elasticsearch#851)
This change also adds synchronous methods to `MachineLearningClient`.

relates elastic/x-pack-elasticsearch#567

Original commit: elastic/x-pack-elasticsearch@b3a4b38a51
2017-03-28 09:05:55 +01:00
Jason Tedor eac00c6a9d Mark x-pack plugin as having native controller
This commit marks the x-pack plugin as having a native controller. This
is now a requirement in core for any plugin that forks a native process
to display a warning to the user when they install the plugin.

Relates elastic/x-pack-elasticsearch#839

Original commit: elastic/x-pack-elasticsearch@3529250023
2017-03-27 15:53:03 -04:00
Igor Motov 9fc6ce83ee Persistent Tasks: Merge NodePersistentTask and RunningPersistentTask (elastic/x-pack-elasticsearch#842)
Refactors NodePersistentTask and RunningPersistentTask into a single AllocatedPersistentTask. Makes it possible to update Persistent Task Status via AllocatedPersistentTask.

Original commit: elastic/x-pack-elasticsearch@8f59d7b819
2017-03-27 14:21:01 -04:00
David Kyle 9b4d399fc3 [ML] Fix bug deleting job with missing alias (elastic/x-pack-elasticsearch#850)
Original commit: elastic/x-pack-elasticsearch@44fd88a834
2017-03-27 17:47:29 +01:00
Alexander Reelsen f3c4ec8a81 Watcher: Allow multiple email addresses for to/cc/bcc (elastic/x-pack-elasticsearch#661)
All of our code supports configuring email addresses in the
email action not only via a JSON array, but also via a comma
separated value (we also have tests for this). However in one bit
we did not support this, where an email template is rendered to
a concrete email.

This commit fixes the last piece, so that users will be able to
specify comma separated email adresses.

The main use case for this is having an array of email addresses,
that can be joined in mustache with a comma in order to send to
several recipients.

Original commit: elastic/x-pack-elasticsearch@19794ba612
2017-03-27 16:56:43 +02:00
Martijn van Groningen fc29fd159a [TEST] Don't lose the actual cause of the exception.
Original commit: elastic/x-pack-elasticsearch@8720288ef5
2017-03-27 15:33:04 +02:00
Dimitrios Athanasiou c0a6b6741e [ML] Improve notification message for shard failures in datafeed
relates elastic/x-pack-elasticsearch#804

Original commit: elastic/x-pack-elasticsearch@2114f94937
2017-03-27 13:52:18 +01:00
Dimitris Athanasiou 27a313c07d [ML] Correctly initialise model size stats on job reopen (elastic/x-pack-elasticsearch#822)
This commit ensures that upon reopening a job, the in-memory
model size stats are correctly initialized from the ones
last persisted in the results index.

This fixes the bug that could be seen upon opening a job
that has processed data and immediately calling its _stats
API only to see the model size stats are zero.

In addition, this PR refactors getting the parameters needed to
open an autodetect job:

- Previously, there was a method chaining together multiple
callbacks to the job provider.
- These methods were retrieving data via GETs which is not
going to work with index rollover.

Note, this PR is not eliminating all GETs. More work is needed
to fully support index rollover.

relates elastic/x-pack-elasticsearch#801

Original commit: elastic/x-pack-elasticsearch@1ef1d44b32
2017-03-27 13:17:44 +01:00
Dimitris Athanasiou 9cd21cca4b [ML] Use default number_of_shards for results and state indices (elastic/x-pack-elasticsearch#849)
Like other x-pack features, these indices are best created with
default number_of_shards. Users can adjust the setting by editing
the respective templates.

relates elastic/x-pack-elasticsearch#723

Original commit: elastic/x-pack-elasticsearch@1d688993be
2017-03-27 13:08:19 +01:00
Alexander Reelsen 374be8b732 Watcher: Support arrays in http response payload (elastic/x-pack-elasticsearch#793)
The xcontent parser was only set to read all data to a map
which did not work, when the returned data was in form of an
array (for example the cat API is doing this, if the response
format is set to JSON).

relates elastic/x-pack-elasticsearch#351

Original commit: elastic/x-pack-elasticsearch@08ad457bf6
2017-03-27 10:22:22 +02:00
Martijn van Groningen 6709b43b97 [ML] Remove redundant comment
Original commit: elastic/x-pack-elasticsearch@7d3d1fdfb5
2017-03-27 09:05:11 +02:00
Martijn van Groningen ea273ab67e [ML] Made fields volatile or final
Original commit: elastic/x-pack-elasticsearch@c9478e2da4
2017-03-24 19:36:12 +01:00
Zachary Tong 4285335dfb [ML] Add a 'force' parameter to CloseJob and StopDataFeed endpoints (elastic/x-pack-elasticsearch#710)
If forced, the internal RemovePersistentTasks API is invoked instead of going through
ML.  This will remove the task, which should trigger the task framework to do
necessary cleanup.

At that point, the Delete* APIs interpret a missing task as CLOSED/STOPPED,
so they can be removed regardless of the original state.

Original commit: elastic/x-pack-elasticsearch@bff23c7840
2017-03-24 13:10:20 -04:00
Martijn van Groningen 1d660f373f [ML] Only push live update if job is opened
Original commit: elastic/x-pack-elasticsearch@5318d65012
2017-03-24 16:32:38 +01:00
Colin Goodheart-Smithe 60a3fbff85 [TEST] Roce ML post data test to use just JSON
This is temporary will we investigate why the test fails when SMILE is used

Original commit: elastic/x-pack-elasticsearch@55c7983a21
2017-03-24 15:23:51 +00:00
David Roberts f816a5708c [ML] Rename action now it's run by _xpack instead of _system (elastic/x-pack-elasticsearch#831)
The _xpack user cannot run internal actions

Original commit: elastic/x-pack-elasticsearch@2dc4a30582
2017-03-24 15:20:20 +00:00
Zachary Tong d33cbaf9be Remove unnecessary norelease
Original commit: elastic/x-pack-elasticsearch@a3bd568a72
2017-03-24 10:28:58 -04:00
Colin Goodheart-Smithe fd54515ecb [ML] Support all XContent types in Data API (elastic/x-pack-elasticsearch#812)
* [ML] Support all XContent types in Data API

This changes the POST Data API so that it accepts all XContent types instead of just JSON.

For now the datafeed is restricted to only sending JSON to the POST data API.

* Rename SimpleJsonRecordReader to XContentRecordReader

Also renames `DataFormat.JSON` to `DataFormat.XCONTENT`

* fixes YAML tests

Original commit: elastic/x-pack-elasticsearch@5fd20690b8
2017-03-24 12:57:02 +00:00
Dimitris Athanasiou 73434dadeb [ML] Remove recursion in bucket expansion (elastic/x-pack-elasticsearch#832)
Relates elastic/x-pack-elasticsearch#752

Original commit: elastic/x-pack-elasticsearch@85392296a5
2017-03-24 12:51:22 +00:00
Dimitrios Athanasiou 28d6b505ed [ML] Minor refactoring to improve code readability
Original commit: elastic/x-pack-elasticsearch@ef2d5fcab6
2017-03-24 10:52:38 +00:00
Martijn van Groningen c85498462c [ML] Replaced norelease with regular todo
Original commit: elastic/x-pack-elasticsearch@c4c8955c3f
2017-03-24 11:46:34 +01:00
Dimitris Athanasiou 1cfd9bd986 [ML] Add ml jobs and datafeeds in usage API (elastic/x-pack-elasticsearch#805)
This adds basic info about jobs and datafeeds, sufficient
for the first release for supporting monitoring and
phone-home.

In particular, usage now displays:

- job count for _all and by state
- detectors statistics (min, max, mean, total) for _all jobs and by job state
- model size statistics (min, max, mean, total) for _all jobs and by job state
- datafeed count for _all and by state

Relates elastic/x-pack-elasticsearch#660

Original commit: elastic/x-pack-elasticsearch@6e0da6c3db
2017-03-24 10:42:12 +00:00
Colin Goodheart-Smithe ea67089cef [ML] Cleans up some NORELEASES (elastic/x-pack-elasticsearch#830)
This change cleans up some NORELEASE comments that are either no longer relevant or actually should be TODO comments

Original commit: elastic/x-pack-elasticsearch@9947f1176e
2017-03-24 10:11:05 +00:00
Dimitrios Athanasiou cc5c34e037 [TEST] Fix open_time assertions
Original commit: elastic/x-pack-elasticsearch@a26425970c
2017-03-24 09:53:29 +00:00
Martijn van Groningen 96f4a72825 [ML] Change how update job api delegates config changes to autodetect process
Submit job updates to a concurrent queue when job update has been processed by ClusterService. Then from a background thread delegate the job updates to the node running the autodetect process. This maintains the same order as how the job config updates have occurred to the cluster state and thus preventing job config updates to the same job to arrive in the wrong order to the job's autodetect process. (the expectation is that in practise this will rarely happen)

The behaviour of the update api changes with this pr, because the api now returns when the update has been made to cluster state, whereas before it would return when the update was made to the autodetect process too. Updating the autodetect process happens in the background. I think that this change in behaviour is acceptable.
Use TP#scheduleWithFixedDelay(...) instead of TP#schedule(...) and
removed the custom rescheduling and cancelling.
Also changed LocalNodeMasterListener#executorName to SAME

Original commit: elastic/x-pack-elasticsearch@c24c0dd7d7
2017-03-24 09:30:55 +01:00
Hendrik Muhs f687f3ea6e [ML] fix test mix up of millisecond with second (elastic/x-pack-elasticsearch#816)
Fix spurious Test failure

fix test resolution bug: mix up of millisecond with second

Original commit: elastic/x-pack-elasticsearch@37b8fed559
2017-03-24 08:11:38 +01:00
Dimitrios Athanasiou 061e3fc1fe [TEST] fix open_time in jobs_get_stats YAML test
Original commit: elastic/x-pack-elasticsearch@2a1c62ab3c
2017-03-23 19:33:26 +00:00
Martijn van Groningen 1bed557911 [ML] Fork on management thread when really opening the job
Original commit: elastic/x-pack-elasticsearch@e528912c23
2017-03-23 19:48:11 +01:00
Dimitris Athanasiou 99e3508267 [ML] Change chunking_config.time_span into a TimeValue (elastic/x-pack-elasticsearch#808)
Original commit: elastic/x-pack-elasticsearch@42d7b06e3f
2017-03-23 18:45:53 +00:00
Zachary Tong e739d86f00 Replace norelease with TODO
Not a blocker, issue opened under elastic/x-pack-elasticsearch#821

Original commit: elastic/x-pack-elasticsearch@d46f6bc556
2017-03-23 13:14:10 -04:00
Zachary Tong c680b79641 Remove norelease
Issue elastic/x-pack-elasticsearch#820 filed to track progress of better error handling, but not a blocker so removing
the norelease

Original commit: elastic/x-pack-elasticsearch@82cf6eebe2
2017-03-23 13:07:50 -04:00
Zachary Tong cf6bca96db Remove norelease and adjust audit logging
Audit logging in wrong location.  Norelease removed because the proper solution
will take some more work, and this edge-case is not likely to be run into frequently.

More details in elastic/x-pack-elasticsearch#818

Original commit: elastic/x-pack-elasticsearch@ab0d731abf
2017-03-23 13:01:37 -04:00
Igor Motov fba5c09e3d Persistent Tasks: remove task restart on failure (elastic/x-pack-elasticsearch#815)
If a persistent task throws an exception, the persistent tasks framework will no longer try to restart the task. This is a temporary measure to prevent threshing the cluster with endless restart attempt. We will revisit this in the future version to make the restart process more robust. Please note, however, that if node executing the task goes down, the task will still be restarted on another node.

Original commit: elastic/x-pack-elasticsearch@30712e0fbf
2017-03-23 12:56:48 -04:00
Hendrik Muhs 6f7f466fa3 [ML] move DataStreamDiagnostics into DataCountsReporter (elastic/x-pack-elasticsearch#775)
repair DataStreamDiagnostics

Moves DataStreamDiagnostics into DataCountsReporter to survive if job is opened/closed/fed in chunks.

relates elastic/x-pack-elasticsearch#764

Original commit: elastic/x-pack-elasticsearch@29c221a451
2017-03-23 16:43:51 +01:00
Martijn van Groningen bb9befcdcb [ML] Include MlMetadata in all xcontent contexts.
Original commit: elastic/x-pack-elasticsearch@e870b5bf6d
2017-03-23 16:10:24 +01:00
Colin Goodheart-Smithe dde0570296 [ML] Removes direct dependency on Jackson Parser (elastic/x-pack-elasticsearch#810)
* [ML] Removes direct dependency on Jackson Parser

The classes that read data from the post data action ready to write to the autodetect process had a direct dependency on Jackson’s `Parser` class. This changes makes those classes depend on XContent instead making them consistent with the way we parse requests and data across Elasticsearch and X-Pack.

* Simplify json record reader

This commit removes the unnecessary `AbstractJsonRecordReader` and `JsonRecordReader` interfaces/classes. These are not required as we do and should only have one implementation of reading json records.

Original commit: elastic/x-pack-elasticsearch@366b8af943
2017-03-23 13:56:32 +00:00
David Roberts 7756067e5d [ML] Check underlying index permissions on datafeed PUT (elastic/x-pack-elasticsearch#809)
Also added a test to ensure underlying index permissions are required
for datafeed preview.

Relates elastic/x-pack-elasticsearch#648

Original commit: elastic/x-pack-elasticsearch@6edadbb401
2017-03-23 13:56:04 +00:00
Martijn van Groningen 93d7b8c14b [ML] State check doesn't need to know if task is stale now that task validation is only done at create time.
Original commit: elastic/x-pack-elasticsearch@d19858240b
2017-03-23 14:40:20 +01:00
Martijn van Groningen df86125a7d [TEST] Adjust assertions.
Original commit: elastic/x-pack-elasticsearch@39b289a4d9
2017-03-23 11:34:39 +01:00
Colin Goodheart-Smithe 795a00ddab Removes unnecessary NORELEASE for ML endpoint
Original commit: elastic/x-pack-elasticsearch@bbb203665b
2017-03-23 08:47:37 +00:00
Tim Vernum 3e0f785f0c Add ldap_dn and ldap_groups to user meta-data (elastic/x-pack-elasticsearch#739)
In the LdapRealm, include the user's DN and the list of groups (the DN for each group) in the User object
This allows this information to be referenced in templated roles.

Closes: elastic/x-pack-elasticsearch#729

Original commit: elastic/x-pack-elasticsearch@065f337109
2017-03-23 15:38:57 +11:00
Zachary Tong cc7a1a821f [ML] Load resource and split into keys manually (elastic/x-pack-elasticsearch#786)
Manually loads the resources, splits the lines and fills the map instead of using the ResourceBundle stuff. 

relates elastic/x-pack-elasticsearch#750 

Original commit: elastic/x-pack-elasticsearch@25ff4d5d19
2017-03-22 15:24:47 -04:00
Igor Motov 5c4933f5ea Make PersistentAction independent from TransportActions (elastic/x-pack-elasticsearch#742)
Removes the transport layer dependency from PersistentActions, makes PersistentActionRegistry immutable and rename actions into tasks in class and variable names.

Original commit: elastic/x-pack-elasticsearch@e3e5b79c28
2017-03-22 14:02:30 -04:00
Martijn van Groningen d779bf66a5 [ML] Also serialize the job id in a update job request.
Relates to elastic/x-pack-elasticsearch#787 and elastic/x-pack-elasticsearch#799

Original commit: elastic/x-pack-elasticsearch@fc64d25bcb
2017-03-22 18:09:10 +01:00
Martijn van Groningen 6ddc626c17 [ML] Never restart job locally upon cancel
Relates to elastic/x-pack-elasticsearch#749

Original commit: elastic/x-pack-elasticsearch@6943d75178
2017-03-22 17:09:19 +01:00
Martijn van Groningen f20efa7152 [ML] Renamed action names from */anomaly_detectors/* to */job/*
The action name is currently inconsistent with the class name.
Also as more types of jobs will be added, they should reuse the existing actions,
so it make more sense to gave a generic job name for the action name. Note that
it is ok to have additional rest handlers for new type of jobs.

Original commit: elastic/x-pack-elasticsearch@a70d46fb8a
2017-03-22 16:47:27 +01:00
Martijn van Groningen a59badf842 [ML] Restore model state as part of opening a job.
Before the model state was restored in the background when the job was already opened.

 relates elastic/x-pack-elasticsearch#751

Original commit: elastic/x-pack-elasticsearch@44a3d98365
2017-03-22 16:33:03 +01:00
Jay Modi 85aedb6776 Cancel LDAP runnables if they are pending execution too long (elastic/x-pack-elasticsearch#727)
The LdapRealm submits runnables to the generic thread pool when a bind is necessary as a bind must
be a synchronous operation and we do not want to block network threads on this. However, the
generic threadpool could be full and this runnable could get queued. When this happens requests
appear to hang; to prevent this we submit a delayed executable that will stop the runnable from
attempting to connect to Ldap and provide an exceptional response to the listener.

relates elastic/x-pack-elasticsearch#716

Original commit: elastic/x-pack-elasticsearch@3e43b17f1d
2017-03-22 05:27:46 -07:00
Jay Modi 8ba6e8b3eb Fix merging of field level security rules (elastic/x-pack-elasticsearch#796)
This commit fixes the merging of field level security rules from multiple roles. Prior to 5.2, the
merging was treated as the merging of languages whereas after 5.2, this incorrectly became a merge
of all rules meaning a single wildcard could cause denials to be ignored.

Original commit: elastic/x-pack-elasticsearch@42f9e6d8b0
2017-03-22 05:10:30 -07:00
Martijn van Groningen 3f5d9850ae [ML] Removed public constructors for testing.
Original commit: elastic/x-pack-elasticsearch@a5d45f2b66
2017-03-22 10:52:18 +01:00
Martijn van Groningen c12d487c01 [ML] Make fields final
Original commit: elastic/x-pack-elasticsearch@49c7d79835
2017-03-22 10:46:59 +01:00
Ryan Ernst 8a8ed1cfbb Plugins: Update jarhell calls with new set based api (elastic/x-pack-elasticsearch#743)
This is the xpack side of elastic/elasticsearch#23596

Original commit: elastic/x-pack-elasticsearch@d1654b1ccd
2017-03-21 12:13:37 -07:00
Dimitris Athanasiou f7c4c754c2 [ML] Accept 'now' in start/end params of start datafeed API (elastic/x-pack-elasticsearch#784)
The params start/end of the start datafeed API now accept
'now' as a value.

Also adds a validation that start must be earlier than end.

relates elastic/x-pack-elasticsearch#781

Original commit: elastic/x-pack-elasticsearch@5396dcb5e8
2017-03-21 17:05:36 +00:00
Jay Modi 72248adcbb Asynchronous export of monitoring data (elastic/x-pack-elasticsearch#718)
This commit removes the blocking invocation of bulk requests in monitoring as in some cases this
can lead to exhaustion of the generic threadpool, which effectively prevents the node from
operating normally.

One behavior change that is made by this commit is the MonitoringService will no longer wait
indefinitely when closing as this can lead to a node blocking forever and never shutting down.
Instead a wait of 10 seconds is added, which aligns with the security index audit trail's behavior
on shutdown.

relates elastic/x-pack-elasticsearch#715

Original commit: elastic/x-pack-elasticsearch@5ba7f49aab
2017-03-21 12:15:13 -04:00
Dimitris Athanasiou 58827dd433 [ML] Do not advance time when datafeed encounters extraction problems (elastic/x-pack-elasticsearch#782)
Original commit: elastic/x-pack-elasticsearch@fcc9af6869
2017-03-21 14:50:10 +00:00
Martijn van Groningen cb5d44c9c4 [ML] Don't assign cancel holders to node tasks, but use the services that stop datafeed and jobs directly.
Relates to elastic/x-pack-elasticsearch#749

Original commit: elastic/x-pack-elasticsearch@ff074b0442
2017-03-21 15:30:13 +01:00
Martijn van Groningen 6fae1867ec [ML] Uses AbstractRunnable for running datafeed, so that we handle rejected execution exceptions.
Original commit: elastic/x-pack-elasticsearch@d04d3fa401
2017-03-21 14:18:09 +01:00
Martijn van Groningen dd91ac0cd3 [ML] Don't use default locale.
Original commit: elastic/x-pack-elasticsearch@f1e5016008
2017-03-21 13:28:11 +01:00
Martijn van Groningen 4f5b3dfea3 [ML] Set ml' tp queue sizes to a reasonable level.
Original commit: elastic/x-pack-elasticsearch@7f7b2defcd
2017-03-21 13:09:46 +01:00
Dimitris Athanasiou 62721c78ea [ML] Make ModelSnapshot immutable (elastic/x-pack-elasticsearch#770)
In preparation of extending the model snapshot update API,
it makes sense to make it immutable to avoid any confusion
that could be caused by having setters on it.

I also like immutable stuff :-)

Original commit: elastic/x-pack-elasticsearch@6b2ee527a8
2017-03-21 12:00:54 +00:00
Martijn van Groningen 7cf959cb66 [ML] renamed getter as it overwrote super method that was used for a different purpose.
Original commit: elastic/x-pack-elasticsearch@a8b70e769b
2017-03-21 11:24:41 +01:00
Alexander Reelsen ce0391f3c7 Watcher: Update dependencies (elastic/x-pack-elasticsearch#613)
Updated dependencies for javax.activation and mail to latest versions.

Original commit: elastic/x-pack-elasticsearch@d73529f98f
2017-03-21 10:28:20 +01:00
Alexander Reelsen 0c7c2f521c Watcher: Remove scheduler based trigger engine (elastic/x-pack-elasticsearch#724)
The scheduler based trigger engine is not enabled by default
as the ticker based trigger engine is used. As we dont use it
in production, this commit removes this specific implementation.

It also removes some uneeded abstractions like AbstractTriggerEngine, TriggerEngine.Listener and TriggerEngine.Job

Original commit: elastic/x-pack-elasticsearch@b17a2e9d62
2017-03-21 10:27:41 +01:00
Jay Modi 1a7e842c15 Make XPackFeatureSet#usage calls asynchronous (elastic/x-pack-elasticsearch#738)
This commit makes the XPackFeatureSet#usage calls asynchronous. Previously these were synchronous
calls that would execute a multi-search request from the currently elected master node in a blocking
fashion. The multi-search request is now executed asynchronously.

relates elastic/x-pack-elasticsearch#213

Original commit: elastic/x-pack-elasticsearch@a0cb988442
2017-03-20 14:23:04 -04:00
Boaz Leskes e3d244164c testSendMessage: log message request/response on failures
Original commit: elastic/x-pack-elasticsearch@591284dced
2017-03-20 19:09:16 +01:00
Dimitris Athanasiou 025461c3c8 [ML] Correctly collect datafeed stats for _all (elastic/x-pack-elasticsearch#776)
Datafeed state was always stopped when the stats
endpoint was called with _all. The reason is that
_all was not being expanded into all datafeed IDs.

This commit fixes the issue by expanding _all into
all datafeed IDs in the cluster. Stats are then fetched
for all of them.

relates elastic/x-pack-elasticsearch#693

Original commit: elastic/x-pack-elasticsearch@ccbdb35b6e
2017-03-20 17:51:36 +00:00
David Roberts f96a40c61a [ML] Rename score fields (elastic/x-pack-elasticsearch#769)
* Rename normalized_probability to record_score
* Rename anomaly_score on influencers to influencer_score
* Remove record level anomaly_score
* Remove bucket level max_normalized_probability

Relates elastic/x-pack-elasticsearch#678

Original commit: elastic/x-pack-elasticsearch@c2c05e73d8
2017-03-20 16:19:52 +00:00
Martijn van Groningen 47e28669b3 [TEST] Fix expected error message
Original commit: elastic/x-pack-elasticsearch@5a60b66b4a
2017-03-20 15:07:13 +01:00
Martijn van Groningen 2c8545f38f [TEST] Don't rely on `new Date()` (2)
Relates elastic/x-pack-elasticsearch#746

Original commit: elastic/x-pack-elasticsearch@f1ccdf89f0
2017-03-20 13:19:30 +01:00
Dimitrios Athanasiou 3e8b45f2a2 Revert "[TEST] Muted failing tests, see elastic/x-pack-elasticsearch#771"
This reverts commit elastic/x-pack-elasticsearch@014ae38d5b.

Original commit: elastic/x-pack-elasticsearch@c34a5bcc60
2017-03-20 12:06:14 +00:00
Martijn van Groningen 67e4544267 [TEST] making failing restrictions tighter.
Original commit: elastic/x-pack-elasticsearch@b22352a5ba
2017-03-20 12:27:53 +01:00
Martijn van Groningen 06277c3677 [ML] Upon job close validate if datafeed has been stopped
and fail otherwise.

Original commit: elastic/x-pack-elasticsearch@d13bfe1041
2017-03-20 12:03:52 +01:00
Martijn van Groningen 06ce981fed [TEST] Don't rely on `new Date()`
relates elastic/x-pack-elasticsearch#746

Original commit: elastic/x-pack-elasticsearch@11879958b6
2017-03-20 09:20:05 +01:00
David Roberts aa02fa85da [ML] Reduce caching time for native code dependency to 0 (elastic/x-pack-elasticsearch#772)
Prior to this change the integration tests could fail for up to 24
hours after a change to the C++ output format

Original commit: elastic/x-pack-elasticsearch@b8d9fa0adb
2017-03-19 15:58:19 +00:00
Hendrik Muhs 7832783122 [ML] Rename model plot elastic/x-pack-elasticsearch#284 (elastic/x-pack-elasticsearch#753)
Rename model_debug_output to model_plot

The model debug output is 1 result type of the autodetect (anomaly detection) process reporting bounds/statistics/state - not anomalies - It's main usage as of time of writing is visualization in the UI, naming the 'blue shadow' under the result graph. Rename in order to remove 'debug' in the name

Original commit: elastic/x-pack-elasticsearch@86de428512
2017-03-19 11:55:06 +01:00
Martijn van Groningen a76232f5e4 [TEST] Muted failing tests, see elastic/x-pack-elasticsearch#771
Original commit: elastic/x-pack-elasticsearch@014ae38d5b
2017-03-18 12:26:07 +01:00
Dimitris Athanasiou ca931f4b39 [ML] Default model_snapshots_retention_days to 1 (elastic/x-pack-elasticsearch#759)
relates elastic/x-pack-elasticsearch#722

Original commit: elastic/x-pack-elasticsearch@e68aaf229c
2017-03-17 17:56:46 +00:00
David Kyle 30ea37943c [ML] Change delimiter in the names of state docs (elastic/x-pack-elasticsearch#768)
Original commit: elastic/x-pack-elasticsearch@34acda3ffe
2017-03-17 17:18:52 +00:00
Martijn van Groningen 9d4e3efad4 [ML] Fix deleteCategorizerState() by using delete by query instead of individual blocking delete requests.
Original commit: elastic/x-pack-elasticsearch@f28cc9fc5b
2017-03-17 11:54:31 +01:00
David Kyle a7d42f3732 Delete state in the JobStorageDeletionTask (elastic/x-pack-elasticsearch#702)
Original commit: elastic/x-pack-elasticsearch@272b0894c5
2017-03-17 09:37:28 +00:00
Ali Beyad 407cc3a9d7 Only allow platinum licenses to use custom role providers (elastic/x-pack-elasticsearch#748)
This commit restricts custom role providers to only apply to those
instances of x-pack with a platinum level license.  All other license
types will not be allowed to use custom role providers.  Any custom role
providers implemented via the XPackExtension will not take effect unless
the license is platinum.

relates elastic/x-pack-elasticsearch#720

Original commit: elastic/x-pack-elasticsearch@4fc35494ee
2017-03-16 13:47:35 -04:00
Dimitris Athanasiou 16efd4e474 [ML] Use TimeValue in job and datafeed configs (elastic/x-pack-elasticsearch#732)
relates elastic/x-pack-elasticsearch#679

Original commit: elastic/x-pack-elasticsearch@891edd5bfe
2017-03-16 14:07:47 +00:00
Dimitris Athanasiou 6c9727c2db [ML] Change default data_description to JSON (elastic/x-pack-elasticsearch#707)
relates elastic/x-pack-elasticsearch#674

Original commit: elastic/x-pack-elasticsearch@efc5f4a269
2017-03-16 11:48:57 +00:00
Tanguy Leroux 803654d9bf [Test] Mute MonitoringBulkTests
Related issue: https://github.com/elastic/x-pack-elasticsearch/issues/353

Original commit: elastic/x-pack-elasticsearch@d2600652e7
2017-03-16 09:57:32 +01:00
Ryan Ernst 8c01d6ea69 Tests: Add cluster health check to xpack integ wait conditions (elastic/x-pack-elasticsearch#740)
The wait condition used for integ tests by default calls the cluster
health api with wait_for_nodes nd wait_for_status. However, xpack
overrides the wait condition to add auth, but most of these conditions
still looked at the root ES url, which means the tests are susceptible
to race conditions with the check and node startup. This change modifies
the url for the authenticated wait condtion to check the health api,
with the appropriate wait_for_nodes and wait_for_status.

Original commit: elastic/x-pack-elasticsearch@0b23ef528f
2017-03-15 10:23:26 -07:00
Jay Modi 149e251445 Filtered RestRequests should allow access to the remote address (elastic/x-pack-elasticsearch#741)
When adding support for rest request filtering of sensitive content, the overridden rest request
did not properly delegate the #getRemoteAddress method to the wrapped request. This resulted in a
NPE when a filtered rest request was created and an audit record needed to be generated.

relates elastic/x-pack-elasticsearch#714

Original commit: elastic/x-pack-elasticsearch@710b43355b
2017-03-15 07:13:09 -06:00
Jay Modi bc53dbfb46 Remove unused sign user setting (elastic/x-pack-elasticsearch#736)
User signing was removed with the move to TLS only transport and this change removes a no longer
used setting.

Original commit: elastic/x-pack-elasticsearch@c221f1f4a4
2017-03-14 19:29:16 -07:00
David Roberts 0b7c735aec [ML] Add machine learning privileges/roles (elastic/x-pack-elasticsearch#673)
* Changed ML action names to allow distinguishing of admin and read-only actions
  using wildcards
* Added manage_ml and monitor_ml built-in privileges as subsets of the existing
  manage and monitor privileges
* Added out-of-the-box machine_learning_admin and machine_learning_user roles
* Changed machine learning results endpoints to use a NodeClient rather than an
  InternalClient when searching for results so that index/document level permissions
  applied to ML results are respected

Original commit: elastic/x-pack-elasticsearch@eee800aaa8
2017-03-14 16:13:41 +00:00
Jay Modi 8df7a82435 Remove unnecessary String creation from password char[] (elastic/x-pack-elasticsearch#713)
This commit removes an unnecessary String creation from the char[] of a password and instead uses
a byte[] that is cleared after it is used to prevent the password bytes from sticking around in
memory longer than required.

Original commit: elastic/x-pack-elasticsearch@1154a68965
2017-03-13 18:50:48 -07:00
Dimitris Athanasiou db48e92f54 [ML] Add support for percentiles aggregation (elastic/x-pack-elasticsearch#733)
Original commit: elastic/x-pack-elasticsearch@7c8357ac04
2017-03-13 23:32:33 +00:00
Steffen Siering 07bde45671 Init beats monitoring support (elastic/x-pack-elasticsearch#543)
- introduce builtin user 'beats_system'
- init monitoring-beats ES mapping
- add beats to MonitoredSystem + Resolver

Original commit: elastic/x-pack-elasticsearch@4d7b45d54d
2017-03-13 10:29:42 -07:00
Tanguy Leroux e5cc038616 Remove unused import
Original commit: elastic/x-pack-elasticsearch@742c12e8b8
2017-03-12 13:36:39 -07:00
Tanguy Leroux 73836f43c5 [Test] Mute flaky monitoring tests
Original commit: elastic/x-pack-elasticsearch@3670e827c8
2017-03-12 13:31:05 -07:00
Hendrik Muhs ce1a910542 [ML] DataStreamDiagnostics Rebase (elastic/x-pack-elasticsearch#698)
DataStreamDiagnostics

DataStreamDiagnostics analyzes input data regarding machine learning fit. It checks whether data is sane/plausible as anomaly detection on broken data (or misconfiguration).

Original commit: elastic/x-pack-elasticsearch@2f37d3c960
2017-03-12 09:40:27 -07:00
Jason Tedor 0457de27dd Fix SHAs for Netty dependencies
This commit fixes the SHA hashes for the Netty dependencies after Netty
was upgraded from version 4.1.8 to version 4.1.9.

Original commit: elastic/x-pack-elasticsearch@ca4c376886
2017-03-12 01:19:17 -05:00
Alexander Reelsen 54527b86ea Tests: Remove DynamicIndexNameIntegrationTests (elastic/x-pack-elasticsearch#725)
This integration tests only checks if date math index names are
supported. This is nothing that a watcher test should check for.

Original commit: elastic/x-pack-elasticsearch@8a06988fff
2017-03-11 17:35:29 -08:00
David Kyle b06ce7e7c1 [ML] Remove dead delete job index code
Original commit: elastic/x-pack-elasticsearch@533b2a0207
2017-03-10 16:30:02 -08:00
Dimitris Athanasiou 72f7698647 [ML] Extend aggregation support (elastic/x-pack-elasticsearch#705)
* [ML] Allow summary_count_field_name to be set to custom field

... in aggregated datafeeds.

This allows implementing e.g. distinct_count anomaly detection
with aggregations. (see case 1 in elastic/x-pack-elasticsearch#659)

Relates to elastic/x-pack-elasticsearch#659

* [ML] Handle multiple leaf aggregations

This commit allows multiple numeric leaf aggregations.
That enables use cases where the data are presummarised and
thus the summary count field is a sum aggregation on the
event rate field. (see 2 in elastic/x-pack-elasticsearch#659)

Relates to elastic/x-pack-elasticsearch#659

Original commit: elastic/x-pack-elasticsearch@07a34a18c6
2017-03-09 15:26:44 +00:00
David Roberts 1c52495c5a [ML] The Machine Learning class no longer needs to be a plugin (elastic/x-pack-elasticsearch#712)
Now machine learning is simply a feature of X-Pack, so I have made the
MachineLearning class more like the other feature classes. It no longer extends
Plugin and its createComponents() method takes an InternalClient rather than
a generic Client.

Original commit: elastic/x-pack-elasticsearch@704860147c
2017-03-08 15:54:26 +00:00
Martijn van Groningen e972f0216d [ML] Auto close jobs and auto stop datafeeds if license is invalid.
Original commit: elastic/x-pack-elasticsearch@6e2634b2b6
2017-03-05 11:14:45 +01:00
Martijn van Groningen 6365dec42e [TEST] Changed internal distributed ml tests to extend from ESIntegTest and only run with ml to avoid noise.
Changed DatafeedJobsIT to extend directly from SecurityIntegTest as it uses external cluster.

Original commit: elastic/x-pack-elasticsearch@d646c59491
2017-03-04 08:10:46 +01:00
Martijn van Groningen 49826ae134 [ML] Simplify JobManager#createJobResultIndex(...)
Original commit: elastic/x-pack-elasticsearch@e8b01e183c
2017-03-03 16:33:30 +01:00
Dimitrios Athanasiou 9e7d6d7fee [TEST] Add more assertions to DeleteExpiredDataIT
Original commit: elastic/x-pack-elasticsearch@ed34093921
2017-03-03 15:32:33 +00:00
Dimitrios Athanasiou f4c8dfce5a [TEST] Add missing parts in delete_expired_data REST spec
Original commit: elastic/x-pack-elasticsearch@3530ed1550
2017-03-03 13:07:42 +00:00
Dimitris Athanasiou a7a36245c9 [ML] Add end-point for deleting expired results (elastic/x-pack-elasticsearch#670)
This commit adds an end-point to force deletion of expired data:

DELETE /_xpack/ml/_delete_expired_data

A few other things are changed too:

- Delete expired results from now rather than start of day
- Rename MlDaily{Management -> Maintenance}Service
- Refresh job indices when job is closing to ensure latest result
  visibility
- Commit results when quantiles are persisted to ensure they are visible
  for renormalization


Original commit: elastic/x-pack-elasticsearch@8ca5272a94
2017-03-03 11:33:22 +00:00
David Roberts 440d005b1a [ML] Prevent repeated cluster state changes when creating index templates (elastic/x-pack-elasticsearch#687)
Switched the order of the local atomic flag check and cluster state check,
based on the observation that we used to sometimes get a storm of cluster
state updates on initial startup, due to a race between checking for the
presence of an index template and starting to create one.

Original commit: elastic/x-pack-elasticsearch@7ae83648ce
2017-03-03 10:59:24 +00:00
David Kyle 01de84a19f [ML] Wait for templates to be installed before running ML Integ tests (elastic/x-pack-elasticsearch#681)
* [ML] Wait for templates to be installed before running ML Integ tests

* Revert put job template check and preserve template change

* Review comments

Original commit: elastic/x-pack-elasticsearch@21deb34f4a
2017-03-03 10:04:34 +00:00
Alexander Reelsen be2ee21d16 Tests: Ensure date is UTC to prevent failing tests
This test used the local time zone to check for an assertion,
and thus failed in US evenings, because the date in UTC rolled over.

relates elastic/x-pack-elasticsearch#239

Original commit: elastic/x-pack-elasticsearch@6286b30407
2017-03-03 00:20:19 +01:00
Tim Vernum b105118ef0 Add `has_privileges` API (elastic/x-pack-elasticsearch#604)
Security API to determine which (if any) of a specified set of index/cluster privileges are held by the current (runAs) user.
Intended for use by Kibana to distinguish between read/write and read-only users, but should be applicable to other uses cases also.

Closes: elastic/x-pack-elasticsearch#282

Original commit: elastic/x-pack-elasticsearch@8b4cfdb858
2017-03-03 18:41:44 +11:00
Ryan Ernst c92562e9d9 Build: Enable notice generation for x-pack (elastic/x-pack-elasticsearch#695)
The only tricky thing here was what to do about ES jars. We now ignore them for the jar sha checking, and the base elasticsearch license and notice is copied here, and elasticsearch jars are mapped to those license/notice files.

Original commit: elastic/x-pack-elasticsearch@a6373cfe4e
2017-03-02 19:06:15 -08:00
Dimitrios Athanasiou c52689a9a0 [ML] Add job_id filter to job alias
This fixes returning results only for the job asked
when a shared index is used.

The commit also refactors the field count check to
use the field mappings API and solves a bug where the
check blows due to the _default_ type not having properties.

[Zach] Minor test tweak to MlJobIT

Original commit: elastic/x-pack-elasticsearch@729f886879
2017-03-02 21:46:34 -05:00
Martijn van Groningen 34a4778b11 [TEST] Wait a bit longer before the lookback import has completed and it stopped the datafeed automatically
Original commit: elastic/x-pack-elasticsearch@6f9b5f8f28
2017-03-02 22:00:11 +01:00
Martijn van Groningen e9e14cbcea [ML] Improve reason why datafeed is stopped.
Original commit: elastic/x-pack-elasticsearch@2055a64689
2017-03-02 18:03:54 +01:00