Commit Graph

729 Commits

Author SHA1 Message Date
Chris Earle f18a7f0f68 [Monitoring] Remove unused "node" _type from .monitoring-data-2 (elastic/x-pack-elasticsearch#1333)
This removes the "node" type from `.monitoring-data-2`. This data is sent to _both_ the time-based and non-time-based indexes for Elasticsearch, but the UI only used the time-based variant already.

This is another step in the process of removing the `.monitoring-data-2` index. There is now only one `_type` left in that index: `cluster_info`, which is used by the UI and phone home stats because it contains the license details _and_ the `stack_stats` (e.g., `xpack_usage`).

Original commit: elastic/x-pack-elasticsearch@2cadb5939d
2017-05-05 17:48:30 -04:00
Tanguy Leroux 327ac9898d Fix compilation errors after elastic/elasticsearch/elastic/x-pack-elasticsearch#24492
Original commit: elastic/x-pack-elasticsearch@06d0c17165
2017-05-05 21:27:09 +02:00
Dimitris Athanasiou 3570eb32d3 [ML] Retrieve model_size_stats via search (elastic/x-pack-elasticsearch#1326)
This is a task towards allowing rollover.

Multiple model_size_stats are stored in order to allow
analytics of the memory usage over time. The job _stats
need to display the latest model_size_stats. Before this
commit, the latest model_size_stats was being stored with
a special ID and it was retrieved using that ID. This
does not lend itself well for rollover as we would end up
with multiple of those special IDs in the rolled indices.

This commit removes the need to store a special model_size_stats
version. Job _stats now retrieve the model_size_stats by searching
for the latest one. It also uses a manual ID for all model_size_stats
in order to maintain a single document per log_time.

Relates elastic/x-pack-elasticsearch#827

Original commit: elastic/x-pack-elasticsearch@b2796e9b08
2017-05-05 17:05:39 +01:00
Chris Earle 8ab46e800c [Monitoring] Stop Accepting .monitoring-data-N index requests via REST (elastic/x-pack-elasticsearch#1318)
Now that the Monitoring UI no longer checks the `.monitoring-data-2` index
for Kibana, Logstash, or Beats data, we can stop accepting the duplicated
data in that index (the _exact_ same documents are also indexed into the
time-based index for each product).

This ignores rather than rejects requests that contain such documents to
allow older clients to communicate with a 5.5+ monitoring cluster.

Original commit: elastic/x-pack-elasticsearch@def472cf2e
2017-05-05 11:53:43 -04:00
Tim Vernum 384486d6dd [TESTS] Really fix MultipleAdRealmTests (I think)
Original commit: elastic/x-pack-elasticsearch@dc1eb4eb93
2017-05-05 10:45:11 +10:00
Igor Motov 9a800cac60 Switch to StreamInput.readEnum and StreamOutput.writeEnum (elastic/x-pack-elasticsearch#1313)
Start using StreamInput.readEnum and StreamOutput.writeEnum for enum serialization.

Relates to elastic/elasticsearch#24475

Original commit: elastic/x-pack-elasticsearch@67ca571458
2017-05-04 18:03:05 -04:00
Dimitris Athanasiou 9e3d5d6cf3 [ML] Provide better error message when doc values are unavailable (elastic/x-pack-elasticsearch#1312)
relates elastic/x-pack-elasticsearch#1305

Original commit: elastic/x-pack-elasticsearch@2e8ccc340b
2017-05-04 17:12:49 +01:00
Dimitris Athanasiou 4241469c89 [ML] Correctly print job state when delete job fails (elastic/x-pack-elasticsearch#1310)
relates elastic/x-pack-elasticsearch#1307

Original commit: elastic/x-pack-elasticsearch@25fb18ed0b
2017-05-04 15:17:48 +01:00
Adrien Grand ea31227a89 Do not create the monitoring index before the exporter service is started.
This prevents the template from being applied.

relates elastic/x-pack-elasticsearch#1308

Original commit: elastic/x-pack-elasticsearch@c9fcea42ce
2017-05-04 14:40:32 +02:00
Dimitris Athanasiou 2290b93aa3 [ML] Ignore interim results during renormalization (elastic/x-pack-elasticsearch#1298)
relates elastic/x-pack-elasticsearch#1193

Original commit: elastic/x-pack-elasticsearch@6f5e354bdd
2017-05-04 11:38:52 +01:00
Dimitris Athanasiou 7f2c7dbe17 [ML] Rename datafeed indexes to indices (elastic/x-pack-elasticsearch#1297)
Renames datafeed indexes to indices but keeps indexes
as a synonym while parsing.

relates elastic/x-pack-elasticsearch#1292

Original commit: elastic/x-pack-elasticsearch@1fcdd97f88
2017-05-04 11:37:12 +01:00
Tim Vernum b922b37c3f [TEST] Fixes for randomised failures
- role_mapping.native is always present, but contains no entries if the security index is unavailable
- file based role mapping does not allow duplicate keys

Original commit: elastic/x-pack-elasticsearch@734cf7e2c0
2017-05-04 20:18:28 +10:00
Adrien Grand bbb3d008f2 Only allow indices to have a single type by default. (elastic/x-pack-elasticsearch#1212)
Sibling of elastic/elasticsearch#24317

Original commit: elastic/x-pack-elasticsearch@a57decdf9f
2017-05-04 10:23:23 +02:00
Alexander Reelsen 4078b2f1b2 Watcher: Replace _status field with status (elastic/x-pack-elasticsearch#1285)
As fields with underscores will be disallowed in master, and we have to
prepare the upgrade, this commit renames the _status field to status.

When the 5.x upgrade logic is in place in the 5.x we can remove all the
old style _status handling from the master branch.

Note: All the BWC compatibility tests, that load 5.x indices are now
faking a finished upgrade by adding the `status` field to the mapping
of the watches index.

Original commit: elastic/x-pack-elasticsearch@9d5cc9aaec
2017-05-04 10:08:34 +02:00
Tim Vernum 8633fd1f07 [TESTS] Fix problem with AD integration test
In some cases (based on the randomisation) the primary-realm would have no mappings, but the secondary-realm would.
If this occurred we wouldn't write out any mappings and the secondary-realm would not authorize the access being tested

Original commit: elastic/x-pack-elasticsearch@8e81ec9dd7
2017-05-04 18:05:26 +10:00
Jim Ferenczi 770404200e [TEST] Fix test that breaks compilation due to an invalid usage of ListenableActionFuture
Original commit: elastic/x-pack-elasticsearch@b92d06c9b1
2017-05-04 08:33:06 +02:00
Tim Vernum 6adf4fd3af Role Mapping API (elastic/x-pack-elasticsearch#925)
This introduces a role-mapping API to X-Pack security.

Features:
- A `GET`/`PUT`/`DELETE` API at `/_xpack/security/role_mapping/`
- Role-mappings are stored in the `.security` index 
- A custom expression language (in JSON) for expressing the mapping rules 
- Supported in LDAP/AD and PKI realms
- LDAP realm also supports loading arbitrary meta-data (which can be used in the mapping rules)
- A CompositeRoleMapper unifies roles from the existing file based mapper, and the new API based mapper.
- Usage stats for native role mappings

Original commit: elastic/x-pack-elasticsearch@d9972ed1da
2017-05-04 13:38:50 +10:00
Luca Cavanna 500170c456 [TEST] Remove more unnecessary ListenableActionFuture usages (elastic/x-pack-elasticsearch#1283)
Original commit: elastic/x-pack-elasticsearch@9dfe7ea6f9
2017-05-03 16:35:15 +02:00
Tim Brooks 106a26b399 Remove unneeded usages of listenable futures (elastic/x-pack-elasticsearch#1261)
This is related to elastic/elasticsearch#24412. That commit changed how
ListenableActionFuture implementations are created. This commit
updates x-pack to be compatible with those changes. In particular, all
the usages of ListenableActionFuture in x-pack could be replaced with
PlainActionFuture as the "listening" functionality was not being used.

Original commit: elastic/x-pack-elasticsearch@7c8d8e3df9
2017-05-03 09:23:39 -05:00
Dimitrios Athanasiou d140b3028d [ML] Reuse encapsulated delete-by-query request
Original commit: elastic/x-pack-elasticsearch@cc0f2ce815
2017-05-03 14:58:22 +01:00
Dimitris Athanasiou 3f73748d14 [ML] Use delete-by-query in JobDataDeleter (elastic/x-pack-elasticsearch#1274)
JobDataDeleter handles the deletion logic for 3 cases:

1. deleting a model snapshot and its state docs
2. deleting all results after a timestamp
3. deleting all interim results

The last 2 are currently implemented by manually performing
a search and scroll and then adding matching hits in a bulk
delete action. This operation is exactly what delete-by-query
does.

This commit changes JobDataDeleter to use delete-by-query. This
makes the code simpler and less error-prone. The downside is
losing some logging which seems non-critical. Unit tests for
JobDataDeleter are also removed as they are heavily mocked tests,
adding little value and high maintenance cost. This functionality
is tested by integration tests already.

relates elastic/x-pack-elasticsearch#821

Original commit: elastic/x-pack-elasticsearch@7da91332bd
2017-05-03 14:51:41 +01:00
Dimitris Athanasiou 3e9c36838d [ML] Remove get model snapshot by description functionality (elastic/x-pack-elasticsearch#1288)
relates elastic/x-pack-elasticsearch#1284

Original commit: elastic/x-pack-elasticsearch@780feea5c1
2017-05-03 13:20:52 +01:00
Luca Cavanna 796e23a02a Adapt to ActionRequestBuilder#execute changes (elastic/x-pack-elasticsearch#1263)
Original commit: elastic/x-pack-elasticsearch@c2d7aa562c
2017-05-03 11:21:06 +02:00
Hendrik Muhs 9d8fea9a32 [ML] expose low and high median functions (elastic/x-pack-elasticsearch#1272)
Expose low and high median functions implemented downstream in machinelearning-cpp.

Original commit: elastic/x-pack-elasticsearch@3863e9d41c
2017-05-03 09:46:10 +02:00
Daniel Mitterdorfer 240bd5bfa7 Mute EllipticCurveSSLTests
Relates elastic/x-pack-elasticsearch#1278

Original commit: elastic/x-pack-elasticsearch@3e5dbf5fe6
2017-05-03 07:57:27 +02:00
Alexander Reelsen 3a0bc504a9 Watcher: Exeuting a watch returns a proper 404 (elastic/x-pack-elasticsearch#1273)
A test failure uncovered that handling non existing watches in the
execute watch API could lead to 500 errors instead of 404 because
they were not handled correctly.

relates elastic/x-pack-elasticsearch#1120

Original commit: elastic/x-pack-elasticsearch@c17a07ae3e
2017-05-02 16:01:45 +02:00
Alexander Reelsen ff6283bf80 Tests: Ignore existing watches index in REST test
This test should ensure, that a missing watch on an existing index
causes an error, thus it can ignore if the .watches index already
exists.

relates elastic/x-pack-elasticsearch#1155

Original commit: elastic/x-pack-elasticsearch@89c56cb2be
2017-05-02 14:16:19 +02:00
Tanguy Leroux 9e14141a8e [Test] Fix NPE in LocalExporterTests
This commit fixes a NullPointerException in the LocalExporterTests.

Original commit: elastic/x-pack-elasticsearch@e28516135f
2017-05-02 13:55:47 +02:00
David Kyle f3f387bd9c [ML] Give jobs meaningful and unique names in the yaml rest tests. (elastic/x-pack-elasticsearch#1271)
Original commit: elastic/x-pack-elasticsearch@b096de55c1
2017-05-02 11:36:33 +01:00
Alexander Reelsen c62f6f8177 Watcher: Distributed watch execution (elastic/x-pack-elasticsearch#544)
The distribution of watches now happens on the node which holds the
watches index, instead of on the master node. This requires several
changes to the current implementation.

1. Running on shards and replicas
   In order to run watches on the nodes with the watches index on its
   primaries and replicas. To ensure that watches do not run twice, there is
   a logic which checks the local shards, runs a murmurhash on the id and
   runs modulo against the number of shards and replicas, this is the way to
   find out, if a watch should run local. Reloading happens
2. Several master node actions moved to a HandledTransportAction, as they
   are basically just aliases for indexing actions, among them the
   put/delete/get watch actions, the acknowledgement action, the de/activate
   actions
3. Stats action moved to a broadcast node action, because we potentially
   have to query every node to get watcher statistics
4. Starting/Stopping watcher now is a master node action, which updates
   the cluster state and then listeners acts on those. Because of this watches
   can be running on two systems, if you those have different cluster state
   versions, until the new watcher state is propagated
5. Watcher is started on all nodes now. With the exception of the ticker
   schedule engine most classes do not need a lot of resources while running.
   However they have to run, because of the execute watch API, which can hit
   any node - it does not make sense to find the right shard for this watch
   and only then execute (as this also has to work with a watch, that has not
   been stored before)
6. By using a indexing operation listener, each storing of a watch now
   parses the watch first and only stores on successful parsing
7. Execute watch API now uses the watcher threadpool for execution
8. Getting the number of watches for the stats now simply queries the
   different execution engines, how many watches are scheduled, so this is
   not doing a search anymore

There will be follow up commits on this one, mainly to ensure BWC compatibility.

Original commit: elastic/x-pack-elasticsearch@0adb46e658
2017-05-02 10:12:46 +02:00
Jason Tedor 718518fe85 Disable setting available processors in tests
Within the same JVM, setting the number of processors available to Netty
can only be done once. However, tests randomize the number of processors
and so without intervention would attempt to set this value multiple
times. Therefore, we need to use a flag that prevents setting this value
in tests.

Relates elastic/x-pack-elasticsearch#1266

Original commit: elastic/x-pack-elasticsearch@d127149725
2017-05-01 19:27:45 -04:00
Jason Tedor bec3102e06 Upgrade Netty to 4.1.10.Final
This commit upgrades the Netty dependency from version 4.1.9.Final to
version 4.1.10.Final.

Relates elastic/x-pack-elasticsearch#1262

Original commit: elastic/x-pack-elasticsearch@aac7aa351c
2017-05-01 10:25:42 -04:00
Yannick Welsch a9aa3e2329 Revert "Test: get more information when sporadic NPE"
This reverts commit elastic/x-pack-elasticsearch@3e08725fc7.

Original commit: elastic/x-pack-elasticsearch@dc85c2b194
2017-04-29 10:51:35 +02:00
Yannick Welsch 308d5e0ae3 Don't call ClusterService.state() in a ClusterStateUpdateTask
The current state is readily available as a parameter

Original commit: elastic/x-pack-elasticsearch@a09929aa82
2017-04-29 10:50:56 +02:00
Yannick Welsch e3834da05e [TEST] Wait for trial license to be generated before running LicensesManagerServiceTests
Many of the tests assume that the trial license has already been generated before the test gets to run. As this is asynchronously triggered upon node
startup, however, there is no guarantee that trial license generation has completed before the tests get to execute, leading to null values when
checking clusterService.state().metaData().custom(LicensesMetaData.TYPE).

Original commit: elastic/x-pack-elasticsearch@d909c9ba95
2017-04-29 10:50:56 +02:00
Dimitrios Athanasiou ee5e66bb0d [ML] Make updateDatafeed var in UpdateDatafeedAction volatile
Original commit: elastic/x-pack-elasticsearch@d8461d0960
2017-04-28 17:58:55 +01:00
Dimitris Athanasiou 5a70eac6e8 [ML] Delete and Update datafeed actions should use current cluster state (elastic/x-pack-elasticsearch#1254)
relates elastic/x-pack-elasticsearch#1253

Original commit: elastic/x-pack-elasticsearch@bdf695e694
2017-04-28 17:53:59 +01:00
Nik Everett 459b77478e Test: get more information when sporadic NPE
LicenseManagerServiceTests sometimes fails in jenkins, but fairly
rarely. We don't get useful logs when it does. This cranks up
the log level and adds some more assertions so we can better track
down where the failure comes from.

Relates to elastic/x-pack-elasticsearch#222

Original commit: elastic/x-pack-elasticsearch@3e08725fc7
2017-04-28 11:34:48 -04:00
David Roberts 892d803a6a [ML] When putting a datafeed use runas user for index privilege check (elastic/x-pack-elasticsearch#1245)
When a user creates a datafeed, as well as checking they have permission
to create a datafeed we also check that they have permission to search the
indices they've configured the datafeed to search.

Previously this second check was erroneously done for the user who issued
the put_datafeed request, whereas it should be done as the runas user for
that request.

Original commit: elastic/x-pack-elasticsearch@4c35204c66
2017-04-28 13:38:53 +01:00
Dimitrios Athanasiou 57382390ab [TEST] Delete job from DatafeedJobsIT.testRealtime in clean up
relates elastic/x-pack-elasticsearch#1246

Original commit: elastic/x-pack-elasticsearch@9ca07f1308
2017-04-28 11:00:51 +01:00
Yannick Welsch c551bcba5c Separate publishing from applying cluster states
Companion commit to elastic/elasticsearch#24236

Original commit: elastic/x-pack-elasticsearch@d685478f5d
2017-04-28 09:35:20 +02:00
Zachary Tong 6147e2ba6a Remove now-unnecessary cast
Original commit: elastic/x-pack-elasticsearch@fcbbe5a919
2017-04-27 17:16:30 -04:00
Dimitrios Athanasiou f341b336a5 [ML] Correctly pass job_id from job task to logger
Original commit: elastic/x-pack-elasticsearch@1c73bccaec
2017-04-27 20:02:15 +01:00
Dimitrios Athanasiou b796388431 [ML] Delete intervening results after now as well
When we revert to snapshot, if we delete intervening results
we should delete with an open end on the time range for the
case when future data has been posted to the job.

Original commit: elastic/x-pack-elasticsearch@c3f5e8f19e
2017-04-27 16:38:23 +01:00
Nik Everett 677ea404f7 Remove most usages of 1-arg Script ctor (elastic/x-pack-elasticsearch#1207)
The one argument ctor for `Script` creates a script with the
default language but most usages of are for testing and either
don't care about the language or are for use with
`MockScriptEngine`. This replaces most usages of the one argument
ctor on `Script` with calls to `ESTestCase#mockScript` to make
it clear that the tests don't need the default scripting language.

Original commit: elastic/x-pack-elasticsearch@c1d05b7357
2017-04-27 11:35:42 -04:00
Yannick Welsch 779e8f6771 [TEST] Reenable IndicesStatsTests
Commit elastic/x-pack-elasticsearch@4165beb90 should have fixed the test failures.

Original commit: elastic/x-pack-elasticsearch@67b8aac14c
2017-04-27 17:04:45 +02:00
Jay Modi 1d08b4d1fb Rest endpoints for token based access (elastic/x-pack-elasticsearch#1235)
This commit adds rest endpoints for the creation of a new token and invalidation of an existing
token. This builds upon the functionality that was introduced in elastic/x-pack-elasticsearch#1029.

relates elastic/x-pack-elasticsearch#8

Original commit: elastic/x-pack-elasticsearch@d56611dfa3
2017-04-27 11:04:31 -04:00
Jay Modi f7fb02f21f Ensure we always respect a user specified filter in the AD realm (elastic/x-pack-elasticsearch#1161)
When the active directory realm was refactored to add support for authenticating against multiple
domains, only the default authenticator respected the user_search.filter setting. This commit moves
this down to the base authenticator and also changes the UPN filter to not include sAMAccountName
in the filter.

Original commit: elastic/x-pack-elasticsearch@d2c19c9bee
2017-04-27 10:20:59 -04:00
Dimitrios Athanasiou 4f12f04c65 [TEST] Fix line width checkstyle error
Original commit: elastic/x-pack-elasticsearch@0d62752c0e
2017-04-27 14:03:07 +01:00
Dimitrios Athanasiou 4c9b4132c9 [TEST] Refactor ML integration test framework
- Removes need to handle exception from action methods
- Clearly renames DatafeedJobIT to DatafeedJobsRestIT to distinguish
  from DatafeedJobsIT
- Refactors DatafeedJobsIT to reuse MlNativeAutodetectIntegTestCase

Original commit: elastic/x-pack-elasticsearch@5bd0c01391
2017-04-27 13:43:28 +01:00
Tim Vernum ddf5fd68c2 Add ClusterSearchShardsAction to "read_cross_cluster" privilege (elastic/x-pack-elasticsearch#1231)
Cross cluster search uses ClusterSearchShardsAction under the covers.
Without this change, you would need both "read_cross_cluster" and "view_index_metadata" privilegs in order to have permission to execute searches from a remote cluster.

Original commit: elastic/x-pack-elasticsearch@65a6aff329
2017-04-27 22:39:13 +10:00
Dimitrios Athanasiou 7e62eb6255 [TEST] Wait for job to close from DatafeedJobsIT.testLookbackOnly
relates elastic/x-pack-elasticsearch#1228

Original commit: elastic/x-pack-elasticsearch@77055bd128
2017-04-27 12:57:50 +01:00
Yannick Welsch 983fb95a2a [TEST] Disable GraphTests.testSignificanceQueryCrawl
as it sporadically fails

Relates to elastic/x-pack-elasticsearch#918

Original commit: elastic/x-pack-elasticsearch@e2a8a79e62
2017-04-27 09:34:56 +02:00
Jay Modi 69837cd817 Fix DLS query merging when there are groups with/without DLS (elastic/x-pack-elasticsearch#1203)
If a single permission set does not have a query defined then this should be considered as the user
not having document level security for the indices matching that pattern. However, the lack of
document level security was not being taken into account and document level security was being
applied when it should not have been.

Original commit: elastic/x-pack-elasticsearch@f5777c2f37
2017-04-26 16:06:15 -04:00
jaymode a7d9e92f25 Test: wait for all token expiration jobs to finish
This adds a best effort wait for the token expiration jobs to finish to hopefully address the
issues in tests with on going requests and locked shards.

Relates elastic/x-pack-elasticsearch#1220

Original commit: elastic/x-pack-elasticsearch@ae789c1e58
2017-04-26 15:40:56 -04:00
Dimitrios Athanasiou b54de1bb91 [TEST] Give time for results to be searchable in UpdateInterimResultsIT
Original commit: elastic/x-pack-elasticsearch@7c28860dd5
2017-04-26 18:46:33 +01:00
Martijn van Groningen 295a4049a3 [ML] Use allocation id as key in `AutodetectProcessManager#autoDetectCommunicatorByJob` map instead of job id.
Relates to elastic/x-pack-elasticsearch#921

Original commit: elastic/x-pack-elasticsearch@21383fd51c
2017-04-26 19:33:41 +02:00
Dimitris Athanasiou 1f57a53b3e [ML] Correct error message for invalid job_id (elastic/x-pack-elasticsearch#1218)
relates elastic/x-pack-elasticsearch#1211

Original commit: elastic/x-pack-elasticsearch@5389a43706
2017-04-26 18:17:06 +01:00
Yannick Welsch 444cbfc283 [TEST] Fix monitoring tests that are flaky in the presence of replicas
Many tests in monitoring use the pattern of calling first awaitMonitoringDocsCount, and then doing a search that checks certain properties, assuming
that the doc count is correct at that point. In the presence of replicas, awaitMonitoringDocsCount might not wait for all shard copies to have the
desired property. A subsequent search might then hit a shard where the property does not hold. As these tests randomize the number of replicas
(through the random_index_template), it easier to constrain awaitMonitoringDocsCount just to the primary and then do subsequent checks just by
querying the primary.

Original commit: elastic/x-pack-elasticsearch@4165beb903
2017-04-26 19:12:45 +02:00
jaymode 4a36cd77ee Test: bind regular socket instead of server socket so connection cannot be accepted
This commit creates a single server socket that will be connected to by local sockets. The local
sockets will use the port of the previously stopped ldap server as the local port. This will
prevent the ldap library from establishing a connection. The previous use of server sockets for
this did not work on all operating systems as the backlog parameter has platform specific meaning.

Original commit: elastic/x-pack-elasticsearch@03b6bf39d4
2017-04-26 12:41:12 -04:00
David Roberts f3f9cb6d74 [ML] Stop using the management thread pool unnecessarily for ML actions (elastic/x-pack-elasticsearch#1213)
The management thread pool only has 5 threads and clogging it up makes
monitoring think the cluster is dead.

relates elastic/x-pack-elasticsearch#1210

Original commit: elastic/x-pack-elasticsearch@f4ad7578d9
2017-04-26 17:17:26 +01:00
jaymode 6b4db0fc36 Test: remove usage of forbidden api (socket connect)
Original commit: elastic/x-pack-elasticsearch@5903973762
2017-04-26 11:39:27 -04:00
jaymode 123a660720 Test: add awaits fix for SessionFactoryLoadBalancingTests
Original commit: elastic/x-pack-elasticsearch@6412d12283
2017-04-26 11:25:30 -04:00
jaymode c9d039525c Test: add more debug output for SessionFactoryLoadBalancingTests failures
Original commit: elastic/x-pack-elasticsearch@206048b94d
2017-04-26 11:15:07 -04:00
jaymode c1c66f38ea Test: specify a timeout for background operation
This commit adds a timeout for the expiration of invalidated tokens so that we can expect that the
requests will have been finished before we do the assertions on the internal test cluster.

Original commit: elastic/x-pack-elasticsearch@2928706224
2017-04-26 10:34:17 -04:00
Dimitrios Athanasiou 708190f356 [TEST] Add model snapshot restore integration test
Relates elastic/x-pack-elasticsearch#882

Original commit: elastic/x-pack-elasticsearch@fbb983e63b
2017-04-26 14:29:55 +01:00
Jay Modi 295051ee8c Add a short-lived token based access mechanism (elastic/x-pack-elasticsearch#1029)
This commit adds a token based access mechanism that is a subset of the OAuth 2.0 protocol. The
token mechanism takes the same values as a OAuth 2 standard (defined in RFC 6749 and RFC 6750),
but differs in that we use XContent for the body instead of form encoded values. Additionally, this
PR provides a mechanism for expiration of a token; this can be used to implement logout
functionality that prevents the token from being used again.

The actual tokens are encrypted using AES-GCM, which also provides authentication. The key for
encryption is derived from a salt value and a passphrase that is stored on each node in the
secure settings store. By default, the tokens have an expiration time of 20 minutes and is
configurable up to a maximum of one hour.

Relates elastic/x-pack-elasticsearch#8

Original commit: elastic/x-pack-elasticsearch@3d201ac2bf
2017-04-26 08:00:03 -04:00
Martijn van Groningen c6c63c471c The xpack side of elastic/x-pack-elasticsearch#24115
Original commit: elastic/x-pack-elasticsearch@862180a169
2017-04-26 11:28:01 +02:00
Dimitrios Athanasiou 9828161cff [TEST] Remove broken test from jobs_get_result_categories.yaml
The YAML framework randomly sends the body wrapped in a `source`
field if the API supports GET. Our API doesn't handle `source`.
Taking the test out.

relates elastic/x-pack-elasticsearch#1200

Original commit: elastic/x-pack-elasticsearch@fa77c071b2
2017-04-25 17:07:30 +01:00
Martijn van Groningen ee650b3189 [ml] Use allocation id as key in `runningDatafeeds` map instead of datafeed id
Original commit: elastic/x-pack-elasticsearch@156e3275b1
2017-04-25 17:55:27 +02:00
Dimitris Athanasiou 32128894a5 [ML] Delete interim results after job re-opening (elastic/x-pack-elasticsearch#1194)
This is an issue where a bucket can have both interim results and
non-interim results, a bucket should never have both at the same time.
The steps to cause this situation are:

1. Flush a running job and create interim results
2. Close that job (this does not delete interim results)
3. Re-open the job and POST data
4. The job will eventually emit a bucket result which mingles with the
existing interim results

Normally interim results are deleted by AutoDetectResultProcessor when a
bucket is parsed following a flush command. Because of the close and
re-opening of the job AutoDetectResultProcessor no longer knows that a
previous flush command creating interim results.

The fix is to always delete interim results the first time
AutoDetectResultProcessor sees a bucket.

relates elastic/x-pack-elasticsearch#1188

Original commit: elastic/x-pack-elasticsearch@5326455f54
2017-04-25 16:32:58 +01:00
jaymode ef571568f4 Test: ensure ports that should fail are not bound to by other tests
In the SessionFactoryLoadBalancingTests, we sometime want a connection to a certain IP and Port to
fail as a way to mock an unresponsive/disconnected LDAP server. The test does this by starting up
multiple LDAP servers and then shutting some down. When the server is shut down the port that it
was bound to is open for another process or test to bind to, which can lead to sporadic failures in
CI. This change is a best effort attempt to prevent this by binding a server socket to the port and
filling its backlog so other connections should fail.

Relates elastic/x-pack-elasticsearch#1195

Original commit: elastic/x-pack-elasticsearch@b31a560c93
2017-04-25 11:17:05 -04:00
David Kyle 2d9fd0ed16 [ML] Only audit job creation after it was successful (elastic/x-pack-elasticsearch#1198)
Original commit: elastic/x-pack-elasticsearch@37af6cbf69
2017-04-25 16:07:47 +01:00
Dimitrios Athanasiou 612dcda8ae [TEST] Increase base job bucket_span to 1h
The DatafeedJobsIT.testRealtime test fails from time to time.
The test seems to take a long time to execute the flush action
after the lookback. This could make sense as the test produces
a few records over the span of a week with 5 minutes bucket_span.
Thus, flush will end up doing a lot of word to create results
for so many buckets.

This change increases the bucket_span to 1 hour. Hopefully, this
will stop the failures.

Relates elastic/x-pack-elasticsearch#1162

Original commit: elastic/x-pack-elasticsearch@4366907371
2017-04-25 15:32:44 +01:00
Dimitris Athanasiou 7f64f37c46 [ML] Fix POST version of get categories API (elastic/x-pack-elasticsearch#1184)
Also improves PageParams parsing to fill in defaults.

relates elastic/x-pack-elasticsearch#1180

Original commit: elastic/x-pack-elasticsearch@fccd7795ca
2017-04-25 14:44:10 +01:00
Martijn van Groningen 415d40e6fc test: improved assertion
Original commit: elastic/x-pack-elasticsearch@8361d2e27d
2017-04-25 12:16:01 +02:00
Martijn van Groningen a3e7c65ba4 [ML] Upon task cancel stop datafeed immediately.
Original commit: elastic/x-pack-elasticsearch@0401ca3d33
2017-04-25 11:56:44 +02:00
David Kyle bd40dd36c9 [ML] Hide partition_scores field if empty (elastic/x-pack-elasticsearch#1189)
Original commit: elastic/x-pack-elasticsearch@5dec266e0d
2017-04-25 10:48:53 +01:00
Martijn van Groningen 6c0613f36f fix mocking in tests
Original commit: elastic/x-pack-elasticsearch@b43de1ea2b
2017-04-25 09:52:12 +02:00
Ryan Ernst 105b689ec0 Templates: Convert template uses to ScriptService.compileTemplate (elastic/x-pack-elasticsearch#1170)
This is the xpack side of elastic/elasticsearch#24280

Original commit: elastic/x-pack-elasticsearch@90b7b2c6b7
2017-04-24 15:45:26 -07:00
Jay Modi 2c2261881d Fix support for elliptic curve certificates in PEM files (elastic/x-pack-elasticsearch#1050)
This commit fixes the support for elliptic curve certificates that are specified as a PEM file.
These certificates and private keys can now be read properly and a integration test was added to
ensure that TLS also functions correctly with these certificates.

Original commit: elastic/x-pack-elasticsearch@6d6d579c88
2017-04-24 11:31:10 -04:00
Martijn van Groningen a98d593576 [ML] Use JobTaskStatus#staleTask(...) instead of PersistentTask#needsReassignement(...) for checking whether a job task is stale when allocation a datafeed to a node.
Original commit: elastic/x-pack-elasticsearch@0952c455fe
2017-04-24 14:56:25 +02:00
David Kyle 0b267242f1 [ML] Refresh indices after job deletion (elastic/x-pack-elasticsearch#1174)
* Refresh indices after job deletion

* Make refresh index option explicit

Original commit: elastic/x-pack-elasticsearch@d3c819966b
2017-04-24 13:55:36 +01:00
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