Commit Graph

6481 Commits

Author SHA1 Message Date
Andrei Stefan a6d8319231
* Wrap a verification_exception in case there is no valid index available (#64267)
Wrap a verification_exception in case there is no valid index available in an index_not_found_exception providing also the original index pattern that may be lost in the chain of filters involving the Security one.

(cherry picked from commit 9c9da2f2f9a4ad12704f7d3a273f067e96cd2054)
2020-10-29 10:14:50 +02:00
Armin Braun 6bd8f079a7
Enhance CacheFile#invariant Assertion (#64272) (#64280)
Follow up to #64180 tightening the assertion further.
2020-10-28 13:43:39 +01:00
Armin Braun 2983584ef6
Fix #invariant Assertion in CacheFile (#64180) (#64264)
Fix #invariant Assertion in CacheFile

closes #64141
2020-10-28 10:22:47 +01:00
jimczi 2492f48375 Fix test compilation 2020-10-28 08:58:09 +01:00
Jim Ferenczi dcc433c971 Fix UOE when fetching flattened field (#64241)
The new fields option allows to fetch the value of all fields in the mapping.
However, internal fields that are used by some field mappers are also shown when
concrete fields retrieved through a pattern (`*` or `foo*`).
We have a [long term plan](https://github.com/elastic/elasticsearch/issues/63446) to hide these fields in field_caps and from pattern resolution
so this change is just a hot fix to ensure that they don't break the retrieval in the meantime.
The `flattened._keyed field will show up as an empty field when using a pattern that match the
flattened field.

Relates #63446
2020-10-28 08:49:03 +01:00
Jason Tedor b46b6d5977
Fix compilation in DataTierTests.java
This commit fixes a compilation issue in DataTierTests.java that was
introduced due to language-level differences between 7.10/7.x and
master.
2020-10-27 13:04:55 -04:00
Jason Tedor 04a9845a49
Adjust defaults for tiered data roles (#64015)
This commit adjusts the defaults for the tiered data roles so that they
are enabled by default, or if the node has the legacy data role. This
ensures that the default experience is that the tiered data roles are
enabled.

To fully specifiy the behavior for the tiered data roles then:
 - starting a new node with the defaults: enabled
 - starting a new node with node.roles configured: enabled if and only
   if the tiered data roles are explicitly configured, independently
   of the node having the data role
 - starting a new node with node.data enabled: enabled unless the
   tiered data roles are explicitly disabled
 - starting a new node with node.data disabled: disabled unless the
   tiered data roles are explicitly enabled
2020-10-27 12:48:31 -04:00
Costin Leau 6ca0b6ae6d EQL: Improve request logging (#64206)
Add logging to multi-search queries
Log response count

(cherry picked from commit ee9b9d58f68e2d545d5d841e2f683ec4e96f79e6)
(cherry picked from commit 02a4c6b83475cebe715311eeba123ad6fc8d6ba1)
2020-10-27 17:23:43 +02:00
Costin Leau 2363c4be4b EQL: Polish testing infra (#64205)
Add tie-breaker inside request creation
Add configurable timeout

(cherry picked from commit ff281d7b6fd7b4cd2f08bac49aa0b354b6812940)
(cherry picked from commit 34bd76fc2987b1ad0b6275ac4358e362a0ba7fb0)
2020-10-27 17:23:43 +02:00
Henning Andersen 0cba23e08f XPack Usage should run on MANAGEMENT threads (#64160)
XPack usage starts out on management threads, but depending on the
implementation of the usage plugin, they could end up running on
transport threads instead. Fixed to always reschedule on a management
thread.
2020-10-27 16:03:26 +01:00
Nhat Nguyen 566d1fd459 Return the same point in time in search response (#64188)
With this change, we will always return the same point in time in a
search response as its input until we implement the retry mechanism
for the point in times.
2020-10-27 10:17:44 -04:00
Armin Braun 6f1c8136a6
Fix CachedBlobContainerIndexInputTests Shutdown (#64181) (#64211)
Same problem as in #64100 we have to safely wait for all operations to go through to
not leak file handles potentially in this test.
2020-10-27 14:22:43 +01:00
Armin Braun 93b52df8c1
Fix SearchableSnapshotDirectoryTests Leaking Listeners (#64150) (#64156)
We need to make sure we don't shut down the pool while ref count release
operations are enqueued but not yet executing.
2020-10-26 13:46:14 +01:00
David Kyle 51f8b0b8d2 Mute MonitoringWithWatcherRestIT.testThatLocalExporterAddsWatche (#64143) 2020-10-26 10:19:48 +00:00
Armin Braun 8161513cb6
Fix Expected Exception Check in BlobstoreCacheService (#63474) (#64135)
The `NodeNotConnectedException` exception can be nested as well in the
fairly unlikley case of the disconnect occuring between the connected check
and actually sending the request in the transport service.

Closes #63233
2020-10-26 10:43:29 +01:00
Armin Braun 17843a40ef
Fix SearchableSnapshotDirectoryTests.testClearCache (#64100) (#64132)
There is a small chance that the file deletion will run
on the searchable snapshot thread pool and not on the test
thread now that the cache is non-blocking in which case
we fail the assertion unless we wait for that thread.
2020-10-26 10:27:08 +01:00
David Roberts adc5509eda
[ML] Support the unsigned_long type in data frame analytics (#64072)
Adds support for the unsigned_long type to data frame analytics.

This type is handled in the same way as the long type.  Values
sent to the ML native processes are converted to floats and
hence will lose accuracy when outside the range where a float
can uniquely represent long values.

Backport of #64066
2020-10-26 09:05:49 +00:00
Armin Braun bd07e44c9a
Make Searchable Snapshot's CacheFile Lock less (#63911) (#64125)
Replacing the mechanism for eviction and listener references via a read-write lock by
a reference counting implementation.
This fixes a bug that caused test failure #63586 in which concurrently trying to acquire or release
an eviction listener while doing a file operation would sometimes lead to throwing an exception
since the `tryLock` call on the read lock would fail in this case.
Also this removes the possibility of blocking cluster state updates as a result of them waiting
on the write-lock which might take a long time if a slow read operation executes concurrently.

Closes #63586
2020-10-26 09:30:22 +01:00
David Roberts cb0c538b35 [ML] Fix rare ML daily maintenance test race condition (#64043)
Depending on thread scheduling the ML daily maintenance
tests could do one more iteration than expected, causing
rare failures.

Fixes #64036
2020-10-22 13:03:02 +01:00
Rory Hunter bfd2cbed86
Remove deprecation indexing code from 7.10 (#63942)
The deprecation indexing code was writing to a regular data stream,
and it is not yet possible to hide a data stream or prefix it with
a period. This functionality we be re-added once it is possible to
mark a data stream as hidden, and also to not rely on the standard
logs template since that can be disabled.
2020-10-21 16:28:21 +01:00
James Rodewig 7551c4dc7f
[DOCS] Avoid trailing newline in apikey base64 encoding (#63720) (#64002)
Co-authored-by: James Rodewig <40268737+jrodewig@users.noreply.github.com>

Co-authored-by: Jurgen Braam <g.j.m.braam@gmail.com>
2020-10-21 09:44:48 -04:00
Yang Wang c1071b1eb4
Update invalidate api key doc for the new ids field (#63860) (#63994)
Follow-up for #63224 and adds the missing doc update for the new ids field.
2020-10-22 00:19:41 +11:00
Yang Wang 428fd7218c
Use asterisk instead of empty string to clear all cached entries (#63907) (#63989)
The officially supported way to clearing all entries from a cache is to use 
wildcard of either * or _all. Though empty string has the same effect, it was
never intended. Therefore the tests should not use empty string and this PR
changes them to use *.
2020-10-21 23:14:01 +11:00
Hendrik Muhs f2517678aa
[7.10][Transform] add support for unsigned_long data type (#63957)
add support for unsigned_long, which required a change in
writing out integer results properly, because coerce is not
supported for unsigned_long

fixes #63871
backport #63940
2020-10-20 21:05:46 +02:00
Ignacio Vera d0f5066310
Upgrade to lucene-8.7.0-snapshot-72d8528c3a6 (#63912) (#63928) (#63933) 2020-10-20 15:08:06 +02:00
Benjamin Trent eff7f06ca6
[ML] fix inference binary classification predication label and feature importance (#63688) (#63930)
When calculating feature importance, the leaf values directly correlate the value of the importance.

Consequently, positive leaf values -> positive feature importance

negative leaf values -> negative feature importance.

It follows that for binary classification, this is done such that the importance relates to the leaf values, which relate directly to the "probability of class 1".

So, the feature importance calculated is always for the importance as it relates to class 1.

The inverse is the importance as it relates to class 0.
2020-10-20 08:50:15 -04:00
Mayya Sharipova 1287df4074 Fix max/min aggs for unsigned_long (#63904)
Max and min aggs were producing wrong results for unsigned_long field
if field was indexed. If field is indexed for max/min aggs instead of
field data, we use values from indexed Points, values of which
are derived using method pointReaderIfPossible. Before
UnsignedLongFieldType#pointReaderIfPossible was incorrectly
producing values, as it failed to shift them back to original
values.

This patch fixes method pointReaderIfPossible to produce
correct original values.

Relates to #60050
2020-10-19 15:59:55 -04:00
Adam Locke c28c3422bb
[DOCS] [7.10] Combining important config settings into a single page (#63849) (#63883)
* [DOCS] Combining important config settings into a single page (#63849)

* Combining important config settings into a single page.

* Updating ids for two pages causing link errors and implementing redirects.

* Updating links to use IDs instead of xrefs.
2020-10-19 12:59:44 -04:00
Julie Tibshirani f122b88bc5 Remove dependency from version plugin. 2020-10-18 14:09:32 -07:00
Lisa Cawley e6959d0d20
[7.10][DOCS] Add grant API key API and grant_api_key privilege (#63853) 2020-10-16 15:41:46 -07:00
Andrei Stefan 5f3c79d64b
Remove filter from QL's field_caps requests (#63840) (#63845)
(cherry picked from commit f009e6341d0fc0471f212d5a41c91e7aab77e006)
2020-10-17 01:36:26 +03:00
James Rodewig 179c6d4014
[DOCS] Fix role template snippet (#63774) (#63779) 2020-10-16 08:24:29 -04:00
Enrico Zimuel e724be5f41
Specify security.get_role_mapping and security.get_role name as list (#53207) (#63785)
This commit updates the rest API specs for

- security.get_role_mapping to specify name as a list type.
- security.get_role to specify name as a list type.

Co-authored-by: Russ Cam <russ.cam@elastic.co>
2020-10-16 14:22:37 +02:00
Ioannis Kakavas 364511395d
[7.10] Move RestRequestFilter to core (#63507)
Move RestRequestFilter to core so that Rest requests outside xpack can use 
it to filter fields and expand its usage.

Backport of #63507
2020-10-16 13:57:52 +03:00
Jim Ferenczi 1d78bd0f72 Async search should retry updates on version conflict (#63652)
* Async search should retry updates on version conflict

The _async_search APIs can throw version conflict exception when the internal response
is updated concurrently. That can happen if the final response is written while the user
extends the expiration time. That scenario should be rare but it happened in Kibana for
several users so this change ensures that updates are retried at least 5 times. That
should resolve the transient errors for Kibana. This change also preserves the version
conflict exception in case the retry didn't work instead of returning a confusing 404.
This commit also ensures that we don't delete the response if the search was cancelled
internally and not deleted explicitly by the user.

Closes #63213
2020-10-16 08:49:02 +02:00
Albert Zaharovits f4e1e6893d Add view_index_metadata over metricbeat-* for monitoring agent (#63750)
The `remote_monitoring_agent` reserved role is extended to grant more privileges
over the metricbeat-* index pattern.
In addition to the index and create_index index privileges that it granted already,
it now also grants the view_index_metadata privilege.

Closes #63203
2020-10-16 02:13:55 +03:00
Jay Modi ebdaeb2f9a
Ensure cancelled jobs do not continue to run (#63771)
This commit ensures that jobs within the SchedulerEngine do not
continue to run after they are cancelled. There was no synchronization
between the cancel method of an ActiveSchedule and the run method, so
an actively running schedule would go ahead and reschedule itself even
if the cancel method had been called.

This commit adds synchronization between cancelling and the scheduling
of the next run to ensure that the job is cancelled. In real life
scenarios this could manifest as a job running multiple times for
SLM. This could happen if a job had been triggered and was cancelled
prior to completing its run such as if the node was no longer the
master node or if SLM was stopping/stopped.

Closes #63754
Backport of #63762
2020-10-15 14:01:14 -06:00
Jay Modi 4d6daa6e40
Handle missing logstash index exceptions (#63753)
This commit updates the APIs in the logstash plugin to handle
IndexNotFoundExceptions that are returned by client calls. Until we
have the creation of this index in place, we need to handle this case
and not let the exception propagate out of the API.

Backport of #63698
2020-10-15 09:45:02 -06:00
Marios Trivyzas 1dbd3a90ae
EQL: [Tests] Use snapshot from 7.10
To be able to run the tests from 7.10 onwards use a snapshot created
with 7.10.

Follows: #63735
2020-10-15 17:28:52 +02:00
Bogdan Pintea 35f5c49e54
SQL: integer parameter validation in string functions (#63338) (#63728)
* SQL: integer parameter validation in string functions (#58923)

In insert, locate, substring function, when argument `start` or `length` is greater than Integer.MAX_INT OR less then Integer.MIN_INT + 1 (note that `start` need to minus 1), it causes overflow and leads to unexpected results.

* Add range checks for BinaryStringNumericProcessors

- Add range checks for Left, Right, Repeat.
- Minor refactorings on initial PR changes.

Co-authored-by: yinanwu <yinanwu@tencent.com>
(cherry picked from commit bf6dc58b93529f977d035a846d083b1c31867694)

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2020-10-15 16:00:48 +02:00
Marios Trivyzas 095f979060
EQL: [Tests] Add correctness integration tests (#63644) (#63735)
Add a new gradle module under eql/qa which runs and validates a set of
queries over a 4m event dataset (restored from a snapshot residing in a
gcs bucket). The results are providing by running the exact set of queries
with Python EQL against the same dataset.

Co-authored-by: Marios Trivyzas <matriv@users.noreply.github.com>
(cherry picked from commit 1cf789e5fcfb0f364f665bfaac021e24a4c2f556)

Co-authored-by: Mark Vieira <portugee@gmail.com>
2020-10-15 15:28:26 +02:00
Costin Leau 06eae58d40 EQL: Fix translation of bool fields (#63694)
This commit fixes two issues in dealing with bool fields in EQL:
- avoid simplifications of field == true expressions
- adding comparison to clauses on fields missing logic (where bool)

Fix #63693

(cherry picked from commit d10a5d0e842bbd4e0031834de948ceb24da3872b)
(cherry picked from commit 0227da3a275c7f22ff524d99d53e1a79146f9e28)
2020-10-15 14:38:31 +03:00
Hendrik Muhs 65ef399563 [Transform] increase timeout in testStopWaitForCheckpoint (#63657)
increase the overall timeout by increasing the wait time after every retry.

fixes #63365
2020-10-15 08:51:33 +02:00
Albert Zaharovits 2b7fbe9957 Add the missing apikey.* fields to the logfile audit layout for docker builds (#63609)
The layout pattern for the security audit for docker builds was missing the apiKey.* fields.
2020-10-14 13:58:41 +03:00
Tanguy Leroux 57b5715bf7
Add CCR repository test for snapshot shard size (#63649)
Following #61906 this commit adds two new integration tests
that verifies the sizes of snapshotted shards for CCR repositories.

Backport of #63590
2020-10-14 12:51:42 +02:00
Ryland Herrick 7e8769a666
EQL: make allow_no_indices true by default (#63573) (#63645)
* Allow all indices options variants
Irrespective of allow_no_indices value, throw VerificationException when
there is no index validated

Co-authored-by: Andrei Stefan <astefan@users.noreply.github.com>
2020-10-14 03:41:04 +03:00
Lee Hinman 7371e51583
[7.10] Add DiscoveryNodeRole compatibility role for bwc tier serialization (#63581) (#63613)
Backports the following commits to 7.10:

    Add DiscoveryNodeRole compatibility role for bwc tier serialization (#63581)
2020-10-13 09:17:15 -06:00
Andras Palinkas f9c8ae5f77 SQL: Improve parser error message for `ESCAPE` (#63616)
Mentions the list of wildchars in case a wildchar is used as an
`ESCAPE` character.

Relates #63428

(cherry picked from commit 74cbcf871e9593b3640e382ae6845168fd14966b)
2020-10-13 10:47:06 -04:00
Andras Palinkas 4aabc050a0 SQL: Escaped wildcard (*) not accepted in LIKE (#63428)
For a query like `SELECT name FROM test WHERE name LIKE ''%c*'` ES SQL
generates an error. `*` is not a special character in a `LIKE` construct
and it's expected to not needing to be escaped, so the previous query
should work as is.
In the LIKE pattern any `*` character was treated as invalid character
and the usage of `%` or `_` was suggested instead. But `*` is a valid,
acceptable non-wildcard on the right side of the `LIKE` operator.

Fix: #55108
(cherry picked from commit 190d9fe3deb31aed0d8f312007360625d4fff217)
2020-10-13 10:47:03 -04:00
Przemysław Witek acbd48f834
[ML] Allow setting num_top_classes to a special value -1 (#63587) (#63602) 2020-10-13 13:57:50 +02:00