Commit graph

19698 commits

Author SHA1 Message Date
Moritz Mack
e2bde8ac76
Instrument methods on File that require read permissions (#122544) (#122862)
This commit adds instrumentation for File methods that require read permissions.

see #122109 for the write side

(cherry picked from commit bf1cbb0e47)

# Conflicts:
#	x-pack/plugin/security/src/main/plugin-metadata/entitlement-policy.yaml

Co-authored-by: Ryan Ernst <ryan@iernst.net>
2025-02-19 02:56:58 +11:00
Ioana Tagirta
aaa09e1740
Fix query builder rewriting when using lookup join (#122833) 2025-02-18 16:27:27 +01:00
Mike Pellegrini
b8a4d980ec
Fix ArrayIndexOutOfBoundsException in ShardBulkInferenceActionFilter (#122538) (#122847) 2025-02-19 01:38:48 +11:00
Moritz Mack
cef7ee183e
[Entitlements] Add missing entitlements for trust store (#122797) (#122846)
Add missing entitlements for trust store if running in fips mode.

Fixes #122546, fixes #122569, fixes #122568, fixes #122680, fixes
#122566

(cherry picked from commit 87c58ff93f)

# Conflicts:
#	muted-tests.yml
#	x-pack/plugin/security/src/main/plugin-metadata/entitlement-policy.yaml
2025-02-19 01:31:08 +11:00
Joe Gallo
c5abd832ea
Fix redact processor arraycopy bug (#122640) (#122765) 2025-02-18 02:03:34 +11:00
Slobodan Adamović
fc70a06d1d
[8.18] Fix internal cluster and single node security tests (#121466) (#122734)
* Fix internal cluster and single node security tests (#121466)

This PR fixes SecuritySingleNodeTestCase and ProfileIntegTests tests.

- The security single node test failures are solved by ensuring every test starts with security index created and available. This is in order to have consistent state for every test. With the changes introduce in the #120323 PR, only the first test would execute with .security index being created async. Subsequent tests would execute without security index creation due to the fact that whole cluster is wiped after each test. This caused a flakiness only for the first test, because there was no mechanism in place to ensure that the .security index is active before test execution.

 - The profile integration tests are solved by introducing an anonymous role which don't have application privileges. The application privileges are resolved from the .security index and assigned to all users, including the es_test_root user which is used during cluster wiping. Due to asynchronous nature of cluster setup and .security index creation, this now causes flakiness. The main problem is that wiping is done asynchronously and uses es_test_root which had assigned anonymous rac_role which depends on .security index being available for search in order to resolve application privileges. The application privilege resolution is done in buildRoleFromDescriptors which currently does not wait for security index availability(can be improved - but still wouldn't fix internal cluster tests). This wasn't a problem before just because we simply return empty results when .security index does not exist. There is some complexity in making internal clusters wait for availability of security shards before the test, so I think this solution is acceptable given that it's not required for this tests to have anonymous role with application privileges.

Resolves #121022
Resolves #121096
Resolves #121101
Resolves #120988
Resolves #121108
Resolves #120983
Resolves #120987
Resolves #121179
Resolves #121183
Resolves #121346
Resolves #121151
Resolves #120985
Resolves #121039
Resolves #121483
Resolves #121116
Resolves #121258
Resolves #121486

(cherry picked from commit 369c641302)

# Conflicts:
#	muted-tests.yml
#	x-pack/plugin/security/src/internalClusterTest/java/org/elasticsearch/xpack/security/authc/esnative/ReservedRealmElasticAutoconfigIntegTests.java

* fix compilation error
2025-02-17 21:43:33 +11:00
Albert Zaharovits
7fb4763ee1
Invoke TestCluster#assertAfterTest before closing the cluster (#122639) (#122709)
In test-scoped internal ITs the `cluster().assertAfterTest()` method was invoked
*after* the cluster nodes were closed. Consequently, the assertions that iterated
over the internal nodes (and asserted some state on nodes after the test) were
all effectively noops.
This PR reverses that order, so that after-test assertions are effective again.
2025-02-16 20:59:10 +11:00
David Kyle
e95cb35016
[ML] Use latest results index for new Anomaly Detection jobs (#122597) (#122672)
After upgrading from v7 new anomaly detection jobs should 
use the latest results index if one has been created.
2025-02-15 21:20:09 +11:00
Pat Whelan
fa3bf55b9d
[8.x] [Deprecation] Refine Transform Destination Index message (#122192) (#122524) (#122648)
When we detect that a Transform writes to the index and the index is
incompatible with the next version, change the message, detail, and
URL to help the user take the necessary steps to migrate the destination
index.
2025-02-15 09:24:10 +11:00
Keith Massey
495a8f9a70
Make sure index is healthy before calling _frozen in ReindexDatastreamIndexTransportActionIT (#122623) (#122636) 2025-02-15 06:08:47 +11:00
Martijn van Groningen
21915b247e
[8.x] Logsdb and source only snapshots. (#122572) (#122594)
* [8.x] Logsdb and source only snapshots.

Backporting #122199 to 8.x branch.

Addresses a few issues with logsdb and source only snapshots:
* Avoid initializing index sorting, because sort fields will not have doc values.
* Also disable doc value skippers when doc values get disabled.
* As part of source only validation figure out what the nested parent field is.

Also added a few more tests that snapshot and restore logsdb data streams.

* fix test
2025-02-14 23:43:44 +11:00
Kostas Krikellas
a5345febe7
[8.18] Licensing controls for logsdb routing on sort fields (#120276) (#122584)
* Licensing controls for logsdb routing on sort fields  (#120276)

* Restrict routing on sort fields to enterprise license

* sync

* bypass checking for serverless

* Node deprecation warning for indexes and component templates with source mode in mapping

* Revert "Node deprecation warning for indexes and component templates with source mode in mapping"

This reverts commit 0fd4ca7d51.

* address comments

(cherry picked from commit 37f974546d)

# Conflicts:
#	x-pack/plugin/logsdb/src/main/java/org/elasticsearch/xpack/logsdb/LogsDBPlugin.java
#	x-pack/plugin/logsdb/src/main/java/org/elasticsearch/xpack/logsdb/LogsDBUsageTransportAction.java

* Update LogsDBPlugin.java

* Update LogsDBPlugin.java

* Update LogsDBUsageTransportAction.java
2025-02-14 22:15:41 +11:00
Parker Timmins
76bcb98a7c
[8.18] Add action to copy index metadata when reindexing data stream indices (#122535) (#122561)
* Add action to copy index metadata when reindexing data stream indices (#122535)

When reindexing data stream indices, parts of the index metadata needs to be copied from the source index to destination index, so that ILM and data stream lifecycle function properly. This adds a new CopyLifecycleIndexMetadataTransportAction which copies the following metadata from a source index to a destination index:
- creation date setting
- rollover info
- ILM custom metadata

(cherry picked from commit aba25c628a)

# Conflicts:
#	x-pack/plugin/migrate/build.gradle

* remove timeouts which were not present in 8.18
2025-02-14 13:48:18 +11:00
Patrick Doyle
0205d3fc86
Entitlements: manage_threads (#122261) (#122533)
* Entitlements: manage_threads (#122261)

* Refactor: protected -> private

* Initial thread-related entitlements

* Entitlements from manual test runs

* Refactor: notEntitled method

* Entitlements reporting mode

* Entitlements from CI

* Revert "Entitlements reporting mode"

This reverts commit 443ca767333269a73accd0cedf9ca6c6ac51698a.

* Remove unnecessary EntitledActions.newThread

* Don't log in entitlements ITs by default

* Import SuppressForbidden

* Respond to PR comments

* Move manage_threads tests to their own file

* Move ForkJoinPool.setParallelism to VersionSpecificManageThreadsActions

* [CI] Auto commit changes from spotless

---------

Co-authored-by: elasticsearchmachine <infra-root+elasticsearchmachine@elastic.co>
2025-02-14 09:18:28 +11:00
Craig Taverner
fb358aaccd
[8.x] Optimize ST_EXTENT_AGG for geo_shape and cartesian_shape (#119889) (#122276) (#122420)
* Optimize ST_EXTENT_AGG for geo_shape and cartesian_shape (#119889)

Support for `ST_EXTENT_AGG` was added in https://github.com/elastic/elasticsearch/pull/118829, and then partially optimized in https://github.com/elastic/elasticsearch/pull/118829. This optimization worked only for cartesian_shape fields, and worked by extracting the Extent from the doc-values and re-encoding it as a WKB `BBOX` geometry. This does not work for geo_shape, where we need to retain all 6 integers stored in the doc-values, in order to perform the datelline choice only at reduce time during the final phase of the aggregation.

Since both geo_shape and cartesian_shape perform the aggregations using integers, and the original Extent values in the doc-values are integers, this PR expands the previous optimization by:
* Saving all Extent values into a multi-valued field in an IntBlock for both cartesian_shape and geo_shape
* Simplifying the logic around merging intermediate states for all cases (geo/cartesian and grouped and non-grouped aggs)
* Widening test cases for testing more combinations of aggregations and types, and fixing a few bugs found
* Enhancing cartesian extent to convert from 6 ints to 4 ints at block loading time (for efficiency)
* Fixing bugs in both cartesian and geo extents for generating intermediate state with missing groups (flaky tests in serverless)
* Moved the int order to always match Rectangle for 4-int and Extent for 6-int cases (improved internal consistency)

Since the PR already changed the meaning of the invalid/infinite values of the intermediate state integers, it was already not compatible with the previous cluster versions. We disabled mixed-cluster testing to prevent errors as a result of that. This leaves us the opportunity to make further changes that are mixed-cluster incompatible, hence the decision to perform this consistency update now.

* Regenerate generated files
2025-02-13 22:11:39 +11:00
Nhat Nguyen
d25da24dcb
Remove completion listener from ExchangeSourceHandler (#122446) (#122466)
With #117410, each remote sink now has its own listener, and the main
query won't finish until all remote sink listeners have completed. As a
result, we no longer need to wait for the exchange source to finish.

This change removes the completion listener to simplify the exchange
service. The completion listener could previously return prematurely
while remote sinks were still being registered.

Closes #122408
2025-02-13 17:22:12 +11:00
Nhat Nguyen
44a054f640
Fix listener leak in exchange service (#122417) (#122454)
If we hit the circuit breaker exception before fetching pages, 
we fail to notify the listener.

Closes #122271
2025-02-13 15:46:59 +11:00
Stanislav Malyshev
7f05a31990
[8.18] Improve CrossClusterAsyncEnrichStopIT test (#122432) (#122441) (#122453)
* [8.x] Improve CrossClusterAsyncEnrichStopIT test (#122432) (#122441)

* Improve CrossClusterAsyncEnrichStopIT test (#122432)

(cherry picked from commit 88550f6126)

* fix backport

(cherry picked from commit 2f6de7d9e8)

# Conflicts:
#	muted-tests.yml
#	x-pack/plugin/esql/src/internalClusterTest/java/org/elasticsearch/xpack/esql/action/AbstractCrossClusterTestCase.java
#	x-pack/plugin/esql/src/internalClusterTest/java/org/elasticsearch/xpack/esql/action/CrossClusterAsyncQueryStopIT.java

* fix backport
2025-02-13 13:19:20 +11:00
Keith Massey
df04756a24
Making reindex data streams actions cancellable (#122438) (#122444) 2025-02-13 11:36:57 +11:00
Keith Massey
646f8f8ed2
Handling frozen indices in reindex data streams (#122279) (#122439) 2025-02-13 10:33:07 +11:00
Pat Whelan
0e7d8540fb
[Transform] Reset plugin after tests (#122252) (#122423)
There is a race condition where the test is trying to clean up while the
Transform auditor is still writing messages - resetting the plugin will
stop the auditor (and properly reset it).

Fix #12148
2025-02-13 06:02:29 +11:00
Stanislav Malyshev
fdd3812385
Add metadata checking to RequestIndexFilteringIT (#122322) (#122416)
(cherry picked from commit 2c846e7351)

# Conflicts:
#	x-pack/plugin/esql/qa/server/multi-clusters/src/javaRestTest/java/org/elasticsearch/xpack/esql/ccq/RequestIndexFilteringIT.java
2025-02-13 05:03:08 +11:00
Parker Timmins
222279342a
[8.18] Fix ReindexDataStreamIndexAction timestamp validation bug in tests (#122274) (#122385)
* Fix ReindexDataStreamIndexAction timestamp validation bug in tests (#122274)

Fix race condition test bugs related to the reindex-data-stream-pipeline. For tests that add doc without timestamp, then add mapping with timestamp, ensure green between adding doc and adding mapping. This makes sure that doc has been written to all shards and thus that timestamp validation does not occur while doc is being written to a shard. Delete pipeline in Before method, then wait for it to be re-created by the MigrateTemplateRegistry.

(cherry picked from commit 05a2003a9f)

# Conflicts:
#	muted-tests.yml
#	x-pack/plugin/migrate/src/internalClusterTest/java/org/elasticsearch/xpack/migrate/action/ReindexDatastreamIndexTransportActionIT.java

* getPipelines missing from 8.18
2025-02-13 04:27:29 +11:00
Pat Whelan
928762b825
[8.18] [Transform] Delete Alias Write Index (#122074) (#122404)
* [Transform] Delete Alias Write Index (#122074)

When the Transform is configured to write to an alias, specifying
`DELETE _transform/<id>?delete_dest_index` will follow the alias
to the concrete destination index.

Fix #121913

Co-authored-by: Przemysław Witek <przemyslaw.witek@elastic.co>

* Update for 8.x api

---------

Co-authored-by: Przemysław Witek <przemyslaw.witek@elastic.co>
2025-02-13 04:20:24 +11:00
Adam Demjen
3d5d827a86
[8.18][Inference API] Rename model_id prop to model in EIS sparse inference request body (#122398)
* Rename model_id prop in EIS sparse inference request body

* Update docs/changelog/122398.yaml
2025-02-12 11:42:31 -05:00
Valeriy Khakhutskyy
443a4717d3
[ML] Delete obsolete snapshot stats after upgrade (#121661)
Ensure that the old snapshot model_size_stats document is removed after the snapshot upgrade.

Marking it as a non-issue since the bug was not released yet.
2025-02-12 15:53:53 +01:00
David Kyle
8d558361c7
[ML] Fix serialising the Inference API update request (#122278) (#122300) 2025-02-13 01:09:08 +11:00
Valeriy Khakhutskyy
a6903f460e
[ML] Increase waiting time to stabilize flaky DFA integration tests (#122268) (#122282)
This PR increases the waiting time for the DFA native process from 60 to 90 seconds to stabilize the flaky integration tests that sometimes fail because the job has not finished training within 60 seconds.
2025-02-12 12:10:01 +01:00
Luke Whiting
09d84fc872
Remove index setting when override value is null (#122267) (#122347)
(cherry picked from commit 2b9d7f6396)
2025-02-12 21:32:34 +11:00
Rene Groeschke
9db54b2488
[Build] Fix the manifest target and source information for jdbc projects (#121888) (#122238)
The nebula info broker plugin takes the information for the manifest from the java project settings rather then from
the compile task configuration. Instead of setting the compiler task configuration explicitly we now set the project
configuration accordingly. Also tweaked the javaTestCompile tasks to keep compiling with general minimum runtime version as we did before

(cherry picked from commit 6e6e42f5d4)
2025-02-12 09:14:15 +01:00
Keith Massey
f8142f4a35
If reindex data streams fails on one index, try the next (#122294) (#122312) 2025-02-12 10:03:35 +11:00
Parker Timmins
bca34f13fc
[8.18] Remove call to super.cleanupCluster in cleanup methods which does not override parent method (#122209) (#122259)
* Remove call to super.cleanupCluster in cleanup methods which does not override parent method (#122209)

ReindexDataStreamIndexAction.cleanupCluster called EsIntegTestCase.cleanupCluster, but did not override it. This caused EsIntegTestCase.cleanupCluster to be called twice, once in ReindexDataStreamIndexAction.cleanupCluster and once when the After annotation is called on EsIntegTestCase.

(cherry picked from commit 89ba03ecff)

# Conflicts:
#	muted-tests.yml
#	x-pack/plugin/migrate/src/internalClusterTest/java/org/elasticsearch/xpack/migrate/action/ReindexDatastreamIndexTransportActionIT.java

* deletePipeline not available in 8.x
2025-02-12 03:19:17 +11:00
Luke Whiting
9c1785a85f
Ensure removal of index blocks does not leave key with null value (#122246) (#122265)
* ES-10801 Ensure removal of index blocks does not leave key with null value

* Update docs/changelog/122246.yaml
2025-02-12 03:15:35 +11:00
Keith Massey
09f2b646ae
Fixing minimum data stream lifecycle version In DataStreamsUpgradeIT (#122207) (#122256) 2025-02-12 02:23:51 +11:00
Luigi Dell'Aquila
94b640683e
ES|QL: Remove redundant sorts from execution plan (#121156) (#122248) 2025-02-12 00:37:07 +11:00
John Verwolf
89096300da
Bugfix/fix privileges in system migration block (#122217)
* Fix privileges for system index migration WRITE block

* Update release notes

* Delete docs/changelog/122217.yaml
2025-02-11 10:06:57 +11:00
Dan Rubinstein
7456e79017
Fix get all inference endponts not returning multiple endpoints sharing model deployment (#121821) (#122210)
* Fix get all inference endponts not returning multiple endpoints sharing model deployment

* Update docs/changelog/121821.yaml

* Clean up modelsByDeploymentId generation code

---------

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2025-02-11 07:59:56 +11:00
Samiul Monir
663e5d6328
Fix - Requesting _inference_fields when using legacy format causes shard failure (#121720) (#122178)
* Adding condition to verify if the field belongs to an index

* Update docs/changelog/121720.yaml

* Remove unnecessary comma from yaml file

* remove duplicate inference endpoint creation

* updating isMetadata to return true if mapper has the correct type

* remove unnecessary index creation in yaml tests

* Adding check if the document has returned in the yaml test

* Updating test to skip time series  check if index mode is standard

* Refactor tests to consider verifying every metafields with all index modes

* refactoring test to verify for all cases

* Adding assetFalse if not time_series and fields are from time_series

* updating test texts to have better description
2025-02-11 02:03:02 +11:00
Luigi Dell'Aquila
2355b67c5e
EQL: fix JOIN command validation (not supported) (#122011) (#122170) 2025-02-11 01:25:32 +11:00
David Kyle
a6d55ed846
[ML] Give the kibana user read/write access to reindexed hidden ml indices (#121897) (#122038)
Indices are reindexed on upgrade. Adds an index pattern to the role
descriptor matching the upgraded indices
2025-02-10 21:36:02 +11:00
David Kyle
ff9c2f06f0
[ML] Fix infer on and elasticsearch service endpoint created with a deployment id (#121428) (#121439)
Fixes a bug where the deployment Id was lost creating the text embedding
model configuration
2025-02-10 21:29:56 +11:00
Niels Bauman
589e51a833
Increase timeout in DataStreamLifecycleDownsampleDisruptionIT (#122151) (#122157)
The downsample task sometimes needs a little bit longer to complete so
we bump the timeout from 60s to 120s.

Fixes #122056

(cherry picked from commit 0ec2fe05ef)

# Conflicts:
#	muted-tests.yml
2025-02-10 19:24:56 +11:00
Nhat Nguyen
3236575931
Handle rejection in DriverScheduler (#122105) (#122116)
When a node is shutting down, scheduling tasks for the Driver can result 
in a rejection exception. In this case, we drain and close all
operators. However, we don't clear the pending tasks in the scheduler,
which can lead to a pending task being triggered unexpectedly, causing a
ConcurrentModificationException.
2025-02-08 17:23:57 +11:00
Stanislav Malyshev
abe7880596
Fix async stop sometimes not properly collecting result (#121843) (#122115)
* Fix async stop sometimes not properly collecting result

(cherry picked from commit d11dad44cc)
2025-02-08 16:21:33 +11:00
Nhat Nguyen
7869fbe5f3
Avoid cyclic exception in ExchangeSource (#121995) (#122054)
Since introducing the fail_fast (see #117410) option to remote sinks, 
the ExchangeSource can propagate failures that can lead to circular
references. The issue occurs as follows:

1. remote-sink-1 fails with exception e1, and the failure collector collects e1.

2. remote-sink-2 fails with exception e2, and the failure collector collects e2.

3. The listener of remote-sink-2 propagates e2 before the listener of 
remote-sink-1 propagates e1.

4. The failure collector in ExchangeSource sees [e1, e2] and suppresses 
e2 to e1. The upstream sees [e2, e1] and suppresses e1 to e2, leading to
a circular reference.

With this change, we stop collecting failures in ExchangeSource.

Labelled this non-issue for an unreleased bug.

Relates #117410
2025-02-07 15:58:37 -08:00
Mary Gouseti
eab1b3fe0a
[8.x] Adjust details in the SourceFieldMapper deprecation warning (#122083) (#122098)
* [Deprecation API] Adjust details in the SourceFieldMapper deprecation warning (#122041)

* Update test
2025-02-08 09:14:47 +11:00
Nik Everett
8666ef03ad
Retry timeout tests for aggs (#122031) (#122080)
The aggs timeout test waits for the agg to return and then double checks
that the agg is stopped using the tasks API. We're seeing some failures
where the tasks API reports that the agg is still running. I can't
reproduce them because computers. This adds two things:
1. Logs the hot_threads so we can see if the query is indeed still
   running.
2. Retries the _tasks API for a minute. If it goes away soon after the
   _search returns that's *fine*. If it sticks around for more than a
   few seconds then the cancel isn't working. We wait for a minute
   because CI can't be trusted to do anything quickly.

Closes #121993
2025-02-08 06:43:32 +11:00
Keith Massey
3a52906e3c
Removing the type from the destination index when using CreateIndexFromSourceAction (#121982) (#122059)
It is possible to create an index in 7.x with a single type. This fixes the CreateIndexFromSourceAction to not copy that type over when creating a destination index from a source index with a type.
2025-02-08 04:39:12 +11:00
Jonathan Buttner
9cf89a63b1
[ML] Inference API removing _unified and using _stream instead (#121804) (#122045)
* Adding proxy action

* [CI] Auto commit changes from spotless

* Incrementing reference count for body content and fixing tests

* [CI] Auto commit changes from spotless

* Refactoring

* Update x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/inference/action/InferenceActionProxy.java

Co-authored-by: David Kyle <david.kyle@elastic.co>

* Addressing feedback

---------

Co-authored-by: elasticsearchmachine <infra-root+elasticsearchmachine@elastic.co>
Co-authored-by: David Kyle <david.kyle@elastic.co>
(cherry picked from commit ab482350e6)

# Conflicts:
#	x-pack/plugin/inference/src/test/java/org/elasticsearch/xpack/inference/rest/BaseInferenceActionTests.java
2025-02-08 03:30:51 +11:00
Saikat Sarkar
7f6bb87b3a
Resolve TransportVersion issue (#121988) 2025-02-07 09:01:00 -07:00