Commit graph

8489 commits

Author SHA1 Message Date
John Verwolf
7dce3566b7
Fix privileges for system index migration WRITE block (#122214)
* Fix privileges for system index migration WRITE block  (#121327)

This PR removes a potential cause of data loss when migrating system indices. It does this by changing the way we set a "write-block" on the system index to migrate - now using a dedicated transport request rather than a settings update. Furthermore, we no longer delete the write-block prior to deleting the index, as this was another source of potential data loss. Additionally, we now remove the block if the migration fails.

* Update release notes

* Delete docs/changelog/122214.yaml
2025-02-11 09:51:40 +11:00
Joe Gallo
eb32a9beb2
Fix geoip databases index access after system feature migration (#121196) (#121946)
Co-authored-by: Keith Massey <keith.massey@elastic.co>
2025-02-07 11:20:16 +11:00
Mark Tozzi
e0dac2e855
Aggregations cancellation after collection (#120944) (#121921)
This PR addresses issues around aggregations cancellation, mentioned in https://github.com/elastic/elasticsearch/issues/108701 and other places. In brief, during aggregations collection time, we respect cancellation via the mechanisms in the searcher to poison cancelled queries. But once the aggregation finishes collection, there is no further need to interact with the searcher, so we cannot rely on that for cancellation checking. In particular, deeply nested aggregations can spend a long time constructing the results tree.

Checking for cancellation is a trade off, as the check itself is somewhat expensive (it involves a volatile read), so we want to balance checking often enough that cancelled queries aren't taking up resources for a long time, but not so frequently that it slows down most aggregation queries. Our first attempt to this is to check once when we go to build sub-aggregations, as the worst cases for this that we've seen involve needing to build deep sub-aggregation trees. Checking at sub-aggregation construction time also provides a conveniently centralized method call to add the check to.

---------

Co-authored-by: elasticsearchmachine <infra-root+elasticsearchmachine@elastic.co>
Co-authored-by: Nik Everett <nik9000@gmail.com>
2025-02-07 04:25:44 +11:00
Jordan Powers
5813fa395c
Copy metrics and default_metric properties when downsampling aggregate_metric_double (#121727) (#121855)
Fixes #119696 and #96076
2025-02-06 11:45:11 +11:00
Ryan Ernst
9a477f7816
Rename environment dir accessors (#121803) (#121834)
The node environment has many paths. The accessors for these currently
use a "file" suffix, but they are always directories. This commit
renames the accessors to make it clear these paths are directories.
2025-02-06 10:14:00 +11:00
Mayya Sharipova
4b16ef0d70
Analyze API to return 400 for wrong custom analyzer (#121568) (#121814)
If a custom analyzer provided in _analyze API can not be built, return
400 instead of the current 500. This most probably means that the user's
provided analyzer specifications are wrong.

Closes #121443
2025-02-06 09:45:47 +11:00
Slobodan Adamović
a0f0cea6da
Disable queryable built-in roles feature for core and datastream YAML tests (#121541) (#121663)
This PR disables the "queryable built-in roles" feature for the `CoreWithSecurityClientYamlTestSuiteIT` and `DataStreamsClientYamlTestSuiteIT` YAML test suites.
The feature was enabled by default in the #120323 PR, which asynchronously creates the `.security` index after cluster formation and indexes all built-in roles. The asynchronous creation of the `.security` index introduces non-deterministic behavior in our YAML tests.
Since these test suites are not intended to verify the queryable built-in roles functionality, having the feature enabled introduced flakiness and unnecessary complexity to handle `.security` in existing tests. These tests would have to exclude the `.security` index in some way (by adjusting permissions or API calls), and in the end cleanup (delete) the `.security` index. This simply adds overhead without much gain. The feature is already test covered by `XPackRestIT` and other integration/REST tests, disabling it here would not compromise test coverage. Instead, it ensures these suites remain deterministic and focused on the behaviors they were designed to verify.

Resolves https://github.com/elastic/elasticsearch/issues/121536
Resolves https://github.com/elastic/elasticsearch/issues/121513
Resolves https://github.com/elastic/elasticsearch/issues/121484
Resolves https://github.com/elastic/elasticsearch/issues/121478
Resolves https://github.com/elastic/elasticsearch/issues/121290
Resolves https://github.com/elastic/elasticsearch/issues/121246
Resolves https://github.com/elastic/elasticsearch/issues/121242
Resolves https://github.com/elastic/elasticsearch/issues/121238
Resolves https://github.com/elastic/elasticsearch/issues/121186
Resolves https://github.com/elastic/elasticsearch/issues/121131
Resolves https://github.com/elastic/elasticsearch/issues/121130
Resolves https://github.com/elastic/elasticsearch/issues/121128
Resolves https://github.com/elastic/elasticsearch/issues/121014
Resolves https://github.com/elastic/elasticsearch/issues/120965
Resolves https://github.com/elastic/elasticsearch/issues/120920
Resolves https://github.com/elastic/elasticsearch/issues/120890

(cherry picked from commit d1beb01d27)

# Conflicts:
#	muted-tests.yml
2025-02-05 01:59:42 +11:00
Chris Hegarty
4baffe4de1
Upgrade to Lucene 10.1.0 (#119308)
This commit upgrades to Lucene 10.1.0.
2025-01-30 13:41:02 +00:00
Mark Vieira
61dc93107f
Add lucene version compatibility tests (#121104)
This commit adds compatibility tests that target ES revisions that align with specific Lucene versions. In this case, we are intending to upgrade from Lucene 10.0 to 10.1. Since no on-prem Elasticsearch release exists with 10.0, we need another method to ensure compatibility with Lucene 10.0 indicies.

The work here is a bit hacky since all our compatibility testing infrastructure is centered around versions and we're now effectively doing compatibility tests between two different revisions of Elasticsearch that both report the same version. Ideally this specific testing would be replaced by unit tests, rather that reusing our full cluster restart tests for this purpose.

We'll also want to bump the commit referenced in the CI pipelines here to align with the last commit using Lucene 10.0.
2025-01-29 13:20:25 -08:00
Mikhail Berezovskiy
1901c71e51
Re-add http stream content size handler (#121095) 2025-01-29 12:07:29 -08:00
Joe Gallo
c4bb9b34bf
Optimize some per-document hot paths in the geoip processor (#120824) 2025-01-29 13:37:08 -05:00
John Verwolf
26b23d88aa
Revert "Reduce Data Loss in System Indices Migration" (#121119) 2025-01-28 20:49:38 -05:00
Joe Gallo
4127f5c92f
Extend geoip FullClusterRestartIT (#121085) 2025-01-28 17:08:13 -05:00
John Verwolf
f209c2bf23
Reduce Data Loss in System Indices Migration (#120168)
This PR removes a potential cause of data loss when migrating system indices. It does this by changing the way we set a "write-block" on the system index to migrate - now using a dedicated transport request rather than a settings update. Furthermore, we no longer delete the write-block prior to deleting the index, as this was another source of potential data loss. Additionally, we now remove the block if the migration fails.
2025-01-28 12:57:22 -08:00
Armin Braun
453db3fd71
Optimize InternalAggregations construction a little (#120868)
We can streamline and optimize this logic a little to
see less copying and more compact results.
2025-01-28 11:50:47 +01:00
Jack Conradson
dddf6481f6
Remove unnecessary entitlement (#120959)
This removes an unnecessary entitlement from reindex that is causing test failures.
2025-01-27 15:30:33 -08:00
Joe Gallo
2f81efd054
Re-enable geoip FullClusterRestartIT (#120966) 2025-01-27 18:23:00 -05:00
Lorenzo Dematté
570efa2bab
Revert "Add http stream content size handler (#120246)" (#120934)
This reverts commit 43e3e24d07.
2025-01-27 11:11:55 -07:00
Joe Gallo
022b841a45
Optimize IngestCtxMap construction (#120833) 2025-01-27 11:03:06 -05:00
Nhat Nguyen
9d90d05a50
Allow unmapped fields in MultiClustersIT tests (#120873)
The message_id field may be unmapped if documents were indexed into some 
indices but not all. This change specifies the unmapped type for
message_id, allowing it to be sorted in such cases.

Closes #120796
2025-01-27 07:54:23 -08:00
Mary Gouseti
0fabaf7716
[Bug] Data stream stats fails when there is a concrete index in the cluster (#120901) 2025-01-27 17:42:49 +02:00
Kostas Krikellas
8de9539e29
Lazy initialization for SyntheticSourceSupport.loader() (#120896)
* Lazy initialization for `SyntheticSourceSupport.loader()`

* [CI] Auto commit changes from spotless

* add missing

---------

Co-authored-by: elasticsearchmachine <infra-root+elasticsearchmachine@elastic.co>
2025-01-27 17:12:42 +02:00
Moritz Mack
6648a03bab
Revert "Revert "Remove deprecated tracing.apm.* settings for v9 (#119926)"" (#120895)
This reverts commit 5f44911ef8.
Reverts revert in #120268 after blockers have been resolved.
Relates to ES-10293
2025-01-27 16:04:36 +01:00
Alexey Ivanov
529ad049a8
Add test for system index migration using reindexing script (#120667) 2025-01-27 15:03:06 +00:00
Slobodan Adamović
52e0f21bdd
Enable queryable built-in roles feature by default (#120323)
Making the `es.queryable_built_in_roles_enabled` feature flag enabled by default.
This feature makes the built-in roles automatically indexed in `.security` index and available
for querying via Query Role API. The consequence of this is that `.security` index is now 
created eagerly (if it's not existing) on cluster formation.

In order to keep the scope of this PR small, the feature is disabled for some of the tests, 
because they are either non-trivial to adjust or the gain is not worthy the effort to do it now. 
The tests will be adjusted in a follow-up PR and later the flag will be removed completely.

Relates to #117581
2025-01-27 10:25:54 +01:00
Moritz Mack
190720d2d8
Special handling for invalid global labels for APM agent (#120795) 2025-01-24 17:46:27 +01:00
Joe Gallo
5e662c507e
Optimize IngestDocMetadata isAvailable (#120753) 2025-01-24 09:22:21 -05:00
Dimitris Rempapis
66db8c7d4c
Test/107515 RestoreTemplateWithMatchOnlyTextMapperIT (#120392)
Update the way of comparing stateMaps for equality
2025-01-24 15:47:44 +02:00
Ignacio Vera
9a9bc69883
Stop caching source map on SearchHit#getSourceMap (#119888)
This call has the side effect that if you are iterating a number of hits calling this method, you will be increasing the 
memory usage by a non trivial number which in most of cases is unwanted. Therefore this commit removes this caching
all together and add an assertion so the method is call once during the lifetime of the object.
2025-01-23 17:28:52 +01:00
Mary Gouseti
77ef1d41a0
Failure store - No selectors in snapshots (#120114)
In this PR we explore how we can include the failure store indices while
disallowing the user to use selectors in the `indices` field of the
create and restore snapshot requests.

**Security concerns**

The create and restore snapshot require cluster privileges only, so we
do not have to worry about how to handle index level security (see
[Create Snapshot
API](https://www.elastic.co/guide/en/elasticsearch/reference/current/create-snapshot-api.html#create-snapshot-api-prereqs)
& [Restore Snapshot
API](https://www.elastic.co/guide/en/elasticsearch/reference/current/restore-snapshot-api.html#restore-snapshot-api-prereqs)).

**Challenges**

While there are other APIs that do not support selectors but they do
include the failure indices in their response such as `GET
_data_stream/<target>`, `GET _data_stream/<target>/stats`, etc; the
snapshot APIs are a little bit different. The reason for that is that
the data stream APIs first collect only the relevant data streams and
then they select the backing indices and/or the failure indices. On the
other hand, the snapshot API that works with both indices and data
streams cannot take such a shortcut and needs to use the
`concreteIndices` method.

We propose, to add a flag that when the selectors are not "allowed" can
determine if we need to include the failure store or not. In the past we
had something similar called the default selector, but it was more
flexible and it was used a fallback always. 

Our goal now is to only specify the behaviour we want when the selectors
are not supported. This new flag allowed also to simplify the concrete
index resolution in `GET _data_stream/<target>/stats`

Relates to https://github.com/elastic/elasticsearch/issues/119545
2025-01-24 00:24:45 +11:00
Alexey Ivanov
2002510d4a
Fix Existing System Index Migration Integration Tests (ES-10527) (#120663)
Re-enables system index migration tests in main. Previously, these tests were only running on the last minor version, leaving the system indices migration infrastructure largely untested for most of the time.
2025-01-23 11:39:36 +00:00
Dimitris Rempapis
e276c71f76
Reintroduce common-analysis tests (#120604)
Reintroduce common-analysis tests
2025-01-22 17:00:03 +02:00
Lorenzo Dematté
bdd2fc00d3
[Entitlements] Policy and checks for loading native libraries (#120044) 2025-01-22 14:00:40 +01:00
Simon Cooper
39601ed683
Remove IndexNameExpressionResolver from base classes that don't use it (#120531) 2025-01-22 10:17:07 +00:00
Moritz Mack
f1447fe821
[Entitlements] Instrument write access to System properties (#120357)
Instrument write access to System properties by means of the `WriteSystemPropertiesEntitlement`.
`System.setProperties(Properties)` is always denied.

Part of #ES-10359
2025-01-21 18:07:40 +01:00
Mikhail Berezovskiy
4e0e36b38c
Relax http stream.next closure assertion (#120480) 2025-01-20 16:26:04 -08:00
Lorenzo Dematté
cd86b3b497
[Entitlements] Refactor Network Entitlement (#120391) 2025-01-20 18:29:32 +01:00
Nick Tindall
c02292f82b
Retry internally when CAS upload is throttled [GCS] (#120250)
Fixes #116546
2025-01-20 12:28:34 +11:00
Mikhail Berezovskiy
43e3e24d07
Add http stream content size handler (#120246) 2025-01-17 11:01:30 -08:00
Lorenzo Dematté
a397fe9291
[Entitlements] Network access checks for NIO classes (#120138) 2025-01-17 11:54:27 +01:00
Mary Gouseti
2ee7ca4187
[Failure store] Add failure index retrieval to IndexAbstraction (#119413) 2025-01-17 09:44:35 +02:00
Patrick Doyle
34059c9dbd
Limit ByteSizeUnit to 2 decimals (#120142)
* Exhaustive testParseFractionalNumber

* Refactor: encapsulate ByteSizeUnit constructor

* Refactor: store size in bytes

* Support up to 2 decimals in parsed ByteSizeValue

* Fix test for rounding up with no warnings

* ByteSizeUnit transport changes

* Update docs/changelog/120142.yaml

* Changelog details and impact

* Fix change log breaking.area

* Address PR comments
2025-01-16 19:30:23 +00:00
Craig Taverner
40c34cd896
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.
2025-01-16 19:43:51 +01:00
Moritz Mack
5f44911ef8
Revert "Remove deprecated tracing.apm.* settings for v9 (#119926)" (#120268)
Temporarily reverts elastic/elasticsearch#119926 due to unforeseen
usage.

Relates to ES-10293
2025-01-16 22:47:49 +11:00
Niels Bauman
9f597a4eb5
Remove trappy timeouts from GetIndexRequest (#120037)
Relates #107984
2025-01-16 16:05:36 +10:00
Lorenzo Dematté
1848d6bb93
[Entitlements] Network access checks on Sockets (#120093) 2025-01-15 22:01:56 +01:00
David Turner
679ae619b5
Remove unused Transport#version field (#120202) 2025-01-16 03:41:50 +11:00
Simon Cooper
a2d84b1b90
Remove assumed features in server for 9.0 (#119946)
All features added before 8.18 can now be assumed and removed in 9.0
2025-01-15 08:37:04 +00:00
David Turner
7ddcfeb638
Fix KibanaThreadPoolIT (#120097)
This test will fail to see the rejection if the GET retries on a
different shard copy, so with this commit we make sure there are no
spare shard copies on which to retry.

Closes #113939
2025-01-15 02:07:58 +11:00
Yang Wang
60a54e6ab7
[Test] Upgrade minio docker image used for tests (#120086)
This PR upgrades the minio docker image from
RELEASE.2021-03-01T04-20-55Z which is 3+ years old to the latest
RELEASE.2024-12-18T13-15-44Z.

Relates: #118548
2025-01-14 21:38:09 +11:00