Commit Graph

729 Commits

Author SHA1 Message Date
Dimitris Athanasiou 71fe599592 [ML] Single doc type for results index (elastic/x-pack-elasticsearch#1528)
This commit changes all results to use the single doc type.
All searches were adjusted to work without the need to specify
type which ensures BWC with 5.4 results.

Additional work is needed to put the new doc mapping in indices
created with 5.4 but it will be done in separate PR.

Relates elastic/x-pack-elasticsearch#668

Original commit: elastic/x-pack-elasticsearch@041c88ac2d
2017-05-24 13:24:32 +01:00
Alexander Reelsen 3d057991e0 Tests: Various watcher test improvements
* Reduced a longish timeout to a shorter one, as a watch should be
  executed in a HTTP test.
* Ensured that the TimeThrottleIntegration tests only query for own
  watches in the watch history, also use random names for watch ids
* HipChatServiceTests configured deprecated logging package, so it was
  not possible to follow the HTTP calls to the hipchat service endpoint.

relates elastic/x-pack-elasticsearch#1514
Relates elastic/x-pack-elasticsearch#1515

Original commit: elastic/x-pack-elasticsearch@adb492e4e9
2017-05-24 14:08:02 +02:00
David Kyle caad9035fd Mark failing test AwaitsFix
Original commit: elastic/x-pack-elasticsearch@c117ef9947
2017-05-24 12:25:34 +01:00
David Kyle b083062689 [ML] Add document type to ID (elastic/x-pack-elasticsearch#1525)
* Add document type to ID

* Delete v5.4 quantiles

Original commit: elastic/x-pack-elasticsearch@d1f383b972
2017-05-24 11:43:25 +01:00
David Kyle fc2d1266f4 Fix compilation
Original commit: elastic/x-pack-elasticsearch@6d34ac5a0c
2017-05-24 10:04:08 +01:00
David Kyle d9882be292 [ML] Use unique and predictable IDs for result docs (elastic/x-pack-elasticsearch#1521)
* Remove sequenceNum from anomaly records and influencers

* Generate unqiue IDs without sequence numbers

* Remove more instances of sequence_num

* Handle parsing sequnce_num from v5.4

Original commit: elastic/x-pack-elasticsearch@e60b206daf
2017-05-24 09:59:17 +01:00
Ryan Ernst b664e66a0d Test: Simplify watch stats test script engine (elastic/x-pack-elasticsearch#1520)
This commit simplifies the WatchStatsTests to use a MockScriptPlugin.
The latch script engine previously depended on a static instance of the
engine to contain the latches. These are now moved to statics of the
test class itself.

Original commit: elastic/x-pack-elasticsearch@4170cd1bd3
2017-05-23 12:23:05 -07:00
Andrew Cholakian ae778cc66f Move logstash-states template into the main logstash template (elastic/x-pack-elasticsearch#1490)
This is a revert of elastic/x-pack-elasticsearch@1940d79d13.
and also moves the template to boot

Original commit: elastic/x-pack-elasticsearch@434183b0e9
2017-05-23 09:20:46 -05:00
Jason Tedor 275bfc0e51 Mark failing exporter template test as awaits fix
This test is failing for eleven days and needs to be looked at.

Original commit: elastic/x-pack-elasticsearch@b16b95f333
2017-05-23 09:48:21 -04:00
David Kyle ea0f3fe4a0 [ML] Wait for a stopping datafeed (elastic/x-pack-elasticsearch#1461)
* [ML] Wait for a stopping datafeed

* Fix compilation after rebase

* Address review comments

Original commit: elastic/x-pack-elasticsearch@2baed641e9
2017-05-23 14:31:19 +01:00
Ali Beyad ec175debd0 Enables security to work with index aliases (elastic/x-pack-elasticsearch#1496)
This commit enables security to work with an index named .security (as
it could before) OR an alias named .security that points to a concrete
index by a different name that has the security index.  This prepares
the ability to migrate from a 5.x to 6.x security index that allows
changing and re-indexing the underlying security index while maintaining
a .security alias that points to the underlying updated index.

relates elastic/x-pack-elasticsearch#1216

Original commit: elastic/x-pack-elasticsearch@9fee12e5a0
2017-05-23 09:10:06 -04:00
Alexander Reelsen 521b7a1940 Watcher: Support setting of markdown in attachments (elastic/x-pack-elasticsearch#1492)
Watcher: Support setting of markdown in attachments

This allows to set the `mrkdwn_in` array in slack attachments to specify which fields should contain markdown.
See https://api.slack.com/docs/message-formatting#message_formatting

This is mainly useful for the text and pretext fields in an attachment.

relates elastic/x-pack-elasticsearch#403

Original commit: elastic/x-pack-elasticsearch@ee4180e4bf
2017-05-23 13:33:00 +02:00
David Roberts e198845614 [ML] Avoid masses of log spam/stack traces on shutdown (elastic/x-pack-elasticsearch#1495)
Suppress many job/datafeed errors if a node is known to be shutting down. Also, ensure started datafeeds and open jobs don't end up stopped/failed due to errors as the shutdown progresses, as this would prevent them automatically relocating to a different node.

relates elastic/x-pack-elasticsearch#1114

Original commit: elastic/x-pack-elasticsearch@e56a7dbea1
2017-05-23 10:05:27 +01:00
Ali Beyad 958ee95f26 [TEST] mute watcher test failure that is being tracked in elastic/x-pack-elasticsearch#1517
Original commit: elastic/x-pack-elasticsearch@a28b7ce3a5
2017-05-22 22:01:31 -04:00
Ryan Ernst 68e0bc419a Use simplified ScriptContext (elastic/x-pack-elasticsearch#1502)
This is the xpack side of elastic/elasticsearch#24818

Original commit: elastic/x-pack-elasticsearch@0edbbab431
2017-05-22 13:11:23 -07:00
Ali Beyad f158be89b8 [TEST] fixes tests that attempt to delete documents from missing
indices, as that is now prohibited by elastic/elasticsearch#24518

relates elastic/x-pack-elasticsearch#1511

Original commit: elastic/x-pack-elasticsearch@026a516196
2017-05-22 13:16:53 -04:00
Ali Beyad e0a8881cfc [TEST] mute failing tests, which are tracked in elastic/x-pack-elasticsearch#1511
Original commit: elastic/x-pack-elasticsearch@e23dd847f3
2017-05-22 12:19:56 -04:00
Dimitris Athanasiou aff8258398 [ML] Change result index searches to not use _type (elastic/x-pack-elasticsearch#1509)
Adjusts the searches for

- buckets
- categories
- model snapshots

to not use _type.

Relates elastic/x-pack-elasticsearch#668

Original commit: elastic/x-pack-elasticsearch@8269609705
2017-05-22 14:44:39 +01:00
Hendrik Muhs edc299a532 move verification so that test is in order (elastic/x-pack-elasticsearch#1504)
improves test by taking order of statuses into account

Original commit: elastic/x-pack-elasticsearch@0d214714d3
2017-05-22 15:44:09 +02:00
David Kyle 1873624a18 Fix failing line length checks
Original commit: elastic/x-pack-elasticsearch@6a493a70a4
2017-05-22 12:39:51 +01:00
David Kyle 8e890d0365 Fix test
Original commit: elastic/x-pack-elasticsearch@cdf7950d3f
2017-05-22 12:36:15 +01:00
David Kyle 0425f58d80 [ML] Give test jobs meaningful names (elastic/x-pack-elasticsearch#1508)
Original commit: elastic/x-pack-elasticsearch@97bec3b1e9
2017-05-22 12:22:39 +01:00
David Roberts 5b2ef6e98e [ML] Ignore IndexNotFoundException when deleting quantiles (elastic/x-pack-elasticsearch#1507)
Relates elastic/elasticsearch#24518

Original commit: elastic/x-pack-elasticsearch@34ee52443c
2017-05-22 11:04:27 +01:00
Hendrik Muhs 527dcfd98d [ML] Make job closing robust against crashes in autodetect and other misbehavior (elastic/x-pack-elasticsearch#1480)
Set job to failed if autodetect manager fails closing, fix force closing of jobs that hang in closing 
state, set timeout when waiting for clusterstate update, disallow closing of failed jobs with normal 
close

relates elastic/x-pack-elasticsearch#1453 

Original commit: elastic/x-pack-elasticsearch@493cf85e22
2017-05-22 08:48:33 +02:00
Simon Willnauer 392e67851e Preserve aliases in index permissions (elastic/x-pack-elasticsearch#1501)
Aliases might be contained in requests that check index permissions
to disable caches etc. This commit preserves permissions for
aliases as well.

Original commit: elastic/x-pack-elasticsearch@233195aeba
2017-05-20 21:34:38 +02:00
Ryan Ernst 883f5d8a7a Remove overrides of isInlineScriptEnabled (elastic/x-pack-elasticsearch#1500)
This is the xpack side of elastic/elasticsearch#24815

Original commit: elastic/x-pack-elasticsearch@5aa314a49d
2017-05-20 12:01:34 -07:00
David Roberts fa95474ab8 [BUILD] Change ordering of Java compilation and ML C++ notice extraction
May help to avoid problems with the speed of temporary AWS credentials
propagation (see elastic/x-pack-logstash#73)

Original commit: elastic/x-pack-elasticsearch@c78e00cda5
2017-05-19 13:36:40 +01:00
Tim Vernum b689159077 [TEST] Mock getVersion on channel for ServerTransportFilterTests
Original commit: elastic/x-pack-elasticsearch@0b48c21eb0
2017-05-19 10:15:49 +10:00
Jack Conradson b92a2f6582 Remove deprecated script settings. (elastic/x-pack-elasticsearch#1469)
Original commit: elastic/x-pack-elasticsearch@069e5a1087
2017-05-18 13:32:57 -07:00
Jay Modi 667f842f92 Fix authentication forward compatibility (elastic/x-pack-elasticsearch#1481)
The authentication object was changed in 5.4.0 in that it was conditionally signed depending on
the version and other factors. A bug was introduced however that causes the authentication to
actually get written with the version of the node it is being sent to even if that version is
greater than the version of the current node, which causes rolling upgrades to fail.

Original commit: elastic/x-pack-elasticsearch@a718ff8a52
2017-05-18 15:30:53 -04:00
David Kyle e5810f894c [ML] Catch exceptions in AutoDetectResultProcessor#process and continue (elastic/x-pack-elasticsearch#1484)
Original commit: elastic/x-pack-elasticsearch@f1f6a322e0
2017-05-18 18:40:41 +01:00
Dimitris Athanasiou 1bb7651dba [ML] Refactor filters API to not use _type (elastic/x-pack-elasticsearch#1483)
- Removes dependence on _type for filters.
- Changes the put filter API to take the id in the URI
- Prepares .ml-meta index to be able to host more types in future

Relates elastic/x-pack-elasticsearch#668

Original commit: elastic/x-pack-elasticsearch@d4cffa9382
2017-05-18 18:09:20 +01:00
David Kyle f3c94915b0 [ML] Add sort parameter for get buckets (elastic/x-pack-elasticsearch#1464)
* Add sort parameter for get buckets

* Add secondary sort by time

* Use default values from actions in rest requests

Original commit: elastic/x-pack-elasticsearch@a530c0bed6
2017-05-18 16:40:54 +01:00
Alexander Reelsen 3f68b4facd Watcher: Use existing plugin hook to delete all old templates (elastic/x-pack-elasticsearch#1425)
This commit ensures the old 5.x index templates are removed
using the existing plugin hook, instead of the self written part.

Original commit: elastic/x-pack-elasticsearch@6faf08d98d
2017-05-18 14:21:27 +02:00
Alexander Reelsen 55359433ae Watcher: Return proper GetWatchResponse if watcher index is missing (elastic/x-pack-elasticsearch#1462)
This ensures that the same responses is returned, when a watch is
missing and when the whole watch index is missing for the
GetWatchResponse.

relates elastic/x-pack-elasticsearch#1409

Original commit: elastic/x-pack-elasticsearch@88a7335fa9
2017-05-18 14:19:18 +02:00
Alexander Reelsen adf480f8fd Watcher: Rename watch and triggered watch types to `doc (elastic/x-pack-elasticsearch#1414)
Note: This disables the BWC tests until the upgrade API is here

Original commit: elastic/x-pack-elasticsearch@8011fa06e3
2017-05-18 11:46:03 +02:00
Ryan Ernst 4c3e82604d Convert native script uses to mock scripts (elastic/x-pack-elasticsearch#1465)
This is the xpack side of elastic/elasticsearch#24726

Original commit: elastic/x-pack-elasticsearch@0428fe1d16
2017-05-17 14:56:59 -07:00
Ryan Ernst f7705eac86 Remove file scripts (elastic/x-pack-elasticsearch#1399)
This is the xpack side of elastic/elasticsearch#24627


Original commit: elastic/x-pack-elasticsearch@4d1c745d74
2017-05-17 14:42:46 -07:00
Ryan Ernst 573da95e26 Use new wireCompatVersions property instead of bwcVersion (elastic/x-pack-elasticsearch#1466)
This is the xpack side of elastic/elasticsearch#24748

Original commit: elastic/x-pack-elasticsearch@8b7dd5cdbe
2017-05-17 12:58:51 -07:00
Dimitrios Athanasiou 05daaa8a3c [ML] Fix compilation errors after Version changes
Original commit: elastic/x-pack-elasticsearch@745c1dffac
2017-05-17 18:32:47 +01:00
Dimitrios Athanasiou 646a3acd56 [ML] Fix line width in OpenJobAction
Original commit: elastic/x-pack-elasticsearch@0798745449
2017-05-17 18:14:03 +01:00
Dimitris Athanasiou f0cb7b816d [ML] Add compatibility checks while opening a job (elastic/x-pack-elasticsearch#1458)
This commit adds compatibility checks while opening a job:

- Checks that jobs without versions (< 5.5) are not opened
- Checks that jobs with incompatible types are not opened

Original commit: elastic/x-pack-elasticsearch@a3adab733e
2017-05-17 18:10:36 +01:00
Simon Willnauer d2e1b31bc7 Fix static / version based BWC tests (elastic/x-pack-elasticsearch#1456)
With the leniency in Version.java we missed to really setup BWC
testing for static indices. This change brings back the testing and adds
missing bwc indices.

Relates to elastic/elasticsearch#24732

Original commit: elastic/x-pack-elasticsearch@85e6270338
2017-05-17 17:28:35 +02:00
Dimitrios Athanasiou b9ccee8731 [TEST] Rename remaining yaml tests to yml
Original commit: elastic/x-pack-elasticsearch@5ee8b9ab7b
2017-05-17 15:59:51 +01:00
David Kyle bbf397181e [ML] New JobState enum values needs to be bwc with 5.4 (elastic/x-pack-elasticsearch#1444)
Original commit: elastic/x-pack-elasticsearch@b44d167719
2017-05-17 10:18:08 +01:00
David Kyle abbdf232aa [ML] Test ML with the Transport Client (elastic/x-pack-elasticsearch#1440)
* Hide ML actions for tribe node client
* Remove unused parameters
* Enable ML actions and rest endpoints for the transport client
* Create the ML components for the transport client
* Add ml transport client tests

Original commit: elastic/x-pack-elasticsearch@509007ca29
2017-05-16 14:34:44 +01:00
Dimitris Athanasiou dda456fb76 [ML] Add job version (elastic/x-pack-elasticsearch#1437)
relates elastic/x-pack-elasticsearch#1396

Original commit: elastic/x-pack-elasticsearch@3148c76d7f
2017-05-16 13:28:52 +01:00
Dimitrios Athanasiou e047598ca9 [ML] Fix timestamp comparison in scroll extractor cancellation logic
Original commit: elastic/x-pack-elasticsearch@1b3f88adf0
2017-05-16 13:26:57 +01:00
David Kyle 9f23c2c171 [ML] Wait for closing jobs in a close request (elastic/x-pack-elasticsearch#1398)
* Remove repeated calls to validateAndReturnJobTask

* Wait for closing job

* Refactor resolving job ids

* More close job unit tests

* Don’t finalise closing jobs twice

Original commit: elastic/x-pack-elasticsearch@20616d6f0a
2017-05-16 10:55:05 +01:00
Tanguy Leroux 9a06b5ee77 [Test] Converts LocalExporterTests.testLocalExporterFlush() as REST test (elastic/x-pack-elasticsearch#969)
The LocalExporterTests.testLocalExporterFlush() test was removed in elastic/x-pack-elasticsearch#835 when
LocalExporterTests was changed. This test verified that export exceptions are
thrown when monitoring documents are exported using the Monitoring Bulk API but
the underlying  monitoring indices are closed.

This commit reintroduces this test, but as a REST test this time.

relates elastic/x-pack-elasticsearch#416

Original commit: elastic/x-pack-elasticsearch@0a42f9a1be
2017-05-16 10:08:40 +02:00
Ryan Ernst ef3b954f63 Scripts: Convert template uses to return String instead of BytesReference (elastic/x-pack-elasticsearch#1279)
This is the xpack side of elastic/elasticsearch#24447. The one caveat is
there are a number of places within the xpack api that use
BytesReference to pass down to templates. These are convert to encode
into a BytesArray when necessary, so as not to require changing all of
those apis here at once, but they should all be convert to String as
well.

Original commit: elastic/x-pack-elasticsearch@8399b9d8c3
2017-05-15 22:37:51 -07:00
Jay Modi f5cd833af4 Use epoch millis for token expiration instead of ZonedDateTime (elastic/x-pack-elasticsearch#1417)
For user tokens, we were storing the expiration time as a date with the date time format in the
mappings. Occasionally, we would get CI failures due to parsing the date and having an invalid
format. This change simplifies the user tokens to simply use an Instant and convert it to the epoch
millis when we index the document. This eliminates the need for a date formatter and should ensure
we no longer have issues with parsing the dates.

Additionally, the TokenAuthIntegTests#testExpireMultipleTimes could fail if the token was expired
but the approximation for the expiration time was after the current time. In order to resolve this
we get the exact expiration time from the token and use that in the test.

relates elastic/x-pack-elasticsearch#1255

Original commit: elastic/x-pack-elasticsearch@d4bf53e7bc
2017-05-15 14:20:12 -06:00
Igor Motov 53753311f3 Move ReindexAction class to core (elastic/x-pack-elasticsearch#1426)
X-Pack counterpart of elastic/elasticsearch#24684

Relates to elastic/x-pack-elasticsearch#24578

Original commit: elastic/x-pack-elasticsearch@e5cd09cf4b
2017-05-15 14:29:17 -04:00
Tanguy Leroux ffcee524c5 Make SignificantTerms.Bucket an interface rather than an abstract class
Related to elastic/elasticsearch#24670

Original commit: elastic/x-pack-elasticsearch@e5b0123fbc
2017-05-15 15:19:19 +02:00
Dimitris Athanasiou e36e2c604d [ML] Write updated model snapshot to its original index (elastic/x-pack-elasticsearch#1415)
When we update a model snapshot we need to write it back to
the exact index where we read it from. This is necessary
for rollover as otherwise we would end up with two different
versions of the same snapshot.

Relates elastic/x-pack-elasticsearch#827

Original commit: elastic/x-pack-elasticsearch@b5d1ab38a7
2017-05-15 12:00:15 +01:00
Tim Vernum 463133b7de [Security] Cross cluster wildcard security (elastic/x-pack-elasticsearch#1290)
Support the resolution of remote index names, including those that contain wildcards in the cluster name or index part)

Specifically these work:
- `GET /remote*:foo/_search`
- `GET /*:foo/_search`
- `GET /*:foo,*/_search`
- `GET /remote:*/_search`
- `GET /*:*/_search`

This change assumes that every user is allowed to attempt a cross-cluster search against any remote index, and the actual authorisation of indices happens on the remote nodes. Thus ` GET /*:foo/_search` will expand to search the `foo` index on every registered remote without consideration of the roles and privileges that the user has on the source cluster.

Original commit: elastic/x-pack-elasticsearch@b45041aaa3
2017-05-15 15:02:13 +10:00
Andrew Cholakian 6413dcd759 [Logstash] New mapping for pipeline viewer (elastic/x-pack-elasticsearch#573)
Add `logstash-states` + other mapping fields for logstash pipeline viewer
This is part of https://github.com/elastic/x-pack-logstash/pull/25

Original commit: elastic/x-pack-elasticsearch@1940d79d13
2017-05-12 18:31:59 -05:00
Jason Tedor 879b4457f3 Update Netty to 4.1.11.Final
This commit upgrades the Netty dependency from 4.1.10.Final to
4.1.11.Final.

Relates elastic/x-pack-elasticsearch#1418

Original commit: elastic/x-pack-elasticsearch@1944a6f5f9
2017-05-12 15:54:05 -04:00
Dimitris Athanasiou 0ac38b05e4 [ML] Require job to have explicit data_description (elastic/x-pack-elasticsearch#1411)
relates elastic/x-pack-elasticsearch#1187

Original commit: elastic/x-pack-elasticsearch@aa2051f959
2017-05-12 17:24:27 +01:00
Alexander Reelsen 50e9e413da Watcher: Make watch history use doc type instead of watch_record (elastic/x-pack-elasticsearch#1311)
As this does not require any reindexing this is easy to fix by just
changing the watch history template.

In addition the old templates are deleted on start up and the new ones
are instantiated.

Original commit: elastic/x-pack-elasticsearch@7e1ad495ad
2017-05-12 16:52:57 +02:00
Jim Ferenczi de1d98b135 Adapt x-pack after the parent/child modularisation (elastic/x-pack-elasticsearch#1407)
This is the x-pack side of elastic/elasticsearch#24634
The hasChild, hasParent queries and the children agg are now in a module.

Original commit: elastic/x-pack-elasticsearch@e9b1296fc3
2017-05-12 15:59:40 +02:00
javanna 4f073cd4bd fix typo in AuthorizationService comment
Original commit: elastic/x-pack-elasticsearch@f747df0311
2017-05-12 11:18:01 +02:00
Simon Willnauer 0215356f12 Remove XPackDeleteByQueryAction BWC (elastic/x-pack-elasticsearch#1400)
5.5 will use delete by query from the module directly and has the
BWC layer in-place. This change therefore removes the BWC layer from 6.0

Relates to elastic/x-pack-elasticsearch#1378

Original commit: elastic/x-pack-elasticsearch@d4d4d6bc61
2017-05-12 10:19:21 +02:00
Simon Willnauer 2e34f160ff [TEST] Add ReindexPlugin to AutodetectResultProcessorIT
Original commit: elastic/x-pack-elasticsearch@acd19bf25c
2017-05-11 21:51:02 +02:00
Simon Willnauer 891c2a6c3f Replace XPacks delete_by_query impl with the core impl (elastic/x-pack-elasticsearch#1378)
This can now be shared with core once elastic/elasticsearch#24578

Original commit: elastic/x-pack-elasticsearch@42bbd75aee
2017-05-11 20:23:55 +02:00
Nik Everett 3ad2da0d87 Fix ordering
Core changed how you specify bucket ordering so we need to change
too.

Original commit: elastic/x-pack-elasticsearch@73d09f64c7
2017-05-11 13:44:17 -04:00
Nik Everett 16aa600830 Fix http request round trip tests
I broke this by adding more randomization to core's randomTimeValue
method. Now it produces valid time values that don't round trip
properly over the XContent API. This change causes the test to skip
trying to round trip time these sorts of time values.

Original commit: elastic/x-pack-elasticsearch@dcdd588bdb
2017-05-11 13:29:33 -04:00
Dimitrios Athanasiou 9ccf617a95 [TEST] Add explanation for custom random time value in ChunkingConfigTests
Original commit: elastic/x-pack-elasticsearch@9e03fb833f
2017-05-11 16:26:00 +01:00
Dimitrios Athanasiou 2e1ac420d7 [TEST] Fix ChunkingConfigTests due to time value randomization
Original commit: elastic/x-pack-elasticsearch@c145b399b6
2017-05-11 16:04:38 +01:00
Dimitris Athanasiou ba40994b1f [ML] Separate read from write index for results (elastic/x-pack-elasticsearch#1397)
This is in preparation of introducing a write alias.
It adjusts all requests to persist results to do so
using a method that returns the write alias (even though
it currently returns the same as the read alias).

Relates elastic/x-pack-elasticsearch#827

Original commit: elastic/x-pack-elasticsearch@1358dd8dcf
2017-05-11 14:44:40 +01:00
jaymode 4d3bc71327 Test: randomly assign the superuser role in RunAsIntegTests
This commit updates the RunAsIntegTests to randomly assign the superuser role to the user that
is authenticating with the cluster but the request is being run as a different user. This provides
additional validation that the authorization errors are actually coming from the user the request
is running as and not due to the authenticating user's privileges.

Original commit: elastic/x-pack-elasticsearch@c6360d13e6
2017-05-11 09:18:57 -04:00
Dimitris Athanasiou 69f9fa8ae9 [ML] Map new fields as keywords in results index (elastic/x-pack-elasticsearch#1387)
Each job introduces new fields to the results index matching
the analysis terms. When the job is created, mappings for those
are added explicitly. However, when rollover is introduced, that
will not be the case. This commit prepares for that by adding
dynamic mapping of new fields as keyword.

Relates elastic/x-pack-elasticsearch#827

Original commit: elastic/x-pack-elasticsearch@8f6cd09a71
2017-05-11 13:47:31 +01:00
David Roberts c4c57e6497 [TEST] Unit test that ML handles configs with brackets in field names (elastic/x-pack-elasticsearch#1395)
Original commit: elastic/x-pack-elasticsearch@a1d12bc254
2017-05-11 10:54:39 +01:00
Tim Vernum f3d5cf229b Change user cache TTL to be based on write not access time (elastic/x-pack-elasticsearch#1373)
This was the behaviour in Shield 2.x, but it was accidentally changed during migration to X-Pack 5.x

Original commit: elastic/x-pack-elasticsearch@de0bf5e688
2017-05-11 14:02:57 +10:00
Ryan Ernst f59b71629a Fix user copied in SecurityContext.executeAfterRewritingAuthentication (elastic/x-pack-elasticsearch#1391)
Also added a unit test for this method

Original commit: elastic/x-pack-elasticsearch@637a865119
2017-05-10 18:00:04 -07:00
Dimitrios Athanasiou 25505fad95 [TEST] Add missing verification in AutoDetectResultProcessorTests
Original commit: elastic/x-pack-elasticsearch@22b620a947
2017-05-10 17:59:54 +01:00
Dimitris Athanasiou 49eb5ea136 [ML] Retrieve model snapshot via search (elastic/x-pack-elasticsearch#1376)
This removes the last remaining GET in JobProvider.

Relates elastic/x-pack-elasticsearch#827

Original commit: elastic/x-pack-elasticsearch@820344be67
2017-05-10 17:26:37 +01:00
David Kyle 0c0961134d Fix compilation
Original commit: elastic/x-pack-elasticsearch@f4dc2c5ce7
2017-05-10 16:16:49 +01:00
David Kyle fdf86967ce [ML] Fix bug initialising ML MetaData (elastic/x-pack-elasticsearch#1386)
Slightly different to the commit I just reverted (elastic/x-pack-elasticsearch#1352)

Original commit: elastic/x-pack-elasticsearch@46339418ae
2017-05-10 16:06:13 +01:00
David Roberts 7a32304f2c [ML] Don't try to gracefully shut down the controller on unsupported platforms (elastic/x-pack-elasticsearch#1384)
It just wastes 20 seconds while we timeout trying to open named pipes that cannot
possibly have been created.

Original commit: elastic/x-pack-elasticsearch@4e447874f6
2017-05-10 16:03:16 +01:00
David Kyle 1994b42cd5 Revert "[ML] Fix bug initialising ML Metadata (elastic/x-pack-elasticsearch#1377)"
This reverts commit elastic/x-pack-elasticsearch@4e4923634a.

Original commit: elastic/x-pack-elasticsearch@3de80a1577
2017-05-10 15:56:49 +01:00
Hendrik Muhs c43ae014b4 Replace timestamp initialization 'now' to an explicit timestamp. (elastic/x-pack-elasticsearch#1383)
fixes build errors. Still ensures that the timestamp is set to 'now' if the parsed logfile misses it.

Original commit: elastic/x-pack-elasticsearch@cf60e8d76b
2017-05-10 16:17:30 +02:00
David Kyle d34192ff6f [ML] Fix bug initialising ML Metadata (elastic/x-pack-elasticsearch#1377)
* Fix bug initialising ML MetaData


Original commit: elastic/x-pack-elasticsearch@4e4923634a
2017-05-10 15:01:37 +01:00
Dimitris Athanasiou a5a44a2e2e [ML] Also revert quantiles and model_size_stats (elastic/x-pack-elasticsearch#1369)
When a model snapshot is reverted, we should also revert
quantiles and model_size_stats to the ones of the reverted
snapshot.

relates elastic/x-pack-elasticsearch#1342

Original commit: elastic/x-pack-elasticsearch@ddabe40470
2017-05-10 12:04:22 +01:00
David Roberts cd99024599 [ML] Validate job configs before transport (elastic/x-pack-elasticsearch#1375)
If invalid job configs are transported to the master node then the root
cause of the validation exception gets reported as a remote_transport_exception,
which is extremely confusing.

This commit moves the validation of job configurations to the first node that
handles the action.

Fixes elastic/x-pack-kibana#1172

Original commit: elastic/x-pack-elasticsearch@5ed59d2a6f
2017-05-10 10:55:16 +01:00
Tanguy Leroux f3b3df0911 [Test] Ensure monitoring indices are yellow in LocalExporterTests
Before searching for documents in monitoring indices, we need to ensure
that they exist and are available.

Original commit: elastic/x-pack-elasticsearch@29db55a1fe
2017-05-10 09:53:59 +02:00
Ryan Ernst 85deb1f8f7 Rename ScriptEngineService to ScriptEngine (elastic/x-pack-elasticsearch#1374)
This is the xpack side of elastic/elasticsearch#24574

Original commit: elastic/x-pack-elasticsearch@4d37021f6d
2017-05-10 00:47:39 -07:00
Hendrik Muhs c1016f3c3d [ML] simple log throttler for autodetect logging (elastic/x-pack-elasticsearch#1323)
Adds a simple log throttler for autodetect logging, summarizes log messages if
they repeat often in a short time period. Throttler gets disabled for debug logging.

relates to: https://github.com/elastic/machine-learning-cpp/issues/111

Original commit: elastic/x-pack-elasticsearch@6729b1fd7c
2017-05-10 09:25:05 +02:00
Ryan Ernst 940ca229aa Fix xpack test using deprecated setting
Original commit: elastic/x-pack-elasticsearch@f98d24782b
2017-05-09 17:32:50 -07:00
Ryan Ernst 1c3d907748 Reverse runAs user setup to store authenticated user inside runAs user (elastic/x-pack-elasticsearch#1371)
Original commit: elastic/x-pack-elasticsearch@8276662298
2017-05-09 13:49:14 -07:00
Jay Modi 590eea57ac Add a base security rest handler (elastic/x-pack-elasticsearch#1239)
This commit adds a base rest handler for security that handles the license checking in the security
apis. This was done previously in some rest handlers but not all and actually had issues where a
value would be returned but we may not have consumed all of the request parameters, which could
lead to a different response being returned than what we would have expected.

relates elastic/x-pack-elasticsearch#1236

Original commit: elastic/x-pack-elasticsearch@2f1100b64a
2017-05-09 14:47:11 -04:00
Chris Earle 7965def49c [TEST] Mark test with AwaitsFix for elastic/x-pack-elasticsearch#1353
Original commit: elastic/x-pack-elasticsearch@a9705d3816
2017-05-09 11:29:39 -04:00
Nik Everett 387944b95a Add defense against broken scrolls (elastic/x-pack-elasticsearch#1327)
Adds defenseagainst broken scrolls to the fetching roles and users.
While Elasticsearch *shouldn't* send broken scrolls it has done so
in the past and when it does this causes security to consume the
entire heap and crash. This changes it so we instead fail the request
with a message about the scroll being broken.

Relates to elastic/x-pack-elasticsearch#1299

Original commit: elastic/x-pack-elasticsearch@dfef87e757
2017-05-09 11:18:15 -04:00
Tanguy Leroux 0a860df9f9 [Test] Restore random documents indexing in LocalExporterTests (elastic/x-pack-elasticsearch#1328)
In elastic/x-pack-elasticsearch#1212, we removed a randomized condition that inserts documents when
the exporter is enabled but before the monitoring is started. This
condition should not have been removed as it allows to test that the
exporters are correctly initialized when the Monitoring Bulk API is used
 by an external application.

This commit also fixed a failure when a search request fails because the
 monitoring indices are not yet ready (see
 https://github.com/elastic/x-pack-elasticsearch/issues/956#issuecomment-298338589)

Original commit: elastic/x-pack-elasticsearch@73ab535ae0
2017-05-09 09:39:25 +02:00
jaymode b450664766 Test: ensure system supports ECDSA before running EllicpticCurveSSLTests
Some JDKs do not support the ECDSA cipher suites that we use in the EllipticCurveSSLTests, which
is the underlying cause of some CI failures. This change ensures there is at least one enabled
ECDSA cipher before testing that a connection can be made.

relates elastic/x-pack-elasticsearch#1278

Original commit: elastic/x-pack-elasticsearch@f6c93d776c
2017-05-08 12:36:20 -04:00
David Kyle e5b11d0222 [ML] Not an error to close a job twice (elastic/x-pack-elasticsearch#1340)
* [ML] Not an error to close a job twice

* Error if job is opening

* Address review comments

* Test closed job isn’t resolved

Original commit: elastic/x-pack-elasticsearch@7da7b24c08
2017-05-08 16:34:46 +01:00
David Roberts 9264ad541e [ML] Only attempt to get the native code version when ML is enabled (elastic/x-pack-elasticsearch#1346)
Originally we used to try to get the native code version even when ML was disabled.
However, this has proved to be an annoyance in cases where people running on
unsupported platforms have disabled ML. This commit means we'll only try to get
the native code version if ML is enabled on a node.

Original commit: elastic/x-pack-elasticsearch@778d6708d2
2017-05-08 16:16:23 +01:00
Dimitris Athanasiou 28f2ba3ef8 [ML] Retrieve data counts via search (elastic/x-pack-elasticsearch#1339)
Relates elastic/x-pack-elasticsearch#827

Original commit: elastic/x-pack-elasticsearch@73a6848526
2017-05-08 13:02:07 +01:00
David Kyle 4e25e1a24d [ML] Use XContentBuilders in try with resource statements (elastic/x-pack-elasticsearch#1329)
* [ML] Use XContentBuilders in try with resource statements

* Address review comments

Original commit: elastic/x-pack-elasticsearch@ef5b45e2f4
2017-05-08 11:41:23 +01:00
Tim Vernum 0a15b03395 [TESTS] A proper fix to MultipleAdRealmTests
Original commit: elastic/x-pack-elasticsearch@f04b3ebb7a
2017-05-08 00:17:00 +10:00