Commit graph

16384 commits

Author SHA1 Message Date
Joe Gallo
5c9cdeeb87
Bump junit and hamcrest (#126055) 2025-04-01 14:05:58 -04:00
David Kyle
fc933d436a
[ML] Remove InferenceServiceResults#transformToLegacyFormat (#125924) 2025-04-01 13:49:48 +01:00
Slobodan Adamović
83d7fe0d82
Prevent :: selectors in remote cluster expressions when security is off (#125968)
This PR prevents using `::` selectors in remote index expressions and adds
a basic integration test with security off.

Relates to https://github.com/elastic/elasticsearch/pull/125252
2025-04-01 10:12:23 +02:00
Luca Cavanna
b01438a95f
Re-enable parallel collection for field sorted top hits (#125916)
With #123610 we disabled parallel collection for field and script sorted top hits,
aligning its behaviour with that of top level search. This was mainly to work around
a bug in script sorting that did not support inter-segment concurrency.

The bug with script sort has been fixed with #123757 and concurrency re-enabled for it.

While sort by field is not optimized for search concurrency, top hits benefits from it
and disabling concurrency for sort by field in top hits has caused performance
regressions in our nightly benchmarks.

This commit re-enables concurrency for top hits with sort by field is used. This
introduces back a discrepancy between top level search and top hits, in that concurrency
is applied for top hits despite sort by field normally disables it. The key difference
is the context where sorting is applied, and the fact that concurrency is disabled
only for performance reasons on top level searches and not for functional reasons.
2025-04-01 09:27:43 +02:00
Jack Conradson
0e5bd3cbf3
Add exclusive file entitlement for settings (#125272)
Adds changes to ensure the correct caller's module is checked for exclusive file settings.
2025-03-31 14:54:14 -07:00
Iraklis Psaroudakis
11942e82ab
Introduce permitAcquired in ensureMutable (#125801)
Relates ES-11159
2025-03-31 19:38:36 +03:00
Sam Xiao
bddc14c232
Add multi-project support for health indicator shards_availability (#125512) 2025-03-31 11:12:52 -04:00
Niels Bauman
fd2492f935
Optimize usage calculation in ILM policies retrieval API (#106953)
Optimize calculating the usage of ILM policies in the `GET _ilm/policy` and `GET _ilm/policy/<policy_id>` endpoints by xtracting a separate class that pre-computes some parts on initialization (i.e. only once per request) and then uses those pre-computed parts when calculating the usage for an individual policy. By precomputing all the usages, the class makes a tradeoff by using a little bit more memory to significantly improve the overall processing time.
2025-03-31 16:11:41 +01:00
Niels Bauman
a8f5db2604
Make data stream lifecycle project-aware (#125476)
Now that all actions that DLM depends on are project-aware, we can make DLM itself project-aware.
There still exists only one instance of `DataStreamLifecycleService`, it just loops over all the projects - which matches the approach we've taken for similar scenarios thus far.
2025-03-31 14:52:43 +01:00
Luca Cavanna
14b017b18a
Address precision issue in IndexDiskUsageAnalyzerTests#testCompletionFields (#125849)
We have some tolerance wound how many bytes we report for these completion fields. But the
values depend on the distribution of the random values that determine how many docs get
an option field. This commit makes the test more precise by computing the real ratio
between docs that have the optional field and the total number of docs, so that we
can base assertion on more realistic expectations.

Closes #123269
2025-03-31 13:34:38 +02:00
Tanguy Leroux
7fadeeb7c9
Revert "Use read/write engine lock to guard operations against resets (#124635)" (#125915)
This reverts commit 4aa7ce5f3e.
2025-03-31 10:16:53 +02:00
Albert Zaharovits
84e1372af2
Start indexing throttling only after disk IO unthrottling does not keep up with the merge load (#125654)
Fixes an issue where indexing throttling kicks in while disk IO is throttling.
Instead disk IO should first unthrottle, and only then, if we still can't keep up with the merging load, start throttling indexing.

Fixes elastic/elasticsearch-benchmarks#2437
Relates #120869
2025-03-31 00:26:12 +03:00
Armin Braun
fd2cc97541
Introduce batched query execution and data-node side reduce (#121885)
This change moves the query phase a single roundtrip per node just like can_match or field_caps work already. 
A a result of executing multiple shard queries from a single request we can also partially reduce each node's query results on the data node side before responding to the coordinating node.

As a result this change significantly reduces the impact of network latencies on the end-to-end query performance, reduces the amount of work done (memory and cpu) on the coordinating node and the network traffic by factors of up to the number of shards per data node!

Benchmarking shows up to orders of magnitude improvements in heap and network traffic dimensions in querying across a larger number of shards.
2025-03-29 16:53:18 +01:00
Tim Brooks
70bc143dee
Advance split target primary term to match source (#125738)
Whenever a split target that has not been handed off is being assigned
the primary term is advanced to match at least the source primary term.
2025-03-28 13:28:40 -06:00
Jordan Powers
71e74bdd66
Store arrays offsets for scaled float fields natively with synthetic source (#125793)
This patch builds on the work in #113757, #122999, #124594, #125529, and 
#125709 to natively store array offsets for scaled float fields instead of
falling back to ignored source when synthetic_source_keep: arrays.
2025-03-28 20:26:29 +01:00
John Verwolf
848a6783f0
Fix system data stream restore warning (#125881)
This PR fixes a bug in the RestoreService whereby the validation logic for index templates didn't account for system datastreams.
2025-03-28 20:14:57 +01:00
Jordan Powers
35a6298730
Optimize entry maps in TSDB doc values codec (#125805)
Currently, the Lucene90DocValuesProducer uses optimized IntObjectHashMaps 
to track various entries for each field, while the
ES87TSDBDocValuesProducer uses regular HashMap<String, Object>. This patch
updates the ES87TSDBDocValuesProducer class to also use the optimized
hash maps.
2025-03-28 11:08:06 -07:00
Pete Gillin
f91f1323a8
ES-10037 Configurable metrics in data stream auto-sharding (#125612)
This adds cluster settings to allow for a choice of write load metrics
in the data stream auto-sharding calculations. There are separate
settings for the increasing and decreasing calculations. Both default
to the existing 'all-time' metric for now.

This also refactors `DataStreamAutoShardingServiceTests`. The main two things done are:

 - Split large test methods which do several independent tests in
   blank code blocks into more smaller methods.

 - Fix an unnecessarily complicated pattern where the code would
   create a `Function` in a local variable and then immediately
   `apply` it exactly once... rather than just executing the code
   normally.
2025-03-28 15:17:20 +00:00
Jeremy Dahlgren
89467b80fc
Add FailedShardEntry info to shard-failed task source string (#125520)
Appends the FailedShardEntry request to the 'shard-failed'
task source string in ShardFailedTransportHandler.messageReceived().
This information will now be available in the 'source' string for
shard failed task entries in the Cluster Pending Tasks API response.
This source string change matches what is done in the
ShardStartedTransportHandler.

Closes #102606.
2025-03-28 10:58:50 -04:00
Andrei Dan
b942e5847a
Add shard routing and state transitions logging to testFilterCacheStats (#125836) 2025-03-28 14:14:18 +00:00
Slobodan Adamović
1d6c6a59c8
[Failure Store] Prevent usage of :: selectors with cross-cluster expressions (#125252)
The CCS is currently not supported for failure store backing indices. 
This PR adjusts the selector parsing (introduced in #118614) to prevent 
using `::failures` and `::data` selectors with cross-cluster expressions.

For example, `GET my_remote_cluster:logs-*::failures/_search` request 
will fail early, during expression parsing. 
To test manually, run `./gradlew run-ccs` and execute the example request.
2025-03-28 09:20:51 +01:00
Yang Wang
3568ab8eac
Migrate RepositoriesMetadata to ProjectCustom (#125398)
This PR migrates RepositoriesMetadata from Metadata#ClusterCustom to
Metadata#ProjectCustom and handles wire BWC.

Resolves: ES-10477
2025-03-28 17:53:17 +11:00
Nick Tindall
1c38e7eea7
Revert "Add temporary logging for #125668 (#125749)" (#125820)
This reverts commit 8ced682a0c.
2025-03-28 15:45:30 +11:00
Pete Gillin
4fa41062a6
Tweak tolerance in EWMR tests (#125773)
We have seen occasional failures with the existing tolerance, in
`testEwmr_threadSafe` which contains some randomness. We were
asserting the result of a lot of f.p. operations with a tolerance of
1.0e-13. The highest error I saw in any of the reported failures was less than
1.2e-13. This PR increases the tolerance to 2.0e-13 which should allow
all those to pass.

Fixes #124692
2025-03-27 18:57:58 +02:00
Carlos Delgado
968bddc462
Non existing synonyms sets do not fail shard recovery (#125659) 2025-03-27 18:04:20 +02:00
Pooya Salehi
e397ed3e5f
Move MergeMemoryEstimator (#125686)
Relates ES-10961
2025-03-27 13:32:19 +02:00
Pete Gillin
66432fb886
ES-10037 Track the peak indexing load for each shard (#125521)
This tracks the highest value seen for the recent write load metric
any time the stats for a shard was computed, exposes this value
alongside the recent value, and persists it in index metadata
alongside it too.

The new test in `IndexShardTests` is designed to more thoroughly test
the recent write load metric previously added, as well as to test the
peak metric being added here.

ES-10037 #comment Added peak load metric in https://github.com/elastic/elasticsearch/pull/125521
2025-03-27 12:03:39 +02:00
David Turner
8ced682a0c
Add temporary logging for #125668 (#125749)
This failure doesn't reproduce locally after repeated attempts. Unmuting
it in CI with some additional logging, to be reverted ASAP.
2025-03-27 19:06:59 +11:00
Yang Wang
0c8daaeca5
Make SnapshotsInProgress project compatible (#125470)
This PR adds project-id to both SnapshotsInProgress and Snapshot so that
they are aware of projects and ready to handle snapshots from multiple
projects.

Relates: ES-10224
2025-03-27 10:54:53 +11:00
Jordan Powers
689eaf20f4
Store arrays offsets for unsigned long fields natively with synthetic source (#125709)
This patch builds on the work in #113757, #122999, #124594, and #125529 to
natively store array offsets for unsigned long fields instead of falling
back to ignored source when synthetic_source_keep: arrays.
2025-03-27 00:59:24 +02:00
Benjamin Trent
dd58b0b6fa
Return appropriate error on null dims update instead of npe (#125716)
Calling `Object::toString` was trying to call `null.toString()`, really
it should have been `Objects::toString`, which accepts `null`.

closes: https://github.com/elastic/elasticsearch/issues/125713
2025-03-27 08:47:20 +11:00
Benjamin Trent
009a86a0e3
Allow zero for rescore_vector.oversample to indicate by-passing oversample and rescoring (#125599)
This allows a `rescore_vector: {oversample: 0}` to indicate bypassing
oversampling and rescoring. 

This is useful for:

 - Updating a quantized mapping to turn off automatic rescoring
 - Bypassing oversampling at query time in an ad-hoc manner if its on by default in the mapping

closes: https://github.com/elastic/elasticsearch/issues/125157
2025-03-27 06:56:51 +11:00
Armin Braun
632b9e79bd
Load FieldInfos from store if not yet initialised through a refresh on IndexShard (#125650)
Load field caps from store if they haven't been initialised through a refresh yet.
Keep the plain reads to not mess with performance characteristics too much on the good path but protect against confusing races when loading field infos now (that probably should have been ordered stores in the first place but this was safe due to other locks/volatiles on the refresh path).

Closes #125483
2025-03-26 18:54:21 +01:00
Mark Vieira
0388a5980c
Migrate legacy QA projects to new test clusters framework (#125545) 2025-03-26 10:05:56 -07:00
Stanislav Malyshev
07921a78a6
Handle long overflow in dates (#124048)
* Handle long overflow in dates
2025-03-26 18:57:04 +02:00
Mary Gouseti
6503c1b94b
[Failure Store] Conceptually introduce the failure store lifecycle (#125258)
* Specify index component when retrieving lifecycle

* Add getters for the failure lifecycle

* Conceptually introduce the failure store lifecycle (even for now it's the same)
2025-03-26 13:21:48 +02:00
David Turner
40095992c2
Add more addTemporaryStateListener utils (#125648)
We often call `addTemporaryStateListener` with the `ClusterService` of a
random node, or the currently elected master. This commit adds utilities
for this common pattern.
2025-03-26 21:15:18 +11:00
Johannes Fredén
acb1061653
Make project and cluster secrets customs available in server (#125406)
* Make project and cluster secrets customs available in core
2025-03-26 08:12:01 +01:00
Nik Everett
f097818fa5
ESQL: Report original_types (#124913)
Adds the `original_types` to the description of ESQL's `unsupported`
fields. This looks like:

```
    {
      "name" : "a",
      "type" : "unsupported",
      "original_types" : [
        "long",
        "text"
      ]
    }
```

for union types. And like:

```
    {
      "name" : "a",
      "type" : "unsupported",
      "original_types" : [
        "date_range"
      ]
    }
```

for truly unsupported types.

This information is useful for the UI. For union types it can suggest
that users append a cast.
2025-03-26 13:21:53 +11:00
Jordan Powers
24734e6894
Rename offset encoding 8.x backport version (#125447)
Renamed to SYNTHETIC_SOURCE_STORE_ARRAYS_NATIVELY_BACKPORT_8_X since it
will include all 8.x implementations of arrays offset encoding.
2025-03-25 13:32:09 -07:00
Mark Vieira
65751062f7
Re-enable VerifyVersionConstantsIT (#125605) 2025-03-25 12:16:53 -07:00
Ying Mao
a6f685cc2a
Adding common rerank options to Perform Inference API (#125239)
* wip

* Adding rerank common options

* Linting

* Linting

* [CI] Auto commit changes from spotless

* Update docs/changelog/125239.yaml

* PR feedback

---------

Co-authored-by: elasticsearchmachine <infra-root+elasticsearchmachine@elastic.co>
2025-03-25 12:32:18 -04:00
Jordan Powers
af1f1452d7
Store arrays offsets for boolean fields natively with synthetic source (#125529)
This patch builds on the work in #113757, #122999, and #124594 to natively
store array offsets for boolean fields instead of falling back to ignored
source when `synthetic_source_keep: arrays`.
2025-03-25 08:59:59 -07:00
elasticsearchmachine
37f5b1db92 Bump versions after 8.17.4 release 2025-03-25 15:23:21 +00:00
elasticsearchmachine
a5e52a4d7e Bump versions after 8.16.6 release 2025-03-25 12:23:43 +00:00
Tanguy Leroux
4aa7ce5f3e
Use read/write engine lock to guard operations against resets (#124635)
Today shard's engine mutation are guarded by an engineMutex object monitor. But we would like to be able to execute one or more operations on an engine instance, without this instance being resetted during the execution of the operation.

In order to do that, this change replaces the engineMutex by a reentrant read/write lock and introduces two new methods IndexShard#withEngine() and IndexShard#withEngineOrNull() that can be used to execute an operation while avoiding the current engine instance to be reset. It does not prevent it to be closed during execution though.

Relates ES-10826

Co-authored-by: Francisco Fernández Castaño <francisco.fernandez.castano@gmail.com>
2025-03-25 13:19:55 +01:00
Artem Prigoda
3d89e221e5
Add a generic method for reading shard field stats from an Engine (#125055)
Support reading shard field stats outside of `IndexShard` in read-only engines.

See ES-11062
2025-03-25 08:57:49 +01:00
James Baiera
81ef7ddd53
Support index pattern selector syntax in ES|QL (#120660)
This PR updates the ES|QL grammar to include the selector portion of an index pattern. Patterns 
are recombined before being sent to field caps. Field caps already supports this functionality, so 
this is primarily wiring it up where needed.
2025-03-24 14:08:43 -04:00
mushaoqiong
df84065205
Avoid creating known_fields for every check in Alias (#124690)
* avoid creating known_fields for every check

* add changelog

---------

Co-authored-by: 广富 <shaoqiong.msq@alibaba-inc.com>
Co-authored-by: Lee Hinman <dakrone@users.noreply.github.com>
2025-03-24 08:22:34 -06:00
Mike Pellegrini
019ce3fb81
Fix Semantic Text 8.x Upgrade Bug (#125446) 2025-03-24 09:15:54 -04:00