Commit Graph

1881 Commits

Author SHA1 Message Date
Martijn van Groningen 1ae4f3c937
Add enrich node cache (#76800)
Introduce a LRU cache to avoid searches that occur frequently
from the enrich processor.

Relates to #48988
2021-09-03 09:33:44 +02:00
Przemysław Witek 676d4de3de
[Transform] Implement the ability to preview the existing transform (#76697) 2021-08-24 14:41:49 +02:00
Jay Modi 22e9d3719d
System indices treated as restricted indices (#74212)
System indices should be treated as a special set of indices and not be
accessible by all users. The existing security codebase has the notion
of restricted indices, which are currently a subset of system indices.

This change unifies the two concepts by making system indices the set
of restricted indices. This means that going forward, consumers of
system indices will need access to restricted indices.

Our intention is that this will be handled internally as much as
possible.  For example, restricted index access can be used implicitly 
by setting a valid origin on a request or using a system index plugin.
In these cases, the security module will apply internally defined
privileges when necessary.

The main impact of this change for developers is that system index
deletions will require superuser privileges, so we have to make sure
we are using an admin role for test cleanup.

Closes #69298

Co-authored-by: William Brafford <william.brafford@elastic.co>
Co-authored-by: Albert Zaharovits <albert.zaharovits@elastic.co>
2021-08-20 09:28:33 -04:00
Tim Vernum 76a684ad32
Replace X-Pack SSL config with libs/ssl-config (#76636)
This is the final step in the removal of the X-Pack specific SSL
configuration code (replaced by libs/ssl-config)

For some time we have had two implementations of SSL Configuration
code. One was in org.elasticsearch.xpack.core.ssl, the other in
org.elasticsearch.common.ssl

These two implementations had essentially the same functionality:
- Handle settings such as '*.ssl.certificate`, `*.ssl.key` etc
- Load certificates and keys from PEM files and Keystores
- Build and configure Java class such as SSLContext, KeyManager, etc
  based on the configuration and certificates.

As of this common the X-Pack version is no more, and all SSL
configuration in Elasticsearch is handled by the libs/ssl-config
version instead.

Resolves: #68719
2021-08-20 10:31:02 +10:00
Przemysław Witek ec07e4213e
[Transform] Rename interim_results to align_checkpoints (#76609) 2021-08-18 13:58:50 +02:00
Rory Hunter d01efa4fd6
Changes to keep Checkstyle happy after reformatting (#76464)
* Reformatting to keep Checkstyle after formatting

* Configure spotless everywhere, and disable the tasks if necessary

* Add XContentBuilder helpers, fix test

* Tweaks

* Add a TODO

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2021-08-18 07:15:55 -04:00
Lyudmila Fokina 207f783924
Adding base RestHandler class for Enrollment APIs (#76564)
* Adding base RestHandler class for Enrollment APIs

This change adding an abstract RestHandler class and extends it by
enrollment API classes (node and Kibana enrollment). It will handle the
cases when `enrollment.enabled` is not set to `true`. It will return an
appropriate exception in this case.

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2021-08-17 21:13:17 +02:00
Ioannis Kakavas a59684835d
Enroll Kibana API uses Service Accounts (#76370)
This commit changes the Enroll Kibana API to create and return
a token for this service account, instead of setting and returning the
password of the kibana_system built-in user. Both the token name and
value are returned in the response of the API.
2021-08-17 14:41:35 +03:00
Yang Wang 7bb1185806
HLRC support for query API key API (#76520)
This PR adds HLRC for the new Query API key API added with #75335 and #76144

Relates: #71023
2021-08-17 16:00:55 +10:00
Przemysław Witek f9d30adf6f
[Transform] Align transform checkpoint range with date_histogram interval for better performance (#74004) 2021-08-16 17:50:11 +02:00
bellengao 58feb4e195
ILM: Add validation of the number_of_shards parameter in Shrink Action of ILM (#74219)
Add validation of the number_of_shards parameter in Shrink Action of ILM
2021-08-16 15:18:15 +01:00
Devon Thomson 5c53a66e8f
remove dashboard only reserved role (#76507)
Removes the deprecated kibana_dashboard_only_user from the set of reserved roles in Elasticsearch as this legacy functionality is being removed from Kibana.

Relates: elastic/kibana#54755.
2021-08-16 10:15:50 -04:00
Nik Everett e305a6bed7
Name `BulkItemResponse` ctors (#76439)
* Name `BulkItemResponse` ctors

`BulkItemResponse` can contain either a success or failure. This
replaces the two constructors used to build either case with named
static methods. So instead of
```
return new BulkItemResponse(0, OpType.CREATE, createResponse);
return new BulkItemResponse(0, OpType.CREATE, failure);
```
you now use
```
return BulkItemResponse.success(0, OpType.CREATE, createResponse);
return BulkItemResponse.failure(0, OpType.CREATE, failure);
```

This makes it marginally easier to read code building these things - you
don't have to know the type of the parameter to know if its a failure
or success.

* Consistent

* Mock response
2021-08-12 14:41:26 -04:00
Dimitris Athanasiou adfa977c83
[ML] Inference configs for NLP models (#76350)
Introduce inference configs for NLP models.

When a PyTorch model is put, the config now expects
a different inference config per task type. Thus, we
have a `ner`, `fill_mask`, and `sentiment_analysis`
config. In addition, the tokenization parameters have
been grouped together and are now part of the relevant
inference config objects. Thus the vocabulary can now
be on a document on its own. A new vocabulary config
object allows the user to specify the location of the
vocabulary document.
2021-08-12 12:10:05 +03:00
Rene Groeschke b323726ebd
Resolve system properties in build scripts via provider factory (#76199)
This allows tracking system properties used in the build configuration and brings us
one step closer to be gradle configuration cache compliant.
2021-08-09 09:39:30 +02:00
David Roberts 7ac5ea39df
[ML] Use results retention time for deleting system annotations (#76096)
In #75617 a new setting, system_annotations_retention_days, was
added to control how long system annotations are retained for.
We now feel that this setting is redundant and that system
annotations should be retained for the same period as results.
This is intuitive and defensible, as system annotations can be
considered a type of result.

Followup to #75617
2021-08-04 17:42:31 +01:00
Lyudmila Fokina 453877d9b7
Enroll API to return CA cert using standard Base64 (#75858)
* Enroll API to return CA cert using standard Base64
encoding
2021-08-03 17:21:32 +02:00
Tanguy Leroux 11a567602a
SearchableSnapshotsIT.testCacheStats should wait for cache writes to complete before checking stats (#76011)
* Wait for cache writes to terminate before checking stats

* remove empty method
2021-08-03 09:24:04 -04:00
Ed Savage 5651215be1
[ML] Add 'model_prune_window' field to AD job config (#75741)
Add configuration for pruning dead split fields in anomaly detection
jobs via the `model_prune_window` field for both the job creation and
update APIs.

Relates to ml-cpp/#1962
2021-08-03 09:16:43 +01:00
Yang Wang e4f7132055
Return file-backed service tokens from all nodes (#75200)
The Get service account credentials API now returns file-backed tokens from all
nodes instead of only the local node. For each file-backed service token, we
list names of the nodes where this token is found. The response for node-local
credentials (currently only file-backed tokens) is place inside the
"nodes_credentials.file_tokens" field. There is also a nodes_credentials._nodes
field containing information about the overall request execution (it works the
same way as the _nodes field of Nodes info API, etc.) Detailed response sample
can be found in #74530

This PR also removes the beta label from the API's documentation page.

Resolves: #74530
2021-08-03 13:43:46 +10:00
Martijn van Groningen cbf500915e
Add resolve_during_rolling_upgrade field to deprecation issue (#74226)
Add an additional boolean field to a deprecation issue to indicate that a deprecation issue can only be resolved during a rolling upgrade when a node is offline (for the upgrade).

No deprecation issue has been marked as restart required as part of this change.

Closes #73091
2021-07-30 13:47:17 +02:00
Przemysław Witek 30d9f13436
[ML] Delete expired annotations (#75617) 2021-07-29 15:27:03 +02:00
David Harsha ed7a65e053
Allow specifying index in pinned queries (#74873)
The current `ids` option doesn't allow pinning a specific document in a
single index when searching over multiple indices. This introduces a
`documents` option, which is an array of `_id` and `_index`
fields to allow index-specific pins.

Closes https://github.com/elastic/elasticsearch/issues/67855.
2021-07-27 15:55:07 +03:00
Nikita Glashenko 1db17ada95
Fix wrong error upper bound when performing incremental reductions (#43874)
When performing incremental reductions, 0 value of docCountError may mean that 
the error was not previously calculated, or that the error was indeed previously 
calculated and its value was 0. We end up rejecting true values set to 0 this 
way. This may lead to wrong upper bound of error in result. To fix it, this PR 
makes docCountError nullable. null values mean that error was not calculated 
yet.

Fixes #40005

Co-authored-by: Igor Motov <igor@motovs.org>
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2021-07-22 08:18:24 -10:00
Lyudmila Fokina 063a1f2d30
Filter out CA PrivateKeyEntry when creating a KeyManager (#73807)
In 8.0, with security on by default, we store the HTTP
layer CA PrivateKeyEntry in the http.ssl keystore (along
with the node certificate) so that it is available in our
Enrollment API transport actions.
When loading a keystore, the current behavior is that the
X509ExtendedKeyManager will iterate through the PrivateKeyEntry
objects and will return the first key/certificate that satisfies
the requirements of the client and the server configuration,
and lacks any additional logic/filters.
We need the KeyManager to deterministically pick the node
certificate/key in all cases as this is the intended entry to be
used for TLS on the HTTP layer.
This change introduces filtering when creating the in-memory
keystore the KeyManager is loaded with, so that it will not
include PrivateKeyEntry objects when:
- there are more than 1 PrivateKeyEntry objects in the keystore
- The leaf certificate associated with the PrivateKeyEntry is a
CA certificate
Related: #75097

Co-authored-by: Ioannis Kakavas <ioannis@elastic.co>
2021-07-09 00:53:20 +02:00
Henning Andersen 12b4fcf0fe
ReindexIT wait for task to really start (#73018)
Reindex and friends have tasks that start but are not ready to
rethrottle before they figured out if they are leader or worker
tasks. Now wait for the task to fully start before rethrottling.

Also added additional assertions to help see if the inability
to rethrottle is caused by some failure.

Closes #60811
2021-07-01 13:06:06 +02:00
Almog Tavor 34cfa40fae
Fix comparison of identical values leads to a bug of non-effective value (#74040) 2021-06-28 10:14:34 -07:00
Sylvain Wallez 32c196f655
Fix HLRC compatibility with Java 8 (#74290)
Optional.isEmpty() was added in Java 11. In Java 8 we only have
Optional.isPresent()
2021-06-28 17:08:53 +02:00
Armin Braun cbf48e0633
Flatten Get Snapshots Response (#74451)
This PR returns the get snapshots API to the 7.x format (and transport client behavior) and enhances it for requests that ask for multiple repositories.
The changes for requests that target multiple repositories are:
* Add `repository` field to `SnapshotInfo` and REST response
* Add `failures` map alongside `snapshots` list instead of returning just an exception response as done for single repo requests
* Pagination now works across repositories instead of being per repository for multi-repository requests

closes #69108
closes #43462
2021-06-24 16:58:33 +02:00
Ioannis Kakavas 74932503a6
Enroll Node API doesn't return a cluster name (#74514)
During implementation we discovered that the clusters should not
necessarily have a unique name and thus we don't need to convey
this information in the response of the Enroll Node API.
2021-06-24 11:27:04 +03:00
Ioannis Kakavas 82e7fbda53
Add the Enroll Kibana API (#72207)
This change adds the Enroll Kibana API that enables a Kibana instance to
configure itself to communicate with a secured elasticsearch cluster
2021-06-23 22:58:46 +03:00
Yang Wang 231134572e [Test] Correct matcher for matching single element 2021-06-23 18:02:16 +10:00
Yang Wang 0c11c6411e [Test] Avoid reusing the same token name for tests
Relates: #74280
2021-06-23 10:23:50 +10:00
Yang Wang 60ee57f079 [Test] Even More robust assertions for possible overlapping tests
Relates: #74280
2021-06-23 00:47:10 +10:00
Rene Groeschke 59fb90487b
Simplify test only project precommit checks (#74172)
we do not need thirdparty check for test only projects
2021-06-22 16:34:07 +02:00
Yang Wang ad8d96e2fb [Test] More robust assertions for possible overlapping tests
Relates: #74280
2021-06-23 00:10:04 +10:00
Yang Wang 19e58c24a5
[Test] Avoid use the same token name in different tests (#74280)
The name token1 is used in both testGetServiceAccountCredentials and
testCreateServiceAccountToken. There are times when the two tests are not fully
isolated. This leads to test failure because indexing of the service token
document must be an op_create. This PR fixes the failure by using a different
token name in testGetServiceAccountCredentials.
2021-06-22 21:01:43 +10:00
Martijn van Groningen 4d84f11ef3
Add meta field to deprecation issue definition. (#74085)
This will allow components to add custom metadata to deprecation issues.
This make extracting additional details about deprecations more robust,
otherwise these details need to be parsed from the deprecation message field.

Adjusted the ml model snapshot deprecation to use custom metadata, and
included the job id and snapshot id as custom metadata.

Closes #73089
2021-06-22 12:05:16 +02:00
Armin Braun 269718ff10
Enhance Tests around SnapshotInfo UserMetadata (#74362)
We barely test the correct handling of user metadata directly.
With upcoming changes to how `SnapshotInfo` is stored it would be nice
to have better test coverage. This PR adds randomized coverage of serializing
user metadata to a large number of tests that all user the shared infrastructure
that is adjusted here.
2021-06-21 19:41:01 +02:00
David Turner 3bbdd3428d AwaitsFix for #74278 2021-06-18 08:31:49 +01:00
Sylvain Wallez c06608d4e6
Verify that main info response returns correct product headers (#73910)
Follow-up to #73434

Ensures that High Level Rest Client is running against a verified
Elasticsearch. When the first request is send on HLRC, a request to the
info endpoint is made first to verify the product identification and
version.
2021-06-17 23:29:07 +02:00
David Roberts c9a613666f
[ML] Remove the undocumented "delimited" format for post_data (#74188)
The data_description of anomaly detection jobs used to accept
delimited data, although this was never documented.

This change removes the delimited option from the data_description,
and the associated functionality in post_data that handled it.

This is not a breaking change because it's removing functionality
that officially never existed.  However, just in case somebody
was using it it is only removed from 8.0 and higher, so that at
least they won't find out during a patch install.
2021-06-17 15:30:27 +01:00
Yang Wang 2350369782
Service Accounts - HLRC (#72431)
This PR adds corresponding components in High Level Rest Client for the new
APIs related to the service accounts feature.
2021-06-17 21:27:20 +10:00
Martijn van Groningen 80593b43f6
Tidy up deprecation code. (#74065)
Removed unused code and made fields immutable.
2021-06-14 19:15:10 +02:00
Nhat Nguyen 1211b9d5e4
Fix HLRC doc link for point in time API (#73874)
The PIT's docs in HLRC wasn't linked properly.
2021-06-09 12:32:30 -04:00
Ryan Ernst ab1a2e4a84
Add precommit task for detecting split packages (#73784)
Modularization of the JDK has been ongoing for several years. Recently
in Java 16 the JDK began enforcing module boundaries by default. While
Elasticsearch does not yet use the module system directly, there are
some side effects even for those projects not modularized (eg #73517).
Before we can even begin to think about how to modularize, we must
Prepare The Way by enforcing packages only exist in a single jar file,
since the module system does not allow packages to coexist in multiple
modules.

This commit adds a precommit check to the build which detects split
packages. The expectation is that we will add the existing split
packages to the ignore list so that any new classes will not exacerbate
the problem, and the work to cleanup these split packages can be
parallelized.

relates #73525
2021-06-08 15:04:23 -07:00
Ryan Ernst 63012c8a40
Move ParseField to o.e.c.xcontent (#73923)
ParseField is part of the x-content lib, yet it doesn't exist under the
same root package as the rest of the lib. This commit moves the class to
the appropriate package.

relates #73784
2021-06-08 13:32:14 -07:00
Ryan Ernst 68817d7ca2
Rename o.e.common in libs/core to o.e.core (#73909)
When libs/core was created, several classes were moved from server's
o.e.common package, but they were not moved to a new package. Split
packages need to go away long term, so that Elasticsearch can even think
about modularization. This commit moves all the classes under o.e.common
in core to o.e.core.

relates #73784
2021-06-08 09:53:28 -07:00
Przemyslaw Gomulka 4bdd00d452
[Rest Api Compatibility] Typed endpoint for bulk api (#73571)
retrofits typed endpoint and type in request parsing
the original types removal commit
#46983

relates #51816
2021-06-07 19:36:31 +02:00
Ryan Ernst f98b374cf6
Revert "Upgrade Azure SDK and Jackson (#72833) (#72995)" (#73837)
The recent upgrade of the Azure SDK has caused a few test failures that
have been difficult to debug and do not yet have a fix. In particular, a
change to the netty reactor resolving
(https://github.com/reactor/reactor-netty/issues/1655). We need to wait
for a fix for that issue, so this reverts commit
6c4c4a0ecb.

relates #73493
2021-06-07 10:20:46 -07:00