Compare commits

...

2940 commits

Author SHA1 Message Date
Benjamin Trent
4fcd4ad1c2
Update bulk scorer cancellation interval to match BooleanScorer window size (#127034)
BooleanScorer's window has been updated, lets increase our initial
cancellation check to match.
2025-04-22 03:27:17 +10:00
Jonathan Buttner
e840334f8b
Fixing issue (#127074) 2025-04-21 13:14:53 -04:00
George Wallace
b98a4fa067
Fixing external link (#127114) 2025-04-21 17:57:48 +02:00
Armin Braun
1ac51783a3
Some cleanups to counting in AbstractSearchAsyncAction (#126167)
With batched execution merged, turns out we can inline one
single-use method here and deduplicate the counting to zero as well.
2025-04-21 17:52:28 +02:00
Patrick Doyle
15c2c467e7
Refactor: ScopeResolver (#126921)
* Fix: use getScopeName consistently

* Rename PolicyManagerTests method

* Refacor: simplify PluginsResolver.create

* Change PluginsResolver to ScopeResolver

* Move boot layer test to ScopeResolverTests

* [CI] Auto commit changes from spotless

* Rename PolicyScope

* Add ComponentKind enum

* Package private componentName field

---------

Co-authored-by: elasticsearchmachine <infra-root+elasticsearchmachine@elastic.co>
2025-04-21 17:35:10 +02:00
Benjamin Trent
4efa17681b
Muting expensive filtersIT test causing test runner oomes (#127113)
this new test is pretty expensive, it was important to discover a
particular failure, but its harming CI as its just too expensive
(causing oomes).
2025-04-22 01:33:37 +10:00
elasticsearchmachine
2c8649dbb5 Mute org.elasticsearch.xpack.esql.qa.multi_node.EsqlClientYamlIT test {p0=esql/10_basic/basic with documents_found} #127046 2025-04-22 01:20:24 +10:00
Nik Everett
5b351af9fc
ESQL: Unmute test (#127065)
It was assuming a simpler execution model. This weakens the assertion to
one that should always pass.

Closes #127046 Closes #127039 Closes #127090 Closes #127080
2025-04-22 00:16:55 +10:00
Jack Conradson
1234f97031
Refactor file path resolution for entitlements (#127040)
This change refactors the known directory resolution such as modules, 
plugins, lib, etc. into a PathLookup. This is one of the steps towards 
allowing unit tests to provide their own PathLookup for resolution so 
we can enable entitlements there.

ES-11584
2025-04-21 06:53:56 -07:00
Luca Cavanna
bc0e1d0675
Forward port incremental top docs 8.x transport version (#127048)
This commit forward ports the transport version added with #126770 in 8.x,
and adjust the corresponding version conditionals.
2025-04-21 11:14:30 +02:00
elasticsearchmachine
4a8bc57127 Mute org.elasticsearch.xpack.esql.qa.single_node.EsqlClientYamlAsyncIT test {p0=esql/10_basic/basic with documents_found} #127080 2025-04-21 09:48:17 +10:00
weizijun
d854b1c625
Bugfix: fixed scroll with knn query (#126035)
Although scrolling is not recommended for knn queries, it is effective.
But I found a bug that when use scroll in the knn query, the But I found
a bug that when using scroll in knn query, knn_score_doc will be lost in
query phase, which means knn query does not work. In addition, the
operations for directly querying the node where the shard is located and
querying the node with transport are different. It can be reproduced on
the local node. Because the query phase uses the previous
ShardSearchRequest object stored before the dfs phase. But when it run
in the local node, it don't do the encode and decode processso the
operation is correct. I wrote an IT to reproduce it and fixed it by
adding the new source to the LegacyReaderContext.
2025-04-21 01:55:59 +10:00
Armin Braun
c662590b6d
Make DelayableWriteable compress its contents (#126988)
In light of data from recent escalations and the introduction of batched execution we can make two improvements to this logic.
For one, we should prefix with a fixed length length field so that we don't need to do any copying when serializing to account for the vint. This outright halves the memory bandwidth required relative to the previous implementation.
More importantly maybe, we should compress these bytes. The wire-format for aggregations is rather inefficient when working with nested bucket aggregations since the type strings are repeated over and over. These don't contribute to the peak heap requirements because they are translated into Java types, but blow up the message size considerably (among other things). Practically, it seems that we often get compression ratios of ~10x for aggregations.
Given that we generally have more memory issues than CPU issues during the reduce-step it seems like an easy tradeoff to trade a little CPU for compression for serious heap savings here.
2025-04-19 19:53:46 +02:00
Craig Taverner
f6a05c6a7c
Support depthOffset in MD docs headings for nesting functions (#126984)
While this change appears subtle at this point, I am using this in a later PR that adds a lot more spatial functions, where nesting them in related groups like this looks much better.

The main impact of this is that the On this page navigator on the right panel of the docs will show the nesting

Co-authored-by: Liam Thompson <32779855+leemthompo@users.noreply.github.com>
2025-04-19 11:28:05 +02:00
elasticsearchmachine
062e8bc7a2 Mute org.elasticsearch.multiproject.test.XpackWithMultipleProjectsClientYamlTestSuiteIT test {yaml=esql/10_basic/basic with documents_found} #127088 2025-04-19 16:32:04 +10:00
Ryan Ernst
0d2bc75301
Make sure SM isn't running alongside entitlements tests (#127082)
closes #127077
2025-04-19 02:37:13 +02:00
elasticsearchmachine
d5332ce2bc Mute org.elasticsearch.packaging.test.DockerTests test026InstallBundledRepositoryPlugins #127081 2025-04-19 09:24:42 +10:00
Kathleen DeRusso
e280aa5d50
Revert semantic_text model registry changes (#127075) 2025-04-18 18:36:33 -04:00
Armin Braun
7c3e8507f4
Clear per-shard failure earlier in AbstractSearchAsyncAction.onShardResult (#126933)
We can clean the failure before we potentially go async for a partial merge here to save
some heap and needless reference chains to the per-shard result.
2025-04-18 22:59:37 +02:00
Jordan Powers
b972364539
Optimize ES819 doc values address offset calculation (#126732)
When writing the doc values addresses, we currently perform an iteration 
over all the sorted numeric doc values to calculate the addresses. When
merging sorted segments, this iteration is expensive as it requires
performing a merge sort.

This patch removes this iteration by instead calculating the addresses
while we are writing the values, writing the addresses to a  temporary
file. Afterwards, they are copied from the temporary file into the
merged segment.

Relates to #126111
2025-04-18 22:52:22 +02:00
James Baiera
7b89f4d4a6
Add ability to redirect ingestion failures on data streams to a failure store (#126973)
Removes the feature flags and guards that prevent the new failure store functionality 
from operating in production runtimes.
2025-04-18 16:33:03 -04:00
Dianna Hohensee
72b4ed255b
Add to allocation architecture guide (#125328)
How master and data nodes communicate
about shard allocation
2025-04-18 14:56:27 -04:00
Brendan Cully
26254e3f42
RepositoryAnalysisFailureIT: disrupt earlier (#127032)
The fix to #126747 was only for one test. This applies
that change to all the tests in this suite that need it.

Fixes #127029
2025-04-18 11:38:49 -07:00
Jonathan Buttner
3156cc7c0f
[ML] Implement JSONPath replacement for Inference API (#127036)
* Adding initial extractor

* Finishing tests

* Addressing feedback
2025-04-18 14:34:19 -04:00
Dianna Hohensee
41b4cee814
Change allocation explain message (#127060)
Reduce the amount of text returned when no shard is requested and all
shards are assigned. Less text is easier to digest and hopefully will
not be skimmed.
2025-04-18 14:04:25 -04:00
Ryan Ernst
584b2379f0
Use Terminal.readSecret in add string keystore command (#126966)
As a followon to #126729, the add string keystore command doesn't need
to use a reader at all (and it was incorrect for it to close the reader
from the terminal). Instead, the Terminal abstraction already handles
how to get at line by line secrets. This commit removes that usage of
reader and uses readSecret calls instead.

closes #126882
2025-04-18 19:50:15 +02:00
James Baiera
d928d1a418
Add node feature for failure store, refactor capability names (#126885)
Adds a node feature that is conditionally added to the cluster state if the failure store 
feature flag is enabled. Requires all nodes in the cluster to have the node feature 
present in order to redirect failed documents to the failure store from the ingest node 
or from shard level bulk failures.
2025-04-18 13:42:48 -04:00
Nik Everett
85749d606c
Add benchmark script (#126596)
Adds a simple script to run benchmarks for ESQL and collect their
results. The script has a `--test` mode which takes about ten minutes.
Running without `--test` takes a four hours fifteen minutes.

To speed up `--test` I reworked the "self test" that each benchmark runs
to be optional and disabled in `--test` mode.
2025-04-18 19:09:38 +02:00
Pat Whelan
d870f42c90
[ML] Allow InputType for Bedrock Titan (#127021)
Semantic Search can now send InputType as part of the request to
non-Cohere Bedrock models.

Fix #126709
2025-04-18 18:38:59 +02:00
Armin Braun
f461f90d48
Remove redundant marker interfaces that extend Bucket (#127038)
No need to have these marker interfaces around when weäre not using them anywhere, all they do is hide a lot of code duplication actually. Removing them sets up the possible removal of hundreds of lines of downstream code it seems
2025-04-18 18:26:39 +02:00
Joe Gallo
b46bee4e47
Correctly handle non-integers in nested paths in the remove processor (#127006) 2025-04-18 11:46:54 -04:00
elasticsearchmachine
70d46d675b Mute org.elasticsearch.xpack.esql.qa.single_node.EsqlSpecIT test {rrf.SimpleRrf ASYNC} #127063 2025-04-19 01:28:18 +10:00
Lorenzo Dematté
69f6520b0c
[Entitlements] Validation checks on paths (#126852)
With this PR we restrict the paths we allow access to, forbidding plugins to specify/request entitlements for reading or writing to specific protected directories.

I added this validation to EntitlementInitialization, as I wanted to fail fast and this is the earliest occurrence where we have all we need: PathLookup to resolve relative paths, policies (for plugins, server, agents) and the Paths for the specific directories we want to protect.

Relates to ES-10918
2025-04-18 15:36:07 +02:00
Dianna Hohensee
4c9c82418e
Improve ShardRoutingState docs (#126875) 2025-04-18 09:24:10 -04:00
elasticsearchmachine
75f8e4a97b Mute org.elasticsearch.xpack.esql.qa.multi_node.EsqlSpecIT test {rerank.Reranker before a limit ASYNC} #127051 2025-04-18 20:14:02 +10:00
Niels Bauman
a81c4491f0
Fix timeout for awaiting index existence (#126773)
#126692 allowed consumers to specify a timeout to `awaitIndexExists`,
but that timeout did not get propagated correctly to all the required
places.
2025-04-18 11:27:52 +02:00
Lorenzo Dematté
b6c9584c28
[Entitlements] Add missing outbound_network entitlement to x-pack-core (#126992)
Add missing outbound_network entitlement to x-pack-core
Closes #127003
2025-04-18 10:19:51 +02:00
elasticsearchmachine
36af046441 Merge patch/serverless-fix into main 2025-04-18 04:30:44 +00:00
Nik Everett
492b036326
NOOP some transport versions (#127037)
We accidentally released the `9_051_0_00` and `9_052_0_00` transport
versions to serverless without their backing code. We can't take that
back. It's live. You can't unbake the cake.

That version of Elasticsearch will claim to be `9_052_0_00` but actually
speak `9_050_0_00` code. To make main compatible with that version we're
bumping all transport versions in main *past* those numbers.

This is a forbidden action. You may not do this. I may not do this. It
is not safe. But it is the only way to make the world whole again.

In all seriousness, everything will be fine. It's against the rules but
sometimes you have to break rules to put things right. We believe some
serverless dev environments may break which is sad but it's worth it to
bring everything back to sane land.
2025-04-18 01:45:08 +02:00
Nhat Nguyen
9d5df193ca
Add last_over_time (#126650)
This PR introduces a time-series aggregation function that collects the 
last value of each time series within each grouping.

For example:

TS index 
| STATS sum(last_over_time(memory_usage)) BY cluster, bucket(@timestamp, 1minute)
2025-04-17 16:13:58 -07:00
elasticsearchmachine
aebb1de41e Mute org.elasticsearch.xpack.test.rest.XPackRestIT test {p0=esql/10_basic/basic with documents_found} #127039 2025-04-18 07:54:52 +10:00
Oleksandr Kolomiiets
62c0629da6
Add new-style block loader tests for constant_keyword, version, wildcard (#126968) 2025-04-17 13:22:09 -07:00
Brian Seeders
af6dac5c05
Revert "Forward port release notes for v8.17.5 (#127024)"
This reverts commit 66b504a881.
2025-04-17 16:16:21 -04:00
elasticsearchmachine
66b504a881
Forward port release notes for v8.17.5 (#127024) 2025-04-17 16:15:42 -04:00
Ryan Ernst
42dc870ece
Ensure logs dir exists before using as working dir (#126566)
With the change to using the logs dir as the working dir of the
Elasticsearch process we need to ensure the logs dir exists within the
CLI instead of later during startup.

relates #124966
2025-04-17 12:59:47 -07:00
Brian Seeders
2a243d8492
Revert #126441 Add flow-control and remove auto-read in netty4 HTTP pipeline (#127030)
* Revert "Release buffers in netty test (#126744)"

This reverts commit f9f3defe92.

* Revert "Add flow-control and remove auto-read in netty4 HTTP pipeline (#126441)"

This reverts commit c8805b85d2.
2025-04-17 12:37:26 -07:00
David Turner
7e62862eab
Clarify queues in thread pool settings (#127027)
The docs about the queue in a `fixed` pool are a little awkwardly
worded, and there is no mention of the queue in a `scaling` pool at all.
This commit cleans this area up.
2025-04-17 19:58:02 +01:00
elasticsearchmachine
633539108f Mute org.elasticsearch.repositories.blobstore.testkit.analyze.RepositoryAnalysisFailureIT testFailsOnReadError #127029 2025-04-18 04:04:19 +10:00
Armin Braun
5a3c9e7dc1
Fix AsyncSearchActionIT tests (#127010)
Missed a spot here when moving this to delayed deserialization, we can leak pending batch results here on exceptions.

closes #126994
closes #126995
closes #126975
closes #126999
closes #127001
closes #126974
closes #127008
2025-04-17 19:31:58 +02:00
Liam Thompson
b6c9b9b54d
[DOCS] Update URLs for ESQL Kibana generated docs (#127011) 2025-04-17 18:25:24 +02:00
Samiul Monir
afb83b7551
Updating text_similarity_reranker documentation (#127004)
* updating documentation to remove duplicate and redundant wording from 9.x

* Update links to rerank model landing page

---------

Co-authored-by: Liam Thompson <32779855+leemthompo@users.noreply.github.com>
2025-04-17 11:54:19 -04:00
Luca Cavanna
f274ab7402
Remove empty results before merging (#126770)
We addressed the empty top docs issue with #126385 specifically for scenarios where
empty top docs don't go through the wire. Yet they may be serialized from data node
back to the coord node, in which case they will no longer be equal to Lucene#EMPTY_TOP_DOCS.

This commit expands the existing filtering of empty top docs to include also those that
did go through serialization.

Closes #126742
2025-04-17 17:36:20 +02:00
elasticsearchmachine
a4b1692148 Mute org.elasticsearch.packaging.test.DockerTests test024InstallPluginFromArchiveUsingConfigFile #126936 2025-04-18 01:23:57 +10:00
elasticsearchmachine
cd138b02f2 Mute org.elasticsearch.xpack.search.AsyncSearchActionIT testDeleteCleanupIndex #127008 2025-04-18 00:56:59 +10:00
Jeremy Dahlgren
512e86813c
Test for cancelled task in TransportSnapshotsStatusAction.buildResponse() (#126740)
Testing for cancellation in buildResponse() avoids a lot of
unnecessary processing in scenarios with many shards.

Closes ES-10981.
2025-04-17 10:38:41 -04:00
Niels Bauman
16070a342f
Fix tests in TimeSeriesDataStreamsIT (#126851)
These tests had the potential to fail when subsequent requests would hit
different nodes with different versions of the cluster state.

Only one of these tests failed already, but we fix the other ones
proactively to avoid future failures.

Fixes #126746
2025-04-17 16:35:43 +02:00
Armin Braun
0d01f88f95
Release InboundMessage and request instances earlier (#126998)
Follow-up to #126138.
We can now release requst bytes directly after deserialization.
Also, request instances need not go through a ref-counting cycle when forking,
removing some contention from transport threads.
2025-04-17 16:32:09 +02:00
elasticsearchmachine
0f0f0ef596 Mute org.elasticsearch.xpack.search.AsyncSearchActionIT testRestartAfterCompletion #126974 2025-04-17 23:52:50 +10:00
elasticsearchmachine
f94b41667e Mute org.elasticsearch.xpack.search.AsyncSearchActionIT testUpdateStoreKeepAlive #127001 2025-04-17 23:51:15 +10:00
elasticsearchmachine
ff07ce8d60 Mute org.elasticsearch.xpack.search.AsyncSearchActionIT testCleanupOnFailure #126999 2025-04-17 23:32:18 +10:00
elasticsearchmachine
721fd140d0 Mute org.elasticsearch.xpack.search.AsyncSearchActionIT testRemoveAsyncIndex #126975 2025-04-17 23:15:19 +10:00
elasticsearchmachine
316ec175d9 Mute org.elasticsearch.xpack.search.AsyncSearchActionIT testMaxResponseSize #126995 2025-04-17 23:12:33 +10:00
elasticsearchmachine
2de225a048 Mute org.elasticsearch.xpack.search.AsyncSearchActionIT testDeleteCancelRunningTask #126994 2025-04-17 23:12:28 +10:00
Armin Braun
149ff93789
Remove reference counting from InboundMessage and make it Releasable (#126138)
There is no actual need to reference-count InboundMessage instances. Their lifecycle is completely linear and we can simplify it away. This saves a little work directly but more importantly, it enables more eager releasing of the underlying buffers in a follow-up.
---------

Co-authored-by: David Turner <david.turner@elastic.co>
2025-04-17 15:10:08 +02:00
Kathleen DeRusso
a72883e8e3
Default new semantic_text fields to use BBQ when models are compatible (#126629)
* Default new semantic_text fields to use BBQ when models are compatible

* Update docs/changelog/126629.yaml

* Gate default BBQ by IndexVersion

* Cleanup from PR feedback

* PR feedback

* Fix test

* Fix test

* PR feedback

* Update test to test correct options

* Hack alert: Fix issue where mapper service was always being created with current index version
2025-04-17 08:25:10 -04:00
Martijn van Groningen
0d41e9a2a5
Tsdb doc values inline building jump table (#126499)
Build jump table (disi) while iterating over SortedNumericDocValues for encoding the values, instead of separately iterating over SortedNumericDocValues just to build the jump table.

In case when indexing sorting is active, this requires an additional merge sort. Follow up from #125403
2025-04-17 12:08:16 +02:00
Mariusz Jozala
4248c9908c Merge branch 'patch/serverless-fix' 2025-04-17 10:54:54 +02:00
Luigi Dell'Aquila
6b8c37e100
ES|QL: make telemetry more strict (#126940) 2025-04-17 10:46:15 +02:00
Martijn van Groningen
4b05fed0d9
Improve DocValuesConsumerUtil#compatibleWithOptimizedMerge(...) (#126894)
The compatibleWithOptimizedMerge() method doesn't the case when doc value fields don't exist in all segments. It is like that for smaller segments not all fields exist. The change addresses that by skipping such doc value producers instead of returning that a field can't be merged using the optimized method.
2025-04-17 09:24:04 +02:00
Nik Everett
814c8c5a6a
Remove unused empty file (#126969)
Not sure how I made it, but surprise.
2025-04-17 17:05:56 +10:00
Nick Tindall
d378185054
Fix GCS tests broken by idempotency token (#126972) 2025-04-17 04:42:32 +02:00
Nick Tindall
270ca0a80a
Add thread pool utilisation metric (#120363)
There are existing metrics for the active number of threads, but it seems tricky to go from those to a "utilisation" number because all the pools have different sizes.

This commit adds `es.thread_pool.{name}.threads.utilization.current` which will be published by all  `TaskExecutionTimeTrackingEsThreadPoolExecutor` thread pools (where `EsExecutors.TaskTrackingConfig#trackExecutionTime` is true).

The metric is a double gauge indicating what fraction (in [0.0, 1.0]) of the maximum possible execution time was utilised over the polling interval.

It's calculated as actualTaskExecutionTime / maximumTaskExecutionTime, so effectively a "mean" value. The metric interval is 60s so brief spikes won't be apparent in the measure, but the initial goal is to use it to detect hot-spotting so the 60s average will probably suffice.

Relates ES-10530
2025-04-17 11:49:30 +10:00
Tim Vernum
e53d3ff64b
Update docs to reflect removal of TLSv1.1 (#126892)
In ES9 and later, we do not enable TLSv1.1 by default,
even if the JDK supports it.

This updates the docs accordingly.

Relates: #121731
2025-04-17 10:15:29 +10:00
Julio
d19b525eb1
Temporarily bypass competitive iteration for filters aggregation (#12… (#126962)
* Temporarily bypass competitive iteration for filters aggregation (#126956)

* Bump versions after 9.0.0 release

* fix merge conflict

* Remove 8.16 from branches.json

* Bring version-bump related changes from main

* [bwc] Add bugfix3 project (#126880)

* Sync version bump changes from main again

---------

Co-authored-by: Benjamin Trent <ben.w.trent@gmail.com>
Co-authored-by: elasticsearchmachine <infra-root+elasticsearchmachine@elastic.co>
Co-authored-by: elasticsearchmachine <58790826+elasticsearchmachine@users.noreply.github.com>
Co-authored-by: Brian Seeders <brian.seeders@elastic.co>
2025-04-16 18:10:01 -06:00
Armin Braun
880aa52e27
Use DelayableWriteable with batched query execution (#126864)
We should use DelayableWriteable here as well just like we do with per-shard results.
The heap savings of making use of this tool are quite significant at times and without
using it we could actually regress in terms of heap use relative to non-batched execution
in corner cases of a low but larger than one number of shards per node.
2025-04-17 01:27:53 +02:00
Brian Seeders
f4fe57516e
Revert "Bump versions after 8.18.0 release"
This reverts commit 74e8946778.
2025-04-16 18:59:02 -04:00
elasticsearchmachine
1c9ff3a728 Mute org.elasticsearch.cli.keystore.AddStringKeyStoreCommandTests testStdinWithMultipleValues #126882 2025-04-17 08:53:07 +10:00
elasticsearchmachine
74e8946778 Bump versions after 8.18.0 release 2025-04-16 21:45:45 +00:00
Brian Seeders
ec7025c2fa
Revert "Bump versions after 8.18.0 release"
This reverts commit 9fe54808c4.
2025-04-16 17:29:37 -04:00
Benjamin Trent
94748dd1a6 Temporarily bypass competitive iteration for filters aggregation (#126956) 2025-04-16 15:16:25 -06:00
elasticsearchmachine
9fe54808c4 Bump versions after 8.18.0 release 2025-04-16 21:11:31 +00:00
Benjamin Trent
b1f766258b
Temporarily bypass competitive iteration for filters aggregation (#126956) 2025-04-16 23:08:17 +02:00
Samiul Monir
2e1101cf5e
Updating text_similarity_reranker documentation (#126175)
* Updating text_similarity_reranker documentation

* Updating docs to include urls

* remove extra THE from the text

---------

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2025-04-16 17:05:30 -04:00
elasticsearchmachine
22adfeb9e1 Bump versions after 8.18.0 release 2025-04-16 20:43:10 +00:00
Parker Timmins
2b2c69a008
Fix reindex yaml test (#126942)
Reindex task may not have completed by time status is called, so remove assertion that relies on this. Following assertions are set in the action which starts task, so will be correct whether or not task has completed.
2025-04-16 15:28:05 -05:00
Brian Seeders
3d78c9428c
[bwc] Add bugfix3 project (#126880) 2025-04-16 16:27:03 -04:00
Ryan Ernst
a813949c34
Fix uniquify to handle multiple successive duplicates (#126889)
CollectionUtils.uniquify is based on C++ std::unique. However, C++
iterators are not quite the same as Java iterators. In particular,
advancing them only allows grabbing the value once. This commit reworks
uniquify to be based on list indices instead of iterators.

closes #126883
2025-04-16 21:00:27 +02:00
Jonathan Buttner
7a0f63c1a0
[ML] Refactor inference request executor to leverage scheduled execution (#126858)
* Using threadpool schedule and fixing tests

* Update docs/changelog/126858.yaml

* Clean up

* change log
2025-04-16 14:14:02 -04:00
Jonathan Buttner
e42c118ec6
[ML] Adding missing onFailure call for Inference API start model request (#126930)
* Adding missing onFailure call

* Update docs/changelog/126930.yaml
2025-04-16 14:07:13 -04:00
Brian Seeders
7d6fda5b06
Allow DRA staging workflow to trigger for 9.0 2025-04-16 12:48:48 -04:00
Nik Everett
128144dd6d
ESQL: Add documents_found and values_loaded (#125631)
This adds `documents_found` and `values_loaded` to the to the ESQL response:
```json
{
  "took" : 194,
  "is_partial" : false,
  "documents_found" : 100000,
  "values_loaded" : 200000,
  "columns" : [
    { "name" : "a", "type" : "long" },
    { "name" : "b", "type" : "long" }
  ],
  "values" : [[10, 1]]
}
```

These are cheap enough to collect that we can do it for every query and
return it with every response. It's small, but it still gives you a
reasonable sense of how much work Elasticsearch had to go through to
perform the query.

I've also added these two fields to the driver profile and task status:
```json
    "drivers" : [
      {
        "description" : "data",
        "cluster_name" : "runTask",
        "node_name" : "runTask-0",
        "start_millis" : 1742923173077,
        "stop_millis" : 1742923173087,
        "took_nanos" : 9557014,
        "cpu_nanos" : 9091340,
        "documents_found" : 5,   <---- THESE
        "values_loaded" : 15,    <---- THESE
        "iterations" : 6,
...
```

These are at a high level and should be easy to reason about. We'd like to
extract this into a "show me how difficult this running query is" API one
day. But today, just plumbing it into the debugging output is good.

Any `Operator` can claim to "find documents" or "load values" by overriding
a method on its `Operator.Status` implementation:
```java
/**
 * The number of documents found by this operator. Most operators
 * don't find documents and will return {@code 0} here.
 */
default long documentsFound() {
    return 0;
}

/**
 * The number of values loaded by this operator. Most operators
 * don't load values and will return {@code 0} here.
 */
default long valuesLoaded() {
    return 0;
}
```

In this PR all of the `LuceneOperator`s declare that each `position` they
emit is a "document found" and the `ValuesSourceValuesSourceReaderOperator`
says each value it makes is a "value loaded". That's pretty pretty much
true. The `LuceneCountOperator` and `LuceneMinMaxOperator` sort of pretend
that the count/min/max that they emit is a "document" - but that's good
enough to give you a sense of what's going on. It's *like* document.
2025-04-16 17:15:25 +02:00
Lorenzo Dematté
115062c643
Fix vec_caps to test for OS support too (on x64) (#126911)
On x64, we are testing if we support vector capabilities (1 = "basic" = AVX2, 2 = "advanced" = AVX-512) in order to enable and choose a native implementation for some vector functions, using CPUID.

However, under some circumstances, this is not sufficient: the OS on which we are running also needs to support AVX/AVX2 etc; basically, it needs to acknowledge it knows about the additional register and that it is able to handle them e.g. in context switches. To do that we need to a) test if the CPU has xsave feature and b) use the xgetbv to test if the OS set it (declaring it supports AVX/AVX2/etc).

In most cases this is not needed, as all modern OSes do that, but for some virtualized situations (hypervisors, emulators, etc.) all the component along the chain must support it, and in some cases this is not a given.

This PR introduces a change to the x64 version of vec_caps to check for OS support too, and a warning on the Java side in case the CPU supports vector capabilities but those are not enabled at OS level.

Tested by passing noxsave to my linux box kernel boot options, and ensuring that the avx flags "disappear" from /proc/cpuinfo, and we fall back to the "no native vector" case.

Fixes #126809
2025-04-16 16:06:46 +02:00
Andrei Dan
e74c237059
Enable online prewarming SPI in integration tests (#126777)
Integration tests use the MockNode. This adds the SPI lookup
when building the MockSearchService. This will enable us to
have the online prewarming implementation avilable in
ESIntegTestCase.
2025-04-16 14:01:36 +01:00
Ioana Tagirta
5a6509a437
Stream result pages from sub plans for FORK (#126705) 2025-04-16 14:57:02 +02:00
Aurélien FOUCRET
e13173c584
[ES|QL] COMPLETION command logical plan optimizer (#126763) 2025-04-16 14:48:02 +02:00
Slobodan Adamović
8c9a0911b1
[Failure Store] Test scroll API (#126197)
Adding basic test coverage for [scroll
API](https://www.elastic.co/guide/en/elasticsearch/reference/current/scroll-api.html).
2025-04-16 22:30:14 +10:00
Slobodan Adamović
ab446b2088
[Failure Store] Test field capabilities API (#126210)
Adds basic coverage for [field capabilities
API](https://www.elastic.co/guide/en/elasticsearch/reference/current/search-field-caps.html).
2025-04-16 22:25:41 +10:00
Luca Cavanna
df83e881f9
Cancel expired async search task when a remote returns its results (#126583)
A while ago we enabled using ccs_minimize_roundtrips in async search.
This makes it possible for users of async search to send a single search
request per remote cluster, and minimize the impact of network latency.

With non minimized roundtrips, we have pretty recurring cancellation checks:
as part of the execution, we detect that a task expired whenever each shard comes
back with its results.

In a scenario where the coord node does not hold data, or only remote data is
targeted by an async search, we have much less chance of detecting cancellation
if roundtrips are minimized. The local coordinator would do nothing other than
waiting for the minimized results from each remote cluster.
One scenario where we can check for cancellation is when each cluster comes
back with its full set of results. This commit adds such check, plus some testing
for async search cancellation with minimized roundtrips.
2025-04-16 14:21:59 +02:00
Niels Bauman
5383f0fcdf
Fix PolicyStepsRegistry cache concurrency issue (#126840)
The following order of events was possible:
- An ILM policy update cleared `cachedSteps`
- ILM retrieves the step definition for an index, this populates `cachedSteps` with the outdated policy
- The updated policy is put in `lifecyclePolicyMap`

Any subsequent cache retrievals will see the old step definition.

By clearing `cachedSteps` _after_ we update `lifecyclePolicyMap`, we
ensure eventual consistency between the policy and the cache.

Fixes #118406
2025-04-16 13:58:12 +02:00
elasticsearchmachine
9a9f827e8a Mute org.elasticsearch.xpack.ml.integration.ClassificationHousePricingIT testFeatureImportanceValues #124341 2025-04-16 21:47:52 +10:00
elasticsearchmachine
e701fce695 Mute org.elasticsearch.index.engine.CompletionStatsCacheTests testCompletionStatsCache #126910 2025-04-16 21:06:00 +10:00
elasticsearchmachine
0a842620b9 Mute org.elasticsearch.repositories.gcs.GoogleCloudStorageBlobStoreRepositoryTests testSnapshotWithLargeSegmentFiles #126909 2025-04-16 20:43:58 +10:00
elasticsearchmachine
9d92cce824 Mute org.elasticsearch.repositories.gcs.GoogleCloudStorageBlobStoreRepositoryTests testWriteFileMultipleOfChunkSize #126908 2025-04-16 20:43:49 +10:00
Liam Thompson
92148cfde3
[DOCS] Update esql-lookup-join.md to mention index mode requirement (#126901)
*  Update esql-lookup-join.md to mention index mode requirement

* fix 8.x page mapping metadata
2025-04-16 12:15:45 +02:00
elasticsearchmachine
e28fca26c5 Mute org.elasticsearch.repositories.gcs.GoogleCloudStorageBlobStoreRepositoryTests testWriteReadLarge #126903 2025-04-16 20:04:49 +10:00
elasticsearchmachine
4e14dd128d Mute org.elasticsearch.repositories.gcs.GoogleCloudStorageBlobStoreRepositoryTests testRequestStats #126902 2025-04-16 20:04:40 +10:00
Carson Ip
5860ccb113
[otel-data] Bump plugin version to release _metric_names_hash changes (#126850)
Bump otel-data plugin version as #120952 missed the bump.
2025-04-16 10:27:19 +01:00
Nick Tindall
17c6e10846
GCS: Use idempotency token to identify requests (#126887) 2025-04-16 15:56:47 +10:00
elasticsearchmachine
85cb5f9a23 Mute org.elasticsearch.xpack.test.rest.XPackRestIT test {p0=ml/inference_crud/Test delete given unused trained model} #126881 2025-04-16 08:03:13 +10:00
elasticsearchmachine
7350e36311 Bump versions after 9.0.0 release 2025-04-15 19:59:51 +00:00
Nik Everett
2e437577d8
ESQL: Create fewer documents in lookup tests (#126874)
This lowers the number of documents used to test lookup because we have
a few failures over the last few months. These are all cases that we
expect to *pass* so fewer documents should make them even more likely to
pass.

Closes #125913 Closes #125779
2025-04-16 05:56:47 +10:00
Paul Tavares
ad0c215369
[Security Solution] Add read index privileges to kibana_system role for Microsoft Defender integration indexes (#126803)
adds read privilege to the kibana_system role for indexes associated with the Microsoft Defender Integrations.
Changes are necessary in order to support Security Solution bi-directional response actions
2025-04-15 15:42:16 -04:00
Ryan Ernst
6174acdc39
Workaround max name limit imposed by Jackson 2.17 (#126806)
In Jackson 2.15 a maximum string length of 50k characters was
introduced. We worked around that by override the length to max int on
all parsers created by xcontent. Jackson 2.17 introduced a similar limit
on field names. This commit mimics the workaround for string length by
overriding the max name length to be unlimited.

relates #58952
2025-04-15 11:40:27 -07:00
Ryan Ernst
bf53927d71
Remove unnecessary network entitlements from server (#126799)
These entitlements should not be necessary. Server does not directly
create any outbound connections, and netty is not a dependency of server
so it should not exist within the server policy.
2025-04-15 11:39:29 -07:00
elasticsearchmachine
d3d40db062 Mute org.elasticsearch.xpack.test.rest.XPackRestIT test {p0=transform/transforms_stats/Test get multiple transform stats where one does not have a task} #126863 2025-04-16 03:55:44 +10:00
Mikhail Berezovskiy
5a7a425bd0
Refactor GCS fixture multipart parser (#125828) 2025-04-15 10:09:53 -07:00
James Baiera
299bf443bb
Support index pattern selector syntax in SQL (#120845)
Updates the SQL grammar to include the selector portion of an index pattern. The 
index() method has been updated to include selectors in the resulting expression.
2025-04-15 13:03:31 -04:00
Liam Thompson
9ca38f93e8
Re-fix elasticsearch highlights for 9.0 (#126859) 2025-04-15 18:38:05 +02:00
Martijn van Groningen
929d79a0f5
Fix DocValuesConsumerUtil (#126836)
The compatibleWithOptimizedMerge() method doesn't handle codec readers that are wrapped by our source pruning filter codec reader.
This change addresses that.

Failing to detect this means that the optimized merge will not kick in.
2025-04-15 18:21:25 +02:00
Nikolaj Volgushev
add0f2449c
[Failure Store] ES|QL security tests (#125586)
Some basic coverage for ES|QL security with failure store access. The
behavior w.r.t. status codes diverges quite a bit between ES|QL and
_search but not in any failure store specific way. ES|QL has the same
authorization behavior when querying multiple data streams without
failure store access in the mix.
2025-04-16 02:15:53 +10:00
Luigi Dell'Aquila
de42ba37e0
ES|QL: fix join masking eval (#126614) 2025-04-15 18:07:05 +02:00
elasticsearchmachine
e030e44881 Prune changelogs after 8.17.5 release 2025-04-15 14:49:20 +00:00
elasticsearchmachine
97651a3960 Bump versions after 8.17.5 release 2025-04-15 14:47:42 +00:00
Simon Cooper
1f249c74eb
Tweak the delta used for vector scorer tests (#126849)
New panama operations in Lucene 10.2 change the results we get from vector operations slightly
2025-04-15 15:46:23 +01:00
Svilen Mihaylov
02f9af732e
Add multi_match function #121525 (#125062)
Implement multi_match function for ESQL. Its currently available on snapshot builds pending refinement of the syntax.
2025-04-15 09:38:08 -04:00
elasticsearchmachine
ac0972bd67 Mute org.elasticsearch.simdvec.VectorScorerFactoryTests testRandomScorerChunkSizeSmall #126847 2025-04-15 23:13:05 +10:00
elasticsearchmachine
f3c4f518e2 [renovate] Update branches config 2025-04-15 22:00:11 +10:00
elasticsearchmachine
02efba5ccf Remove 8.16 from branches.json 2025-04-15 22:00:10 +10:00
David Turner
aa40147142
Add integ tests for ftp:// URL repository (#126757)
We document support for snapshot repositories using `ftp://` URLs but it
seems this functionality has not worked for many years because of
security-manager restrictions, although nobody noticed because it was
not covered by any tests. The migration to the Entitlements framework
means that this functionality now works again, so this commit adds tests
to make sure we do not break it again in future.
2025-04-15 12:57:00 +01:00
Armin Braun
d71ada6e22
Remove needless array indirection in AbstractInternalTerms (#126830)
Obviously just a single count, make it a plain field like the counter next to it.
2025-04-15 13:53:40 +02:00
Moritz Mack
ed7d72ac50
Fix formatting of recently added transport versions using old format (#126826) 2025-04-15 13:40:44 +02:00
Francisco Fernández Castaño
39670d9477
Add IndexingPressureMonitor to monitor large indexing operations (#126372)
Relates ES-11063
2025-04-15 13:23:18 +02:00
Martijn van Groningen
0033de9ab3
Tweak TSDBDocValuesMergeBenchmark (#126825)
to use benchmark mode single shot time.

Which makes more sense for benchmarking force merge. The sample time mode would invoke the benchmark methods many times, which in case of force merge is a noop.
2025-04-15 13:03:01 +02:00
Ioana Tagirta
050ac273a1
Unmute fixed FORK test (#126706) 2025-04-15 12:57:37 +02:00
Lorenzo Dematté
2697a3a872
Patcher for AWS SDKv2 locale-dependent formatting (#126326)
AWS SDK v2 has a bug (aws/aws-sdk-java-v2#5968) where PathResolver uses locale-dependent formatting.

This PR adds a patcher to the discovery-ec2 build process to replace calls to String.format(<format>, <args>) with String.format(Locale.ROOT, <format>, <args>).

Relates to ES-11279
2025-04-15 12:49:56 +02:00
Ievgen Degtiarenko
07cb14e7a9
Expose more detailed profiling information (#126525) 2025-04-15 12:27:31 +02:00
Richard Dennehy
9e3476ef99
permit at+jwt typ header value in jwt access tokens (#126687)
* permit at+jwt typ header value in jwt access tokens

* Update docs/changelog/126687.yaml

* address review comments

* [CI] Auto commit changes from spotless

* update Type Validator tests for parser ignoring case

---------

Co-authored-by: elasticsearchmachine <infra-root+elasticsearchmachine@elastic.co>
2025-04-15 11:08:30 +01:00
Liam Thompson
7de46e9897
[DOCS] Update es-connectors-salesforce.md (#126828)
* [DOCS] Update es-connectors-salesforce.md

9.x equivalent of https://github.com/elastic/elasticsearch/pull/126791

* Reformat known issues section
2025-04-15 11:47:36 +02:00
Aurélien FOUCRET
6702afc96c
[ES|QL] COMPLETION command physical plan (#126766) 2025-04-15 11:43:23 +02:00
Liam Thompson
b326ebb1dd
Fix 8.x page mapping for ES release notes (#126820) 2025-04-15 10:26:29 +02:00
Jan Kuipers
7474849ef2
License check for ES|QL categorize (#126595) 2025-04-15 09:57:20 +02:00
Jim Ferenczi
c906cc005c
Expose model registry to SemanticTextFieldMapper (#126635)
This change integrates the new model registry with the `SemanticTextFieldMapper`, allowing inference IDs to be eagerly resolved at parse time.
It also preserves the existing lenient behavior: no error is thrown if the specified inference id does not exist, only a warning is logged.
2025-04-15 09:45:23 +02:00
Nick Tindall
358b724bd8
Deduplicate monitoring of balancer settings (#126752) 2025-04-15 16:58:27 +10:00
Jim Ferenczi
46c3657255
Fix and unmute SemanticInferenceMetadataFieldsRecoveryTests (#126784)
Use the TranslogOperationAsserter to compare the raw operations.

Closes #124383
Closes #124384
Closes #124385
2025-04-15 08:36:20 +02:00
elasticsearchmachine
9584bb880e Mute org.elasticsearch.search.SearchServiceSingleNodeTests testLookUpSearchContext #126813 2025-04-15 15:35:28 +10:00
elasticsearchmachine
378c276109 Mute org.elasticsearch.search.SearchServiceSingleNodeTests testBeforeShardLockDuringShardCreate #126812 2025-04-15 15:35:20 +10:00
Ignacio Vera
bcee0af23c
Return float[] instead of List<Double> in valueFetcher (#126702)
We are currently having to hold in heap big list of Double objects which can take big amounts of heap. With this change 
we can reduce the heap usage by 7x.
2025-04-15 07:03:55 +02:00
Nick Tindall
dfaf3de96e
Allow float settings to be configured with other settings as default (#126751)
Relates ES-11367
2025-04-15 13:41:01 +10:00
Sam Xiao
718315c5f8
Add unit tests for MountSnapshotStep in COLD phase (#126804) 2025-04-14 18:36:26 -04:00
Ryan Ernst
83ce15ae06
Make TransportRequest an interface (#126733)
In order to support a future TransportRequest variant that accepts the
response type, TransportRequest needs to be an interface. This commit
adds AbstractTransportRequest as a concrete implementation and makes
TransportRequest a simple interface that joints together the parent
interfaces from TransportMessage.

Note that this was done entirely in Intellij using structural find and
replace.
2025-04-14 14:22:28 -07:00
Dan Rubinstein
b917d9a1e0
Revert endpoint creation validation for ELSER and E5 (#126792)
* Revert endpoint creation validation for ELSER and E5

* Update docs/changelog/126792.yaml

* Revert start model deployment being in TransportPutInferenceModelAction

---------

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2025-04-14 17:00:33 -04:00
Mikhail Berezovskiy
f9f3defe92
Release buffers in netty test (#126744) 2025-04-14 13:09:12 -07:00
Ryan Ernst
b47bd3adc7
Use terminal reader in keystore add command (#126729)
When reading a string value from stdin the keystore add command
currently looks directly at stdin. However, stdin may also be consumed
while reading the keystore password. This commit changes the add command
to use the reader from the termainl instead of looking at stdin
directly.

closes #98115
2025-04-14 12:55:56 -07:00
Mike Pellegrini
85713f78e0
Semantic Text Chunking Indexing Pressure (#125517)
We have observed many OOMs due to the memory required to inject chunked inference results for semantic_text fields. This PR uses coordinating indexing pressure to account for this memory usage. When indexing pressure memory usage exceeds the threshold set by indexing_pressure.memory.limit, chunked inference result injection will be suspended to prevent OOMs.
2025-04-14 15:55:37 -04:00
Armin Braun
235867cad9
Avoid walking the complete list of search contexts on shard creation (#123855)
This I found in the many-shards benchmark during some manual testing.
Creating indices slows down measurably when there's concurrent searches
going on. Interestingly enough, the bulk of the cost is coming from this
hook. This makes sense to some extend because the map can quickly grow
to a massive size as it scales as O(shards_searched_on_average *
concurrent_searches) and a CHM generally is anything but cheap to
iterate over.
2025-04-14 21:19:33 +02:00
elasticsearchmachine
ff42cb6b3e Mute org.elasticsearch.simdvec.VectorScorerFactoryTests testRandomScorerMax #126797 2025-04-15 05:09:09 +10:00
Mikhail Berezovskiy
189b81f620
Speed netty tests shutdown (#126734) 2025-04-14 11:49:18 -07:00
Brian Seeders
01a8a9b63b
[docs] Fix 9.0.0 release notes issues 2025-04-14 14:34:31 -04:00
Benjamin Trent
d7a547597e
Fix bbq quantization algorithm but for differently distributed components (#126778)
We had a silly bug in quantizing vectors in bbq where we were scaling
the initial quantile optimization parameters incorrectly given the
vector component distribution. 

In distributions where this has a major impact, the recall results were
abysmal and rendered the quantization technique useless. 

In modern, well distributed components, this change is almost a no-op.
2025-04-15 04:21:51 +10:00
Nik Everett
af686b2606
Reenable test now that this if fixed in 8.x (#126789)
Relates to #126765
2025-04-15 03:43:29 +10:00
Brendan Cully
d02b65308e
S3BlobContainer: Revert broadened exception handler (#126731)
Catching Exception instead of AmazonClientException in copyBlob and
executeMultipart led to failures in S3RepositoryAnalysisRestIT due to
the injected exceptions getting wrapped in IOExceptions that prevented
them from being caught and handled in BlobAnalyzeAction.

Closes #126576
2025-04-14 19:20:11 +02:00
Brendan Cully
2a2491897f
RepositoryAnalysisFailureIT: fix testFailsOnWriteException (#126750)
With the addition of copy coverage in the repository analyzer,
blob count is no longer 1:1 with blob analyzer request count: requests
that create a copy count as two blobs. This can cause
testFailsOnWriteException to sometimes fail, because this test randomly
injects a failure somewhere between the first and blobCounth request,
which may never happen if enough of the requests create copies.

This simple fix is to inject the failure within blobCount/2 requests,
which we will see even if every request generates a copy. An alternative
could be to add a knob to the request to disallow copies and use that
during this test.

Closes #126747
2025-04-14 19:19:34 +02:00
Mary Gouseti
e461717627
Test fix: align timeouts in testDataStreamLifecycleDownsampleRollingRestart (#123769) (#126682)
Recently we changed the implementation of
`testDataStreamLifecycleDownsampleRollingRestart` to use a temporary
state listener. We missed that the listener also had a timeout that was
quite shorter than the `safeGet` timeout we were configuring. In this PR
we align these two timeouts.

Fixes: #123769
2025-04-15 02:53:59 +10:00
Andrei Dan
2f2b9099d8
Add OnlinePrewarming option for cache population reason (#126716) 2025-04-15 02:52:08 +10:00
Jonathan Buttner
31bb3d1619
[ML] Refactoring inference API non-streaming response validation error object check (#126725)
* Refactoring so that non-streaming does not check for error object

* Fixing test
2025-04-14 10:42:40 -04:00
Charlotte Hoblik
8cb449386b
remove redirects.yml (#126774) 2025-04-14 14:10:49 +02:00
Ignacio Vera
ffdfcec334
Upgrade to Lucene 10.2.0 (#126594)
This commit upgrade Elasticsearch to lucene 10.2.0
2025-04-14 13:50:52 +02:00
Mary Gouseti
58a29396a5
Mute test (#126768) 2025-04-14 12:09:24 +03:00
Carlos Delgado
061c8bb8d7
Fix ESQL match test flakiness by using regexes for error messages (#126707) 2025-04-14 10:53:11 +02:00
Kofi B
08beb534ef
[DOCS] Added sort order explanation (#125182)
* Added explanation of sort order and default behavior

* Update docs/reference/elasticsearch/rest-apis/sort-search-results.md

Co-authored-by: Liam Thompson <32779855+leemthompo@users.noreply.github.com>

---------

Co-authored-by: George Wallace <georgewallace@users.noreply.github.com>
Co-authored-by: Liam Thompson <32779855+leemthompo@users.noreply.github.com>
2025-04-14 10:28:03 +02:00
Craig Taverner
ec495e9f0b
Make LOOKUP JOIN docs examples fully tested (#126622)
The current LOOKUP JOIN docs include examples that are not tested by the ES|QL tests, unlike most other examples in the documentation. This PR fixes that, changing two examples to use existing tests, and adding a new csv-spec file for the remaining four examples. These four are not required to show results, so the tests have empty data and do not require any results. This means we are testing only the syntax (parsing and semantic analysis), which is sufficient for the docs.
2025-04-14 09:57:58 +02:00
Jan Kuipers
3f2f5ee158
ES|QL change_point docs and tech preview (#126407)
* ES|QL change point docs

* Move ES|QL change_point to tech preview

* Update docs/reference/query-languages/esql/esql-commands.md

Co-authored-by: Craig Taverner <craig@amanzi.com>

* different example + add it the csv tests

* Restructure change_point docs to new structure

* Added generated test examples to change_point docs

* Fixed a few README.md text mistakes and added more details

* fix grammar

* License check

* regen parser

* Update docs/reference/query-languages/esql/_snippets/commands/layout/change_point.md

Co-authored-by: Craig Taverner <craig@amanzi.com>

---------

Co-authored-by: Craig Taverner <craig@amanzi.com>
2025-04-14 09:56:03 +02:00
elasticsearchmachine
411a946b7f Mute org.elasticsearch.xpack.test.rest.XPackRestIT test {p0=transform/transforms_start_stop/Test start/stop/start continuous transform} #126755 2025-04-14 15:42:42 +10:00
elasticsearchmachine
4ed1a000ab Mute org.elasticsearch.repositories.blobstore.testkit.analyze.RepositoryAnalysisFailureIT testFailsOnWriteException #126747 2025-04-13 07:45:29 +10:00
elasticsearchmachine
31b8e36146 Mute org.elasticsearch.xpack.ilm.TimeSeriesDataStreamsIT testShrinkActionInPolicyWithoutHotPhase #126746 2025-04-13 07:31:26 +10:00
Lisa Cawley
ae33eaabdb
[DOCS] Fix broken images (#126648) 2025-04-11 19:04:08 -07:00
Patrick Doyle
4cbc5eb156
Fix test: set up mocks before starting the service (#126719)
* Change testInvalidJSON to set up mocks before starting the service

* Move another mock setup before the service starts
2025-04-11 15:19:53 -07:00
Mikhail Berezovskiy
c8805b85d2
Add flow-control and remove auto-read in netty4 HTTP pipeline (#126441) 2025-04-11 14:54:22 -07:00
Jack Conradson
c1ecafad6a
Fix painless return type cast for list shortcut (#126724)
This fixes an issue where if a Painless getter method return type
 didn't match a Java getter method return type we add a cast. 
Currentlythis is adding an extraneous cast.

Closes: #70682
2025-04-11 13:50:19 -07:00
Oleksandr Kolomiiets
9d18d5280a
Add block loader from stored field and source for ip field (#126644) 2025-04-11 13:37:15 -07:00
Patrick Doyle
5c5a87aba4
Fix RepositoriesFileSettingsIT to wait for metadataVersion (#126720) 2025-04-11 22:00:27 +02:00
Patrick Doyle
448ca02f85
Unmute FileAccessTreeTests.testDuplicatePrunedPaths (#126717) 2025-04-11 12:13:43 -07:00
Patrick Doyle
e4b7b06d1b
Reword Suppress a Benign Warning section (#126546) 2025-04-11 14:51:34 -04:00
Aurélien FOUCRET
3c29593ef6
[ES|QL] COMPLETION command analysis. (#126677)
* [ES|QL] COMPLETION command analysis.

* Moving prompt type test in postAnalysisVerification

* Test lint.
2025-04-11 19:50:26 +02:00
Nik Everett
55a6624746
ESQL: TO_IP can handle leading zeros (#126532)
Modifies TO_IP so it can handle leading `0`s in ipv4s. Here's how it
works now:
```
ROW ip = TO_IP("192.168.0.1") // OK!
ROW ip = TO_IP("192.168.010.1") // Fails
```

This adds
```
ROW ip = TO_IP("192.168.010.1", {"leading_zeros": "octal"})
ROW ip = TO_IP("192.168.010.1", {"leading_zeros": "decimal"})
```

We do this because there isn't a consensus on how to parse leading zeros
in ipv4s. The standard unix tools like `ping` and `ftp` interpret
leading zeros as octal. Java's built in ip parsing interprets them as
decimal. Because folks are using this for security rules we need to
support all the choices.

Closes #125460
2025-04-11 19:45:14 +02:00
Andrei Dan
fa09255182
Online prewarming service interface docs and usage in SearchService (#126561)
This adds the interface for search online prewarming with a default NOOP
implementation. This also hooks the interface in the SearchService after
we fork the query phase to the search thread pool.
2025-04-11 17:53:50 +01:00
David Turner
800cf72e1f
Use TimeValue for timeouts in safeAwait etc. (#126509)
There's no need to force callers to deconstruct the `TimeValue` in their
possession into a `long` and a `TimeUnit`, we can do it ourselves.
2025-04-12 02:46:28 +10:00
Tanguy Leroux
f57be54001
[CI] Fix IndexShardTests.testReentrantEngineReadLockAcquisitionInRefreshListener (#126685)
I suspect the test resets/closes the reference manager
between the refresh and the retrieval of the segment
generation after the refresh.

By executing segmentGenerationAfterRefresh while
holding the engine reset lock we make sure there
are no concurrent engine resets meanwhile.

In the future, we should also ensure that
IndexShard.refresh() uses withEngine.

Closes #126628
2025-04-11 18:45:18 +02:00
Niels Bauman
507f40cd72
Fix ILMDownsampleDisruptionIT.testILMDownsampleRollingRestart (#126692)
Wait for the index to exist on the master node to ensure all nodes have
the latest cluster state.

Fixes #126495
2025-04-11 17:45:45 +02:00
Jack Conradson
856323594d
Add a custom toString to DynamicMap (#126562)
This change prevents a delegate map from giving an inconsistent 
toString or an empty toString.

Closes #70262
2025-04-11 08:34:48 -07:00
Niels Bauman
ac7eccc1e4
Unmute #126348 (#126690)
This was already fixed by #126501.

Fixes #126348
2025-04-12 01:27:09 +10:00
elasticsearchmachine
e3fd1841f9 Mute org.elasticsearch.repositories.blobstore.testkit.analyze.S3RepositoryAnalysisRestIT testRepositoryAnalysis #126576 2025-04-12 01:22:07 +10:00
Lorenzo Dematté
e4af657c12
Patcher improvements (HDFS) (#126449)
Patchers transform specific classes in some "broken" dependencies to ensure they behave correctly (fixing a bug, disabling some undesired or dangerous behaviour, updating calls to deprecated or removed method overloads).

If we upgrade one of the dependencies we patch, we have a concerns that the patchers may not work against the classes in the new version.
This PR addresses this concern by introducing a check on the SHA256 digest of the class, to ensure we are operating on the same bytes the patcher was designed for; if the digest changes that means the class has been changed (e.g. for a dependency update). If that happens, we break the build process with a specific error, so we can double check that the patchers still work against the new classes.

Extracted from #126326

Relates to ES-11279
2025-04-11 17:20:45 +02:00
David Turner
1461820dac
Fix race condition in RestCancellableNodeClient (#126686)
Today we rely on registering the channel after registering the task to
be cancelled to ensure that the task is cancelled even if the channel is
closed concurrently. However the client may already have processed a
cancellable request on the channel and therefore this mechanism doesn't
work. With this change we make sure not to register another task after
draining the registrations in order to cancel them.

Closes #88201
2025-04-12 00:59:46 +10:00
Bogdan Pintea
9784e0ec5f
ESQL: Split grouping functions based on their EVAL-ability (#126597)
This splits the grouping functions in two: those that can be evaluated independently through the EVAL operator (`BUCKET`) and those that don't (like those that that are evaluated through an agg operator, `CATEGORIZE`).

Closes #124608
2025-04-11 16:19:54 +02:00
Martijn van Groningen
f658af6628
Allow a tsdb data stream to rolled over to a logsdb data stream (#126640)
and the other way around.

This doesn't make much sense. However, if a data stream's index mode differs from the index mode of most recent backing index, then this can cause confusion. Typically, misconfiguration is a reason this can happen.

Related to #126637
2025-04-11 15:59:52 +02:00
Nik Everett
5689dfa9bb
ESQL: Heuristics to pick efficient partitioning (#125739)
Adds heuristics to pick an efficient partitioning strategy based on the
index and rewritten query. This speeds up some queries by throwing more
cores at the problem:
```
FROM test | STATS SUM(b)

Before: took: 31 CPU: 222.3%
 After: took: 15 CPU: 806.9%
```

It also lowers the overhead of simpler queries by throwing less cores at
the problem when it won't really speed anything up:
```
FROM test

Before: took: 1 CPU: 48.5%
 After: took: 1 CPU: 70.4%
```

We have had a `pragma` to control our data partitioning for a long time,
this just looks at the query to pick a partitioning scheme. The
partitioning options:
* `shard`: use one core per shard
* `segment`: use one core per large segment
* `doc`: break each shard into as many segments as there are cores

`doc` is the fastest, but has a lot of overhead, especially for complex
Lucene queries. `segment` is fast, but doesn't make the most out of CPUs
when there are few segments. `shard` has the lowest overhead.

Previously we always used `segment` partitioning because it doesn't have
the terrible overhead but is fast. With this change we use `doc` when
the top level query matches all documents - those have very very low
overhead even in the `doc` partitioning. That's the twice as fast
example above.

This also uses the `shard` partitioning for queries that don't have to
do much work like `FROM foo` or `FROM foo | LIMIT 1` or
`FROM foo | SORT a`. That's the lower CPU example above.

This forking choice is taken very late on the data node. So queries like
this:
```
FROM test | WHERE @timestamp > "2025-01-01T00:00:00Z" | STATS SUM(b)
```
can also use the `doc` partitioning when all documents are after the
timestamp and all documents have `b`.
2025-04-11 09:58:35 -04:00
Ievgen Degtiarenko
b96a2f6c89
Simplify DataNodeRequestSender (#126664) 2025-04-11 15:53:16 +02:00
Colleen McGinnis
24dfda583f
update mapped_pages (#126647) 2025-04-11 08:48:29 -05:00
Ben Chaplin
c11b8f130c
Remove unnecessary request from log tests (#126556) 2025-04-11 09:46:30 -04:00
Fang Xing
e8ffb38d5d
[ES|QL] Retrieve token text only when necessary (#126578)
* retrieve token text only when necessary
2025-04-11 09:40:20 -04:00
kanoshiou
4cc21b6f35
ESQL: Fix NULL handling in IN clause (#125832)
This PR fixes #119950 where an `IN` query includes `NULL` values with non-NULL `DataType` appearing within the query range. An expression is considered `NULL` when its `DataType` is `NULL` or it is a `Literal` with a value of `null`.
2025-04-11 14:58:28 +02:00
Kathleen DeRusso
489a38895e
Update chunking_settings docs for semantic_text (#126634)
* Update chunking_settings docs for semantic_text

* Remove redundancy
2025-04-11 08:55:47 -04:00
Jonathan Buttner
39e594f9b9
[ML] Exposing OpenAI URL field in services API (#126638)
* Adding url configuration field

* Fixing test
2025-04-11 08:26:35 -04:00
Francisco Fernández Castaño
7ad2369f7e
Guard Get operations against Engine resets (#125646)
Closes ES-11324

---------

Co-authored-by: tlrx <tlrx.dev@gmail.com>
2025-04-11 14:19:42 +02:00
Rene Groeschke
31995ace2d
Add docker hub specific docker context (#126625)
The labels we require for openshift are incompatible with docker hub policies. therefore we need to use different docker contexts for those.
2025-04-11 13:30:00 +02:00
Martijn van Groningen
6012590929
Improve resiliency of UpdateTimeSeriesRangeService (#126637)
If updating the `index.time_series.end_time` fails for one data stream,
then UpdateTimeSeriesRangeService should continue updating this setting for other data streams.

The following error was observed in the wild:

```
[2025-04-07T08:50:39,698][WARN ][o.e.d.UpdateTimeSeriesRangeService] [node-01] failed to update tsdb data stream end times
java.lang.IllegalArgumentException: [index.time_series.end_time] requires [index.mode=time_series]
        at org.elasticsearch.index.IndexSettings$1.validate(IndexSettings.java:636) ~[elasticsearch-8.17.3.jar:?]
        at org.elasticsearch.index.IndexSettings$1.validate(IndexSettings.java:619) ~[elasticsearch-8.17.3.jar:?]
        at org.elasticsearch.common.settings.Setting.get(Setting.java:563) ~[elasticsearch-8.17.3.jar:?]
        at org.elasticsearch.common.settings.Setting.get(Setting.java:535) ~[elasticsearch-8.17.3.jar:?]
        at org.elasticsearch.datastreams.UpdateTimeSeriesRangeService.updateTimeSeriesTemporalRange(UpdateTimeSeriesRangeService.java:111) ~[?:?]
        at org.elasticsearch.datastreams.UpdateTimeSeriesRangeService$UpdateTimeSeriesExecutor.execute(UpdateTimeSeriesRangeService.java:210) ~[?:?]
        at org.elasticsearch.cluster.service.MasterService.innerExecuteTasks(MasterService.java:1075) ~[elasticsearch-8.17.3.jar:?]
        at org.elasticsearch.cluster.service.MasterService.executeTasks(MasterService.java:1038) ~[elasticsearch-8.17.3.jar:?]
        at org.elasticsearch.cluster.service.MasterService.executeAndPublishBatch(MasterService.java:245) ~[elasticsearch-8.17.3.jar:?]
        at org.elasticsearch.cluster.service.MasterService$BatchingTaskQueue$Processor.lambda$run$2(MasterService.java:1691) ~[elasticsearch-8.17.3.jar:?]
        at org.elasticsearch.action.ActionListener.run(ActionListener.java:452) ~[elasticsearch-8.17.3.jar:?]
        at org.elasticsearch.cluster.service.MasterService$BatchingTaskQueue$Processor.run(MasterService.java:1688) ~[elasticsearch-8.17.3.jar:?]
        at org.elasticsearch.cluster.service.MasterService$5.lambda$doRun$0(MasterService.java:1283) ~[elasticsearch-8.17.3.jar:?]
        at org.elasticsearch.action.ActionListener.run(ActionListener.java:452) ~[elasticsearch-8.17.3.jar:?]
        at org.elasticsearch.cluster.service.MasterService$5.doRun(MasterService.java:1262) ~[elasticsearch-8.17.3.jar:?]
        at org.elasticsearch.common.util.concurrent.ThreadContext$ContextPreservingAbstractRunnable.doRun(ThreadContext.java:1023) ~[elasticsearch-8.17.3.jar:?]
        at org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:27) ~[elasticsearch-8.17.3.jar:?]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144) ~[?:?]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642) ~[?:?]
        at java.lang.Thread.run(Thread.java:1575) ~[?:?]
```

Which resulted in a situation, that causes the `index.time_series.end_time` index setting not being updated for any data stream. This then caused data loss as metrics couldn't be indexed, because no suitable backing index could be resolved:

```
the document timestamp [2025-03-26T15:26:10.000Z] is outside of ranges of currently writable indices [[2025-01-31T07:22:43.000Z,2025-02-15T07:24:06.000Z][2025-02-15T07:24:06.000Z,2025-03-02T07:34:07.000Z][2025-03-02T07:34:07.000Z,2025-03-10T12:45:37.000Z][2025-03-10T12:45:37.000Z,2025-03-10T14:30:37.000Z][2025-03-10T14:30:37.000Z,2025-03-25T12:50:40.000Z][2025-03-25T12:50:40.000Z,2025-03-25T14:35:40.000Z
```
2025-04-11 12:58:10 +02:00
Liam Thompson
6da2f34f70
Fix issue links in breaking-changes.md (#126675) 2025-04-11 12:55:13 +02:00
Quentin Pradet
1f68bfbc3e
Add back inference.inference API (#126601) 2025-04-11 14:09:51 +04:00
Armin Braun
55453aeef6
Dry up o.e.c.lucene.Lucene transport logic (#126646)
We've accumulated quited a bit of duplication here, drying this logic up a little.
2025-04-11 11:39:53 +02:00
Liam Thompson
ef633d53bd
Add license mention to ESQL categorize (#126666)
* Add license mention to ESQL categorize
exceptional licensing mention in docs
2025-04-11 11:13:12 +02:00
Tim Vernum
a0dd4e76ec
Reduce use of deprecated Metadata builder method (#124290)
This removes all non-test usage of

     Metadata.Builder.put(IndexMetadata.Builder)

And replaces it with appropriate calls to the equivalent method on
`ProjectMetadata.Builder`

In most cases this _does not_ make the code project aware, but does
reduce the number of deprecated methods in use
2025-04-11 18:36:19 +10:00
Armin Braun
788cd26a0f
Fix missing BwC in QuerySearchResult (#126636)
Forgot to update for 8.19.x changes after backporting.

closes #126633
closes #126632
2025-04-11 10:33:17 +02:00
Larisa Motova
1324f82ed2
Update keyword ignore_above documentation for logsdb (#126651)
This commit adds a note that ignore_above has a different limit for
logsdb indices to the documentation.

Related to https://github.com/elastic/docs-content/pull/1092 and
https://github.com/elastic/sdh-elasticsearch/issues/8892
2025-04-10 21:49:47 -10:00
Aurélien FOUCRET
6842203a3c
[ES|QL] COMPLETION command grammar and logical plan (#126319) 2025-04-11 09:20:54 +02:00
Dianna Hohensee
fd0aaebea3
Move REST layer architecture guide write-up (#126643) 2025-04-11 17:18:35 +10:00
Aurélien FOUCRET
c4fa1dcb8f
Fix LTR rescorer with model alias (#126273) 2025-04-11 09:15:47 +02:00
Mary Gouseti
424a2572da
[Failure store] Extend DLM security test to cover failure store (#126543) 2025-04-11 10:12:01 +03:00
Slobodan Adamović
3db258ed14
[Test] Fix testGenerateMultipleCertificateWithNewCA (#126621)
Fixes an edge case where we randomly generate an empty list of key
usages then pass it to `certutil` command.
The empty means just apply the defaults, but we assert based on the
generated empty set.

Resolves https://github.com/elastic/elasticsearch/issues/126471

Co-authored-by: Tim Vernum <tim@adjective.org>
2025-04-11 08:48:48 +02:00
Nhat Nguyen
173904924a
Add avg_over_time (#126572)
This change adds the `avg_over_time` aggregation for time series 
indices. Similar to other time series aggregations, we need to translate
`avg_over_time` into regular aggregations. There are two options for
this translation:

1. Translate `avg_over_time` to `EVAL div(sum_over_time, count_over_time)`, then translate `sum_over_time` and `count_over_time` to `sum` and `count`.
2. Translate `avg_over_time` directly to `avg`, and then to `div(sum, count)`.

This PR chooses the latter approach. Below is an example:

```
TS k8s
| STATS sum(avg_over_time(memory_usage)) BY host, bucket(@timestamp, 1minute)
```

translates to:

```
TS k8s
| STATS avg_memory_usage = avg(memory_usage), host_values=VALUES(host) BY _tsid, time_bucket=bucket(@timestamp, 1minute)
| STATS sum(avg_memory_usage) BY host_values, time_bucket
```

and then:

``` 
TS k8s
| STATS sum_memory_usage = sum(memory_usage), count_memory_usage = count(memory_usage), host_values=VALUES(host) BY _tsid, time_bucket=bucket(@timestamp, 1minute)
| EVAL avg_memory_usage = sum_memory_usage / count_memory_usage
| STATS sum(avg_memory_usage) BY host_values, time_bucket
```

Since we need to substitute `AVG` with `SUM` and `COUNT` after 
translation, we need to call `SubstituteSurrogates` twice in
`LogicalPlanOptimizer`. If there is a performance impact, we can move
this rule to `TranslateTimeSeriesAggregate`.
2025-04-10 20:38:38 -07:00
Armin Braun
dd1db5031e
Move calls to FeatureFlag.enabled to class-load time (#125885)
I noticed that we tend to create the flag instance and call this method
everywhere. This doesn't compile the same way as a real boolean constant
unless you're running with `-XX:+TrustFinalNonStaticFields`.
For most of the code spots changed here that's irrelevant but at least
the usage in the mapper parsing code is a little hot and gets a small
speedup from this potentially.
Also we're simply wasting some bytes for the static footprint of ES by
using the `FeatureFlag` indirection instead of just a boolean.
2025-04-11 01:46:28 +02:00
elasticsearchmachine
b3e500f572 Mute org.elasticsearch.xpack.esql.action.EsqlActionIT testQueryOnEmptyDataIndex #126580 2025-04-11 07:44:14 +10:00
David Turner
b10b35fccd
Fix S3RepositoryAnalysisRestIT (#126593)
- Translate a 404 during a multipart copy into a `FileNotFoundException`

- Use multiple threads in `S3HttpHandler` to avoid `CopyObject`/`PutObject` deadlock

Closes #126576
2025-04-11 05:41:20 +10:00
Mary Gouseti
78ac5d58ef
[Failure store] Support failure store for system data streams (#126585)
In this PR we add support for the failure store for system data streams.
Specifically:

- We pass the system descriptor so the failure index can be created based on that.
- We extend the tests to ensure it works
- We remove a guard we had but I wasn't able to test it because it only gets triggered if the data stream gets created right after a failure in the ingest pipeline, and I didn't see how to add one (yet).
- We extend the system data stream migration to ensure this is also working.
2025-04-11 05:14:11 +10:00
elasticsearchmachine
a73f9238ea Mute org.elasticsearch.upgrades.SearchStatesIT testCanMatch #126633 2025-04-11 04:16:50 +10:00
elasticsearchmachine
4eace87721 Mute org.elasticsearch.upgrades.SearchStatesIT testBWCSearchStates #126632 2025-04-11 04:16:40 +10:00
Mike Pellegrini
9956bedb52
Update TestSparseInferenceServiceExtension to not support text embeddings (#126618) 2025-04-10 14:08:17 -04:00
Ioana Tagirta
9f2f4f2e8e
Add friendly error message when using more than one FORK (#126599) 2025-04-10 19:20:02 +02:00
elasticsearchmachine
94e8eb008c Mute org.elasticsearch.index.shard.IndexShardTests testReentrantEngineReadLockAcquisitionInRefreshListener #126628 2025-04-11 03:16:06 +10:00
Lisa Cawley
627e3099f6
[DOCS] Add node specifications to API conventions (#126571)
Co-authored-by: shainaraskas <58563081+shainaraskas@users.noreply.github.com>
2025-04-10 19:08:40 +02:00
Lisa Cawley
6c4a230858
[DOCS] Add ranking evaluation API examples (#126577) 2025-04-10 09:50:15 -07:00
Jack Conradson
d081100887
Remove extraneous doc id method (#126570)
Removes docId. We can use _getDocId instead of docId instead. They are identical.
2025-04-10 08:38:42 -07:00
Rene Groeschke
ca195736ca
Address review feedback on es default docker image (#126330)
This addresses feedback we got for our default image at https://github.com/docker-library/official-images/pull/18692
This also introduces separate docker source files to make maintaining those easier.

We cannot take over all suggested changes as we require certain settings to have our packaging tests pass as expected.
2025-04-10 17:14:22 +02:00
Bogdan Pintea
7fdf9c156c
ESQL: optimise ProjectAwayColumns handling of AttrSet/Map (#126610)
Currently, each plan node iterration in ProjectAwayColumns creates 3
AttributeSet/Map_s. This can be dropped to just one by using builders.

Related: #124395
2025-04-10 17:11:23 +02:00
Nik Everett
afe97af593
ESQL: Count took times (#126547)
Build a little histogram of the `took` times of ESQL queries in a
cluster. Graphing this can tell you how much ESQL is in use. Especially
for heavy or light things.
2025-04-10 11:06:55 -04:00
Bogdan Pintea
75f54a40cb
ESQL: stabilise one FORK test (#126604)
Add sorting on a MV result set in ForkIT#testWithStatsSimple
2025-04-10 16:49:58 +02:00
Niels Bauman
3231eb2926
Fix equality bug in WaitForIndexColorStep (#126605)
The `indexNameSupplier` was included in the equality and is of type
`BiFunction`, which doesn't implement a proper `equals` method by
default - and thus neither do the lambdas. This meant that two instances
of this step would only be considered equal if they were the same
instance. By excluding `indexNameSupplier` from the `equals` method, we
ensure the method works as intended and is able to properly tell the
equality between two instances.

As a side effect, we expect/hope this change will fix a number of tests
that were failing because `WaitForIndexColorStep` missed the last
cluster state update in the test, causing ILM to get stuck and the test
to time out.

Fixes #125683
Fixes #125789
Fixes #125867
Fixes #125911
Fixes #126053
Fixes #126354
2025-04-10 16:35:32 +02:00
Craig Taverner
67b15ad5d8
Split ES|QL functions/operators/commands into separate pages for similar functions and make commands examples generated (#126279)
While the internal structure of the docs is already split into many (over 1000) sub-pages, the final display for the `Functions and Operators` page is a single giant page, making navigation harder. This PR splits it into separate pages, one for each group of similar functions and one for the operators. Twelve new pages.

This PR also bundles a few other related changes. In total what is done is:
* Split functions/operators into 12 pages, one for each group, maintaining the existing split of each function/operator into a snippet with dynamically generated examples
* Split esql-commands.md into source-commands.md and processing-commands.md, each of which is split into individual snippets, one for each command
* Each command snippet has it's examples split out into separate files, if they were examples that were dynamically generated in the older asciidoc system
* The examples files are overwritten by the ES|QL unit tests, using a similar mechanism to the examples written for functions and operators)
* Some additional refinements to the Kibana definition and markdown files (nicer operator headings, and display text)
2025-04-10 15:56:05 +02:00
elasticsearchmachine
f7c86b7361 Mute org.elasticsearch.xpack.esql.action.ForkIT testWithStatsSimple #126607 2025-04-10 23:38:39 +10:00
Charlotte Hoblik
e9d3328903
[DOCS]: Move ES connectors Known issues page in 9.0+ (#126600)
* add known issues page to es connectors

* update known issues

* Update docs/reference/search-connectors/es-connectors-known-issues.md

Co-authored-by: Liam Thompson <32779855+leemthompo@users.noreply.github.com>

* Update docs/reference/search-connectors/es-connectors-known-issues.md

Co-authored-by: Liam Thompson <32779855+leemthompo@users.noreply.github.com>

---------

Co-authored-by: Liam Thompson <32779855+leemthompo@users.noreply.github.com>
2025-04-10 15:26:20 +02:00
Tanguy Leroux
591fa87e43
Revive read/write engine lock to guard operations against resets (#126311)
This change re-introduces the engine read/write lock to guard against engine resets.

It differs from #124635 on the following:
    uses the engineMutex for creating/closing engines
    uses the reentrant r/w lock for retaining engine instances and for resetting the engine
    acquires the reentrant read lock during refreshes to prevent deadlocks during resets
    add tests to ensure no deadlock when re-acquiring read lock in refresh listeners

Relates ES-11447
2025-04-10 13:37:48 +02:00
Charlotte Hoblik
edfb17e16e
[DOCS]: Update 9.0.0 Release notes wording (#126589)
* update release notes wording

* Update docs/release-notes/index.md

Co-authored-by: Liam Thompson <32779855+leemthompo@users.noreply.github.com>

---------

Co-authored-by: Liam Thompson <32779855+leemthompo@users.noreply.github.com>
2025-04-10 12:19:43 +02:00
Ioana Tagirta
9b6ce86657
FORK - allow EVAL/DISSECT/STATS in branches (#125937) 2025-04-10 11:44:42 +02:00
Luigi Dell'Aquila
4fe2fb52af
ES|QL: one more fix to generative tests (#126586) 2025-04-10 11:37:44 +02:00
David Turner
9e0d885702
Reduce assertBusy usage in testMultipleNodes (#126582)
Relates #126501
2025-04-10 18:28:36 +10:00
Luca Cavanna
0c95d1a48e
Filter out empty top docs results before merging (#126385)
`Lucene.EMPTY_TOP_DOCS` to identify empty to docs results. These were previously
null results, but did not need to be send over transport as incremental reduction
was performed only on the data node.

Now it can happen that the coord node received a merge result with empty top docs,
which has nothing interesting for merging, but that can lead to an exception because
the type of the empty array does not match the type of other shards results, for
instance if the query was sorted by field. To resolve this, we filter out empty
top docs results before merging.

Closes #126118
2025-04-10 10:03:10 +02:00
Yang Wang
62636f958b
Replace assertBusy of indexExists (#126501)
Relates:
https://github.com/elastic/elasticsearch/pull/126437#pullrequestreview-2748766613
2025-04-10 10:56:52 +10:00
elasticsearchmachine
4ea4a298a4 Mute org.elasticsearch.repositories.blobstore.testkit.analyze.S3RepositoryAnalysisRestIT testRepositoryAnalysis #126576 2025-04-10 09:28:24 +10:00
elasticsearchmachine
90f8b87a2e Mute org.elasticsearch.xpack.esql.qa.single_node.GenerativeIT test #126573 2025-04-10 09:21:33 +10:00
Nik Everett
599be802ca
ESQL: Fix bug in octal ip parsing tests (#126552)
This fixes a bug in the tests for parsing ipv4 addresses with leading
zeros as octal numbers. The bug was in the expectation code that we use
for random input ips.

Closes #126496
2025-04-10 09:20:34 +10:00
Nhat Nguyen
c888b2cc6b
Add max_over_time aggregation for TSDB (#126498)
This change adds support for the `max_over_time` aggregation for 
time_series indices. Similar to the `rate` aggregation, this aggregation
is translated into two stages: the first stage groups by `_tsid` (and
time-bucket), and the second stage groups by the user-specified groups.

For example:

```
TS my-metrics
| STATS SUM(max_over_time(memory_usage)) BY cluster, bucket(@timestamp, 1 minute)
```

is translated into:

```
TS my-metrics
| STATS max_memory_usage=max(memory_usage), cluster=VALUES(cluster) BY _tsid, ts=bucket(@timestamp, 1 minute)
| STATS sum(max_memory_usage) BY cluster, ts
```

In this case, we don't need to keep the Lucene source emitted in the 
order of _tsid/timestamp, but I leave this optimization for the future.

Other `{agg}_over_time` functions will be added later.
2025-04-09 16:01:39 -07:00
elasticsearchmachine
f07d943011 Mute org.elasticsearch.repositories.blobstore.testkit.rest.SnapshotRepoTestKitClientYamlTestSuiteIT test {p0=/10_analyze/Analysis without details} #126569 2025-04-10 08:02:13 +10:00
Jack Conradson
3d54cc3e52
Add leniency to missing array values in mustache (#126550)
In mustache, this change returns null values which convert to empty strings 
instead of throwing an exception when users have a template with 
something like a.8 where the index 8 is out of bounds. This matches the 
behavior for non-existent keys like a.d.

Closes #55200
2025-04-09 14:51:26 -07:00
elasticsearchmachine
31e5678c40 Mute org.elasticsearch.xpack.test.rest.XPackRestIT test {p0=transform/transforms_stats/Test get single transform stats when it does not have a task} #126568 2025-04-10 07:47:16 +10:00
elasticsearchmachine
10122c7cf3 Mute org.elasticsearch.xpack.test.rest.XPackRestIT test {p0=transform/transforms_stats/Test get multiple transform stats} #126567 2025-04-10 07:42:04 +10:00
Jason-Whitmore
36280d2630
Fixing ModelLoaderUtils.split() to pass tests (#126009)
Prior to these changes, the split method would fail tests. Additionally,
the method had code which could be refactored.

A new variable (numRanges) was introduced to replace the direct usage of numStreams.
The method was refactored to make the code easier to understand. Javadocs were updated.
Tests for this method now pass.
2025-04-09 15:37:15 -04:00
Pat Whelan
6c6500ec3b
[ML] Bedrock Cohere Task Settings Support (#126493)
Add support for Cohere Task Settings and Truncate, through
the Amazon Bedrock provider integration.

Task Settings can now be passed bother during Inference endpoint
creation and Inference POST requests.

Close #126156
2025-04-09 21:34:05 +02:00
James Baiera
6d86b202ea
Restrict failure stores from replicating via CCR (#126355)
Checks to see if an index belongs to a data stream's failure store before following it. If the index is a 
failure index, the follow operation is rejected. Also updates the logic in the auto follower API's to 
exclude failure indices on data streams from being followed if their parent data stream matches the 
follow pattern.
2025-04-09 14:52:25 -04:00
Colleen McGinnis
1b021c58df
fix cross-repo link syntax (#126554) 2025-04-09 14:46:19 -04:00
Slobodan Adamović
d12eb8d5ce
[Failure Store] Test API keys and skip_unavailable with RCS1 (#125782)
Adjust existing RCS1 tests to randomize using API keys for authorization
and `skip_unavailable` setting.

Followup on #125252
2025-04-09 20:28:54 +02:00
Brendan Cully
c1a71ff45c
BlobContainer: add copyBlob method (#125737)
* BlobContainer: add copyBlob method

If a container implements copyBlob, then the copy is
performed by the store, without client-side IO. If the store
does not provide a copy operation then the default implementation
throws UnsupportedOperationException.

This change provides implementations for the FS and S3 blob containers.
More will follow.

Co-authored-by: elasticsearchmachine <infra-root+elasticsearchmachine@elastic.co>
Co-authored-by: David Turner <david.turner@elastic.co>
2025-04-09 10:33:01 -07:00
Dan Rubinstein
44507cce04
Fix ELAND endpoints not updating dimensions (#126537)
* Fix ELAND endpoints not updating dimensions

* Update docs/changelog/126537.yaml
2025-04-09 12:16:06 -04:00
Luke Whiting
7d7fa766c5
Batch ILM policy cluster state updates [#122917] (#126529)
* Use a task queue to ensure ILM policy change cluster state updates are batched

* Update docs/changelog/126529.yaml

* Update docs/changelog/126529.yaml

* Switch to using SimpleBatchedAckListenerTaskExecutor

* Get timeout from request

* Ditch the try-catch
2025-04-09 17:09:24 +01:00
Nhat Nguyen
7c77ead209
Remove time unit from rate aggregation (#126497)
Currently, the rate aggregation accepts two parameters: the first 
specifies the counter field, and the second specifies the time unit of 
the rate. The time unit parameter was introduced to conveniently compute 
requests per minute or per hour. However, this can be replaced easily -
for example, rate(field, 1minute) with 60 * rate(field).

This change removes the time unit parameter and reserves it for 
potential future usage, such as introducing a sliding window unit. If we 
decide on other options later, we can reintroduce it. Removing it now
avoids breaking changes while the rate aggregation is not yet available.
2025-04-09 07:49:31 -07:00
Ryan Ernst
2986d738c6
Simplify entitlement rest test discovery (#125449)
This commit cleans up how entitlement test methods are discovered. It
also adds another robustness check to ensure an annotation doesn't exist
on a private method.
2025-04-09 07:24:17 -07:00
Ryan Ernst
3bac50e818
Use logs dir as working directory (#124966)
In the unexpected case that Elasticsearch dies due to a segfault or
other similar native issue, a core dump is useful in diagnosing the
problem. Yet core dumps are written to the working directory, which is
read-only for most installations of Elasticsearch. This commit changes
the working directory to the logs dir which should always be writeable.
2025-04-09 07:07:11 -07:00
Mayya Sharipova
d82886fc52
Enable sort optimization on float and half_float (#126342)
Before we enabled sort optimization on long, double and date types,
but left other types for follow-up.

This enables sort optimization on float and half_float types.

Optimizations on INT, BYTE, SHORT are left for follow-up,
because they need more work: we currently use SORT.LONG
type for all integer types and this doesn't allow to use
optimization.
2025-04-09 09:07:35 -04:00
Aurélien FOUCRET
20ae83f603
[ES|QL] Rerank command: unmute reranker tests in multi-node. (#126521) 2025-04-09 13:30:22 +02:00
Iván Cea Fontenla
90dcccfc96
ESQL: Updated RENAME docs with the behaviour of multiple column renames (#126462)
* ESQL: Updated RENAME docs with the behaviour of multiple column renames

* Added rename example to csv-spec
2025-04-09 12:39:10 +02:00
Luigi Dell'Aquila
41297680c7
ES|QL: generative tests - fix identifiers generation and source field mapping (#126514) 2025-04-09 12:25:09 +02:00
Lorenzo Dematté
b692d1a14e
Add support for a custom transport version check predicate in ElasticsearchException (#126272)
Today when we are adding a ElasticsearchException, we specify a versionAdded TransportVersion (the transport version from which we support it); this version is checked by the isRegistered method:

return version.onOrAfter(elasticsearchExceptionHandle.versionAdded);

This does not play well with backports; when we add a patch version for a backport, normally the procedure would be to change the code above take also the patch into account, like:

version.orOnAfter(versionAdded) || version.isPatchFrom(versionPatched)

This PR updates ElasticsearchException to have more than just "version added", so that we can do patches as described above.
2025-04-09 11:44:39 +02:00
Aurélien FOUCRET
26ae289648
Fix reranker tests (#126500) 2025-04-09 11:20:50 +02:00
Armin Braun
595ba6bb68
Remove some redundant ref-counting from SearchHits (#124948)
Remove ref-counting that is obviously redundant because of clear
ownership transfers from `SearchHits`.
2025-04-09 11:06:48 +02:00
Josh Mock
5f871c5cf5
Remove reference to dropped EIS API (#126422)
Co-authored-by: Quentin Pradet <quentin.pradet@elastic.co>
2025-04-09 12:06:00 +04:00
Johannes Fredén
e22fff9d81
Unmute testWatcherWithApiKey (#126502)
Resolves: https://github.com/elastic/elasticsearch/issues/124159
2025-04-09 18:01:03 +10:00
elasticsearchmachine
e090e475c0 Mute org.elasticsearch.smoketest.MlWithSecurityIT test {yaml=ml/get_trained_model_stats/Test get stats given trained models} #126510 2025-04-09 17:43:14 +10:00
Ievgen Degtiarenko
e95397c829
Speedup equals (#126394) 2025-04-09 09:36:47 +02:00
Mariusz Józala
afe503f02f
[CI] Use official UBI9 image for testing (#126455)
Internal UBI images from `docker.elastic.co` are planned to be removed.
2025-04-09 09:05:26 +02:00
Martijn van Groningen
065c5830cb
First step optimizing tsdb doc values codec merging. (#125403)
The doc values codec iterates a few times over the doc value instance that needs to be written to disk. In case when merging and index sorting is enabled, this is much more expensive, as each time the doc values instance is iterated a merge sorting is performed (in order to get the doc ids of new segment in order of index sorting).

There are several reasons why the doc value instance is iterated multiple times:
* To compute stats (num values, number of docs with value) required for writing values to disk.
* To write bitset that indicate which documents have a value. (indexed disi, jump table)
* To write the actual values to disk.
* To write the addresses to disk (in case docs have multiple values)

This applies for numeric doc values, but also for the ordinals of sorted (set) doc values.

This PR addresses solving the first reason why doc value instance needs to be iterated. This is done only when in case of merging and when the segments to be merged with are also of type es87 doc values, codec version is the same and there are no deletes. Note this optimized merged is behind a feature flag for now.
2025-04-09 07:50:16 +02:00
Yang Wang
4f9bfb0a3c
[Test] More reliable wait for index to appear (#126437)
Relates: #125652 Resolves: #126204
2025-04-09 14:31:01 +10:00
David Kyle
d2be03c946
[ML] Move Inference Service request and response classes into service package (#126482) 2025-04-08 23:26:25 +02:00
elasticsearchmachine
ebaa807363 Mute org.elasticsearch.xpack.search.AsyncSearchErrorTraceIT testDataNodeLogsStackTraceWhenErrorTraceFalseOrEmpty #126357 2025-04-09 07:21:55 +10:00
elasticsearchmachine
81c544cae9 Mute org.elasticsearch.xpack.downsample.ILMDownsampleDisruptionIT testILMDownsampleRollingRestart #126495 2025-04-09 07:19:01 +10:00
Gal Lalouche
953b9fbb83
ESQL: List/get query API (#124832)
This PR adds two new REST endpoints, for listing queries and getting information on a current query.

* Resolves #124827 
* Related to #124828 (initial work)

Changes from the API specified in the above issues:
* The get API is pretty initial, as we don't have a way of fetching the memory used or number of rows processed.

List queries response:
```
GET /_query/queries
// returns for each of the running queries
// query_id, start_time, running_time, query

{ "queries" : {
 "abc": {
  "id": "abc",
  "start_time_millis": 14585858875292,
  "running_time_nanos": 762794,
  "query": "FROM logs* | STATS BY hostname"
  },
 "4321": {
  "id":"4321",
  "start_time_millis": 14585858823573,
  "running_time_nanos": 90231,
  "query": "FROM orders | LOOKUP country_code ON country"
  }
 } 
}
```

Get query response:
```
GET /_query/queries/abc

{
 "id" : "abc",
  "start_time_millis": 14585858875292,
  "running_time_nanos": 762794,
  "query": "FROM logs* | STATS BY hostname"
  "coordinating_node": "oTUltX4IQMOUUVeiohTt8A"
  "data_nodes" : [ "DwrYwfytxthse49X4", "i5msnbUyWlpe86e7"]
}
```
2025-04-08 22:21:32 +03:00
Stanislav Malyshev
b21e3253a8
Refactor remote cluster handling in Analyzer (#126426)
* Refactor remote cluster handling in Analyzer

- Initialize clusters earlier
- Simplify cluster set calculation
- No need to keep separate skipped list for enrich resolution
2025-04-08 13:20:33 -06:00
Alexey Ivanov
ecf9adfc78
[main] System data streams are not being upgraded in the feature migration API (#126409)
This commit adds support for system data streams reindexing. The system data stream migration extends the existing system indices migration task and uses the data stream reindex API.
The system index migration task starts a reindex data stream task and tracks its status every second. Only one system index or system data stream is migrated at a time. If a data stream migration fails, the entire system index migration task will also fail.

Port of #123926
2025-04-08 20:42:58 +02:00
Patrick Doyle
728eb7504f
Fix inference plugin name in entitlements warning suppression (#126470) 2025-04-08 13:58:01 -04:00
David Turner
aab40b1247
Introduce TestBlobContainerBuilder (#126445)
The mostly-optional parameters to `createBlobContainer` are getting
rather numerous in this test harness which makes the tests hard to read.
This commit introduces a builder to help name the provided parameters
and skip the omitted ones.
2025-04-09 01:52:16 +10:00
Joe Gallo
450516d675
Fix a RemoveProcessor test that never ran (#126464) 2025-04-08 11:21:04 -04:00
Alexander Spies
ffd491364c
ESQL: Fix usage of already released null block in ValueSourceReaderOperator (#126411)
* Add yaml test with reproducer
* Fix the bug
* Make ComputeBlockLoaderFactory Releasable
2025-04-08 17:17:57 +02:00
Nhat Nguyen
c1a30659c5
Select time-series indices with TS command (#126436)
With this change, the TS command will target only time_series indexes.
2025-04-08 08:16:14 -07:00
David Turner
94c385d067
Run newShardSnapshotTask tasks concurrently (#126452)
In #88707 we changed the behaviour here to run the shard-snapshot
initialization tasks all in sequence. Yet these tasks do nontrivial work
since they may flush to acquire the relevant index commit, so with this
commit we go back to distributing them across the `SNAPSHOT` pool again.
2025-04-09 01:10:11 +10:00
elasticsearchmachine
2c0b71f99d Mute org.elasticsearch.xpack.security.cli.HttpCertificateCommandTests testGenerateMultipleCertificateWithNewCA #126471 2025-04-09 00:46:21 +10:00
elasticsearchmachine
b83a86e070 Mute org.elasticsearch.xpack.test.rest.XPackRestIT test {p0=transform/transforms_start_stop/Test start/stop only starts/stops specified transform} #126466 2025-04-09 00:07:26 +10:00
Dianna Hohensee
4b2867a0ef
Support maxConnections override in AbstractBlobContainerRetriesTestCase tests (#126435) 2025-04-08 09:55:01 -04:00
Dan Rubinstein
20f6a2a76b
Adding endpoint creation validation to ElasticsearchInternalService (#123044)
* Adding validation to ElasticsearchInternalService

* Update docs/changelog/123044.yaml

* [CI] Auto commit changes from spotless

* Removing checkModelConfig

* Fixing IT

* [CI] Auto commit changes from spotless

* Remove DeepSeek checkModelConfig and fix tests

* Cleaning up comments, updating validation input type, and moving model deployment starting to model validator

---------

Co-authored-by: elasticsearchmachine <infra-root+elasticsearchmachine@elastic.co>
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2025-04-08 09:53:31 -04:00
Mary Gouseti
060a9b746a
[DLM]Use default lifecycle instance instead of default constructor (#126461)
When creating the an empty lifecycle we used to use the default
constructor. This is not just for efficiency but it will allow us to
separate the default data and failures lifecycle in the future.
2025-04-08 23:37:30 +10:00
elasticsearchmachine
e27bffbc41 Mute org.elasticsearch.ingest.geoip.EnterpriseGeoIpDownloaderIT testEnterpriseDownloaderTask #126124 2025-04-08 23:26:59 +10:00
Pete Gillin
f9b29efc24
Multi-project for TransportExlainLifecycleAction (#126414)
This converts this class to support multi-project.

There is a drive-by refactoring to split multiple independent tests in one method into separate methods. (Look at this change with whitespace changes hidden to see the 'real' change.)
2025-04-08 14:23:35 +01:00
Rene Groeschke
6e4cb8142b
Add initial esql test benchmark tests (#126224)
* Add initial esql test benchmark tests
* Fix build-benchmark pipeline
* Update gredle profiler
2025-04-08 13:28:34 +02:00
Richard Dennehy
ceaa01a538
Add Issuer to failed SAML Signature validation logs when available (#126310)
* Add Issuer to failed SAML Signature validation logs when available

* [CI] Auto commit changes from spotless

* Fix tests

* Update docs/changelog/126310.yaml

* address review comments

* replace String.format call

* update formatIssuer to describeIssuer

* [CI] Auto commit changes from spotless

* truncate long issuers in log messages

* [CI] Auto commit changes from spotless

* handle null issuer value

* address review comments

---------

Co-authored-by: elasticsearchmachine <infra-root+elasticsearchmachine@elastic.co>
2025-04-08 10:50:45 +01:00
Luca Cavanna
a6ffeeeb71
Remove outdated TODO from TopDocsAndMaxScore (#126386)
There are no plans to remove max_score, as highlighted in #32981 .
This commit removes a related TODO given we don't plan on addressing it.
2025-04-08 10:41:38 +02:00
Luigi Dell'Aquila
262a793329
Re-enable generative tests (#126421) 2025-04-08 10:21:36 +02:00
Ievgen Degtiarenko
c2d0c59b7a
Pre-size collections (#126382) 2025-04-08 10:01:21 +02:00
Slobodan Adamović
284121ad9f
Set keyUsage for generated HTTP certificates and self-signed CA (#126376)
The `elasticsearch-certutil http` command, and security auto-configuration, 
generate the HTTP certificate and CA without setting the `keyUsage` extension.

This PR fixes this by setting (by default):
- `keyCertSign` and `cRLSign` for self-signed CAs 
- `digitalSignature` and `keyEncipherment` for HTTP certificates and CSRs

These defaults can be overridden when running `elasticsearch-certutil http` 
command. The user will be prompted to change them as they wish.

For `elasticsearch-certutil ca`, the default value can be overridden by passing 
the `--keysage` option, e.g.
```
elasticsearch-certutil ca --keyusage "digitalSignature,keyCertSign,cRLSign" -pem    
```

Fixes #117769
2025-04-08 09:44:09 +02:00
Ignacio Vera
47e352fda0
Throw nicer exception in SpanBooleanQueryRewriteWithMaxClause (#126387)
Throw an ElasticsearchStatusException with a RestStatus.BAD_REQUEST code instead of a generic RuntimeException.
2025-04-08 06:42:00 +02:00
Yang Wang
997a7b8fab
FileWatchingService should not throw for missing file (#126264)
Missing file is a valid state for FileWatchingService so that the
exception should be suppressed.
2025-04-08 09:56:35 +10:00
Ryan Ernst
991e80d56e
Remove unnecessary generic params from action classes (#126364)
Transport actions have associated request and response classes. However,
the base type restrictions are not necessary to duplicate when creating
a map of transport actions. Relatedly, the ActionHandler class doesn't
actually need strongly typed action type and classes since they are lost
when shoved into the node client map. This commit removes these type
restrictions and generic parameters.
2025-04-07 16:22:56 -07:00
elasticsearchmachine
9feac7833e Mute org.elasticsearch.smoketest.MlWithSecurityIT test {yaml=ml/trained_model_cat_apis/Test cat trained models} #125750 2025-04-08 07:45:47 +10:00
Nhat Nguyen
6c641c0677
Extrapolate rate aggregation (#126331)
This change performs extrapolation for rate aggregation similarly
to how PromQL does.
2025-04-07 14:31:57 -07:00
Kaarina Tungseth
e3e03bc28b
Removes known issues page content (#126429)
* Removes known issues page

* Adds empty known issues page
2025-04-07 15:58:52 -05:00
David Turner
cedcb5ccfe
Replace TransportResponse.Empty with ActionResponse.Empty (#126400)
No need to distinguish these things any more, we can just use
`ActionResponse.Empty` everywhere.
2025-04-08 06:58:06 +10:00
Joe Gallo
bead858ccd
Correctly handle nulls in nested paths in the remove processor (#126417) 2025-04-07 16:54:07 -04:00
Jeremy Dahlgren
79297438ed
Avoid extra allocations in RestGetAliasesAction (#126177)
When no explicit aliases are provided in the call there is no need
to collect the index names or aliases into HashSets if they won't be
used. Also fixed where the index name was being added for each
loop of the alias list.
2025-04-07 15:02:05 -04:00
Brian Seeders
5888e903e4
[docs] Re-generate and fix 9.0.0 release notes in markdown (#126425) 2025-04-07 14:17:06 -04:00
David Turner
f6c1965101
Forward port changes from backport of #125562 (#126413)
The backport to `8.x` needed some changes to pass through CI; this
commit forward-ports the relevant bits of those changes back into `main`
to keep the branches aligned.
2025-04-07 19:05:06 +01:00
David Turner
fbbbdd7eec
Allow overriding blob container path in tests (#126391)
Some `AbstractBlobContainerRetriesTestCase#createBlobContainer`
implementations choose a path for the container randomly, but we have a
need for a test which re-creates the same container against a different
`S3Service` and `BlobStore` and must therefore specify the same path
each time. This commit exposes a parameter that lets callers specify a
container path.
2025-04-08 03:54:37 +10:00
David Turner
5dc7ab77b3
Remove usages of TransportMessage (#126375)
This base class is kinda pointless: everywhere it's used we can either
be more specific (e.g. choosing between `TransportRequest` or
`TransportResponse`) or more general (e.g. choosing `Writeable`). This
commit removes all the usages apart from the `extends` clauses of its
direct descendants.
2025-04-08 03:50:28 +10:00
István Zoltán Szabó
212971a435
[DOCS] Adds ML-CPP release notes. (#126420) 2025-04-07 19:15:20 +02:00
Nhat Nguyen
894d92af85
Skip rerank tests in mixed clusters (#126415)
If the clusters don't support inference test services, skip tests that require inference services. 
Hence, we should check for rerank tests.

Relates #123074
2025-04-07 09:43:55 -07:00
Oleksandr Kolomiiets
21ff72bef4
Use FallbackSyntheticSourceBlockLoader for text fields (#126237) 2025-04-07 09:32:35 -07:00
David Kyle
20eb59080c
[ML] Move request managers into service package (#126114) 2025-04-07 16:01:49 +02:00
Moritz Mack
0360db2cd0
Improved reproduction of scaling EsExecutors bug #124667 to work with max pool size > 1. (#125045)
Relates to #124867, ES-10640
2025-04-07 15:40:25 +02:00
Nik Everett
7e1e45eaa4
ESQL: Speed up TO_IP (#126338)
Speed up the TO_IP method by converting directly from utf-8 encoded
strings to the ip encoding. Previously we did:
```
utf-8 -> String -> INetAddress -> ip encoding
```

In a step towards solving #125460 this creates three IP parsing
functions, one the rejects leading zeros, one that interprets leading
zeros as decimal numbers, and one the interprets leading zeros as octal
numbers. IPs have historically been parsed in all three of those ways.

This plugs the "rejects leading zeros" parser into `TO_IP` because
that's the behavior it had before.

Here is the performance:
```
Benchmark               Score    Error  Units
leadingZerosAreDecimal  14.007 ± 0.093  ns/op
leadingZerosAreOctal    15.020 ± 0.373  ns/op
leadingZerosRejected    14.176 ± 3.861  ns/op
original                32.950 ± 1.062  ns/op
```

So this is roughly 45% faster than what we had.
2025-04-07 09:34:53 -04:00
Mike Pellegrini
72066ea49f
Update InferenceException to retain top-level message (#126345) 2025-04-07 09:05:00 -04:00
Pete Gillin
549fddb348
ES-10037 Tweak wording of autosharding logs (#126339)
ES-10037 #comment Tweaked wording of logging in https://github.com/elastic/elasticsearch/pull/126339
2025-04-07 13:15:52 +01:00
David Turner
527d2a203b
Improve handling of empty response (#125562)
Today `ActionResponse$Empty` implements `ToXContentObject`, but yields
no bytes of content when serialized which creates an invalid JSON
response. This commit removes the bogus interface and adjusts the
affected REST APIs to send a `text/plain` response instead.
2025-04-07 12:10:07 +01:00
Alexander Spies
a152b4e29b
ESQL: Fail with 500 not 400 for ValueExtractor bugs (#126296)
In case of wrong layouts of ESQL's operators, it can happen that
ValueExtractor.extractorFor encounters a data type mismatch. Currently,
this throws IllegalArgumentException, which is treated like a user
exception and triggers a 400 response.

We need to return a 500 status code for such errors; this is also
important for observability of ES clusters, which can normally use 500
responses as an indicator of a bug.

Throw IllegalStateException instead, it's close enough.
2025-04-07 11:21:57 +02:00
Christoph Büscher
f8b99258f4
Re-enable SearchProgressActionListenerIT testSearchProgressWithQuery (#124302) 2025-04-07 11:13:47 +02:00
Craig Taverner
1f6518f371
Document special behaviour of ignore_malformed for geo_point mappings (#125692)
With `geo_point` fields, here is the special case of values that have a syntactically valid format, but the numerical values for `latitude` and `longitude` are out of range.

If `ignore_malformed` is `false`, an exception will be thrown as usual. But if it is `true`, the document will be indexed correctly, by normalizing the latitude and longitude values into the valid range. The special `_ignored` field will not be set. The original source document will remain as before, but indexed values, doc-values and stored fields will all be normalized.
2025-04-07 11:05:51 +02:00
Jan Kuipers
24909ca9df
Adaptive allocations improvements (#126307)
* Adaptive allocations: don't update deployments that aren't started.

* AssignmentPlanner: don't plan deployments with zero allocations

* Update JavaDoc
2025-04-07 08:46:32 +02:00
Slobodan Adamović
0b09506b54
Improve error handling during index expressions resolving (#126018)
The `InvalidIndexNameException` exception was wrapped in a `ElasticsearchSecurityException`, which returns HTTP `403` status. 

This exception (along with newly introduced `InvalidSelectorException` and `UnsupportedSelectorException`) can be raised during index expression resolving due to an invalid user input and should result in HTTP `400` response instead.

This PR changes exception handling to avoid wrapping them in the `ElasticsearchSecurityException`.
2025-04-06 07:09:24 +02:00
elasticsearchmachine
1bace0b70d Mute org.elasticsearch.packaging.test.DockerTests test022InstallPluginsFromLocalArchive #116866 2025-04-06 09:42:11 +10:00
elasticsearchmachine
d7095c360c Mute org.elasticsearch.smoketest.MlWithSecurityIT test {yaml=ml/start_data_frame_analytics/Test start classification analysis when the dependent variable cardinality is too low} #123200 2025-04-06 09:39:23 +10:00
elasticsearchmachine
2ccf0c3513 Mute org.elasticsearch.xpack.esql.qa.multi_node.EsqlSpecIT test {rerank.Reranker using multiple fields ASYNC} #126371 2025-04-06 09:12:19 +10:00
elasticsearchmachine
ea440aa0b8 Mute org.elasticsearch.xpack.esql.qa.multi_node.EsqlSpecIT test {rerank.Reranker using a single field SYNC} #126370 2025-04-06 09:12:10 +10:00
elasticsearchmachine
947d33bf0f Mute org.elasticsearch.xpack.esql.qa.multi_node.EsqlSpecIT test {rerank.Reranker using a single field ASYNC} #126369 2025-04-06 09:12:02 +10:00
elasticsearchmachine
e808bc2c33 Mute org.elasticsearch.backwards.MixedClusterClientYamlTestSuiteIT test {p0=search.vectors/42_knn_search_bbq_flat/Vector rescoring has same scoring as exact search for kNN section} #126368 2025-04-06 08:06:58 +10:00
elasticsearchmachine
354a56dc91 Mute org.elasticsearch.xpack.esql.qa.multi_node.EsqlSpecIT test {rerank.Reranker add the _score column when missing SYNC} #126367 2025-04-06 07:43:02 +10:00
elasticsearchmachine
a53ae214f3 Mute org.elasticsearch.xpack.esql.qa.multi_node.EsqlSpecIT test {rerank.Reranker using another sort order SYNC} #126363 2025-04-06 02:22:17 +11:00
elasticsearchmachine
83418244ed Mute org.elasticsearch.xpack.esql.qa.multi_node.EsqlSpecIT test {rerank.Reranker using another sort order ASYNC} #126362 2025-04-06 02:22:10 +11:00
elasticsearchmachine
0255c10866 Mute org.elasticsearch.xpack.esql.qa.multi_node.EsqlSpecIT test {rerank.Reranker before a limit ASYNC} #126361 2025-04-06 02:22:02 +11:00
elasticsearchmachine
81033069dd Mute org.elasticsearch.xpack.esql.qa.multi_node.EsqlSpecIT test {rerank.Reranker add the _score column when missing ASYNC} #126360 2025-04-06 02:21:55 +11:00
Nhat Nguyen
fbfc707d95
Support serialization of aggregate metric double literal (#126352)
To backport the newly introduced AggregateMetricDoubleLiteral to 8.x, we need
to override the supportsVersion method instead of getMinimalSupportedVersion.
2025-04-04 20:50:10 -07:00
elasticsearchmachine
a6aaccdb7f Mute org.elasticsearch.xpack.ilm.actions.SearchableSnapshotActionIT testSearchableSnapshotTotalShardsPerNode #126354 2025-04-05 11:59:20 +11:00
Lisa Cawley
1d1feb6010
[DOCS] Migrate search profile API examples (#126347) 2025-04-04 22:42:09 +01:00
elasticsearchmachine
67fca830df Mute org.elasticsearch.xpack.ilm.ClusterStateWaitThresholdBreachTests testWaitInShrunkShardsAllocatedExceedsThreshold #126348 2025-04-05 08:21:50 +11:00
Tim Brooks
68bc2b8600
Adjust method to transition split state (#126179)
Make the method to transition to handoff be generic and support multiple
states.
2025-04-04 15:20:07 -06:00
Rene Groeschke
6cfb2e9d4a
Resolve fips specific metricbeat and filebeat libs for ES fips image (#126312)
Also updated DRA handling to reflect resolving fips specific artifacts
2025-04-05 06:47:30 +11:00
Jordan Powers
4c174a891f
Use Lucene101 postings format by default (#126080)
Update the PerFieldFormatSupplier so that new standard indices use the
Lucene101PostingsFormat instead of the current default ES812PostingsFormat.

Currently, use of the new codec is gated behind a feature flag.
2025-04-04 12:41:27 -07:00
elasticsearchmachine
fce28cc82a Mute org.elasticsearch.search.SearchWithRejectionsIT testOpenContextsAfterRejections #126340 2025-04-05 06:02:19 +11:00
Mary Gouseti
a525b3d924
Fix test to anticipate force merge failure (#126282)
This test had a copy paste mistake. When the cluster has only one data
node the replicas cannot be assigned so we end up with a force merge
error. In the case of the failure store this was not asserted correctly.

On the other hand, this test only checked for the existence of an error
and it was not ensuring that the current error is not the rollover error
that should have recovered. We make this test a bit more explicit.

Fixes: https://github.com/elastic/elasticsearch/issues/126252
2025-04-05 05:26:58 +11:00
Pete Gillin
78aff25b05
ES-10037 Periodic logging in autosharding service (#126171)
This enhances DataStreamAutoShardingService so that it periodically
logs at INFO level the most 'interesting' results it has produced in
the last period.

In this PR, the most 'interesting' results are considered to be the
ones with the highest load, keeping track separately of the top 10
which resulting in an increase decision and the top 10 which did
not. In practice, increase recommendations are sufficiently rare that
the top 10 will often be 'all of them', and they are all potentially
interesting (but we cap it to protect against taking up an unbounded
amount of memory). We keep the high load non-increase recommendations
as well, since these are likely to be the interesting ones to look at
when investigating why some data stream did not get an increase shards
recommendation when we might have expected it.

The mechanism would be easily extended to add in other categories. For
example, we may find that there are some categories of decrease
decisions we consider 'interesting'. (N.B. The rollover service will
not roll over just because the auto-sharding service recommended
down-sharding — down-sharding only happens if the rollover was going
to happen for some other reason (age, size, etc.) So it's normal for
the auto-sharding service to return decrease recommendations for the
same data streams every 5 minutes until those other conditions are
met. Which makes things a bit more complicated.) This PR just covers
the cases that seem likely to be useful in the support cases we have
seen.

The existing DEBUG and TRACE log lines in the service are replaced
with a single DEBUG log which pulls together all the data. This is an
improvement, since at the moment it is hard to figure out from the
logs which lines refer to the same data stream (they are interleaved,
and don't all include the data stream name).

The write load field in the AutoShardingResult was unused, and is
removed.

ES-10037 #comment Improved logging in https://github.com/elastic/elasticsearch/pull/126171
2025-04-04 19:08:39 +01:00
Alexey Ivanov
fd7efe587e
[main] Move system indices migration to migrate plugin (#125437)
* [main] Move system indices migration to migrate plugin

It seems the best way to fix #122949 is to use existing data stream reindex API. However, this API is located in the migrate x-pack plugin. This commit moves the system indices migration logic (REST handlers, transport actions, and task) to the migrate plugin.

Port of #123551

* [CI] Auto commit changes from spotless

* Fix compilation

* Fix tests

* Fix test

---------

Co-authored-by: elasticsearchmachine <infra-root+elasticsearchmachine@elastic.co>
2025-04-04 18:49:38 +01:00
Brian Seeders
5706e075ad
[CI] Trigger FIPS PR tests when test-fips label is present (#126332) 2025-04-04 13:11:43 -04:00
Brian Seeders
eaac8ee36c
Fix vector-tile tests when run on non-snapshot builds (#126251) 2025-04-04 12:16:31 -04:00
Armin Braun
c06cbb6496
Optimize slicing ReleasableBytesReference to avoid needless retention of unused pages (#126284)
We can make slicing things like search hits where we cut many small
buffers out of a large composite reference a lot more efficient in some
cases by making the slice of a releasable reference itself releasable.
This fixes the current situation where we could have composite buffer
of many MB that is made up of e.g. 16k chunks but that we would retain
in full if we were to slice even a single byte out of it in any position.
2025-04-04 18:16:04 +02:00
Aurélien FOUCRET
5b44651040
Remove files commited by mistake. (#126313) 2025-04-04 16:54:02 +01:00
George Wallace
ce8b418686
Update esql-lookup-join.md (#126290) 2025-04-04 09:43:45 -06:00
elasticsearchmachine
a560b6df66 Mute org.elasticsearch.packaging.test.DockerTests test023InstallPluginUsingConfigFile #126145 2025-04-05 02:41:46 +11:00
elasticsearchmachine
d9e3b20796 Mute org.elasticsearch.xpack.esql.qa.multi_node.EsqlSpecIT test {rerank.Reranker before a limit SYNC} #126322 2025-04-05 02:28:47 +11:00
elasticsearchmachine
4a163fad33 Mute org.elasticsearch.xpack.esql.qa.multi_node.EsqlSpecIT test {rerank.Reranker using multiple fields SYNC} #126320 2025-04-05 02:28:39 +11:00
David Turner
7239540c91
Replace region with regionSupplier in all AWS tests (#126285)
Rather than hard-coding a region name we should always auto-generate it
randomly during test execution. This commit replaces the remaining fixed
`String` arguments with a `Supplier<String>` argument to enable this.
2025-04-05 02:27:28 +11:00
David Turner
3e35900b07
Add missing test security policies (#126309)
Relates #126274 Closes #126301 Closes #126302 Closes #126303 Closes
#126304 Closes #126305 Closes #126306
2025-04-05 02:27:17 +11:00
Nhat Nguyen
52c2d62103
Add evaluation context to time-series aggregators (#126089)
Rate aggregators need to access the start time and end time of each 
group to perform extrapolation in the final evaluation. This change 
replaces the DriverContext parameter in evaluateFinal with
EvaluationContext, allowing the TimeSeriesAggregationOperator to pass an
EvaluationContext with these time intervals. I took another approach 
where the extension is applied only for the time series aggregator, but
it could be fragile with the pre-filter of aggregators.
2025-04-04 08:13:24 -07:00
Christoph Büscher
e55b97270b
Fix failing SearchServiceSingleNodeTests testSlicingBehaviourForParallelCollection (#126300)
We need to register the settings update consumer for
QUERY_PHASE_PARALLEL_COLLECTION_ENABLED regardless of the
BATCHED_QUERY_PHASE_FEATURE_FLAG feature flag.

Closes #125899
2025-04-04 16:50:49 +02:00
Jan Kuipers
1927c6e91d
Fix deploying custom models with adaptive allocations (#126276) 2025-04-05 01:50:06 +11:00
Aurélien FOUCRET
a4a271415d
Adding ES|QL RERANK command in snapshot builds (#123074) 2025-04-04 15:39:18 +01:00
Alexander Spies
8f38b13059
ESQL: Revert "Allow partial results by default in ES|QL (#125060)" (#126286)
This reverts commit 81555cc9d9 from
https://github.com/elastic/elasticsearch/pull/125060.

Fix https://github.com/elastic/elasticsearch/issues/126275

@idegtiarenko and I investigated and believe this needs reverting:
silently dropping results from the query response in case any index is
missing can lead to real problems if users don't spot their mistake. I'm
also not sure if all the results will get dropped, or only from some
nodes/shards/clusters, meaning that this might be hard to spot by users
if only some results get dropped.

The main PR has no transport version bump, no new ESQL capability, and
was merged 15h ago - so it should be safe to just revert it. I noticed
there was a linked Serverless PR on the original PR, but it merely
disabled some obsolete tests on Serverless and doesn't require reverting
itself.
2025-04-05 01:27:13 +11:00
elasticsearchmachine
a58d8e09f3 Mute org.elasticsearch.xpack.test.rest.XPackRestIT test {p0=ml/start_data_frame_analytics/Test start classification analysis when the dependent variable cardinality is too low} #126299 2025-04-05 00:43:45 +11:00
Kathleen DeRusso
3575bdba08
Ensure sentence overlap is considered in SentenceBoundaryChunkingSettings equals/hashCode (#126250) 2025-04-04 09:29:29 -04:00
Tim Rühsen
e85a38bba7
[Profiling] Don't use synthetic source for symbolization queues (#126278) 2025-04-04 15:24:04 +02:00
Jeremy Dahlgren
4c979aa365
Accumulate compute() calls and iterations between convergences in DesiredBalanceComputer (#126008)
Add tracking of the number of compute() calls and total iterations
between convergences in the DesiredBalanceComputer, along with the
time since the last convergence.  These are included in the log
message when the computer doesn't converge.

Closes #100850.
2025-04-04 08:33:17 -04:00
Armin Braun
8199c831b2
Revert "Flip batched execution flag to false for test (#126228)" (#126281)
This reverts commit d9bc3b97eb.
2025-04-04 12:54:30 +01:00
Rene Groeschke
d39db02a74
Use official ubi9-minimal base image for es docker (#126280)
Based on feedback we got here: Based on feedback we got
https://github.com/docker-library/official-images/pull/18692\#issuecomment-2749045229
we can not rely on non official images here
2025-04-04 22:41:16 +11:00
David Turner
7402dfdf65
Introduce qa subprojects of :modules:repository-s3 (#126274)
Today we have some special-case test classes in `:modules:repository-s3`
within the same source root as the regular tests, with some trickery to
define separate Gradle tasks to run them with their special-case
configs. This commit simplifies the build by just moving each of these
classes into its own Gradle project.
2025-04-04 21:29:05 +11:00
Gergely Kalapos
88996bc01d
[otel-data] Add profiler_stack_trace_ids as counted_keyword to otel-data mappings (#125608)
* Add profiler_stack_trace_ids as counted_keyword to otel-data mappings

* Change prefix for profiler_stack_trace_ids
2025-04-04 09:44:41 +01:00
elasticsearchmachine
0be3222502 Mute org.elasticsearch.xpack.test.rest.XPackRestIT test {p0=transform/transforms_stats/Test get transform stats} #126270 2025-04-04 19:28:30 +11:00
David Turner
896598570c
Reinstate S3SearchableSnapshotsCredentialsReloadIT in FIPS JVMs (#126109)
These tests only don't work in a FIPS JVM because they use a secret key
that is unacceptably short. This commit replaces the relevant uses of
`randomIdentifier` with `randomSecretKey` so they work whether in FIPS
mode or not.
2025-04-04 18:42:09 +11:00
David Turner
24fa8eaa63
Support ListObjectsV2 in S3HttpHandler (#126189)
`ListObjects` and `ListObjectsV2` only really differ in their approach
to pagination, but today `S3HttpHandler` does not simulate pagination
anyway so we can use the same handling code for both APIs. The only
practical difference is that the v2 SDK requires the `<IsTruncated>`
element in a `ListObjectsV2` response, but this element is permitted in
both APIs so we add it here.
2025-04-04 18:40:27 +11:00
David Turner
7eee6502de
Misc cleanups in S3BlobContainerRetriesTests (#126101)
- Simplify multi-object-delete request detection
- Replace `AtomicBoolean` with volatile field
- Make `ThrottlingDeleteHandler` static
2025-04-04 18:39:51 +11:00
Lorenzo Dematté
e52288d330
[Entitlements] Expand and update README (#125395)
This PR expands the README for the entitlements package; it adds information for Elasticsearch developers on how the system is structured, how to build policies, what to do when new code "does not work" because it's bumping into a NotEntitledException, and how to apply a policy patch in case of an emergency.
2025-04-04 08:17:44 +01:00
Ievgen Degtiarenko
5a865a4f69
Re-enable test and add logging (#126193) 2025-04-04 09:17:31 +02:00
Ievgen Degtiarenko
d6a9339724
Verify can match is applied to WHERE operator (#126117) 2025-04-04 09:13:51 +02:00
Ievgen Degtiarenko
97626d418d
Remove outdated ESQL test mutes (#126190) 2025-04-04 09:13:24 +02:00
Ievgen Degtiarenko
dbd816aabe
Declare required capability for date tests (#126222) 2025-04-04 09:09:33 +02:00
Nhat Nguyen
6ce8d51c42
Add time bucket to time-series aggregate (#126010)
We need the bucket interval within the rate function to perform 
extrapolation. With this change, along with #26089, we will be able to
pass the grouping range interval to rate aggregations.
2025-04-03 23:53:52 -07:00
Mikhail Berezovskiy
70654a3633
Add GCS telemtry with ThreadLocal (#125452) 2025-04-03 23:46:06 -07:00
Stanislav Malyshev
6043d9c675
Update allow_partial_results docs (#126257) 2025-04-03 22:13:49 -06:00
Joe Gallo
950456d38b
Cleanup community_id processor (#126247) 2025-04-03 19:59:09 -04:00
Kathleen DeRusso
e7d4a28a87
Support configurable chunking in semantic_text fields (#121041)
* test

* Revert "test"

This reverts commit 9f4e2adba0.

* Refactor InferenceService to allow passing in chunking settings

* Add chunking config to inference field metadata and store in semantic_text field

* Fix test compilation errors

* Hacking around trying to get ingest to work

* Debugging

* [CI] Auto commit changes from spotless

* POC works and update TODO to fix this

* [CI] Auto commit changes from spotless

* Refactor chunking settings from model settings to field inference request

* A bit of cleanup

* Revert a bunch of changes to try to narrow down what broke CI

* test

* Revert "test"

This reverts commit 9f4e2adba0.

* Fix InferenceFieldMetadataTest

* [CI] Auto commit changes from spotless

* Add chunking settings back in

* Update builder to use new map

* Fix compilation errors after merge

* Debugging tests

* debugging

* Cleanup

* Add yaml test

* Update tests

* Add chunking to test inference service

* Trying to get tests to work

* Shard bulk inference test never specifies chunking settings

* Fix test

* Always process batches in order

* Fix chunking in test inference service and yaml tests

* [CI] Auto commit changes from spotless

* Refactor - remove convenience method with default chunking settings

* Fix ShardBulkInferenceActionFilterTests

* Fix ElasticsearchInternalServiceTests

* Fix SemanticTextFieldMapperTests

* [CI] Auto commit changes from spotless

* Fix test data to fit within bounds

* Add additional yaml test cases

* Playing with xcontent parsing

* A little cleanup

* Update docs/changelog/121041.yaml

* Fix failures introduced by merge

* [CI] Auto commit changes from spotless

* Address PR feedback

* [CI] Auto commit changes from spotless

* Fix predicate in updated test

* Better handling of null/empty ChunkingSettings

* Update parsing settings

* Fix errors post merge

* PR feedback

* [CI] Auto commit changes from spotless

* PR feedback and fix Xcontent parsing for SemanticTextField

* Remove chunking settings check to use what's passed in from sender service

* Fix some tests

* Cleanup

* Test failure whack-a-mole

* Cleanup

* Refactor to handle memory optimized bulk shard inference actions - this is ugly but at least it compiles

* [CI] Auto commit changes from spotless

* Minor cleanup

* A bit more cleanup

* Spotless

* Revert change

* Update chunking setting update logic

* Go back to serializing maps

* Revert change to model settings - source still errors on missing model_id

* Fix updating chunking settings

* Look up model if null

* Fix test

* Work around https://github.com/elastic/elasticsearch/issues/125723 in semantic text field serialization

* Add BWC tests

* Add chunking_settings to docs

* Refactor/rename

* Address minor PR feedback

* Add test case for null update

* PR feedback - adjust refactor of chunked inputs

* Refactored AbstractTestInferenceService to return offsets instead of just Strings

* [CI] Auto commit changes from spotless

* Fix tests where chunk output was of size 3

* Update mappings per PR feedback

* PR Feedback

* Fix problems related to merge

* PR optimization

* Fix test

* Delete extra file

---------

Co-authored-by: elasticsearchmachine <infra-root+elasticsearchmachine@elastic.co>
2025-04-03 17:45:26 -04:00
elasticsearchmachine
bcdf51ad51 Mute org.elasticsearch.datastreams.lifecycle.ExplainDataStreamLifecycleIT testExplainLifecycleForIndicesWithErrors #126252 2025-04-04 08:24:54 +11:00
elasticsearchmachine
3004d44523 Mute org.elasticsearch.xpack.searchablesnapshots.SearchableSnapshotsIntegTests testCreateAndRestoreSearchableSnapshot #119709 2025-04-04 08:06:49 +11:00
Tim Grein
00c051cc38
Only add product use case header if not present (#126212)
Co-authored-by: Brendan Jugan <brendan.jugan@elastic.co>
2025-04-03 17:05:22 -04:00
Sam Xiao
b6c6db9861
Add multi-project support for health indicator data_stream_lifecycle (#126056) 2025-04-03 16:26:22 -04:00
Nhat Nguyen
81555cc9d9
Allow partial results by default in ES|QL (#125060)
With this change, ES|QL will return partial results instead of failing
the entire query when encountering errors. Callers should check the
partial_results flag in the response to determine if the result is
partial or complete. If returning partial results is not desired, this
option can be overridden per request via the allow_partial_results
parameter in the query URL or globally via the cluster setting
esql.allow_partial_results.

Relates #122802
2025-04-03 12:30:47 -07:00
Christoph Büscher
0c16ed7f5d
Remove fixed test from muted-tests.yml (#124088)
The issue underlying this test mute has been closed as a duplicate, the
issue seems fixed in https://github.com/elastic/elasticsearch/issues/117415 
but the test wasn't activated again.
2025-04-03 21:05:29 +02:00
Nhat Nguyen
b0d7c7d102
Add logical/physical plans time-series aggregate (#126178)
We need to store extra information for Aggregate and AggregateExec for 
time-series aggregations. Previously, I added a type (standard or
time_series), but this was not enough. This PR removes it and replaces
it with extensions of Aggregate and AggregateExec. I considered adding
an extra map of metadata to Aggregate and AggregateExec, but this
approach seems simpler.
2025-04-03 11:36:43 -07:00
elasticsearchmachine
496c62dd84 Mute org.elasticsearch.xpack.test.rest.XPackRestIT test {p0=transform/transforms_reset/Test force reseting a running transform} #126240 2025-04-04 05:33:54 +11:00
Ben Chaplin
9f6eb1d4e3
Log stack traces on data nodes before they are cleared for transport (#125732)
We recently cleared stack traces on data nodes before transport back to the coordinating node when error_trace=false to reduce unnecessary data transfer and memory on the coordinating node (#118266). However, all logging of exceptions happens on the coordinating node, so stack traces disappeared from any logs. This change logs stack traces directly on the data node when error_trace=false.
2025-04-03 13:45:09 -04:00
Lorenzo Dematté
e4ce993c16
[Entitlements] Fix PolicyUtils and PolicyUtilsTests on Windows (#126185)
This PR fixes 2 issues discovered around PolicyUtils (and PolicyUtilsTests) when running CI on Windows:
- in tests, absolute paths like always are different, this fix updates the tests to account for the difference.
- on Windows, Files.move was failing because we were parsing the Entitlement policy but not closing the stream in a timely manner. This causes plugin installation (and related CI tests) to fail 70% of the time. Fixed by closing the stream properly

Fixes #126176
2025-04-03 18:02:17 +01:00
David Turner
279498d810
Remove spurious NOMERGE comment (#126231)
Left-over from #122062
2025-04-04 03:46:07 +11:00
Mary Gouseti
488951edf3
Data stream lifecycle does not record error in failure store rollover (#126229)
**Issue** The data stream lifecycle does not register correctly rollover
errors for failure store.

**Observed bahaviour** When data stream lifecycle encounters a rollover
error it records it unless it sees that the current write index of this
data stream doesn't match the source index of the request. However, the
write index check does not use the failure write index but the write
backing index, so the failure gets ignored

**Desired behaviour** When data stream lifecycle encounters a rollover
error it will check the relevant write index before it determines if it
should be recorded or not.
2025-04-04 03:44:09 +11:00
Armin Braun
d9bc3b97eb
Flip batched execution flag to false for test (#126228)
Disabling this to illustrate a point in nightly ccs runs.
2025-04-03 17:25:16 +01:00
elasticsearchmachine
fcfc90ee1f Mute org.elasticsearch.packaging.test.DockerTests test020PluginsListWithNoPlugins #126232 2025-04-04 02:44:43 +11:00
Ievgen Degtiarenko
1c7867d53b
Presize sets (#126098) 2025-04-03 17:37:43 +02:00
Ioana Tagirta
bd0a75df8b
Make Fork n-ary (#126074) 2025-04-03 17:09:26 +02:00
Slobodan Adamović
3affea35bd
[Failure Store] Add missing feature flag check in RBACEngineTests (#126215)
Resolves https://github.com/elastic/elasticsearch/issues/126130
2025-04-04 02:08:13 +11:00
Omri Cohen
856ee3a177
Support explicit Z/M attributes using WKT geometry (#125896) 2025-04-03 17:00:12 +02:00
kanoshiou
30b2a1f729
ESQL: Enhanced DATE_TRUNC with arbitrary intervals (#120302)
Originally, `DATE_TRUNC` only supported 1-month and 3-month intervals for months, and 1-year interval for years, while arbitrary intervals were supported for weeks and days. This PR adds support for `DATE_TRUNC` with arbitrary month and year intervals. 

Closes #120094
2025-04-03 16:55:56 +02:00
elasticsearchmachine
44a74f9fec Mute org.elasticsearch.xpack.security.SecurityRolesMultiProjectIT testUpdatingFileBasedRoleAffectsAllProjects #126223 2025-04-04 01:15:31 +11:00
elasticsearchmachine
7807183972 Mute org.elasticsearch.entitlement.runtime.policy.PolicyUtilsTests testFormatFilesEntitlement #126176 2025-04-04 01:03:43 +11:00
Pat Whelan
69180eafe1
[ML] Refactor SSE Parsing (#125959)
ServerSentEvent is now a record with `event` and `data`, rather than
it being a record for value with a separate `ServerSentEventField`.

- `value` was renamed to `data`
- `hasValue` was renamed to `hasData`
- Parsing was refactored to read more like its spec: writing to a buffer
  and flushing when we reach a blank newline
- We now support multiline data payloads
2025-04-03 09:42:49 -04:00
elasticsearchmachine
3277ff8b28 Mute org.elasticsearch.index.engine.ThreadPoolMergeSchedulerTests testSchedulerCloseWaitsForRunningMerge #125236 2025-04-04 00:31:29 +11:00
David Turner
69f9914403
Migrate tests away from S3 SDK MD5DigestCalculatingInputStream (#126099)
`S3BlobContainerRetriesTests` uses `MD5DigestCalculatingInputStream`
from the AWS v1 SDK to compute a MD5 checksum, but this feature is not
available in the v2 SDK. With this commit we remove this dependency and
compute the MD5 checksums directly instead.
2025-04-03 14:11:00 +01:00
elasticsearchmachine
d5c0778f70 Mute org.elasticsearch.snapshots.SharedClusterSnapshotRestoreIT testDeletionOfFailingToRecoverIndexShouldStopRestore #126204 2025-04-03 22:40:38 +11:00
Richard Dennehy
f821930518
Fix NPE for missing Content Type header in OIDC Authenticator (#126191)
* Fix NPE for missing Content Type header in OIDC Authenticator

* Update docs/changelog/126191.yaml
2025-04-03 12:38:53 +01:00
Mary Gouseti
95257bbf07
Make data stream options multi-project aware (#126141) 2025-04-03 14:33:40 +03:00
Przemysław Witek
062d580899
Verify usage of CATEGORIZE function in the ES|QL telemetry tests (#126105) 2025-04-03 13:19:49 +02:00
Albert Zaharovits
0faa960aa2
Fix IndexStatsIT (#126113)
Ensures proper cleanup in the testThrottleStats test.

Fixes #125910 #125907 #125912
2025-04-03 14:09:38 +03:00
Craig Taverner
1645711ff8
Unmute already fixed test (#126194)
This was fixed last week in
https://github.com/elastic/elasticsearch/pull/125802. It seems this
report was from the day before the fix, but the PR was based on main
without the mute, so a timing issue. I'll make a PR that simply unmutes
the test.

Fixes #125735
2025-04-03 22:07:39 +11:00
Martijn van Groningen
717d00d96d
Fix TsdbDocValueBwcTests test failure. (#126182)
Don't perform version check assertion in TsdbDocValueBwcTests if security manager is active.

By default, with jvm version 24 entitlements are used instead security manager and assertOldDocValuesFormatVersion() / assertNewDocValuesFormatVersion() work as expected.

Making these methods work with security manager would require granting the server entire test codebase suppressAccessChecks and suppressAccessChecks privileges. This is undesired from a security manager perspective. Instead, only assert doc values format checks if security manager isn't active, which is always the case jvm version 24 or higher is used.

Closes #126174
2025-04-03 12:19:59 +02:00
Albert Zaharovits
ecaa0b1f65
Fix ThreadPoolMergeSchedulerTests testSchedulerCloseWaitsForRunningMerge (#126110)
Fixes #125236
2025-04-03 11:11:55 +03:00
Ievgen Degtiarenko
0095f29624
Remove TableInfo (#126090) 2025-04-03 09:42:32 +02:00
Alexander Spies
28a544e0c5
ESQL: Fix ReplaceMissingFieldsWithNull (#125764)
* Revert changes to Layout.java

The change in 80125a4bac is a quick fix
and allows breaking an invariant of Layout. Revert that.

* Simplify ReplaceMissingFieldWithNull

When encountering projections, it tries to do the job of field
extraction for missing fields by injecting an Eval that creates a
literal null with the same name id as the field attribute for the
missing field. This is wrong:
1. We only insert an Eval in case that a Project relies on the missing
   attribute. There could be other plan nodes that rely on the missing
   attribute.
2. Even for Projects, we only insert an Eval in case we squarely project
   for the field - in case of aliases (e.g. from RENAME), we do nothing.
3. In case of multiple Projects that use this attribute, we create
   multiple attributes with the original field attribute's id, causing
   a wrong Layout. This triggered
   https://github.com/elastic/elasticsearch/issues/121754.

* Revive logic for EsRelation instead of Project

* Update LocalLogicalPlanOptimizerTests

* Update docs/changelog/125764.yaml

* Update test expectations

* Do not prune attributes from EsRelation

This can lead to empty output, which leads to the EsRelation being
replaced by a LocalRelation with 0 rows.

* Add tests + capability

* Update docs/changelog/125764.yaml

* Add comments
2025-04-03 09:26:26 +02:00
David Turner
9b353f69a7
Fix CommonPrefixes rendering in S3HttpHandler (#126147)
Today the `ListObjects` implementation in `S3HttpHandler` will put all
the common prefixes in a single `<CommonPrefixes>` container, but in
fact the real S3 gives each one its own container. The v1 SDK is lenient
and accepts either, but the v2 SDK requires us to do this correctly.
This commit fixes the test fixture to match the behaviour of the real
S3.
2025-04-03 07:55:07 +01:00
Nhat Nguyen
b563145129
Rename METRICS command to TS (#126064)
- Rename METRICS to TS
- Disable time-series tests in mixed clusters until the development stabilizes.
2025-04-02 16:16:46 -07:00
Joe Gallo
552066e910
Revert "Bump spotless (#126125)" (#126173)
Reverting https://github.com/elastic/elasticsearch/pull/126125 due to
https://github.com/elastic/elasticsearch/pull/126125#issuecomment-2773672346.
2025-04-03 09:00:33 +11:00
Bogdan Pintea
2b512bc58a
ESQL: make AttributeMap and AttributeSet immutable (#125938)
This will allow reusing them in the plan analysis and skip recreating them in UnaryPlan/UnaryExec when not needed.
Introduce/adjust builders for them, which are now the only way to use a modifiable map/set.

Related #124395
2025-04-02 23:27:12 +02:00
elasticsearchmachine
8a44b382b8 Merge patch/serverless-fix into main 2025-04-02 21:00:39 +00:00
Benjamin Trent
33dcc921be
Mark rescore_vector as generally available (#126038)
* Mark rescore_vector as generally available

* Update docs/changelog/126038.yaml
2025-04-02 16:10:01 -04:00
Pawan Kartik
c54c3afb42
Add transport version entry for backport (#126168) 2025-04-02 20:40:34 +01:00
Oleksandr Kolomiiets
daed78308c
Fix KeywordFieldBlockLoaderTests (#126146) 2025-04-02 11:59:22 -07:00
Albert Zaharovits
01a1f454e1
Unmute ThreadContextTests testDropWarningsExceedingMaxSettings (#123629) 2025-04-02 21:10:29 +03:00
Ioana Tagirta
47edd0adb8
Remove SEMANTIC_TEXT data type in ES|QL (#125581) 2025-04-02 19:47:28 +02:00
Stanislav Malyshev
d84b65d38b
Ensure the set of remote clusters is consistent over the life of ES|QL query (#126000)
* Ensure the set of remote clusters is consistent over the life of ES|QL query
2025-04-02 11:46:04 -06:00
Niels Bauman
483f97915c
Run TransportGetIndexAction on local node (#125652)
This action solely needs the cluster state, it can run on any node.
Since this is the last class/action that extends the `ClusterInfo`
abstract classes, we remove those classes too as they're not required
anymore.

Relates #101805
2025-04-02 18:41:35 +01:00
Pawan Kartik
e4fb22c4f3
ES|QL: Wrap remote errors with cluster name to provide more context (#123156)
Wrap remote errors with cluster name to provide more context

Previously, if a remote encountered an error, user would see a top-level error that would provide no context about which remote ran into the error. Now, such errors are wrapped in a separate remote exception whose error message clearly specifies the name of the remote cluster and the error that occurred is the cause of this remote exception.
2025-04-02 18:08:20 +01:00
Joe Gallo
1306c6ba01
Bump spotless (#126125) 2025-04-02 13:06:42 -04:00
Joe Gallo
078f7ff9f7
Minor docs fixes (#126143) 2025-04-02 12:30:07 -04:00
Mark J. Hoy
e77bf808ab
Add Bounded Window to Inference Models for Rescoring to Ensure Positive Score Range (#125694)
* apply bounded window inference model

* linting

* add unit tests

* [CI] Auto commit changes from spotless

* add additional tests

* remove unused constructor

---------

Co-authored-by: elasticsearchmachine <infra-root+elasticsearchmachine@elastic.co>
2025-04-02 11:50:04 -04:00
Niels Bauman
509a12058f
Run TransportGetLifecycleAction on local node (#126002)
This action solely needs the cluster state, it can run on any node.

Relates #101805
2025-04-02 16:35:25 +01:00
elasticsearchmachine
fcd7c9f9f5 Mute org.elasticsearch.xpack.esql.qa.single_node.GenerativeIT test #126139 2025-04-03 02:27:51 +11:00
Luke Whiting
d816845251
ES-125727 Fix for [CI] ReindexDataStreamTransportActionIT testAlreadyUpToDateDataStream failing (#126123) 2025-04-02 15:34:43 +01:00
Mary Gouseti
25050495b9
Data stream options convert to javaRestTests to yamlRestTests. (#126037)
In this PR we introduce the data stream API in the `es-rest-api` using
the feature flag feature. This enabled us to use the `yamlRestTests`
tests instead of the `javaRestTests`.
2025-04-03 01:32:54 +11:00
elasticsearchmachine
c0cac957bc Mute org.elasticsearch.xpack.security.authz.RBACEngineTests testBuildUserPrivilegeResponseCombinesIndexPrivileges #126130 2025-04-03 01:29:13 +11:00
Albert Zaharovits
e93460040d
Fix testMergeSourceWithFollowUpMergesRunSequentially (#126050)
Fixes #125639
Relates #120869
2025-04-02 17:13:46 +03:00
Niels Bauman
eb4d64f94a
Run TransportGetSettingsAction on local node (#126051)
This action solely needs the cluster state, it can run on any node.
Additionally, it needs to be cancellable to avoid doing unnecessary work
after a client failure or timeout.

Relates #101805
2025-04-02 15:05:31 +01:00
Slobodan Adamović
ea8fd3b77c
[Test] Skip testAuthorizeDataStreamFailureIndices for release tests (#126112)
Adding a missing feature flag for
`IndicesPermissionTests#testAuthorizeDataStreamFailureIndices` test.

Resolves #125555 Resolves #126040
2025-04-03 00:45:31 +11:00
elasticsearchmachine
6a83480cbc Mute org.elasticsearch.search.basic.SearchWithRandomDisconnectsIT testSearchWithRandomDisconnects #122707 2025-04-03 00:26:12 +11:00
Luigi Dell'Aquila
5fcef40c26
ES|QL: fix generative tests (#126107)
Manage envs where source field mapping is not supported
2025-04-02 14:24:22 +01:00
Albert Zaharovits
edc5379e6a
Fix ThreadPoolMergeSchedulerStressTestIT testMergingFallsBehindAndThenCatchesUp (#125956)
We don't know how many semaphore merge permits we need to release, or how many are already released.

Fixes #125744
2025-04-02 16:07:18 +03:00
Slobodan Adamović
7b753d0621
[Test] Fix failing RBACEngineTests (#126106)
Adjusting the test assertion to account for the potential 3rd extra
group (https://github.com/elastic/elasticsearch/pull/125900).

Resolves https://github.com/elastic/elasticsearch/issues/126061
2025-04-02 23:57:16 +11:00
elasticsearchmachine
04e25ad200 Mute org.elasticsearch.index.mapper.blockloader.KeywordFieldBlockLoaderTests testBlockLoader {preference=Params[syntheticSource=false, preference=DOC_VALUES]} #126121 2025-04-02 23:48:08 +11:00
elasticsearchmachine
eeac1a7a34 Mute org.elasticsearch.search.sort.GeoDistanceIT testDistanceSortingWithUnmappedField #126118 2025-04-02 23:21:40 +11:00
Ievgen Degtiarenko
f084daaeb5
Simplify makeFieldConfig (#126021) 2025-04-02 14:07:38 +02:00
Martijn van Groningen
52d68392d0
Prepare tsdb doc values format for merging optimizations. (#125933)
The change contains the following changes:

- The numDocsWithField field moved from SortedNumericEntry to NumericEntry. Making this statistic always available.
- Store jump table after values in ES87TSDBDocValuesConsumer#writeField(...). Currently it is stored before storing values. This will allow us later to iterate over the SortedNumericDocValues once. When merging, this is expensive as a merge sort on the fly is being executed.

This change will allow all the optimizations that are listed in #125403
2025-04-02 13:39:41 +02:00
Lorenzo Dematté
40dd91b800
[Entitlements] Replace Permissions with Entitlements in InstallPluginAction (#125207)
This PR replaces the parsing and formatting of SecurityManager policies with the parsing and formatting of Entitlements policy during plugin installation.

Relates to ES-10923
2025-04-02 11:03:27 +01:00
Albert Zaharovits
1f0551a995
Slack merge throttling params for fewer merge tasks (#126016)
The intent here is to aim for fewer to-do merges enqueued for execution,
and to unthrottle disk IO at a faster rate when the queue grows longer.
Overall this results in less merge disk throttling.

Relates https://github.com/elastic/elasticsearch-benchmarks/issues/2437 https://github.com/elastic/elasticsearch/pull/120869
2025-04-02 12:36:49 +03:00
Luigi Dell'Aquila
cc54010c3c
ES|QL: enable generative tests (#126097) 2025-04-02 09:57:53 +01:00
David Turner
15899afd26
Remove testWriteBlobWithExceptionThrownAtClosingTime (#126096)
Reverts the test added in #123505 - this is not behaviour on which we
rely any more, and it does not apply with SDKv2 anyway.
2025-04-02 09:43:04 +01:00
Johannes Fredén
95cf1450f4
Add getSecret method to ProjectMetadata (#125830)
* Add getSecret method to ProjectState
2025-04-02 08:56:36 +02:00
Dimitris Rempapis
69f388c391
Unmute test and fix for SearchWithRandomDisconnectsIT::testSearchWithRandomDisconnects (#125838)
Provide a fix for a test execution and unmute the test.
2025-04-02 09:37:25 +03:00
Nick Tindall
58c8f4abae
Upgrade to latest GCS SDK (#126087)
Upgrades google cloud SDK used by repository-gcs to com.google.cloud:google-cloud-storage-bom:2.50.0

Closes: ES-9287
2025-04-02 15:41:50 +11:00
elasticsearchmachine
b3ea6596e4 Mute org.elasticsearch.index.mapper.blockloader.KeywordFieldBlockLoaderTests testBlockLoaderForFieldInObject {preference=Params[syntheticSource=false, preference=DOC_VALUES]} #126088 2025-04-02 13:26:47 +11:00
Nick Tindall
28dd8e1bae
Make GCS HttpHandler more compliant (#126007)
- Fixed bug where 416 was being erroneously returned for zero-length blobs even with no Range header
- Fixed bug where partial upload wouldn't be completed if the last PUT included no data
- Return 206 (partial content) status when a Range header is specified
- Return an ETag on object get - BlobReadChannel uses this to ensure we fail when the blob is updated between successive chunks being fetched)
- The 416 on zero-length blobs was one of(?) the causes of #125668
2025-04-02 13:05:23 +11:00
Keith Massey
bb762107b6
Preventing ConcurrentModificationException when updating settings for more than one index (#126077) 2025-04-01 17:10:08 -05:00
elasticsearchmachine
8ba57412c9 Mute org.elasticsearch.search.CCSDuelIT testTerminateAfter #126085 2025-04-02 08:57:35 +11:00
Nik Everett
d30296229b
ESQL: Hide some "extras" from docs (#124763)
Hides some of the "extra" lines from ESQL's documentation. These lines
are required to make the documentation into nice tests which is
important to make sure the docs don't get out of date. But readers don't
need to see them.
2025-04-01 21:24:15 +01:00
Patrick Doyle
a90b314ffd
Put the not-entitled message in the log (#126072) 2025-04-01 21:09:47 +01:00
Oleksandr Kolomiiets
f3ccde6959
Use FallbackSyntheticSourceBlockLoader for point and geo_point (#125816) 2025-04-01 12:55:18 -07:00
elastic-renovate-prod[bot]
7b46621c19
Pin docker.elastic.co/wolfi/chainguard-base-fips Docker tag to ebfc3f1 (#126065)
This PR contains the following updates:

| Package | Update | Change | |---|---|---| |
docker.elastic.co/wolfi/chainguard-base-fips | pinDigest |  -> `ebfc3f1`
|

---

### Configuration

📅 **Schedule**: Branch creation - "after 1pm on tuesday" (UTC),
Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once
you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Renovate
Bot](https://redirect.github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzOS4xMDcuMCIsInVwZGF0ZWRJblZlciI6IjM5LjEwNy4wIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyI6RGVsaXZlcnkvUGFja2FnaW5nIiwiPm5vbi1pc3N1ZSIsIlRlYW06RGVsaXZlcnkiLCJhdXRvLW1lcmdlLXdpdGhvdXQtYXBwcm92YWwiXX0=-->
2025-04-02 06:22:31 +11:00
elastic-renovate-prod[bot]
de5377df45
Update docker.elastic.co/wolfi/chainguard-base:latest Docker digest to 29150cd (#126066)
This PR contains the following updates:

| Package | Update | Change | |---|---|---| |
docker.elastic.co/wolfi/chainguard-base | digest | `c4e10ec` ->
`29150cd` |

---

### Configuration

📅 **Schedule**: Branch creation - "after 1pm on tuesday" (UTC),
Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once
you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Renovate
Bot](https://redirect.github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzOS4xMDcuMCIsInVwZGF0ZWRJblZlciI6IjM5LjEwNy4wIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyI6RGVsaXZlcnkvUGFja2FnaW5nIiwiPm5vbi1pc3N1ZSIsIlRlYW06RGVsaXZlcnkiLCJhdXRvLW1lcmdlLXdpdGhvdXQtYXBwcm92YWwiXX0=-->
2025-04-02 06:19:48 +11:00
David Turner
0d64aab4cc
Clean up request parsing in S3HttpHandler (#126034)
The `METHOD /path/components?and=query` string representation of a
request is becoming increasingly difficult to parse, with slight
variations in parsing between the implementation in `S3HttpHandler` and
the various other implementations. This commit gets rid of the
string-concatenate-and-split behaviour in favour of a proper object that
has predicates for testing all the different kinds of request that might
be made against S3.
2025-04-02 05:49:50 +11:00
Patrick Doyle
b8c70ae36d
Custom getCallerClass in entitlement bridge (#125139) 2025-04-01 14:45:12 -04:00
Jack Conradson
24e4887748
Remember extraneous Painless code (#126057)
This removes some leftover remnants from using StringBuilder 
as part of String concatenation. Since we no longer support JDK 8, 
this code can be safely removed.
2025-04-01 11:41:54 -07:00
Joe Gallo
5c9cdeeb87
Bump junit and hamcrest (#126055) 2025-04-01 14:05:58 -04:00
elasticsearchmachine
e9c35547fa Mute org.elasticsearch.xpack.security.authz.RBACEngineTests testGetRoleDescriptorsIntersectionForRemoteClusterHasDeterministicOrderForIndicesPrivileges #126061 2025-04-02 04:59:24 +11:00
Colleen McGinnis
d966938842
add missing mapped pages (#126054) 2025-04-01 19:41:37 +02:00
Mariusz Józala
78ee13fb29
Return null from transformer when not transforming (#125961) (#126041)
The transform API for instrumentation should return null when no
transformation occurs. This commit fixes our entitlement transformer to
return null instead of the original buffer.

Co-authored-by: Ryan Ernst <ryan@iernst.net>
2025-04-01 09:07:29 -07:00
Samiul Monir
d8ae61e91f
[Semantic Text] Integration Test (#125141)
* Initial draft test with index version  setup

* Adding test in phases

* [CI] Auto commit changes from spotless

* Adding test for search functionality

* Adding test for highlighting

* Adding randomization during selection process

* Fix code styles by running spotlessApply

* Fix code styles by running spotlessApply

* Fixing forbiddenAPIcall issue

* Decoupled namedWritables to use separate fake plugin and simplified other override methods

* Updating settings string to variable and removed unused code

* Fix SemanticQueryBuilder dependencies

* fix setting maximum number of tests to run

* utilizing semantci_text index version param and removed unwanted override

---------

Co-authored-by: elasticsearchmachine <infra-root+elasticsearchmachine@elastic.co>
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2025-04-01 09:42:50 -06:00
Benjamin Trent
6415e142ba
unmuting test #125902 (#126043)
fixed by: https://github.com/elastic/elasticsearch/pull/125877

closes: https://github.com/elastic/elasticsearch/issues/125902
2025-04-02 02:26:34 +11:00
Ioana Tagirta
0a4ea188b6
Remove QueryBuilderResolver (#125955) 2025-04-01 16:55:32 +02:00
Colleen McGinnis
0e537325fc
[docs] Remove as many redirects as possible (#125663)
* remove as many assembler-related redirects as possible

* Update docs/redirects.yml

* delete more unused temp redirects

* remove more redirects

* remove all redirects to see remaining errors
2025-04-01 16:53:59 +02:00
Nikolaj Volgushev
3be4fb199c
[Failure Store] Manage-style privileges grant both data and failures access (#125900)
It's more natural for `manage` and `manage_data_stream_lifecycle` to
grant access to management style APIs both for regular data streams and
their failure stores.

This PR adds support for privileges to grant access to both data and
failures selectors (without granting access to everything, à la `all`),
and extends `manage` and `manage_data_stream_lifecycle` to grant failure
store access, in addition to regular data stream access.
`manage_failure_store` still grants failures-only access.
2025-04-02 01:46:30 +11:00
Niels Bauman
a97e006454
Fix data stream retrieval in DataStreamLifecycleServiceRuntimeSecurityIT (#125667)
This test seemed to fail because we would index another document before
the master processed the data stream rollover - which is possible
because non-master nodes expose the next cluster state a little bit
earlier than the master node.

Caused by #122852

Fixes #124978
2025-04-01 14:57:36 +01:00
David Kyle
c521264815
[ML] Delay copying chunked input strings (#125837)
The chunked text is only required when the actual inference request is made, 
using a string supplier means the string creation can be done much much closer 
to where the request is made reducing the lifespan of the copied string.
2025-04-01 14:53:54 +01:00
Craig Taverner
7b263b4b83
Kibana updates, remove links from JSON and split is-null/is-not-null (#125986)
In particular:
* Remove all links (both asciidoc and markdown) from the JSON definition files.
  * This required a two phase edit, from asciidoc links to markdown, and then removal of markdown (replace with markdown text). This is because the asciidoc does not have the display text, and because some links were already markdown.
* Split predicates into is_null and is_not_null
  * We kept the old combined version because the main docs still use that, so now we have both combined and separate versions, and Kibana can select the version they want.
2025-04-01 15:46:24 +02:00
David Kyle
d3a1b21a59
[ML] Move Inference Service account classes into the service package (#125928) 2025-04-01 14:38:24 +01:00
elasticsearchmachine
a45d7941de Mute org.elasticsearch.action.RejectionActionIT testSimulatedSearchRejectionLoad #125901 2025-04-02 00:26:40 +11:00
조혜온
89adec154c
[ML] Resolve duplicate key exception in GetDatafeedRunningStateAction (#125477) 2025-04-01 14:16:17 +01:00
David Kyle
fc933d436a
[ML] Remove InferenceServiceResults#transformToLegacyFormat (#125924) 2025-04-01 13:49:48 +01:00
Ben Chaplin
610ba2305a
Update renamed MockLog class (#125971) 2025-04-01 08:46:43 -04:00
Nikolaj Volgushev
4f019d15cc
[Failure Store] Authorization denial messages (#125757)
This PR makes authorization denial messages account for privileges that
grant access to the failure store. This is a minimal implementation that
only displays information around failure store privileges for requests
that include concrete names with the `::failures` selector. This avoids
including irrelevant information in regular non-failures requests. We
can improve on this in follow ups. 

Closes: ES-11158
2025-04-01 22:29:20 +11:00
Ioana Tagirta
fd1c008c35
Enable semantic search in FORK (#125960) 2025-04-01 13:10:50 +02:00
David Kyle
3fbcb3cf9a
[ML] Add job id to reverting snapshot message (#126025) 2025-04-01 12:03:56 +01:00
Jim Ferenczi
42b7b78a31
[ES|QL] Infer the score mode to use from the Lucene collector (#125930)
This change uses the Lucene collector to infer which score mode to use
when the topN collector is used.
2025-04-01 11:52:27 +01:00
Niels Bauman
8028d5adde
Fix cat allocation YAML test (#126003)
This test failed when the `disk.indices.forecast` value was a decimal number.
We adjust the regex to allow decimal values and for consistency we also allow negative values.

Fixes #125711
Fixes #125848
Fixes #125661
2025-04-01 11:25:13 +01:00
Slobodan Adamović
c864c6c3ec
Return failure store privileges via get built-in privileges API (#125852)
Return `read_failure_store` and `manage_failure_store` via 
`GET /_security/privilege/_builtin` API.
2025-04-01 10:40:39 +02:00
Ievgen Degtiarenko
8bbd47404e
Speedup field exists check (#125943) 2025-04-01 10:37:57 +02: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
elasticsearchmachine
61d92d6613 Mute org.elasticsearch.packaging.test.DockerTests test021InstallPlugin #116147 2025-04-01 10:50:52 +11: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
elasticsearchmachine
e6096a2ed8 Mute org.elasticsearch.search.SearchServiceSingleNodeTests testSlicingBehaviourForParallelCollection #125899 2025-04-01 08:28:00 +11:00
Mark Vieira
66ba3c2a53
Convert CCR module tests to new testing framework (#125894) 2025-03-31 14:16:19 -07:00
Mark Tozzi
70de5a82b4
Esql - add capability checks (#125987)
Add some capability checks that should resolve the CI failures around these tests.
2025-03-31 16:50:24 -04:00
Keith Massey
7a9edb5d95
Adding a cleanup method to EnterpriseGeoIpDownloaderIT (#125958) 2025-03-31 14:28:14 -05:00
Mark Vieira
421392af99
Convert more x-pack modules to new test framework (#125874) 2025-03-31 12:27:11 -07:00
Rene Groeschke
511c50967d
[CI] Fix LegacyYamlRestTestPluginFuncTest failure for not available java toolchain (#125976)
Wire in toolchain plugins into AbstractRestResourcesFuncTest to allow
resolving jdk

fixes #125534 , #125533 ,  #125532, #125531
2025-04-01 05:30:49 +11:00
Mark Vieira
e75891e49a
Convert x-pack fleet project to new test framework (#125743) 2025-03-31 10:30:38 -07:00
elasticsearchmachine
228d5e1ecb Mute org.elasticsearch.xpack.test.rest.XPackRestIT test {p0=transform/transforms_stats/Test get transform stats with timeout} #125975 2025-04-01 04:13:41 +11:00
Ryan Ernst
425cb70d50
Return null from transformer when not transforming (#125961)
The transform API for instrumentation should return null when no
transformation occurs. This commit fixes our entitlement transformer to
return null instead of the original buffer.

closes #125920
2025-03-31 18:09:11 +01:00
Iraklis Psaroudakis
11942e82ab
Introduce permitAcquired in ensureMutable (#125801)
Relates ES-11159
2025-03-31 19:38:36 +03:00
Rene Groeschke
f79ff970ea
Ignore Fips docker images in packages tests for now (#125942)
* Ignore Fips docker images in packages tests for now

Handled in a later work package

* Fix typo
2025-03-31 18:23:26 +02:00
elasticsearchmachine
9b7ee210d3 Mute org.elasticsearch.xpack.ilm.actions.SearchableSnapshotActionIT testResumingSearchableSnapshotFromPartialToFull #125789 2025-04-01 02:41:35 +11: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
Stanislav Malyshev
242a195ad8
Unmute CrossClusterAsyncQueryStopIT tests (#125895) 2025-03-31 16:06:35 +01:00
Keith Massey
939dc8bb8e
Re-enabling EnterpriseGeoIpDownloaderIT with verbose logging (#125884) 2025-03-31 09:47:53 -05:00
Mark Tozzi
f37564d938
Lower logging level (#125940)
In #125595 I accidentally left some logging at WARN level; this PR corrects that to TRACE.
2025-03-31 14:58:45 +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
elasticsearchmachine
be9ebd0084 Mute org.elasticsearch.xpack.esql.action.ManyShardsIT testCancelUnnecessaryRequests #125947 2025-04-01 00:46:24 +11:00
David Turner
6048d26990
Rename IgnoreNoResponseMetricsCollector (#125934)
Originally this metrics collector was just there to ignore API calls
that didn't make it all the way to S3, but (a) it doesn't really do that
because it also apparently ignores 4xx responses and (b) it also does a
bunch of other metrics collection too. `IgnoreNoResponseMetricsCollector`
is definitely the wrong name these days so this commit renames it to
something more general.
2025-03-31 14:32:38 +01:00
Benjamin Trent
505f21ba42
Simplify tests, bypassing raw score test (#125877)
I was debating on having this tests in the original PR anyways. It ain't
worth the flakiness. We know the oversampling setting gets updated given
the other tests.

closes: https://github.com/elastic/elasticsearch/issues/125851
2025-03-31 23:49:29 +11:00
Ievgen Degtiarenko
2ce2fdabaf
Make rule initialization static (#125590) 2025-03-31 14:27:59 +02:00
Rene Groeschke
611f5cba4f
[BUILD] Support AARCH64 for docker fips images (#125927)
This updates the docker fips base image which support arm and x84
architectures
2025-03-31 22:41:04 +11: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
Niels Bauman
fd6ae3dfae
Properly fix data stream retrieval in TimeSeriesDataStreamsIT (#125815)
This test could still fail by consecutive API calls hitting different
nodes with different versions of the cluster state.

Follow-up of #125621

Fixes #125752
2025-03-31 11:17:12 +01:00
Rene Groeschke
daec775fbc
[Test] Revisit usage of default distro for logsdb rest tests (#125898) 2025-03-31 12:11:54 +02:00
Jim Ferenczi
55827946a4
[ML] Fix ModelRegistryMetadataTests intermittent failures (#125883)
unmute test
2025-03-31 10:44:35 +01:00
Slobodan Adamović
1f7e26c1f7
[Failure Store] Prevent explicit selectors in role index name patterns (#125843)
Adding basic validation to prevent using `::` selectors when defining index permissions.
Index names do not allow colon character (`:`), hence the index name patterns that
would include double colon (`::`), would never match any of the index names. 
To avoid confusion, we are preventing using `::` in role index name patterns.  

For example, the `test-*::failures` will be rejected during `test-role` validation:

```
PUT /_security/role/test-role
{
    "indices": [
        {
            "names": ["test-*::failures"],
            "privileges": ["read"]
        }
    ]
}
```
2025-03-31 11:30:48 +02:00
Mariusz Jozala
1cb9084ca7 Merge patch/serverless-fix into main 2025-03-31 11:23:02 +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
elasticsearchmachine
2aa53064a2 Mute org.elasticsearch.indices.stats.IndexStatsIT testThrottleStats #125910 2025-03-31 16:33:19 +11:00
elasticsearchmachine
509c11275b Mute org.elasticsearch.xpack.test.rest.XPackRestIT test {p0=ml/start_data_frame_analytics/Test start given dest index is not empty} #125909 2025-03-31 09:20:21 +11:00
elasticsearchmachine
994ff36a2e Mute org.elasticsearch.smoketest.SmokeTestMultiNodeClientYamlTestSuiteIT test {yaml=cat.allocation/10_basic/Node forecasts} #125848 2025-03-31 09:01:31 +11: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
elasticsearchmachine
ae727a11a2 Mute org.elasticsearch.multiproject.test.CoreWithMultipleProjectsClientYamlTestSuiteIT test {yaml=search.vectors/41_knn_search_bbq_hnsw/Test index configured rescore vector score consistency} #125902 2025-03-31 00:50:06 +11:00
elasticsearchmachine
a563966521 Mute org.elasticsearch.xpack.downsample.DataStreamLifecycleDownsampleDisruptionIT testDataStreamLifecycleDownsampleRollingRestart #123769 2025-03-31 00:26:47 +11: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
Mark Vieira
cdb6230329
Fix enterprise search yaml rest compatibility test 2025-03-28 15:38:42 -07:00
Brandon Morelli
74e4ce23e0
Update limitations.md (#125893) 2025-03-28 22:35:41 +01:00
Craig Taverner
98a2c711f8
Refine ESQL docs handling of applies_to (#125835)
This primarily splits the old preview:true warning from the newer applies_to approach. Since all of our current applies_to examples are actually just behaviour modifications of current functions, we do not use the official docs {applies_to} syntax. However there is code to make use of that in the case where we have an entirely new function which will appear in a new version.

Co-authored-by: Alexander Spies <alexander.spies@elastic.co>
2025-03-28 22:09:15 +01:00
Larisa Motova
b4f534cb25
[ES|QL] Fix sorting when aggregate_metric_double present (#125191)
Previously if an aggregate_metric_double was present amongst fields and
you tried to sort on any (not necessarily even on the agg_metric itself)
field in ES|QL, it would break the results.

This commit doesn't add support for sorting _on_ aggregate_metric_double
(it is unclear what aspect would be sorted), but it fixes the previous
behavior.
2025-03-28 10:16:26 -10: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
Bogdan Pintea
1bd80d10a6
ESQL: supplement docs on LIMIT (#125839)
This adds a few extra details around how ESQL processes input docs and
how it limits output results.

Closes #125819
2025-03-29 06:03:27 +11:00
Mayya Sharipova
332abe4198
[DOCS] Clarify that min_score applies to aggs (#125882)
Clarify that min_score param of a search request
also applies to aggregations.
2025-03-28 14:41:14 -04: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
elasticsearchmachine
a02241b252 Mute org.elasticsearch.xpack.inference.registry.ModelRegistryMetadataTests testUpgrade #125554 2025-03-29 04:22:15 +11:00
Carlos Delgado
7cddef951e
Non existing synonyms sets do not fail shard recovery (#125659) (#125865)
(cherry picked from commit 968bddc462)
2025-03-28 18:05:47 +01:00
David Kyle
9f4db73435
[ML] Move Inference Service Action classes into the service package (#125567) 2025-03-28 17:56:44 +01:00
Mark Vieira
3ac0c136aa
Convert enterprise search module to new testing framework (#125807) 2025-03-28 09:07:00 -07:00
elasticsearchmachine
7a0de676ad Mute org.elasticsearch.xpack.ilm.TimeSeriesDataStreamsIT testSearchableSnapshotAction #125867 2025-03-29 03:03:51 +11:00
elasticsearchmachine
f786f49af1 Mute org.elasticsearch.xpack.core.common.notifications.AbstractAuditorTests testRecreateTemplateWhenDeleted #123232 2025-03-29 03:02:38 +11:00
Colleen McGinnis
adccaa66a4
remove reliance on redirects in docs-content (#125863) 2025-03-28 16:41:38 +01: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
Mark Tozzi
27ebb14722
ESQL - CSV tests for invalid ranges (#125714)
Add CSV tests for invalid ranges (i.e. where the lower bound is greater than the upper bound) for several data types. It looks at first glance like there should be a bug here with Date Nanos, but I cannot trigger one, and analysis suggests the code that has the bug is in fact unreachable. I've left comments to that effect.
2025-03-28 16:10:00 +01: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
elasticsearchmachine
9b041afa0d Mute org.elasticsearch.xpack.test.rest.XPackRestIT test {p0=transform/transforms_start_stop/Verify start transform creates destination index with appropriate mapping} #125854 2025-03-29 01:32:52 +11:00
Andrei Dan
b942e5847a
Add shard routing and state transitions logging to testFilterCacheStats (#125836) 2025-03-28 14:14:18 +00:00
elasticsearchmachine
35bf0fe808 Mute org.elasticsearch.test.rest.yaml.RcsCcsCommonYamlTestSuiteIT test {p0=search.vectors/41_knn_search_bbq_hnsw/Test index configured rescore vector score consistency} #125851 2025-03-29 00:47:27 +11:00
Slobodan Adamović
dc48439303
[Failure Store] Test FLS/DLS access to failure store (#125792)
More test coverage for FLS/DLS over failure store indices.
2025-03-29 00:36:14 +11:00
elasticsearchmachine
75e6dca4d1 Mute org.elasticsearch.index.engine.ThreadPoolMergeExecutorServiceTests testIORateIsAdjustedForRunningMergeTasks #125842 2025-03-29 00:28:40 +11:00
Mary Gouseti
1943844d5a
Effort to fix testDataStreamLifecycleDownsampleRollingRestart #123769 (#125478) 2025-03-28 15:26:09 +02:00
David Kyle
67798dd25b
[ML] Fix ModelRegistryMetadataTests (#125756) 2025-03-28 13:40:53 +02: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
Alexander Spies
ea98166919
ESQL: Improve LOOKUP JOIN page (#125688) (#125798)
Forward port of #125688
2025-03-28 09:07:28 +01:00
Nick Tindall
7eb865473e
Unmute GCSRepositoryAnalysisRestIT (#125825) 2025-03-28 19:02:51 +11:00
David Turner
2d4fb76267
Improve randomIdentifier usage in AWS tests (#125775)
Adds prefixes to various randomly-generated values to make it easier to
pin down where they're coming from in debugging sessions. Also forces
the STS expiry time to be rendered in UTC.
2025-03-28 18:33:05 +11: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
a25677371a
Revert "Upgrade to latest GCS SDK (#124062)" (#125748)
This reverts commit 073ca0e888.
2025-03-28 17:49:30 +11:00
elasticsearchmachine
27a389d54a Mute org.elasticsearch.xpack.test.rest.XPackRestIT test {p0=transform/transforms_start_stop/Test schedule_now on an already started transform} #120720 2025-03-28 16:46:37 +11:00
elasticsearchmachine
51ed156f09 Mute org.elasticsearch.repositories.blobstore.testkit.analyze.GCSRepositoryAnalysisRestIT testRepositoryAnalysis #125668 2025-03-28 16:43:59 +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
Niels Bauman
9314613678
Unmute #123202 (#125811)
This test failure was already fixed by #124319 but wasn't unmuted yet.
2025-03-28 11:02:05 +11:00
Lee Hinman
de4994de9e
Fix ILMHistoryItemTests.testTruncateLongError (#125814)
It should work independent of how many characters are truncated now.

Resolves #125216
2025-03-28 09:55:50 +11:00
Fang Xing
a0dce5c005
[ES|QL] Take double parameter markers for identifiers out of snapshot (#125690)
* take double parameter markers out of snapshot
2025-03-27 18:36:54 -04:00
Joe Gallo
d12a662a98
Use a custom cache record for EnterpriseResponse (#125809) 2025-03-27 17:15:52 -04:00
Joe Gallo
37f6ebe560
Use a custom cache record for CityResponse (#125806) 2025-03-27 16:07:40 -04:00
Craig Taverner
f64efbd242
Use PLATINUM as license level for spatial features (#125802)
The random license selection in
https://github.com/elastic/elasticsearch/pull/125584 was incorrectly
assuming ENTERPRISE was needed, when it should have been PLATINUM. This
resulted in occasional test failures (expected to fail on PLATINUM, and
succeeded).

Fixes #125734
2025-03-28 06:18:02 +11:00
Mark Vieira
0c50403ebb
Migrate x-pack core module to new testing framework (#125740) 2025-03-27 10:13:29 -07: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
James Baiera
dcfe0536d5
Add validation step to quoted join query construction (#125731)
* Add validation step to quoted join query construction

* Fix double validation
2025-03-27 12:37:33 -04:00
David Kyle
800e312493
[ML] Check if the anomaly results index has been rolled over (#125404) (#125786)
If the v7 index has already been rolled over don't try again
2025-03-28 03:22:20 +11:00
Carlos Delgado
968bddc462
Non existing synonyms sets do not fail shard recovery (#125659) 2025-03-27 18:04:20 +02:00
Dimitris Rempapis
6a9d765408
Minor-Fixes Support 7x segments as archive in 8x / 9x (#125666)
Minor fixes to support 7x segments as archive in 8x / 9x
2025-03-27 16:28:23 +02:00
elasticsearchmachine
9a500be815 Mute org.elasticsearch.xpack.esql.spatial.SpatialExtentAggregationNoLicenseIT testStExtentAggregationWithPoints #125735 2025-03-28 01:26:53 +11:00
Nikolaj Volgushev
fa46aabb3b
[Failure Store] Access for internal users (#125660)
This PR grants `manage_failure_store` to the internal user
`_data_stream_lifecycle` to enable life-cycle management for the failure
indices of data stream, which includes rollovers using the failures
selector.

I'm only unit testing this but we also need to add DLM tests for the
failure store with security enabled. 

Relates: ES-11355
2025-03-28 01:17:21 +11:00
Benjamin Trent
d84eb1f53f
Update bbq test data to better distinguish docs (#125705)
Adjust the test data. I verified that the scores are now more
distinguishable when:

 - each doc has its own segment
 - when 1 & 2 are in the same segment but 3 is alone
 - 2 & 3 in the same segment but 1 alone
 - 1 & 3 in the same segment but 2 alone
 - all three in the same segment

closes: https://github.com/elastic/elasticsearch/issues/123727 closes:
https://github.com/elastic/elasticsearch/issues/124848
2025-03-28 00:12:56 +11:00
Rene Groeschke
b476ee19b5
Try fixing mutedTest.yml file not found (#125763) 2025-03-27 13:31:52 +01:00
Mary Gouseti
1ac5dfa96a
Fix p0=deprecation/10_basic/Test Deprecations (#125687)
In #120505 we introduced a capabilities check in the yaml test `deprecation/10_basic/Test Deprecations` but we forgot to add them in the `RestDeprecationInfoAction`.

In this PR we add the capabilities which will enable the test and we make the test resilient to the warning that occurs when the `.security-7` index is present.
2025-03-27 13:56:01 +02:00
Pooya Salehi
e397ed3e5f
Move MergeMemoryEstimator (#125686)
Relates ES-10961
2025-03-27 13:32:19 +02:00
Rene Groeschke
9dd0228990
Fix fips tests (#125754)
reported as broken due to issue in gradle setup
2025-03-27 21:31:50 +11: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
David Turner
36c14bf3a5
Validate region/service in DynamicAwsCredentials (#125671)
Following on from #125559, we can validate the region and service name
in tests that use `DynamicAwsCredentials` too.
2025-03-27 06:14:40 +00:00
elasticsearchmachine
8820823978 Mute org.elasticsearch.test.rest.ClientYamlTestSuiteIT test {yaml=cat.allocation/10_basic/Node forecasts} #125661 2025-03-27 16:38:09 +11:00
elasticsearchmachine
2826f37a2e Mute org.elasticsearch.index.engine.ThreadPoolMergeSchedulerStressTestIT testMergingFallsBehindAndThenCatchesUp #125744 2025-03-27 11:34:12 +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
Nhat Nguyen
b882e76a9a
Fix channels in TimeSeriesAggregationOperator (#125736)
Fix the channel in TimeSeriesAggregationOperator.

Relates #125537
2025-03-26 16:53:45 -07:00
Mark Vieira
cb44d7a727
Bump test cluster startup timeout back to 5 minutes 2025-03-26 16:26:20 -07:00
Mark Vieira
e149a3e10d
Convert :test projects to new testing framework (#125724) 2025-03-26 16:11:50 -07: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
David Turner
83c0ca14f7
Exercise multi-part uploads in S3 repo analysis tests (#125669)
Extends the max blob size to 10MiB, and sets the buffer size to 5MiB, to
ensure that sometimes the S3 repo analysis tests will create blobs using
the multipart upload flow.
2025-03-26 21:43:48 +00:00
David Turner
60bd75d71f
Generalize S3HttpHandler request matching (#125670)
The pattern-matching in `S3HttpHandler` is overly specific and carefully
crafted to handle the exact requests that the AWS SDK v1 makes. It turns
out that the AWS SDK v2 makes requests that are slightly different. This
commit generalizes the pattern-matching to handle both SDKs.
2025-03-26 21:41:01 +00:00
elasticsearchmachine
937bcd9f51 Mute org.elasticsearch.xpack.migrate.action.ReindexDataStreamTransportActionIT testAlreadyUpToDateDataStream #125727 2025-03-27 08:32:13 +11:00
Mark Vieira
930b4ab995
Convert remaining plugin projects to new test clusters framework (#125626) 2025-03-26 13:44:07 -07: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
Fang Xing
80125a4bac
[ES|QL] Make numberOfChannels consistent with layout map by removing duplicated ChannelSet (#125636)
* make numberOfChannels consistent with layout
2025-03-26 14:51:23 -04:00
Craig Taverner
220f4c432d
Add integration tests that verify ST_EXTENT_AGG needs a license (#125584) 2025-03-26 19:50:18 +01:00
elasticsearchmachine
52245d0600 Mute org.elasticsearch.backwards.MixedClusterClientYamlTestSuiteIT test {p0=cat.allocation/10_basic/Node forecasts} #125711 2025-03-27 05:41:39 +11:00
Larisa Motova
10719831b5
[ES|QL] Add ToAggregateMetricDouble example (#125518)
Adds AggregateMetricDouble to the ES|QL CSV tests and examples of how to
use the ToAggregateMetricDouble function
2025-03-26 07:56:48 -10: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
5cfe3cba9d
Convert ingest-geoip file based update tests to new testing framework (#125632) 2025-03-26 10:42:45 -07:00
Mark Vieira
0388a5980c
Migrate legacy QA projects to new test clusters framework (#125545) 2025-03-26 10:05:56 -07:00
elastic-renovate-prod[bot]
2204b4a13c
Update docker.elastic.co/wolfi/chainguard-base:latest Docker digest to c4e10ec (#124565)
This PR contains the following updates:

| Package | Update | Change | |---|---|---| |
docker.elastic.co/wolfi/chainguard-base | digest | `15a4191` ->
`c4e10ec` |

---

### Configuration

📅 **Schedule**: Branch creation - "after 1pm on tuesday" (UTC),
Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once
you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Renovate
Bot](https://redirect.github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzOS4xMDcuMCIsInVwZGF0ZWRJblZlciI6IjM5LjEwNy4wIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyI6RGVsaXZlcnkvUGFja2FnaW5nIiwiPm5vbi1pc3N1ZSIsIlRlYW06RGVsaXZlcnkiLCJhdXRvLW1lcmdlLXdpdGhvdXQtYXBwcm92YWwiXX0=-->
2025-03-27 04:01:35 +11:00
Stanislav Malyshev
07921a78a6
Handle long overflow in dates (#124048)
* Handle long overflow in dates
2025-03-26 18:57:04 +02:00
Joe Gallo
8857ebf95e
Refactor geoip cache for MaxMind databases (#125527) 2025-03-26 12:52:57 -04:00
Bogdan Pintea
b6b8159ed9
SQL: Docs: Drop examples of LIKE/RLIKE vs QUERY/MATCH equivalence (#125673)
This drops the examples of LIKE/RLIKE vs QUERY/MATCH equivalence.
2025-03-27 03:28:38 +11:00
elasticsearchmachine
7c6427ffb3 Mute org.elasticsearch.xpack.ilm.actions.SearchableSnapshotActionIT testSearchableSnapshotsInHotPhasePinnedToHotNodes #125683 2025-03-27 03:01:51 +11:00
Karen Metts
f0168b4b84
Doc: Update links to logstash plugin docs (#125675)
* Add logstash plugin repo to cross_links
2025-03-26 11:54:37 -04:00
elasticsearchmachine
756860e157 Mute org.elasticsearch.packaging.test.DockerTests test010Install #125680 2025-03-27 02:47:55 +11:00
Mark Vieira
d72d81a0eb
Convert remaining module projects to new test clusters framework (#125613) 2025-03-26 08:42:55 -07:00
Rene Groeschke
653c179b08
[Build] Add FIPS docker image for GovCloud (#117152)
- Adds docker image based on chainguard base fips image
- x86 only for now as the base image is x86 only
- the image does not provide any elasticsearch.yml configuration. for testing purposes you can follow the elasticsearch fips guide available at https://github.com/elastic/FIPSGuide/tree/main/elasticsearch

The image is shipped with:
- org.bouncycastle:bc-fips:1.0.2.5 and org.bouncycastle:bctls-fips:1.0.19 in Elasticsearch libs folder
- config/jvm.options.d/fips.options for fips specific JVM options
- fips_java.security file
- fips_java.policy

Out of scope:
- Add packaging test coverage (part of later PR as we want to provide that image for testing early and packaging tests require more general restructuring for support fips scenarios)
2025-03-26 16:15:15 +01:00
David Kyle
5778b76cb9
[ML] Fix auditor test failures (#125038) 2025-03-26 17:09:53 +02:00
elasticsearchmachine
540f90e837 Mute org.elasticsearch.repositories.blobstore.testkit.analyze.GCSRepositoryAnalysisRestIT testRepositoryAnalysis #125668 2025-03-27 00:48:16 +11:00
Ioana Tagirta
ebc13531ac
Speed up LuceneTopNSourceOperator (#125622) 2025-03-26 14:02:29 +01:00
Nikolaj Volgushev
0e0214dcc2
[Failure Store] Has Privileges API (#125329)
This PR adds support for checking access to the failure store via the
Has Privileges API.

To check access for a data stream `logs`, a request must query for a
concrete named privilege, `read_failure_store` or
`manage_failure_store`, e.g., a request to the HasPrivileges API by a
user with `read_failure_store` over `logs`:

```
POST /_security/user/_has_privileges
{
    "index": [
        {
            "names": ["logs"],
            "privileges": ["read_failure_store", "read", "indices:data/read/*"]
        }
    ]
}
``` 

Returns:
```

{     "username": "<...>",     "has_all_requested": false,    
"cluster": {},     "index": {         "logs": {            
"read_failure_store": true,             "read": false, <1>            
"indices:data/read/*": false <2>         }     },     "application": {}
}

```
Note that `<1>` and `<2>` are both `false` since `read` is not covered by `read_failure_store` and neither are any raw actions like `indices:data/read/*` since these implicitly correspond to data access. 

Selectors are not allowed in the index patterns of HasPrivileges requests to avoid ambiguities such as checking `read` on `logs::failures` as well as the ambiguity of index patterns that are regular expressions.
2025-03-26 23:20:57 +11:00
Niels Bauman
3d9a7abb84
Fix data stream retrieval in DataStreamAndIndexLifecycleMixingTests (#125609)
These tests had the potential to fail when two consecutive GET data
streams requests would hit two different nodes, where one node already
had the cluster state that contained the new backing index and the other
node didn't yet.

Caused by #122852

Fixes #124837
Fixes #124849
Fixes #124850
Fixes #124886
Fixes #125083
2025-03-26 13:51:18 +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
Niels Bauman
0405fb088c
Fix data stream retrieval in TimeSeriesDataStreamsIT (#125621)
This test had the potential to fail when two consecutive GET data
streams requests would hit two different nodes, where one node already
had the cluster state that contained the new backing index and the other
node didn't yet.

Caused by #122852

Fixes #124987
2025-03-26 10:34:11 +00:00
Niels Bauman
8b691db436
Fix data stream retrieval in ExplainDataStreamLifecycleIT (#125611)
These tests had the potential to fail when two consecutive GET data
streams requests would hit two different nodes, where one node already
had the cluster state that contained the new backing index and the other
node didn't yet.

Caused by #122852

Fixes #124882
Fixes #124885
2025-03-26 10:33:33 +00:00
Tommaso Teofili
7a610c30fd
[docs] nested knn only supports score_mode max (#125582)
* [docs] nested knn only supports score_mode max
2025-03-26 11:31:43 +01:00
Nikolaj Volgushev
722a1b427a
[Failure Store] Feature-flag test (#125591)
Closes: https://github.com/elastic/elasticsearch/issues/12555
2025-03-26 21:15:24 +11: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
Rene Groeschke
4de4ec1d4c
Resolve bwc dependencies for packer cache (#125625) 2025-03-26 09:59:37 +01:00
elasticsearchmachine
16441fe3b3 Mute org.elasticsearch.smoketest.MlWithSecurityIT test {yaml=ml/data_frame_analytics_cat_apis/Test cat data frame analytics single job with header} #125642 2025-03-26 18:38:51 +11:00
elasticsearchmachine
a19d4696f8 Mute org.elasticsearch.smoketest.MlWithSecurityIT test {yaml=ml/data_frame_analytics_cat_apis/Test cat data frame analytics all jobs with header and column selection} #125641 2025-03-26 18:22:23 +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
elasticsearchmachine
419052ff67 Mute org.elasticsearch.index.engine.ThreadPoolMergeSchedulerTests testMergeSourceWithFollowUpMergesRunSequentially #125639 2025-03-26 16:58:44 +11: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
Yang Wang
6be0bf50bb
Minor update to interal distributed guide for multi-project (#125556)
This PR adds a minimal amount information about multi-project so that
the existing distributed guide is up-to-date.

Relates: https://github.com/elastic/elasticsearch/pull/123565 Resolves:
ES-10985
2025-03-26 12:48:20 +11:00
Nick Tindall
073ca0e888
Upgrade to latest GCS SDK (#124062)
Upgrades google cloud SDK used by repository-gcp to com.google.cloud:google-cloud-storage-bom:2.50.0

Closes: ES-9287
2025-03-26 11:08:14 +11:00
Keith Massey
13110d778b
Using a consistent index template name to avoid undefined behavior (#125624) 2025-03-26 01:00:27 +02:00
Keith Massey
6a74aba04d
Avoid restarting data stream reindex when cluster is upgraded (#125587) 2025-03-26 00:43:46 +02:00
Ryan Ernst
d4aa1e66de
Rename deprecation index template (#125606)
The dataset name for the deprecation logs index was previously renamed
from `deprecation.elasticsearch` to `elasticsearch.deprecation` in
order to follow the pattern of `product.group`. The deprecation index
template, however, was not updated. This causes indexing errors once
upgraded to 9.0 due to the dataset name having changed on a
constant_keyword field. In order to avoid that mismatch, this commit
renames the deprecation indexing datastream to match the dataset name.
The old template is kept in place, but marked as deprecated, so that any
deprecation logs written during upgrading to 9.x will continue to be
indexed into the old datastream.

closes #125445
2025-03-25 14:16:49 -07: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 Tozzi
2e6e71ac9b
Esql - Fix lucene push down behavior when a range contains nanos and millis (#125595)
Follow up to #125345. If the query contained both a nanos and a millis comparison, we were formatting the dates incorrectly for the lucene push down. This PR adds a test and a fix for that case.
---------

Co-authored-by: elasticsearchmachine <infra-root+elasticsearchmachine@elastic.co>
2025-03-25 21:22:08 +02: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
David Turner
8d649f2f07
Validate AWS signer region and service in tests (#125559)
Extends the predicate in `AwsCredentialsUtils` to verify that we are
using a proper AWS v4 signature complete with the correct region and
service, rather than just looking for the access key as a substring.
2025-03-26 02:53:21 +11:00
elasticsearchmachine
48d242fd4e Mute org.elasticsearch.smoketest.MlWithSecurityIT test {yaml=ml/data_frame_analytics_crud/Test get stats on newly created config} #121726 2025-03-26 02:33:45 +11:00
elasticsearchmachine
22c79a3de8 Prune changelogs after 8.17.4 release 2025-03-25 15:25:29 +00:00
elasticsearchmachine
37f5b1db92 Bump versions after 8.17.4 release 2025-03-25 15:23:21 +00:00
Nhat Nguyen
3f8055288b
Add time-series aggregation operator (#125537)
We will need custom logic in the time-series aggregation operator, such 
as smoothing the rate across buckets. To address this, this PR
introduces a TimeSeriesAggregationOperator that extends
HashAggregationOperator to support the addition logic.
2025-03-25 08:16:48 -07:00
elasticsearchmachine
2331051d36 Mute org.elasticsearch.xpack.security.authz.accesscontrol.IndicesPermissionTests testAuthorizeDataStreamFailureIndices #125555 2025-03-26 01:36:18 +11:00
elasticsearchmachine
a0670ab169 Mute org.elasticsearch.xpack.inference.registry.ModelRegistryMetadataTests testAlreadyUpgraded #125585 2025-03-26 01:17:54 +11:00
Simon Cooper
7f1203e472
Add panama implementations of byte-bit and float-bit script operations (#124722) 2025-03-25 13:59:11 +00:00
Ievgen Degtiarenko
11fed4502c
Improve StatementParserTests error message (#125568) 2025-03-25 14:23:18 +01:00
Iván Cea Fontenla
bd04d1fe1c
ESQL: Calculate concurrent node limit (#124901) 2025-03-25 13:59:36 +01:00
elasticsearchmachine
2b5200fac8 Prune changelogs after 8.16.6 release 2025-03-25 12:26:17 +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
Valeriy Khakhutskyy
2da0985e73
Improve log message of upgrade of primary job snapshots. (#125574)
Instruct users to close the job to proceed with upgrading primary snapshots.
2025-03-25 12:28:00 +01:00
Valeriy Khakhutskyy
d9008cd065
[ML] Increasing timeout for DFA integration tests #125510
Increase waiting time to prevent DFA integration tests from timing out.
2025-03-25 11:05:02 +01:00
Ievgen Degtiarenko
3b685cb27a
Fix test fail on unavailable shards resolver (#125096) 2025-03-25 09:59:10 +01:00
Rene Groeschke
be553e31be
Skip building 9.0.0 staging artifacts for now (#125563) 2025-03-25 09:31:48 +01:00
Colleen McGinnis
209bf8c3bb
[docs] update release note template language and titles (#125548) 2025-03-25 09:31:22 +01:00
Rene Groeschke
7e551ecba0
Remove version qualifier in 9.0.0 DRA build (#125561) 2025-03-25 09:03:32 +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
elasticsearchmachine
f461731a30 Mute org.elasticsearch.xpack.inference.registry.ModelRegistryMetadataTests testUpgrade #125554 2025-03-25 17:06:06 +11:00
Mark Tozzi
30a56d6e2c
ESQL - date nanos range bug? (#125345)
Fixes #125439

We were incorrectly formatting nanosecond dates when building lucene queries. We had missed this in our testing because none of the CSV tests were running against Lucene. This happened because the date nanos test data includes multivalue fields. Our warning behavior for multivalue fields is inconsistent between queries run in Lucene and queries run in pure ES|QL without pushdown. Our warning tests, however, require that the specified warnings be present in all execution paths. When we first built the date nanos CSV tests, we worked around this by always using an MV function to unpack the multivalue fields. But we forgot that using an MV function prevents the entire query from being pushed down to Lucene, and thus that path wasn't being tested.

In this PR, I've duplicated many of the tests to have a version that doesn't use the MV function, and uses warningRegex instead of warning. The regex version does not fail if the header is absent, so it's safe to use in both modes. Rewriting the tests this way revealed several situations in which this bug can manifest, all of which are fixed in this PR. I cannot be confidant that there aren't more paths that can trigger this bug and aren't covered by these tests, but I haven't found any yet.

I've left some trace level logging that I found helpful while debugging this.

---------

Co-authored-by: elasticsearchmachine <infra-root+elasticsearchmachine@elastic.co>
2025-03-25 00:23:39 +02:00
elasticsearchmachine
bab9edc232 Mute org.elasticsearch.xpack.esql.parser.StatementParserTests testInvalidJoinPatterns #125536 2025-03-25 08:38:55 +11:00
Colleen McGinnis
162763bd13
[docs] More updates for docs-assembler (#125509)
* update docset.yml, add reference/toc.yml, update reference/elasticsearch/index.md

* Update docs/docset.yml

* add index.md
2025-03-24 14:20:14 -05: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
Ryan Ernst
740d9833a8
Add --with-plugins to run task (#125468)
This commit adds a new command line option to the run task to include
plugins. The option takes in a comma separated list of plugins from the
plugins directory. For example:
```
./gradlew run --with-plugins=analysis-icu,analysis-nori
```
2025-03-24 10:39:07 -07:00
Alexander Spies
04d0a0ac5b
ESQL: Fix EsqlNodeSubclassTest failure from mutating (#125503)
We shouldn't mutate LogicalPlan.child().output() (or just
LogicalPlan.output()); we did so in RENAME, but only in
EsqlNodeSubclassTest, making them flaky.

>The PR at https://github.com/elastic/elasticsearch/pull/122250 seems to
have created a flaky test failure in `EsqlNodeSubclassTests`. Local runs
with `-Dtests.iters=100` lead to about two dozen failures in over 70k
tests run. This is not a high failure rate, but still requires
addressing. > >The single line added to the Analyzer by that PR causes
an `UnsupportedOperationException` on attempting to mutate an immutable
collection when running `EsqlNodeSubclassTests`. It turns out that this
code path comes from `Rename.output()` which is only called in test
scenarios. So a quick fix is to copy the child output into a mutable
collection.
2025-03-25 03:37:43 +11:00
Niels Bauman
e68587acb6
Process ILM cluster state updates on another thread (#123712)
Instead of processing cluster state updates on the cluster state applier
thread, we fork to a different thread where ILM's runtime of processing
the cluster state update does not affect the speed at which the cluster
can apply new cluster states. That does not mean we don't need to
optimize ILM's cluster state processing, as the overall amount of
processing is generally unaffected by this fork approach (unless we skip
some cluster states), but it does mean we're saving a significant amount
of processing on the critical cluster state applier thread.

Additionally, by running ILM's state processing asynchronously, we allow
ILM to skip some cluster states if the management thread pool is
saturated or ILM's processing is taking too long.
2025-03-24 17:13:57 +01:00
Nhat Nguyen
28bdb2483e
Optimize TimeSeriesBlockHash (#125461)
Since the data returned from time-series indices (shard-level) is sorted 
by tsid and timestamp, we can optimize the timeseries blockhash by
comparing the incoming tsid and timestamp only with the last values,
thus avoiding the need for lookups or internal hashes. Additionally, we
can reuse the internal large arrays when rebuilding key blocks.
2025-03-24 09:04:30 -07:00
Patrick Doyle
474563fbac
Unmute entitlements unit tests (#125217) 2025-03-24 17:52:16 +02:00
Tim Rühsen
4fcce51af7
[Profiling] Aggregate flamegraph by process name and thread name (#119115)
* Add field process.executable.name to profiling-events

* Amend query to aggregate events by executable name

* Send flamegraph row with grouping by executable name

* Flamegraph sub-aggregation by thread name

* Rework internal data model

* Cleanups

* Fix building tests

* Fix GetStackTracesResponseTests

* Fix unit tests

* Fix remaining unit tests

* [CI] Auto commit changes from spotless

* Fix flamegraph yaml tests

* Fix yaml REST tests

* Increase INDEX_TEMPLATE_VERSION for profiling.executable.name

* Fix yamlRestCompatTest

Co-authored-by: Jake Landis <jake.landis@elastic.co>

* Rename executable name to process name

* Remove warnings meant for testing

* Replace ChunkedToXContentHelper.wrapWithObject() with .object()

* Fix comment in ProfilingIndexTemplateRegistry.java

* Simplify sorting of unique stacktrace and host IDs

* [CI] Auto commit changes from spotless

* Add 'missing()' to aggregations

* Fix syntax error after resolving merge conflicts

* Revert "Rename executable name to process name"

This reverts commit e514874198.

* Set FRAMETYPE_EXECUTABLE to 0x103

* Fix TransportGetFlamegraphActionTests

---------

Co-authored-by: elasticsearchmachine <infra-root+elasticsearchmachine@elastic.co>
Co-authored-by: Jake Landis <jake.landis@elastic.co>
2025-03-24 16:51:22 +01:00
Niels Bauman
542a3b65a9
Fix data stream retrieval in DataStreamLifecycleServiceIT (#125195)
These tests had the potential to fail when two consecutive GET data
streams requests would hit two different nodes, where one node already
had the cluster state that contained the new backing index and the other
node didn't yet.

Caused by #122852

Fixes #124846
Fixes #124950
Fixes #124999
2025-03-24 17:43:09 +02:00
Stanislav Malyshev
669d400e1a
If there's no matching index to wildcard, list it as success (#125173)
* If there's no matching index to wildcard, list it as success
2025-03-24 09:30:59 -06:00
Alexander Spies
f8536aadda
ESQL: Add more details on ENRICH vs. LOOKUP JOIN to docs (#125487)
* Add more details on ENRICH vs. LOOKUP JOIN
* Move example, fix syntax formatting
2025-03-24 16:26:28 +01:00
Nik Everett
f83ca0c6b7
ESQL: Document warnings behavior in CsvTests (#125441)
The `CsvTests` has a slight difference regarding warnings from real
Elasticsearch indices and this is worth documenting. I've also added an
explanation to `SingleValueMatchQuery` that explains *exactly* when it
makes a warning because it's not *exactly* the same as when the compute
engine would make a warning. The resulting documents are the same - but
the warnings are not.
2025-03-24 17:02:23 +02:00
Joe Gallo
1078bd0c41
Optimize MlConfigVersion#getMinMaxMlConfigVersion (#125432) 2025-03-24 10:31:49 -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
Simon Cooper
da9ed5ae41
Re-enable SIMD operations on JDK 24 (#125484) 2025-03-24 13:13:15 +00:00
David Kyle
9ec61d52fb
[ML] Return a Conflict status code if the model deployment is stopped by a user (#125204) 2025-03-24 12:28:50 +00:00
Simon Cooper
ba2f7f606f
Remove old InvalidateApiKeyRequest transport versions (#118290) 2025-03-24 11:07:32 +00:00
Johannes Fredén
14fdc2868e
Fix testProcessMultipleChunks (#125304)
* Fix testProcessMultipleChunks
2025-03-24 11:36:25 +01:00
Simon Cooper
2ba9e9f8ed
Panama implementation of painless float-byte vector ops (#123270) 2025-03-24 10:30:52 +00:00
Ievgen Degtiarenko
eceb178cd7
Document plan execution across nodes (#125422) 2025-03-24 10:04:46 +01:00
Craig Taverner
8ffecb408d
Additional support for docs for ES|QL operators and version-specific differentiation (#125251)
This PR was originally focused on improving support for Kibana docs, in particular the missing operator docs, but it has expanded to cover a bunch of related things:

* Primarily the main work was to improve operators support. ESQL generated docs cover all functions and most operators for which their is a clear operator class and test class. However, some are built-in behaviour and need additional support. This PR adds more generated content for those operators.
* Various specific operators requested by Kibana: Cast & null-predicates, and in particular the addition of examples
* Two functions without examples: mv_append and to_date_nanos
* Many small visual document cleanups (spelling, grammar, capitalization, etc.)
* Initial support for `applies_to` for multi-version differentiation.

This last point requires more work, as it is not yet agreed on just how we want this to look. We'll probably need to do refinements in followup PR. Consider the version in this PR as a first step into how this could look.
2025-03-24 09:56:45 +01:00
Lorenzo Dematté
e0b7c8bdfc
[Entitlements] Print a warning during plugin installation if a legacy policy file is found (#125294)
This PR adds a check and a warning message if the user is trying to install a plugin containing the legacy plugin-security.policy used by SecurityManager.

Relates to ES-10846
2025-03-24 08:29:52 +01:00
Yang Wang
6c04abc68c
Fix compilation and tests for customAuthzEngine (#125469)
Relates: #123812
2025-03-24 12:03:06 +11:00
Rene Groeschke
59a55c85f3
[Gradle] Wire java toolchain plugin into integration tests (#125347)
* [Gradle] Wire java toolchain plugin into integration tests

This addresses transient issues we see in the integration tests where previously resolved jdk toolchain
is not available. See https://gradle-enterprise.elastic.co/s/66msrp7n2nsdy/tests/task/:build-tools-internal:integTest/details/org.elasticsearch.gradle.internal.test.rest.LegacyYamlRestTestPluginFuncTest/yamlRestTest%20executes%20and%20copies%20api%20and%20tests%20to%20correct%20source%20set\?top-execution\=1 for example

* Fix fix
2025-03-23 19:11:24 +01:00
Niels Bauman
f7d7ce7ccc
Run TransportGetDataStreamOptionsAction on local node (#125213)
This action solely needs the cluster state, it can run on any node.
Additionally, it needs to be cancellable to avoid doing unnecessary work
after a client failure or timeout.

Relates #101805
2025-03-22 16:18:28 +02:00
Niels Bauman
bbc47d9cad
Run TransportGetDataStreamLifecycleAction on local node (#125214)
This action solely needs the cluster state, it can run on any node.
Additionally, it needs to be cancellable to avoid doing unnecessary work
after a client failure or timeout.

Relates #101805
2025-03-22 13:00:47 +02:00
Niels Bauman
fdd453734d
Fix NPE in rolling over unknown target and return 404 (#125352)
Since #122905 we were throwing NPEs (i.e. 5xxs) when a rollover request has an unknown/non-existent target. Before that, we returned a 400 - illegal argument exception. We now return a 404 which matches "missing target" better. Additionally, to avoid this from happening again, we add a YAML test that asserts the correct exception behavior.
2025-03-22 12:59:13 +02:00
Armin Braun
50437e79d3
Cleanup missing use of StandardCharsets (#125424)
Random annoyance that I figured, I'd just fix globally:
We can do a bit of a cleaner job when doing byte <-> string conversion here and there.
2025-03-21 20:10:15 +01:00
Ryan Ernst
02f12c8e83
Move remaining check methods in RestEntitlementsCheckAction (#125351)
All future check methods should be found reflectively with the
EntitlementTest annotation.
2025-03-21 21:00:39 +02:00
Jeremy Dahlgren
d7995975d9
Add cache support in TransportGetAllocationStatsAction (#124898)
Adds a new cache and setting
TransportGetAllocationStatsAction.CACHE_TTL_SETTING
"cluster.routing.allocation.stats.cache.ttl" to configure the max age
for cached NodeAllocationStats on the master.  The default
value is currently 1 minute per the suggestion in issue 110716.

Closes #110716
2025-03-21 20:35:40 +02:00
Martijn van Groningen
adf1839079
Ensure the tsdb doc values codec is used in ES87TSDBDocValuesFormatTests (#125420)
Ensure `ES87TSDBDocValuesFormat` is used in `ES87TSDBDocValuesFormatTests`'s tests.
2025-03-21 19:27:06 +01:00
Jordan Powers
db7317513d
Fix offsets not recording duplicate values (#125354)
Previously, when calculating the offsets, we just compared the values as-is 
without any loss of precision. However, when the values were saved into doc 
values and loaded in the doc values loader, they could have lost precision.
This meant that values that were not duplicates when calculating the
offsets could now be duplicates in the doc values loader. This interfered
with the de-duplication logic, causing incorrect values to be returned.

My solution is to apply the precision loss before calculating the offsets,
so that both the offsets calculation and the SortedNumericDocValues
de-duplication see the same values as duplicates.
2025-03-21 20:26:18 +02:00
Nik Everett
c5e76847ad
ESQL: Keep ordinals in conversion functions (#125357)
Make the conversion functions that process `BytesRef`s into `BytesRefs`
keep the `OrdinalBytesRefVector`s when processing. Let's use `TO_LOWER`
as an example. First, the performance numbers:
```
  (operation)  Mode   Score   Error ->  Score    Error Units
     to_lower  30.662 ± 6.163 -> 30.048 ±  0.479 ns/op
to_lower_ords  30.773 ± 0.370 ->  0.025 ±  0.001 ns/op
     to_upper  33.552 ± 0.529 -> 35.775 ±  1.799 ns/op
to_upper_ords  35.791 ± 0.658 ->  0.027 ±  0.001 ns/op
```
The test has a 8192 positions containing alternating `foo` and `bar`.
Running `TO_LOWER` via ordinals is super duper faster. No longer
`O(positions)` and now `O(unique_values)`.

Let's paint some pictures! `OrdinalBytesRefVector` is a lookup table.
Like this:
```
+-------+----------+
| bytes | ordinals |
| ----- | -------- |
|  FOO  | 0        |
|  BAR  | 1        |
|  BAZ  | 2        |
+-------+ 1        |
        | 1        |
        | 0        |
        +----------+
```

That lookup table is one block. When you read it you look up the
`ordinal` and match it to the `bytes`. Previously `TO_LOWER` would
process each value one at a time and make:
```
bytes
-----
 foo
 bar
 baz
 bar
 bar
 foo
```

So it'd run `TO_LOWER` once per `ordinal` and it'd make an ordinal
non-lookup table. With this change `TO_LOWER` will now make:
```
+-------+----------+
| bytes | ordinals |
| ----- | -------- |
|  foo  | 0        |
|  bar  | 1        |
|  baz  | 2        |
+-------+ 1        |
        | 1        |
        | 0        |
        +----------+
```
We don't even have to copy the `ordinals` - we can reuse those from the
input and just bump the reference count. That's why this goes from
`O(positions)` to `O(unique_values)`.
2025-03-21 20:00:15 +02:00
Jim Ferenczi
0930a75642
Prevent default inference model to update the cluster state when deleting (#125369)
The Elastic inference service removes the default models at startup if the node cannot access EIS.
Since #125242 we don't store default models in the cluster state but we still try to delete them.
This change ensures that we don't try to update the cluster state when a default model is deleted
since the delete is not performed on the master node and default models are never stored in the cluster state.
2025-03-21 17:27:26 +00:00
Jim Ferenczi
775036622e
Set the level for zstd best speed to 1 (#125375)
This change sets the zstd best speed level from 0 to 1.
Compression level 0 means the default level will be used, which is level 3.
The intent of speed is to use the fastest compression level so 1 is a more appropriate value.
Note that zstd best speed is still under a feature flag so this change is just meant to evaluate the impact on our nightly benchmarks.
Further testing is needed (wip) to remove the feature flag entirely.
2025-03-21 17:26:27 +00:00
Nik Everett
e897a1422f
Aggs: Let terms run in global ords mode no match (#124782)
Allows the `terms` agg to run with global ords if the top level query
matches no docs *but* the agg is configured to collect buckets with 0
docs.
2025-03-21 13:00:25 -04:00
Pat Whelan
b8db0eee96
[ML] Refactor stream metrics (#125092)
Remove the use of DelegatingProcessor and replace it with an inline
processor.
2025-03-21 18:51:08 +02:00
Liam Thompson
397c9c59c7
Clarify regex character range case insensitivity limitations (#125413)
* Update regexp-syntax.md

9.x equivalent of https://github.com/elastic/elasticsearch/pull/125412

* use md syntax
2025-03-21 18:43:44 +02:00
Pat Whelan
76260267b0
[ML] Move and rename AmazonBedrockSecretSettings (#125323)
In preparation for integrating with SageMaker, we want to reuse the
existing SecretSettings.

- AmazonBedrockSecretSettings moved from services.amazonbedrock to
  common.amazon.
- AmazonBedrockSecretSettings was renamed to AwsSecretSettings.
- accessKey and secretKey are now encapsulated.
2025-03-21 16:00:58 +02:00
David Kyle
e0d4599dad
[ML] Add logging for ModelRegistry cluster state update failure (#125401) 2025-03-21 15:46:03 +02:00
David Turner
51d209ea5d
Record action name for all outbound messages (#125399)
On outbound messages we know the action name whether it's a request or
response, so we can report it in logs rather than just relying on the
payload's type.
2025-03-22 00:41:23 +11:00
David Turner
4ce1d9ce21
Cosmetic fixes to repository-s3 (#125397)
Relates AWS SDK v2 uprgade, this commit just pulls out some bits that
can go in first.
2025-03-21 13:31:48 +00:00
Jim Ferenczi
a26bbe25bf
Set default similarity for Cohere model to cosine (#125370)
Cohere embeddings are expected to be normalized to unit vectors, but due to floating point precision issues,
our check ({@link DenseVectorFieldMapper#isNotUnitVector(float)}) often fails.
This change fixes this bug by setting the default similarity for newly created Cohere inference endpoint to cosine.

Closes #122878
2025-03-21 12:23:26 +00:00
kanoshiou
1d6a77c7cb
ESQL: Fail in AggregateFunction when LogicPlan is not an Aggregate (#124446) 2025-03-21 13:13:24 +01:00
Armin Braun
9c8750bc8c
Stop retaining transport responses past serialization (#125163)
Remove the `OutboundMessage` class that needlessly holds on to the the response instances after they are not needed any longer. Inlining the logic should save considerably heap under pressure and enabled further optimisations.
2025-03-21 13:08:54 +01:00
Mary Gouseti
0d23976923
Handle patch from 8.19 about introducing data stream lifecycle template (#125374)
Update `TransportVersions` with the patched version from `8.19.0`: -
`main`: https://github.com/elastic/elasticsearch/pull/124593 - `8.19.0`:
https://github.com/elastic/elasticsearch/pull/125199
2025-03-21 22:31:41 +11:00
Dimitris Rempapis
9dfe7ab75f
Support 7x segments as archive in 8x / 9x (#119503)
Added BWCLucene8*Codecs wrapper classes for the  lucene8* equivalents. A BWC wrapper is initialized for archive indices and provides read-only capabilities for an index.
2025-03-21 12:32:01 +02:00
Nikolaj Volgushev
abd2bdd70e
Use Sets.newHashSetWithExpectedSize (#125327)
IJ complains about the static method not being available -- I don't see
a reason against using the regular constructor here instead.
2025-03-21 21:04:35 +11:00
Carlos Delgado
160ac698d7
ES|QL: Add default values for match function options (#125282) 2025-03-21 10:44:41 +01:00
Jim Ferenczi
0ff526aa84
BWC Handling for ModelRegistryMetadata (#125301)
ModelRegistryMetadata has now been backported to 8.19 via #125150. This update ensures that we properly differentiate between nodes running 8.19.x (which supports the new custom metadata) and 9.0.x (which does not).
To achieve this, this PR introduces a new `supportsVersion(TransportVersion)` method for `NamedWriteable` and `NamedDiff`, allowing subclasses to customize their backward compatibility behavior.
2025-03-21 09:28:11 +00:00
Tanguy Leroux
8a56518034
[CI] Reenable N-2 BWC tests for non-snapshot builds (#125296)
We can reenable those tests for `release-test`, now the
code exist in 8.18, 8.x and 9.0 branches.

Closes #119550
2025-03-21 10:18:10 +01:00
Lorenzo Dematté
3558a288f6
Update plugins documentation for Entitlements (#125292)
This PR updates the documentation for Creating classic plugins, replacing the instructions relative to the Java SecurityManager with information on Entitlements.

Relates to ES-10846
2025-03-21 10:31:06 +02:00
Ievgen Degtiarenko
9ddcede185
Attempt to make some operations cheaper (#125228) 2025-03-21 09:08:41 +01:00
Mary Gouseti
2c377f9c85
Unify template builders for data stream options, failure store and data stream lifecycle (#125293) 2025-03-21 10:03:27 +02:00
Lisa Cawley
97c5d4e149
Add more inference API REST specifications (#125187) 2025-03-21 09:44:37 +02:00
Yang Wang
7a0a399055
[Test] Reconcile TestProjectResolvers (#124988)
This PR updates the different methods in TestProjectResolvers so that
their names are more accurate and behaviours to be more as expected.

For example, In MP-1749, we differentiate between single-project and
single-project only resolvers. The later should not support multi-project.
2025-03-21 11:43:05 +11:00
Pete Gillin
22d8169ab9
ES-10037 Persist recent write load in index metadata (#125330)
This changes the default value for the Exponentially Weighted Moving Rate calculation used for the 'recent write load' metric in indexing stats to 5 minutes (as agreed over Slack) and persists the value in the index metadata alongside the existing write load metric.

The value is still not used in the data stream autosharding calculation, that will be yet one more PR.

There are a couple of drive-by changes in this PR:

It adds a comment to DataStreamAutoShardingService.computeOptimalNumberOfShards, because the nested min and max calls are quite hard to understand at a glance.

It changes IndexShard.indexingStats() so that, if it is called before the shard has entered the started state, it uses a timeSinceShardStartedInNanos value of zero when calling InternalIndexingStats.stats(). Previously, it would have passed the current relative time in nanos as timeSinceShardStartedInNanos (because startedRelativeTimeInNanos would be zero) which is arbitrary and incorrect (since the zero point of System.nanoTime() is arbitrary). This didn't actually matter, since InternalIndexingStats.postIndex would not increment the metrics while in recovery, so the numerator used to calculate the write load would be zero if the shard has not started, so it doesn't matter if the denominator is incorrect. However, it is good defensive coding not to rely on that, and to pass a correct value instead.
2025-03-20 22:45:44 +00:00
Jordan Powers
2ff03acf51
Fix ignores malformed testcase (#125337)
Fix and unmute testSynthesizeArrayRandomIgnoresMalformed
2025-03-21 00:31:38 +02:00
Benjamin Trent
e9c4b267c2
Adjusting 41_knn_search_bbq_hnsw tests to have explicit refresh (#125255) 2025-03-20 17:15:05 -04:00
Patrick Doyle
e0611260c5
Use ALL-UNNAMED for the unnamed module in warnings (#125317)
* Use ALL-UNNAMED for the unnamed module in warnings

* [CI] Auto commit changes from spotless

---------

Co-authored-by: elasticsearchmachine <infra-root+elasticsearchmachine@elastic.co>
2025-03-20 17:02:57 -04:00
Mark Vieira
baffc4a8c8
Fix failure in ScalingThreadPoolTests after addition of merge scheduler (#125245) 2025-03-20 13:03:44 -07:00
Jonathan Buttner
2fd70d9d69
[ML] Refactoring inference API throttled logging (#124923)
* Refactoring throttled logging

* Renaming setting

* Resetting log counter when attempt to log for repeated messages

* Clean up

* Refactoring locking

* Comments

* Working tests

* Addressing logbuilder issue

* Fixing tests
2025-03-20 14:22:24 -04:00
David Turner
f04761c31a
Remove redundant response parameter to onResponseSent() (#125326)
Nobody uses this parameter (except some tests that simply verify the
otherwise-unused plumbing is connected). This commit removes it.

Relates #125163
2025-03-21 04:50:08 +11:00
Colleen McGinnis
9bcd59596d
[docs] Prepare for docs-assembler (#125118)
* reorg files for docs-assembler and create toc.yml files

* fix build error, add redirects

* only toc

* move images
2025-03-20 12:09:12 -05:00
Dan Rubinstein
52bc96240c
Fix AlibabaCloudSearchCompletionAction not accepting ChatCompletionInputs (#125023)
* Fix AlibabaCloudSearchCompletionAction not accepting ChatCompletionInputs

* Update docs/changelog/125023.yaml

* Fix unit tests
2025-03-20 13:07:58 -04:00
Ryan Ernst
80db28e5b1
Split out jvm and operating system actions in entitlement tests (#125122)
This is part of continued cleanup to remove actions from
RestEntitlementCheckAction.
2025-03-20 18:59:52 +02:00
Jan Kuipers
a16eaf1423
Don't immediately scale down startups triggered by non-master nodes in inference adaptive allocations. (#125297) 2025-03-20 17:38:15 +01:00
kanoshiou
873827db12
ESQL: Align RENAME behavior with EVAL for sequential processing (#122250) 2025-03-20 17:04:13 +01:00
Mariusz Józala
e704eb0b0e
Mute testSynthesizeArrayRandomIgnoresMalformed (#125320)
Muting because of random failures on main branch.
2025-03-21 03:03:08 +11:00
Nikolaj Volgushev
56027da9f6
Fix 125307 (#125308)
Closes: https://github.com/elastic/elasticsearch/issues/125307
2025-03-21 01:52:56 +11:00
John Wagster
207da8af34
Updated Date Range to Follow Documentation When Assuming Missing Values - Yaml Compat Doc Updates (#113964)
updating yaml compat docs
2025-03-20 09:21:50 -05:00
Luca Cavanna
8fdf44d708
Remove completion postings format extension (#125253)
A while ago we introduced a completion postings format extension to eventually
be able to customize how completion FSTs are loaded. See #111494.

We have never leveraged this extension, and meanwhile Lucene is moving
to always load FSTs off-heap, and no longer allow on-heap.
See https://github.com/apache/lucene/pull/14364 .

This commit removes the SPI extension as it is no longer needed.
2025-03-20 15:07:53 +01:00
Mariusz Józala
eb54026130
[CI] Sign in to Docker Hub for Buildkite pipelines (#125208)
Unauthenticated pulls from Docker Hub are heavily rate-limited. After
this change, we will use authenticated Docker Hub user so that we can
pull public images for tests without being rate-limited.
2025-03-20 14:54:23 +01:00
Johannes Fredén
b892e448c2
Mute testProcessMultipleChunks (#125306) 2025-03-20 14:18:02 +01:00
Tommaso Teofili
6d3dac32c6
Let random_score yaml test explicitly fail on _id field (#125230)
* constrain the no-field scenario to 9.x
2025-03-20 14:16:02 +01:00
Keith Massey
24132d3834
Reindex data stream indices on different nodes (#125171) 2025-03-20 07:50:10 -05:00
Iván Cea Fontenla
5182e733d7
Unmute MvJoinKeyFromRow (#125128)
Closes https://github.com/elastic/elasticsearch/issues/124951
2025-03-20 13:45:18 +01:00
Tim Grein
177da5f270
[Inference API] Move elastic provider service & task settings under their own package similar to authorization and completion. (#125197) 2025-03-20 13:13:29 +01:00
Mike Pellegrini
f67b5d6e95
Mark semantic text as GA in docs (#124669) 2025-03-20 08:13:00 -04:00
Jeremy Dahlgren
a3dc9183d5
Disable logging in ClusterFormationFailureHelper on shutdown. (#125244)
Modifies Coordinator to enable logging in ClusterFormationFailureHelper
when started and disables logging in ClusterFormationFailureHelper when
stopped.  The warning scheduler handling and invariant check in the
Coordinator are left as is, with the logging boolean set independently,
eliminating the need to hold the mutex in doStop() when Coordinator.stop()
is called when the Node is shutdown.

Closes #105559.

* Update docs/changelog/125244.yaml
2025-03-20 08:12:34 -04:00
Pooya Salehi
11e4d31208
Make ProjectId#isValidFormatId public (#125134) 2025-03-20 12:56:15 +01:00
Jim Ferenczi
22be0d957a
Leverage scorer supplier in QueryFeatureExtractor (#125259)
Follow up of #125103 that leverages scorer supplier to create queries optimised to run on top docs only.
2025-03-20 11:22:45 +00:00
Nikolaj Volgushev
c58ac456b8
Failure Store Access Authorization (#123986)
This PR implements authorization logic for failure store access. It
builds on https://github.com/elastic/elasticsearch/pull/122715.

Access to the failure store is granted by two privileges:
`read_failure_store` and `manage_failure_store`. Either of these
privileges lets a user access a failure store via the `::failures`
selector, as well as access its backing failure indices. 
`read_failure_store` grants read access (for example to search documents
in a failure store), `manage_failure_store` grants access to write
operations, such as rollover. Users with only `read` or `manage` on a
data stream do not get failure store access. Vice versa, users with
`read_failure_store` and `manage_failure_store` do not get access to
regular data in a data stream. 

The PR implements this by making authorization logic selector-aware. It
involves two main changes:

1. Index permission groups now compare the selector under which an index resource is accessed to the selector associated with the group.
2. The `AuthorizedIndices` interface likewise uses selectors to decide which indices to treat as authorized. This part of the change requires a sizable refactor and changes to the interface. 

The high-level behavior for selector-aware search is as follows:

For a user with `read_failure_store` over data stream `logs`:

- `POST /logs::failures/_search` returns the documents in the failure store.
- `POST /logs/_search` returns a 403.
- `POST /logs/_search?ignore_unavailable=true` and `POST /*/_search` return an empty result.

Similarly, for a user with `read` over data stream `logs`:

- `POST /logs::failures/_search` returns a 403.
- `POST /logs/_search` returns documents in the data stream.
- `POST /logs::failures/_search?ignore_unavailable=true` and `POST /*::failures/_search` return an empty result.

A user with both `read` and `read_failure_store` over data stream `logs`
gets access to both `POST /logs::failures/_search` and `POST
/logs/_search`.

The index privilege `all` automatically grants access to both data and
the failures store, as well as all hypothetical future selectors. 

Resolves: ES-10873
2025-03-20 20:10:16 +11:00
Gal Lalouche
54240d3854
Refactor IndexFieldCapabilities creation by adding a proper builder object (#125219)
Reduce boilerplate associated with creating `IndexFieldCapabilities`
instances. Since it's a class with a large number of fields, it makes
sense to define a builder object, as that can also help with all the
Boolean and null blindness going on. As with `FieldCapabilitiesBuilder`,
this is only used in tests, to avoid any potential performance hit in
production code.
2025-03-20 11:02:35 +02:00
Ioana Tagirta
5290e0cedf
ES|QL: Add license check for RRF (#125225) 2025-03-20 09:51:55 +01:00
Carlos Delgado
d2c65f5d74
ESQL ScoringIT - Fix release test (#125250) 2025-03-20 09:50:44 +01:00
Johannes Fredén
fc7fbdfe4c
Allow passing several reserved state chunks in single process call (#124574)
This PR overloads the `process` method and allows it to be used with
several `ReservedStateChunks`. The purpose is to allow several state
chunks to be spread across several files but handled as a single cluster
state update by validating and merging them into a single representation
of the `ReservedStateChunk`.
2025-03-20 19:31:00 +11:00
Nhat Nguyen
5a73689de6
Adjust bwc for ES|QL partial failures from remote (#125279)
Relates #124929
2025-03-20 19:28:21 +11:00
Rene Groeschke
38f243944e
Fix failing docker packaging tests due to too long commandline (#125053)
* Increate COLUMN for detecting running elasticsearch instance
* Unmute DockerTest test
2025-03-20 08:27:40 +01:00
Nhat Nguyen
c8de8d1fd4
Update metrics command (#125193)
This change updates the METRICS command syntax from METRICS 
index_pattern aggregations | ... to METRICS index_pattern | ...,
removing inline aggregations. This PR does not filter out
non-time-series indexes from the source; this will be addressed in a
follow-up PR to keep this PR small.
2025-03-20 00:12:18 -07:00
Nhat Nguyen
44a1190bc0
Adjust bwc for block serialization (#125276)
Adjust wire version after backporting to 8.x.

Relates #124394
2025-03-20 00:07:46 -07:00
Costin Leau
e186b15df2
ESQL: Reuse child outputSet inside the plan where possible (#124611)
Avoid creating outputSet between nodes that passthrough their input

Relates #124395
2025-03-19 19:44:15 -07:00
Jordan Powers
376abfece9
Natively store synthetic source array offsets for numeric fields (#124594)
This patch builds on the work in #122999 and #113757 to natively store
array offsets for numeric fields instead of falling back to ignored source
when `source_keep_mode: arrays`.
2025-03-19 18:44:46 -07:00
Yang Wang
a1b0ed104b
[Test] Allow configuring configDir for the Java test cluster (#125094)
For creating and deleting projects in multi-project tests, we need
create and delete settings and secrets files on the fly. This PR adds
such feature to the Java test cluster with an option to specify the
config directory.
2025-03-20 11:21:39 +11:00
Joe Gallo
e210ea87d6
Add an ignoreMissing parameter to IngestDocument's removeField method (#125232) 2025-03-19 16:55:13 -04:00
Jim Ferenczi
2f1c8577f9
Exclude Default Inference Endpoints from Cluster State Storage (#125242)
When retrieving a default inference endpoint for the first time, the system automatically creates the endpoint.
However, unlike the `put inference model` action, the `get` action does not redirect the request to the master node.

Since #121106, we rely on the assumption that every model creation (`put model`) must run on the master node, as it modifies the cluster state. However, this assumption led to a bug where the get action tries to store default inference endpoints from a different node.

This change resolves the issue by preventing default inference endpoints from being added to the cluster state. These endpoints are not strictly needed there, as they are already reported by inference services upon startup.

**Note:** This bug did not prevent the default endpoints from being used, but it caused repeated attempts to store them in the index, resulting in logging errors on every usage.
2025-03-19 20:19:08 +00:00
Luca Cavanna
296bbef44d
Remove request arg from TransportSingleShardAction#getExecutor method (#124872)
The argument is not used anywhere and can be removed.
2025-03-19 20:46:39 +01:00
Rene Groeschke
6f7a206a8a
Update Gradle Enterprise Plugin (Develocity) to 3.19.2 (#125137)
with develocity updated to 2024.3.4 we are unblocked on updating the gradle enterprise plugin
2025-03-19 19:19:54 +01:00
Nhat Nguyen
b85b32a040
Fix FieldCapabilitiesIT#testRelocation (#125233)
We should not try to relocate initializing shards. This change disables rebalancing 
and ensures all shards to be relocated are ready.

Closes #124227
2025-03-19 11:01:03 -07:00
elasticsearchmachine
582fcaf848 Mute org.elasticsearch.index.engine.ThreadPoolMergeSchedulerTests testSchedulerCloseWaitsForRunningMerge #125236 2025-03-20 03:34:47 +11:00
Pawan Kartik
0350a48e41
Do not look over TaskCancelledException when looking at failures when updating CCS info for clusters (#125206)
Do not look over `TaskCancelledException` when looking at failures when updating CCS info for clusters
2025-03-19 16:30:29 +00:00
Kathleen DeRusso
00c8ad87c7
Add rule retriever yaml test with empty indices (#125161)
* Add rule retriever yaml test with empty indices

* Add more specificity to NodeFeature name
2025-03-19 18:12:20 +02:00
David Turner
23769da8e3
Work around testFilterByTags failure (#125109)
A SDK bug[^1] means that these values sometimes don't parse as an
integer. We don't need them to do so in order to pass the test, so this
commit relaxes the test to accept any string.

Closes #125090 Closes #125166

[^1]: https://github.com/aws/aws-sdk-java-v2/issues/5968
2025-03-20 02:49:54 +11:00
Ievgen Degtiarenko
edc36aa302
Fix testCancelUnnecessaryRequests (#124864) 2025-03-19 16:48:52 +01:00
Lisa Cawley
ec0f8be34d
[DOCS] Clean up Asciidoc links in markdown files (#125046) 2025-03-19 08:03:55 -07:00
Jonathan Buttner
fbf4580369
[ML] Return empty usage statistics in the event of an failure (#124799)
* Returning empty usage on failure

* Adding logging
2025-03-19 10:40:12 -04:00
Jim Ferenczi
7c5be1257f
Fix LTR query feature with phrases (and two-phase) queries (#125103)
Query features should verify that docs match the two-phase iterator.
2025-03-19 14:21:34 +00:00
Lorenzo Dematté
ae0b2963d2
[Entitlements] Add an option to perform bytecode verification during instrumentation (#124404)
Using ASM CheckClassAdapter was key to diagnose the issue we had with incorrect signatures for some check methods.
In this PR I polished up the code I used to pinpoint the issue, and made it available via a system property so it can be turned on if we need it (and it's always on for Entitlements IT tests too).

It is also turned on in case we get VerifyErrors during retransformClasses early in the Entitlement agent bootstrap: retransformClasses runs in the native part of the JVM, so the VerifyError it produces is not so readable (e.g. it lacks a full stack trace and a description); in case this happens, we re-apply the transformation with verification turned on to get a meaningful error before dying.
2025-03-19 16:02:01 +02:00
Craig Taverner
65dfaf1c91
Rewrite Kibana docs asciidoc links to be MD links (#125155)
Did a few things:
* Rewrite Kibana docs asciidoc links to be MD links
* Make kibana docs links absolute to planned publication path
* Clarify which operators are generated and which are static
* Removed the trailing .md from kibana docs links
2025-03-19 13:56:05 +01:00
István Zoltán Szabó
8a741bfd62
Adds VoyageAI PUT Inference API. (#125198) 2025-03-19 13:29:14 +01:00
Quentin Pradet
7070f3fdbe
Add missing cause param to indices.put_template API (#125189) 2025-03-19 14:57:30 +04:00
Niels Bauman
8e64f50d66
Make DLM stats and DLM error store project-aware (#124810)
This is part of the work to make DLM project-aware.

These two features were pretty tightly coupled, so I saved some effort
by combining them in one PR.
2025-03-19 12:39:28 +02:00
Martijn van Groningen
ae16016290
Update disable assertion jvm args from bwc/mixed cluster setups. (#125074)
Remove `-da:org.elasticsearch.index.mapper.DocumentMapper` and `-da:org.elasticsearch.index.mapper.MapperService` from mixed cluster/bwc cluster setups. Given that #122606 is now backported to the 8.18 branch.
2025-03-19 08:10:50 +01:00
Mikhail Berezovskiy
d9e751602d
gcp retry-test setup fix (#125181) 2025-03-18 23:23:50 -07:00
Lisa Cawley
b5bc681191
Add Mistral inference API (#125063) 2025-03-18 22:11:12 -07:00
Nhat Nguyen
db23674a0b
Span new trace context for compute group task (#125151)
We need to create a new trace context when registering a task. There are 
other issues with the task group, but I need this change to enable
allow_partial_results first, then follow up with other enhancements.
2025-03-18 20:19:36 -07:00
Kofi B
e34bfd166a
[DOCS] Opster Migration: Nested bool query addition (#124455)
added section related to nested bool queries to provide a more clear example and clean up surrounding language and grammatical issues
2025-03-18 20:42:31 -05:00
Ryan Ernst
a7c71669a4
Update bundled JDK to Java 24 (#125159)
Bumping bundled JDK to Java 24 since it is now GA.
2025-03-19 01:46:37 +02:00
elasticsearchmachine
0f2ab9c105 Mute org.elasticsearch.packaging.test.DockerTests test012SecurityCanBeDisabled #116636 2025-03-19 10:09:05 +11:00
Larisa Motova
08ae54e423
[ES|QL] ToAggregateMetricDouble function (#124595)
This commit adds a conversion function from numerics (and aggregate
metric doubles) to aggregate metric doubles.

It is most useful when you have multiple indices, where one index uses
aggregate metric double (e.g. a downsampled index) and another uses a
normal numeric type like long or double (e.g. an index prior to
downsampling).
2025-03-18 11:39:27 -10:00
Joe Gallo
3e2cdc774b
Refactor IngestDocument's resolve method (#125051) 2025-03-18 17:38:49 -04:00
Joe Gallo
0efa6f89f6
Add some utility functions for handling Maxmind geoip results (#125153) 2025-03-18 17:05:45 -04:00
Pete Gillin
50e689493c
Calculate recent write load in indexing stats (#124652)
This uses the recently-added `ExponentiallyWeightedMovingRate` class
to calculate a write load which favours more recent load and include
this alongside the existing unweighted all-time write load in
`IndexingStats.Stats`.

As of this change, the new load metric is not used anywhere, although
it can be retrieved with the index stats or node stats APIs.
2025-03-18 21:23:20 +02:00
Ying Mao
a27f5ac50c
Fixing muted tests and small refactor to remove duplicate functions (#125138) 2025-03-18 15:08:29 -04:00
Rene Groeschke
12c2dd5903
[Gradle] Autoprovision jvm for gradle daemon (#124071)
With Gradle 8.13 we can now auto provision the jdk used by the gradle daemon. Our configuration relies on jdk21.
With this autoprovisioning enabled each gradle build will use adoptium jdk 21 for gradle jvm
2025-03-18 19:50:05 +01:00
elasticsearchmachine
02dc6d4780 Mute org.elasticsearch.threadpool.ScalingThreadPoolTests testScalingThreadPoolConfiguration #125142 2025-03-19 05:00:08 +11:00
Lee Hinman
cda26693ca
Truncate step_info and error reason in ILM execution state and history (#125054)
This commit adds a limit to the `step_info` contained in
`LifecycleExcutionState` so that large step info messages will not be
stored in the cluster state. Additionally, when generating an ILM
history failure, the full exception that is "stringified" is truncated
to the same limit, ensuring that we do not accidentally index gigantic
documents in the history store.

The default limit is 1024 characters.

Resolves #124181
2025-03-19 04:45:06 +11:00
Albert Zaharovits
fa46b873be
Threadpool merge scheduler (#120869)
This adds a new merge scheduler implementation that uses a (new)
dedicated thread pool to run the merges. This way the number of
concurrent merges is limited to the number of threads in the pool
(i.e. the number of allocated processors to the ES JVM).

It implements dynamic IO throttling (the same target IO rate for all
merges, roughly, with caveats) that's adjusted based on the number
of currently active (queued + running) merges.
Smaller merges are always preferred to larger ones, irrespective of
the index shard that they're coming from.
The implementation also supports the per-shard "max thread count"
and "max merge count" settings, the later being used today for indexing throttling.
Note that IO throttling, max merge count, and max thread count work similarly,
but not identical, to their siblings in the ConcurrentMergeScheduler.

The per-shard merge statistics are not affected, and the thread-pool statistics should
reflect the merge ones (i.e. the completed thread pool stats reflects the total
number of merges, across shards, per node).
2025-03-18 19:32:49 +02:00
Moritz Mack
cace90584a
Prepare backport of transport version STORED_SCRIPT_CONTENT_LENGTH to 9.0 (#125127)
Prepare backport of transport version STORED_SCRIPT_CONTENT_LENGTH to
9.0

Relates to https://github.com/elastic/elasticsearch/pull/123860
2025-03-19 04:30:30 +11:00
Charlotte Hoblik
64a56439a6
[DOCS] Restructure user settings reference pages (#125000)
* add elasticsearch settings page

* add logo to ech applicable settings

* removing ECH settings page

* removing duplicate information from ECH

* move settings to correcponding page

* update configuration page

* fix link

* Add applies_to frontmatter to auditing settings

* remove duplicate how-to pages

* fix broken links

* replce cloud icon text

* adjust settings pages

* add applies_to tag

---------

Co-authored-by: lcawl <lcawley@elastic.co>
2025-03-18 18:18:49 +01:00
Luigi Dell'Aquila
41510fc846
Fix ES|QL query log file suffix in LogType (#125124) 2025-03-18 19:16:16 +02:00
Lorenzo Dematté
a4d7297944
Permanently switch from SecurityManager to Entitlements (#124865) (#125117)
The JDK team has completely disabled the Java SecurityManager from Java 24. Elasticsearch has always used the Java SecurityManager as an additional protection mechanism; in order to retain this second line of defense, the Elasticsearch Core/Infra team has been working on the Entitlements project.

Similar to SecurityManager, Entitlements only allow calling specific methods in the JDK when the caller has a matching policy attached. In other words, if some code (in the main Elasticsearch codebase, in a plugin/module, or in a script) attempts to perform a "privileged" operation and it is not entitled to do so, a NotEntitledException will be thrown.

This PR includes the minimal set of changes to always use Entitlements, regardless of system properties or Java version.

Relates to ES-10921
2025-03-18 18:38:45 +02:00
Ryan Ernst
11961730da
Cleanup command line setting errors (#124963)
This commit improves the error cases when command line settings are
found that are duplicates or conflict with special system properties.
2025-03-18 09:38:14 -07:00
Craig Taverner
50a7eb09d4
Fix ES|QL build.gradle for configuration-cache (#125097)
Earlier work on the ES|QL port of docs to V3 introduced an issue in the build.gradle file making it fail with --configuration-cache. This fixes that, as well as one other broken link and removes some unused files.

In addition we bring back partial support for deleting unused files. It is tricky to have full support for this due to the mix of static and generated content, particularly in the operators snippets.
2025-03-18 17:15:53 +01:00
Oleksandr Kolomiiets
033d28e792
Use FallbackSyntheticSourceBlockLoader for shape and geo_shape (#124927) 2025-03-18 08:49:08 -07:00
Luigi Dell'Aquila
f3ed9b3a2d
ES|QL query log (#124094) 2025-03-18 16:31:55 +01:00
István Zoltán Szabó
c3222aba74
Adds EIS inference PUT API (#125082) 2025-03-18 16:19:00 +01:00
Moritz Mack
54792077da
Prepare transport version backport to 9.0 for RE_REMOVE_MIN_COMPATIBLE_SHARD_NODE (#125095)
Relates to #123859
2025-03-18 16:04:54 +01:00
Patrick Doyle
fd51f44e32
Silence known entitlement warnings (#124883) 2025-03-18 16:52:12 +02:00
Rene Groeschke
df7c20acd8
[Gradle] Fix configuration cache issues in distribution subproject (#124281)
* [Gradle] Fix configuration cache issues in distribution subproject

- do not reference tasks from task execution time
- do not use project references at task execution time
- use layout.settingsDir for resolving root project dir

* Fix test coverage

* [CI] Auto commit changes from spotless

---------

Co-authored-by: elasticsearchmachine <infra-root+elasticsearchmachine@elastic.co>
2025-03-18 15:27:47 +01:00
Carlos Delgado
7950751788
ES\QL: Fix scoring for non full text functions (#124540) 2025-03-18 14:37:20 +01:00
elasticsearchmachine
8fc012088b Mute org.elasticsearch.discovery.ec2.Ec2DiscoveryTests testFilterByTags #125090 2025-03-18 23:31:06 +11:00
Arpad Kiraly
30dd38bc97
Remove @UpdateForV9 annotation (#125024)
* Delete libs/core/src/main/java/org/elasticsearch/core/UpdateForV9.java

* Remove UpdateForV9 annotation in ConsumeProcessor.java
2025-03-18 12:52:18 +01:00
Mary Gouseti
ce04da7dea
Refactor data stream lifecycle to use the template paradigm (#124593) 2025-03-18 13:24:06 +02:00
elasticsearchmachine
9f76a7f32d Mute org.elasticsearch.xpack.ilm.DataStreamAndIndexLifecycleMixingTests testGetDataStreamResponse #125083 2025-03-18 21:36:19 +11:00
Jim Ferenczi
270ec538c9
Add ModelRegistryMetadata to Cluster State (#121106)
This commit integrates `MinimalServiceSettings` (introduced in #120560) into the cluster state for all registered models in the `ModelRegistry`.
These settings allow consumers to access configuration details without requiring asynchronous calls to retrieve full model configurations.

To ensure consistency, the cluster state metadata must remain synchronized with the models in the inference index.
If a mismatch is detected during startup, the master node performs an upgrade to load all model settings from the index.
2025-03-18 10:12:51 +00:00
Lorenzo Dematté
d20528b27c
[Entitlements] Uniform server and plugins policy patching (#125011)
With #124904 we introduced server policy patching via system properties; now that we have the possibility to merge policies and scopes, it's worth applying the same mechanism to plugin policies too.

This PR changes the behaviour of plugin policy overrides; now they are not replacing the policy entirely, but patch it by adding the entitlements and scopes specified in the "patch policy"
2025-03-18 09:27:54 +00:00
Tim Grein
b3eeb96e27
[Inference API] Fix test for pre-adaptive rate limiting case (#124709) 2025-03-18 10:26:22 +01:00
Liam Thompson
ccd1c33b7f
[DOCS] Update hardcoded reference doc links URLs for v9 (#124798) 2025-03-18 10:07:36 +01:00
Armin Braun
b1e878fe0a
Release DocumentField instances in SearchHit.deallocate (#124925)
These can consume non-trivial heap if transport messages start to queue
up. Let's release them asap.
2025-03-18 09:46:20 +01:00
David Turner
a2d98e44a1
Upgrade discovery-ec2 to AWS SDK v2 (#122062) 2025-03-18 19:38:16 +11:00
Brendan Cully
9866a67fab
Add shardCountBefore/After operations to IndexReshardingMetadata (#125058)
* Add shardCountBefore/After operations to IndexReshardingMetadata

Any reshard operation will change shard count, so it makes sense
to make this information available here.

* [CI] Auto commit changes from spotless

---------

Co-authored-by: elasticsearchmachine <infra-root+elasticsearchmachine@elastic.co>
2025-03-17 21:01:17 -07:00
elasticsearchmachine
0e42914206 Mute org.elasticsearch.xpack.inference.external.request.azureopenai.embeddings.AzureOpenAiEmbeddingsRequestTests testCreateRequest_WithEntraIdDefined #125061 2025-03-18 09:23:22 +11:00
elasticsearchmachine
0c8f74bf5d Mute org.elasticsearch.xpack.inference.external.request.jinaai.JinaAIEmbeddingsRequestTests testCreateRequest_TaskSettingsInputType #125059 2025-03-18 09:22:50 +11:00
elasticsearchmachine
29b8c86025 Mute org.elasticsearch.xpack.inference.external.action.azureopenai.AzureOpenAiEmbeddingsActionTests testExecute_ReturnsSuccessfulResponse #125057 2025-03-18 08:23:46 +11:00
Ryan Ernst
3e3c8a2ec7
Indicate when errors represent timeouts (#124936)
This commit adds a `timed_out` key to the error responses that represent a
timeout condition. It also adds an `X-Timed-Out` header to the response
indicating the same outside the response body.
2025-03-17 21:17:02 +00:00
Jeremy Dahlgren
92290aa01f
Fix test in TransportGetAllocationStatsActionTests (#124902)
testReturnsOnlyRequestedStats() was using
EnumSet.copyOf(randomSubsetOf(Metric.values().length, Metric.values()))
which will always return all of the metrics.  The code was expecting
Metric.ALLOCATIONS and Metric.FS to sometimes not be in the returned set.
This change uses an explicit list of EnumSets to cover the range of
scenarios expected in the test code.
2025-03-17 16:18:57 -04:00
Stanislav Malyshev
f0ee146f7f
Document allow_partial_results (#125044) 2025-03-17 12:37:10 -06:00
Brendan Cully
cc6a4bb467
Pass IndexReshardingMetadata over the wire (#124841)
* Pass IndexReshardingMetadata over the wire

When I introduced IndexReshardingMetadata I inadvertently
only covered local serialization. It was not getting sent or
received over the wire. This fixes that.
2025-03-17 11:35:35 -07:00
Ying Mao
0b6a3cd138
Expose input_type option at root level for text_embedding task type in Perform Inference API (#122638)
* wip

* wip

* [CI] Auto commit changes from spotless

* Adding internal input types

* [CI] Auto commit changes from spotless

* Throwing validation exception for services that don't support input type

* linting

* hugging face

* voyage ai

* google ai studio

* bedrock updates

* Fixing tests

* Fixing tests

* Fixing tests

* bedrock updates

* elasticsearch

* azure openai

* [CI] Auto commit changes from spotless

* Refactoring all the things

* [CI] Auto commit changes from spotless

* Everything compiles

* spotless

* external actions tests

* external request tests

* service tests

* Fixing integration tests

* Cleanup

* Update docs/changelog/122638.yaml

* Cleanup

* Update x-pack/plugin/inference/src/main/java/org/elasticsearch/xpack/inference/services/azureopenai/AzureOpenAiService.java

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

* Update x-pack/plugin/inference/src/main/java/org/elasticsearch/xpack/inference/services/ServiceUtils.java

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

* PR feedback

---------

Co-authored-by: elasticsearchmachine <infra-root+elasticsearchmachine@elastic.co>
Co-authored-by: David Kyle <david.kyle@elastic.co>
2025-03-17 13:51:44 -04:00
Jack Conradson
053938a3d4
Add manage_threads entitlement for reactor.core (#125037)
This adds the manage_threads entitlement for reactor.core as part of the 
azure-repository module. It looks like this is a requirement for offloading 
azure blob store work.
2025-03-17 10:15:10 -07:00
Craig Taverner
94cad286bc
Restructure query-languages docs files for clarity (#124797)
In a few previous PR's we restructured the ES|QL docs to make it possible to generate them dynamically.

This PR just moves a few files around to make the query languages docs easier to work with, and a little more organized like the ES|QL docs.

A bit part of this was setting up redirects to the new locations, so other repo's could correctly link to the elasticsearch docs.
2025-03-17 17:58:58 +01:00
elasticsearchmachine
8c737fb235 Mute org.elasticsearch.packaging.test.DockerTests test010Install #119441 2025-03-18 02:16:21 +11:00
Ignacio Vera
aba54e8af8
Don't generate stacktrace in TaskCancelledException (#125002) 2025-03-17 15:59:08 +01:00
Quentin Pradet
0bacede6cc
Add missing OpenAI and Watsonx inference APIs (#124989) 2025-03-17 18:42:09 +04:00
Armin Braun
c9203e7304
Fix EQL double invoking listener (#124918)
We need to break out early here, otherwise we double resolve the
listener in the following code potentially.
2025-03-17 13:49:44 +01:00
Ryan Ernst
e39f14d697
Guard checking master node watching for file settings (#124960) 2025-03-17 05:37:06 -07:00
Jim Ferenczi
665e89065f
Fix invalid setting value in ShardBulkInferenceActionFilter tests (#125006)
0 is not a valid value.

Closes #124985
Closes #124986
Closes #124955
Closes #124954
2025-03-17 12:31:41 +00:00
elasticsearchmachine
fd3ee956b4 Mute org.elasticsearch.backwards.MixedClusterClientYamlTestSuiteIT test {p0=search/610_function_score/Random} #125010 2025-03-17 22:03:21 +11:00
Lorenzo Dematté
ef3b835a0f
[Entitlelments] Server policy patching via system property (#124904)
This PR adds a mechanism to patch the server layer policy by merging entitlements from a policy provided via a system property (merge, not replace).
2025-03-17 12:00:08 +01:00
Charlotte Hoblik
c9724557a2
add signposts to docs-content (#124866) 2025-03-17 11:41:52 +01:00
Tommaso Teofili
51877bb33c
Add yaml test for random_score in function_score query (#124893) 2025-03-17 10:59:01 +01:00
elasticsearchmachine
dc013bb0be Mute org.elasticsearch.datastreams.lifecycle.DataStreamLifecycleServiceIT testLifecycleAppliedToFailureStore #124999 2025-03-17 19:30:19 +11:00
Kostas Krikellas
b861f101e6
Merge template mappings properly during validation (#124784)
* Merge template mappings properly during validation

* Update docs/changelog/124784.yaml
2025-03-17 09:49:53 +02:00
Rene Groeschke
7f722e98eb
[Build] Rework internal build plugin plugin to work with Isolated Projects (#123461)
This fixes a general flaw in our build logic where we reach out to configurations of other projects.
This is not best practice and breaks future initiatives like IsolatedProjects that allow parallel configuration
of subprojects.
2025-03-17 08:27:03 +01:00
Rene Groeschke
ae569def9c
[Build] Require reason for usesDefaultDistribution (#124707)
This makes using usesDefaultDistribution in our test setup for explicit by requiring a reason why it's needed.
This is helpful as part of revisiting the need for all those usages in our code base.
2025-03-17 08:25:39 +01:00
elasticsearchmachine
a77bf7f1a6 Mute org.elasticsearch.packaging.test.DockerTests test011SecurityEnabledStatus #124990 2025-03-17 17:53:46 +11:00
elasticsearchmachine
e06bece83f Mute org.elasticsearch.xpack.ilm.TimeSeriesDataStreamsIT testRolloverAction #124987 2025-03-17 16:21:58 +11:00
elasticsearchmachine
e653547c94 Mute org.elasticsearch.packaging.test.BootstrapCheckTests test10Install #124957 2025-03-17 10:13:33 +11:00
elasticsearchmachine
0e02cde336 Mute org.elasticsearch.integration.DataStreamLifecycleServiceRuntimeSecurityIT testRolloverLifecycleAndForceMergeAuthorized #124978 2025-03-17 09:36:15 +11:00
elasticsearchmachine
12ab667274 Mute org.elasticsearch.xpack.esql.action.CrossClusterAsyncQueryStopIT testStopQuery #124977 2025-03-17 09:30:04 +11:00
elasticsearchmachine
f6da9e40c2 Mute org.elasticsearch.xpack.esql.action.CrossClusterAsyncQueryStopIT testStopQueryLocal #121672 2025-03-17 08:48:29 +11:00
David Turner
37a559c57d
Mention zero-window state in networking docs (#124967)
Clarify that it is expected sometimes to see inter-node connections
sending zero-window advertisements as part of the usual TCP backpressure
mechanism.
2025-03-16 19:43:29 +00:00
Armin Braun
4c1c51e870
Remove remoteAddress field from TransportResponse (#120016)
This field is only used (by security) for requests, having it in responses is redundant.
Also, we have a couple of responses that are singletons/quasi-enums where setting the value
needlessly might introduce some strange contention even though it's a plain store.

This isn't just a cosmetic change. It makes it clear at compile time that each response instance
is exclusively defined by the bytes that it is read from. This makes it easier to reason about the
validity of suggested optimizations like https://github.com/elastic/elasticsearch/pull/120010
2025-03-16 19:54:29 +01:00
Nhat Nguyen
6b6fc8028d
Include failures in partial response (#124929)
This change includes failures when ESQL returns partial results. It also 
carries failures between cluster requests.

Relates #122802
2025-03-16 11:44:06 -07:00
Moritz Mack
36874e8663
Prevent work starvation bug if using scaling EsThreadPoolExecutor with core pool size = 0 (#124732)
When `ExecutorScalingQueue` rejects work to make the worker pool scale up while already being at max pool size (and a new worker consequently cannot be added), available workers might timeout just about at the same time as the task is then force queued by `ForceQueuePolicy`. This has caused starvation of work as observed for `masterService#updateTask` in #124667 where max pool size 1 is used. This configuration is most likely to expose the bug.

This PR changes `EsExecutors.newScaling` to not use `ExecutorScalingQueue` if max pool size is 1 (and core pool size is 0). A regular `LinkedTransferQueue` works perfectly fine in this case.

If max pool size > 1, a probing approach is used to ensure the worker pool is adequately scaled to at least 1 worker after force queueing work in `ForceQueuePolicy`.

Fixes #124667
Relates to #18613
2025-03-16 17:42:46 +01:00
Ryan Ernst
3c129e7fce
Re-enable analysis stemmer test (#124961)
This test was disabled until exclusive entitlements were added.

closes #119130
2025-03-17 02:57:36 +11:00
elasticsearchmachine
e4c2c3b761 Mute org.elasticsearch.xpack.esql.action.CrossClusterAsyncQueryStopIT testStopQueryLocalNoRemotes #124959 2025-03-16 16:49:18 +11:00
Costin Leau
dc15462ca4
ESQL: Catch parsing exception (#124958)
When an invalid popMode occurs (due to an invalid query), ANTLR throws
 an out-of-channel exception, bypassing the existing checks.
This PR extends the checks and properly reports the error back to the
 user

Fix #119025
2025-03-15 20:37:13 -07:00
Costin Leau
e8533c1732
ESQL: Improve error message for ( and [ (#124177)
Due to recent grammar changes made ( token to no longer be reported by
 its text rather by his internal token name. Due to the use of pushMode,
 the symbol is not treated as a literal rather as a symbol.
To address this, the parser listener looks at the error message and
 changes the message before returning it to the user.

Replace hacky regex approach with Vocabulary substitution (not
 as pluggable as it could be yet much better)

Fix #124145
Relates #123085 #121948

Co-authored-by: Alexander Spies <alexander.spies@elastic.co>
2025-03-15 16:18:21 -07:00
elasticsearchmachine
4a0c935e82 Mute org.elasticsearch.xpack.esql.qa.single_node.EsqlSpecIT test {lookup-join.MvJoinKeyFromRow SYNC} #124951 2025-03-16 08:43:03 +11:00
elasticsearchmachine
62c8e3cee6 Mute org.elasticsearch.datastreams.lifecycle.DataStreamLifecycleServiceIT testErrorRecordingOnRetention #124950 2025-03-16 08:29:39 +11:00
Ryan Ernst
789eb2fadb
Log system information early during startup (#124926)
Information about the system, and in particular the running JVM, is
logged relatively late in startup. When problems occur in low level
initialization, it is often useful to have this information. This commit
moves logging of system information to right after logging has been
initialized. Note that it no longer utilizes the JvmInfo class as most
was already easily available and the static init of JvmInfo does a lot.
2025-03-15 14:55:02 +00:00
Ryan Ernst
aeee44f2a5
Ignore _JAVA_OPTIONS (#124843)
The JVM has a couple ways that Java options can be passed. In
Elasticsearch we ignore these common patterns, instead using our own
bespoke mechanisms for setting options (ES_JAVA_OPTS, etc). The primary
reason for this is some systems like Ubuntu setting these options
globally and then affecting Elasticsearch, often in ways that cause
Elasticsearch to fail to start.

This commit ignores _JAVA_OPTIONS, which is a little known environment
variable that the JVM may pick up options from.
2025-03-15 14:53:37 +00:00
Armin Braun
9dfd8b19d1
Move logic for parsing GetResult to test module (#124868)
This logic is now test only, no need to have it add to the production
code size.
2025-03-15 15:38:38 +01:00
Fang Xing
bd81312d2d
[ES|QL] Double parameter markers for identifiers (#122459)
* double parameter markers for identifiers
2025-03-15 09:42:55 -04:00
Niels Bauman
481d91c428
Run TransportGetMappingsAction on local node (#122921)
This action solely needs the cluster state, it can run on any node.
Additionally, it needs to be cancellable to avoid doing unnecessary work
after a client failure or timeout.

Relates #101805
2025-03-15 07:59:28 +00:00
elasticsearchmachine
6a748b5bec Mute org.elasticsearch.packaging.test.BootstrapCheckTests test20RunWithBootstrapChecks #124940 2025-03-15 18:15:21 +11:00
John Verwolf
ea7af902b7
Fix test bug, mute test (#124924)
Fixes a bug in the SystemResourceSnapshotIT class.
2025-03-15 13:28:06 +11:00
Patrick Doyle
359743baab
Use child loggers broadly in PolicyManager (#124896)
* Use child loggers broadly in PolicyManager

* Pass ModuleEntitlements to notEntitled

* Store logger name instead of object.

Some of our unit tests check for equality of `ModuleEntitlements` objects,
and they are entitled to do so (no pun intended).

* Alright, let's cache 'em

* Memoize at point of creation, not point of use

* Explanatory comments
2025-03-15 01:30:06 +00:00
John Verwolf
77b1091b36
Fix system data stream snapshot bug (#124931)
This PR fixes a bug in the snapshot service that was allowing partial snapshots to restore features that use system data streams.
2025-03-14 18:24:03 -07:00
Stanislav Malyshev
aa2db74e77
Add more logging around testStopQueryLocal to see what's going on (#124911) 2025-03-14 22:25:20 +00:00
Nik Everett
d387af87dc
ESQL: Fix field extractor tests in release (#124899)
Fix the field extractor tests in the release build by skipping all of
the cases that require a pragma.
2025-03-14 20:52:03 +00:00
Nik Everett
7ac6e5fd3c
ESQL: Fix EvalBenchmark (#124736)
Fix the benchmark for `EVAL` which was failing because of a strange
logging error. The benchmarks really didn't want to run when we use
commons-logging. That's fine - we can use the ES logging facade thing. I
also added a test to the benchmarks which should run the self-tests for
`EVAL` on `gradle check`.
2025-03-14 20:19:20 +00:00
Ryan Ernst
47454df24e
Ensure we always use vectorization in Lucene (#124914)
By default Lucene only uses vectorization up to the JDK version
available at the time of its release. When testing against EA versions,
we want to still use vectorization. This commit adds a sysprop to force
lucene to use the current version for vectorization.
2025-03-14 20:08:15 +00:00
Stanislav Malyshev
0e6d6f4324
Report failures on partial results (#124823)
* Report failures on partial results
2025-03-14 14:06:24 -06:00
Patrick Doyle
190bd9311a
Include stack trace in Not Entitled warning (#124895)
* Include stack trace in Not Entitled warning

* Remove redundant log message text
2025-03-14 19:20:33 +00:00
Michael Peterson
eee890a783
Fix resource leak in CrossClusterSearchUnavailableClusterIT (#124880)
Fixes https://github.com/elastic/elasticsearch/issues/123814
2025-03-14 13:53:32 -04:00
Lorenzo Dematté
b76048ddd2
add load_native_libraries entitlement to java.desktop (#124852)
The ingest-attachment module uses Tika to parse some content; Tika in turn uses some libraries from java.desktop to perform its tasks.

In turn, the JDK loads one (or more) native libraries for its implementation as part of class initialization. This means we need to grant load_native_libraries to java.desktop so that because AWT can load libraries for itself.
2025-03-14 18:51:13 +01:00
Alexander Spies
3d6eb26892
ESQL: Don't run INLINESTATS optimizer tests in release builds (#124889) 2025-03-14 18:45:32 +01:00
Nhat Nguyen
49254b0bdc
Remove page alignment in exchange sink (#124610)
I see that planning the ExchangeSinkExec takes a few milliseconds when 
benchmarking simple queries with 10K fields. It spends time checking if
we need to realign the incoming pages. However, the exchange has the
exact same attributes as its child, so the incoming layout should match
its attributes perfectly. This change removes the realignment.
2025-03-14 08:40:01 -07:00
John Verwolf
cb3c35783b
Bug Fix: System Data Streams Should Be Restorable (#124651)
This PR adds a new MetadataDeleteDataStreamService that allows us to delete system data streams prior to a restore operation.  This fixes a bug where system data streams were previously un-restorable.
2025-03-14 08:00:44 -07:00
elasticsearchmachine
d8b067db31 Mute org.elasticsearch.xpack.inference.action.filter.ShardBulkInferenceActionFilterTests testExplicitNull {p0=true} #124892 2025-03-15 01:55:35 +11:00
elasticsearchmachine
52417001e3 Mute org.elasticsearch.xpack.inference.action.filter.ShardBulkInferenceActionFilterTests testExplicitNull {p0=false} #124891 2025-03-15 01:55:27 +11:00
elasticsearchmachine
96915d4916 Mute org.elasticsearch.xpack.ilm.DataStreamAndIndexLifecycleMixingTests testIndexTemplateSwapsILMForDataStreamLifecycle #124886 2025-03-15 01:22:58 +11:00
elasticsearchmachine
9b7b6ae059 Mute org.elasticsearch.datastreams.lifecycle.ExplainDataStreamLifecycleIT testSystemExplainLifecycle #124885 2025-03-15 00:36:48 +11:00
elasticsearchmachine
7023fe994e Mute org.elasticsearch.datastreams.lifecycle.ExplainDataStreamLifecycleIT testExplainLifecycle #124882 2025-03-15 00:27:03 +11:00
Luca Cavanna
6d914a2b8e
Restore V8 REST compatibility around highlight force_source parameter (#124873)
While that was an approved breaking change, the change should have ensured v8
compatibility, so that under v8 compatibility mode the parameter is still accepted,
but rejected in v9 compatibility mode (default).

This commit ensures compatibility and adds a test for it.
2025-03-14 14:09:55 +01:00
Jonathan Buttner
cbfc1000bc
[ML] Allowing deletion of default endpoints while using force=true (#124781)
* Allowing deletion of default endpoints and add warning header

* Moving to force logic
2025-03-14 08:35:11 -04:00
Luca Cavanna
05c8453b2b
Remove search throttled index setting and thread pool (#124519)
Frozen indices, the freeze index API and the private index.frozen setting have been removed with #120539.

There is also a search throttled thread pool that can now be removed, as well as a private search.throttled index settings that is no longer used as it could only be set internally by freezing an index.

While the index setting is private and can be removed, as it should no longer be present in any index on 9.0+ indices, the thread pool settings associated to the removed pool are still accepted as no-op in case users have customized them and are upgrading without removing these. These will also trigger a deprecating warning.

This change also removes the search.throttled related output from the thread pool section of the cluster info API.
2025-03-14 12:04:35 +01:00
Iván Cea Fontenla
f2628392d1
ESQL: Add capability to prevent failing mixed tests after Starts/EndsWith Lucene pushdown (#124764)
Continuation of https://github.com/elastic/elasticsearch/pull/124641, after different issues arised.

Closes https://github.com/elastic/elasticsearch/issues/124693
Closes https://github.com/elastic/elasticsearch/issues/124745

The failing BWC tests are checking <8.14 mixed cluster nodes, and SingleValueQuery is sometimes emitting warnings with an empty source.
2025-03-14 11:50:49 +01:00
Jim Ferenczi
361b51d436
Optimize memory usage in ShardBulkInferenceActionFilter (#124313)
This refactor improves memory efficiency by processing inference requests in batches, capped by a max input length.

Changes include:
- A new dynamic operator setting to control the maximum batch size in bytes.
- Dropping input data from inference responses when the legacy semantic text format isn’t used, saving memory.
- Clearing inference results dynamically after each bulk item to free up memory sooner.

This is a step toward enabling circuit breakers to better handle memory usage when dealing with large inputs.
2025-03-14 09:51:03 +00:00
Ievgen Degtiarenko
35ecbf6e87
Include node thread name in IT tests logs (#124761) 2025-03-14 10:30:19 +01:00
Artem Prigoda
a49fa0be4a
Mark transport.enable_stack_protection to be removed in v10
This setting was supposed to be removed in 9.0, but turned to be non-critical. We should remove it in ES 10.0

See #109236
See ES-11224
2025-03-14 10:01:11 +01:00
Artem Prigoda
00d1834a4a
Mark cluster.routing.allocation.type to be removed in v10 (#124801)
This setting was supposed to be removed in 9.0, but turned to be non-critical. We should remove it in ES 10.0

See #94066
See ES-11224
2025-03-14 10:00:43 +01:00
Artem Prigoda
5a159d622e
Mark index.merge.policy.max_merge_at_once_explicit not to be accepted in v10 (#124807)
Introduce `Property.IndexSettingDeprecatedInV9AndRemovedInV10` property setting to mark
index settings that accepted on 9.x indices, but not on 10.0.

See #80574, #90264
See ES-11224
2025-03-14 09:59:28 +01:00
Niels Bauman
f0eb8da172
Make DeleteSourceAndAddDownsampleToDS project-aware (#124808)
This is part of the work to make DLM project-aware.
2025-03-14 08:40:37 +00:00
Lorenzo Dematté
e0c4c4de20
[Entitlements] Allow policy overrides via system properties (#124489)
This PR adds the ability to override entitlement policies for Elasticsearch plugins and modules via a system property.

The system property is in the form es.entitlements.policy.<plugin name>, and accepts a versioned policy:

versions:
  - version1
  - versionN
policy:
  <a standard entitlement policy>

For example:

versions:
  - 9.1.0
policy:
  ALL-UNNAMED:
    - set_https_connection_properties
    - outbound_network
    - files:
      - relative_path: ".config/gcloud"
        relative_to: home
        mode: read

The versioned policy needs to be base64 encoded. For example, to pass the above policy to a test cluster via gradle run:

./gradlew run --debug-jvm -Dtests.jvm.argline="-Des.entitlements.policy.repository-gcs=dmVyc2lvbnM6CiAgLSA5LjEuMApwb2xpY3k6CiAgQUxMLVVOTkFNRUQ6CiAgICAtIHNldF9odHRwc19jb25uZWN0aW9uX3Byb3BlcnRpZXMKICAgIC0gb3V0Ym91bmRfbmV0d29yawogICAgLSBmaWxlczoKICAgICAgLSByZWxhdGl2ZV9wYXRoOiAiLmNvbmZpZy9nY2xvdWQiCiAgICAgICAgcmVsYXRpdmVfdG86IGhvbWUKICAgICAgICBtb2RlOiByZWFkCg=="

The versions listed in the policy are string-matched against Build.version().current(); it is possible to specify any number of versions. If the list is empty/there is no versions field, the policy is assumed to match any Elasticsearch versions.

The override policy specified for any given plugin replaces the embedded policy for that plugin. See how EntitlementsAllowedViaOverrideIT replaces an empty policy for the entitlement-test-plugin with a policy that allows load_native_libraries and access to files in the test read_dir.

Also tested manually with an override with a different version, with an override with an invalid policy and with a valid override (see command above).

Relates to ES-11009
2025-03-14 09:33:08 +01:00
Kostas Krikellas
7b30cd2c38
Unmute LogsdbIndexingRollingUpgradeIT tests (#124851)
These test failed briefly because
https://github.com/elastic/elasticsearch/pull/124803 was merged and
https://github.com/elastic/elasticsearch/pull/124787 wasn't.

Fixes #124830 Fixes #124831 Fixes #124833
2025-03-14 19:32:30 +11:00
elasticsearchmachine
084627e8d3 Mute org.elasticsearch.xpack.ilm.DataStreamAndIndexLifecycleMixingTests testUpdateIndexTemplateFromILMtoBothILMAndDataStreamLifecycle #124850 2025-03-14 17:34:34 +11:00
elasticsearchmachine
c632e7719c Mute org.elasticsearch.xpack.ilm.DataStreamAndIndexLifecycleMixingTests testUpdateIndexTemplateToMigrateFromDataStreamLifecycleToIlm #124849 2025-03-14 17:20:26 +11:00
elasticsearchmachine
b8bd16e8aa Mute org.elasticsearch.backwards.MixedClusterClientYamlTestSuiteIT test {p0=search.vectors/41_knn_search_bbq_hnsw/Test knn search} #124848 2025-03-14 17:10:26 +11:00
elasticsearchmachine
1e8edd5abd Mute org.elasticsearch.datastreams.lifecycle.DataStreamLifecycleServiceIT testAutomaticForceMerge #124846 2025-03-14 16:33:32 +11:00
Stanislav Malyshev
35cdc82743
Refactor CrossClusterQueryWithPartialResultsIT tests (#124811) 2025-03-14 01:21:39 +00:00
elasticsearchmachine
0497e4be4a Mute org.elasticsearch.xpack.esql.optimizer.rules.logical.PropagateInlineEvalsTests testGroupingAliasingMoved_To_LeftSideOfJoin_WithExpression #124838 2025-03-14 09:28:49 +11:00
elasticsearchmachine
cd2edb277c Mute org.elasticsearch.xpack.esql.optimizer.rules.logical.PropagateInlineEvalsTests testGroupingAliasingMoved_To_LeftSideOfJoin #124839 2025-03-14 09:28:42 +11:00
elasticsearchmachine
58d683dae9 Mute org.elasticsearch.xpack.ilm.DataStreamAndIndexLifecycleMixingTests testUpdateIndexTemplateToDataStreamLifecyclePreference #124837 2025-03-14 09:13:55 +11:00
elasticsearchmachine
b2899f19b5 Mute org.elasticsearch.upgrades.LogsdbIndexingRollingUpgradeIT testIndexing {upgradedNodes=1} #124833 2025-03-14 08:53:16 +11:00
elasticsearchmachine
42fa81375b Mute org.elasticsearch.upgrades.LogsdbIndexingRollingUpgradeIT testIndexing {upgradedNodes=3} #124831 2025-03-14 08:44:36 +11:00
elasticsearchmachine
9523b29ff7 Mute org.elasticsearch.upgrades.LogsdbIndexingRollingUpgradeIT testIndexing {upgradedNodes=2} #124830 2025-03-14 08:44:28 +11:00
Martijn van Groningen
13bbd4b5ef
Don't enable docvalues by default for the time being. (#124787)
By change index.mapping.use_doc_values_skipper setting's default to false.
2025-03-13 21:40:47 +00:00
Niels Bauman
af6eb8cc38
Run TransportGetDataStreamsAction on local node (#122852)
This action solely needs the cluster state, it can run on any node.
Additionally, it needs to be cancellable to avoid doing unnecessary work
after a client failure or timeout.

Relates #101805
2025-03-13 21:16:14 +00:00
Patrick Doyle
df7be39de3
Silence AWS entitlement warnings from ALL-UNNAMED (#124805) 2025-03-13 16:42:29 -04:00
David Turner
d5d81a57db
Upgrade AWS v2 SDK to 2.30.38 (#124738)
Adopts fix for https://github.com/aws/aws-sdk-java-v2/issues/5754,
removing the need for read permissions of sensitive files in
`${HOME}/.aws`.
2025-03-14 07:38:39 +11:00
David Turner
fd7866a2f8
Expand some threadpool docs (#123244) 2025-03-14 07:35:20 +11:00
Pat Whelan
10a0b9bb47
[ML] Fix Get DeepSeek Model (#124802)
When secrets are null, we should allow the model to return for the Get
Model API.
2025-03-13 20:26:21 +00:00
Armin Braun
9f6042ad1a
Make AbstractSearchAsyncAction release resources earlier (#124275)
We can release resources earlier by releasing before responding to the
listener (everything that needs retaining is retained via the search
response already) as well as make the GCs life a little easier and get
obvious correctness by using the listener that nulls out resources in a
thread-safe manner intead of a non-thread-safe and mutable list shared
across all kinds of places in the code.
2025-03-13 20:03:47 +01:00
George Wallace
472536c189
lookup join docs (#124531)
* lookup join docs


---------

Co-authored-by: Alexander Spies <alexander.spies@elastic.co>
2025-03-13 12:47:58 -06:00
Jonathan Buttner
bf53f97efd
[ML] Migrate model_version to model_id when parsing persistent elser inference endpoints (#124769)
* Handling model_version for prexisting endpoints

* Update docs/changelog/124769.yaml
2025-03-13 13:54:11 -04:00
Jonathan Buttner
1bee2cc3cc
[ML] Remove Voyageai request manager classes (#124512)
* Removing voyage request managers

* Fixing tests
2025-03-13 13:47:36 -04:00
Martijn van Groningen
5bbc04bc66
Cleanup assert in DownsampleShardIndexer (#124751) 2025-03-13 18:07:59 +01:00
Valeriy Khakhutskyy
5f204938f8
[ML] Refactor deprecated routes and simplify class hierarchy (#124755)
Removes deprecated routes and API parameters.

The old 7.x routes for text file structure finding _text_structure/find_file_structure have been deprecated since 8 and replaced with _text_structure/find_structure. Also this PR simplifies the class hierarchy of GetDatafeedsStatsAction.

Non-issue as the deprecation and removal in 9 was long signaled.
2025-03-13 17:40:47 +01:00
Ignacio Vera
6036a1ef00
Build list of the right length in #finalizeSampling (#124762)
Avoid oversize list in internal aggregations.
2025-03-13 17:14:20 +01:00
David Turner
519381f2c1
Clarify double-response exception (#124706)
It is confusing to readers to report `Channel is already closed` in
reaction to a double-response bug, and this may be interpreted as a
networking issue. We're not really closing anything here, and it's a
definite logic bug to call `sendResponse()` twice, so this commit
clarifies the actual problem in the exception message.

Relates ES-10996
2025-03-14 02:48:43 +11:00
Nik Everett
1e25a54ac5
ESQL: TO_LOWER process all values (#124676)
Make `TO_LOWER` and `TO_UPPER` process all values it received.

This is quite large because it borrows a lot of code from the regular
evaluator generator to generate conversions so we can use the Locale.
That change propagates to the order of some parameters and to the
`toString` and a few more places.

Closes #124002
2025-03-13 11:00:25 -04:00
Martijn van Groningen
d81c7995a7
Improve rolling up metrics (#124739)
Remove unneeded Metric abstraction in MetricFieldProducer, which speeds-up rolling up gauges/counters.
2025-03-13 14:54:12 +00:00
Armin Braun
70486b45e6
Release aggregations earlier during reduce (#124520)
Release each hit's aggregations before moving on to the next hit and unlink it from the shard result even earlier.
Also, do the aggregation-reduce earlier in the reduce steps to reduce average heap use over time. 
To that effect, do not do the reduction in the search phase controller. This has the added benefit of removing any need for a fake aggs-reduce-context in scroll.
2025-03-13 15:36:27 +01:00
Craig Taverner
a7d1bd8938
Refine .gitattributes to hide generated docs changes (#124742) 2025-03-13 15:32:50 +01:00
Alexander Spies
fc4d8d65e5
ESQL: Enable visualizing a query profile (#124361)
To understand query performance, we often peruse the output of
`_query`-requests run with `"profile": true`.

This is difficult when the query runs in a large cluster with many nodes
and shards, or in case of CCQ.

This adds an option to visualize a query using Chromium's/Chrome's
builtin `about:tracing` - or, for even better visuals and querying the
different drivers via SQL, perfetto (c.f. https://ui.perfetto.dev/).

To use, save the JSON output of a query run with `"profile": true` to a
file, like `output.json` and then invoke the following Gradle task:

```
./gradlew x-pack:plugin:esql:tools:parseProfile --args='~/output.json ~/parsed_profile.json'
```

Either open `about:tracing` in Chromium/Chrome
![image](https://github.com/user-attachments/assets/75e17ddf-f032-4aa1-bf3e-61b985b4e0b6)
Or head over to https://ui.perfetto.dev (build locally in case of
potentially sensitive data in the profille):
![image](https://github.com/user-attachments/assets/b3372b7d-fbec-45aa-a68c-b24e62a8c704)

Every slice is a driver, the colors indicating the ratio of cpu time
over total time. - In Perfetto, essentials like duration, cpu duration,
timestamp and a few others can be queried via SQL - this allows e.g.
querying for all drivers that spent more than 50% of their time waiting
and other fun things.
![image](https://github.com/user-attachments/assets/4a0ab2ce-3585-4953-b2eb-71991777b3fa)

- Details about a driver, esp. which operators it ran, are available when clicking the driver's slice.
![image](https://github.com/user-attachments/assets/e1c0b30d-0a31-468c-9ff4-27ca452716fc)
2025-03-14 01:10:25 +11:00
Benjamin Trent
b2c1c4e0f0
New vector_rescore parameter as a quantized index type option (#124581)
This adds a new parameter to the quantized index mapping that allows
default oversampling and rescoring to occur. 

This doesn't adjust any of the defaults. It allows it to be configured.
When the user provides `rescore_vector: {oversample: <number>}` in the
query it will overwrite it.

For example, here is how to use it with bbq:

```
PUT rescored_bbq
{
  "mappings": {
    "properties": {
      "vector": {
        "type": "dense_vector",
        "index_options": {
          "type": "bbq_hnsw",
          "rescore_vector": {"oversample": 3.0}
        }
      }
    }
  }
}
```

Then, when querying, it will auto oversample the `k` by `3x` and rerank
with the raw vectors.

```
POST _search
{
  "knn": {
    "query_vector": [...],
    "field": "vector"
  }
}
```
2025-03-14 00:40:08 +11:00
Yang Wang
cd25958700
Refactor Metadata.toXContent by extracting methods (#124689)
The method is long and has two distinct paths for multi-project and
single-project formats. This PR extracts separate method for each of the
code paths for readability.

See also:
https://github.com/elastic/elasticsearch/pull/124613#discussion_r1990981472
2025-03-14 00:31:20 +11:00
elasticsearchmachine
73f0693c2a Mute org.elasticsearch.common.metrics.ExponentiallyWeightedMovingRateTests testEwmr_threadSafe #124692 2025-03-14 00:29:08 +11:00
Craig Taverner
d5ddb909a4
ESQL autogenerate docs v3 (#124312)
Building on the work started in https://github.com/elastic/elasticsearch/pull/123904, we now want to auto-generate most of the small subfiles from the ES|QL functions unit tests.

This work also investigates any remaining discrepancies between the original asciidoc version and the new markdown, and tries to minimize differences so the docs do not look too different.

The kibana json and markdown files are moved to a new location, and the operator docs are a little more generated than before (although still largely manual).
2025-03-13 14:16:46 +01:00
Slobodan Adamović
cac356ae64
Disable queryable built-in feature in docs YAML tests (#124684)
The .security index is created asynchronously on a cluster startup. This
affects some of the docs YAML tests in a way that they need to account
for the existence of the .security index or wait for the index to be
created and green. This PR disables the feature for docs YAML tests.
Disabling the feature in docs YAML tests will solve the flakiness
without affecting the coverage.

Resolves https://github.com/elastic/elasticsearch/issues/122343 Resolves
https://github.com/elastic/elasticsearch/issues/121748 Resolves
https://github.com/elastic/elasticsearch/issues/121611 Resolves
https://github.com/elastic/elasticsearch/issues/121345 Resolves
https://github.com/elastic/elasticsearch/issues/121338 Resolves
https://github.com/elastic/elasticsearch/issues/121337 Resolves
https://github.com/elastic/elasticsearch/issues/121288 Resolves
https://github.com/elastic/elasticsearch/issues/121287 Resolves
https://github.com/elastic/elasticsearch/issues/121867 Resolves
https://github.com/elastic/elasticsearch/issues/122335 Resolves
https://github.com/elastic/elasticsearch/issues/122681 Resolves
https://github.com/elastic/elasticsearch/issues/121976 Resolves
https://github.com/elastic/elasticsearch/issues/123094 Resolves
https://github.com/elastic/elasticsearch/issues/123192 Resolves
https://github.com/elastic/elasticsearch/issues/122983 Resolves
https://github.com/elastic/elasticsearch/issues/124671 Resolves
https://github.com/elastic/elasticsearch/issues/124103
2025-03-13 23:13:45 +11:00
Martijn van Groningen
81f33e4602
Change downsample's MetricFieldProducers (#124701)
Refactor MetricFieldProducer to use SortedNumericDoubleValues instead of FormattedDocValues, which saves unneeded conversations / casts.
2025-03-13 11:59:46 +00:00
Mariusz Józala
b427a2bf4e
[Tests] Limit IOUtilTests on Windows (#124716)
On Windows read-only directories where files cannot be stored are not
supported. It makes this test irrelevant for this OS.
2025-03-13 21:59:23 +11:00
Jan Kuipers
a503497bce
Add max.chunks to EmbeddingRequestChunker to prevent OOM (#123150)
* add max number of chunks

* wire merge function

* implement sparse merge function

* move tests to correct package/file

* float merge function

* bytes merge function

* more accurate byte average

* spotless

* Fix/improve EmbeddingRequestChunkerTests

* Remove TODO

* remove unnecessary field

* remove Chunk generic

* add TODO

* Remove specialized chunks

* add comment

* Update docs/changelog/123150.yaml

* update changelog
2025-03-13 11:38:12 +01:00
David Turner
c24f77f547
Fix stack trace in ActionListener#assertOnce (#124672)
In #112380 we changed this `assert` to yield a `String` on failure
rather than the original `ElasticsearchException`, which means we don't
see the original completion's stack trace any more. This commit
reinstates the lost stack trace.
2025-03-13 20:43:38 +11:00
Ievgen Degtiarenko
734dd070e7
Query hot indices first (#122928) 2025-03-13 10:28:15 +01:00
Armin Braun
4a951e752c
Make function score query rewrite a little cheaper (#124637)
Just a random thing I noticed, this seemingly overlooked when
porting to the new rewrite API. No need to create a new searcher, we
already have one here.
2025-03-13 10:03:31 +01:00
Nick Tindall
9edeaae6e6
Unmute test that was fixed long ago (#124695)
The test was fixed in in d48cf3f2f0
2025-03-13 18:09:37 +11:00
Martijn van Groningen
ce3a778fa1
Improve downsample performance by buffering docids and do bulk processing. (#124477) 2025-03-13 07:46:08 +01:00
Andrei Stefan
c48f9a9e1c
ESQL: Change the order of the optimization rules (#124335) 2025-03-13 07:45:37 +02:00
Nick Tindall
74d61a4052
Retry when the server can't be resolved (#123852) 2025-03-13 12:38:04 +11:00
Yang Wang
076f61d40c
Combine cluster and project tasks in xcontent for single project (#124613)
This PR combines both cluster and project tasks under persistent_tasks
for XContent output of Metadata when it contains only a single project,
i.e. there will be no cluster_persistent_tasks in such output.  This is
to maintain the existing output format when the cluster is not
multi-project enabled.

Relates: MP-1945
2025-03-13 10:48:26 +11:00
Nik Everett
7e746ce5c2
ESQL: Fix a test oom (#124685)
The test was generating too much data

Closes #124330
2025-03-13 10:36:32 +11:00
elasticsearchmachine
17044d7f9d Mute org.elasticsearch.multiproject.test.CoreWithMultipleProjectsClientYamlTestSuiteIT test {yaml=search.vectors/41_knn_search_byte_quantized/kNN search plus query} #124687 2025-03-13 10:23:42 +11:00
David Turner
bf804fcf34
Add consistency checker for stuck snapshot debugging (#124616)
Checks the local cluster state after marking a shard snapshot as
complete, and logs a message if the completion is not reflected in this
cluster state.
2025-03-13 10:18:04 +11:00
Matt Culbreth
b9ec8fd35e
Remove @UpdateForV9 annotations from Security code (#123176) 2025-03-12 18:32:37 -04:00
Mikhail Berezovskiy
ecb602de7f
change payload lower bound for resumable upload test (#124674) 2025-03-12 14:10:51 -07:00
Joe Gallo
d565304f4b
Fix geoip databases index access after system feature migration (take 3) (#124604) 2025-03-12 14:03:57 -04:00
Tommaso Teofili
c971d79a95
Let MLTQuery throw IAE when no analyzer is set (#124662)
* Let MLTQuery throw IAE when no analyzer is set
2025-03-12 18:37:31 +01:00
Mridula
44a3ac444f
Removed logger and also fixed the nitpick comments (#124650) 2025-03-12 18:33:03 +01:00
Pat Whelan
1f6aa1a18d
[ML] Enable DeepSeek Completion (#124665)
Enable streaming Completion as well as Chat Completion
2025-03-12 18:23:05 +01:00
Charlotte Hoblik
9e754ec8f6
[DOCS] Plugin management reference cleanup (#124578)
* add content to plugin management

* add content to Plugin Management

* Update docs/reference/elasticsearch-plugins/plugin-management.md

Co-authored-by: florent-leborgne <florent.leborgne@elastic.co>

* fix applies-to tag

* add ech to docset.yml

---------

Co-authored-by: florent-leborgne <florent.leborgne@elastic.co>
2025-03-12 17:01:10 +01:00
Valeriy Khakhutskyy
44fba7213d
[ML] Provide model_size_stats as soon as an anomaly detection job is opened (#124638)
Fixes #121168
2025-03-12 16:57:58 +01:00
Mariusz Józala
4ff1aade13
[Tests] Fix copying files for test cluster (#124628)
In case when file with `.attach_pid` in name was stored in distribution
and then deleted, the exception could stop copying/linking files
without any sign of issue. The files were then missing in the cluster
used in the test causing them sometimes to fail (depending on which
files haven't been copied).

When using `Files.walk` it is impossible to catch the IOException and
continue walking through files conditionally. It has been replaced with
FileVisitor implementation to be able to continue if the exception is
caused by files left temporarily by JVM but no longer available.
2025-03-12 16:09:55 +01:00
Pat Whelan
9f89a3b318
[ML] Integrate with DeepSeek API (#122218)
Integrating for Chat Completion and Completion task types, both calling
the chat completion API for DeepSeek.
2025-03-12 15:24:39 +01:00
Andrei Dan
d553455092
Add metrics around the file extensions we request when populating the cache (#123134)
This adds the file extentions for the blobs we request when populating the
cache.
The possible values for lucene extensions are around 50 and we use a special
"other" category for everything else, as a fallback.
2025-03-12 14:12:56 +00:00
Nik Everett
50aaa1c2a6
ESQL: Pragma to load from stored fields (#122891)
This creates a `pragma` you can use to request that fields load from a
stored field rather than doc values. It implements that pragma for
`keyword` and number fields.

We expect that, for some disk configuration and some number of fields,
that it's faster to load those fields from _source or stored fields than
it is to use doc values. Our default is doc values and on my laptop it's
*always* faster to use doc values. But we don't ship my laptop to every
cluster.

This will let us experiment and debug slow queries by trying to load
fields a different way.

You access this pragma with:
```
curl -HContent-Type:application/json -XPOST localhost:9200/_query?pretty -d '{
    "query": "FROM foo",
    "pragma": {
        "field_extract_preference": "STORED"
    }
}'
```

On a release build you'll need to add `"accept_pragma_risks": true`.
2025-03-12 09:40:42 -04:00
elasticsearchmachine
690454000c Mute org.elasticsearch.repositories.gcs.GoogleCloudStorageBlobContainerStatsTests testResumableWrite #124648 2025-03-13 00:39:31 +11:00
Yang Wang
4344a10dcc
AutoCreation waits for active shards in the right project context (#124636)
This PR replaces the default project ID with the actual project while
waiting for active shards after index auto-creation similar to how wait
is done for explicit index creation.
2025-03-13 00:20:28 +11:00
Simon Cooper
d7864f4af6
Refactor JMH script vector distance benchmark to add panama benchmarks (#124351)
Add vector benchmarks vs scalar, and automatically pick up new implementations as they get added
2025-03-12 13:15:16 +00:00
Mridula
f6538e86e2
Prevent Query Rule Creation with Invalid Numeric Match Criteria (#122823)
* SEARCH-802 - bug fixed - Query rules allows for creation of rules with invalid match criteria

* [CI] Auto commit changes from spotless

* Worked on the comments given in the PR

* [CI] Auto commit changes from spotless

* Fixed Integration tests

* [CI] Auto commit changes from spotless

* Made changes from the PR

* Update docs/changelog/122823.yaml

* [CI] Auto commit changes from spotless

* Fixed the duplicate code issue in queryRuleTests

* Refactored code to clean it up based on PR comments

* [CI] Auto commit changes from spotless

* Logger statements were removed

* Cleaned up the QueryRule tests

* [CI] Auto commit changes from spotless

* Update x-pack/plugin/ent-search/src/test/java/org/elasticsearch/xpack/application/EnterpriseSearchModuleTestUtils.java

Co-authored-by: Mike Pellegrini <mike.pellegrini@elastic.co>

* [CI] Auto commit changes from spotless

---------

Co-authored-by: elasticsearchmachine <infra-root+elasticsearchmachine@elastic.co>
Co-authored-by: Kathleen DeRusso <kathleen.derusso@elastic.co>
Co-authored-by: Mike Pellegrini <mike.pellegrini@elastic.co>
2025-03-12 13:56:13 +01:00
Ievgen Degtiarenko
79e776a488
Add missing capabilities (#124625) 2025-03-12 13:28:18 +01:00
Tim Grein
0b83425d17
[Inference API] Propagate product use case http header to EIS (#124025) 2025-03-12 12:48:24 +01:00
Pete Gillin
43eee87fed
Implement an exponentially weighted moving rate (#124507)
This is intended to be used to efficiently calculate a write load
metric for use by the auto-sharding algorithm which favours more
recent loads.

ES-10037 #comment Core algorithm added in https://github.com/elastic/elasticsearch/pull/124507
2025-03-12 10:09:53 +00:00
Ievgen Degtiarenko
8d11dd2a98
Limit concurrent node requests (#122850) 2025-03-12 10:02:38 +01:00
Moritz Mack
c41caeb6cd
Enable FIPS entitlements based on org.bouncycastle.fips.approved_only. (#124577)
When enabling FIPS `javax.net.ssl.trustStore` is not necessarily set.
This change adds FIPS entitlements based on
`org.bouncycastle.fips.approved_only=true`, which enforces usage of FIPS
approved functionality only.

Additionally, this PR grants read access to a custom trust store if
provided via `javax.net.ssl.trustStore`, otherwise read access to the
default JDK trust store is granted.

Relates to ES-11025.
2025-03-12 19:54:48 +11:00
Lorenzo Dematté
37a363050e
[Entitlements] Add support for IT tests of always allowed actions (take 2) (#124429)
Writing tests for #123861, turns out that #124195 is not enough.
We really need new IT test cases for "always allowed" actions: in order to be sure they are allowed, we need to setup the plugin with no policy.
This PR adds test cases for that, plus the support for writing test functions that accept one Environment parameter: many test paths we test and allow/deny are relative to paths in Environment, so it's useful to have access to it (see readAccessConfigDirectory as an example)
2025-03-12 09:44:30 +01:00
Lorenzo Dematté
d844c6a847
[Entitlements] Exclude java.desktop from system modules (#124563)
* exclude java.desktop from system modules

* add IT test
2025-03-12 08:34:52 +01:00
Tim Rühsen
c0efcd01c8
[Profiling] Fix NullPointerExceptions by accepting dotted field names (#124506)
* [Profiling] Fix NullPointerExceptions by accepting dotted field names

Profiling uses synthetic source and thus expects nested field names in query responses.
With 8.17+, synthetic source is available only to Enterprise (or higher) subscriptions,
so that smaller subscriptions have dotted field names in query responses.
The profiling plugin relies on nested field names and runs into NullPointerExceptions
if these are not found.

This PR fixes the NullPointerExceptions that could happen with dotted field names.

Signed-off-by: Tim Rühsen <tim.ruhsen@elastic.co>

* Evaluate source only once (cleanup)

---------

Signed-off-by: Tim Rühsen <tim.ruhsen@elastic.co>
2025-03-12 08:34:15 +01:00
elasticsearchmachine
49f7cfb22f Mute org.elasticsearch.lucene.spatial.CartesianCentroidCalculatorTests testAddDifferentDimensionalType #124609 2025-03-12 12:20:01 +11:00
Mikhail Berezovskiy
053b037a9b
GCS blob store: add OperationPurpose/Operation stats counters (#122991) 2025-03-11 17:57:15 -07:00
Lee Hinman
dd2a5c691a
Add .monitoring exemption to DotPrefixValidator (#124158)
This was something we were planning on removing, but have not yet.

Resolves #124131
2025-03-12 10:06:14 +11:00
elasticsearchmachine
ae1d57f941 Mute org.elasticsearch.xpack.restart.MLModelDeploymentFullClusterRestartIT testDeploymentSurvivesRestart {cluster=OLD} #124160 2025-03-12 08:33:19 +11:00
kanoshiou
deff3df9f0
ES|QL: Support ::date in inline cast (#123460)
* Inline cast to date

* Update docs/changelog/123460.yaml

* New capability for `::date` casting

* More tests

* Update tests

---------

Co-authored-by: Fang Xing <155562079+fang-xing-esql@users.noreply.github.com>
2025-03-11 17:08:10 -04:00
Mark Vieira
74ccd4dba2
Filter module-info.class from entitlements-bridge jar in distribution (#124580) 2025-03-11 13:37:03 -07:00
Patrick Doyle
5112dbbb3b
Reduce noise from NotEntitledException logging (#124511)
* Refactor: findRequestingFrame

* INFO instead of WARN for NotEntitledException.

Some of these are expected, so an INFO seems more appropriate.

The stack trace tends to attract attention even when entitlements are not the
cause of a problem, so let's avoid the stack trace, but still include stack
frame info from the frame of interest.

* Use child loggers for Not Entitled logs

* Use warn, and include compoenent name

* Fix ALL_UNNAMED

* Mute entitlement warnings from repositories

* PR feedback

* Common out the Not Entitled prefix.

We're alerting on this, so let's not rely on every caller of notEntitled to remember it.
2025-03-11 15:50:31 -04:00
Julien Mailleret
e5cf597782
Fix IronBank hardening_manifest CI test (#124579)
This commit fix the IronBank hardening_manifest CI test that expect the
hardening_manifest.yaml values to match `'^(?!\\s*$)[ -~|]*$'` regex:

```
| hardening_manifest           | ERROR    | Hardening Manifest failed jsonschema validation
| hardening_manifest           | ERROR    | Verify Hardening Manifest content
| hardening_manifest           | ERROR    | 'Rene Gröschke' does not match '^(?!\\s*$)[ -~|]*$'
```

43219286

cc @breskeby 

<!-- Thank you for your interest in and contributing to Elasticsearch!
There are a few simple things to check before submitting your pull
request that can help with the review process. You should delete these
items from your submission, but they are here to help bring them to your
attention. -->

- Have you signed the [contributor license agreement](https://www.elastic.co/contributor-agreement)?
- Have you followed the [contributor guidelines](https://github.com/elastic/elasticsearch/blob/main/CONTRIBUTING.md)?
- If submitting code, have you built your formula locally prior to submission with `gradle check`?
- If submitting code, is your pull request against main? Unless there is a good reason otherwise, we prefer pull requests against main and will backport as needed.
- If submitting code, have you checked that your submission is for an [OS and architecture that we support](https://www.elastic.co/support/matrix#show_os)?
- If you are submitting this code for a class then read our [policy](https://github.com/elastic/elasticsearch/blob/main/CONTRIBUTING.md#contributing-as-part-of-a-class) for that.
2025-03-12 06:22:10 +11:00
Iván Cea Fontenla
2fff041077
ESQL: Push down StartsWith and EndsWith functions to Lucene (#123381)
Fixes https://github.com/elastic/elasticsearch/issues/123067

Just like WildcardLike and RLike, some functions can be converted to Lucene queries. Here it's those two, which are nearly identical to WildcardLike

This, like some other functions, needs a FoldContext. I'm using the static method for this here, but it's fixed in https://github.com/elastic/elasticsearch/pull/123398, which I kept separated as it changes many files
2025-03-11 19:14:05 +01:00
Pete Gillin
6cb5f8360b
Disable the IntelliJ inspection for string templates (#124570)
IntelliJ has been suggesting switching to string templates (at least
it has for me). This is unhelpful advice, since the feature was only
ever a tech preview and was removed in more recent JVMs. This change
disables that inspection.
2025-03-11 17:13:05 +01:00
Simon Cooper
d8e889acb6
Restore TextSimilarityRankBuilder XContent output (#124564) 2025-03-11 16:03:04 +00:00
elasticsearchmachine
2187c252b5 Mute org.elasticsearch.multiproject.test.CoreWithMultipleProjectsClientYamlTestSuiteIT test {yaml=data_stream/150_tsdb/created the data stream} #124575 2025-03-12 02:46:40 +11:00
elasticsearchmachine
e5adc6058c Mute org.elasticsearch.xpack.esql.expression.function.aggregate.ValuesTests testGroupingAggregate {TestCase=<<no alt geo_shape>s> #2} #124571 2025-03-12 02:13:28 +11:00
Mark Tozzi
3e949479d8
ESQL - Include thread names in profile output (#124262)
Resolves #123053

This adds the thread name to the driver sleep profile output.
---------

Co-authored-by: elasticsearchmachine <infra-root+elasticsearchmachine@elastic.co>
2025-03-11 15:53:22 +01:00
Carlos Delgado
2b40e73fe9
ES|QL - Add scoring for full text functions disjunctions (#121793) 2025-03-11 15:29:15 +01:00
Johannes Fredén
e11d89d76b
Bump nimbus-jose-jwt to 10.0.2 (#124544)
This bumps nimbus-jose-jwt from 10.0.1 -> 10.0.2
2025-03-12 00:23:33 +11:00
Jonathan Buttner
543c50a9ce
[ML] Refactor OpenAI to use ConstructingObjectParser and consolidate class locations (#124380)
* Switching openai to ConstructingObjectParser

* Moving files

* Fixing package errors
2025-03-11 08:26:26 -04:00
Martijn van Groningen
58d80f36a3
Improve DownsampleActionSingleNodeTests testing (#124550)
By indexing the test data set in multiple bulk requests, which ensure there are multiple segments, which improves testing coverage for DownsampleShardIndexer.

We don't catch more complex DownsampleShardIndexer issues if we end up with just one segment. Hence, we need to make the DownsampleShardIndexer test suite a little bit more evil by ensuring we have more than one segment.
2025-03-11 13:05:43 +01:00
Arpad Kiraly
8da3beaee6
Remove @UpdateForV9 annotation in FullClusterRestartIT.java (#124474)
* Remove @UpdateForV9 annotation in FullClusterRestartIT.java

* Remove UpdateForV9 import from FullClusterRestartIT.java
2025-03-11 12:59:36 +01:00
Jan Calanog
435d1db5b9
Remove subs attribute (#124551) 2025-03-11 12:14:58 +01:00
Kostas Krikellas
04917c5ea3
Avoid warnings for non-system indexes using fast_refresh (#124294)
* Update LogsdbIndexModeSettingsProvider.java

* add test
2025-03-11 12:05:22 +02:00
David Kyle
444b8eab75
[ML] Avoid potentially throwing calls to Task#getDescription in model download 2025-03-11 09:48:07 +00:00
Moritz Mack
c26d195120
Rethrow NoSuchFileException if encountering an invalid symlink when checking file entitlements (#124483)
This will rethrow the `NoSuchFileException` when encountering an invalid
symbolic link when following links during file (read) entitlement
checks.

Relates to https://github.com/elastic/elasticsearch/pull/124133
(ES-11019)
2025-03-11 20:38:03 +11:00
Ioana Tagirta
cda82554aa
ES|QL: Add initial grammar and planning for RRF (snapshot) (#123396) 2025-03-11 10:18:11 +01:00
David Turner
f1f2df77ba
Tighten up threading in snapshot finalization (#124403)
Today snapshot finalization does nontrivial work on the calling thread
(often the cluster applier thread) and also in theory may fork back to
the cluster applier thread in `getRepositoryData`, yet it always forks
at least one task (the `SnapshotInfo` write) to the `SNAPSHOT` pool
anyway. With this change we fork to the `SNAPSHOT` pool straight away
and then make sure to stay on this pool throughout.
2025-03-11 18:12:58 +11:00
Martijn van Groningen
45f2eb205f
Optimize tsdb codec for segment merging (#124392)
By implementing the getMergeInstance() method in ES87TSDBDocValuesProducer
2025-03-11 07:52:45 +01:00
Tim Vernum
fdfe63eb37
Unable working MP YAML Tests (#124532)
This commit enables some existing yaml tests that work correctly on
multi-project
2025-03-11 15:45:54 +11:00
Yang Wang
207c2df14c
[Test] Move helper mthods for multi-project rest test (#124285)
This PR moves the helper methods up to the base ESRestTestCase class so
that they can be reused by other subclasses, e.g. the ones on the
serverless side.

Relates: ES-10292
2025-03-11 12:53:10 +11:00
Brendan Cully
08b16ebb61
Introduce IndexReshardingMetadata (#121360)
* Introduce IndexReshardingMetadata

This adds to IndexMetadata the persistent state
we will need to track while a split is in progress.
Nothing outside test code sets it yet, so it doesn't
introduce any wire changes yet.

Followups will consult this to make routing decisions and
handle backward compatibility if the object is present
in metadata.
2025-03-10 17:28:26 -07:00
Costin Leau
2761af000b
ESQL: Lazy collection copying during node transform (#124424)
* ESQL: Lazy collection copying during node transform

A set of optimization for tree traversal:
1. perform lazy copying during children transform
2. use long hashing to avoid object creation
3. perform type check first before collection checking

Relates #124395
2025-03-10 16:11:47 -07:00
Ed Savage
376aad0a05
[ML] Modify test case to update running job (#124287)
This PR makes a change to the existing Java REST test DetectionRulesIT.testCondition such that it updates detection rules for a running job. Previously it had relied on closing and re-opening the job for the update to take effect.

Relates elastic/ml-cpp#2821
2025-03-11 09:53:06 +13:00
elasticsearchmachine
eb81ed3a38 Mute org.elasticsearch.multiproject.test.CoreWithMultipleProjectsClientYamlTestSuiteIT test {yaml=data_stream/190_failure_store_redirection/Redirect ingest failure in data stream to failure store} #124518 2025-03-11 07:33:58 +11:00
Luca Cavanna
def4c890bc
Fix concurrency issue in ScriptSortBuilder (#123757)
Inter-segment concurrency is disabled whenever sort by field, included script sorting, is used in a search request.

The reason why sort by field does not use concurrency is that there are some performance implications, given that the hit queue in Lucene is build per slice and the different search threads don't share information about the documents they have already visited etc.

The reason why script sort has concurrency disabled is that the script sorting implementation is not thread safe. This commit addresses such concurrency issue and re-enables search concurrency for search requests that use script sorting. In addition, missing tests are added to cover for sort scripts that rely on _score being available and top_hits aggregation with a scripted sort clause.
2025-03-10 21:10:53 +01:00
Luca Cavanna
dfe2b249a0 [TEST] Remove BlockMultiValuedTests from muted tests list
This was added as a result of merging #124327, via a bad merge. Fix that with this commit.
2025-03-10 20:45:34 +01:00
Luca Cavanna
03d8bdf733
Docs and simplifications to support for Lucene ancient versions (#124053)
The old lucene versions plugin allows users to read indices created by ancient
Elasticsearch version, starting from 5.0. Especially for 5.x which relied on Lucene
6.x, some special logic is required around postings format support. That revolves
around reading of FSTs, but has a consequence of requiring quite a few fork of
other Lucene classes due to their visibility.

This commit attempts to add javadocs to clarify the intent of some of these classes.
It also includes some simplifications, in that Lucene50PostingsReader can be reused as-is
and some other classes are only needed in tests hence are moved to the test folder.
2025-03-10 20:00:20 +01:00
Luca Cavanna
22d7f397ed
Address test issue in QueryPhaseTimeoutTests (#124327)
The test that is verifying timeout handling when pulling a scorer supplier is
going to always score the entire segment. The test needs to be adjusted
accordingly. While at it, I added docs and clarified the tests a bit, as well
as added a couple new tests that cover for timeout handling when retrieving a
scorer from the scorer supplier.

Closes #124140

* [CI] Auto commit changes from spotless

* iter

* iter

* spotless

---------

Co-authored-by: elasticsearchmachine <infra-root+elasticsearchmachine@elastic.co>
2025-03-10 19:58:48 +01:00
Nhat Nguyen
79a1626160
Speed up block serialization (#124394)
Currently, we use NamedWriteable for serializing blocks. While 
convenient, it incurs a noticeable performance penalty when pages 
contain thousands of blocks. Since block types are small and already
centered in ElementType, we can safely switch from NamedWriteable to
typed code. For example, the NamedWriteable alone of a small page with
10K fields would be 180KB, whereas the new method reduces it to 10KB.
Below are the serialization improvements with FROM idx | LIMIT 10000
where the target index has 10K fields:

- write_exchange_response executed 173 times took: 73.2ms -> 26.7ms
- read_exchange_response executed 173 times took: 49.4ms -> 25.8ms
2025-03-10 11:54:38 -07:00
Ryan Ernst
3149640a93
Ignore ordering in policy manager exclulsive tests (#124488) 2025-03-10 09:46:51 -07:00
Lorenzo Dematté
a2b0d96778
fix file tests to work across multiple invocations (#124412) 2025-03-10 16:58:04 +01:00
Lorenzo Dematté
958352f12b
Fix FileAccessTreeTests#testDuplicateExclusivePaths to work on windows (#124430) 2025-03-10 16:20:17 +01:00
Nik Everett
a80402b13b
TSDB: Remove test compatibility for untested (#124113)
Removes testing compatibility switches for versions we no longer test
against.
2025-03-10 10:53:51 -04:00
Iván Cea Fontenla
0160c56441
ESQL: Unmute and fix BlockMultiValuedTests.testToMask (#124339)
Fixes https://github.com/elastic/elasticsearch/issues/124165
2025-03-10 15:31:43 +01:00
Rene Groeschke
e81ac2371d
[Tests] Simplify classpath for analytics javaRestTests (#124274)
This replaces the usage of a defaultDistribution for javaRestTest by the integTestDistribution.

This has a few advantages:
1. The overall dependencies on running the java rest tests are minimized.
   By using the default distribution we rely on building the whole default distribution (including all modules and plugins)
   before we can run these tests. This a) takes time and b) dramatically reduces the likelyhood of us avoiding test task execution at all as we
   basically declare the whole distro as an input. By using integTest distro we reduce the surface of the inputs dramatically which also results in faster
   execution of these tests
2. its more idiomatic as one pattern we see is that we e.g  disable the security settings that we would not need once we use the integTest distro without
   the security plugin
3. it makes test setup and its dependencies more explicit.

Point 3. might sound as like a downside at first, but for understanding what those tests are doing and what they are relying on I think its worth the 3 more lines of code.

Here are two build scans task executions:
- before the `javaRestTest` task requires `995 tasks, 2 transforms executed in 155 projects`: https://gradle-enterprise.elastic.co/s/drj5mfzsfx7ra/timeline
- after we only rely on `275 tasks, 2 transforms executed in 56 projects`: https://gradle-enterprise.elastic.co/s/jr5sblhppn4fg/timeline?page=2
2025-03-10 15:29:58 +01:00
Simon Cooper
cf89b22f86
Remove 7.17 transport versions (#124196) 2025-03-10 14:01:55 +00:00
Armin Braun
8aaca61d7e
Remove SearchOperationListenerExecutor abstraction (#124298)
This isn't even saving any lines of code and is a measurable
source of both cache and branch-prediction misses on the hot
and critical transport-thread path.
=> inline it
2025-03-10 14:32:51 +01:00
Moritz Mack
7cec9489c2
Fix entitlement checks for relative links (#124133) 2025-03-10 13:45:46 +01:00
Simon Cooper
9b0804049d
Remove 7.15 transport versions (#124193) 2025-03-10 12:34:16 +00:00
Martijn van Groningen
6afd3ecc58
Avoid reading unnecessary dimension values when downsampling (#124451)
Read dimension values once per tsid/bucket docid range instead of for each document being processed.
The dimension value within a bucket-interval docid range is always to same and this avoids unnecessary reads.

Latency of downsampling the tsdb track index into a 1 hour interval downsample index drop by ~16% (running on my local machine).
2025-03-10 12:12:42 +01:00
Mark Hopkin
a5f186bb5d
Give Kibana user 'all' permissions for .entity_analytics.* indices (#123588) 2025-03-10 11:57:12 +01:00
Mary Gouseti
44dd44bd2d
Remove test usages of DataStream#getDefaultBackingIndexName in ILM integration tests (#124319)
* Incorporate review comments
2025-03-10 12:38:23 +02:00
Charlotte Hoblik
e51b50139b
Fix external URI images (#124350) 2025-03-10 11:31:47 +01:00
Ignacio Vera
9042201187
Deduplicate created objects when deserializing InternalAggregations in SearchResponse (#124296)
It should help in case of cross cluster search.
2025-03-10 11:12:35 +01:00
David Turner
2026ce3c9e
Document getMinTransportVersion including exceptions (#124192)
The cluster's min transport version has some useful properties but also
some subtle exceptions that are today not documented in the code. This
commit adds some Javadocs in this area.
2025-03-10 19:58:11 +11:00
Niels Bauman
9cecc89fed
Run TransportExplainLifecycleAction on local node (#122885)
This action solely needs the cluster state, it can run on any node.
Additionally, it needs to be cancellable to avoid doing unnecessary work
after a client failure or timeout.

Relates #101805
2025-03-10 09:43:13 +01:00
Rene Groeschke
15b8407d28
[CI] Fix lucene compatibility tests in periodic builds (#124458)
our periodic builds still point to an incompatible commit in ES that has
been already been updated for our intake build
2025-03-10 19:15:32 +11:00
Armin Braun
a40c6da0d8
Cleanup dead code in o.e.search and o.e.a.search (#124445)
Just some obvious cleanups for stuff that became unused as of late.
2025-03-10 09:11:15 +01:00
Armin Braun
29ac2611fe
Make some constant SubscribableListener instances cheaper (#124452)
We can just use a real constant for the `null` case, avoiding any
non-plain stores in all cases. This should be somewhat helpful for the
security interceptors.
2025-03-09 22:32:00 +01:00
Armin Braun
425823cb5c
Remove some overhead from TransportService message handling (#124428)
Avoiding some indirection, volatile-reads and moving the listener
functionality that needlessly kept iterating an empty CoW list (creating
iterator instances, volatile reads, more code) in an effort to improve
the low IPC on transport threads.
2025-03-09 16:00:11 +01:00
elasticsearchmachine
bab03b3e35 Mute org.elasticsearch.indices.stats.IndexStatsIT testFilterCacheStats #124447 2025-03-10 00:40:12 +11:00
Nikolaj Volgushev
b374c483e8
More debug logging in realms authenticator (#124342)
This PR adds debug logging to the realms authenticator, for exceptions
around request processing.
2025-03-09 23:50:29 +11:00
Lorenzo Dematté
a15aee6274
[Entitlements] Add URLConnection instrumentation for jar protocol (#123861)
Follows #123824

Relates to ES-10994
2025-03-09 09:30:42 +01:00
elasticsearchmachine
9960863846 Mute org.elasticsearch.xpack.restart.FullClusterRestartIT testWatcherWithApiKey {cluster=UPGRADED} #124159 2025-03-09 17:29:48 +11:00
elasticsearchmachine
232e8f710e Mute org.elasticsearch.entitlement.runtime.policy.FileAccessTreeTests testDuplicateExclusivePaths #124437 2025-03-09 09:34:44 +11:00
Lorenzo Dematté
b8f1faac8d
remove addess to home/.aws for repository-s3 (#124190) 2025-03-08 23:30:17 +01:00
Lorenzo Dematté
a753d4392a
Revert "missing file entitlement used by google-http-client for oauth2 (#123985)" (#124329)
This reverts commit 404c9e6290.
2025-03-08 23:17:53 +01:00
Stanislav Malyshev
b9a97840bd
Fix test - wait for other threads before throwing the exception (#124386) 2025-03-08 19:31:02 +01:00
elasticsearchmachine
6f0756a5ee Mute org.elasticsearch.entitlement.runtime.policy.PolicyManagerTests testFilesEntitlementsWithExclusive #124420 2025-03-09 02:24:05 +11:00
Lorenzo Dematté
ab9ec4cf6f
Make NotEntitledException inherit from AccessControlException for compatibility purposes (#124321)
Even if the contract for JDK methods using the SecurityManager states that the exception throw is of type SecurityException, many libraries (including our own, apparently!) violates that and use the type actually thrown by SecurityManager, AccessControlException. A prime example is the GCS/CSP libraries.
In order to maintain compatibility for them, we need to inherit from the more specific AccessControlException; this is less desirable, as AccessControlException is marked as deprecated for removal alongside the other SecurityManager classes, but we discussed and found this is the best short term solution.

More work will be needed -- again, this is a short term solution.

Replaces #123984
2025-03-08 16:17:30 +01:00
Lorenzo Dematté
4981c15a95
[Entitlements] Add support for IT testing always allowed actions (#124195) 2025-03-08 16:03:16 +01:00
Ryan Ernst
7e1195dc9a
Add exclusive access files for security module (#123676)
This commit fills out missing entitlements for the security module.
Specifically they are config files which require exclusive access.
2025-03-08 07:02:36 -08:00
Joe Gallo
f15cc9667b
IngestDocument readability improvements (#124322) 2025-03-08 09:04:00 -05:00
Joe Gallo
0e87e8454d
DateProcessor refactoring (#124349) 2025-03-08 09:03:50 -05:00
Lorenzo Dematté
155e7d5592
[Entitlements] Use the correct format for the EntitlementInstrumented annotation descriptor (#124310) 2025-03-08 08:59:32 +01:00
Samiul Monir
f0d5220178
Handle empty input inference (#123763)
* Added check for blank string to skip generating embeddings with unit test

* Adding yaml tests for skipping embedding generation

* dynamic update not required if model_settings stays null

* Updating node feature for handling empty input name and description

* Update yaml tests with refresh=true

* Update unit test to follow more accurate behavior

* Added yaml tests for multu chunks

* [CI] Auto commit changes from spotless

* Adding highlighter yaml tests for empty input

* Update docs/changelog/123763.yaml

* Update changelog and test reason to have more polished documentation

* adding input value into the response source and fixing unit tests by reformating

* Adding highligher test for backward compatibility and refactor existing test

* Added bwc tests for  empty input and multi chunks

* Removed reindex for empty input from bwc

* [CI] Auto commit changes from spotless

* Fixing yaml test

* Update unit tests helper function to support both format

* [CI] Auto commit changes from spotless

* Adding cluster features for bwc

* Centralize logic for assertInference helper

---------

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
Co-authored-by: elasticsearchmachine <infra-root+elasticsearchmachine@elastic.co>
2025-03-07 23:38:42 -05:00
elasticsearchmachine
5752c71087 Mute org.elasticsearch.env.NodeEnvironmentTests testIndexCompatibilityChecks #124388 2025-03-08 09:25:29 +11:00
David Turner
88eeb8a5a1
Refactor SnapshotInfo dataflow in finalization (#124336)
There's no need to have a `SnapshotInfo` consumer to run at the end of
finalization, we only pass it the value we already calculated earlier.
This replaces it with a bare `Runnable` instead.
2025-03-08 09:17:13 +11:00
elasticsearchmachine
7949f87f5e Mute org.elasticsearch.xpack.inference.mapper.SemanticInferenceMetadataFieldsRecoveryTests testSnapshotRecovery {p0=false p1=false} #124385 2025-03-08 08:38:19 +11:00
elasticsearchmachine
7bee44a2b4 Mute org.elasticsearch.xpack.inference.mapper.SemanticInferenceMetadataFieldsRecoveryTests testSnapshotRecovery {p0=true p1=false} #124384 2025-03-08 08:38:13 +11:00
elasticsearchmachine
a485095409 Mute org.elasticsearch.xpack.inference.mapper.SemanticInferenceMetadataFieldsRecoveryTests testSnapshotRecovery {p0=false p1=true} #124383 2025-03-08 08:38:06 +11:00
David Turner
2fbce4b9c8
Introduce BoundedDelimitedStringCollector (#124303)
An issue with `Strings#collectionToDelimitedStringWithLimit` is that you
need to collect all the items together up front first, even if you're
going to throw most of them away. This commit introduces
`BoundedDelimitedStringCollector` which allows to accumulate the items
one-at-a-time instead.
2025-03-08 08:05:06 +11:00
Mike Pellegrini
db03788b17
Add bit vector support to semantic text (#123187) 2025-03-07 16:00:48 -05:00
David Kilfoyle
e158cd868b
[Docs] Fix cross-repo links to Beats docs (#124360)
Co-authored-by: Colleen McGinnis <colleen.mcginnis@elastic.co>
2025-03-07 14:38:46 -05:00
David Turner
93dea0f9d7
Use safeAwait in indexRandom (#124362)
No need to implement the safe wait on the latch by hand here, we can use
the other `safeAwait` variant that takes a timeout. Also adds a comment
discouraging its use elsewhere without good reason.
2025-03-08 06:19:59 +11:00
Parker Timmins
d83176d32a
Set cause on create index request in create from action (#124363)
In the create-index-from-source action, we should set the cause of the create index request so that it is clear in the logs. Without setting the cause on the request, the default value of api is used.
2025-03-07 13:14:12 -06:00
Mike Pellegrini
005d4c50fb
Don't use dot product similarity in SemanticInferenceMetadataFieldsRecoveryTests (#124364) 2025-03-07 14:13:16 -05:00
David Turner
80deeb8112
Drop unused prefix and suffix from string collection utils (#124353)
These parameters are confusing and almost entirely unused (apart from
one easily-adjusted test, two production locations where they are used
incorrectly, and one production location that can be adjusted not to
need them). This commit just removes them.
2025-03-08 05:09:25 +11:00
Svilen Mihaylov
ee4bcac1db
Added optional parameters to QSTR ES|QL function (#121787)
Adds options to QSTR function.

#118619 added named function parameters. This PR uses this mechanism for allowing query string function parameters, so query string parameters can be used in ES|QL.

Closes #120933
2025-03-07 13:00:22 -05:00
Artem Prigoda
5b2ea77904
[spotless] Remove extra imports (#124354)
Remove extra imports retained by #124194
2025-03-08 04:47:58 +11:00
Joe Gallo
f8ef78446a
Upgrade httpclient to 5.3.3 for build-tools-internal (#124018) 2025-03-07 11:43:15 -05:00
Tommaso Teofili
74bb0f9826
Do not let ShardBulkInferenceActionFilter unwrap / rewrap ESExceptions (#123890)
* do not let ShardBulkInferenceActionFilter unwrap / rewrap ESExceptions
2025-03-07 16:53:19 +01:00
Alexey Ivanov
02f01af2a0
Change setting's deprecation message wording (#120718)
Depending on whether a message is critical or warning a message should
indicate to check breaking changes documentation (critical level) or
deprecation changes documentation (warn level)

relates #79666
2025-03-07 15:31:55 +00:00
Simon Cooper
0dda109dc8
Remove 7.16 transport version (#124194) 2025-03-07 15:24:06 +00:00
Jan Kuipers
5948b71693
Fix NPE in AdaptiveAllocationsScalarService for null nodes (serverless) (#124318) 2025-03-07 15:37:34 +01:00
Ievgen Degtiarenko
9e7a90facf
Do not retry CBE (#124300) 2025-03-07 15:26:28 +01:00
Lorenzo Dematté
b663616aa2
[Entitlements] Fix AbstractDelegateHttpsURLConnection "this" parameter type (#124304)
Our check methods injected by the instrumenter receive "this" as the second parameter.
For internal classes like AbstractDelegateHttpsURLConnection we generally use a base type; in this case we were using javax.net.ssl.HttpsURLConnection, which is incorrect as AbstractDelegateHttpsURLConnection derives from java.net.HttpURLConnection.
This was not failing in our tests because we don't actually use that parameter in that check function.

Also, it was not failing on transform, just on retransformClasses, and only in JDK 24. Apparently, JDK 24 introduced new validation there (to be confirmed).

And it was failing just on cloud as the APM agent there (which is loaded before our agent) connects to a https endpoint - our IT tests, and ./gradlew run --with-apm-server, use a http endpoint. Using https makes the JVM load AbstractDelegateHttpsURLConnection, making it one of the classes we need to retransform, triggering the VerifyError.
2025-03-07 13:41:47 +01:00
elasticsearchmachine
d4b1dc0900 Mute org.elasticsearch.smoketest.MlWithSecurityIT test {yaml=ml/3rd_party_deployment/Test start and stop multiple deployments} #124315 2025-03-07 23:40:41 +11:00
Ievgen Degtiarenko
1b2f5653c0
Add tests for non-fatal errors in data node request sender (#124203) 2025-03-07 12:44:41 +01:00
Niels Bauman
954420495d
Fix some lazy rollover code (#124153)
The main goal of the PR is to fix the "rollover failed" log in the
`IndexTemplateRegistry`. We were logging this on every upgrade because
`rolloverResponse.isRolledOver()` is always `false` when we do a lazy
rollover request - which is the default for index template updates.

While I was looking at this, I noticed we don't actually return early
when we process a lazy rollover _dry run_. The end result happened to be
ok (i.e. side-effects and response), but I figured I might as well fix
the behavior to return early.

Finally, we add an `INFO` log in the lazy rollover action to aid the
debugging process.
2025-03-07 12:01:39 +01:00
Simon Cooper
b218f698f1
Remove 7.13 and 7.14 transport versions (#124115) 2025-03-07 08:19:56 +00:00
Simon Cooper
135b1658c2
Use valid REST version when determining capabilities (#123864)
If the rest api version is not specified, infer the correct one to use from the major versions present on the cluster, determined using features
2025-03-07 08:18:24 +00:00
Lorenzo Dematté
e3c953f799
[Entitlements] Allow read access to a plugin's directory (#124111) 2025-03-07 08:31:33 +01:00
Tim Vernum
fb322dc769
Migrate getProject().index calls to lookup index (#124178)
This migrates a number of calls of the form

    metadata.getProject().getIndexSafe(index)

or

    metadata.getProject().index(index)

to

    metadata.indexMetadata(index)

or

    metadata.findIndex(index)
2025-03-07 07:06:12 +01:00
Nick Tindall
e478ce1c88
Revert "Add temporary workaround for IntelliJ editorconfig bug (#123954)" (#124286)
This reverts (most of) commit 2f14649f16.
2025-03-07 16:08:07 +11:00
Yang Wang
88b5900837
Require project-id for waitForPersistentTasksCondition (#124180)
The method should be called with an explicit project-id to access
persistent tasks from the right project. This PR does that. The
callsites are updated by using the default project-id for the timebeing.
They work for single project deployments but should eventually be
updated for multi-project setup.

Relates: ES-11039
2025-03-07 14:00:09 +11:00
Sam Xiao
d5dfdb534d
Add annotation for watcher deprecated setting (#124278) 2025-03-06 21:43:09 -05:00
Armin Braun
b02f15d009
Cheaper handling of skipped shard iterators in AbstractSearchAsyncAction (#124223)
No reason to blow up the size of `AbstractSearchAsyncAction` (and the code size of some methods that really only need the size of that collection) needlessly. Just keep the count, that's all we need. 
We can build the skipped shard list inline if need be (and do so in a cheaper way because we can build the search targets.
2025-03-06 23:33:33 +01:00
Brian Seeders
b1c3772df6
[CI] Disable multi-project tests in non-snapshot build tests (#124261) 2025-03-06 16:03:13 -05:00
Pat Whelan
a5e0423138
[Deprecation] Update URL (#124259)
Replace the URL with the new updated docs URL. Should probably migrate
to ReferenceDocs after 9.1.
2025-03-06 20:03:07 +01:00
Parker Timmins
10a8dcf0fb
Retry ILM async action after reindexing data stream (#124149)
When reindexing a data stream, the ILM metadata is copied from the index metadata of the source index to the destination index. But the ILM state of the new index can be stuck if the source index was in an AsyncAction at the time of reindexing. To un-stick the new index, we call TransportRetryAction to retry the AsyncAction. In the past this action would only run if the index were in the error phase. This change includes an update to TransportRetryAction, which allows it to be run when the index is not in an error phase, if the parameter requireError is set to false.
2025-03-06 12:39:45 -06:00
Niels Bauman
20e186a252
Make enrich project-aware (#124099)
Makes the execution and use of enrich policies project-aware.
Note: this does not make the enrich cache project-aware. That is to be
handled in a follow-up PR.
2025-03-06 19:20:46 +01:00
Niels Bauman
ff6465b83b
Avoid hoarding cluster state references during rollover (#124107)
By keeping a list of all the rollover results in a rollover request
batch, we were keeping references to all the intermediate cluster states
that we built. We've seen this list take up ~1.4GB with 600 rollover
requests in one batch.

We only kept the list of results to compute the "reason" for the
allocation reroute, so we can easily drop the cluster state reference
from the list and only keep what we need.

Fixes #123893
2025-03-06 18:34:57 +01:00
Benjamin Trent
a1ee3c9291
Have create index return a bad request on poor formatting (#123761)
closes: https://github.com/elastic/elasticsearch/issues/123661
2025-03-07 04:24:54 +11:00
Kostas Krikellas
296cae8a30
[DOCS] Document source-related restrictions (#124011)
* Document source-related restrictions

* Update mapping-source-field.md

* Update docs/reference/elasticsearch/mapping-reference/mapping-source-field.md

Co-authored-by: Marci W <333176+marciw@users.noreply.github.com>

* Update mapping-source-field.md

---------

Co-authored-by: Marci W <333176+marciw@users.noreply.github.com>
2025-03-06 11:38:09 -05:00
Christoph Büscher
874cf707d6
Remove seemingly fixed test mute (#124207) 2025-03-06 17:28:14 +01:00
Colleen McGinnis
23be51a04f
[DOCS] fix external links (#124248) 2025-03-06 17:27:03 +01:00
Joe Gallo
54c826532c
Refactor RegisteredDomainProcessorTests (#124175) 2025-03-06 11:01:12 -05:00
Tim Grein
67af06905a
[Inference API] Fix output stream ordering in InferenceActionProxy (#124225) 2025-03-06 16:33:20 +01:00
Jonathan Buttner
d3fcff3309
[ML] Refactor OpenAI request managers (#124144)
* Code compiling

* Removing OpenAiAccount
2025-03-06 10:23:35 -05:00
Patrick Doyle
67ef4f8623
Entitle inference to access AWS credentials (#123750)
* Entitle inference to access AWS credentials.

Copied from the security policy.

* more missing entitlements for the inference plugin

---------

Co-authored-by: Lorenzo Dematte <lorenzo.dematte@elastic.co>
2025-03-06 10:09:03 -05:00
Lorenzo Dematté
cce1333744
[Entitlements] MailToURLConnection instrumentation (#123829) 2025-03-06 09:52:15 -05:00
Simon Cooper
861cfe9880
Remove several remaining Core/Infra UpdateForV9 references (#124197) 2025-03-06 14:49:15 +00:00
Liam Thompson
7cc613b0e4
[DOCS] Update DOCS README.md backporting guidance (#124228) 2025-03-06 15:43:27 +01:00
Andrei Stefan
04c8bf4ba8
ESQL: Revive some more of inlinestats functionality (#123589) 2025-03-06 16:37:58 +02:00
Jonathan Buttner
2a006ec1f4
Updating description of stream API (#124209) 2025-03-06 15:34:21 +01:00
elasticsearchmachine
81c23ca390 Mute org.elasticsearch.search.fieldcaps.FieldCapabilitiesIT testRelocation #124227 2025-03-07 01:23:58 +11:00
Marci W
bea3af2467
[DOCS] Clarify support for doc_values (#124047)
* Update doc-values.md

* Make the note more visible

* fix link
2025-03-06 09:01:19 -05:00
Jonathan Buttner
3a472ebae9
[ML] Update inference api rest spec (#124151)
* Pulling api spec changes

* Fixing test and updating code javadoc
2025-03-06 08:26:49 -05:00
Andrei Stefan
43d509d4de
Make the test deterministic (#124204) 2025-03-06 15:24:41 +02:00
Niels Bauman
2a7eb6e117
Make downsampling project-aware (#124000)
Allows downsampling to work on multiple projects.
2025-03-06 12:55:04 +01:00
Ignacio Vera
f360d6b781
Use IDENTITY constants when creating stats in TrainedModelsStatsAction (#123894) 2025-03-06 12:48:10 +01:00
Martijn van Groningen
ea8283e9c8
Avoid serializing empty _source fields in mappings. (#122606) 2025-03-06 12:20:07 +01:00
Francisco Fernández Castaño
387eef070c
Enhance memory accounting for document expansion and introduce max document size limit (#123543)
This commit improves memory accounting by incorporating document
expansion during shard bulk execution. Additionally, it introduces a new
limit on the maximum document size, which defaults to 5% of the
available heap.

This limit can be configured using the new setting:

indexing_pressure.memory.max_operation_size
These changes help prevent excessive memory consumption and
improve indexing stability.

Closes ES-10777
2025-03-06 11:26:49 +01:00
Luke Whiting
c702eb9efa
Re-instate watch count check with busy/wait (#123979) 2025-03-06 08:59:34 +00:00
Tim Vernum
d266f58a37
Remove workaround from TransportHandshakerTests (#123587)
TransportHandshakerTests had a workaround for multi-project's fake
transport version. Now that it's a real transport version we can remove
the workaround
2025-03-06 16:11:37 +11:00
Tim Vernum
3eb7f12eb6
Drop cluster scope method from RoleMappingMetadata (#124174)
This removes `getFromClusterState` from `RoleMappingMetadata` and
replaces its use in the 2 test classes that were still using it
2025-03-06 16:04:25 +11:00
Tim Vernum
2d1ab2e221
Remove unused method from AutoCreateIndex (#124176)
The method

    AutoCreateIndex.shouldAutoCreate(String, ClusterState)

is deprecated and not used. This commit removes it.
2025-03-06 16:03:46 +11:00
Ankita Kumar
473c4da497
Resharding - Adding shards to an existing index (#121082)
This POC attempts to double the number of shards of an existing index.
2025-03-05 18:21:00 -07:00
Yang Wang
a9432ba07a
Limit the log line length for s3 deletion error (#123953)
If all items fail to delete, the current warning log builds a huge
string to include all of them (up to 1000). This PR limits the string
length to first 10 entries.

Relates: #123630
2025-03-06 12:02:27 +11:00
elasticsearchmachine
521f044d37 Mute org.elasticsearch.smoketest.MlWithSecurityIT test {yaml=ml/start_data_frame_analytics/Test start classification analysis when the dependent variable is missing} #124168 2025-03-06 11:52:27 +11:00
Ryan Ernst
768f6f1905
Filter out JNA Cleaner thread from test leak detection (#114668) (#124162)
JNA has a static thread which handles cleaning up native memory
references. This commit adds the thread name to those filtered out of
thread leak detection since it lives for the lifetime of the JDK (yet
might be started in the middle of a test).

closes #114555
2025-03-06 00:53:16 +01:00
elasticsearchmachine
fd781e6e28 Mute org.elasticsearch.compute.data.BlockMultiValuedTests testToMask {elementType=BOOLEAN nullAllowed=true} #124165 2025-03-06 10:49:52 +11:00
Joe Gallo
d7b8b728e9
Cleanup RegisteredDomainProcessor (#124123) 2025-03-05 17:05:07 -05:00
Nhat Nguyen
206363664c
Introduce allow_partial_results setting in ES|QL (#122890)
This change introduces a cluster setting 
`esql.query.allow_partial_results` that allows enabling or disabling
allow_partial_results in ES|QL at the cluster-wide level. Initially,
this setting defaults to false, but it will be switched to true soon. 
The reason for not changing the default in this PR is that it requires
adjusting many tests, which would make the PR too large. Instead, we
will adjust the tests incrementally and switch the default when the
tests are ready. This cluster setting is useful for falling back to the
previous behavior (i.e., disabling allow_partial_results) if users
upgrade to the new version and haven't updated their queries.

Also, the default setting can be overridden on a per-request basis via a 
URL parameter (allow_partial_results) (changed from request body to URL
parameter to conform to the proposal).

Relates #122802
2025-03-05 13:48:20 -08:00
Tim Vernum
9cd0db7f48
Update XPackPlugin for project awareness (#124087)
This updates XPackPlugin.alreadyContainsXPackCustomMetadata to
consider all projects
2025-03-05 22:14:45 +01:00
Lee Hinman
47706b505f
Add index mode to get data stream API (#122486)
This commit adds the `index_mode` for both the data stream and each
backing index to the output of `GET /_data_stream`. An example looks
like:

```
{
  "data_streams" : [
    {
      "name" : "foo-things",
      "indices" : [
        {
          "index_name" : ".ds-foo-things-2025.02.13-000001",
          ...
          "index_mode" : "standard"
        }
      ],
      ...
      "index_mode" : "standard"
    },
    {
      "name" : "logs-foo-bar",
      "indices" : [
        {
          "index_name" : ".ds-logs-foo-bar-2025.02.13-000001",
          ...
          "index_mode" : "logsdb"
        },
        {
          "index_name" : ".ds-logs-foo-bar-2025.02.13-000002",
          ...
          "index_mode" : "logsdb"
        }
      ],
      ...
      "index_mode" : "logsdb",
    }
  ]
}
```
2025-03-06 07:39:58 +11:00
Mike Pellegrini
2fa6651a68
Remove matched text from chunks (#123607) 2025-03-05 15:01:46 -05:00
elasticsearchmachine
f534fc3ccf Mute org.elasticsearch.search.query.QueryPhaseTimeoutTests testScorerTimeoutTerms #124141 2025-03-06 06:45:09 +11:00
elasticsearchmachine
8a28b51c57 Mute org.elasticsearch.search.query.QueryPhaseTimeoutTests testScorerTimeoutPoints #124140 2025-03-06 06:45:01 +11:00
Oleksandr Kolomiiets
99262c6256
Use FallbackSyntheticSourceBlockLoader for boolean and date fields (#124050) 2025-03-05 11:43:47 -08:00
Benjamin Trent
a92b1d6892
Adjust exception thrown when unable to load hunspell dict (#123743)
On index creation, its possible to configure an hunspell analyzer, but
reference a locale file that actually doesn't exist or isn't accessible.

This error, like our other user dictionary errors, should be an IAE not
an ISE.

closes: https://github.com/elastic/elasticsearch/issues/123729
2025-03-06 06:19:21 +11:00
Joe Gallo
65a8e778e3
Cleanup RegisteredDomainProcessorTests (#124118) 2025-03-05 13:19:12 -05:00
elasticsearchmachine
64c08550af Mute org.elasticsearch.xpack.esql.plugin.MatchOperatorIT testScoring_Zero_OutsideQuery #124132 2025-03-06 04:34:59 +11:00
Mark Vieira
98f8005704
Generate compatible versions artifact in distributions dir (#124119) 2025-03-05 09:25:22 -08:00
Lorenzo Dematté
e6d6d30360
Revert "Mute org.elasticsearch.test.apmintegration.MetricsApmIT testApmIntegration #124106" (#124108)
This reverts commit 152d086c0f.
2025-03-05 09:20:27 -08:00
Valentin Crettaz
0290b1ce28
[Stack Monitoring] [REVERT] Update stack monitoring templates for Stack 9 release (#124112)
* [REVERT] Update stack monitoring templates for Stack 9 release
2025-03-05 17:44:41 +01:00
Andrei Stefan
ecb3d21b29
ESQL: Use a must boolean statement when pushing down to Lucene when scoring is also needed (#124001)
* Use a "must" instead of "filter" when building the pushed down filter
AND when scoring is needed
2025-03-05 18:35:35 +02:00
shainaraskas
a06c8ea5b8
Update node-settings.md (#123997)
* Update node-settings.md

Port change https://github.com/elastic/elasticsearch/pull/123939 forward to new docs system

* Update docs/reference/elasticsearch/configuration-reference/node-settings.md
2025-03-05 11:21:16 -05:00
David Kyle
c3e7493d7a
[ML] Remove deprecated routes for ml trained models APIs (#124019)
The 7.x routes for ml trained models _ml/inference/ have been deprecated
since 8 and replaced with _ml/trained_models. Also removes query 
parameters that are no longer supported.
2025-03-05 16:09:37 +00:00
Simon Cooper
106d7eaef5
Remove 7.11 and 7.12 transport versions (#124024) 2025-03-05 15:18:27 +00:00
Simon Cooper
22a7b5ea12
Collapse transport versions for 8.17.0 (#124005) 2025-03-05 15:18:01 +00:00
elasticsearchmachine
152d086c0f Mute org.elasticsearch.test.apmintegration.MetricsApmIT testApmIntegration #124106 2025-03-06 02:02:59 +11:00
Martijn van Groningen
26de5343a2
Remove synthetic recovery source feature flag. (#122615)
This feature flag controls whether synthetic recovery source is enabled by default when the source mode is synthetic.

The synthetic recovery source feature itself is already available via the index.recovery.use_synthetic_source index setting and can be enabled by anyone using synthetic source.

The default value of index.recovery.use_synthetic_source setting defaults to true when index.mapping.source.mode is enabled. The index.mapping.source.mode default to true if index.mode is logsdb or time_series.

In other words, with this change synthetic recovery source will be enabled by default for logsdb and tsdb.

Closes #116726
2025-03-05 15:43:33 +01:00
Liam Thompson
2456cd375a
Add note to servicenow connector ref (#124101) 2025-03-05 15:26:22 +01:00
Gal Lalouche
5a62fd1b0e
ESQL: Fix ShapeGeometryFieldMapperTests (and rename) (#122871)
Fixes #122661.
The issue was caused by RandomIndexWriter (randomly) reshuffling the document writing order. Since this test also ensures that the documents are read in the input order, I've opted to use a regular IndexWriter instead. I've also renamed the class to AbstractShapeGeometryFieldMapperTests since it was originally renamed due to a misunderstanding of muted tests (which caused it to be muted again! Busted 😅).
2025-03-05 14:09:18 +01:00
Simon Cooper
30a37c361b
Re-remove min compatible version from SearchRequest (#123859)
Re-apply transport changes from #114713
2025-03-05 12:49:07 +00:00
Simon Cooper
3b323dc588
Collapse 8.16.1 transport versions (#124003) 2025-03-05 12:29:29 +00:00
Maxim Kholod
025acaa603
add wiz and aws security hub new full posture data streams to kibana_system role permissions (#124074) 2025-03-05 13:28:53 +01:00
Luca Cavanna
20742b6946
Simplify Lucene60 and Luene62 codec constructors (#124054)
The only public constructor needed in the archive index codecs is the default one,
as that's called by SPI. The other one will only ever be called by the default one,
hence we can merge the two into one and simplify things a bit.
2025-03-05 13:20:51 +01:00
Gal Lalouche
a6e47ae85b
Refactor FieldCapabilities creation by adding a proper builder object (#121310)
Reduce boilerplate associated with creating `FieldCapabilities` instances.
Since it's a class with a huge number of fields, it makes sense to define a builder object, as that can also help with all the Boolean and null blindness going on.
Note while there is a static Builder class in `FieldCapabilities`, it is not a proper builder object (no setters, still need to pass a lot of otherwise default parameters) and also package-private. To avoid changing that, I defined a new `FieldCapabilitiesBuilder` class. I also went over the code and refactored places which used the old constructor.
2025-03-05 13:09:36 +01:00
Armin Braun
b1c75d1868
Move some security APIs to using promises in place of callbacks (#123812)
We have some incredibly deep callstacks in security that seem to visibly
raise context switch costs, make profiling more complicated and
generally make the code rather hard to follow.
Since the methods adjusted here return a result synchronously we can
both save overhead and make things a little easier to follow by using
promises as returns in place of consuming callbacks.
2025-03-05 12:08:29 +01:00
Rene Groeschke
cfa98f30e5
Fix configuration cache compatibility issues (#124073)
- for running :plugins:discovery-ec2:check
- checking if in idea in build scan background action
2025-03-05 21:06:31 +11:00
Liam Thompson
badfc93596
[DOCS] Update API ref link in docs README (#124069)
https://github.com/elastic/elasticsearch-specification/pull/3873/files
2025-03-05 10:22:34 +01:00
Simon Cooper
6925bc98db
Remove code to handle pre-7.6 TCP headers (#123899)
And 7.6 transport version
2025-03-05 08:35:26 +00:00
Tim Rühsen
792ab39637
[profiling] Take care of @UpdateForV9 (#123977)
* [profiling] Take care of @UpdateForV9

* Fix GetStackTracesResponseTests
2025-03-05 09:09:59 +01:00
Yang Wang
1bf6a7741f
Use singleton instance for default project-id (#123677)
No need to create new instances for the default project-id. We can use
the singleton field which should speeds up key comparsion for Map.get
operations.

Relates: #123662
2025-03-05 18:47:24 +11:00
Niels Bauman
10e23b31b4
Explicitly pass project ID in simulate pipeline request (#124033)
Instead of implicitly relying on the `IngestService` to resolve the
project ID, the simulate pipeline request should do this and pass the
project ID explicitly.
2025-03-05 08:30:45 +01:00
Rene Groeschke
496c38e5a5
Reapply "Update Gradle wrapper to 8.13 (#122421)" (#123889) (#123896)
This reverts commit 36660f2e5f.
2025-03-05 08:02:13 +01:00
Lorenzo Dematté
67d0dd4df2
[Entitlements] Add URLConnection instrumentation for file protocol (#123824) 2025-03-05 07:36:55 +01:00
Yang Wang
ae1ad21aac
Change constructor to private for ProjectMetadata (#124060)
Similar to Metadata, the constructor should be private since we expect
it to be created with the Builder.
2025-03-05 17:09:36 +11:00
Yang Wang
6646af015a
Use MultiProjectPendingException more consistently (#123955)
Use the same exception class in more places where single lookup fails
due to the existence of multiple projects. This allows the exception to
be handled similarly, e.g. ignored in
ClusterApplierService#callClusterStateListener
2025-03-05 11:37:50 +11:00
elasticsearchmachine
850a49be7c Mute org.elasticsearch.smoketest.MlWithSecurityIT test {yaml=ml/3rd_party_deployment/Test start deployment fails while model download in progress} #120814 2025-03-05 10:50:26 +11:00
elasticsearchmachine
80cbdfc87e Mute org.elasticsearch.multiproject.test.CoreWithMultipleProjectsClientYamlTestSuiteIT test {yaml=search.vectors/41_knn_search_bbq_hnsw/Vector rescoring has same scoring as exact search for kNN section} #124052 2025-03-05 09:59:19 +11:00
Patrick Doyle
bef762f4dc
Remove duplicate exclusive paths (#124023)
* Remove duplicate exclusive paths

* Normalize paths in tests to support Windows

* Remove withMode
2025-03-04 23:44:08 +01:00
elasticsearchmachine
c96fcf7b72 Mute org.elasticsearch.entitlement.runtime.policy.FileAccessTreeTests testDuplicatePrunedPaths #124006 2025-03-05 09:39:38 +11:00
Tim Brooks
b46dd1ca5c
Simplify check to split bulk request (#124035)
Use an optional to check if bulk operation should be split.
2025-03-04 15:03:46 -07:00
Mark Vieira
d61b86477d
Add jdk.management.agent module to server boot layer on start (#123938) 2025-03-04 11:32:42 -08:00
Rene Groeschke
b0318eccef
[CI] Fix the lucene compatibility tests in intake (#124034)
the last commit before the lucene update is not compatible in how we
apply the buildscan plugin these days. We now instead created a branch
"combat-lucene-10-0-0" where we added a compatibibility fix. Now we pick
the fix commit instead.
2025-03-05 06:04:21 +11:00
Armin Braun
976c9f9375
Much faster indices lookup on metadata (#123749)
We mostly need the map for lookups in very tight loops but also rarely rely on the sortedness of this thing. Getting the best of both worlds at surprisingly only a ~10% increase in build time and ~25% increase in the heap consumption of this structure provides a massive speedup to e.g. search or field_caps over large numbers of indices thanks to the up to an order of magnitude cheaper lookups in index name resolution and security (as well as speedups in other areas).
2025-03-04 19:21:23 +01:00
David Kyle
77313160bf
[main] [ML] Use latest results index for new Anomaly Detection jobs (#122597) (#122673)
* [ML] Use latest results index for new Anomaly Detection jobs (#122597)

After upgrading from v7 new anomaly detection jobs should 
use the latest results index if one has been created.

* Delete 8.x test
2025-03-05 04:34:50 +11:00
Mark Vieira
e54037b7d0
Add build artifact containing json file of all wire compatible versions (#123740) 2025-03-04 09:25:11 -08:00
Mark Vieira
cc08d1d2a6
Add inbound_network entitlement to repository-hdfs plugin (#123907) 2025-03-04 09:24:54 -08:00
Tim Brooks
535dbbe032
Add coordinating object to track bytes (#122460)
This commit adds a new coordinating object to reflect reduce the need to
introduce a new releasable for every network byte reference.
Additionally, it will allow us to more specifically track bytes while
they are buffered.
2025-03-04 10:23:43 -07:00
Adam Demjen
a0f3b2464a
Remove obsolete EIS feature flag class (#123716) 2025-03-04 12:10:12 -05:00
Jordan Powers
9e6fcf6690
Fix timestamp range query optimization for indices with doc values skipper (#123930)
When running a timestamp range query, as an optimization we check if the
query range overlaps with the total range of values within a shard before
executing the query on that shard. That way, if the range is disjoint, we
can skip execution for that shard. To get the range of values within a
shard, we usually use the PointValues index on the shard. However, when the
doc values skipper is enabled, the point values are not (as the reason for
the skipper is to reduce storage overhead by removing the point values
index). In this case, we need to instead get the range of values within the
shard by using the skipper. This patch implements that logic.

Follow-up to #123191
2025-03-04 08:18:49 -08:00
elastic-renovate-prod[bot]
163730352d
Update docker.elastic.co/wolfi/chainguard-base:latest Docker digest to 15a4191 (#124012)
This PR contains the following updates:

| Package | Update | Change | |---|---|---| |
docker.elastic.co/wolfi/chainguard-base | digest | `c66fdaf` ->
`15a4191` |

---

### Configuration

📅 **Schedule**: Branch creation - "after 1pm on tuesday" (UTC),
Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once
you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Renovate
Bot](https://redirect.github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzOS4xMDcuMCIsInVwZGF0ZWRJblZlciI6IjM5LjEwNy4wIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyI6RGVsaXZlcnkvUGFja2FnaW5nIiwiPm5vbi1pc3N1ZSIsIlRlYW06RGVsaXZlcnkiLCJhdXRvLW1lcmdlLXdpdGhvdXQtYXBwcm92YWwiXX0=-->
2025-03-05 03:10:01 +11:00
Nhat Nguyen
f9565817ab
Remove skip with semantic_text tests in ES|QL (#123948)
This change removes the skipping introduced for the semantic_text tests 
in #122222. These tests were accidentally re-enabled without failures
over the last two weeks, so we can now re-enable them.

Closes #121411
Relates #122222
2025-03-04 07:32:55 -08:00
Stanislav Malyshev
74d78bbdc3
Add some logging to better see what's up with testCancelFailedSearchWhenPartialResultDisallowed (#123933) 2025-03-04 08:16:41 -07:00
David Turner
77a3d30d26
Remove trappy timeouts from IndicesAliasesRequest (#123987)
Relates #107984
2025-03-05 02:11:50 +11:00
Lorenzo Dematté
404c9e6290
missing file entitlement used by google-http-client for oauth2 (#123985) 2025-03-04 16:06:44 +01:00
Lorenzo Dematté
8f5de85d16
Make NotEntitledException inherit from SecurityException for compatibility purposes (#123984) 2025-03-04 15:34:13 +01:00
Pat Whelan
dfe2adb592
[ML] Retry on streaming errors (#123076)
We now always retry based on the provider's configured retry logic
rather than the HTTP status code. Some providers (e.g. Cohere,
Anthropic) will return 200 status codes with error bodies, others (e.g.
OpenAI, Azure) will return non-200 status codes with non-streaming
bodies.

Notes:
- Refactored from HttpResult to StreamingHttpResult, the byte body is
  now the streaming element while the http response lives outside the
  stream.
- Refactored StreamingHttpResultPublisher so that it only pushes byte
  body into a queue.
- Tests all now have to wait for the response to be fully consumed
  before closing the service, otherwise the close method will shut down
  the mock web server and apache will throw an error.
2025-03-04 09:33:00 -05:00
elasticsearchmachine
6a36f31f41 Bump versions after 8.16.5 release 2025-03-04 14:28:01 +00:00
Craig Taverner
efe7379e67
Split ESQL functions/operators docs files (#123904)
* Port from asciidocalypse

* Fix links for operator lists

* Remove unused image files after moving/editing them

* Fix lists links

* Fix like/rlike links

* Fix remaining bad references to /elasticsearch/docs

* Fix logstash and beats references

* Fix logstash and beats references

* Fix image links
2025-03-04 14:59:31 +01:00
elasticsearchmachine
ee091a3c9a Prune changelogs after 8.17.3 release 2025-03-04 12:27:13 +00:00
elasticsearchmachine
514745b78e Bump versions after 8.17.3 release 2025-03-04 12:25:16 +00:00
Nikolaj Volgushev
66a7c9f0de
Drop TLS_RSA ciphers from default cipher suites for JDK 24 (#123600)
This PR adjusts the list of supported ciphers to reflect ciphers
available in JDK 24. 

JDK 24 [drops](https://bugs.openjdk.org/browse/JDK-8245545) support for
`TLS_RSA` suites. These ciphers will no longer be supported in
Elasticsearch with a bundled JDK with version >= 24. JDK's of lower
versions will continue to support to dropped ciphers. 

I will follow up this PR with a separate docs PR.
2025-03-04 23:21:49 +11:00
Jim Ferenczi
e57a38f807
Unmute SemanticInferenceMetadataFieldsRecoveryTests#testSnapshotRecovery (#123590)
Modify the test to avoid using cosine similarity, as random vectors may fail the magnitude check.

Closes #122549
Closes #122550
Closes #122551
2025-03-04 11:32:32 +00:00
Nikolaj Volgushev
989ddbe51b
Failure store access - selector-aware role building (#122715)
This PR adds the `read_failure_store` index privilege and extends the role building logic to support selector-aware authorization. Note that this PR only concerns building roles; the actual authorization logic implementation will follow in a separate PR. The overall approach is based on the proof-of-concept PR (https://github.com/elastic/elasticsearch/pull/122007). 

The purpose of the `read_failure_store` index privilege is to support granting selective access to the failure store of a data stream via the `::failures` selector in search and related APIs. A role with the `read_failure_store` index privilege grants access to the failure store, without granting access to the data in a data stream. Conversely, the existing `read` privilege only grants access to data and _not_ the failure store. 

This requires changes to both the role building logic, and authorization. Going forward, each named index privilege is assigned a selector it grants access to, e.g., `read` grants access to the implicit `::data` selector, `read_failure_store` grants access to `::failures`. When building a role from role descriptors, we partition its underlying index groups by selector access such that any given group grants access to a single selector (with the exception of `all`, which grants access to all selectors). 

This PR implements this partitioning logic and sets up roles to implement selector-aware authorization in a follow up. Note that parts of the code make assumption around the existence of only two distinct selectors (`::data` and `::failures`) to simplify the implementation; however, it's possible to generalize these sections to support more selectors in the future, if necessary. 

Closes: ES-10872
2025-03-04 12:04:33 +01:00
Christoph Büscher
0f14c4f065
Add test for deprecated index settings in N-2 indices (#122493)
This change adds a new rolling upgrade test that checks having certain deprecated
index settings present in an N-2 index doesn't prevent the index from being opened
in the current version. The deprecated settings specifically tested here are:

* index.mapper.dynamic
* index.max_adjacency_matrix_filters
* index.force_memory_term_dictionary
* index.soft_deletes.enabled
2025-03-04 11:13:32 +01:00
elasticsearchmachine
959ad8bfdc Mute org.elasticsearch.xpack.esql.heap_attack.HeapAttackIT testLookupExplosionNoFetch #123432 2025-03-04 21:08:24 +11:00
Niels Bauman
8c6df1f451
Unmute TimeSeriesDataStreamsIT.testSearchableSnapshotAction (#123973)
Already fixed by #123378.

Closes #123214
2025-03-04 21:01:15 +11:00
Liam Thompson
de448aa51b
[DOCS] Delete old asciidoc preview URL action (#123909) 2025-03-04 10:46:03 +01:00
David Turner
32f182f8b0
Align TransportVersion#bestKnownVersion with 8.x (#123801)
In backporting #123397 to 8.x we discovered that we needed to generalize
`TransportVersion#bestKnownVersion` slightly to handle older versions.
This commit forward-ports this change to keep the branches aligned.
2025-03-04 09:19:46 +00:00
Rene Groeschke
18256a5f28
[Gradle] Fix and simplify disabling assertions in test tasks (#123038)
Fixes misleading assertion configuration for test tasks from the command
line. 

We support the following command line args:

1. `-Dtests.jvm.argline=-disableassertions`

2. `-Dtests.jvm.argline=-da`

3. `-Dtests.asserts=false`
2025-03-04 19:28:46 +11:00
Liam Thompson
a6896a876a
[DOCS] Update Elasticsearch docs README for v9 (#123902) 2025-03-04 09:26:30 +01:00
elasticsearchmachine
78b6dac090 Mute org.elasticsearch.indices.recovery.IndexRecoveryIT testSourceThrottling #123680 2025-03-04 19:22:29 +11:00
David Turner
4e00998cf2
Add @UpdateForV9 for ReferenceDocs (#123928)
The docs system is very different in v9 so we must update
`ReferenceDocs` to generate links that are not broken.
2025-03-04 07:38:20 +00:00
Lorenzo Dematté
4f2f1bc2a7
[Entitlements] Add URLConnection instrumentation for ftp, http and https protocols (#123802) 2025-03-04 08:35:14 +01:00
Lorenzo Dematté
c663e3ded8
Add missing APM entitlements (#123462) 2025-03-04 08:32:59 +01:00
kanoshiou
4d2cb53ed7
ESQL: Ensure non-zero row size in EstimatesRowSize (#122762)
Closes #121535
2025-03-03 22:31:10 -08:00
Nick Tindall
2f14649f16
Add temporary workaround for IntelliJ editorconfig bug (#123954) 2025-03-04 16:43:15 +11:00
Yang Wang
9d4eca0ad5
[Test] More robust unique allocationId randomization (#123941)
Persistent tasks expect unique allocationId for each individual task.
This PR ensures that is the case when randomize allocationId in tests.
2025-03-04 14:00:44 +11:00
Ryan Ernst
1d04b4f810
Skip internal logging in compat check (#123940)
The stable API compatibility checks ensure public jars don't change
their APIs in incompatible ways. Yet the logging jar has an internal
package which can change arbitrarily. This commit adds a temporary
workaround to skip the internal logging package until the compat check
can be made to look at module-info.
2025-03-04 02:43:27 +00:00
Nhat Nguyen
796cfcefc8
Unmute CrossClusterQueryWithPartialResultsIT tests (#123943)
Closes #123451 Closes #123101
2025-03-04 13:28:41 +11:00
Joe Gallo
e602d569bf
Bump up httpcore version (#123932) 2025-03-03 20:42:33 -05:00
Tim Vernum
23e5c15590
Fix custom authz engine for multi-project (#123937) 2025-03-04 01:21:07 +00:00
elasticsearchmachine
b4602d5cb2 Mute org.elasticsearch.smoketest.MlWithSecurityIT test {yaml=ml/data_frame_analytics_crud/Test get stats given multiple analytics} #123034 2025-03-04 11:39:24 +11:00
Nhat Nguyen
782a36cafa
Relax profiles assertions (#123923)
If the final driver is woken up before the exchange buffer is finished, 
there will be two sleeps in its profile instead of one. We don't need
these assertions to be so precise. This change relaxes the assertions to
allow reduce operators to have more than one sleep.
2025-03-03 15:24:12 -08:00
David Turner
fc66cdf596
Comment on disabling compression when using HTTPS (#123877)
The lack of context here left me at a dead end. I didn't RTFM otherwise
I would have discovered #56899 added this info there, but for the sake
of future code-readers I'm adding the same info here.
2025-03-04 09:44:09 +11:00
Yang Wang
9431c6764d
Explicit import layout for packages begin with io (#123854)
This PR adds explicit import layout for io.* packages so that their
import orders are consistent between IDE and CLI. Without it, the IDE
places the io.* imports at the bottom of the import list.
See AbstractRepositoryS3RestTestCase for such an example.
2025-03-04 09:32:35 +11:00
Jack Conradson
3e2597f49b
remove duplicate paths in FileAccessTree (#123776)
Co-authored-by: Lorenzo Dematté <lorenzo.dematte@elastic.co>
Co-authored-by: Patrick Doyle <810052+prdoyle@users.noreply.github.com>
2025-03-03 20:56:18 +00:00
John Wagster
be577e382d
Update Flatten Graph Docs to Include a Real Flattened Graph 9.x (#123901)
updated flatten graph docs to include a real flattened graph
2025-03-03 14:33:53 -06:00
Nik Everett
66a812321b
Speed up stored field spec management (#122645)
When you load stored fields from lucene you have get all of your ducks
in a row first or it'll be really slow. You need to get a list of all of
the fields you want so you can ignore the ones that you don't. We do
this with the `StoredFieldsSpec` which is immutable and has a `merge`
method. It's quite common to merge a few dozen of these specs together
to prepare for the fetch phase or for a new segment when loading fields
from ESQL.

When I was loading thousands of fields in ESQL I noticed that the merge
was slowing things down marginally. This skips a big chunk of the merge
in the common case that we don't have to load any named stored fields.
2025-03-03 15:01:27 -05:00
Jonathan Buttner
a88d6458dc
[ML] Improve EIS authorization to perform requests on a periodic basis instead of only once (#123639)
* Refactoring

* Add internal cluster setting to aid testing

* [CI] Auto commit changes from spotless

* Allowing the auth interval to be configurable via a setting

* Removing unused code

* Adding revocation functionality back

---------

Co-authored-by: elasticsearchmachine <infra-root+elasticsearchmachine@elastic.co>
2025-03-03 15:00:44 -05:00
Ryan Ernst
4841f43e88
Grant read access to the config dir (#123882)
This matches what Security Manager permissions Elasticsearch had for all
plugins.
2025-03-03 19:43:41 +00:00
Jordan Powers
737ab62393
Enable a sparse doc values index for @timestamp in time-series indices (#123191)
This patch builds on the work done in #122161 by also enabling the sparse doc values index for @timestamp in time-series indices.
2025-03-03 11:29:38 -08:00
Mark Tozzi
c4dcdee9f8
ESQL - remove some dead code (#123720)
I was looking at some unrelated stuff in the Function Registry, and noticed this was never called.
2025-03-03 14:06:11 -05:00
Ioana Tagirta
5011a473ce
Query rules: Check if MGET request failed when we retrieve query rules (#123616) 2025-03-03 19:21:32 +01:00
Ying Mao
6b2e56697e
Adding support for specifying embedding type to Jina AI service settings (#121548)
* Adding embeddings type to Jina AI service settings

* Update docs/changelog/121548.yaml

* Setting default similarity to L2 norm for binary embedding type
2025-03-03 13:00:09 -05:00
Tim Grein
08aa668ce8
[Inference API] Auto-propagate product origin for every subclass of ElasticInferenceServiceRequest (#123141) 2025-03-03 17:58:40 +01:00
Pooya Salehi
113f0c17cc
Limit number of suppressed S3 deletion errors (#123630)
We've seen this being an issue on 7.x although can happen on all 
versions (I'm pretty sure this PR doesn't cleanly back-port to 7.x
though).

Closes https://github.com/elastic/elasticsearch/issues/123354
2025-03-04 03:06:27 +11:00
Nhat Nguyen
a320809843
Handle exceptions when register compute group (#123438)
If the parent task is canceled, registering the compute group task might 
throw a TaskCancelledException, so the listener won't be notified.

Closes #123216
Closes #123101
Closes #123451
2025-03-03 08:00:03 -08:00
Valentin Crettaz
dc45ff450e
[Stack Monitoring] Update stack monitoring templates for Stack 9 release (#123106)
* Update stack monitoring templates for Stack 9 release

* Update stack monitoring documentation for Stack 9 release

* Update stack monitoring documentation for Stack 9 release (fixed test cases)

* Revert "Update stack monitoring documentation for Stack 9 release"

This reverts commit fd2f55203d.

* Update stack monitoring templates for Stack 9 release (revert ent-search removal)

* Update stack monitoring templates for Stack 9 release (fix BWC test cases)
2025-03-03 16:49:46 +01:00
Colleen McGinnis
db5acd8976
add missing pages (#123774) 2025-03-03 15:02:51 +00:00
Rene Groeschke
36660f2e5f
Revert "Update Gradle wrapper to 8.13 (#122421)" (#123889)
This reverts commit e19b2264af.
2025-03-03 15:51:07 +01:00
Simon Cooper
1447e0e341
Remove obsolete fields from PutStoredScriptRequest (#123860) 2025-03-03 14:39:20 +00:00
Ignacio Vera
c250368632
Introduce the constant ByteStats.IDENTITY (#123857)
we already have IDENTITY constant for IngestStats and Stats, it make sense to introduce a similar pattern for ByteStats.
2025-03-03 15:34:24 +01:00
Rene Groeschke
7ad7e60368
Still allow building with gradle 8.12.1 (#123881)
to not break es-serverless
2025-03-03 15:19:19 +01:00
Lorenzo Dematté
31b3f7dc9c
Fix PolicyManagerTests testFilesEntitlementsWithExclusive failing (#123856) 2025-03-03 14:11:07 +00:00
Julia Bardi
24c5e5c296
[Fleet] added privileges for fleet-synced-integrations* (#123493)
* Update KibanaOwnedReservedRoleDescriptors.java

* Update x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/authz/store/KibanaOwnedReservedRoleDescriptors.java

Co-authored-by: Sid <siddharthmantri1@gmail.com>

---------

Co-authored-by: Sid <siddharthmantri1@gmail.com>
2025-03-03 14:17:11 +01:00
Rene Groeschke
e19b2264af
Update Gradle wrapper to 8.13 (#122421)
* Fix Gradle Deprecation warning as declaring an is- property with a Boolean type has been deprecated.
* Make use of new layout.settingsFolder api to address some cross project references
* Fix buildParams snapshot check for multiprojet projects
2025-03-03 14:10:00 +01:00
Niels Bauman
afff39ed5c
Run XPack usage actions on local node (#122933)
These actions solely need the cluster state, they can run on any node.

Relates #101805
2025-03-03 13:37:27 +01:00
Ievgen Degtiarenko
2fcb23a87e
Rename driver description (#123848) 2025-03-03 13:09:06 +01:00
Yang Wang
7f16b3b0e5
Detect multi-project in REST tests (#123842)
This PR makes ESRestTestCase to detect whether multi-project is enabled
and issue cluster state requests accordingly.
2025-03-03 22:39:29 +11:00
Martijn van Groningen
cf83c37b66
Include doc value skippers in disk usage analyzer (#123692) 2025-03-03 11:05:26 +00:00
Yang Wang
9f107668cb
[Test] Allow leader/follower checks in pending tasks (#123841)
Leader and follower checks are expected to run regularly for any
multi-node clusters. This PR allows them to be observed in the list of
tasks during cleanup phase of REST tests.
2025-03-03 21:47:32 +11:00
Arpad Kiraly
196e083502
Remove @UpdateForV9 usages that are related to security manager removal (#123690)
* Remove @UpdateForV9 annotation in RuntimeVersionFeature

Re ES-10338 the Core/Infra team agreed that this is not blocked on security manager removal. We should go ahead and remove these 2 instances of the @UpdateForV9 annotation, the code will be cleaned up soon with the removal of Security Manager.

* Remove @UpdateForV9 annotation from SystemJvmOptions

re ES-10338 the Core/Infra team agreed this is not blocked on security manager removal. We should go ahead and remove this instance of the @UpdateForV9 annotation.
2025-03-03 11:34:46 +01:00
Luca Cavanna
8baba58529
Address TopFieldCollectorManager and TopScoreDocCollectorManager related deprecation warnings (#123615)
The supportsConcurrency flag has been deprecated in Lucene,
see https://github.com/apache/lucene/pull/13977 .
2025-03-03 10:38:52 +01:00
Simon Cooper
82668b40f4
Add basic implementations of float-byte script comparisons (#122381)
Add implementations of `cosineSimilarity` and `dotProduct` to query byte vector fields using float vectors
2025-03-03 09:38:37 +00:00
Yang Wang
5697f7f016
Make GeoIpDownload work for default project explicitly (#123845)
GeoIpDownloaderTaskExecutor needs to be made project aware eventually.
In the meantime, to unblock tests, this PR makes the stopping action
work explicitly for the default project only.
2025-03-03 20:27:55 +11:00
Lorenzo Dematté
dbac70eed5
[Entitlements] Fix FileAccessTree paths ordering (#123689) 2025-03-03 09:05:00 +01:00
Lorenzo Dematté
678738acc0
[Entitlements] Add URLConnection instrumentation (#123503) 2025-03-03 08:40:53 +01:00
Nhat Nguyen
7560e2e349
Fix potential block leak in LuceneSourceOperator (#123835)
A follow-up to #123296 to address a potential block leak that may occur
when a circuit-breaking exception is triggered while truncating the docs
or scores blocks.

Relates  #123296
2025-03-03 13:31:16 +11:00
Lorenzo Dematté
850d48a944
Missing policies for netty, discovery-azure and repository-s3 (#123696) 2025-03-02 22:34:38 +01:00
Ryan Ernst
eace6a1071
Remove ignoreUrl file setting property (#123718)
Urls may make the FileAccessTree invalid. This commit removes the flag
for filtering urls, instead always filtering them.
2025-03-02 19:29:45 +00:00
Ryan Ernst
39a2e88964
Set root logger level for CLIs (#123742)
All CLIs in elasticsearch support command line flags for controlling the
output level. When --silent is used, the expectation is that normal
logging is omitted. Yet the log4j logger is still configured to output
error level logs. This commit sets the appropriate log level for log4j
depending on the Terminal log level.
2025-03-02 17:55:09 +00:00
elasticsearchmachine
3a1aa8b36d Mute org.elasticsearch.xpack.esql.action.EsqlActionBreakerIT testProjectRenameEval #123811 2025-03-02 17:50:30 +11:00
elasticsearchmachine
2de382abdd Mute org.elasticsearch.xpack.esql.action.EsqlActionBreakerIT testFromStatsEvalWithPragma #123810 2025-03-02 17:50:21 +11:00
elasticsearchmachine
bc644ef5d0 Mute org.elasticsearch.xpack.esql.action.EsqlActionBreakerIT testDefaultTruncationSizeSetting #123809 2025-03-02 17:50:12 +11:00
elasticsearchmachine
c021e92f96 Mute org.elasticsearch.xpack.esql.action.EsqlActionBreakerIT testFromStatsGroupingByDate #123808 2025-03-02 17:50:05 +11:00
elasticsearchmachine
bdc20770a6 Mute org.elasticsearch.xpack.test.rest.XPackRestIT test {p0=snapshot/10_basic/Create a source only snapshot and then restore it} #122755 2025-03-02 10:02:27 +11:00
elasticsearchmachine
6d04ffd064 Mute org.elasticsearch.xpack.esql.action.EsqlActionBreakerIT testDropAllColumns #123791 2025-03-01 17:40:07 +11:00
Nhat Nguyen
ca88c93329 Fix compilation after #123784 2025-02-28 17:47:08 -08:00
Nhat Nguyen
cdd4df5f1a
Allow skip shards with _tier and _index in ES|QL (#123728)
This change adds support for skipping shards with event.ingested fields 
and metadata fields (_tier, _index). This should allow ES|QL to skip
unmatched shards and avoid sending requests to the data nodes.
2025-02-28 17:45:57 -08:00
Nhat Nguyen
333e252aee
Avoid over collecting in Limit or Lucene Operator (#123296)
Currently, we rely on signal propagation for early termination. For 
example, FROM index | LIMIT 10 can be executed by multiple Drivers:
several Drivers to read document IDs and extract fields, and the final
Driver to select at most 10 rows. In this scenario, each Lucene Driver
can independently collect up to 10 rows until the final Driver has
enough rows and signals them to stop collecting. In most cases, this
model works fine, but when extracting fields from indices in the
warm/cold tier, it can impact performance. This change introduces a
Limiter used between LimitOperator and LuceneSourceOperator to avoid
over-collecting. We will also need a follow-up to ensure that we do not
over-collect between multiple stages of query execution.
2025-02-28 16:43:35 -08:00
Lorenzo Dematté
b3464275ce
[Entitlements] Add a check for filesystem mismatch (#123744) 2025-02-28 23:10:08 +00:00
elasticsearchmachine
60ba131edf Mute org.elasticsearch.xpack.searchablesnapshots.FrozenSearchableSnapshotsIntegTests testCreateAndRestorePartialSearchableSnapshot #123773 2025-03-01 09:54:55 +11:00
Keith Massey
ba088b0418
Avoiding a race condition where pending indices count is 0 at start of data stream reindex (#123765) 2025-02-28 16:50:53 -06:00
elasticsearchmachine
71ca4ca7d5 Mute org.elasticsearch.xpack.downsample.DataStreamLifecycleDownsampleDisruptionIT testDataStreamLifecycleDownsampleRollingRestart #123769 2025-03-01 09:25:31 +11:00
Dianna Hohensee
ba5a9c8331
Report outcome of data node's shard snapshot master update (#123652)
Improves the information in the IndexShardSnapshotStatus's
statusDescription field to include the success/failure of the remote
call to the master node to update the shard snapshot state. This
allows us to see if there is a discrepancy between the state of the
data node and the master node.

Closes ES-10991
2025-02-28 16:11:07 -05:00
David Turner
6bdb9fe209
Negotiate disordered transport handshakes (#123397)
Previously we'd reject transport handshakes from numerically-older nodes
with a chronologically-newer release date. With this commit we instead
negotiate to use the latest known version for future communications.
2025-03-01 07:14:13 +11:00
Ryan Ernst
dcb0eb606f
More flexible settings pattern (#123746)
This commit reworks the settings globs to be more useable. Primarily it
expands the values so that the settings may be lists, iterating over
each value. Additionally it simplifies the function to also allow
non-glob settings so that this single method may be used to lookup all
values for a given setting pattern, whether it contains a glob or not.
2025-02-28 20:02:50 +00:00
Ryan Ernst
9ae3730ffc
Include network access for monitoring plugin (#123651) 2025-02-28 11:26:32 -08:00
Ryan Ernst
e35ef897bf
Include network access for watcher plugin (#123653) 2025-02-28 11:26:07 -08:00
Dianna Hohensee
b435bc01db
Include the snapshot ID when logging shard snapshot statuses (#123654)
The SnapshotShutdownProgressTracker logs the shard snapshot statuses
individually and now each status can be associated back to the parent
snapshot.

Relates ES-10991
2025-02-28 13:54:31 -05:00
Francisco Fernández Castaño
c0c0827f87
Add ActionListener.releaseBefore (#123591)
This commit introduces a new helper function, ActionListener.releaseBefore,
which ensures that a resource is released before the listener is notified.
2025-02-28 19:28:57 +01:00
Liam Thompson
6b27e420fe
Cleanup search connectors, add some reference -> docs content signposts in various sections (#123733) 2025-02-28 17:10:09 +00:00
Martijn van Groningen
086329c5cb
Tidy up some noise during indexing with synthetic source. (#123724) 2025-02-28 16:52:17 +00:00
elasticsearchmachine
e05304bc2d Mute org.elasticsearch.test.rest.yaml.RcsCcsCommonYamlTestSuiteIT test {p0=search.vectors/41_knn_search_bbq_hnsw/Test knn search} #123727 2025-03-01 02:58:26 +11:00
Ievgen Degtiarenko
201a37012d
Document how to enable tracing (#123713) 2025-02-28 16:16:04 +01:00
Liam Thompson
91c2654570
Fix broken cross-repo links, versions in search connectors docker instructions (#123700) 2025-02-28 16:02:54 +01:00
Jake Landis
1f5e9655c6
unumte testWatcherWithApiKey (#123656) 2025-02-28 08:55:15 -06:00
Jonathan Buttner
4dcc81f0c4
Removing url and adding cause REST api response (#123638) 2025-02-28 08:24:57 -05:00
David Turner
b7868ef554
Remove production XContent parser from SnapshotIndexShardStatus (#123608)
This parser is only used in tests, so this commit moves it to the test
code.
2025-02-28 22:35:35 +11:00
Lorenzo Dematté
6be0887778
Missing geoip policy (#123597) 2025-02-28 12:06:05 +01:00
Iván Cea Fontenla
e8b01ff7c0
ESQL: Fix Driver status iterations and cpuTime (#123290)
Fixes https://github.com/elastic/elasticsearch/issues/122967

When the Driver reported status, if the "report at least every X time" report was triggered, it was re-adding the same iterations and cpuTime again, as it wasn't clearing it before the next iteration.
Now, there are separated variables for the last updated iterations and reported time.
2025-02-28 12:05:47 +01:00
Luca Cavanna
46fc7de3fb
Minor DocValuesDocReader cleanup (#123619)
The instance members can be private, all final, and SearchLookup is unused.
2025-02-28 10:08:06 +01:00
Ryan Ernst
71f72b9b91
Consolidate path setting files entitlements to config (#123649)
The setting based paths could be either absolute or relative, and they
are always relative to the config dir. This commit renames the
path_setting to make it clear it is related to config, and removes the
relative variant.
2025-02-28 01:38:51 +00:00
Yang Wang
7f501a5e27
Add a faster path for single default project retrieving (#123662)
This PR makes single default project retrieving faster by using a single
element map instead of a regular hash map.
2025-02-28 12:35:06 +11:00
Tim Vernum
2a17df58af
Only resolve project once in FieldCaps (#123664)
`TransportFieldCapabilitiesAction.doExecuteForked` would resolve the
project twice:
- Once implicitly when resolving indices from cluster state
- Another time to resolve index blocks

This changes this method to resolve `ProjectState` once and use that
instance for both index resolution and block checking
2025-02-28 01:22:00 +00:00
Mark Vieira
9a37fbfbee
Remove NodesCapabilitiesUpgradeIT (#123561) 2025-02-27 16:31:38 -08:00
Mark Vieira
b8b77eaa81
Remove XPackIT (#123558) 2025-02-27 16:31:27 -08:00
Mark Vieira
d2da07716e
Remove rolling upgrade test that is no longer applicable (#123557) 2025-02-27 16:31:15 -08:00
Alexey Ivanov
ab835a96b1
Update elastic-apm-agent to support Java 24 (#123052)
Updates elastic-apm-agent to 1.52.2 to support Java 24.
2025-02-28 00:14:33 +00:00
Mark Vieira
d9c0ef156a
Fix enrollment packaging test when running on Java 24 (#123650) 2025-02-27 14:40:27 -08:00
elasticsearchmachine
1abd7a134a Mute org.elasticsearch.entitlement.runtime.policy.PolicyManagerTests testFilesEntitlementsWithExclusive #123657 2025-02-28 09:37:36 +11:00
Joe Gallo
37f0b3c932
Adjust the versions for :modules:ingest-geoip:qa:full-cluster-restart 2025-02-27 16:00:49 -05:00
Rene Groeschke
cd8fbab5b5
Fix some early tasks creations (#123637)
We want to use the task avoidance api whereever possible and delay task
creation
2025-02-28 07:54:01 +11:00
Luca Cavanna
905222613a
Disable concurrency when top_hits sorts on anything but _score (#123610)
We already disable inter-segment concurrency in SearchSourceBuilder whenever
the top-level sort provided is not _score. We shoudl apply the same rules
in top_hits. We recenly stumbled upon non deterministic behaviour caused by
script sorting defined within top hits. That is to be expected given that
script sorting does not support search concurrency.

The sort script can be replaced with a runtime field, either defined in the
mapping or in the search request, which does support concurrency and guarantees
predictable behaviour.
2025-02-27 21:22:17 +01:00
Mark Vieira
79c388a5b7
Don't use preemptive agents for forwards compat tests 2025-02-27 09:49:53 -08:00
Colleen McGinnis
b7e3a1e14b
[docs] Migrate docs from AsciiDoc to Markdown (#123507)
* delete asciidoc files

* add migrated files

* fix errors

* Disable docs tests

* Clarify release notes page titles

* Revert "Clarify release notes page titles"

This reverts commit 8be688648d.

* Comment out edternal URI images

* Clean up query languages landing pages, link to conceptual docs

* Add .md to url

* Fixes inference processor nesting.

---------

Co-authored-by: Liam Thompson <32779855+leemthompo@users.noreply.github.com>
Co-authored-by: Liam Thompson <leemthompo@gmail.com>
Co-authored-by: Martijn Laarman <Mpdreamz@gmail.com>
Co-authored-by: István Zoltán Szabó <szabosteve@gmail.com>
2025-02-27 17:56:14 +01:00
Armin Braun
2113a3c606
Remove needless contention in ContextIndexSearcher.timeoutOverwrites (#123609)
This doesn't have to be an instance variable nor does it need any
concurrency, it's per definition a thread-local variable so lets make it
one.
2025-02-27 17:50:17 +01:00
Rene Groeschke
17e35d431b
[IDEA] Enable Gradle Configuration Cache for Gradle Test Runner (#123552)
* [IDEA] Enable Gradle Configuration Cache for Gradle Runner

This should speedup repetitives usages of the Gradle Runner for the majority of test executions
We added a flag to disable it explicitly if it does not work for certain scenarios
2025-02-27 17:34:02 +01:00
elasticsearchmachine
84552f8d83 Mute org.elasticsearch.action.admin.cluster.node.tasks.CancellableTasksIT testChildrenTasksCancelledOnTimeout #123568 2025-02-28 01:55:15 +11:00
Niels Bauman
4b31293b6f
Fix TimeSeriesDataStreamsIT.testShrinkActionInPolicyWithoutHotPhase (#123153)
This test was muted, got fixed, and then was muted again but the issue
wasn't reopened (by accident it seems). Since that was 4 years ago, I'm
going to unmute this test and if it's still an issue, the new test
automation will open a new issue for it using the current muting
mechanism.

Relates #70595
2025-02-27 15:10:29 +01:00
Ievgen Degtiarenko
238b279f34
Fix cluster and node name in driver (#123601) 2025-02-27 14:57:52 +01:00
Nikolaj Volgushev
a77626368f
Handle NotEntitledException in SSL file utils (#123491)
SSL file utils currently only handle security manager access control
exceptions around file read checks. This PR extends these to support
entitlement checks as well. 

There is no easy way to unit test this since we can't run unit tests
with entitlements enabled (for now). The PR includes a REST test
instead. 

Relates: https://github.com/elastic/elasticsearch/issues/121960
2025-02-28 00:06:09 +11:00
Yang Wang
c7e7dbe904
Abort pending deletion on IndicesService stop (#123569)
When IndicesService is closed, the pending deletion may still be in
progress due to indices removed before IndicesService gets closed. If
the deletion stucks for some reason, it can stall the node shutdown.
This PR aborts the pending deletion more promptly by not retry after
IndicesService is stopped.

Resolves: #121717 Resolves: #121716  Resolves: #122119
2025-02-27 23:43:53 +11:00
Yang Wang
2c0fb18899
[Test] Do not use ExtrasFS for fileSettingsServiceTests (#123578)
The tests expect tightly controlled set of files and should not see
random extra files.
2025-02-27 22:42:17 +11:00
Armin Braun
43f3032db8
Inline some methods into Releasables (#123273)
Bit of a random find. Looks like we're effectively spending something
like ~0.5% of the total CPU time on resolving virtual calls for these
methods. Inlining `IOUtils` reduces their size quite a bit, removes
dead-code for rethrowing `IOException` that is never actually thrown
and hopefully as a result improve compilation a little here.
2025-02-27 12:09:36 +01:00
Liam Thompson
731a412326
Revert "Revert "[docs] Add the new docs CI checks"" (#123585)
* Revert "Revert "Add new docs actions (#123506)" (#123570)"

This reverts commit ee31c5a92d.

* [CI] Auto commit changes from spotless

---------

Co-authored-by: elasticsearchmachine <infra-root+elasticsearchmachine@elastic.co>
2025-02-27 11:23:50 +01:00
Simon Cooper
06206cc66a Apply spotless directly 2025-02-27 10:17:17 +00:00
Simon Cooper
be2c699ded
Use the correct id for the multi-project transport version (#123582) 2025-02-27 10:09:54 +00:00
Iván Cea Fontenla
ca5d251807
ESQL: Fix function registry concurrency issues on constructor (#123492)
Fixes https://github.com/elastic/elasticsearch/issues/123430

There were 2 problems here:
- We were filling a static field (used to auto-cast string literals) within a constructor, which is also called in multiple places
- The field was only filled with non-snapshot functions, so snapshot function auto-casting wasn't possible

Fixed both bugs by making the field non-static instead, and a fix to use the snapshot registry (if available) in the string casting rule.
2025-02-27 11:05:18 +01:00
Moritz Mack
32826974e4
Add missing APM agent entitlements (#123575)
Add missing APM agent entitlements
2025-02-27 21:02:56 +11:00
Tim Vernum
1d3106f288 Merge branch 'feature/multi-project' 2025-02-27 19:51:21 +11:00
Tanguy Leroux
e6eb8efba0
[Test] Add test for AWS SDKv1 swallowing exception at IndexputStream close time (#123505)
This change adds a unit test to demonstrate a specific 
behavior of the AWS SDKv1, which closes the InputStream 
used to upload a blob only after the HTTP request has 
been sent (this is to accomodate for retries). The SDK 
then swallows any exception thrown when closing the 
InputStream which has the effect to hide any potential 
CorruptIndexException that could have been detected 
at that time.

Relates ES-10931
2025-02-27 09:14:06 +01:00
Patrick Doyle
a9e27a9eaa
More entitlements for bouncycastle (#123548) 2025-02-27 09:08:36 +01:00
Liam Thompson
ee31c5a92d
Revert "Add new docs actions (#123506)" (#123570)
This reverts commit 4d5f9b2332.
2025-02-27 09:04:04 +01:00
Tim Vernum
783ce7a0d2
Merge branch 'main' into feature/multi-project 2025-02-27 15:33:46 +11:00
Yang Wang
cea5adcb49
Add null check in more places for persistent tasks (#123566)
There is no guarantee that a project has non-null persistent tasks [0].
Null check is already done in most places. This PR adds it in a few more
places.

[0] Since health-node is now a cluster-scoped persistent task, it has
become more likely for the project-scoped tasks to be null.

Relates: #123262
2025-02-27 15:10:30 +11:00
Tim Vernum
779e1adc4a
Replace use of 'getProject' in RoutingNodes (#123567)
When #119968 was merged into multi-project we introduced a regression by
inserting a call to `.getProject()` within the `RoutingNodes` class that
was supposed to be multi-project-aware.

This commit replaces those calls with `.indexMetadata` lookups
2025-02-27 14:44:55 +11:00
Tim Vernum
10be77b5a6
Revert changes to DistributedArchitectureGuide.md (#123565)
This commit reverts the changes to

    docs/internal/DistributedArchitectureGuide.md

These changes need to be redone in order to update the code links
so that they point to a more recent version that includes the
`Metadata.ClusterCustom` / `Metadata.ProjectCustom` split

We also need to incorporate documentation updates to reflect the
changes to PersistentTasks.
2025-02-27 13:24:36 +11:00
Jack Conradson
3e3dfa4fb7
Add an exclusive parameter for files entitlements (#123087)
This adds an exclusive parameter for FilesEntitlement where a path can be made exclusive for a certain 
module. Should two modules attempt to both specify the same path as exclusive an exception is 
thrown.
2025-02-26 17:35:47 -08:00
Niels Bauman
92081d4cd2 Add MP fix annotation for cluster state listeners (MP-1966)
We're catching MP exceptions when applying cluster state listeners to
avoid noise in the logs, but we shouldn't forget to remove this `catch`
block at some point in the future.
2025-02-27 12:23:39 +11:00
Niels Bauman
2607f649d4 Make handling of failure during shard recovery project-aware (MP-1967)
When a shard recovery fails, we need to able able to handle that
properly when there are multiple projects.
2025-02-27 12:23:39 +11:00
Niels Bauman
d20773577e Mark temporary metadata builder methods as deprecated (MP-1968)
These methods will be removed at some point in the future. By marking
them as deprecated, it'll be easier to spot that some code is using
these methods. Additionally, this will hopefully prevent people from
using these temporary methods.
2025-02-27 12:23:39 +11:00
Tim Vernum
f7e80e7fd2
Merge branch 'main' into feature/multi-project 2025-02-27 12:09:08 +11:00
Oleksandr Kolomiiets
8db6f16119
Another set of fixes to IDEA test running (#123553) 2025-02-26 15:33:40 -08:00
Tim Vernum
b5ed91a6f0 Merge branch main into feature/multi-project 2025-02-27 09:38:52 +11:00
Mark Vieira
0b40fc9967
Quote matrix variables
(cherry picked from commit b5735d8a3a)
2025-02-26 14:23:20 -08:00
Armin Braun
da51c8ccbf
Remove lots of redundant ref-counting from transport pipeline (#123390)
We can do with a whole lot less in ref-counting, avoiding lots of contention and speeding
up the logic in general by only incrementing ref-counts where ownership is unclear while
avoiding count changes on obvious "moves".
2025-02-26 23:11:17 +01:00
Mark Vieira
c118ab94f4
Add forwards compatibility testing CI pipeline
(cherry picked from commit 6b1a6f7d63)
2025-02-26 13:59:21 -08:00
Michel Laterman
61179258ce
Add fips attribute to .fleet-agents docs (#123406)
Co-authored-by: Julien Lind <julien.lind@elastic.co>
2025-02-26 12:54:22 -08:00
Ryan Ernst
cee43fd7d8
Add ignore_url for setting based files entitlement (#123541)
File entitlements which read a setting may actually contain urls. This
commit adds an optional `ignore_url` property for the entitlement to
skip any values which are urls.
2025-02-26 12:41:44 -08:00
Dianna Hohensee
b1e6908ef5
Add node weight changes to balance round summaries (#122195)
The node weight changes between two balancer rounds are summarized by
saving the old DesiredBalance's weights per node along with a weights
diff to reach the new DesiredBalance's weights per node. This supports
combining multiple summaries by using the oldest summary's base node
weights and summing the diffs across all summaries to reach a combined
node weight diffs.
2025-02-26 12:52:48 -05:00
Mark Vieira
feb3a60e98
Add forwards compatibility testing (#123436) 2025-02-26 08:56:30 -08:00
Costin Leau
e4604a4432
ESQL: Reduce iteration complexity for plan traversal (#123427) 2025-02-26 08:30:58 -08:00
Colleen McGinnis
4d5f9b2332
Add new docs actions (#123506) 2025-02-26 17:04:12 +01:00
Ioana Tagirta
c9fa59cf98
Add tests using semantic search and lookup join (#123504) 2025-02-26 15:56:45 +00:00
Salvatore Campagna
86a6c93bd6
Benchmark date field range query with doc values sparse index (#123251) 2025-02-26 16:50:36 +01:00
Moritz Mack
7e554fa443
Skip selected tests in SSLErrorMessageFileTests that rely on SecurityManager to block access to resources. (#123484) 2025-02-26 16:47:44 +01:00
David Turner
4be53f50f7
Small resiliency status update (#123497) 2025-02-27 01:49:16 +11:00
Efe Gürkan YALAMAN
b86c44c260
Add UpdateForV10 annotations for Behavioral Analytics APIs (#123393)
* Add UpdateForV10 annotations for Behavioral Analytics APIs

* Update docs/changelog/123393.yaml

* [CI] Auto commit changes from spotless

* Delete docs/changelog/123393.yaml

---------

Co-authored-by: elasticsearchmachine <infra-root+elasticsearchmachine@elastic.co>
2025-02-26 14:57:39 +01:00
Ievgen Degtiarenko
faa15ebab6
Add profile details (#123388) 2025-02-26 14:33:12 +01:00
Ievgen Degtiarenko
72678e85ea
Add cluster and node name to driver profile output (#123470) 2025-02-26 14:32:49 +01:00
Kostas Krikellas
4269c732d9
[TEST] Remove flaky checks on snapshot shard stats (#123458)
* Update 10_basic.yml

* Update muted-tests.yml

* Update 10_basic.yml
2025-02-26 13:57:52 +02:00
Ievgen Degtiarenko
b369cbcec6
Simplify driver creation in tests (#123457) 2025-02-26 12:34:48 +01:00
Nikolaj Volgushev
ae46613049
Upgrade Netty to 4.1.118.Final (#122371)
This PR upgrades Netty to `4.1.118.Final`.
2025-02-26 11:44:25 +01:00
Ievgen Degtiarenko
f1097a1784
Rename processing -> process in LuceneOperator status (#123359) 2025-02-26 11:34:31 +01:00
Niels Bauman
f0f0eeb077
Fix failing test(s) in TimeSeriesDataStreamsIT (#123378)
When these tests were run around midnight, the use of
`DataStream#getDefaultBackingIndexName` could result in a potential
mismatch in the generated index name and the one that the cluster
actually created. Instead, we need to obtain the backing index and
extract the desired index name from there.

Fixes #123086
Relates #123376
2025-02-26 11:16:52 +01:00
Martijn van Groningen
21b97c250b
Fix mistake in NativeArrayIntegrationTestCase, (#123459)
that affect release builds.
2025-02-26 10:31:21 +01:00
Ievgen Degtiarenko
ec4022a047
Simplify Driver data classes (#123373) 2025-02-26 09:11:02 +01:00
Tim Vernum
4d0c25330c Add "hasAnyIndices" method to Metadata
If all we want to know is whether the cluster has any indices, then
this new method is more efficient than using the existing
"getTotalNumberOfIndices" method
2025-02-26 18:00:24 +11:00
Tim Vernum
597ab8a7e9 Merge branch 'main' into multi-project 2025-02-26 17:57:01 +11:00
elasticsearchmachine
1e8262170e Mute org.elasticsearch.xpack.esql.action.CrossClusterQueryWithPartialResultsIT testOneRemoteClusterPartial #123451 2025-02-26 16:49:01 +11:00
Niels Bauman
2ad3121795 Make the health node a cluster-scoped persistent task (MP-1969)
Now that the persistent task framework supports cluster-scoped
persistent tasks, we can make the health node persistent task run with
cluster scope.
2025-02-26 16:02:19 +11:00
Ryan Ernst
0dafc9974e
Add JDK 24 release candidate to toolchain resolver (#123321) 2025-02-25 20:50:51 -08:00
Nhat Nguyen
c4ff1c8eb3
Unmute EnrichIT#testAvgDurationByArtist (#123443)
Relates #123093
2025-02-25 20:16:57 -08:00
Yang Wang
ad8e22d1ef Fix diff building for combined cluster and project persistent tasks (MP-1965)
When the combined tasks diff is used, we need to remove the separate
project and cluster tasks from the original diff.

Relates: MP-1945, MP-1938
2025-02-26 13:46:24 +11:00
Yang Wang
b882c079f6 Make persistent task framework project aware (MP-1955)
This PR is the follow-up work for MP-1945 and MP-1938 which laid the
foundation of two different scoped persistent tasks. It updates the
persistent task framework to be aware of the two task types so that it
can handle both cluster scope tasks and per-project tasks. Once these
changes are in place, we will make health-node to be the first
cluster-scope persistent task.

Relates: ES-10168
2025-02-26 13:45:09 +11:00
Ryan Ernst
8176746754
Give NamedComponentReader access to read plugins directories (#123431)
The NamedComponentReader reads a file created upon plugin installation
for stable plugins from the plugin installation dir. This commit passes
the plugins directory through to entitlements and grants server access.
2025-02-26 00:44:03 +00:00
elasticsearchmachine
c92ce0adee Mute org.elasticsearch.packaging.test.DockerTests test151MachineDependentHeapWithSizeOverride #123437 2025-02-26 11:06:55 +11:00
Ryan Ernst
4531e6fa4e
Grant Lucene expressions module create classloader entitlement (#123424)
Expressions create a classloader within Lucene, not the Elasticsearch
module. This commit fixes the policy to grant the entitlement to the
Lucene module.
2025-02-25 23:36:01 +00:00
elasticsearchmachine
6f2f68ee95 Mute org.elasticsearch.index.mapper.IPSyntheticSourceNativeArrayIntegrationTests testSynthesizeArrayIgnoreMalformed #123419 2025-02-26 08:32:21 +11:00
elasticsearchmachine
e1652af25d Mute org.elasticsearch.index.mapper.IPSyntheticSourceNativeArrayIntegrationTests testSynthesizeArrayRandom #123418 2025-02-26 08:32:14 +11:00
elasticsearchmachine
916b22792d Mute org.elasticsearch.index.mapper.IPSyntheticSourceNativeArrayIntegrationTests testSynthesizeArray #123417 2025-02-26 08:32:06 +11:00
Joe Gallo
af6014ecb5
Use ordered maps for PipelineConfiguration xcontent deserialization (#123403) 2025-02-25 15:20:01 -05:00
Matt Culbreth
3075b0776e
Remove @UpdateForV9 annotations from Data Management code (#123171)
* Remove `@UpdateForV9` as necessary backport has been done
* Change UpdateForV9 to UpdateForV10 for ESRestTestCase due to N-2 support
2025-02-25 15:05:49 -05:00
Ryan Ernst
b5e482bc91
Enable entitlements by default (#122907)
Entitlements are almost complete. This commit enables them by default,
in preparation for 8.18/9.0.
2025-02-25 09:58:39 -08:00
Keith Massey
88cf2487e7
Fixing serialization of ScriptStats cache_evictions_history (#123384) 2025-02-25 16:46:22 +00:00
elastic-renovate-prod[bot]
48d20839fb
Update docker.elastic.co/wolfi/chainguard-base:latest Docker digest to c66fdaf (#123385)
This PR contains the following updates:

| Package | Update | Change | |---|---|---| |
docker.elastic.co/wolfi/chainguard-base | digest | `d74b1fd` ->
`c66fdaf` |

---

### Configuration

📅 **Schedule**: Branch creation - "after 1pm on tuesday" (UTC),
Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once
you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Renovate
Bot](https://redirect.github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzOS4xMDcuMCIsInVwZGF0ZWRJblZlciI6IjM5LjEwNy4wIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyI6RGVsaXZlcnkvUGFja2FnaW5nIiwiPm5vbi1pc3N1ZSIsIlRlYW06RGVsaXZlcnkiLCJhdXRvLW1lcmdlLXdpdGhvdXQtYXBwcm92YWwiXX0=-->
2025-02-26 03:44:53 +11:00
Nhat Nguyen
c02b484eab
Use mock block factory in breaker tests (#122965)
We have two leaks reported in breaker tests, but we do not have their 
traces. This PR integrates MockBlockFactory for breaker tests to help
identify these potential leaks.

Relates #122810
2025-02-25 07:59:15 -08:00
Jill Guyonnet
28f4d87ba5
[Fleet] Add upgrade_attempts to .fleet-agents index (#123256)
* [Fleet] Add upgrade_attemps to .fleet-agents index

* Change type to date

---------

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2025-02-25 16:38:47 +01:00
Kathleen DeRusso
ae6474db63
Deprecate Behavioral Analytics CRUD apis (#122960)
* Deprecate Behavioral Analytics CRUD APIs

* Add allowed warning for REST Compatibility tests

* Update docs/changelog/122960.yaml

* Update changelog

* Update docs to add deprecation flags and fix failing tests

* Update changelog

* Update changelog again

* Update docs formatting

Co-authored-by: Liam Thompson <32779855+leemthompo@users.noreply.github.com>

* Skip asciidoc test

---------

Co-authored-by: Efe Gürkan YALAMAN <efeyalaman@gmail.com>
Co-authored-by: Liam Thompson <32779855+leemthompo@users.noreply.github.com>
Co-authored-by: Efe Gürkan YALAMAN <efeguerkan.yalaman@elastic.co>
2025-02-25 16:02:50 +01:00
Ying Mao
e8438490ea
Updates to allow using Cohere binary embedding response in semantic search queries. (#121827)
* wip

* wip

* [CI] Auto commit changes from spotless

* updating tests

* [CI] Auto commit changes from spotless

* Update docs/changelog/121827.yaml

* Updates after the refactor

* [CI] Auto commit changes from spotless

* Updating error message

---------

Co-authored-by: elasticsearchmachine <infra-root+elasticsearchmachine@elastic.co>
2025-02-25 09:14:20 -05:00
Lorenzo Dematté
f929270431
Fix how we suppress logs for self-tests (#123361) 2025-02-25 14:09:30 +00:00
Martijn van Groningen
6c55099784
Store arrays offsets for ip fields natively with synthetic source (#122999)
Follow up of #113757 and adds support to natively store array offsets for ip fields instead of falling back to ignored source.
2025-02-25 13:42:41 +00:00
Lorenzo Dematté
2f0e1dabf7
Missing log4j policy (#123360) 2025-02-25 13:55:25 +01:00
David Turner
d0db4cd085
Reduce licence checks in LicensedWriteLoadForecaster (#123346)
Rather than checking the license (updating the usage map) on every
single shard, just do it once at the start of a computation that needs
to forecast write loads.

Closes #123247
2025-02-25 23:50:43 +11:00
Lorenzo Dematté
4f6a0e6840
[Entitlements] Follows links during FileAccessTree creation (#123357) 2025-02-25 13:39:58 +01:00
Craig Taverner
ec82c24a87
Add support to VALUES aggregation for spatial types (#122886)
The original work at https://github.com/elastic/elasticsearch/pull/106065 did not support geospatial types with this comment:

> I made this work for everything but geo_point and cartesian_point because I'm not 100% sure how to integrate with those. We can grab those in a follow up.

The geospatial types should be possible to collect using the VALUES aggregation with similar behavior to the `ST_COLLECT` OGC function, based on the Elasticsearch convention that treats multi-value geospatial fields as behaving similarly to any geometry collection. So this implementation is a trivial addition to the existing values types support.
2025-02-25 11:38:51 +01:00
Lorenzo Dematté
12fcdd8633
Some missing entitlements preventing serverless to start (#123271) 2025-02-25 10:19:15 +01:00
Ryan Ernst
9aaf07242c
Add pidfile access for server (#123313) 2025-02-25 10:18:56 +01:00
Rene Groeschke
4bd1f81ef9
Move eclipse specific extention property into elasticsearch eclipse plugin (#123320) 2025-02-25 19:30:42 +11:00
Ryan Ernst
5b0591e04a
Consider entitlement lib as system module (#123315)
* Consider entitlement lib as system module

Entitlements sometimes needs to perform sensitive operations,
particularly within the FileAccessTree. This commit expands the
trivially allowed check to include entitlements as one of the system
modules alongside the jdk. One consequence is that the self test must be
moved outside entitlements.

* [CI] Auto commit changes from spotless

* remove old method call

---------

Co-authored-by: elasticsearchmachine <infra-root+elasticsearchmachine@elastic.co>
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2025-02-25 09:05:36 +01:00
David Turner
4a6343ad0b
Update minimum transport version in main (#123254)
Versions 9.1.0 onwards will not be wire-compatible with versions before
8.19.0. This commit sets the minimum transport version to reject
handshakes from earlier versions.
2025-02-25 07:39:14 +00:00
Tim Vernum
a23175d63a Revert build changes from multi-project 2025-02-25 17:31:06 +11:00
Stanislav Malyshev
688542b515
Increase await timeout for testCancelFailedSearchWhenPartialResultDisallowed (#123084) 2025-02-24 21:48:18 -07:00
Yang Wang
7686d47f54 Handle task type split on reading cluster state from disk (MP-1964)
An old node writes all tasks in the metadata custom. A new old must be
able to read it and separate the cluster-scoped and project-scoped tasks
and store them in the right place. This PR does that.

Relates: MP-1945, MP-1938
2025-02-25 04:19:40 +00:00
Ryan Ernst
1c7d17c295
Remove unnecessary temp dir access (#123314)
All modules have read/write access to the temp dir. This commit removes
unnecessarily adding the temp dir explicitly to the server policy.
2025-02-25 01:48:07 +00:00
Tim Vernum
c9d5a7dd31 Merge main into multi-project 2025-02-25 11:49:17 +11:00
Tim Vernum
77bf65d9af Merge main into multi-project 2025-02-25 10:33:53 +11:00
Tim Vernum
d6d56e1b43 Add test prefix to multi_project setting (MP-1960)
This changes the `multi_project.enabled` setting to
`test.multi_project.enabled`
2025-02-25 09:51:29 +11:00
Joe Gallo
6315b8a8aa
Register IngestGeoIpMetadata as a NamedXContent (#123079) 2025-02-24 17:25:25 -05:00
Ryan Ernst
09a3ec1fb3
Add platform property to files entitlement (#123212)
Some file paths are OS specific. This commit adds a `platform` property
to each file in a files entitlement that can be used to limit that file
to a specific platform.

Co-authored-by: Moritz Mack <mmack@apache.org>
Co-authored-by: Lorenzo Dematte <lorenzo.dematte@elastic.co>
2025-02-24 22:17:25 +00:00
Ryan Ernst
ad99b0d3e8
Add shared_repo relative dir for files entitlement (#123221)
This commit adds the shared repo path as a relative base dir. However,
it does not make this available to policy files, only to server.
2025-02-24 11:39:26 -08:00
Niels Bauman
b0a6ef41d5 Merge main into multi-project 2025-02-24 20:11:46 +01:00
Nik Everett
a792334756
pick up main (#122075)
Co-authored-by: Fang Xing <fang.xing@elastic.co>
2025-02-24 13:59:43 -05:00
Patrick Doyle
763e7cd44a
FileAccessTree fixes for ordering and pruning (#123291)
* Custom comparator for paths in FileAccessTree

* Strip trailing separators in normalizePath
2025-02-24 13:50:33 -05:00
Samiul Monir
5664f4f2ba
Improved error message when index field type is unknown (#122860)
* Updating error message when index field type is unknown

* Fix style issue

* Add yaml test for invalid field type error message

* Update docs/changelog/122860.yaml

* Updating error message for runtime and multi field type parser

* add and fix yaml tests

* Fix code styles by running spotlessApply

* Update changelog

* Updatig the test in yml

* Updating error message for runtime

* Fix failing yaml tests

* Update error message to Fix unit tests

* fix serverless qa test

---------

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2025-02-24 13:16:22 -05:00
Pat Whelan
4c3ceae986
[ML] Set Connect Timeout to 5s (#123272)
Reduced connection timeout from infinite to a system configurable
setting that defaults to 5s.

Increased EIS auth token timeout from 30s to 1m.
2025-02-24 18:03:15 +00:00
Niels Bauman
b23b6b6103 Mute esql data stream lookup MP YAML tests 2025-02-24 18:55:36 +01:00
Lorenzo Dematté
c7bcdd37f4
[Entitlements] Cross-platform implementation of Path.isAbsolute() (#123282) 2025-02-24 18:27:36 +01:00
David Turner
d007dae1ad
Remove redundant IndexNameExpressionResolver params (#123258)
Follow-up to #120531 to remove all the now-redundant constructor
parameters.
2025-02-25 04:08:31 +11:00
Nhat Nguyen
4d2b8dc4f2
Fix early termination in LuceneSourceOperator (#123197)
The LuceneSourceOperator is supposed to terminate when it reaches the 
limit; unfortunately, we don't have a test to cover this. Due to this
bug, we continue scanning all segments, even though we discard the
results as the limit was reached. This can cause performance issues for
simple queries like FROM .. | LIMIT 10, when Lucene indices are on the
warm or cold tier. I will submit a follow-up PR to ensure we only
collect up to the limit across multiple drivers.
2025-02-24 08:49:54 -08:00
Niels Bauman
116b045139 Merge main into multi-project 2025-02-24 17:43:47 +01:00
Andrei Dan
760b2312ea
Periodically check the available memory when fetching search hits source (#121920)
When fetching documents, sometimes we need to load the  entire source of
search hits. Document sources can be large,  and with support for up to
10k hits per search request, this creates  a significant untracked
memory load on Elasticsearch that can  potentially cause out-of-memory
errors.

This PR adds memory checking for hits source in the fetch phase. We
check with the parent (the real memory) circuit breaker every  1MiB of
loaded source and when fetching the last document of every segment. This
gives the real memory breaker a chance to interrupt  running operations
when we're running low on memory, and prevent  potential OOMs. 

The amount of local accounting to buffer is controlled by the 
`search.memory_accounting_buffer_size` dynamic setting and defaults to
`1MiB`.

Fixes #89656
2025-02-25 03:25:14 +11:00
Nik Everett
319e53a350
ESQL: Benchmark TO_LOWER and TO_UPPER (#123268)
This adds a microbenchmark for TO_LOWER and TO_UPPER. They are quite
common probably could use some optimizing.
2025-02-24 11:18:06 -05:00
Quentin Pradet
17ed01471b
Add missing body to ML rest-api-spec API (#123235) 2025-02-24 19:56:01 +04:00
jeffganmr
22103de150
fix stale data in synthetic source for string stored field (#123105) 2025-02-24 07:22:48 -08:00
elasticsearchmachine
b2bd8d2171 Mute org.elasticsearch.action.admin.indices.diskusage.IndexDiskUsageAnalyzerTests testCompletionField #123269 2025-02-25 01:29:07 +11:00
Niels Bauman
3f51012481
Fix NPE in ReindexDataStreamTransportAction (#123262)
In the multi-project branch, we're making some changes to persistent
tasks and those changes can cause the persistent tasks custom to still
be `null`. This resulted in an NPE here, so I'm fixing the check here.
2025-02-24 13:56:37 +00:00
Iván Cea Fontenla
c40c5a6c0a
ESQL: Fix functions emitting warnings with no source (#122821)
Fixes https://github.com/elastic/elasticsearch/issues/122588

- Replaced `Source.EMPTY.writeTo(out)` to `source().writeTo(out)` in functions emitting warnings
  - Did the same on all aggs, as Top emits an error on type resolution. This is not a bug, as type resolution errors should only happen in the coordinator. Another option would be changing Top to not generate that error there, and make it implement instead `PostAnalysisVerificationAware`
- In some cases, we don't even serialize an empty source. So I had to add a new `TransportVersion` to do so
  - As an special case, `ToLower` and `ToUpper` weren't serializing a source, but they don't emit warnings. As they were the only remaining functions not serializing the source, I added it there too
2025-02-24 13:52:41 +00:00
Armin Braun
cae7f0a809
Use inheritance instead of composition to simplify search phase transitions (#119272)
We only need the extensibility for testing and it's a lot easier to
reason about the code if we have explicit methods instead of overly
complicated composition with lots of redundant references being retained
all over the place.

-> lets simplify to inheritance and get shorter code that performs more
predictably (especially when it comes to memory) as a first step.
This also opens up the possibility of further simplifications and
removing more retained state/memory as we go through the search phases.
2025-02-24 14:26:22 +01:00
David Turner
187b192dfe
Deduplicate allocation stats calls (#123246)
These things can be quite expensive and there's no need to recompute
them in parallel across all management threads as done today. This
commit adds a deduplicator to avoid redundant work.
2025-02-25 00:21:10 +11:00
Benjamin Trent
4e71c04353
Adding more tests for rank_vectors for hex string case (#123185) 2025-02-24 07:39:17 -05:00
Moritz Mack
329514965e
Unmute AsyncSearchSecurityIT hitting potential JDK bug to gather more samples (#123253) 2025-02-24 22:31:15 +11:00
Chris Hegarty
135f00a9ff
Enable testCommandNamesAsIdentifiers (#123249) 2025-02-24 11:10:00 +00:00
Armin Braun
236b955b95
Speedup SearchResponse serialization (#123211)
No need to have a nested concat here. There's obviously lots and lots of
room for optimization on this one, but just flattening out one obvious
step here outright halves the number of method calls required when
serializing a search response. Given that method calls can consume up to
half the serialization cost this change might massively speed up some
usecases.
2025-02-24 12:00:29 +01:00
Armin Braun
2a9de3f57f
Avoid creating IndexSearcher in Engine.refreshNeeded (#123218)
Checking whether we need to refresh does not require a searcher
so we can simplify this to just work based on the reader
and avoid lots of contention etc. for setting up the searcher.

relates #122374
2025-02-24 11:59:39 +01:00
Armin Braun
c06bde4c62
Cleanup duplication and dead code around ChunkedToXContentHelper (#123217)
Cleans up a couple things that are obviously broken:

* duplicate array and object constructs where the helper utility
  generates the exact same iterator
* unused helper methods
* single iterator concatenations
2025-02-24 11:57:37 +01:00
Carlos Delgado
f5e2a92a31
Add rescore knn vector test coverage (#122801) 2025-02-24 07:47:05 +00:00
Artem Prigoda
4ca669ad42
[test] Fix RetrySearchIntegTests (#122919)
Don't simultaneously restart multiple nodes in a cluster. It causes data races when
multiple primaries are trying to mark the `[[.snapshot-blob-cache][0]]` shard as stale.

```
org.elasticsearch.cluster.action.shard.ShardStateAction$NoLongerPrimaryShardException: primary term [2] did not match current primary term [4]
	at org.elasticsearch.cluster.action.shard.ShardStateAction$ShardFailedClusterStateTaskExecutor.execute(ShardStateAction.java:355) ~[elasticsearch-8.18.0-SNAPSHOT.jar:8.18.0-SNAPSHOT]
	at org.elasticsearch.cluster.service.MasterService.innerExecuteTasks(MasterService.java:1075) ~[elasticsearch-8.18.0-SNAPSHOT.jar:8.18.0-SNAPSHOT]
	at org.elasticsearch.cluster.service.MasterService.executeTasks(MasterService.java:1038) ~[elasticsearch-8.18.0-SNAPSHOT.jar:8.18.0-SNAPSHOT]
	at org.elasticsearch.cluster.service.MasterService.executeAndPublishBatch(MasterService.java:245) ~[elasticsearch-8.18.0-SNAPSHOT.jar:8.18.0-SNAPSHOT]
	at org.elasticsearch.cluster.service.MasterService$BatchingTaskQueue$Processor.lambda$run$2(MasterService.java:1691) ~[elasticsearch-8.18.0-SNAPSHOT.jar:8.18.0-SNAPSHOT]
	at org.elasticsearch.action.ActionListener.run(ActionListener.java:452) ~[elasticsearch-8.18.0-SNAPSHOT.jar:8.18.0-SNAPSHOT]
	at org.elasticsearch.cluster.service.MasterService$BatchingTaskQueue$Processor.run(MasterService.java:1688) ~[elasticsearch-8.18.0-SNAPSHOT.jar:8.18.0-SNAPSHOT]
	at org.elasticsearch.cluster.service.MasterService$5.lambda$doRun$0(MasterService.java:1283) ~[elasticsearch-8.18.0-SNAPSHOT.jar:8.18.0-SNAPSHOT]
	at org.elasticsearch.action.ActionListener.run(ActionListener.java:452) ~[elasticsearch-8.18.0-SNAPSHOT.jar:8.18.0-SNAPSHOT]
	at org.elasticsearch.cluster.service.MasterService$5.doRun(MasterService.java:1262) ~[elasticsearch-8.18.0-SNAPSHOT.jar:8.18.0-SNAPSHOT]
	at org.elasticsearch.common.util.concurrent.ThreadContext$ContextPreservingAbstractRunnable.doRun(ThreadContext.java:1044) ~[elasticsearch-8.18.0-SNAPSHOT.jar:8.18.0-SNAPSHOT]
	at org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:27) ~[elasticsearch-8.18.0-SNAPSHOT.jar:8.18.0-SNAPSHOT]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144) ~[?:?]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642) ~[?:?]
	at java.lang.Thread.run(Thread.java:1575) ~[?:?]
```

Resolve #118374
Resolve #120442
2025-02-24 08:22:37 +01:00
Tim Rühsen
a5f3da2809
Fix queries for events with missing host.id (#122472) 2025-02-24 08:09:34 +01:00
Armin Braun
4af51839d2
Speedup MultiTermsAggregator (#123220)
Creating (and more importantly eventually resizing) a fresh stream
output makes up a large chunk of the runtime of this aggregation.
Also, recursively calling an inline consumer makes this logic
even more confusing and adds additional overhead as escape analysis
will not be able to remove the allocation of the consumer.
=> just call a method recursively and reuse the output
2025-02-24 08:00:47 +01:00
Tim Vernum
3858dd61b1 Move multi-project module to test tree (MP-1957)
The multi-project module is actually a testing module, but was included
in the modules/ tree for convenience. This commit moves it to
`test/external-modules/` which is where it belongs.
2025-02-24 16:07:05 +11:00
Tim Vernum
e7559d3dcd Merge main into multi-project 2025-02-24 15:35:48 +11:00
Tim Vernum
21a16acbd4 Merge main into multi-project 2025-02-24 14:23:18 +11:00
Tim Vernum
7fabcf42c7 Merge revision 5b90305211 into multi-project 2025-02-24 14:22:49 +11:00
Nik Everett
67293ba8f4
ESQL: Speed up VALUES for many buckets (#123073)
Speeds up the VALUES agg when collecting from many buckets.
Specifically, this speeds up the algorithm used to `finish` the
aggregation. Most specifically, this makes the algorithm more tollerant
to large numbers of groups being collected. The old algorithm was
`O(n^2)` with the number of groups. The new one is `O(n)`

```
(groups)
      1     219.683 ±    1.069  ->   223.477 ±    1.990 ms/op
   1000     426.323 ±   75.963  ->   463.670 ±    7.275 ms/op
 100000   36690.871 ± 4656.350  ->  7800.332 ± 2775.869 ms/op
 200000   89422.113 ± 2972.606  -> 21920.288 ± 3427.962 ms/op
 400000 timed out at 10 minutes -> 40051.524 ± 2011.706 ms/op
```

The `1` group version was not changed at all. That's just noise in the
measurement. The small bump in the `1000` case is almost certainly worth
it and real. The huge drop in the `100000` case is quite real.
2025-02-23 18:29:55 +00:00
elasticsearchmachine
5b90305211 Mute org.elasticsearch.xpack.ilm.TimeSeriesDataStreamsIT testSearchableSnapshotAction #123214 2025-02-23 11:16:27 +11:00
Tim Vernum
ac5b877095 Merge main into multi-project 2025-02-22 18:00:58 +11:00
Tim Vernum
fd9f8e1b08 Merge main into multi-project 2025-02-22 16:42:59 +11:00
Parker Timmins
8b25a7281d
Fix broken test caused by setting old write index to read-only verified (#123190)
#122887 set read-only on the source indices of a data stream reindex. To test behavior when the source index was already read-only, testDataStreamUpgrade sometimes set the old write index to read-only. But the rest end point for adding a read-only block always sets verifed-read-only. This caused the old write index to not need to be upgraded, resulting in an incorrect value for total_indices_requiring_upgrade
2025-02-21 20:20:17 -06:00
Jack Conradson
7cbd305a16
Prune extraneous files entitlements paths to prevent incorrect binary search (#123177) 2025-02-22 01:45:39 +00:00
Oleksandr Kolomiiets
df71ccf441
Don't run FieldExtractorIT#testScaledFloat using JDK17 (#123199) 2025-02-22 00:28:13 +00:00
elasticsearchmachine
0fee331c28 Mute org.elasticsearch.xpack.ilm.TimeSeriesLifecycleActionsIT testHistoryIsWrittenWithFailure #123203 2025-02-22 11:14:25 +11:00
elasticsearchmachine
2c34d95977 Mute org.elasticsearch.xpack.ilm.actions.SearchableSnapshotActionIT testRestoredIndexManagedByLocalPolicySkipsIllegalActions #123202 2025-02-22 11:10:37 +11:00
Sam Xiao
4233310846
Add health indicator impact to HealthPeriodicLogger (#122390) 2025-02-21 17:06:25 -05:00
Ryan Ernst
1ca04b7bae
Capture core dump files from tests (#123169)
When running Elasticsearch in tests we occassionally have JDK crashes.
It's important to capture the state of the JVM at the time of the crash.
We currently capture the hs_err_pid file for the crash, but the
resulting core file exists in a directory that is no captured. This
commit adjusts the capture patterns to also get core files.
2025-02-21 13:55:32 -08:00
elasticsearchmachine
f7e4d7cf8a Mute org.elasticsearch.smoketest.DocsClientYamlTestSuiteIT test {yaml=reference/snapshot-restore/restore-snapshot/line_408} #123192 2025-02-22 08:37:24 +11:00
elasticsearchmachine
fd626a288b Mute org.elasticsearch.upgrades.DataStreamsUpgradeIT testUpgradeDataStream #123189 2025-02-22 07:51:35 +11:00
Alexey Ivanov
2bda4c1fa8
Converting an Existing Data Stream to a System DataStream is Broken (#121392)
Adds support of converting existing data stream to a system data stream as part of existing system_index_metadata_upgrade_service task
2025-02-21 19:50:57 +00:00
kanoshiou
7326928502
Fix failed ScaledFloatFieldMapperTests (#123144) 2025-02-21 11:34:46 -08:00
Parker Timmins
2cc86b3df7
Add read-block to source index during data stream reindex (#122887)
When reindexing a data stream, we currently add a write block to the source indices so that new documents cannot be added to the index while it is being reindexed. A write block still allows the index to be deleted and for the metadata to be updated. It is possible that ILM could delete a backing index or update a backing index's lifecycle metadata while it is being reindexed. To avoid this, this PR sets a read-only block on the source index. This block must be removed before source index can be deleted after it is replaced with the destination index.
2025-02-21 13:17:26 -06:00
Ruben van Staden
af364a44ea
bump apm-data plugin version (#123166) 2025-02-21 13:10:48 -05:00
Pat Whelan
bd52363bde
[ML] Add ElasticInferenceServiceCompletionServiceSettings (#123155)
Adding the missing NamedWriteable to the registry.
2025-02-21 12:27:12 -05:00
Patrick Doyle
27b8fd7f0a
Rename testTransportRoundTripsWithTwoDigitFractions (#123160) 2025-02-21 16:45:08 +00:00
Patrick Doyle
061c0ca154
Reinstate BYTE_SIZE_VALUE_ALWAYS_USES_BYTES (#122964) 2025-02-21 07:23:22 -08:00
elasticsearchmachine
4e15a4d786 Mute org.elasticsearch.index.mapper.extras.ScaledFloatFieldMapperTests testBlockLoaderFromColumnReaderWithSyntheticSource #123149 2025-02-22 02:20:44 +11:00
Costin Leau
21845ad7a1
ESQL: Remove duplicated nested commands (#123085)
Fork grammar duplicated nested command declaration causing additional
 lexing to occur resulting in invalid field name declaration

Relates to #121948
2025-02-21 06:56:09 -08:00
Patrick Doyle
afd7e4e911
Misc non-java.base file entitlements (#123078)
* Misc non-java.base file entitlements

* Remove unnecessary dependency
2025-02-21 14:54:34 +00:00
Parker Timmins
f044d97ac1
Add lifecycle setting to destination index after adding to data stream (#123071)
When reindexing a data stream, remove the lifecycle name setting when creating the destination index, so that ILM does not process it. Add the setting back after adding the destination index to the data stream, at which point ILM can safely process it.
2025-02-21 08:46:19 -06:00
Alexander Spies
5013eee400
Unmute aaaall the affected tests (#123136)
Depends on https://github.com/elastic/elasticsearch/pull/123133 and
https://github.com/elastic/elasticsearch/pull/123132

Fixes https://github.com/elastic/elasticsearch/issues/123096 Fixes
https://github.com/elastic/elasticsearch/issues/123097 Fixes
https://github.com/elastic/elasticsearch/issues/123098 Fixes
https://github.com/elastic/elasticsearch/issues/123099 Fixes
https://github.com/elastic/elasticsearch/issues/123100 Fixes
https://github.com/elastic/elasticsearch/issues/123103 Fixes
https://github.com/elastic/elasticsearch/issues/123104 Fixes
https://github.com/elastic/elasticsearch/issues/123107 Fixes
https://github.com/elastic/elasticsearch/issues/123108 Fixes
https://github.com/elastic/elasticsearch/issues/123109 Fixes
https://github.com/elastic/elasticsearch/issues/123116 Fixes
https://github.com/elastic/elasticsearch/issues/123117 Fixes
https://github.com/elastic/elasticsearch/issues/123118 Fixes
https://github.com/elastic/elasticsearch/issues/123119 Fixes
https://github.com/elastic/elasticsearch/issues/123120 Fixes
https://github.com/elastic/elasticsearch/issues/123122 Fixes
https://github.com/elastic/elasticsearch/issues/123123 Fixes
https://github.com/elastic/elasticsearch/issues/123124 Fixes
https://github.com/elastic/elasticsearch/issues/123130 Fixes
https://github.com/elastic/elasticsearch/issues/123131
2025-02-22 01:41:50 +11:00
Jan Kuipers
5f99708187
Refactor EmbeddingRequestChunker (#122818)
* refactor

* inference generics

* more refactor

* unify naming

* remove interface "EmbeddingInt"

* more renaming

* javadoc

* revert accidental changeas

* remove ununsed EmbeddingRequestChunker.EmbeddingType

* polish

* support chunking for text embedding bits

* Polish error messagex

* fix VoyageAI conflicts
2025-02-21 15:29:50 +01:00
elasticsearchmachine
698bf31c68 Mute org.elasticsearch.xpack.esql.action.CrossClusterAsyncQueryStopIT testStopQueryLocal #121672 2025-02-22 00:52:59 +11:00
elasticsearchmachine
b404a8b1f5 Mute org.elasticsearch.index.mapper.extras.ScaledFloatFieldMapperTests testBlockLoaderFromRowStrideReaderWithSyntheticSource #123145 2025-02-22 00:32:24 +11:00
Tim Grein
71f80c4213
[Inference API] Follow-up for add rerouting attributes PR (#123121) 2025-02-21 14:27:40 +01:00
Joe Gallo
a8958755a7
Fix geoip databases index access after system feature migration (again) (#122938) 2025-02-21 08:00:10 -05:00
Simon Cooper
274be7997a
Create a SearchResponseBuilder for creating SearchResponses in tests (#122196)
As well as simplifying test code, this also highlights which settings in the response are actually needed for individual tests
2025-02-21 12:00:17 +00:00
Tim Vernum
7d2d490f66 Merge main into multi-project 2025-02-21 22:06:33 +11:00
elasticsearchmachine
2c432a461c Mute org.elasticsearch.xpack.esql.ccq.MultiClusterSpecIT test {fork.ForkWithWhereSortAndLimit} #123131 2025-02-21 21:57:15 +11:00
elasticsearchmachine
861daf6d03 Mute org.elasticsearch.xpack.esql.qa.mixed.EsqlClientYamlIT test {p0=esql/40_tsdb/render aggregate_metric_double when missing value} #123130 2025-02-21 21:56:59 +11:00
Martijn van Groningen
8d1f5d3223
Hold store reference in InternalEngine#performActionWithDirectoryReader(...) (#123010)
This method gets called from `InternalEngine#resolveDocVersion(...)`, which gets during indexing (via `InternalEngine.index(...)`).

When `InternalEngine.index(...)` gets invoked, the InternalEngine only ensures that it holds a ref to the engine via Engine#acquireEnsureOpenRef(), but this doesn't ensure whether it holds a reference to the store.

Closes #122974

* Update docs/changelog/123010.yaml
2025-02-21 11:48:21 +01:00
elasticsearchmachine
edcc21895e Mute org.elasticsearch.index.mapper.extras.ScaledFloatFieldMapperTests testBlockLoaderFromRowStrideReader #123126 2025-02-21 21:46:06 +11:00
Quentin Pradet
d8284fba1a
Fix cat APIs query parameters (#123020) 2025-02-21 14:46:05 +04:00
elasticsearchmachine
4d4276eacb Mute org.elasticsearch.xpack.esql.qa.mixed.EsqlClientYamlIT test {p0=esql/40_tsdb/render aggregate_metric_double when missing min and max} #123124 2025-02-21 21:14:19 +11:00
elasticsearchmachine
bc1b3ae529 Mute org.elasticsearch.xpack.esql.qa.mixed.EsqlClientYamlIT test {p0=esql/40_unsupported_types/unsupported} #123123 2025-02-21 21:14:11 +11:00
elasticsearchmachine
bfe960cff6 Mute org.elasticsearch.xpack.esql.qa.mixed.EsqlClientYamlIT test {p0=esql/46_downsample/Render stats from downsampled index} #123122 2025-02-21 21:14:03 +11:00
elasticsearchmachine
fcdf9eb060 Mute org.elasticsearch.xpack.esql.ccq.MultiClusterSpecIT test {fork.ForkWithWhereSortDescAndLimit} #123120 2025-02-21 20:56:46 +11:00
elasticsearchmachine
0c5941d9b9 Mute org.elasticsearch.xpack.esql.ccq.MultiClusterSpecIT test {fork.FiveFork} #123119 2025-02-21 20:56:38 +11:00
elasticsearchmachine
0b7b0702f4 Mute org.elasticsearch.xpack.esql.ccq.MultiClusterSpecIT test {fork.SimpleFork} #123118 2025-02-21 20:56:31 +11:00
elasticsearchmachine
fc9c791db0 Mute org.elasticsearch.xpack.esql.ccq.MultiClusterSpecIT test {fork.ForkWithCommonPrefilter} #123117 2025-02-21 20:56:22 +11:00
elasticsearchmachine
c182fd3a5e Mute org.elasticsearch.xpack.esql.qa.mixed.EsqlClientYamlIT test {p0=esql/40_tsdb/to_string aggregate_metric_double} #123116 2025-02-21 20:48:46 +11:00
Kostas Krikellas
a79b15d414
[TEST] Cover basic license in logsdb rolling upgrade tests (#123095)
* Use min node version to guard injecting settings in logs provider

* Update docs/changelog/123005.yaml

* no random in cluster init

* Cover basic license in logsdb rolling upgrade tests
2025-02-21 11:17:06 +02:00
elasticsearchmachine
45836c8db4 Mute org.elasticsearch.xpack.esql.qa.mixed.MixedClusterEsqlSpecIT test {fork.ForkWithCommonPrefilter SYNC} #123109 2025-02-21 19:46:06 +11:00
elasticsearchmachine
2a0f36b0c6 Mute org.elasticsearch.xpack.esql.qa.mixed.MixedClusterEsqlSpecIT test {fork.ForkWithWhereSortDescAndLimit ASYNC} #123108 2025-02-21 19:42:38 +11:00
elasticsearchmachine
cf80db122c Mute org.elasticsearch.xpack.esql.qa.mixed.MixedClusterEsqlSpecIT test {fork.ForkWithWhereSortDescAndLimit SYNC} #123107 2025-02-21 19:42:27 +11:00
elasticsearchmachine
c5ca08f7a0 Mute org.elasticsearch.xpack.esql.qa.mixed.MixedClusterEsqlSpecIT test {fork.SimpleFork SYNC} #123104 2025-02-21 19:39:34 +11:00
elasticsearchmachine
9a5e368dbb Mute org.elasticsearch.xpack.esql.qa.mixed.MixedClusterEsqlSpecIT test {fork.ForkWithWhereSortAndLimit SYNC} #123103 2025-02-21 19:39:26 +11:00
Tim Vernum
5017b6d5d4 Merge main into multi-project 2025-02-21 19:28:07 +11:00
Tim Vernum
b29682c931 Merge revision b3959b6642 into multi-project 2025-02-21 19:28:00 +11:00
elasticsearchmachine
1b0b8acf96 Mute org.elasticsearch.xpack.esql.action.CrossClusterQueryWithPartialResultsIT testPartialResults #123101 2025-02-21 19:23:54 +11:00
elasticsearchmachine
18d20c305d Mute org.elasticsearch.xpack.esql.qa.mixed.MixedClusterEsqlSpecIT test {fork.SimpleFork ASYNC} #123100 2025-02-21 18:43:23 +11:00
elasticsearchmachine
681a55303b Mute org.elasticsearch.xpack.esql.qa.mixed.MixedClusterEsqlSpecIT test {fork.FiveFork ASYNC} #123099 2025-02-21 18:43:15 +11:00
elasticsearchmachine
ae34ef5467 Mute org.elasticsearch.xpack.esql.qa.mixed.MixedClusterEsqlSpecIT test {fork.FiveFork SYNC} #123098 2025-02-21 18:37:03 +11:00
elasticsearchmachine
a9872fb80c Mute org.elasticsearch.xpack.esql.qa.mixed.MixedClusterEsqlSpecIT test {fork.ForkWithCommonPrefilter ASYNC} #123097 2025-02-21 18:36:55 +11:00
elasticsearchmachine
6501d673be Mute org.elasticsearch.xpack.esql.qa.mixed.MixedClusterEsqlSpecIT test {fork.ForkWithWhereSortAndLimit ASYNC} #123096 2025-02-21 18:36:48 +11:00
elasticsearchmachine
b3f9f225b5 Mute org.elasticsearch.smoketest.DocsClientYamlTestSuiteIT test {yaml=reference/troubleshooting/common-issues/disk-usage-exceeded/line_65} #123094 2025-02-21 18:13:32 +11:00
elasticsearchmachine
e2b8e0af33 Mute org.elasticsearch.xpack.esql.action.EnrichIT testAvgDurationByArtist #123093 2025-02-21 17:38:02 +11:00
Nick Tindall
d48cf3f2f0
Fix GoogleCloudStorageServiceTests (#123092) 2025-02-20 21:26:23 -08:00
elasticsearchmachine
29eb923e0d Mute org.elasticsearch.repositories.gcs.GoogleCloudStorageServiceTests testClientsAreNotSharedAcrossRepositories #123090 2025-02-21 14:51:29 +11:00
Fang Xing
412e6c2b39
[ES|QL] Implicit numeric casting for CASE/GREATEST/LEAST (#122601)
* implicit numeric casting for conditional functions
2025-02-20 22:20:49 -05:00
Nick Tindall
74f2113122
Propagate OperationPurpose in GCS blob store (#123083) 2025-02-21 11:35:58 +11:00
Nick Tindall
b3959b6642
Implement test for GCS metrics (#122909) 2025-02-21 09:06:28 +11:00
kanoshiou
de41d5704b
ESQL: Fix precision of scaled_float field values retrieved from stored source (#122586) 2025-02-20 14:01:34 -08:00
fzowl
521f8554c3
feat: VoyageAI integration (#122134)
* VoyageAI embeddings and rerank:
 - embeddings works, tested
 - initial rerank code

What's missing:
 - unit and integration tests
 - rerank request/response mapping and verification

* VoyageAI embeddings and rerank:
 - embeddings works, tested
 - rerank works, tested (https://www.elastic.co/search-labs/blog/elasticsearch-cohere-rerank)

What's missing:
 - unit and integration tests

* VoyageAI embeddings and rerank:
 - embeddings works, tested
 - rerank works, tested (https://www.elastic.co/search-labs/blog/elasticsearch-cohere-rerank)

What's missing:
 - unit and integration tests

* VoyageAI embeddings and rerank:
 - embeddings works, tested
 - rerank works, tested (https://www.elastic.co/search-labs/blog/elasticsearch-cohere-rerank)

What's missing:
 - unit and integration tests

* Adding initial tests
Moving dimensions to ServiceSettings

* Correcting the TransportVersions.java

* Correcting due to comments

* Adding BIT support

* Initial tests

* More tests

* More tests/corrections

* Removing warnings

* Further tests

* Transport version correction

* Adding changelog and correcting TransportVersions

* Spotless tests

* Changes due to the comments

* Changes due to the comments

* Correcting QA tests

* Correcting QA tests

---------

Co-authored-by: Jonathan Buttner <jonathan.buttner@elastic.co>
Co-authored-by: Jonathan Buttner <56361221+jonathan-buttner@users.noreply.github.com>
2025-02-20 16:11:58 -05:00
Ruben van Staden
171a3b93f9
apm-data: use representative count as event.success_count if available (#119995) 2025-02-20 14:45:06 -05:00
Stanislav Malyshev
15474a2c8d
Remove testCloseSkipUnavailable (#123054)
* Remove testCloseSkipUnavailable

It duplicates CrossClusterQueryWithPartialResultsIT so there's no more need of it.
2025-02-20 20:37:06 +01:00
Dan Rubinstein
99897b1b39
Add enterprise license check to inference action for semantic text fields (#122293)
* Add enterprise license check to inference action for semantic text fields

* Update docs/changelog/122293.yaml

* Set license to trial in ShardBulkInferenceActionFilterIT

* Move license check to only block semantic_text fields that require inference call

* Cleaning up tests

* Add parameterization on useLegacyFormat back in ShardBulkInferenceActionFilterBasicLicenseIT

---------

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2025-02-20 14:06:40 -05:00
Stanislav Malyshev
0852cc0ebc
Fix CrossClusterAsyncQueryStopIT testStopQueryLocal test (#123050) 2025-02-20 19:45:49 +01:00
Lorenzo Dematté
6d042511a1
Create test entitlement libs dir and jar to pass validation (#123013) 2025-02-20 13:34:19 -05:00
Rene Groeschke
4ab11a5950
[GRADLE] Fix idea setup after removing :plugins:repository-hdfs:hadoop-client-api (#123056) 2025-02-20 19:20:10 +01:00
Tim Grein
a3313a3c5a
[Inference API] Record re-routing attributes as part of inference request metrics (#122350)
Record inference API re-routing attributes as part of request metrics.
2025-02-20 18:03:53 +01:00
Kostas Krikellas
5c129786f1
Use min node version to guard injecting settings in logs provider (#123005)
* Use min node version to guard injecting settings in logs provider

* Update docs/changelog/123005.yaml

* no random in cluster init
2025-02-20 18:31:16 +02:00
Patrick Doyle
3da1bb808f
Reduce warnings in entitlement REST tests (#123028) 2025-02-20 17:23:17 +01:00
Keith Massey
41dae025e7
Updating TransportRolloverAction.checkBlock so that non-write-index blocks do not prevent data stream rollover (#122905) 2025-02-20 17:20:44 +01:00
Armin Braun
a8c9d2fc80
Stop retaining transport messages after serialization (#122981)
We should not retain messages after serialization. We currently, have no
0-copy logic in place outside of some special cases that are handled
separately. As a result of not doing zero-copy logic, there is no need
to retain messages until they have been flushed to the wire in full.
This change reduces the lifetime of things like `SearchHit`
significantly, reducing the data-node side impact of fetching large
documents/large aggregations/top-hits to name a few.
The fact that this change technically passes released request + response
instances to the `messageListener` seems irrelevant since the listeners
are only used in tests anyway. If anything, we should look to refactor
this logic to avoid holding on to the request/response objects
needlessly.
2025-02-20 17:04:05 +01:00
Nhat Nguyen
091ea9aa1d
Support partial results in CCS in ES|QL (#122708)
A follow-up to #121942 that adds support for partial results in CCS in ES|QL.

Relates #121942
2025-02-20 07:27:32 -08:00
Pat Whelan
e74ef2d325
[ML] Make Streaming Results Writeable (#122527)
Make streaming elements extend Writeable and create StreamInput
constructors so we can publish elements across nodes using the transport
layer.

Additional notes:
- Moved optional methods into the InferenceServiceResults interface and
  default them
- StreamingUnifiedChatCompletionResults elements are now all records
2025-02-20 16:06:05 +01:00
Luke Whiting
e3792d19b5
Allow data stream reindex tasks to be re-run after completion (#122510)
* Allow data stream reindex tasks to be re-run after completion

* Docs update

* Update docs/reference/migration/apis/data-stream-reindex.asciidoc

Co-authored-by: Keith Massey <keith.massey@elastic.co>

---------

Co-authored-by: Keith Massey <keith.massey@elastic.co>
2025-02-20 15:03:51 +00:00
Moritz Mack
d1b7639784
Add missing entitlements discovered in IT tests (#123015) 2025-02-20 15:05:42 +01:00
Mary Gouseti
13ff755984
Failure store - add backport version for 8.18 patch (#123014) 2025-02-20 16:01:40 +02:00
Lorenzo Dematté
4c6fd56864
Skip tests that require old security manager policy parsing/validation when running on Java 24 (#123009) 2025-02-20 14:54:28 +01:00
elasticsearchmachine
268413b577 Mute org.elasticsearch.test.apmintegration.MetricsApmIT testApmIntegration #123022 2025-02-21 00:43:45 +11:00
Martijn van Groningen
de59bd7036
Fix KeywordSyntheticSourceNativeArrayIntegrationTests for release builds (#123008) 2025-02-20 14:43:27 +01:00
Jonathan Buttner
4de82448c8
[ML] Support delaying EIS authorization revocation until after the node has finished booting (#122644)
* Refactoring authorization to happen after the node starts

* Adding delay for model registry call

* Fixing test
2025-02-20 08:39:45 -05:00
Ioana Tagirta
a26b596cbd
ES|QL: Initial grammar and changes for FORK (snapshot) (#121948)
* Grammar changes

* Generate grammar changes

* Fork planning

* Fix field resolution

* Cleanup

* Add CSV tests

* Update docs/changelog/121948.yaml

* [CI] Auto commit changes from spotless

* fix forbidden apis

* javadoc

* remove serialization of fork and Merge

* fix equality

* fix EsqlNodeSubclassTests

* add statement parser tests

* remove unnecessary serialization

* automatic fork branch ids start at 1

* add analyzer test

* more tests

* more tests

* minor itr

* replace [] with ()

* move fork eval to initial logical plan

* simplify MergeOperator finished state

* enable CVS tests

* rework Fork to use StubRelation and Merge to be Nary

* reverts

* fail hard if not LocalSourceExec

* spotless

* no fork in fork yet

* itr

* itr

* itr

* fix EsqlNodeSubclassTests

* more tests and restrict NESTED_XX to snapshot

* fix method name

* check for fork cap before testing ForkIT

* Move fork id alias logic to parser

---------

Co-authored-by: elasticsearchmachine <infra-root+elasticsearchmachine@elastic.co>
Co-authored-by: ChrisHegarty <chegar999@gmail.com>
Co-authored-by: Chris Hegarty <62058229+ChrisHegarty@users.noreply.github.com>
2025-02-20 13:25:08 +01:00
David Turner
cdaa5dd7ad
Clarify breaking change note for #112903 (#122998)
Closes #122994
2025-02-20 12:11:56 +00:00
Martijn van Groningen
e09fab4acd
[Followup] Store arrays offsets for keyword fields natively with synthetic source (#123006)
Update index version check after #122997 backport was merged.
2025-02-20 22:43:18 +11:00
Lorenzo Dematté
2d56eb3f28
Have ASM recompute frames on patched classes (#123004) 2025-02-20 12:27:06 +01:00
Tim Vernum
7e890acabb Export reservedstate.service to serverless (MP-1956) 2025-02-20 10:46:23 +01:00
Tim Rühsen
5de46d1557
Use LogsDB for profiling events to reduce storage footprint (#122034)
* Use LogsDB for profiling events to reduce storage footprint (~30% for events only)

* Amend number for storage footprint
2025-02-20 10:29:06 +01:00
Lorenzo Dematté
f142e485c4
Unmute HdfsSearchableSnapshotsIT (#122992)
https://github.com/elastic/elasticsearch/pull/122044 solved
(temporarily) the issue with HDFS libraries not being compatible with
JDK 24. This PR unmutes a test with the same issues

Solves https://github.com/elastic/elasticsearch/issues/122024
2025-02-20 20:19:37 +11:00
Larisa Motova
e4ee91a08a
[ES|QL] Render aggregate_metric_double (#122660)
This commit allows users to read aggregate_metric_double fields from
indices in ES|QL, with any subset of metrics.
2025-02-19 22:38:49 -10:00
Martijn van Groningen
43665f0a35
Store arrays offsets for keyword fields natively with synthetic source (#113757)
The keyword doc values field gets an extra sorted doc values field, that encodes the order of how array values were specified at index time. This also captures duplicate values. This is stored in an offset to ordinal array that gets zigzag vint encoded into a sorted doc values field.

For example, in case of the following string array for a keyword field: ["c", "b", "a", "c"].
Sorted set doc values: ["a", "b", "c"] with ordinals: 0, 1 and 2. The offset array will be: [2, 1, 0, 2]

Null values are also supported. For example ["c", "b", null, "c"] results into sorted set doc values: ["b", "c"] with ordinals: 0 and 1. The offset array will be: [1, 0, -1, 1]

Empty arrays are also supported by encoding a zigzag vint array of zero elements.

Limitations:

currently only doc values based array support for keyword field mapper.
multi level leaf arrays are flattened. For example: [[b], [c]] -> [b, c]
arrays are always synthesized as one type. In case of keyword field, [1, 2] gets synthesized as ["1", "2"].
These limitations can be addressed, but some require more complexity and or additional storage.

With this PR, keyword field array will no longer be stored in ignored source, but array offsets are kept track of in an adjacent sorted doc value field. This only applies if index.mapping.synthetic_source_keep is set to arrays (default for logsdb).
2025-02-20 09:20:49 +01:00
Tim Vernum
51145f7205 Merge main into multi-project 2025-02-20 13:28:26 +11:00
Tim Vernum
4f918a81b9 Merge main into multi-project 2025-02-20 12:17:12 +11:00
Tim Vernum
00159c5030 Merge revision ad220c1abb into multi-project 2025-02-20 11:37:54 +11:00
Keith Massey
18df4d0c89
Fixing the document count in reindex data stream status in-progress indices (#122976) 2025-02-20 00:53:50 +01:00
Lorenzo Dematté
a4c7d29675
[Entitlements] Instrumentation of NIO file channels (#122816) 2025-02-19 23:18:07 +01:00
elasticsearchmachine
52b3713405 Mute org.elasticsearch.test.apmintegration.TracesApmIT testApmIntegration #122129 2025-02-20 09:04:40 +11:00
Niels Bauman
618de4855d
Remove local param from field mapping API spec (#122922)
The `local` param for the `GetFieldMapping` API was deprecated in #55014
and I think #57265 aimed to propogate that deprecation to the REST API
spec, but it changed `get_mapping.json` instead of
`get_field_mapping.json`. #55100 removed the `local` param for the
_field_ mapping API so we can safely remove the field from the spec and
remove the YAML test.
2025-02-19 22:51:11 +01:00
elasticsearchmachine
5166b81481 Mute org.elasticsearch.action.admin.indices.create.ShrinkIndexIT testShrinkIndexPrimaryTerm #122974 2025-02-20 08:50:04 +11:00
Keith Massey
463dc4a8a5
Updates the deprecation info API to not warn about system indices and data streams (#122951) 2025-02-19 15:30:17 -06:00
Lorenzo Dematté
20b829fc14
[Entitlements] Add check functions for NIO Files (#122591) 2025-02-19 21:55:06 +01:00
Jordan Powers
bf31ee6f18
Doc values sparse index on _tsid fields (#122699)
This patch extends the work done in #122161 and #121751 to also use the doc values sparse index for the _tsid fields in time-series mode indices.
2025-02-19 11:21:34 -08:00
Moritz Mack
2c15b68efa
[Entitlements] Log message for troubleshooting if not entitled (#122948)
Log message for troubleshooting if not entitled.
2025-02-20 06:13:54 +11:00
Patrick Doyle
877963c652
Miscellaneous java.base file entitlements (#122906)
* java.base entitlements

* SuppressForbidden, and add a missing test

* Revert logging back to commented-out printlns

* Merge FileCheckActions and rename for overloads

* Remove stray logger

* Remove more traces of logging change

* Remove more traces of logging
2025-02-19 13:17:15 -05:00
Lorenzo Dematté
340a2ceb29
Fix hdfs-related IT tests for java24 (#122044) 2025-02-19 18:27:09 +01:00
Dan Rubinstein
bea8df3c8e
Adding endpoint creation validation to ElasticInferenceService (#117642)
* Adding endpoint creation validation to ElasticInferenceService

* Fix unit tests

* Update docs/changelog/117642.yaml

---------

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2025-02-19 12:24:21 -05:00
Moritz Mack
3b1825571d
Add missing entitlements for FIPS (#122941)
Add missing entitlements for FIPS
2025-02-20 03:36:10 +11:00
Dianna Hohensee
2bfc700683
DesiredBalanceReconciler always returns AllocationStats (#122458)
Ensures that the DesiredBalanceReconciler always returns a non-empty
AllocationStats object, eliminating edge cases where the stats
available to DesiredBalanceMetrics may not be updated due to some
kind of throttling or the balancer being disabled via cluster
settings.

Adds documentation around
AllocationDecider#canRebalance(RoutingAllocation)

Closes ES-10581
2025-02-19 10:34:24 -05:00
Tim Grein
388c4a1df2
[Inference API] Remove addressed TODO #122923 2025-02-19 16:15:10 +01:00
Patrick Doyle
17278183ea
Change printlns to log statements (#122935) 2025-02-19 15:57:43 +01:00
Iraklis Psaroudakis
ad220c1abb
Pass checkpoint to commit extra user data function (#122930)
Relates ES-10852
2025-02-19 16:12:50 +02:00
elasticsearchmachine
04422cdc7f Mute org.elasticsearch.xpack.search.AsyncSearchSecurityIT org.elasticsearch.xpack.search.AsyncSearchSecurityIT #122940 2025-02-20 00:37:05 +11:00
Artem Prigoda
8e34393227
Fail primary term and generation listeners on a closed shard (#122713)
If a shard has been closed, we should quickly bail out and fail
all waiting primary term and generation listeners. Otherwise,
the engine implementation may try to successfully to complete the
provided listeners and perform operations on an already closed
shard and cause some unexpected errors.
2025-02-19 13:46:25 +01:00
Dimitris Rempapis
f220abaf08
StressSearchServiceReaperIT_unmute_test (#122793)
unmute test
2025-02-19 13:55:30 +02:00
Tim Vernum
cc338a1a1d Merge main into multi-project 2025-02-19 22:50:02 +11:00
Armin Braun
cc29af3b14
Speedup a few more aggregations using Kahan summation (#122920)
Follow-up to #120241 and linked issues, using the logic that doesn't
require any mutable object indirection led to significant speedups
for sum+avg and should be of similar if not more help in these as well.
2025-02-19 11:50:09 +01:00
Tim Vernum
de93304b95 Merge main into multi-project 2025-02-19 21:37:13 +11:00
Tim Vernum
5b2f1cbdaa Merge revision 1c368c7d42 into multi-project 2025-02-19 21:37:04 +11:00
David Turner
997233fd4e
Remove unused @UpdateForV9 owners (#122748)
Several teams have completed all outstanding `@UpdateForV9` tasks, so
this commit removes the corresponding `Owner` symbols.
2025-02-19 21:06:13 +11:00
David Turner
cd15d09adf
Fork post-snapshot-delete cleanup off master thread (#122731)
We shouldn't run the post-snapshot-delete cleanup work on the master
thread, since it can be quite expensive and need not block subsequent
cluster state updates. This commit forks it onto a `SNAPSHOT` thread.
2025-02-19 21:02:27 +11:00
Johannes Fredén
37da2da9ff Add secrets file handling to MultiProjectFileSettingsService (MP-1948)
This PR replaces
https://github.com/elastic/elasticsearch-internal/pull/1934 and extracts
some features from
https://github.com/elastic/elasticsearch-serverless/pull/3422.

Instead of allowing for projects to be created without a secrets file,
this PR forces projects to also have a secrets file before being
created.

- This PR doesn't actually handle the secrets data (defines a handler
for reserved project state), that will be implemented in a separate PR.
- The multi-project file handling should move to the
`elasticsearch-serverless` repo before being merged to main (separate
PR).
- This PR contains a bug fix for `ProjectMetadata` where the project
reserved state wasn't always applied to project metadata.
- Since the secrets file name can clash with a project file if named
`project-<project_id>-secrets.json` (project id could be `-secrets`) the
naming of the file has been updated to
`project-<project_id>.secrets.json` (`.` is not allowed in project id)
- This PR adds a separate namespace for secrets, since sharing the
`file_settings` namespace with the `project-<project_id>.json` makes
assumptions on the order of the increasing version number. If they share
namespace, the order would have to be first increased in the project
config and then in the secrets config for them to be processed (since
they're separate state chunks), which is a strange assumption. One of
them also wouldn't be processed if they were on the same version.
2025-02-19 09:50:05 +01:00
Niels Bauman
1c368c7d42
Remove trappy timeouts from GetSettingsRequest (#122855)
Relates #107984
2025-02-19 09:03:52 +01:00
Niels Bauman
c65596b62e
Run TransportGetWatcherSettingsAction on local node (#122857)
This action solely needs the cluster state, it can run on any node.
Additionally, it needs to be cancellable to avoid doing unnecessary work
after a client failure or timeout.

Relates #101805
2025-02-19 08:15:00 +01:00
Tim Vernum
15751a8b2f Merge main into multi-project
Merge main into multi-project
2025-02-19 17:58:18 +11:00
elasticsearchmachine
449cc295a7 Mute org.elasticsearch.xpack.esql.heap_attack.HeapAttackIT testEnrichExplosionManyMatches #122913 2025-02-19 17:34:41 +11:00
Tim Vernum
838d8389de Merge main into multi-project 2025-02-19 16:40:34 +11:00
Tim Vernum
81043b5ce0 Merge revision 2eb0d00b8f into multi-project 2025-02-19 16:00:15 +11:00
elasticsearchmachine
5160113880 Mute org.elasticsearch.smoketest.DocsClientYamlTestSuiteIT test {yaml=reference/cat/allocation/cat-allocation-example} #121976 2025-02-19 10:08:38 +11:00
Ryan Ernst
cffbccbb49
Add support for setting based file entitlements (#122656)
With Security Manager we have SecuredConfigFileSettingAccessPermission.
This commit adds an entitlement equivalent. With each entry in files
entitlement, a `path_setting` can now be used. The value may be an
explicit setting, or a setting glob with a single `*`.

relates ES-10844
2025-02-18 23:13:55 +01:00
Nhat Nguyen
9dedcf7ebc
Re-enable shard rebalance in ES|QL rest tests (#122889)
Today, we disable shard rebalancing in ES|QL REST tests to avoid 
failures when shards are rebalanced while the query is being executed.
This is no longer necessary if the clusters are on version 8.19 or 9.1.
2025-02-18 13:41:45 -08:00
Mark Vieira
d30b3ca3f4
Prepare for 9.0.0-rc1 2025-02-18 12:31:29 -08:00
Lee Hinman
2ae80c799d
Allow setting the type in the reroute processor (#122409)
* Allow setting the `type` in the reroute processor

This allows configuring the `type` from within the ingest `reroute` processor. Similar to `dataset`
and `namespace`, the type defaults to the value extracted from the index name. This means that
documents sent to `logs-mysql.access.default` will have a default value of `logs` for the type.

Resolves #121553

* Update docs/changelog/122409.yaml
2025-02-18 12:38:00 -07:00
Luca Cavanna
80b7879eda
Simplify logic around missing shards check in search phases (#122817)
This removes a couple of indirections: the error message for missing shards is always the
same no matter the search phase. This was required to provide a slightly different error
message for open PIT. The previous error was misleading when open PIT did not support
setting allow_partial_search_results, but now that it does, it looks like we can unify
the error message and simplify the code around it.
2025-02-18 20:24:29 +01:00
Artem Prigoda
29cbbd99dd
Add more logging for IndexRecoveryIT#testSourceThrottling (#122830)
I couldn't reproduce the failure of the throttling time being zero on
the recovery target node. Added more logging for the stats in case of
failure.

Resolve #122712
2025-02-19 06:05:22 +11:00
Dianna Hohensee
befc6a03e3
Start the allocation architecture guide section (#121940)
This is a high-level overview of the main rebalancing components and
how they interact to move shards around the cluster, and decide where
shards should go.

Relates ES-10423
2025-02-18 13:33:39 -05:00
Armin Braun
b4f84f6f04
Improve Iterators.single (#122875)
Using an anonymous class here doesn't compile as expected.
The resulting class comes out as:

```
class Iterators$1 implements java.util.Iterator<T> {
  private T value;

  final java.lang.Object val$element;

  Iterators$1(java.lang.Object);
```

which seemingly also does not get fixed by the JIT compiler, judging by
heap dumps. Lets just use a named class to clean this up and make things
a bit more compact and save some heap as well here and there potentially.
2025-02-18 19:20:10 +01:00
Artem Prigoda
b4e95dc40a
Unmute FrozenSearchableSnapshotsIntegTests#testCreateAndRestorePartialSearchableSnapshot (#122831)
* Unmute `FrozenSearchableSnapshotsIntegTests#testCreateAndRestorePartialSearchableSnapshot`

The underlying failure `java.lang.AssertionError: Searchable snapshot directory does not support the operation [createOutput`
was fixed in https://github.com/elastic/elasticsearch/pull/122006.

The automation bot was too aggressive in re-opening this issue.

Resolve #122693

* Add a check for the CLOSED state along with STOPPED

* Update x-pack/plugin/searchable-snapshots/src/main/java/org/elasticsearch/xpack/searchablesnapshots/cache/full/CacheService.java

Co-authored-by: Tanguy Leroux <tlrx.dev@gmail.com>

---------

Co-authored-by: Tanguy Leroux <tlrx.dev@gmail.com>
2025-02-18 18:40:33 +01:00
David Turner
45f0471924
Bump post-recovery merge minimum version (#121997)
In #113462 we introduced a version bound on post-recovery merges to
avoid a spike of merge activity after an upgrade. At the time there was
no `IndexVersion` unique to the 9.x series, but we have such a version
now, so this commit properly restricts post-recovery merges to only
apply to indices created by versions that support them.

Relates ES-9620
2025-02-19 04:36:25 +11:00
Felix Barnsteiner
5e8865deac
Add _metric_names_hash field to OTel metric mappings (#120952)
If metrics that have the same timestamp and dimensions aren't grouped into the same document, ES will consider them to be a duplicate.
The _metric_names_hash field will be set by the OTel ES exporter.
As it's mapped as a time_series_dimensions, it creates a different _tsid for documents with different sets of metrics.
The tradeoff is that if the composition of the metrics grouping changes over time, a different _tsid will be created.
That has an impact on the rate aggregation for counters.
2025-02-18 18:30:37 +01:00
Oleksandr Kolomiiets
ba8c5764f8
Use FallbackSyntheticSourceBlockLoader for unsigned_long and scaled_float fields (#122637) 2025-02-18 09:28:26 -08:00
Benjamin Trent
894db68357
Potentially addressing bbq bwc failures and added logging (#122553)
I have ran this many times locally, and it never failed. Maybe there is
something "magical" in CI. 

Added some additional info in the assertion logging.
2025-02-19 03:46:04 +11:00
Slobodan Adamović
ae7d1967cb
[Test] Fix IndexAliasesTests#testRemoveIndex (#122864)
Exclude `.security*` aliases when calling Get Aliases API with the admin
superuser.

Resolves https://github.com/elastic/elasticsearch/issues/122221
2025-02-19 03:06:27 +11:00
Ryan Ernst
f5927055fe
Use ES build instead of xpack inside xpack info action (#122859)
Xpack used to be a plugin to Elasticsearch, and existed in a separate
repository. So it had a separate build hash and date, which is exposed
through the xpack info API. Since xpack is no longer a plugin, and part
of the Elasticsearch repository, having a separate build info is no
longer necessary. This commit keeps the xpack info content intact, but
switches the implemntation to look at the Elasticsearch build details,
and removes the xpack build info class.
2025-02-18 16:41:10 +01:00
Tanguy Leroux
60176b804c
[CI] Unmute RollingUpgrade*IndexCompatibilityTestCase (#122856)
All those issues have been opened by test automation,
before some missing transport versions was fixed
(see #122580).

Closes #122688
Closes #122689
Closes #122690
Closes #122691
Closes #122694
Closes #122695
Closes #122696
Closes #122697
Closes #122698
Closes #122700
Closes #122701
Closes #122702
Closes #122703
Closes #122704
Closes #122705
2025-02-18 16:16:29 +01:00
elastic-renovate-prod[bot]
9145ab73cf
Update docker.elastic.co/wolfi/chainguard-base:latest Docker digest to d74b1fd (#122839)
This PR contains the following updates:

| Package | Update | Change | |---|---|---| |
docker.elastic.co/wolfi/chainguard-base | digest | `ecd940b` ->
`d74b1fd` |

---

### Configuration

📅 **Schedule**: Branch creation - "after 1pm on tuesday" (UTC),
Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once
you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Renovate
Bot](https://redirect.github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzOS4xMDcuMCIsInVwZGF0ZWRJblZlciI6IjM5LjEwNy4wIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyI6RGVsaXZlcnkvUGFja2FnaW5nIiwiPm5vbi1pc3N1ZSIsIlRlYW06RGVsaXZlcnkiLCJhdXRvLW1lcmdlLXdpdGhvdXQtYXBwcm92YWwiXX0=-->
2025-02-19 01:28:38 +11:00
elasticsearchmachine
17147a2978 Mute org.elasticsearch.snapshots.DedicatedClusterSnapshotRestoreIT testRestoreShrinkIndex #121717 2025-02-19 01:21:01 +11:00
Mike Pellegrini
229d392e63
Fix ArrayIndexOutOfBoundsException in ShardBulkInferenceActionFilter (#122538) 2025-02-18 08:26:35 -05:00
Moritz Mack
8eb89cf7c1
Add entitlement checks for java.io stream classes (#122406) 2025-02-18 14:12:01 +01:00
Moritz Mack
d78bfe8f6e
Skip SM policy tests for JDK 24 when Security Manager is not available anymore (#122828) 2025-02-18 14:09:59 +01:00
Johannes Fredén
e16664573e
Bump json-smart and oauth2-oidc-sdk (#122737)
* Bump json-smart and oauth2-oidc-sdk

---------

Co-authored-by: elasticsearchmachine <infra-root+elasticsearchmachine@elastic.co>
2025-02-18 13:55:17 +01:00
Moritz Mack
87c58ff93f
[Entitlements] Add missing entitlements for trust store (#122797)
Add missing entitlements for trust store if running in fips mode.

Fixes #122546, fixes #122569, fixes #122568, fixes #122680, fixes
#122566
2025-02-18 23:32:05 +11:00
Salvatore Campagna
7f7967bcfa
Remove TransportDownsampleIndexerAction (#122756) 2025-02-18 12:32:20 +01:00
Salvatore Campagna
cb62b442a1
Remove shard changes and add retention lease REST APIs (#122754) 2025-02-18 12:31:32 +01:00
Iván Cea Fontenla
a1b16d9076
ESQL: Add ser/deser to functions tests (#122498)
# Why and what?
First part of https://github.com/elastic/elasticsearch/issues/122588

Some functions don't serialize their Source. This sometimes makes them emit wrong warnings, with -1:-1 line and without the correct source text.

This PR pretends to integrate ser/deserialization before executing some (randomly chosen) functions, as well as using a non-empty Source to build them.

_Note:_ It's different from the SerializationTests: Here we check that, whether serialized or not, the functionality is identical
2025-02-18 11:47:18 +01:00
Yang Wang
850249b897
Handle status code 200 for s3 CMU response (#122815)
When a CopmleteMultipartUpload request fails after the initial 200
response, the status code of the failure response use to be not set and
hence got translated to status code 0. With #116212, we handle this case
accordingly. Since AWS SDK 1.12.691, the status code is now set to 200
instead of 0. This PR changes our error handling code accordingly.

Relates: #122431 Relates: #116212 Resolves: #122799

Relevant AWS SDK change
430899c217/aws-java-sdk-s3/src/main/java/com/amazonaws/services/s3/AmazonS3Client.java (L3696-L3709)
2025-02-18 20:11:36 +11:00
elasticsearchmachine
19fe0a480c Mute org.elasticsearch.xpack.esql.action.EsqlActionBreakerIT org.elasticsearch.xpack.esql.action.EsqlActionBreakerIT #122810 2025-02-18 16:40:52 +11:00
Tim Vernum
87575fa1e1 Refactor multi-project module to prepare for split (MP-1950)
This refactors the "multi-project" module by:

1. Moving some useful code from the module into server
2. Renaming some classes to "TestOnlyMultiProject..."

For (1)
- create a new `AbstractProjectResolver` in server that contains logic
for resolving a project from the thread context.
- create a `MultiProjectFeature` to contain the MP `NodeFeature`

For (2)
- Rename the plugin etc to `TestOnlyMultiProjectPlugin` to reflect that
it is only used for testing.
- We do not touch the file based settings code since this will move to
serverless production.

This is a pure refactor - as of this commit, the
`TestOnlyMultiProjectPlugin` is still used in serverless, the changes
allow us to move to having a separate `ServerlessMultiProjectPlugin`
2025-02-18 04:09:16 +01:00
Yang Wang
2eb0d00b8f
[Test] Separate testAcceptsMismatchedServerlessBuildHash (#122570)
This PR moves
TransportServiceHandshakeTests.testAcceptsMismatchedServerlessBuildHash
to its own test job to ensure the expected system property is always set
correctly.

Resolves: #122565
2025-02-18 10:15:08 +11:00
Slobodan Adamović
2f4abbf870
[Test] Fix QueryableReservedRolesIT testQueryDeleteOrUpdateReservedRoles (#122803)
Adds missing `assertBusy` in `testQueryDeleteOrUpdateReservedRoles`. 
We wait for security migration to finish before test execution, but this is not 
enough to guarantee that built-in roles are synchronized into the `.security` 
index. In many cases, the roles have already been synchronized before the 
query gets executed, but in rare cases the cluster is a bit slower and the 
assertion fails because the built-in roles have not been indexed yet.

Resolves https://github.com/elastic/elasticsearch/issues/120401
2025-02-17 22:12:21 +01:00
Lorenzo Dematté
cf64bd31f6
Fix policy manager/parser absolute path checks (#122736) 2025-02-17 20:26:30 +01:00
Rene Groeschke
4908c92940
Fix lucene compatibility tests (#122780)
- Fix lucene compatibility tests
- failing due to buildscan setup
- Update reference to luceneBwcTest commit
2025-02-17 19:12:30 +01:00
elasticsearchmachine
7199fa2b9d Mute org.elasticsearch.repositories.blobstore.testkit.analyze.S3RepositoryAnalysisRestIT testRepositoryAnalysis #122799 2025-02-18 04:57:22 +11:00
Artem Prigoda
e702edcbab
Remove @UpdateForV9 annotation from ReindexRequest#failOnSizeSpecified (#122729)
The size parameter hasn't been accepted since 8.0, end users should use max_docs and if the user specify it, we can defer to the standard error message produced by the parser.
2025-02-17 18:45:28 +01:00
Moritz Mack
67dc1995df
Support file entitlements relative to the user's home directory (#122724) 2025-02-17 17:56:02 +01:00
Pooya Salehi
a3fca9fa69 Merge pull request MP-1947 from elastic/ps250207-projectScopedTasksSystemIndex
Considering the `.tasks` system index is already project-specific, it seems that we only need to add project-awareness to task management calls that rely on ongoing tasks in the task manager. Among the three operations, i.e., get task, cancel task and list tasks, only get task is public in Serverless. The other two are internal.

I've only touched the get task API, and I've done a very small change to check if the request's project and the task header match. For the other two API methods, I've left them as they are. Which means they see all of the tasks in the cluster. Considering they're internal, I'd assume that's fair. We could make them project-aware in the sense that they would operate only on the tasks that belong to the current project (when the header is set). I think that takes away the possibility of using them at a cluster-level, if a project header will always be present, and not sure if as an internal action we have a use case for it currently. If a "project-view" of the cluster tasks is desirable for listing/cancelling, it might be more suitable to support it via adding a "project" [query parameter](https://www.elastic.co/guide/en/elasticsearch/reference/current/tasks.html#tasks-api-query-params), e.g., as is available for nodes.

Relates ES-10167
2025-02-17 17:37:54 +01:00
Alex Kattathra Johnson
5462601fd6
Upgrade AWS SDK to v1.12.746 (#122431) 2025-02-18 02:44:38 +11:00
Ryan Ernst
bf1cbb0e47
Instrument methods on File that require read permissions (#122544)
This commit adds instrumentation for File methods that require read permissions.

see #122109 for the write side
2025-02-17 16:27:42 +01:00
Johannes Fredén
1f4f5ddca9
Improve jwt logging on failed auth (#122247)
Update docs/changelog/122247.yaml
2025-02-17 16:11:22 +01:00
Pooya Salehi
390d34f98b Merge branch 'multi-project' into ps250207-projectScopedTasksSystemIndex 2025-02-17 15:43:50 +01:00
Tim Vernum
fc01170bbb Merge main into multi-project 2025-02-18 01:32:40 +11:00
Ryan Ernst
c211040470
Remove FileEntitlement (#122657)
This is no longer used since FilesEntitlement was added.
2025-02-17 06:08:00 -08:00
Ryan Ernst
abfda89e19
Use records for FileData implementations (#122658)
This commit switches to using records in place of classes for FileData
impls. It moves them outside the interface so that they can be private.
This does not change the fact the interface is sealed, nor the factory
methods for creating them.
2025-02-17 06:07:33 -08:00
elasticsearchmachine
b1811647bb Mute org.elasticsearch.entitlement.qa.EntitlementsDeniedIT org.elasticsearch.entitlement.qa.EntitlementsDeniedIT #122566 2025-02-18 00:56:43 +11:00
elasticsearchmachine
f2a33b89d7 Mute org.elasticsearch.entitlement.qa.EntitlementsAllowedIT org.elasticsearch.entitlement.qa.EntitlementsAllowedIT #122680 2025-02-18 00:56:35 +11:00
elasticsearchmachine
eb538d8fd1 Mute org.elasticsearch.entitlement.qa.EntitlementsAllowedNonModularIT org.elasticsearch.entitlement.qa.EntitlementsAllowedNonModularIT #122568 2025-02-18 00:56:27 +11:00
elasticsearchmachine
8782b3928b Mute org.elasticsearch.entitlement.qa.EntitlementsDeniedNonModularIT org.elasticsearch.entitlement.qa.EntitlementsDeniedNonModularIT #122569 2025-02-18 00:56:19 +11:00
Joe Gallo
846bf75f8b
Fix redact processor arraycopy bug (#122640) 2025-02-17 08:51:02 -05:00
Simon Cooper
fc2f8fc1f6
Optionally allow text similarity reranking to fail (#121784)
Add an option to allow reranking to fail, and the docs to pass through as-is.
Exposing the error to users and adding documentation is a later piece of work.
2025-02-17 13:32:17 +00:00
Tim Vernum
927e67bc5d Merge main into multi-project 2025-02-18 00:19:44 +11:00
Moritz Mack
7fd1addccf
[Entitlements] Instrument nio path (#122507) 2025-02-17 14:01:57 +01:00
Salvatore Campagna
780cac5a6d
Enable a sparse doc values index for @timestamp in LogsDB (#122161)
This PR extends the work done in #121751 by enabling a sparse doc values index for the @timestamp field in LogsDB.

Similar to the previous PR, the setting index.mapping.use_doc_values_skipper will override the index mapping parameter when all of the following conditions are met:

* The index mode is LogsDB.
* The field name is @timestamp.
* Index sorting is configured on @timestamp (regardless of whether it is a primary sort field or not).
* Doc values are enabled.

This ensures that only one index structure is defined on the @timestamp field:
* If the conditions above are met, the inverted index is replaced with a sparse doc values index.
* This prevents both the inverted index and sparse doc values index from being enabled together, reducing unnecessary storage overhead.

This change aligns with our goal of optimizing LogsDB for storage efficiency while possibly maintaining reasonable query latency performance. It will enable us to run benchmarks and evaluate the impact of sparse indexing on the @timestamp field as well.
2025-02-17 13:31:26 +01:00
Slobodan Adamović
5c54c5f78d
Do not fetch reserved roles from native store when Get Role API is called (#121971)
The reserved roles are already returned from the `ReservedRolesStore`
in `TransportGetRolesAction`. There is no need to query and deserialize
reserved roles from the `.security` index just to be merged with "static" definitions.
2025-02-17 12:42:47 +01:00
Artem Prigoda
fb75dc4a1d
Don't serialize backwardCompatibleMessage field from RepositoryConflictException in V9 (#122730)
This field was deprecated in V8 and removed in #114726. We don't need to serialize it in V9
2025-02-17 11:56:51 +01:00
David Turner
e161ff204f
Remove discovery-ec2 QA module mention (#122025)
This module was removed in #119384 so we can drop it from the
`RestrictedBuildApiService` now.
2025-02-17 21:18:13 +11:00
Moritz Mack
cc9679162f
[Entitlements] Add missing file entitlements for server (#122728)
Add missing file entitlements for server.

closes https://github.com/elastic/elasticsearch/issues/122569, closes
https://github.com/elastic/elasticsearch/issues/122568, closes
https://github.com/elastic/elasticsearch/issues/122567, closes
https://github.com/elastic/elasticsearch/issues/122566 

(Note, some failures are due to a `NoSuchAlgorithmException` when fips
is enabled. This issue is unrelated to entitlements)
2025-02-17 21:06:11 +11:00
Lorenzo Dematté
24afbe39d7
Rewire 8.19 backport constants to avoid conflicts with 8.18 backport constants (#122578) 2025-02-17 09:57:40 +01:00
Tim Vernum
8c8cde583f Debug DEVELOCITY_ACCESS_KEY 2025-02-17 18:59:21 +11:00
Lorenzo Dematté
191f801f8c
[Entitlements] Add logsDir to entitlement bootstrap parameters (#122605)
While testing https://github.com/elastic/elasticsearch/pull/122591, I
realized we need to grand read/write permission to the logs dir to
server.

This PR adds the `logsDir` to the bootstrap parameters, and uses it in
the `server` policy.
2025-02-17 18:42:08 +11:00
Mikhail Berezovskiy
8b4f159aa2
fix testReadBlobWithPrematureConnectionClose jdk24 (#122655) 2025-02-16 22:05:41 -08:00
Tim Vernum
d271a48c2a Merge main into multi-project 2025-02-17 17:05:19 +11:00
Yang Wang
8a9ae471b3
[Test] Fix assertion for number of message chunks (#122571)
Depending on the position of the split and the size of the extra chunk,
the test may send out one more chunk than the assertion expects. This PR
ensures the assertoin is more accurate to count for this scenario.

Resolves: #122349
2025-02-17 14:56:51 +11:00
elasticsearchmachine
54eab9d564 Mute org.elasticsearch.indices.recovery.IndexRecoveryIT testSourceThrottling #122712 2025-02-17 00:34:05 +11:00
Slobodan Adamović
369c641302
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
2025-02-16 10:47:55 +01:00
Albert Zaharovits
4b12ec8d8e
Invoke TestCluster#assertAfterTest before closing the cluster (#122639)
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 09:48:20 +01:00
Nhat Nguyen
42deaab38b
Adjust wire version for partial results in ES|QL (#122706)
Relates #121942
2025-02-16 17:19:41 +11:00
elasticsearchmachine
8f978db776 Mute org.elasticsearch.search.basic.SearchWithRandomDisconnectsIT testSearchWithRandomDisconnects #122707 2025-02-16 16:45:02 +11:00
elasticsearchmachine
daecc7cc4d Mute org.elasticsearch.lucene.RollingUpgradeSearchableSnapshotIndexCompatibilityIT testMountSearchableSnapshot {p0=[9.1.0, 9.1.0, 9.1.0]} #122705 2025-02-16 14:04:40 +11:00
elasticsearchmachine
1ebccd2a01 Mute org.elasticsearch.lucene.RollingUpgradeSearchableSnapshotIndexCompatibilityIT testSearchableSnapshotUpgrade {p0=[9.1.0, 9.1.0, 9.1.0]} #122704 2025-02-16 14:04:32 +11:00
elasticsearchmachine
df4b1390d5 Mute org.elasticsearch.lucene.RollingUpgradeSearchableSnapshotIndexCompatibilityIT testMountSearchableSnapshot {p0=[9.1.0, 9.1.0, 8.19.0]} #122703 2025-02-16 13:01:06 +11:00
elasticsearchmachine
8d5c3d43e4 Mute org.elasticsearch.lucene.RollingUpgradeSearchableSnapshotIndexCompatibilityIT testMountSearchableSnapshot {p0=[9.1.0, 8.19.0, 8.19.0]} #122702 2025-02-16 13:00:59 +11:00
elasticsearchmachine
7534455bbb Mute org.elasticsearch.lucene.RollingUpgradeSearchableSnapshotIndexCompatibilityIT testSearchableSnapshotUpgrade {p0=[9.1.0, 9.1.0, 8.19.0]} #122701 2025-02-16 13:00:53 +11:00
elasticsearchmachine
a3219aee84 Mute org.elasticsearch.lucene.RollingUpgradeSearchableSnapshotIndexCompatibilityIT testSearchableSnapshotUpgrade {p0=[9.1.0, 8.19.0, 8.19.0]} #122700 2025-02-16 13:00:45 +11:00
elasticsearchmachine
417451a7fa Mute org.elasticsearch.lucene.RollingUpgradeLuceneIndexCompatibilityTestCase testRestoreIndex {p0=[9.1.0, 9.1.0, 9.1.0]} #122698 2025-02-16 11:23:37 +11:00
elasticsearchmachine
e5951a5847 Mute org.elasticsearch.lucene.RollingUpgradeLuceneIndexCompatibilityTestCase testIndexUpgrade {p0=[9.1.0, 9.1.0, 9.1.0]} #122697 2025-02-16 10:37:06 +11:00
elasticsearchmachine
28b6480d49 Mute org.elasticsearch.lucene.RollingUpgradeLuceneIndexCompatibilityTestCase testIndexUpgrade {p0=[9.1.0, 9.1.0, 8.19.0]} #122696 2025-02-16 10:36:39 +11:00
elasticsearchmachine
bf734e00ae Mute org.elasticsearch.lucene.RollingUpgradeLuceneIndexCompatibilityTestCase testClosedIndexUpgrade {p0=[9.1.0, 9.1.0, 9.1.0]} #122695 2025-02-16 10:36:24 +11:00
elasticsearchmachine
cce4728adf Mute org.elasticsearch.lucene.RollingUpgradeLuceneIndexCompatibilityTestCase testClosedIndexUpgrade {p0=[9.1.0, 9.1.0, 8.19.0]} #122694 2025-02-16 10:31:38 +11:00
Nhat Nguyen
ced440af62
Adjust bwc for ES|QL retry on failures (#122685)
Relates ##120774
2025-02-15 15:25:23 -08:00
elasticsearchmachine
5b95480f2c Mute org.elasticsearch.xpack.searchablesnapshots.FrozenSearchableSnapshotsIntegTests testCreateAndRestorePartialSearchableSnapshot #122693 2025-02-16 10:06:46 +11:00
elasticsearchmachine
2d9a090b16 Mute org.elasticsearch.lucene.RollingUpgradeLuceneIndexCompatibilityTestCase testRestoreIndex {p0=[9.1.0, 8.19.0, 8.19.0]} #122691 2025-02-16 09:30:37 +11:00
elasticsearchmachine
d158e890c7 Mute org.elasticsearch.lucene.RollingUpgradeLuceneIndexCompatibilityTestCase testClosedIndexUpgrade {p0=[9.1.0, 8.19.0, 8.19.0]} #122690 2025-02-16 09:30:30 +11:00
elasticsearchmachine
e61bb6bf68 Mute org.elasticsearch.lucene.RollingUpgradeLuceneIndexCompatibilityTestCase testRestoreIndex {p0=[9.1.0, 9.1.0, 8.19.0]} #122689 2025-02-16 09:30:24 +11:00
elasticsearchmachine
ddfe27fb73 Mute org.elasticsearch.lucene.RollingUpgradeLuceneIndexCompatibilityTestCase testIndexUpgrade {p0=[9.1.0, 8.19.0, 8.19.0]} #122688 2025-02-16 09:30:17 +11:00
Luca Cavanna
85a9115539
Remove reset usages and remaining method from SearchShardIterator (#121934)
remaining is used in tests only since the recent change to counting in AbstractSearchAsyncAction.

reset was used in a couple of places where it does not seem like it's needed anymore.
2025-02-15 23:22:05 +01:00
elasticsearchmachine
a4c645b388 Mute org.elasticsearch.xpack.autoscaling.storage.ReactiveStorageIT testScaleWhileShrinking #122119 2025-02-16 08:23:42 +11:00
elasticsearchmachine
d1b2eb6ef0 Mute org.elasticsearch.smoketest.DocsClientYamlTestSuiteIT test {yaml=reference/snapshot-restore/apis/get-snapshot-api/line_408} #122681 2025-02-16 01:11:19 +11:00
elasticsearchmachine
0c16abf454 Mute org.elasticsearch.entitlement.qa.EntitlementsAllowedIT org.elasticsearch.entitlement.qa.EntitlementsAllowedIT #122680 2025-02-16 01:03:41 +11:00
Luca Cavanna
9adb91d4fe
Knn vector rescoring to sort score docs (#122653)
RescoreKnnVectorQuery rewrites to KnnScoreDocQuery, which takes a sorted array of
doc ids and corresponding array including scores fo such docs. A binary search is
performed on top of the docs array, and such global ids are converted back to
segment level ids (subtracting the context docbase) when scoring docs.

RescoreKnnVectoryQuery did not sort the array of docs which caused binary search
to return non deterministic results, which in turn made us look up wrong docs,
something using out of bound ids. One symptom of this was observed in a DFSProfilerIT
test failure which triggered a Lucene assertion around doc id being outside of the
range of the bitset of live docs.

The fix is to simply sort the score docs array before extracting docs ids and scores
and providing them to KnnScoreDocQuery upon rewrite.

Relates to #116663

Closes #119711
2025-02-15 14:24:12 +01:00
Nhat Nguyen
b07ba89b1d
Support partial results in ES|QL (#121942)
This change introduces partial results in ES|QL. To minimize the scope of the 
changes, this PR is just the first step toward full support for partial
results. The following follow-up tasks are required:

- Support partial results across clusters

- Return shard-level failures (currently, we only return the `is_partial` flag)

- Add documentation

- Allow partial results during resolution
2025-02-14 22:57:39 -08:00
elasticsearchmachine
d264f7afd7 Mute org.elasticsearch.entitlement.qa.EntitlementsDeniedNonModularIT org.elasticsearch.entitlement.qa.EntitlementsDeniedNonModularIT #122569 2025-02-15 16:53:16 +11:00
elasticsearchmachine
0f7b3ef588 Mute org.elasticsearch.entitlement.qa.EntitlementsDeniedIT org.elasticsearch.entitlement.qa.EntitlementsDeniedIT #122566 2025-02-15 16:53:09 +11:00
elasticsearchmachine
7558077f92 Mute org.elasticsearch.entitlement.qa.EntitlementsAllowedNonModularIT org.elasticsearch.entitlement.qa.EntitlementsAllowedNonModularIT #122568 2025-02-15 16:53:02 +11:00
elasticsearchmachine
4e7e24751f Mute org.elasticsearch.entitlement.runtime.policy.PolicyParserFailureTests testEntitlementAbsolutePathWhenRelative #122666 2025-02-15 16:49:50 +11:00
elasticsearchmachine
1f4f7560fe Mute org.elasticsearch.entitlement.runtime.policy.PolicyParserTests testPolicyBuilder #122665 2025-02-15 16:49:42 +11:00
elasticsearchmachine
0784575100 Mute org.elasticsearch.entitlement.runtime.policy.PolicyParserTests testParseFiles #122664 2025-02-15 16:49:34 +11:00
elasticsearchmachine
16173a52f4 Mute org.elasticsearch.entitlement.runtime.policy.PolicyParserTests testPolicyBuilderOnExternalPlugin #122663 2025-02-15 16:49:27 +11:00
elasticsearchmachine
ac727857a5 Mute org.elasticsearch.index.mapper.ShapeGeometryFieldMapperTests testCartesianBoundsBlockLoader #122661 2025-02-15 16:29:47 +11:00
Stanislav Malyshev
bb9c2c3444
Separate stop flag and is_partial (#122654) 2025-02-15 02:24:19 +01:00
Armin Braun
2e3cf38e87
Unmute SearchPhaseControllerTests.testProgressListener (#122649)
This was a transient issue back in November, it's long fixed
and we can just unmute.

closes #116149
2025-02-14 23:27:48 +01:00
Nhat Nguyen
b619e142f3
Fix listener usage in remote clusters (#122629)
We should notify the listener provided in delegateResponse/delegateFailure, 
not the original listener.
2025-02-14 12:41:11 -08:00
Ryan Ernst
db176a2175
Add entitlements lib to core/infra codeowners (#122611) 2025-02-14 21:37:25 +01:00
Martijn van Groningen
018b3cefb8
Speed up InternalEngine#resolveDocVersion(...) method (#122374)
Use reference manager to get index reader instead of acquiring a searcher. The latter involves creating an index searcher, which is not used and expensive as part of the `resolveDocVersion(...)` method, because this method is invoked for each document that gets indexed.
2025-02-14 20:35:04 +01:00
Joe Gallo
d59a0d9d44
Canonicalize processor names and types in IngestStats (#122610) 2025-02-14 12:38:00 -05:00
Lorenzo Dematté
91413351ce
[Entitlements] Add ability to set path relative to a special directory for Files policies (#122370) 2025-02-14 18:08:08 +01:00
Lorenzo Dematté
eff30608ce
Add file read entitlement check to library load functions (#122494) 2025-02-14 17:23:33 +01:00
Andrei Dan
c8836a8572
[TEST] ensure cluster is stable before running testReindex (#122589)
Unable to reproduce however the coordinator node that is meant to route
the write requests might've not been ready to do so in due time.
This PR adds an ensureStableCluster in the test setup method.

Fixes #120605
2025-02-14 16:19:56 +00:00
elasticsearchmachine
1473b19cde Bump versions after 8.16.4 release 2025-02-14 16:17:39 +00:00
Luigi Dell'Aquila
d9beed12f8
ES|QL: disable mixed cluster CSV tests that require source field mapping (#122607) 2025-02-14 16:56:07 +01:00
elasticsearchmachine
208a074902 Bump versions after 8.17.2 release 2025-02-14 15:52:39 +00:00
Rene Groeschke
9c19538c06
[BUILD] Rework build cache authentication on CI (#122296)
This is required to update to newer version of gradle enterprise and the gradle enterprise plugin.
2025-02-14 16:48:15 +01:00
Luca Cavanna
66d18d03d4
Return an empty suggestion when suggest phase times out (#122575)
We recently fixed timeout handling in the suggest phase. A test failure on SearchTimeoutIT surfaced an issue with the current approach. In case partial results are allowed, it may happen that some shards time out while executing the suggest phase and some don't.

SearchPhaseController assumes that if one shard has suggest results, all of the other shards will have suggest results too. We could address that assertion and check is the search timed out, instead this commit changes timeout handling in the suggest phase to return an empty suggestion instead of null. This seems appropriate in terms of providing some results and makes the assertion about non null suggestions in SearchPhaseController happy.

Relates to #122357

Closes #122548
2025-02-14 15:28:47 +01:00
Armin Braun
f2098e0bad
Increase timeout in indexRandom to 30s (#122598)
We have at least this one test where the combination of running in the single CPU
environment and a relatively large document count + dynamic mapping updates
exceeds the 10s threshold in very rare cases. Lets try moving this to 30s to hopefully
turn "rare" into practically impossible. I could see this being an issue in other tests
or becoming one, so I think it's fine to raise the timeout for all tests.

closes #116126
closes #115815
2025-02-14 14:52:51 +01:00
Armin Braun
fd25d3bd82
Fix SO-Error in SearchWithRandomDisconnectsIT (#122593)
Obvious SO exception possibilitiy if we encounter exceptions back to back in the callback.
Use promise style pattern instead of callback in the individual loops to limit stack-depth
(this should be good enough for a fix, technically you could still run into very deep stacks
if the search completes between the `isDone` check and adding the listener back-to-back
a couple times but practically this should be good enough since all the instant-done situations
are from the search fully failing outright.

closes #116175
2025-02-14 13:46:24 +01:00
Panagiotis Bailis
95f8454e40
Update test_reranking_service to try and parse provided inputs as scores (#122328) 2025-02-14 12:30:10 +02:00
Kostas Krikellas
37f974546d
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
2025-02-14 11:46:15 +02:00
Lorenzo Dematté
7781345799
Unmute tests (#122576) 2025-02-14 10:12:19 +01:00
Ievgen Degtiarenko
7ac3275988
Unmute EsqlSpecIt (#122573) 2025-02-14 09:59:37 +01:00
Tim Vernum
04bb8b2361 Merge main into multi-project 2025-02-14 17:18:02 +11:00
Tim Vernum
680e7a6979 Merge revision 5c00341c2b into multi-project 2025-02-14 17:17:41 +11:00
elasticsearchmachine
1bcb68d03f Mute org.elasticsearch.entitlement.qa.EntitlementsDeniedNonModularIT org.elasticsearch.entitlement.qa.EntitlementsDeniedNonModularIT #122569 2025-02-14 16:51:41 +11:00
elasticsearchmachine
d5cb811b3a Mute org.elasticsearch.entitlement.qa.EntitlementsAllowedNonModularIT org.elasticsearch.entitlement.qa.EntitlementsAllowedNonModularIT #122568 2025-02-14 16:51:33 +11:00
elasticsearchmachine
0d388c5291 Mute org.elasticsearch.entitlement.qa.EntitlementsAllowedIT org.elasticsearch.entitlement.qa.EntitlementsAllowedIT #122567 2025-02-14 16:51:24 +11:00
elasticsearchmachine
9cf2e80d31 Mute org.elasticsearch.entitlement.qa.EntitlementsDeniedIT org.elasticsearch.entitlement.qa.EntitlementsDeniedIT #122566 2025-02-14 16:51:14 +11:00
elasticsearchmachine
d88e063cbc Mute org.elasticsearch.xpack.esql.qa.multi_node.EsqlSpecIT org.elasticsearch.xpack.esql.qa.multi_node.EsqlSpecIT #121411 2025-02-14 16:46:15 +11:00
Tim Vernum
ad1ce7e7cd
Move isOperator to x-pack-core (#122468)
This moves from `isOperator(ThreadContext`) method from

    org.elasticsearch.xpack.security.operator.OperatorPrivileges

to

    org.elasticsearch.xpack.core.security.operator.OperatorPrivilegesUtil

so that it can be used by modules that depend on x-pack-core (without
needing to depend on x-pack-security)
2025-02-14 15:25:49 +11:00
Joe Gallo
5c00341c2b
Handle 404s from the _cat/indices api in FullClusterRestartIT (#122537) 2025-02-13 21:14:04 -05:00
Sam Xiao
5d48ded537
Improve SLM Health Indicator to cover missing snapshot (#121370)
Currently the SLM health indicator in health report turns YELLOW when snapshots fail for a number of times. However, the SLM health indicator stays GREEN if snapshot is not completed (no success or failure) for a long time. This change adds a new optional setting unhealthy_if_no_snapshot_within to SLM policy, that sets a time threshold. If the SLM policy has not had a successful snapshot for longer than the threshold, the SLM health indicator will turn YELLOW.
2025-02-14 09:54:26 +08:00
Oleksandr Kolomiiets
542c5d99fb
Fix handling of object arrays FallbackSyntheticSourceBlockLoader (#122528) 2025-02-13 17:21:08 -08:00
Ryan Ernst
b8e4f4ea6a
Add temp dir access to all modules (#122525)
Temp dir access is necessary all over Elasticsearch, and in general is
not sensitive. With Security Manager all code in ES, including plugins,
are given read/write access to the temp dir. This commit mimicks that
behavior with entitlements.
2025-02-13 17:19:00 -08:00
Parker Timmins
aba25c628a
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
2025-02-13 19:14:30 -06:00
Benjamin Trent
4bba2ca663
Unmuting fixed int4 flakiness (#122545)
This test was missed back in my "fix int4" PR. 

https://github.com/elastic/elasticsearch/pull/121437

closes: https://github.com/elastic/elasticsearch/issues/121412
2025-02-14 09:32:50 +11:00
Gal Lalouche
d3ed999356
ESQL: Initial support for unmapped fields (#119886)
This PR adds initial support for unmapped fields, using the INSIST clause. For starters, this unmapped fields without a cast.
Note that the INSIST keyword is potentially a placeholder, as the method of defining an unmapped field might change in the future, e.g., use a special magic function. As this is currently under development, the actual syntax is INSIST_🐔.

First stage of #120072.

Specifically, the following features are implemented in this PR:

* Support for INSIST keyword without a cast. In particular, if the type being INSISTed upon is mapped to anything other than KEYWORD, it will result in an InvalidMappedField. There is no support for union type resolution on top of INSIST. Future PRs will handle these conflicts. There is support for multiple parameters, or INSIST on top of INSIST which is equivalent.
* Enforcing that INSIST must always be on top of a FROM or another INSIST. While this may change in the future, e.g., handling cases like `FROM foo | EVAL x = 1 | INSIST bar` will not be done in this PR, as it makes handling INSIST too complicated.
2025-02-13 23:28:35 +01:00
elasticsearchmachine
b0ded613ae Mute org.elasticsearch.xpack.inference.mapper.SemanticInferenceMetadataFieldsRecoveryTests testSnapshotRecovery {p0=false p1=true} #122551 2025-02-14 09:19:26 +11:00
elasticsearchmachine
45167d5a38 Mute org.elasticsearch.xpack.inference.mapper.SemanticInferenceMetadataFieldsRecoveryTests testSnapshotRecovery {p0=true p1=false} #122550 2025-02-14 09:19:18 +11:00
elasticsearchmachine
61c8fb299e Mute org.elasticsearch.xpack.inference.mapper.SemanticInferenceMetadataFieldsRecoveryTests testSnapshotRecovery {p0=false p1=false} #122549 2025-02-14 09:19:09 +11:00
elasticsearchmachine
8b1397fb87 Mute org.elasticsearch.search.SearchTimeoutIT testSuggestTimeoutWithPartialResults #122548 2025-02-14 08:57:25 +11:00
elasticsearchmachine
94bf12a4b2 Mute org.elasticsearch.telemetry.apm.ApmAgentSettingsIT org.elasticsearch.telemetry.apm.ApmAgentSettingsIT #122546 2025-02-14 08:35:53 +11:00
Francisco Fernández Castaño
38cc72c066
Fix ShuffleForcedMergePolicyTests#testDiagnostics (#122473)
This commit ensures that opening the DirectoryReader won't merge
all the segments into one, making the tested force merge a no-op.

Closes #121336
2025-02-13 22:31:30 +01:00
Lorenzo Dematté
0810e66802
[Entitlements] Make lookupImplementationMethod inheritance-aware (#122474) 2025-02-13 22:08:29 +01:00
Lorenzo Dematté
556281ace8
Removed unused "else" branch for no entitlements/no SM (#122354) 2025-02-13 22:08:09 +01:00
John Verwolf
9076ac4303
System Index Migration Failure Results in a Non-Recoverable State (#122326)
This PR changes the code to no-longer rely on the persistent task state for the cleanup logic of existing indices.
2025-02-13 20:49:14 +01:00
Ryan Ernst
482a49fce1
Improve size limiting string message (#122427)
SizeLimitingStringWriter is used to limit the output size of mustache
scripts. When the size is limited, the resulting exception lacks detail
needed to identify the problem. In particular, the actual size that
would result is not given. Additionally, the excerpt lacks any of the
new string being added. This commit tweaks the exception to include both
of these details.
2025-02-13 20:28:22 +01:00
Patrick Doyle
f8aa047994
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
2025-02-13 13:45:51 -05:00
Tanguy Leroux
6ff8bedafd
Ensure shard is mutable before proceeding with updates (#122392)
An update operations should make sure
that the shard is mutable before proceeding
further with a Get to retrieve the document
and then any of the create/update/delete/noop
operation.

Relates ES-10708
2025-02-13 19:38:54 +01:00
Jordan Powers
53150881e9
Enable the use of nested field type with index.mode=time_series (#122224)
This patch removes the check that fails requests that attempt to use fields of type: nested within indices with mode time_series.

This patch also updates TimeSeriesIdFieldMapper#postParse to set the _id field on child documents once it's calculated.

Closes #120874
2025-02-13 09:33:04 -08:00
Luca Cavanna
6a57b70f16
Remove Countable interface and dry up ShardsIterator (#121923)
The size method is needed only in SearchShardIterator and PlainIterator.
An interface is not really needed, we can just rather add the size method
where needed.

Also, there's a couple of methods in the ShardsIterator interface that are
not needed that this commit removes: size, reset and remaining.
2025-02-13 18:30:23 +01:00
Luca Cavanna
610722d539
Handle search timeout in SuggestPhase (#122357)
Whenever a search timeout is set to a search request, the timeout may be triggered
by the suggest phase via exitable directory reader. In that case, the exception that
is thrown by the timeout check needs to be handled, instead of returned back to the user.

Instead of handling the timeout in each phase, this commit handles it as part of QueryPhase
for both SuggestPhase and RescorePhase.

For rescore phase, one integration test that is time dependent is also rewritten to remove
the time dependency and moved from QueryRescorerIT to SearchTimeoutIT.

Closes #122186
2025-02-13 18:26:46 +01:00
Armin Braun
b117651322
Unmute org.elasticsearch.search.CrossClusterSearchUnavailableClusterIT.testSearchSkipUnavailable (#122515)
Long fixed, forgot to unmute.

closes #121497
2025-02-13 18:17:39 +01:00
Armin Braun
54613656c3
Remove another outdated assertion from SearchQueryThenFetchAsyncActionTests (#122086)
Same reasoning as in 2b410c44eb,
with the now weaker ordering guarantees from optimizations this
assertion stopped being reliable.
2025-02-13 17:57:18 +01:00
Ignacio Vera
33a2bc9a31
Deduplicate IngestStats and IngestStats.Stats identity records when deserializing (#122496)
This commit makes sure we reuse the existing static instance when deserializing to avoid excessive heap usage.
2025-02-13 17:09:09 +01:00
Martijn van Groningen
1b452c719a
Logsdb and source only snapshots. (#122199)
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.
2025-02-13 17:06:05 +01:00
Pat Whelan
fda7fc71e6
[Deprecation] Refine Transform Destination Index message (#122192)
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-13 10:36:50 -05:00
Mary Gouseti
cd74d18c5e
Add missing transport versions (#122506) 2025-02-13 16:18:42 +02:00
elasticsearchmachine
41be8b940f Mute org.elasticsearch.lucene.RollingUpgradeSearchableSnapshotIndexCompatibilityIT testSearchableSnapshotUpgrade {p0=[9.1.0, 9.1.0, 9.1.0]} #122505 2025-02-14 00:50:40 +11:00
elasticsearchmachine
aa5ee2c433 Mute org.elasticsearch.lucene.RollingUpgradeSearchableSnapshotIndexCompatibilityIT testMountSearchableSnapshot {p0=[9.1.0, 9.1.0, 9.1.0]} #122504 2025-02-14 00:50:32 +11:00
elasticsearchmachine
4cdb1e3cdd Mute org.elasticsearch.lucene.RollingUpgradeSearchableSnapshotIndexCompatibilityIT testSearchableSnapshotUpgrade {p0=[9.1.0, 9.1.0, 8.19.0]} #122503 2025-02-13 23:41:11 +11:00
elasticsearchmachine
28797290ad Mute org.elasticsearch.lucene.RollingUpgradeSearchableSnapshotIndexCompatibilityIT testMountSearchableSnapshot {p0=[9.1.0, 8.19.0, 8.19.0]} #122502 2025-02-13 23:41:04 +11:00
elasticsearchmachine
6e0541e080 Mute org.elasticsearch.lucene.RollingUpgradeSearchableSnapshotIndexCompatibilityIT testMountSearchableSnapshot {p0=[9.1.0, 9.1.0, 8.19.0]} #122501 2025-02-13 23:40:55 +11:00
elasticsearchmachine
d5b6c265bf Mute org.elasticsearch.lucene.RollingUpgradeSearchableSnapshotIndexCompatibilityIT testSearchableSnapshotUpgrade {p0=[9.1.0, 8.19.0, 8.19.0]} #122500 2025-02-13 23:40:48 +11:00
elasticsearchmachine
0c9c9103c9 Mute org.elasticsearch.lucene.RollingUpgradeLuceneIndexCompatibilityTestCase testClosedIndexUpgrade {p0=[9.1.0, 9.1.0, 9.1.0]} #122495 2025-02-13 22:25:51 +11:00
Pooya Salehi
bee0317e57 Merge remote-tracking branch 'upstream/multi-project' into ps250207-projectScopedTasksSystemIndex 2025-02-13 11:52:41 +01:00
Pooya Salehi
142200ac0a address review comments 2025-02-13 11:52:26 +01:00
elasticsearchmachine
9d50ceaf59 Mute org.elasticsearch.lucene.RollingUpgradeLuceneIndexCompatibilityTestCase testRestoreIndex {p0=[9.1.0, 9.1.0, 9.1.0]} #122490 2025-02-13 21:27:11 +11:00
elasticsearchmachine
b404651527 Mute org.elasticsearch.lucene.RollingUpgradeLuceneIndexCompatibilityTestCase testIndexUpgrade {p0=[9.1.0, 9.1.0, 8.19.0]} #122489 2025-02-13 21:19:03 +11:00
elasticsearchmachine
f0c3bc9ad2 Mute org.elasticsearch.lucene.RollingUpgradeLuceneIndexCompatibilityTestCase testClosedIndexUpgrade {p0=[9.1.0, 9.1.0, 8.19.0]} #122488 2025-02-13 21:17:06 +11:00
elasticsearchmachine
22e1a67d6f Mute org.elasticsearch.lucene.RollingUpgradeLuceneIndexCompatibilityTestCase testIndexUpgrade {p0=[9.1.0, 9.1.0, 9.1.0]} #122487 2025-02-13 21:16:58 +11:00
elasticsearchmachine
bfaffe9d51 Mute org.elasticsearch.lucene.RollingUpgradeLuceneIndexCompatibilityTestCase testIndexUpgrade {p0=[9.1.0, 8.19.0, 8.19.0]} #122484 2025-02-13 20:06:52 +11:00
elasticsearchmachine
da024dc942 Mute org.elasticsearch.lucene.RollingUpgradeLuceneIndexCompatibilityTestCase testRestoreIndex {p0=[9.1.0, 8.19.0, 8.19.0]} #122483 2025-02-13 20:06:44 +11:00
elasticsearchmachine
260a2ee463 Mute org.elasticsearch.lucene.RollingUpgradeLuceneIndexCompatibilityTestCase testRestoreIndex {p0=[9.1.0, 9.1.0, 8.19.0]} #122482 2025-02-13 20:06:36 +11:00
elasticsearchmachine
bb4915947f Mute org.elasticsearch.lucene.RollingUpgradeLuceneIndexCompatibilityTestCase testClosedIndexUpgrade {p0=[9.1.0, 8.19.0, 8.19.0]} #122481 2025-02-13 20:06:28 +11:00
Ievgen Degtiarenko
81b73b630c
Un-mute CsvTests (#122469) 2025-02-13 10:03:46 +01:00
Rene Groeschke
93d601c391
Develocity setup does not allow overwriting server url (#122470)
This is a prerequisite to have
https://github.com/elastic/elasticsearch/pull/122296 passing in bwc
tests
2025-02-13 19:41:30 +11:00
Valeriy Khakhutskyy
1bafbc1d3d
[main][ML] Delete obsolete snapshot stats after upgrade (#121661)(#121661) (#122400)
Ensure that the old snapshot model_size_stats document is removed after the snapshot upgrade.
2025-02-13 09:09:15 +01:00
Mikhail Berezovskiy
49ecbcaf27
Test-fix testAcceptsMismatchedServerlessBuildHash #121869 (#122332) 2025-02-12 20:36:48 -08:00
Yang Wang
71e45ae138
Make persistent task name and ID available in update source (#122334)
Add the task name (when possible) and ID as part of the source string
for updating cluster state. This helps better identifying the source of
a task. The updatePersistentTaskState method already does it. This PR
ensures it is the case in other places.
2025-02-13 14:45:23 +11:00
Nhat Nguyen
f789277677
Prefer client errors while collecting ES|QL failures (#122290)
Currently, the ES|QL failure collectors categorize errors into 
non-cancellation and cancellation errors, preferring to return 
non-cancellation errors to users. With the retry on shard-level failure,
the failure collector can now collect more categories of errors: client 
errors, server errors, shard-unavailable errors, and cancellation
errors. For easier diagnostics and operations (especially on
serverless), the failure collectors prefer returning client (4xx) errors
over server (5xx) errors, shard-unavailable errors, and cancellation
errors.

Relates #120774
2025-02-12 19:41:37 -08:00
Niels Bauman
ee3542a27c
Log hot threads after cluster cleanup timeout (#122341)
In addition to logging the pending cluster tasks after the cluster
health request times out during cluster cleanup in REST tests, we should
log the hot threads to help identify any issues that could cause tasks
to get stuck.

Follow-up of #119186

Relates #111632
Relates #111431
Relates #111662
2025-02-13 04:39:05 +01:00
Tim Vernum
13f9ace345 Explain unsupported reindex YAML test (MP-1912)
The yaml test

    reindex/30_search/Sorting deprecated wait_for_completion false

does not work correctly with security enabled.
This test should be permanently added to the "unsupported" list.

Relates: https://github.com/elastic/elasticsearch/issues/120252
2025-02-13 03:49:33 +01:00
Niels Bauman
3c18ea6e44
Unmute SetSingleNodeAllocateStepTests (#122318)
This failing test was already fixed by #121266

Fixes #121495
2025-02-13 12:19:00 +10:00
Nhat Nguyen
8e2322c2ef
Fix listener leak in exchange service (#122417)
If we hit the circuit breaker exception before fetching pages, 
we fail to notify the listener.

Closes #122271
2025-02-12 17:58:53 -08:00
Nhat Nguyen
03d7d34f01
Remove completion listener from ExchangeSourceHandler (#122446)
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-12 17:57:55 -08:00
Oleksandr Kolomiiets
b8d7e99cb9
Use FallbackSyntheticSourceBlockLoader for number fields (#122280) 2025-02-12 16:12:19 -08:00
Mark Vieira
6c6e8d8768
Add release tooling for adding new transport versions (#122426) 2025-02-12 15:59:51 -08:00
Keith Massey
8c0ab4eab3
Making reindex data streams actions cancellable (#122438) 2025-02-13 00:23:23 +01:00
Stanislav Malyshev
88550f6126
Improve CrossClusterAsyncEnrichStopIT test (#122432) 2025-02-12 15:37:44 -07:00
elasticsearchmachine
ecde1cad9d Mute org.elasticsearch.xpack.esql.CsvTests org.elasticsearch.xpack.esql.CsvTests #122440 2025-02-13 09:27:41 +11:00
Andrei Stefan
f8fb3c3d84
Don't run the csv tests for inlinestats in non-snapshot tests (#122407) 2025-02-13 09:20:16 +11:00
Benjamin Trent
f5c901e68c
Fix synthetic source bug that would mishandle nested dense_vector fields (#122425)
When utilizing synthetic source with nested fields, we attempt to
rebuild the child values in addition to all the parent values.

While this generally works well, its potential that certain values might
be missing from various child docs. Consequently, we will attempt to
iterate the vector values strangely, resulting in seemingly missing
values or potentially exceptions indicating EOFs.

closes: #122383
2025-02-13 08:20:13 +11:00
Mary Gouseti
a7cf0f6875
[Failure store] Remove ::* selector (#121900) 2025-02-12 22:27:54 +02:00
Dianna Hohensee
a644202e92
Extract metric handling from DesiredBalanceReconciler (#121771)
The DesiredBalanceReconciler is responsible for applying updates to
the cluster states that reflect shard allocation changes towards a
DesiredBalance. It isn't the Reconciler's responsibility to handle
pushing APM metrics. This patch cleans up the Reconciler constructor
and logic by extracting metric handling, modularizing metric updates
in the Allocator level of the code instead of being split across the
two components. This will facilitate testing.

This patch also contains general improvements in documentation
around the desired balance Reconciler and Metrics related code.

Relates ES-10581
2025-02-12 14:28:42 -05:00
Lorenzo Dematté
bd242cccbc
[Entitlements] Instrumentation for FileSystemProvider (#122232) 2025-02-12 18:56:13 +01:00
Stanislav Malyshev
2c846e7351
Add metadata checking to RequestIndexFilteringIT (#122322) 2025-02-12 09:46:28 -07:00
Luca Cavanna
8f28bc2feb
Fix handling of auto expand replicas for stateless indices (#122365)
Auto expand replicas is meant to be entirely disabled for stateless indices.
The only scenario where a change needs to be applied is when the number of replicas
is initialized to 0, in which case 0 needs to be turned into 1. Otherwise, no changes
should be applied in stateless indices despite auto expand replicas is used.

The current handling for this was missing an early exit of the indices loop in the case
where 0 shoudl be turned into 1, that leads to a potentially higher number of copies
being allocated (effectively auto-expand gets applied by mistake).
2025-02-12 16:41:40 +01:00
Pat Whelan
99c5398137
[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>
2025-02-12 16:24:07 +01:00
Pat Whelan
39da0749b0
[Transform] Reset plugin after tests (#122252)
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-12 16:16:16 +01:00
elasticsearchmachine
fd97007803 Mute org.elasticsearch.xpack.esql.action.EsqlActionBreakerIT testStatsMissingFieldWithStats #122327 2025-02-13 02:07:42 +11:00
Armin Braun
ac03aa4c63
Simplify InternalOrder.isOrder a little (#122372)
No need for recursion here. We don't allow nested compound order instances
so this thing works exactly as the JavaDoc states and we only need to check
one level down.
2025-02-12 15:55:37 +01:00
Iván Cea Fontenla
dfcf479204
ESQL: Emit warnings on LOOKUP JOIN multivalues (#121219)
Fixes https://github.com/elastic/elasticsearch/issues/118780
2025-02-12 15:45:26 +01:00
Adam Demjen
d1bbc4ceb8
[Inference API] Rename model_id prop to model in EIS sparse inference request body (#122272)
* Rename model_id prop to model in EIS sparse inference request body

* Update docs/changelog/122272.yaml

* Fix broken tests
2025-02-12 09:23:31 -05:00
Ryan Ernst
5f00b64ec7
Instrument methods on File that require write permission (#122109)
This commit adds instrumentation for File methods that require write
permission. No server or plugins use these methods, so no policy changes
were necessary. Note that since we are not planning to restrict temp
file creation, the bootstrap self test on file writing was removed,
which failed with these changes.
2025-02-12 06:20:34 -08:00
Parker Timmins
05a2003a9f
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.
2025-02-12 08:00:16 -06:00
Pooya Salehi
917e0d47c0 Make task API project-aware 2025-02-12 14:46:47 +01:00
elasticsearchmachine
a7957a8cc6 Mute org.elasticsearch.repositories.blobstore.testkit.analyze.HdfsRepositoryAnalysisRestIT org.elasticsearch.repositories.blobstore.testkit.analyze.HdfsRepositoryAnalysisRestIT #122378 2025-02-13 00:43:36 +11:00
elasticsearchmachine
55f5d68409 Mute org.elasticsearch.repositories.blobstore.testkit.analyze.SecureHdfsRepositoryAnalysisRestIT org.elasticsearch.repositories.blobstore.testkit.analyze.SecureHdfsRepositoryAnalysisRestIT #122377 2025-02-13 00:43:25 +11:00
elasticsearchmachine
b8babb663a Mute org.elasticsearch.smoketest.DocsClientYamlTestSuiteIT test {yaml=reference/snapshot-restore/apis/get-snapshot-api/line_488} #121611 2025-02-13 00:37:06 +11:00
Jonathan Buttner
b9d122205a
[ML] Adding elser default endpoint for EIS (#122066)
* Adding elser default endpoint

* [CI] Auto commit changes from spotless

* Fixing test and allowing duplicate calls

* [CI] Auto commit changes from spotless

* Update docs/changelog/122066.yaml

---------

Co-authored-by: elasticsearchmachine <infra-root+elasticsearchmachine@elastic.co>
2025-02-12 08:16:48 -05:00
Andrei Stefan
4b3acd4f57
ESQL: revive inlinestats (#122257) 2025-02-12 15:12:20 +02:00
Kostas Krikellas
65f6b44b2a
Handle error in concurrent downsample actions (#122251) 2025-02-12 15:07:38 +02:00
Lorenzo Dematté
ec7f4ccb04
[Entitlements] Add FileStore instrumentation + tests (#122348) 2025-02-12 14:04:18 +01:00
Valeriy Khakhutskyy
e8bbf27146
[ML] Unmute fixed Classification IT tests #122352
Unmute tests following #122268

Closes #120071
Closes #121680
Closes #121492
Closes #121415
Closes #121236
2025-02-12 12:09:08 +01:00
Armin Braun
858769ddb6
Simplify comparators in InternalOrder (#122330)
We can build slightly more compact (and likely also faster) iterators
while using less code for these. Also, no need to create method
references as a way of casting.
2025-02-12 11:40:48 +01:00
Jan Kuipers
656b54bc74
Unmute changepoint tests (#122351) 2025-02-12 11:25:03 +01:00
Tanguy Leroux
f3b3297f9e
Sets the new engine before closing the previous one in IndexShard.resetEngine (#122255)
Current code closes the previous engine instance, creates the new engine and then updates the currentEngineReference:

    IOUtils.close(currentEngine);
    var newEngine = createEngine(engineConfig);
    currentEngineReference.set(newEngine);

This leaves more room for callers of getEngineOrNull() to pick a closed instance. Instead we can create the new engine first and atomically update the reference to the new instance.
2025-02-12 11:09:53 +01:00
elasticsearchmachine
49eccbe52d Mute org.elasticsearch.smoketest.DocsClientYamlTestSuiteIT test {yaml=reference/alias/line_260} #122343 2025-02-12 20:07:05 +11:00
elasticsearchmachine
bc6731b467 Mute org.elasticsearch.xpack.esql.action.EsqlActionBreakerIT testUnsupportedTypesOrdinalGrouping #122342 2025-02-12 20:00:49 +11:00
Ievgen Degtiarenko
a57b985487
Enforce aggs interface (#121898) 2025-02-12 09:17:15 +01:00
Francisco Fernández Castaño
a0029cd833
Ensure that IndexShard is mutable before force merges (#122275)
Closes ES-10787
2025-02-12 09:16:42 +01:00
Lorenzo Dematté
2b54de1e4b
Skip SM policy parsing and validation for Java24+ (#122233) 2025-02-12 08:14:36 +01:00
elasticsearchmachine
9112aba601 Mute org.elasticsearch.xpack.esql.action.CrossClusterCancellationIT testCloseSkipUnavailable #122336 2025-02-12 17:41:43 +11:00
elasticsearchmachine
6d25cbfd7a Mute org.elasticsearch.smoketest.DocsClientYamlTestSuiteIT test {yaml=reference/cat/health/cat-health-example} #122335 2025-02-12 17:08:45 +11:00
elasticsearchmachine
e44e5a3b92 Mute org.elasticsearch.xpack.searchablesnapshots.hdfs.HdfsSearchableSnapshotsIT org.elasticsearch.xpack.searchablesnapshots.hdfs.HdfsSearchableSnapshotsIT #122024 2025-02-12 16:36:36 +11:00
Mikhail Berezovskiy
23e4db8558
Unmute #122104 & #122103 2025-02-11 19:29:00 -08:00
Yang Wang
d93522207f Wire BWC for the split between cluster and project persistent tasks (MP-1938)
An old node does not know about the separation between cluster and
project scoped persistent tasks. When cluster state and cluster state
diff are read from or writen to an old node, wire BWC must be handled.
Specifically this means:
1. Read must split the incoming persistent tasks custom metadata into
cluster and project scoped ones and store them separately. We re-use the
same lastAllocationId for both cluster and project scopes.
2. Write must combine cluster and project scoped metadata and send it as
one single custom so that an old node can understand. The
lastAllocationId sent across is the max between cluster and project
scoped persistent tasks.

Note the BWC is only necessary when the new node has a single default
project. In other cases, we already simply reject such communication.

The cluster scoped persistent tasks are not used yet and should be added
as follow-ups. Until then, only unit tests are possible for the BWC
logic.
2025-02-12 02:41:40 +01:00
Yang Wang
0daf2e7dd8 Merge main into multi-project
Merge main into multi-project
2025-02-12 11:20:54 +11:00
Yang Wang
865f376b6a Fix compilation 2025-02-12 10:11:12 +11:00
Yang Wang
04d459009b Merge main into multi-project 2025-02-12 09:57:09 +11:00
Brian Seeders
ffd49f5f6f
[CI] Unmute tests 2025-02-11 17:31:52 -05:00
elasticsearchmachine
55d906ba35 Mute org.elasticsearch.blocks.SimpleBlocksIT testConcurrentAddBlock #122324 2025-02-12 08:59:45 +11:00
Mark Vieira
b65b5e971d
Ensure environment variable is set in Java compatibility testing jobs 2025-02-11 13:48:11 -08:00
elasticsearchmachine
48fd69e455 Mute org.elasticsearch.xpack.eql.EqlClientYamlIT org.elasticsearch.xpack.eql.EqlClientYamlIT #122317 2025-02-12 08:26:29 +11:00
elasticsearchmachine
c52d831bb0 Mute org.elasticsearch.xpack.test.rest.XPackRestIT org.elasticsearch.xpack.test.rest.XPackRestIT #120816 2025-02-12 08:24:44 +11:00
elasticsearchmachine
5fc27f095e Mute org.elasticsearch.xpack.kql.KqlRestIT org.elasticsearch.xpack.kql.KqlRestIT #122316 2025-02-12 08:24:22 +11:00
elastic-renovate-prod[bot]
2a04bc3e17
Update docker.elastic.co/wolfi/chainguard-base:latest Docker digest to ecd940b (#121659)
This PR contains the following updates:

| Package | Update | Change | |---|---|---| |
docker.elastic.co/wolfi/chainguard-base | digest | `bd40170` ->
`ecd940b` |

---

### Configuration

📅 **Schedule**: Branch creation - "after 1pm on tuesday" (UTC),
Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once
you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Renovate
Bot](https://redirect.github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy40MjUuMSIsInVwZGF0ZWRJblZlciI6IjM5LjEwNy4wIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyI6RGVsaXZlcnkvUGFja2FnaW5nIiwiPm5vbi1pc3N1ZSIsIlRlYW06RGVsaXZlcnkiLCJhdXRvLW1lcmdlLXdpdGhvdXQtYXBwcm92YWwiXX0=-->
2025-02-12 08:20:00 +11:00
elasticsearchmachine
51d214dbf7 Mute org.elasticsearch.xpack.apmdata.APMYamlTestSuiteIT org.elasticsearch.xpack.apmdata.APMYamlTestSuiteIT #122315 2025-02-12 08:16:50 +11:00
Keith Massey
1c5faaa822
If reindex data streams fails on one index, try the next (#122294) 2025-02-11 22:15:00 +01:00
elasticsearchmachine
5452f32f22 Mute org.elasticsearch.test.rest.ClientYamlTestSuiteIT org.elasticsearch.test.rest.ClientYamlTestSuiteIT #122310 2025-02-12 08:13:49 +11:00
elasticsearchmachine
78266d2c80 Mute org.elasticsearch.multi_node.GlobalCheckpointSyncActionIT org.elasticsearch.multi_node.GlobalCheckpointSyncActionIT #122308 2025-02-12 08:11:40 +11:00
elasticsearchmachine
26a9574895 Mute org.elasticsearch.multi_node.RollupIT org.elasticsearch.multi_node.RollupIT #122307 2025-02-12 08:11:37 +11:00
Stanislav Malyshev
453124396d
Improve CrossClusterAsyncQueryStopIT test resiliency (#122219) 2025-02-11 13:47:21 -07:00
David Kyle
0b7c3cece4
[ML] Fix serialising the Inference API update request (#122278) 2025-02-11 20:43:54 +00:00
elasticsearchmachine
94505724d1 Bump versions after 8.16.4 release 2025-02-11 20:18:32 +00:00
elasticsearchmachine
81843e2ff6 Prune changelogs after 8.17.2 release 2025-02-11 19:52:35 +00:00
elasticsearchmachine
1293bba29b Bump versions after 8.17.2 release 2025-02-11 19:50:48 +00:00
Joe Gallo
1727040503
Update IPinfo mmdb fixture files (#122277) 2025-02-11 14:32:58 -05:00
Ryan Ernst
30a65fbec5
Fix example plugin using config dir (#122212)
This commit fixes a use of accessing the config dir from the
environment.
2025-02-11 11:06:22 -08:00
Mark Vieira
25ff35e156
Add additional CI jobs to test with and without entitlements enabled 2025-02-11 10:53:09 -08:00
Valeriy Khakhutskyy
3d457ef84e
[ML] Increase waiting time to stabilize flaky DFA integration tests (#122268)
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-11 19:19:14 +01:00
Artem Prigoda
ecda919e67
Support real-time gets on hollow shards (#122012)
* Support returning `getLastUnsafeSegmentGenerationForGets` for any `Engine`, not only `InternalEngine`
* Retry real-time gets on `AlreadyClosedException` in case a shard's engine gets swapped.

See ES-10571
2025-02-11 17:33:20 +01:00
Luke Whiting
2b9d7f6396
Remove index setting when override value is null (#122267) 2025-02-11 17:27:43 +01:00
Francisco Fernández Castaño
67e71261d7
Generalize mechanism to signal need for a mutable shard (#122241)
Introduce beforeIndexShardMutableOperation in IndexEventListener to allow plugins to react when a mutable shard is needed. Add IndexShard#ensureMutable to let consumers signal this need and be notified when the shard is ready for mutable operations.

Relates ES-10787
2025-02-11 17:04:33 +01:00
Joe Gallo
e082ad56bf
Update Maxmind mmdb fixture files (#122225) 2025-02-11 10:47:54 -05:00
elasticsearchmachine
f52c59ef46 Mute org.elasticsearch.xpack.esql.action.EsqlNodeFailureIT testFailureLoadingFields #122132 2025-02-12 02:41:09 +11:00
Luke Whiting
3f021a1aa3
Ensure removal of index blocks does not leave key with null value (#122246)
* ES-10801 Ensure removal of index blocks does not leave key with null value

* Update docs/changelog/122246.yaml
2025-02-11 14:59:35 +00:00
Ievgen Degtiarenko
58277e7199
Document aggregation code generation (#121644) 2025-02-11 15:54:10 +01:00
Ievgen Degtiarenko
a36b327435
Supply timestamp to aggregate functions (#122174) 2025-02-11 15:53:44 +01:00
Jan Kuipers
cde8493374
Fix ChangePointOperatorTests.testSimpleFinishClose (#122245) 2025-02-11 12:57:19 +01:00
Armin Braun
28f51e45b7
Fix small mistake in listener wrapping in SearchService (#122190)
`l` is the same as the `finalListener` here, that's kind of the point of
the API. Fixing this here and removing the local variable the enabled
the mistake in the first place. Not a bug, but a needless capture that
at times makes heap dumps harder to read and wastes a couple cycles.
2025-02-11 12:30:48 +01:00
Tanguy Leroux
e706193689
Reduce number of get method variants in ShardGetService (#122175) 2025-02-11 09:40:27 +01:00
Rene Groeschke
6e6e42f5d4
[Build] Fix the manifest target and source information for jdbc projects (#121888)
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
2025-02-11 09:22:29 +01:00
Mikhail Berezovskiy
3ec1d12c99
Revert #122047 (#122227) 2025-02-11 18:49:36 +11:00
Lorenzo Dematté
a10f8a8c1c
[Entitlements] Fix "dynamic" instrumentation target class (#122197) 2025-02-11 08:48:00 +01:00
elasticsearchmachine
2d589b0bd5 Mute org.elasticsearch.xpack.esql.action.EsqlActionBreakerIT testGroupingMultiValueByOrdinals #122228 2025-02-11 17:31:45 +11:00
elasticsearchmachine
03d1c47736 Mute org.elasticsearch.xpack.migrate.action.ReindexDatastreamIndexTransportActionIT org.elasticsearch.xpack.migrate.action.ReindexDatastreamIndexTransportActionIT #121737 2025-02-11 17:29:32 +11:00
Nhat Nguyen
ce9f3f4284
Skip tests with semantic_text in ES|QL (#122222)
With this change, we will skip tests using semantic_texts in ES|QL while 
awaiting a fix for the mismatch in the _source of the semantic text
fields. The key change is that we need to avoid indexing semantic_text
fields in clusters with more than one node.

Relates #121411
2025-02-10 20:35:47 -08:00
Nhat Nguyen
bda99c9390
Fix DataNodeRequestSender (#121999)
There are two issues in the current implementation:

1. We should use the list of shardIds from the request, rather than all 
targets, when removing failures for shards that have been successfully
executed.

2. We should remove shardIds from the pending list once a failure is reported 
and abort execution at that point, as the results will be discarded.

Closes #121966
2025-02-10 16:43:59 -08:00
elasticsearchmachine
e056586840 Mute org.elasticsearch.xpack.security.authz.IndexAliasesTests testRemoveIndex #122221 2025-02-11 09:40:45 +11:00
elasticsearchmachine
5f70307315 Mute org.elasticsearch.xpack.esql.action.CrossClusterAsyncQueryStopIT testStopQueryLocal #121672 2025-02-11 09:32:33 +11:00
elasticsearchmachine
f7c363a525 Mute org.elasticsearch.smoketest.SmokeTestMonitoringWithSecurityIT testHTTPExporterWithSSL #122220 2025-02-11 09:29:23 +11:00
Ryan Ernst
840ee0f5d5
Skip plugins service create classloader test for jdk 24+ (#122067)
This test is only relevant when security manager is available. This
commit skips the test otherwise.

closes #121870
2025-02-10 14:07:37 -08:00
Ryan Ernst
57c2a7ef4d
Skip security manager hack test on jdk 24+ (#122070)
This test only makes sense when security manager is actually available.
This commit skips the test otherwise.

closes #121871
2025-02-10 14:06:47 -08:00
elasticsearchmachine
910135ecec Mute org.elasticsearch.datastreams.TSDBPassthroughIndexingIT org.elasticsearch.datastreams.TSDBPassthroughIndexingIT #121716 2025-02-11 09:00:49 +11:00
Stanislav Malyshev
7ba556d9e6
Ensure constitnent naming CrossClusterXYZ for tests (#122211) 2025-02-10 22:21:09 +01:00
Parker Timmins
89ba03ecff
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.
2025-02-10 14:49:07 -06:00
Ed Savage
7c614fddf8
Unmute XPackRestIT test {p0=snapshot/10_basic/Create a source only snapshot and then restore it} (#121733)
The XPackRestIT test {p0=snapshot/10_basic/Create a source only snapshot
and then restore it} had been failing due to spurious creation of ML
indices. That no longer seems to be the case as, after extensive local
testing, the test is passing.

Raising this PR to unmute the test

Relates #117295
2025-02-11 09:14:47 +13:00
John Verwolf
418dec0eb5
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.
2025-02-10 11:52:45 -08:00
Luca Cavanna
a1b2f3d39d
[TEST] Remove assert on non scored doc from SearchTimeoutIT (#122198)
In the recent rewrite of SearchTimeoutIT, an edge case was not considered
for the situation where a specific segment may not score any document.
In that case, other shards and their segments will raise a timeout anyway.
2025-02-10 19:32:54 +01:00
Armin Braun
210f854430
Relax some search interfaces to allow arbitrary cancellable tasks (#122188)
An easy change we can split out of #121885 to make that shorter.
2025-02-10 19:29:07 +01:00
Dan Rubinstein
3810864e2f
Fix get all inference endponts not returning multiple endpoints sharing model deployment (#121821)
* 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-10 12:40:37 -05:00
Joe Gallo
5e3fed02f1
Upgrade geoip2 dependency (#122184) 2025-02-10 11:23:35 -05:00
Luca Cavanna
ebba004fbe
Fix SearchTimeoutIT (#120390)
Two of the timeout tests have been muted for several months. The reason is that we tightened the assertions to cover for partial results being returned, but there were edge cases in which partial results were not actually returned.

The timeout used in the test was time dependent, hence when the timeout precisely will be thrown is unpredictable, because we have timeout checks in different places in the codebase, when iterating through the leaves, before scoring any document, or while scoring documents. The edge case that caused failures is a typical timing issue where the initial check for timeout in CancellableBulkScorer already triggers the timeout, before any document has been collected.

I made several adjustments to the test to make it more robust:
- use index random to index documents, that speeds it up
- share indexing across test methods, so that it happens once at the suite level
- replace the custom query that triggers a timeout to not be a script query, but rather a lucene query that is not time dependent, and throws a time exceeded exception precisely where we expect it, so that we can test how the system reacts to that. That allows to test that partial results are always returned when a timeout happens while scoring documents, and that partial results are never returned when a timeout happens before we even started to score documents. 

Closes #98369
Closes #98053
2025-02-10 17:06:43 +01:00
Martijn van Groningen
8cfc6228da
Conditionally use sequential stored field reader in LuceneSyntheticSourceChangesSnapshot (#121636)
Improve LuceneSyntheticSourceChangesSnapshot by triggering to use a sequential stored field reader if docids are dense. This is done by computing for which docids to synthesize recovery source for. If the requested docids are dense and monotonic increasing a sequential stored field reader is used, which provided recovery source for many documents without repeatedly de-compressing the same block of stored fields.
2025-02-10 15:38:25 +01:00
elasticsearchmachine
aa3cbbdbfc Mute org.elasticsearch.xpack.esql.analysis.VerifierTests testChangePoint_valueNumeric #122181 2025-02-11 01:29:22 +11:00
elasticsearchmachine
99d1fa7b27 Mute org.elasticsearch.xpack.esql.analysis.VerifierTests testChangePoint_keySortable #122180 2025-02-11 01:29:14 +11:00
elasticsearchmachine
0f007a41db Mute org.elasticsearch.xpack.esql.analysis.VerifierTests testChangePoint #122179 2025-02-11 01:29:05 +11:00
Jan Kuipers
2136d06933
Only run VerifierTests for change_point on snapshot builds. (#122167) 2025-02-10 15:09:07 +01:00
Samiul Monir
43c841a012
Fix - Requesting _inference_fields when using legacy format causes shard failure (#121720)
* 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-10 08:48:40 -05:00
Salvatore Campagna
27adf205ed
Refactoring doc values sparse index enabling for the host.name field (#121751)
In this PR, we change how the doc values sparse index is enabled for the host.name keyword field.  
The initial implementation of the sparse index for host.name was introduced in #120741.  

Previously, the choice between using an inverted index or a doc values sparse index was determined by the index parameter. With this change, we introduce a new final index-level setting, index.mapping.use_doc_values_sparse_index:

- When the setting is true, we enable the sparse index and omit the inverted index for host.name.  
- When the setting is false (default), we retain the inverted index instead.

Additionally, this setting is only exposed if the doc_values_sparse_index feature flag is enabled.

This change simplifies enabling the doc values sparse index and makes the selection of indexing strategies explicit at the index level. Moreover, the setting is not dynamic and is exposed only for stateful deployments.

The plan is to enable this setting in our nightly benchmarks and evaluate its impact on LogsDB indexing throughput, storage footprint and query latency. Based on benchmarking results, we will decide whether to adopt the sparse index and determine the best way to configure it.
2025-02-10 14:20:25 +01:00
Luigi Dell'Aquila
1e5ac8b4cc
ES|QL: Remove redundant sorts from execution plan (#121156) 2025-02-10 14:15:26 +01:00
Tanguy Leroux
26f6acf20c
Make CacheService.get() throws AlreadyClosedException when service is stopped (#122006)
This is caught thanks to #121210: if shard files are verified/checksumed
while the node is stopping, an IllegalStateException is throw by
CacheService.get() when it attempts to read data from the cache. This
exception later caused the verification to fail and then the Lucene
index to be marked as corrupted (which nows fails for searchable
snapshots shards that are read-only and should not be corrupted at
all).

This pull request changes ensureLifecycleStarted(), which is called
during CacheService.get(), to throw an AlreadyClosedException when
the service is stopped (note that ACE extends IllegalStateException,
which is convenient here). This ACE will be later specially handlded
in the checksumIndex method to not mark the shard as corrupted (see
#121210).

Closes #121927
2025-02-10 14:15:05 +01:00
Luigi Dell'Aquila
32dd91d71d
EQL: fix JOIN command validation (not supported) (#122011) 2025-02-10 14:14:06 +01:00
Iván Cea Fontenla
7bea3a5610
ESQL: Remove AggregateMapper reflection, and delegate intermediate state to suppliers (#122023)
To avoid having AggregateMapper find aggregators based on their names with reflection, I'm doing some changes:
- Make the suppliers have methods returning the intermediate states
- To allow this, the suppliers constructor won't receive the chanells as params. Instead, its methods will ask for them
  - Most changes in this PR are because of this
- After those changes, I'm leaving AggregateMapper still there, as it still converts AggregateFunctions to its NamedExpressions
2025-02-10 13:01:59 +01:00
Jan Kuipers
aaa5ce85a9
ES|QL change_point processing command (#120998)
* Grammar for ES|QL change point (with dummy impl)

* pipeline breaker

* ChangePointOperator

* Add sorting

* basic csv test

* conflict

* Update docs/changelog/120998.yaml

* [CI] Auto commit changes from spotless

* polish

* Non-long data type

* Move OrderBy/Limit to the logical plan

* fix mem.leak

* csv test for reusing column names

* Warning indeterminable

* capability

* handle null values

* too much data

* type text->keyword

* default timestamp and output columns

* spotless

* ChangePointOperatorTests + fix memory leaks

* [CI] Auto commit changes from spotless

* improve test

* add comments/todos

* handle multivalued columns

* don't register unserialiazable

* surrogate

* make "too much data" tests readable

* more tests

* Error handling

* fix multivalued test

* more name conflict tests

* [CI] Auto commit changes from spotless

* more tests

* improve code

* CSV test for various input key/value types

* one more csv test

* Check sortable/numeric for all types

* add null type to testChangePoint_valueNumeric

* more CSV tests

* skip nulls instead of zeroing them

* error on MV

* Test+todo for nicer error message

* better error msg

* Revert "better error msg"

This reverts commit 21ec77c8f3.

* fix

* make csv test deterministic

* replace NamedExpression -> Attribute

* skip MVs + warning

---------

Co-authored-by: elasticsearchmachine <infra-root+elasticsearchmachine@elastic.co>
2025-02-10 11:50:46 +01:00
Kostas Krikellas
49352fd3e5
Unmute TSDBPassthroughIndexingIT (#122160)
Yet another unmute, the failures are due to a platform issue in Windows.

Related to #121716
2025-02-10 20:40:18 +11:00
Julia Bardi
a11085c07b
[Fleet] added privileges for fleet-synced-integrations (#121753)
* added privileges for fleet-synced-integrations

* Update index-templates.asciidoc

* Revert "Update index-templates.asciidoc"

This reverts commit b73bae80f8.
2025-02-10 10:27:52 +01:00
Ievgen Degtiarenko
7deaacdb53
Update aggs code generation to be more explicit about required methods (#121749) 2025-02-10 09:40:21 +01:00
elasticsearchmachine
98c7570119 Mute org.elasticsearch.search.SearchCancellationIT testCancelFailedSearchWhenPartialResultDisallowed #121719 2025-02-10 19:22:45 +11:00
Tim Vernum
17657c0104
Remove TLSv1.1 from default protocols (#121731)
This commit removes "TLSv1.1" from the list of default protocols in
Elasticsearch (starting with ES9.0)

TLSv1.1 has been deprecated by the IETF since March 2021

This affects a variety of TLS contexts, include
 - The HTTP Server (Rest API)
 - Transport protocol (including CCS and CCR)
 - Outgoing connections for features that have configurable SSL
   settings. This includes
    - reindex
    - watcher
    - security realms (SAML, OIDC, LDAP, etc)
    - monitoring exporters
    - inference services

In practice, however, TLSv1.1 has been disabled in most Elasticsearch
deployments since around 7.12 because most JDK releases have disabled
TLSv1.1 (by default) starting in April 2021

That is, if you run a default installation of Elasticsearch (for any
currently supported version of ES) that uses the bundled JVM then
TLSv1.1 is already disabled.
And, since ES9+ requires JDK21+, all supported JDKs ship with TLSv1.1
disabled by default.

In addition, incoming HTTP connections to Elastic Cloud deployments
have required TLSv1.2 or higher since April 2020

This change simply makes it clear that Elasticsearch does not
attempt to enable TLSv1.1 and administrators who wish to use that
protocol will need to explicitly enable it in both the JVM and in
Elasticsearch.

Resolves: #108057
2025-02-10 09:12:52 +01:00
elasticsearchmachine
f097b6e0a9 Mute org.elasticsearch.xpack.downsample.DownsampleActionSingleNodeTests testDuplicateDownsampleRequest #122158 2025-02-10 19:04:36 +11:00
Armin Braun
d3abf9d5ba
Dry up search error trace ITs (#122138)
This logic will need a bit of adjustment for bulk query execution.
Lets dry it up before so we don't have to copy and paste the fix which
will be a couple lines.
2025-02-10 08:48:49 +01:00
Kostas Krikellas
f81f717e90
Unmute CoreWithSecurityClientYamlTestSuiteIT tests (#122154)
The suite was updated in #122035 to address the test failures.

Fixes #122100 Fixes #122101
2025-02-10 18:47:04 +11:00
Niels Bauman
0ec2fe05ef
Increase timeout in DataStreamLifecycleDownsampleDisruptionIT (#122151)
The downsample task sometimes needs a little bit longer to complete so
we bump the timeout from 60s to 120s.

Fixes #122056
2025-02-10 17:01:27 +10:00
Nhat Nguyen
3928051fdb Mute EsqlActionBreakerIT
Tracked at #122153
2025-02-09 22:09:21 -08:00
elasticsearchmachine
9c48bb9e6f Mute org.elasticsearch.xpack.esql.action.CrossClustersCancellationIT testCloseSkipUnavailable #121627 2025-02-10 11:49:58 +11:00
elasticsearchmachine
55696153e1 Mute org.elasticsearch.xpack.esql.action.EsqlActionBreakerIT testWhereNegatedCondition #122147 2025-02-10 10:57:33 +11:00
elasticsearchmachine
0e9e9f6196 Mute org.elasticsearch.xpack.esql.action.EsqlActionBreakerIT testProjectRenameEvalProject #122150 2025-02-10 10:09:45 +11:00
elasticsearchmachine
f3bb4161d6 Mute org.elasticsearch.xpack.esql.action.EsqlActionBreakerIT testFromStatsProjectGroupWithAlias #122144 2025-02-10 09:26:47 +11:00
elasticsearchmachine
549165d347 Mute org.elasticsearch.xpack.esql.action.EsqlActionBreakerIT testEvalWhere #122141 2025-02-10 08:46:18 +11:00
elasticsearchmachine
db7fa3c7e9 Mute org.elasticsearch.xpack.esql.action.EsqlNodeFailureIT testFailureLoadingFields #122132 2025-02-09 17:45:39 +11:00
elasticsearchmachine
4cb5f88dd9 Mute org.elasticsearch.xpack.esql.action.EsqlActionBreakerIT testGroupingMultiValueByOrdinals #122131 2025-02-09 17:25:23 +11:00
elasticsearchmachine
8a3b7d3881 Mute org.elasticsearch.xpack.esql.qa.single_node.EsqlSpecIT org.elasticsearch.xpack.esql.qa.single_node.EsqlSpecIT #121411 2025-02-09 16:42:35 +11:00
elasticsearchmachine
5dcb507715 Mute org.elasticsearch.xpack.esql.action.EsqlActionBreakerIT testIndexPatterns #122128 2025-02-09 08:39:47 +11:00
elasticsearchmachine
c0bf7d2335 Mute org.elasticsearch.xpack.esql.action.EsqlActionBreakerIT testExtractFields #122125 2025-02-09 01:38:43 +11:00
elasticsearchmachine
c34a0c7a33 Mute org.elasticsearch.xpack.ml.integration.ClassificationIT testWithOnlyTrainingRowsAndTrainingPercentIsFifty_DependentVariableIsBoolean #121680 2025-02-08 17:09:23 +11:00
elasticsearchmachine
3878b06424 Mute org.elasticsearch.datastreams.TSDBPassthroughIndexingIT org.elasticsearch.datastreams.TSDBPassthroughIndexingIT #121716 2025-02-08 17:06:15 +11:00
Nhat Nguyen
2355103e6f
Handle rejection in DriverScheduler (#122105)
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-07 21:13:56 -08:00
Nhat Nguyen
ac1bfa606a
Unmute #118238 (#122112)
Closes #118238
Fixed in #118370
2025-02-07 20:36:31 -08:00
Stanislav Malyshev
d11dad44cc
Fix async stop sometimes not properly collecting result (#121843)
* Fix async stop sometimes not properly collecting result
2025-02-07 20:48:07 -07:00
elasticsearchmachine
9c235c347a Mute org.elasticsearch.xpack.security.CoreWithSecurityClientYamlTestSuiteIT test {yaml=snapshot.delete/10_basic/Delete a snapshot asynchronously} #122104 2025-02-08 10:36:53 +11:00
elasticsearchmachine
5fabd2d323 Mute org.elasticsearch.test.rest.ClientYamlTestSuiteIT test {yaml=search/180_locale_dependent_mapping/Test Index and Search locale dependent mappings / dates} #122103 2025-02-08 10:24:22 +11:00
elasticsearchmachine
8d2d7bafe4 Mute org.elasticsearch.test.rest.ClientYamlTestSuiteIT test {yaml=snapshot.delete/10_basic/Delete a snapshot asynchronously} #122102 2025-02-08 10:24:14 +11:00
elasticsearchmachine
80916dd391 Mute org.elasticsearch.xpack.security.CoreWithSecurityClientYamlTestSuiteIT test {yaml=update/100_synthetic_source/keyword} #122101 2025-02-08 09:51:07 +11:00
elasticsearchmachine
c4682c84bd Mute org.elasticsearch.xpack.security.CoreWithSecurityClientYamlTestSuiteIT test {yaml=update/100_synthetic_source/stored text} #122100 2025-02-08 09:50:59 +11:00
Martijn van Groningen
d93f9c4d58
Address synthetic recovery source release test failures. (#122035) 2025-02-07 13:02:27 -08:00
Ryan Ernst
e32b9f48b0
Use dynamic policy for entitled test plugin (#121852)
Like the plugin being testing, the entitled test plugin needs access to
dynamic elements (namely, file paths). This commit dynamically generates
the entitlement policy for the entitlted test plugin when it is
installed. It also adds using the file entitltlement as an example.
2025-02-07 21:47:48 +01:00
Stanislav Malyshev
5bdb339e49
Improve cancellation test (#122085)
- Don't require specific message since cancel can take several forms
- Stop both branches for close test to avoid race
2025-02-07 21:36:18 +01:00
Oleksandr Kolomiiets
d52be5f784
Add ignore_malformed and null_values to test data generation (#121983) 2025-02-07 11:59:28 -08:00
Ryan Ernst
743e5d4c81
Remove assertion about theoretical path separators (#122069)
The only real path separators are either forward or back slash. Trying
to use something else like newline fails to even parse as a path on
windows. This commit removes testing of other separators.

closes #121872
2025-02-07 11:51:26 -08:00
Larisa Motova
3abc8524cb
[ES|QL] Support subset of metrics in agg metric double (#121805)
This commit adds adds support for mappings containing only a subset of
metrics in aggregate metric double (i.e. only sum and value_count, or
just max, etc) as well as tests for grouped aggregations on aggregate
metric double.
2025-02-07 09:29:13 -10:00
David Turner
b6facb25b8
Fork post-snapshot-delete cleanup off master thread (#122047)
We shouldn't run the post-snapshot-delete cleanup work on the master
thread, since it can be quite expensive and need not block subsequent
cluster state updates. This commit forks it onto a `SNAPSHOT` thread.
2025-02-08 05:08:29 +11:00
Mary Gouseti
1fe1055aef
[Deprecation API] Adjust details in the SourceFieldMapper deprecation warning (#122041)
In this PR we improve the deprecation warning about configuring source
in the mapping.

- We reduce the size of the warning message so it looks better in kibana.
- We keep the original message in the details.
- We use an alias help url, so we can associate it with the guide when it's created.
2025-02-08 04:55:14 +11:00
Simon Cooper
3ed5f73600
Add a parameter to describe the lambda in a transformedMatch matcher (#122013) 2025-02-07 17:13:26 +00:00
Brian Seeders
8366678854
[CI] Add VERSION_QUALIFIER to dra-update-staging script 2025-02-07 12:07:07 -05:00
elasticsearchmachine
396765dc8c Mute org.elasticsearch.xpack.restart.FullClusterRestartIT testWatcherWithApiKey {cluster=UPGRADED} #122061 2025-02-08 03:44:43 +11:00
Keith Massey
27545b0c27
Removing the type from the destination index when using CreateIndexFromSourceAction (#121982)
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-07 10:29:20 -06:00
Nik Everett
97c9574935
Aggs: Comment on deprecated execution mode (#122046)
This adds a comment to `execution_mode: global_ordinals_hash` explaining
that we're not going to remove it so we don't break anyone.
2025-02-08 03:26:43 +11:00
elasticsearchmachine
b94fbd1e81 Mute org.elasticsearch.xpack.downsample.DataStreamLifecycleDownsampleDisruptionIT testDataStreamLifecycleDownsampleRollingRestart #122056 2025-02-08 03:23:28 +11:00
Nhat Nguyen
e02e887126
Avoid cyclic exception in ExchangeSource (#121995)
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 08:20:33 -08:00
Lorenzo Dematté
05340746bb
Missing providers from nio (#122004) 2025-02-07 17:09:36 +01:00
Lorenzo Dematté
20376e0762
[Entitlements] Add native checks support and tests for Java 21 (preview) (#121881) 2025-02-07 17:01:04 +01:00
Nik Everett
cff329ee40
Retry timeout tests for aggs (#122031)
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-07 16:56:11 +01:00
David Kyle
8d4f034a5a
[ML] Give the kibana user read/write access to reindexed hidden ml indices (#121897)
Indices are reindexed on upgrade. Adds an index pattern to the role
descriptor matching the upgraded indices
2025-02-07 16:08:15 +01:00
elasticsearchmachine
9f35608c1c Mute org.elasticsearch.xpack.migrate.action.ReindexDatastreamIndexTransportActionIT org.elasticsearch.xpack.migrate.action.ReindexDatastreamIndexTransportActionIT #121737 2025-02-08 02:06:42 +11:00
Jonathan Buttner
ab482350e6
[ML] Inference API removing _unified and using _stream instead (#121804)
* 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>
2025-02-07 09:57:54 -05:00
elasticsearchmachine
f4ee8c605b Mute org.elasticsearch.xpack.application.CohereServiceUpgradeIT org.elasticsearch.xpack.application.CohereServiceUpgradeIT #121537 2025-02-08 01:57:07 +11:00
Nik Everett
df2f3b3b3f
ESQL: Update kibana signatures (#121951)
This updates the kibana signature json files in two ways:
* Renames `eval` to `scalar` - that's the name we use inside of ESQL and
  we may as well make the name the same.
* Calls the `CATEGORIZE` and `BUCKET` function `grouping` because they
  can only be used in the "grouping" positions of the `STATS` command.

Closes #113411
2025-02-07 09:51:09 -05:00
elasticsearchmachine
0485701e53 Mute org.elasticsearch.xpack.logsdb.LogsdbTestSuiteIT test {yaml=/60_synthetic_source_recovery/synthetic recovery for logsdb index} #122028 2025-02-08 01:32:10 +11:00
elasticsearchmachine
51a9c0de12 Mute org.elasticsearch.xpack.logsdb.LogsdbTestSuiteIT test {yaml=/60_synthetic_source_recovery/synthetic recovery for time_series index} #122027 2025-02-08 01:32:01 +11:00
elasticsearchmachine
c2f64b6ebd Mute org.elasticsearch.xpack.logsdb.LogsdbTestSuiteIT test {yaml=/60_synthetic_source_recovery/synthetic recovery for synthetic source mode index} #122026 2025-02-08 01:31:53 +11:00
elasticsearchmachine
fcf7130d48 Mute org.elasticsearch.action.search.SearchQueryThenFetchAsyncActionTests testBottomFieldSort #121503 2025-02-08 00:45:45 +11:00
Valeriy Khakhutskyy
f1b1983476
[ML] Add deprecation warning for flush API (#121667)
The anomaly detection job flush API is deprecated since it is only required for the post data API, which was deprecated since 7.11.0.

Closes #121506
2025-02-07 13:53:43 +01:00
Tanguy Leroux
7b8f7cca35
[Test] Unmute MinioSearchableSnapshotsIT (#122014)
Tests failures were caused by transient download failure of the Minion
Docker image.

Closes #121882
2025-02-07 23:17:37 +11:00
Luigi Dell'Aquila
c7ad02273c
ES|QL: fix ENRICH validation for use of wildcards (#121911) 2025-02-07 12:36:00 +01:00
Armin Braun
9209341e21
Remove unnecessary FeatureService dependencies (#121496)
We have a lot of unused fields for this thing. Also, more of its methods
can just be made static to avoid a dependency.
2025-02-07 11:23:16 +01:00
Ievgen Degtiarenko
c92b7b568e
Fix testValidFromPattern (#121996) 2025-02-07 11:14:45 +01:00
Luigi Dell'Aquila
c59406723d
ES|QL: Improve random query generation tests (#121750) 2025-02-07 10:31:10 +01:00
Armin Braun
2c6dd6c612
Remove assertExecuteOnStartThread from AbstractSearchAsyncAction (#121922)
This is a really strange assertion. I get that it tries to make sure we
skip unavailable without forking but this makes extending the
AbstractSearchAsyncAction cleanly for batched execution needlessly hard
and some of the assertion is dead code already because can-match isn't
going through this codepath anymore.

-> lets remove it, the code is simple enough now to follow that there's
no forking here IMO
2025-02-07 09:36:50 +01:00
Ievgen Degtiarenko
efb890b4d7
Emit process_nanos from LookupOperator (#120694) 2025-02-07 09:25:11 +01:00
elasticsearchmachine
144ff0ce8e Mute org.elasticsearch.smoketest.SmokeTestMultiNodeClientYamlTestSuiteIT test {yaml=update/100_synthetic_source/keyword} #121992 2025-02-07 17:20:08 +11:00
elasticsearchmachine
111c13077c Mute org.elasticsearch.smoketest.SmokeTestMultiNodeClientYamlTestSuiteIT test {yaml=update/100_synthetic_source/stored text} #121991 2025-02-07 17:19:59 +11:00
Ryan Ernst
03271bdfe8
Add 9.0 patch transport version constants (#121985)
Transport version changes must be unique per branch. Some transport
version changes meant for 9.0 are missing unique backport constants.
This commit adds constants and adjusts the transport logic to use the
new constants.
2025-02-07 02:51:52 +01:00
Yang Wang
7ed771e3f9 Add separate ClusterPersistentTasksCustomMetadata (MP-1945)
This PR adds ClusterPersistentTasksCustomMetadata by splitting from the
existing PersistentTasksCustomMetadata. The latter will be used for
project scoped persistent tasks. It also updates tasks executors to
declare its scope.

The new task type is not used anywhere yet and has no wire BWC handling.
Both will be addressed in follow-ups.

Split from: MP-1938
2025-02-07 01:08:34 +01:00
Stanislav Malyshev
ec2ac485b7
Release latches at the end of the test (#121947)
* Release latches at the end of the test
This may prevent failure contamination to other tests
2025-02-06 16:25:58 -07:00
Nik Everett
c659349289
ESQL: Clean index when retrying test (#121954)
This modifies the `HeapAttackIT` test to clean an index created by the
test if we have to retry it.

Closes #121873
2025-02-07 09:48:05 +11:00
elasticsearchmachine
c4f4b39406 Mute org.elasticsearch.xpack.esql.parser.StatementParserTests testInvalidJoinPatterns #121968 2025-02-07 08:44:04 +11:00
elasticsearchmachine
616e0573ec Mute org.elasticsearch.xpack.searchablesnapshots.hdfs.SecureHdfsSearchableSnapshotsIT org.elasticsearch.xpack.searchablesnapshots.hdfs.SecureHdfsSearchableSnapshotsIT #121967 2025-02-07 08:42:51 +11:00
elasticsearchmachine
e24489f142 Mute org.elasticsearch.xpack.esql.plugin.DataNodeRequestSenderTests testDoNotRetryOnRequestLevelFailure #121966 2025-02-07 08:40:19 +11:00
elasticsearchmachine
bcca97d47d Mute org.elasticsearch.test.rest.ClientYamlTestSuiteIT test {yaml=update/100_synthetic_source/keyword} #121965 2025-02-07 08:39:48 +11:00
elasticsearchmachine
a6a0e2d29d Mute org.elasticsearch.test.rest.ClientYamlTestSuiteIT test {yaml=update/100_synthetic_source/stored text} #121964 2025-02-07 08:39:40 +11:00
Pat Whelan
c38ea536a0
[ML] Parse mid-stream errors from OpenAI and EIS (#121806)
When we are already parsing events, we can receive errors as the next
event.

OpenAI formats these as:
```
event: error
data: <payload>
```

Elastic formats these as:
```
data: <payload>
```

Unified will consolidate them into the new error structure.
2025-02-06 22:27:43 +01:00
elasticsearchmachine
c225382f18 Mute org.elasticsearch.analysis.common.CommonAnalysisClientYamlTestSuiteIT test {yaml=analysis-common/40_token_filters/stemmer_override file access} #121625 2025-02-07 08:20:59 +11:00
Joe Gallo
2bf98743d6
Fix geoip databases index access after system feature migration (#121196) 2025-02-06 13:36:47 -06:00
Pat Whelan
5d5741d874
[Transform] Recreate Notifications Index (#121912)
If the notification index and alias gets deleted, recreate the index.

Fix #121909
2025-02-06 14:27:32 -05:00
Jack Conradson
8206411ee9
Merge all file entitlements into a single files entitlement (#121864)
This change replaces FileEntitlement with FilesEntitlement so that we can have exactly one entitlement 
class per module (or possibly future scope). This cleans up our policy files so that all files are located 
together to allow access, and this opens up the design for future optimizations.
2025-02-06 11:11:11 -08:00
Francisco Fernández Castaño
0015d56ea9
Skip sending ShardActiveRequest checks in stateless nodes (#121387)
Stateless nodes rely on an external blob store to persist data, therefore
it's not necessary to go through such checks when a shard store
should be deleted.

Closes ES-10577
2025-02-06 19:13:26 +01:00
Mark Vieira
eb6a49b7af
Upgrade mockito (#121849) 2025-02-06 09:36:04 -08:00
elasticsearchmachine
7c186a1af0 Mute org.elasticsearch.xpack.searchablesnapshots.FrozenSearchableSnapshotsIntegTests testCreateAndRestorePartialSearchableSnapshot #121927 2025-02-07 04:13:53 +11:00
Tommaso Teofili
0c8f5f8f00
Remove scoring enabled assumptions in ES|QL match test (#121393)
* Remove scoring enabled assumptions in ES|QL match test
---------

Co-authored-by: elasticsearchmachine <infra-root+elasticsearchmachine@elastic.co>
2025-02-06 17:55:14 +01:00
Luca Cavanna
f2b09051ec
Fold PlainShardIterator into ShardIterator (#121893)
ShardIterator is an interface with a single implementation called PlainShardIterator.
This commit makes it a concrete final class and folds its only implementation into it.
2025-02-06 17:29:13 +01:00
Stanislav Malyshev
29a09f1470
Unmute CrossClusterQueryUnavailableRemotesIT, should be fixed already (#121858) 2025-02-06 09:18:39 -07:00
Mark Tozzi
69b2078723
Aggregations cancellation after collection (#120944)
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-06 17:15:01 +01:00
David Turner
5537a51311
Fix testLogsSlowInboundProcessing (#121895)
This test creates an incorrectly-serialized handshake which cannot be
validated, and #121747 made that validation compulsory. This test
corrects the serialization.

Closes #121816
2025-02-06 15:50:37 +00:00
Ievgen Degtiarenko
24bc9fa1ce
Ensure cluster string could be quoted (#120355)
Currently we accept "remote:index", remote:"index" but not "remote":"index" as a valid index pattern. This change fixes this.
2025-02-06 16:10:03 +01:00
Tanguy Leroux
fab8ec92ae
Remove assertion on refreshed result in TransportShardRefreshAction.UnpromotableReplicasRefreshProxy (#121889)
Relates ES-10700
2025-02-06 16:08:35 +01:00
Keith Massey
85acf41d28
Adding tests that index metadata is correct after data stream upgrade (#121845) 2025-02-06 08:26:28 -06:00
David Turner
8a15609ae9
Fix version confusion in testHandshakeRequestFutureVersionsCompatibility (#121883)
Today we use the ID from `Version#CURRENT` in this test, which only
works if its ID is no less than that of `TranportVersion#current()`.
This commit fixes the test to ensure it always picks a transport version
ID that is not from the past.
2025-02-06 14:23:25 +00:00
Jonathan Buttner
671ecd0c63
[ML] Support revoking inference default endpoint authorization (#121326)
* Starting revoke

* Adding integration tests

* More integration tests

* Adding test for deleting default inference endpoint via rest call

* Removing task type any

* Addressing feedback and adding test
2025-02-06 08:28:21 -05:00
Salvatore Campagna
d507f8f2e0
Re-enable synthetic recovery tests (#121896) 2025-02-06 14:22:56 +01:00
Armin Braun
a33708df4f
Remove unused parameter from AbstractSearchAsyncAction.onShardResult (#121887)
Recent cleanups made the shard iterator unused on this method.
2025-02-06 11:29:14 +01:00
elasticsearchmachine
ed04ffa4c4 Mute org.elasticsearch.xpack.searchablesnapshots.minio.MinioSearchableSnapshotsIT org.elasticsearch.xpack.searchablesnapshots.minio.MinioSearchableSnapshotsIT #121882 2025-02-06 19:39:45 +11:00
Ievgen Degtiarenko
17d25ad1b8
Refactor and simplify aggregation implementers (#121818) 2025-02-06 09:04:36 +01:00
Lorenzo Dematté
a9d6c1241f
Fix: avoid further dispatch when ThreadContext population fails (#121665) 2025-02-06 08:51:53 +01:00
Nhat Nguyen
d7db1f5599
Keep outstanding pages when finish buffer early (#121857)
Today, the exchange buffer of an exchange source is finished in two 
cases: (1) when the downstream pipeline has received enough data and (2)
when all remote sinks have completed. In the first case, outstanding
pages could be safely discarded. In the second case, no new pages should
be received after finishing. In both scenarios, discarding all
outstanding pages was safe if noMoreInputs was switched while adding
pages.

However, with the stop API, the buffer may now finish while keeping 
outstanding pages, and new pages may still be received. This change
updates the exchange buffer to discard only the incoming page when
noMoreInputs is switched, rather than all pages in the buffer.

Closes #120757
2025-02-05 22:51:05 -08:00
Fang Xing
16fe4fd5d4
[ES|QL] Take named parameters for identifier and pattern out of snapshot (#121850) 2025-02-05 21:12:06 -08:00
Yang Wang
5afe9e5ba0 Merge main into multi-project
Merge main into multi-project
2025-02-06 15:22:12 +11:00
elasticsearchmachine
40d738c87e Mute org.elasticsearch.smoketest.DocsClientYamlTestSuiteIT test {yaml=reference/cat/health/cat-health-no-timestamp-example} #121867 2025-02-06 14:57:22 +11:00
Yang Wang
b4d60b0c01 Merge main into multi-project 2025-02-06 14:15:37 +11:00
Nhat Nguyen
2d99a66415
Retry ES|QL node requests on shard level failures (#120774)
Today, ES|QL fails fast on any failure. This PR introduces support for 
retrying within a cluster when data-node requests fail.

There are two types of failures that occur with data-node requests: 
entire request failures and individual shard failures. For individual
shard failures, we can retry the next copies of the failing shards. For
entire request failures, we can retry every shard in the node request if
no pages have been received.

On the handling side, ES|QL executes against a batch of shards 
concurrently. Here, we need to track whether any pages have been
produced. If pages have been produced, the entire request must fail.
Otherwise, we can track the failed shards and send them back to the
sender for retries.

There are two decisions around how quickly we should retry:

1. Should we notify the sender of failing shards immediately (via a 
different channel) to enable quick retries, or should we accumulate
failures and return them in the final response?

2. What is the maximum number of inflight requests we should allow on 
the sending side?

This PR considers failures often occurring when the cluster is under 
load or during a rolling upgrade. To prevent retries from adding more
load and to allow the cluster to stabilize, this PR chooses to send
shard failures in the final response and limits the number of inflight
requests to one per data node
2025-02-05 19:01:19 -08:00
Armin Braun
59631fdcb0
Remove redundant list copy in CanMatchNodeRequest (#121700)
We're not mutating that list ever, so lets just use an immutable list
all the way here and avoid at least one round of needless copy.
2025-02-06 03:50:32 +01:00
Yang Wang
6500ebeff6 Fix tests 2025-02-06 13:07:47 +11:00
Niels Bauman
fa3d548c9d
Fix transport serialization of EnrichStatsAction.Request (#121735)
In #121256, we changed the superclass of the request to
`LocalClusterStateRequest` to make the action run on the local node
instead of the master node. Most of the actions that have been updated
thusfar to run on the local node used to extend `MasterNodeReadRequest`
and thus serialized a `local` field. This request class, however,
extended `MasterNodeRequest`, meaning that it didn't serialize that
field.
2025-02-06 02:20:32 +01:00
Patrick Doyle
ba343c157b
Improved PolicyManager error reporting (#121824)
* Report componentName in ModuleEntitlements.

This lets us produce error messages that guide the user to add the right
entitlement to the right plugin/server/etc.

* Include component names in errors and logs

* Name APM agent specifically.

Avoids confusion with the entitlements agent.

* Entitlement component names package private

* [CI] Auto commit changes from spotless

---------

Co-authored-by: elasticsearchmachine <infra-root+elasticsearchmachine@elastic.co>
2025-02-06 00:58:36 +01:00
Jordan Powers
e3e474c337
Copy metrics and default_metric properties when downsampling aggregate_metric_double (#121727)
Fixes #119696 and #96076
2025-02-06 00:32:14 +01:00
Mark Vieira
56cac1bfe9
Don't attempt to install modules into test cluster more than once (#121833) 2025-02-06 00:15:16 +01:00
Yang Wang
38d74f7408 Merge main into multi-project 2025-02-06 10:04:49 +11:00
Ryan Ernst
0cf42f2388
Rename environment dir accessors (#121803)
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-05 14:03:28 -08:00
Nik Everett
1e12b547ca
ESQL: Fix a bug in TOP (#121552)
Fix a bug in TOP which surfaces when merging results from ordinals. We
weren't always accounting for oversized arrays when checking if we'd
ever seen a field. This changes the oversize itself to always size on a bucket boundary.

The test for this required random `bucketSize` - without that the
oversizing frequently wouldn't cause trouble.
2025-02-05 16:28:09 -05:00
Nik Everett
85da28d919
ESQL: Grow heap attack tests (#121714)
This causes the ESQL heap attack tests to grow their memory usage if
they first don't cause a circuit breaking exception. It just tries again
with more data. That's slow, but it should stop this from failing quite
as much. And it'll give us even more information about failures.

Closes #121465
2025-02-05 21:47:45 +01:00
elasticsearchmachine
764e6eb1a5 Mute org.elasticsearch.transport.InboundHandlerTests testLogsSlowInboundProcessing #121816 2025-02-06 07:43:08 +11:00
Nik Everett
77f8558d0b
ESQL: Add description to status and profile (#121783)
This adds a `task_description` field to `profile` output and task
`status`. This looks like:
```
...
  "profile" : {
    "drivers" : [
      {
        "task_description" : "final",
        "start_millis" : 1738768795349,
        "stop_millis" : 1738768795405,
...
        "task_description" : "node_reduce",
        "start_millis" : 1738768795392,
        "stop_millis" : 1738768795406,
...
        "task_description" : "data",
        "start_millis" : 1738768795391,
        "stop_millis" : 1738768795404,
...
```

Previously you had to look at the signature of the operators in the
driver to figure out what the driver is *doing*. You had to know enough
about how ESQL works to guess. Now you can look at this description to
see what the server *thinks* it is doing. No more manual classification.

This will be useful when debugging failures and performance regressions
because it is much easier to use `jq` to group on it:
```
| jq '.profile[] | group_by(.task_description)[]'
```
2025-02-05 21:25:48 +01:00
Mayya Sharipova
5a5683215e
Analyze API to return 400 for wrong custom analyzer (#121568)
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 07:24:13 +11:00
Parker Timmins
0f6b80a98f
Fix tests broken because future not completed during cleanup (#121782)
A future.actionGet was missing from the delete pipeline action execution in the test cleanup, causing all tests to fail intermittently. Also replace actionGet with safeGet.
2025-02-05 21:19:42 +01:00
Armin Braun
95e4907cc8
Remvoe some more dead code from o.e.search.aggregations (#121498)
Just some obvious dead code removal.
2025-02-05 21:08:28 +01:00
Armin Braun
229d89d343
Remove GroupShardsIterator and replace it with plain List (#116891)
There is no point in having `GroupShardsIterator`, it's mostly an
unnecessary layer of indirection as it has no state and a single field
only. It's only value could be seen in it hiding the ability to mutate
the list it wraps, but that hardly justifies the overhead on the search
path and extra code complexity. Moreover, the list it references is not
copied/immutable in any way, so the value of hiding is limited also.
2025-02-05 21:08:00 +01:00
Patrick Doyle
c1deef4467
Entitlement policies correct handling of prefixes that are not directories (#121598)
* Fix FileAccessTree for prefixes that aren't parents

* Support backslashes

* Whoops, nio

* Move normalization responsibility to FileEntitlement

* Normalize to native separators

* Avoid forbidden API
2025-02-05 20:04:43 +01:00
David Turner
5302589639
Validate transport handshake from known version (#121747)
With parallel releases on multiple branches it's possible that an older
branch sees a transport version update that is not known to a
numerically newer but chronologically older version. In that case the
two nodes cannot intercommunicate, so with this commit we reject such
connection attempts at the version negotiation stage.
2025-02-06 04:46:36 +11:00
Jack Conradson
534e171275
Update policy parser to allow static methods for entitlement creation (#121706)
This updates the PolicyParser to allow static methods to have an ExternalEntitlement annotation. This 
removes a limitation where constructors cannot properly support type-erasure with different types of 
data structures for internal entitlement generation and external entitlement generation (for example 
List<Object> from the parser and List<SomeData> from an internal builder). We continue to enforce 
that only one constructor/method may be annotated with ExternalEntitlement per Entitlement class.
2025-02-05 08:57:12 -08:00
Oleksandr Kolomiiets
2ad64e18f4
Fix synthetic source issue with deeply nested ignored source fields (#121715)
* Fix synthetic source issue with deeply nested ignored source fields

* Update docs/changelog/121715.yaml
2025-02-05 08:21:59 -08:00
Ryan Ernst
5ab175ebc1
Move spi and system actions into separate classes (#121555)
This commit moves methods used to test spi and system actions out of
RestEntitlementsCheckAction into separate classes, to ease future
merges.
2025-02-05 16:37:02 +01:00
Pat Whelan
c8053d4aca
[ML] Skip Usage stats update when ML is disabled (#121559)
Do not call ML's GetDeploymentStatsAction API when ML is disabled in the cluster, instead return the inference configurations as-is.

Fix #121532
2025-02-05 15:49:40 +01:00
Artem Prigoda
885a5510e1
Don't return or accept node_version in the Desired Nodes API (#119049)
Re-submission of #114580

>  node_version was deprecated in #104209 (8.13) and shouldn't be set or returned in 9.0

Resolve ES-9443
2025-02-05 15:41:47 +01:00
elasticsearchmachine
b440e06c85 Mute org.elasticsearch.xpack.migrate.action.ReindexDatastreamIndexTransportActionIT org.elasticsearch.xpack.migrate.action.ReindexDatastreamIndexTransportActionIT #121737 2025-02-06 01:41:19 +11:00
Pat Whelan
ad00113f23
[ML] Change format for Unified Chat error responses (#121396)
Unified Chat Completion error responses now forward code, type, and
param to in the response payload. `reason` has been renamed to
`message`.

Notes:
- `XContentFormattedException` is a `ChunkedToXContent` so that the REST listener can call `toXContentChunked` to format the output structure.  By default, the structure forwards to our existing ES exception structure.
- `UnifiedChatCompletionException` will override the structure to match the new unified format.
- The Rest, Transport, and Stream handlers all check the exception to verify it is a UnifiedChatCompletionException.
- OpenAI response handler now reads all the fields in the error message and forwards them to the user.
- In the event that a `Throwable` is a `Error`, we rethrow it on another thread so the JVM can catch and handle it.  We also stop surfacing the JVM details to the user in the error message (but it's still logged for debugging purposes).
2025-02-05 15:41:00 +01:00
Artem Prigoda
62f0fe869a
Remove the failures field from snapshot responses (#114496)
Failure handling for snapshots was made stricter in #107191 (8.15), so this field is always empty since then. Clients don't need to check it anymore for failure handling, we can remove it from API responses in 9.0
2025-02-05 15:35:38 +01:00
elasticsearchmachine
5c147899d2 Mute org.elasticsearch.xpack.esql.qa.multi_node.EsqlSpecIT org.elasticsearch.xpack.esql.qa.multi_node.EsqlSpecIT #121411 2025-02-06 01:16:07 +11:00
elastic-renovate-prod[bot]
5728a7210b
Migrate config renovate.json (#121759)
The Renovate config in this repository needs migrating. Typically this
is because one or more configuration options you are using have been
renamed.

You don't need to merge this PR right away, because Renovate will
continue to migrate these fields internally each time it runs. But later
some of these fields may be fully deprecated and the migrations removed.
So it's a good idea to merge this migration PR soon. 

🔕 **Ignore**: Close this PR and you won't be reminded about config
migration again, but one day your current config may no longer be valid.

 Got questions? Does something look wrong to you? Please don't hesitate
to [request help
here](https://redirect.github.com/renovatebot/renovate/discussions).

---

This PR has been generated by [Renovate
Bot](https://redirect.github.com/renovatebot/renovate).
2025-02-06 01:10:15 +11:00
Artem Prigoda
94d7f22a2a
Simplify TransportStats assertions in v9 (#114700)
Transport handling times were added in #80581 (8.1), we don't need assertions for version prior to that in 9.0
2025-02-05 14:16:04 +01:00
Salvatore Campagna
6a526755de
Use synthetic recovery source by default if synthetic source is enabled (#119110)
We experimented with using synthetic source for recovery and observed quite positive impact
on indexing throughput by means of our nightly Rally benchmarks. As a result, here we enable
it by default when synthetic source is used. To be more precise, if `index.mapping.source.mode`
setting is `synthetic` we enable recovery source by means of synthetic source.

Moreover, enabling synthetic source recovery is done behind a feature flag. That would allow us 
to enable it in snapshot builds which in turn will allow us to see performance results in Rally nightly
benchmarks.
2025-02-05 13:55:51 +01:00
David Turner
09bc343aab
Migrate to v9 transport handshake (#121646)
This commit moves to sending out a v9-format handshake (with apparent
transport version `8_800_00_0`) and drops support for handshakes from v7
nodes.
2025-02-05 12:06:03 +00:00
Armin Braun
e4fd6c06ae
Simplify counting in AbstractSearchAsyncAction (#120593)
No need to do this so complicated, just count down one when we're actually done with a specific shard id.
2025-02-05 11:56:29 +01:00
Ievgen Degtiarenko
e5ea00a185
Remove combineValueCount from code generation (#121637)
`combineValueCount` is described as something that might no longer be needed and has zero actual usages. Removing it in order to simplify code generation.
2025-02-05 07:56:57 +01:00
Niels Bauman
a9f157cf79 Unmute set_security_user processor tests (MP-1943) 2025-02-05 15:27:50 +10:00
Yang Wang
4afa8ba62b Pass boolean supplier for supportsMultipleProjects (MP-1944)
Stateless has a subclass for PersistedClusterStateService which needs to
know the value of supportsMultipleProjects. Due to how a node is
initialized, the value is not known until the plugin components are
created which is after the stateless service is created. Therefore this
PR changes the parameter from boolean to a booleanSupplier so that it
can be resolved later when actually used.

The alternative is to change the PersistedClusterStateServiceFactory
interface so it takes a projectResolver or boolean
supportsMultipleProjects. I prefer to not change the interface. The
creation of Stateless PersistedClusterStateService already uses two
other suppliers so that it feels more aligned to use a boolean supplier.
The other reason is that supportsMultipleProjects may not be needed in
long term so it is better to not have it in an interface.

Relates: MP-1880
2025-02-05 16:19:34 +11:00
Yang Wang
77112d911c Merge main into multi-project
Merge main into multi-project
2025-02-05 12:58:12 +11:00
Yang Wang
0e5946a4a0 fix compilation 2025-02-05 11:46:20 +11:00
Yang Wang
caa43535b5
Assert for no duplicate persistent task executor (#120984)
The same persistent task name should not be registered twice with
different executors. This PR adds an assertion for it.

Relates: ES-10533
2025-02-05 11:42:37 +11:00
Oleksandr Kolomiiets
e885da1e94
Introduce FallbackSyntheticSourceBlockLoader and apply it to keyword fields (#119546) 2025-02-04 16:13:20 -08:00
Yang Wang
fee57daf53 Merge main into multi-project 2025-02-05 11:03:29 +11:00
Parker Timmins
29965bccf0
Add pipeline to clean docs during data stream reindex (#121617)
Add the pipeline "reindex-data-stream-pipeline" to the reindex request within ReindexDataStreamIndexAction. This cleans up documents as needed before inserting into the destination index. Currently, the pipeline only sets a timestamp field with a value of 0, if the document is missing a timestamp field. This is needed because existing indices which are added to a data stream may not contain a timestamp, but reindex validates that a timestamp field exists when creating data stream destination indices.
This pipeline is managed by ES, but can be overriden by users if necessary. To do this, the version field of the pipeline should be set to a value higher than the MigrateRegistry version.
2025-02-04 17:59:21 -06:00
Mark Vieira
0c667ecd2a
Fix thirdPartyAudit task when running on Java 24 (#121712)
We need to explicitly add the incubating vector API module to the third
party audit task on Java 24.
2025-02-05 10:30:08 +11:00
Ryan Ernst
6389dfc2e7
Sort groups of instrumented methods (#121616)
Instrumented methods in EntitlementChecker are loosely grouped by the
associated entitlement. This commit sorts the methods within groups to
allow more clear placement of additional instrumented methods.
2025-02-04 15:27:29 -08:00
Benjamin Trent
2de1a3defe
Addressing int4 flat flakiness (#121437)
This simplifies the setup and relaxes the similarity check. 

We can restrict the similarity check once we evolve the quantization
algorithm in the future.
2025-02-05 09:34:26 +11:00
Nhat Nguyen
c1a32f6184
Unmute EsqlNodeFailureIT (#121707)
Closes #118000
2025-02-05 08:21:41 +11:00
Jordan Powers
061920b585
Counted keyword randomized testing (#121462)
This patch adds the needed data generator and source matcher to include 
counted_keyword fields in our randomized testing.

This patch also updates the source matcher such that field-specific 
matchers are checked before the generic matcher is used. It seems that 
this is the correct behavior, and the only reason the generic matcher was
checked first was as a workaround for issue #111916, which is now closed.
2025-02-04 13:06:26 -08:00
Ryan Ernst
21218c3a69
Add classifier to version specific jar artifacts (#121083)
The mrjar plugin produces artifacts for each java version that may be
consumed downstream. This commit fixes an issue with gradle dependencies
when multiple java versions are depended on.
2025-02-04 20:47:11 +01:00
James Baiera
59fc3834fd
Return failure store status on ingest failures for data streams without failure store enabled (#121544)
Updates the on failure handler to accept the additional context required to report to the client whether 
or not the document could have been rerouted if failure store was enabled.

---------

Co-authored-by: elasticsearchmachine <infra-root+elasticsearchmachine@elastic.co>
2025-02-04 14:16:26 -05:00
Larisa Motova
af213a5f89
Rename AggregateDoubleMetric to *MetricDouble (#121254)
Some areas of the code call this field type
AggregateDoubleMetric and others AggregateMetricDouble, but the docs
use aggregate_metric_double, so for consistency this commit refactors
the former into the latter.
2025-02-04 08:56:04 -10:00
Ryan Ernst
f77201fb12
Fix compilation of custom auth engine example (#121089) 2025-02-04 19:34:41 +01:00
Armin Braun
a21b984561
Fix SearchResponse leak in CrossClusterSearchUnavailableClusterIT (#121681)
Fixing an obvious leak where we fail to count down 1 for a new search
response.
2025-02-04 19:30:45 +01:00
Jordan Powers
13b743c39b
Fix counted_keyword support in arrays of objects (#121558)
As a result of the randomized testing enabled in #121462, we found that
we currently fail to parse documents with arrays of objects containing
counted_keyword fields. This PR fixes this issue by using a custom
docvalues field to store the count instead of the built-in lucene
BinaryDocValues. This custom CountsBinaryDocValuesField has logic to
handle multiple values for the same field.
2025-02-04 19:11:14 +01:00
Nhat Nguyen
9b6af6a306
Clean up exchanges in EsqlNodeFailureIT (#121633)
If the query hits the failing index first, we will cancel the request,
preventing exchange-sink requests and data-node requests from reaching
another data node. As a result, exchange sinks could stay for 30
seconds.
2025-02-05 04:32:21 +11:00
Ryan Ernst
04c04ccd19
re-mute HeapAttackIT.testLookupExplosionBigStringManyMatches
relates https://github.com/elastic/elasticsearch/issues/121465
2025-02-04 09:24:38 -08:00
Fang Xing
f58fdf81e9
[ES|QL] Change function_named_parameters in Kibana doc to expected format (#121585)
* change function_named_parameters in kibana doc to expected format
2025-02-04 12:20:34 -05:00
Christoph Büscher
0af4646052
Fix rare failures in YAML xContent roundtrip tests (#121515)
Under very unfortunate conditions tests that check xContent objects
roundtrip parsing  (like i.e. SearchHitsTests#testFromXContent)
can fail when we happen to randomly pick YAML xContent type and create
random (realistic)Unicode character sequences that may contain the
character U+0085 (133) from the Latin1 code page. That specific character
doesn't get parsed back to its original form for YAML xContent, which can 
lead to rare but hard to diagnose test failures.

This change adds logic to AbstractXContentTestCase#test() which lies at
the core of most of our  xContent roundtrip tests that disallows test
instances containing that particular character  when using YAML xContent
type.

Closes #97716
2025-02-04 18:16:43 +01:00
Keith Massey
c77afd8f54
Fail the reindex data stream task if any document fails to reindex (#121591) 2025-02-04 09:36:26 -06:00
elasticsearchmachine
9122e668be Mute org.elasticsearch.xpack.esql.action.CrossClusterAsyncQueryStopIT testStopQueryLocal #121672 2025-02-05 02:04:22 +11:00
Tim Grein
ac34cad1a3
[Inference API] Fix node local rate limit calculator tests for non-snapshot builds (#121527) 2025-02-04 16:03:21 +01:00
Jonathan Buttner
7f284d3533
[ML] Remove tasktype any from supportedStreamingTasks (#121460)
* Refactoring supported streaming functionality

* Moving always retrying handler to the tests

* Fixing comment
2025-02-04 09:45:31 -05:00
Iván Cea Fontenla
4541b12738
ESQL: Fix AggregatorFunctionSupplierImplementer warnings import (#121654)
Extracted from https://github.com/elastic/elasticsearch/pull/116170/files#diff-d8dcb5e856b601ac28b3dc0055e09d5c815d2577705eade446bd55b2fca42ac7R145

Those warnings are not being used in main yet, so there's no error, and that code wasn't being executed. But it better be fixed in main already
2025-02-04 15:20:17 +01:00
Ryan Ernst
1587556e97
Mute org.elasticsearch.search.CrossClusterSearchUnavailableClusterIT.testSearchSkipUnavailable
relates https://github.com/elastic/elasticsearch/issues/121497
2025-02-04 06:18:38 -08:00
Slobodan Adamović
d1beb01d27
Disable queryable built-in roles feature for core and datastream YAML tests (#121541)
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
2025-02-04 14:38:36 +01:00
Lorenzo Dematté
fdbd079bb0
[Entitlements] Fix Entitlement initialization to work across multiple versions (#121192) 2025-02-04 14:32:04 +01:00
Luigi Dell'Aquila
8886594769
Unmute docs.testFilterToday JDBC test (#121509)
Fixes: https://github.com/elastic/elasticsearch/issues/121474

Fixed by https://github.com/elastic/elasticsearch/pull/121504
2025-02-05 00:12:56 +11:00
Niels Bauman
f49db26e4b Unmute split API YAML tests (MP-1937) 2025-02-04 13:00:53 +01:00
Christoph Büscher
954db370ef
Add migration test for .async-search system index (#121517)
This change adds migration testing for the ".async-search" system index
to the full cluster upgrade tests that perform updates from versions N-2
to N via N-1.
The test creates a system index by using async_search on a cluster with
version N-2, then calls the "_migrate" API in version N-1 and finally
checks that on the upgraded cluster in N we are still able to retrieve
async search results from previous versions and can still write to the
system index. This is necessary to ensure we don't end up with a
write-only async search system index when migrating to version 9.
2025-02-04 11:54:27 +01:00
Niels Bauman
2e1d84b2fc Make index block API project aware (MP-1936) 2025-02-04 11:40:20 +01:00
Pooya Salehi
0cd3ff5967
Fix AllocationFailuresResetOnShutdownIT#testResetAllocationFailuresOnNodeShutdown (#121378)
The ITs assumes that `ensureRed` means we've exhausted all the attempts for allocation, which doesn't hold always. 

Closes https://github.com/elastic/elasticsearch/issues/121129
2025-02-04 11:03:39 +01:00
elasticsearchmachine
12a71666f6 Mute org.elasticsearch.upgrades.UpgradeClusterClientYamlTestSuiteIT test {p0=mixed_cluster/110_enrich/Enrich stats query smoke test for mixed cluster} #121642 2025-02-04 20:57:20 +11:00
Mary Gouseti
95c9b4b855
DeprecationInfoAction refactoring (#121181)
This refactoring was motivated by the following issues with the current
state of the code:

- The `TransformDeprecationChecker` is listed as plugin checker, but later we remove is from the `plugin_settings` and add it to the `cluster_settings`. This made me consider that the checker might be dealing with transform deprecation warnings but if they are listed under the `cliuster_settings`, it fits better to be part of `ClusterDeprecationChecker`.
- The `DeprecationInfo` is a data class, but it has a method `from` which constructs an `DeprecationInfo.Response` instance. However, this is not a simple factory class but it actually runs all the checks and it also tries to assert that it is not executed on a transport thread. Considering this, I thought it might fit better to the `TransportDeprecationInfoAction`, this way all the logic is in one place and all the checkers are wired and used in the same class.
- Constructing the node settings deprecation issues requires to merge the deprecation warnings of the individual nodes. We considered bringing together the execution of the remote request and the construction of the response in a new class called `NodeDeprecationChecker` that resembles the patterns of the other Checker classes.
- Reinstated the `PLUGIN_CHECKERS` even if we have only one check, so other developers can easier add their plugin checks.
- Finally, we noticed that the way we synthesise the remote requests is difficult to read and maintain because each call is nested under the previous one. We propose in this PR a different pattern that uses the `RefCountingListener` to combine the different remote calls and store their results in a container class named `PrecomputedData`
- **Bonus**: Removed the `LegacyIndexTemplateDeprecationChecker.java` which was not used.
2025-02-04 19:48:17 +11:00
Yang Wang
0f7ccded13 Merge main and fix mapping deletion on persist
This PR is a combination of MP-1935 and MP-1880 plus a few other changes to make tests pass, all needed for a green CI.
2025-02-04 19:41:13 +11:00
Tanguy Leroux
8502e5b3f0
Use InMemoryNoOpCommitDirectory for archives indices only (#121210)
Since #118606 searchable snapshots shards are not expected to 
write files on disk, with the exception of archives indices mounted 
as searchable snapshots which require to rewrite the segment infos 
file in a newer version.

Ideally we should be able to remove the usage of the 
InMemoryNoOpCommitDirectory for non-archives searchable 
snapshots indices and only rely on SearchableSnapshotDirectory 
that throws on write operations. Similarly, starting 9.0 searchable 
snapshots shards do not write files on disk and therefore should 
be able to use a Directory implementation that forbids writes. 
Searchable snapshots shards for indices created before 9.0 
require a mutable directory for peer-recoveries.

In this change, we only allow writes for archives indices and 
searchable snapshots created before 9.0.

Relates ES-10438
2025-02-04 09:35:08 +01:00
Ievgen Degtiarenko
1378b59d21
replace tuples with named parameters in AggregateMapper (#121542) 2025-02-04 09:05:38 +01:00
Niels Bauman
7834e11fcc Merge main into multi-project 2025-02-04 17:30:03 +10:00
Niels Bauman
bac1b7bfc8 Mute ESQL downsample test for MP 2025-02-04 17:27:04 +10:00
Francisco Fernández Castaño
30a706a80d
Revert "Remove INDEX_REFRESH_BLOCK after index becomes searchable (#120807)" (#121427)
This reverts commit ae0f1a64b5.

The refresh block would be removed in a subsequent cluster state
update instead of removing it immediately after an index is ready
for searches.

Closes ES-10697
2025-02-04 08:08:38 +01:00
Yang Wang
cf4a0ae117 Remember project creation status across tests
We want to create and delete projects only once around the entire YAML
test suite. Therefore the project creation status needs to be remembered
across tests. This commit changes the field to be static. It also moves
initialization of projectIds to be static.
2025-02-04 17:36:59 +11:00
elasticsearchmachine
c570950d48 Mute org.elasticsearch.xpack.esql.action.CrossClustersCancellationIT testCancelSkipUnavailable #121631 2025-02-04 17:30:42 +11:00
elasticsearchmachine
1b7518d578 Mute org.elasticsearch.xpack.esql.action.CrossClustersCancellationIT testCancel #121632 2025-02-04 17:30:36 +11:00
Yang Wang
1b1e81a113 Use the known project in ClusterInfoSimulator.simulateShardStarted
Replace getProject call with the actual project resolved earlier.
2025-02-04 16:48:31 +11:00
elasticsearchmachine
feba92deb7 Mute org.elasticsearch.xpack.esql.action.CrossClustersCancellationIT testCloseSkipUnavailable #121627 2025-02-04 16:47:04 +11:00
elasticsearchmachine
1758598edb Mute org.elasticsearch.xpack.esql.action.CrossClustersCancellationIT testTasks #121626 2025-02-04 16:46:56 +11:00
Yang Wang
d1965ca779 Fix transport version for multi-project 2025-02-04 14:48:11 +10:00
Yang Wang
fb6e142e86 Take project into account when deleting unused mappingHash
Indices from different projects could have identical mappings and hence
identical mapping hash. The unused mapping hashes are computed for a
project scope. Hence the deletion must also be project-scoped to not
deleting mapping hashes on a different project.

Resolves: ES-10568
2025-02-04 14:48:11 +10:00
Niels Bauman
4cf484e978 Disable queryable built-in roles feature for MP core YAML tests 2025-02-04 14:48:11 +10:00
Niels Bauman
ad683c3e17 Allow security index in default project after REST test 2025-02-04 14:48:08 +10:00
Nhat Nguyen
6685736408
Fix relocation targets in FieldCapabilitiesIT (#121606)
The test failed because we tried to move a shard to a node that already 
has a copy. This change prevents that from happening.

Closes #119280
Closes #120772
2025-02-03 20:17:41 -08:00
Niels Bauman
7b430dd050 Make system index cleanup project-aware 2025-02-04 13:32:21 +10:00
Niels Bauman
055086a160 Bump multi-project transport version 2025-02-04 11:20:13 +10:00
Niels Bauman
a15932159a Merge remote-tracking branch 'public/main' into merge-main 2025-02-04 11:19:42 +10:00
Nhat Nguyen
ed128339b0
Unwrap failure in testCancelRequestWhenFailingFetchingPages (#121597)
The thrown exception may be wrapped in an ExecutionException; therefore, 
we need to unwrap it before verification.

Closes #121596
Closes #118193
2025-02-03 16:25:13 -08:00
Nhat Nguyen
5e5079362f
Wait for exchange source to complete before verifying results (#121603)
Closes #118732
2025-02-03 16:24:41 -08:00
Niels Bauman
e27a50dead
Run TransportEnrichStatsAction on local node (#121256)
This action solely needs the cluster state, it can run on any node.
Additionally, it needs to be cancellable to avoid doing unnecessary work
after a client failure or timeout.
2025-02-04 09:30:44 +10:00
Nhat Nguyen
c717e78e0f
Fix ClusterRequestTests (#121570)
The upper bound of randomVersionBetween is inclusive; therefore, for 
testing the fallback version of the request, we need to use the version
preceding 8.16.0 rather than 8.16.0 itself.

Closes #117937
2025-02-04 10:29:54 +11:00
Stanislav Malyshev
2fbec77015
Implement runtime skip_unavailable=true (#121240)
* Implement runtime skip_unavailable=true
2025-02-03 15:47:59 -07:00
Luke Whiting
b559607a94
Various Datastream Reindex Fixes (#121376)
* Fix incorrect value of reindex_required flag on ignored index warning
* Datastream reindex now uses unverified write block to allow retrying failed reindex
2025-02-03 16:45:46 -06:00
Keith Massey
01efd5edea
Passing parent task id to the refresh request within reindex data streams (#121533) 2025-02-03 16:25:42 -06:00
Nik Everett
78a9d7b478
ESQL: Reenable another heap attack (#121572)
This one was disabled by a long-closed issue.
2025-02-04 08:58:51 +11:00
Ying Mao
fab2423865
Adding patch transport version (#121560) 2025-02-03 16:29:04 -05:00
elasticsearchmachine
542d293395 Mute org.elasticsearch.xpack.esql.action.CrossClusterQueryUnavailableRemotesIT testRemoteOnlyCCSAgainstDisconnectedRemoteWithSkipUnavailableTrue #121578 2025-02-04 08:28:45 +11:00
Nik Everett
50d76c205f
ESQL: Reenable heap attacks (#121565)
Reenables some heap attack tests, bumping their memory requirements to
try and force a failure on all CI machines. Previously some CI machines
weren't failing, invalidating the test on those machines.

Close #121481 Close #121465
2025-02-04 08:02:30 +11:00
Mike Pellegrini
d23699f827
Enable New Semantic Text Format Only On Newly Created Indices (#121556) 2025-02-03 15:56:43 -05:00
Carson Ip
f3f5135f06
Add missing apm-server tail sampling monitoring metrics to stack monitoring mapping (#121543)
Add missing apm-server tail sampling monitoring metrics to stack monitoring mapping. They were missed in #110568.
2025-02-03 20:40:52 +00:00
Stanislav Malyshev
dbf15393a7
Refactor CCS tests (#121547)
* Refactor CCS tests

Clean up duplication, move stop tests to separate test
2025-02-03 13:33:02 -07:00
Patrick Doyle
cc6e84ecd0
Remove entitlement reflection ITs. (#121550)
This is best tested in unit tests, not REST actions.
2025-02-03 20:25:11 +01:00
Andrei Dan
44e5104af1
[TEST] wait for all active shards when indexing data (#121442)
This attempts to fix a flay test where the term_freq returned by the
multiple terms vectors API was `null`. I was not able to reproduce this
test but this proposes a fix based on the following running theory: - an
Elasticsearch cluster comprised of at least 2 nodes - we create a couple
of indices with 1 primary and 1 replica - we index a document that was
acknowledged only by the primary (because `wait_for_active_shards`
defaults to `1`) - the test executes the multiple terms vectors API and
it hits the node hosting the replica shard, which hasn't yet received
the document we ingested in the primary shard.

This race condition between the document replication and the test
running the terms vectors API on the replica shard could yield a `null`
value for the the term's `term_freq` (as the replica shard contains 0
documents).

This PR proposes we change the `wait_for_active_shards` value to `all`
so each write is acknowledged by all replicas before the client receives
the response.

Fixes #113325
2025-02-04 05:57:05 +11:00
Ying Mao
89d71e1f6c
Adding support for binary embedding type to Cohere service embedding type (#120751)
* Adding support for binary embedding type to Cohere service embedding type

* Returning response in separate text_embedding_bits field

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

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

* Update docs/changelog/120751.yaml

* Reverting docs change

---------

Co-authored-by: David Kyle <david.kyle@elastic.co>
2025-02-03 13:55:31 -05:00
Mark Vieira
92d1d31eea
Add Java 24 to testing matrix 2025-02-03 09:59:20 -08:00
Nik Everett
bb67a7c4ab
GEO: Comment that we are not removing warning (#121459)
Change the warning message when you send a multifield under a geo field.
We *still* ignore the multifields but we do not plan to remove them. It
isn't worth breaking anyone.
2025-02-03 18:15:59 +01:00
Dianna Hohensee
623a6afd12
Introduce AllocationBalancingRoundSummaryService (#120957)
This service is added to the desired balance allocator to track and
report on balancer round activity. It is a WIP and currently only
tracks the number of shard moves caused by a balancing round.
Reporting balancer round summary results will provide information
with which to do cost-benefit analyses of the work that shard
allocation rebalancing executes. It is disabled by default.

Relates ES-10341
2025-02-03 10:31:21 -05:00
Patrick Doyle
aa28d84792
Fix PolicyManager: plugin resolver overrides agent (#121456) 2025-02-03 16:10:01 +01:00
elasticsearchmachine
274fb738a1 Mute org.elasticsearch.xpack.security.CoreWithSecurityClientYamlTestSuiteIT test {yaml=snapshot.create/10_basic/Create a snapshot for missing index} #121536 2025-02-04 01:52:42 +11:00
Simon Cooper
c288684fdb
Use NavigableSet for representing test version sets, rather than List (#121266) 2025-02-03 14:01:57 +00:00
Simon Cooper
68c8fa6b38
Update transport and index version id numbers to S_PP (#121380)
We need more patch numbers for longer-lived branches
2025-02-03 11:10:58 +00:00
Tanguy Leroux
106b66682e
[Test] Remove ASYNC translog durability in N-2 bwc upgrade tests (#121278)
When adding support for upgrading closed indices in 
N-2 version, I randomized the Translog.Durability setting 
of the closed index with the aim to test the 2 phases 
closing process.

This caused at least 1 test failure on Windows with the 
index being closed and the cluster upgraded before the 
synchronization of the translog had a chance to be 
executed. I think this cause the engine to be reset on 
the replica that is promoted as a primary, causing the 
loss of the operations that were not yet persisted.

Closes #121257
2025-02-03 12:05:30 +01:00
Niels Bauman
1b342b26ef Merge main into multi-project 2025-02-03 21:03:58 +10:00
Christoph Büscher
85f5222d69 Revert "WIP (#121463)"
This reverts commit fd1bd79b85.
PR was merged by a mistake, still needs to get reviewed.
2025-02-03 10:58:41 +01:00
Simon Cooper
c8b6d2fe65
Create transport version for 9.0 release (#120936)
Also bump the minimum compatible version to something similar to what 8.18 will be
2025-02-03 09:53:38 +00:00
elasticsearchmachine
3200c06011 Mute org.elasticsearch.xpack.security.CoreWithSecurityClientYamlTestSuiteIT test {yaml=cat.aliases/10_basic/Complex alias} #121513 2025-02-03 20:53:04 +11:00
Luca Cavanna
487b217afe
Remove ServerlessScope annotation from RestGraphAction (#120789) 2025-02-03 10:27:19 +01:00
Kostas Krikellas
541c94160f
Unmute TSDBPassthroughIndexingIT (#121505) 2025-02-03 11:25:25 +02:00
Luigi Dell'Aquila
befc5783b7
Fix docs.testFilterToday JDBC test (#121504) 2025-02-03 10:20:24 +01:00
Ievgen Degtiarenko
1058df407f
Add expectThrows with messageMatcher (#120290) 2025-02-03 10:14:49 +01:00
elasticsearchmachine
10a6f27282 Mute org.elasticsearch.xpack.ml.integration.ClassificationIT testDependentVariableIsAliasToKeyword #121492 2025-02-03 16:56:24 +11:00
elasticsearchmachine
406b4a3dcd Mute org.elasticsearch.xpack.inference.common.InferenceServiceNodeLocalRateLimitCalculatorTests org.elasticsearch.xpack.inference.common.InferenceServiceNodeLocalRateLimitCalculatorTests #121294 2025-02-03 09:22:33 +11:00
elasticsearchmachine
d8b764c0a5 Mute org.elasticsearch.backwards.MixedClusterClientYamlTestSuiteIT test {p0=search.vectors/42_knn_search_int4_flat/Vector similarity with filter only} #121412 2025-02-03 09:04:14 +11:00
Nhat Nguyen
25c300a1e1
Unmute EsqlSpecIT for more logging (#121500)
Tracked at #121411
2025-02-03 08:08:04 +11:00
elasticsearchmachine
e7c1ee1a70 Mute org.elasticsearch.xpack.esql.qa.multi_node.EsqlSpecIT org.elasticsearch.xpack.esql.qa.multi_node.EsqlSpecIT #121411 2025-02-03 02:44:06 +11:00
elasticsearchmachine
7743380509 Mute org.elasticsearch.xpack.security.CoreWithSecurityClientYamlTestSuiteIT test {yaml=cat.aliases/40_hidden/Test cat aliases output with a visible index with a hidden alias} #121128 2025-02-03 01:41:41 +11:00
elasticsearchmachine
7eeb908d88 Mute org.elasticsearch.xpack.core.ilm.SetSingleNodeAllocateStepTests testPerformActionSomeShardsOnlyOnNewNodesButNewNodesInvalidAttrs #121495 2025-02-03 01:02:35 +11:00
Gal Lalouche
2838dbb98e
ESQL: Support for _index metadata field in CsvTests (#121261)
* ESQL: Support for _index metadata field in CsvTests

* Extract INDEX constant to MetadataAttribute

* Add comment on capability
2025-02-02 14:56:22 +02:00
Gal Lalouche
f5a3de7ef8
ESQL: Even more test type error testing movements (#121321)
* Multivalue error tests

* Date error tests

* Spatial error tests

* String error tests

* Aggregate error tests

* Remove deprecated AbstractScalarFunction checks

* Rename DefaultChecks test in AbstractAggregation

* [CI] Auto commit changes from spotless

---------

Co-authored-by: elasticsearchmachine <infra-root+elasticsearchmachine@elastic.co>
2025-02-02 14:56:02 +02:00
elasticsearchmachine
10fe2d724a Mute org.elasticsearch.ingest.geoip.FullClusterRestartIT testGeoIpSystemFeaturesMigration {cluster=UPGRADED} #121115 2025-02-02 17:40:14 +11:00
elasticsearchmachine
2b6b7da190 Mute org.elasticsearch.xpack.security.profile.ProfileIntegTests testSuggestProfileWithData #121258 2025-02-02 17:36:16 +11:00
elasticsearchmachine
543fa00e62 Mute org.elasticsearch.xpack.sql.qa.single_node.JdbcDocCsvSpecIT test {docs.testFilterToday} #121474 2025-02-02 16:39:07 +11:00
elasticsearchmachine
edcec6207d Mute org.elasticsearch.xpack.security.profile.ProfileIntegTests testSuggestProfilesWithHint #121116 2025-02-02 09:48:24 +11:00
elasticsearchmachine
6c9e64e014 Mute org.elasticsearch.xpack.esql.action.CrossClusterAsyncQueryIT testAsyncQueriesWithLimit0 #121489 2025-02-02 09:15:30 +11:00
elasticsearchmachine
660419812d Mute org.elasticsearch.xpack.esql.action.CrossClusterAsyncQueryIT testSuccessfulPathways #121488 2025-02-02 09:15:21 +11:00
elasticsearchmachine
9e73518097 Mute org.elasticsearch.xpack.esql.action.CrossClusterAsyncQueryIT testStopQueryLocal #121487 2025-02-02 09:15:05 +11:00
Armin Braun
2b410c44eb
Remove outdated assertion from #118214 (#121435)
Asserting that we definitely saw the "received a single result" flag
and can now deal with null responses, isn't applicable after a few
recent fixes. New requests are sent out before responses are fully
processed to keep data nodes in a tighter loop (as well as other
relaxed ordering relative to when this assertion was added) so
the flag is not guaranteed to show up as true for lower numbers
of shard requests any longer.
Lets just remove it, it was always best effort and accidental that
this worked for the numbers the test randomizes over.
2025-02-01 15:54:59 +01:00
elasticsearchmachine
06dab2d48c Mute org.elasticsearch.xpack.transform.checkpoint.TransformCCSCanMatchIT testTransformLifecycle_RangeQueryThatMatchesNoShards #121480 2025-02-02 01:45:27 +11:00
elasticsearchmachine
fc72c64738 Mute org.elasticsearch.xpack.security.CoreWithSecurityClientYamlTestSuiteIT test {yaml=cat.aliases/10_basic/Empty cluster} #121484 2025-02-02 01:43:08 +11:00
elasticsearchmachine
4207fe52ad Mute org.elasticsearch.xpack.security.profile.ProfileIntegTests testGetUsersWithProfileUid #121483 2025-02-02 01:35:47 +11:00
elasticsearchmachine
a9f03b5ae4 Mute org.elasticsearch.xpack.esql.heap_attack.HeapAttackIT testLookupExplosionManyMatches #121481 2025-02-01 18:18:11 +11:00
elasticsearchmachine
61e1fb65f3 Mute org.elasticsearch.xpack.security.CoreWithSecurityClientYamlTestSuiteIT test {yaml=cluster.health/10_basic/cluster health basic test} #121478 2025-02-01 16:45:25 +11:00
elasticsearchmachine
bf9c93d95a Mute org.elasticsearch.xpack.security.authc.jwt.JwtRealmSingleNodeTests testGrantApiKeyForJWT #121039 2025-02-01 16:32:06 +11:00
Christoph Büscher
fd1bd79b85
WIP (#121463)
Under very unfortunate conditions tests that check xContent objects
roundtrip parsing  (like i.e. [SearchHitsTests
testFromXContent](https://github.com/elastic/elasticsearch/issues/97716)
can fail when we happen to randomly pick YAML xContent type and create
random (realistic)Unicode character sequences that may contain the
character U+0085 (133) from the [Latin1 code
page](https://de.wikipedia.org/wiki/Unicodeblock_Lateinisch-1,_Erg%C3%A4nzung).

That specific character doesn't get parsed back to its original form for
YAML xContent, which can lead to [rare but hard to diagnose test
failures](https://github.com/elastic/elasticsearch/issues/97716#issuecomment-2464465939).

This change adds logic to AbstractXContentTestCase#test() which lies at
the core of most of our  xContent roundtrip tests that disallows test
instances containing that particular character  when using YAML xContent
type.

Closes #97716
2025-02-01 09:56:59 +11:00
elasticsearchmachine
a589e1f836 Mute org.elasticsearch.xpack.security.authc.jwt.JwtRealmSingleNodeTests testClientSecretRotation #120985 2025-02-01 09:29:13 +11:00
elasticsearchmachine
09e1426616 Mute org.elasticsearch.xpack.esql.heap_attack.HeapAttackIT testLookupExplosionBigStringManyMatches #121465 2025-02-01 09:18:19 +11:00
elasticsearchmachine
38052b2594 Mute org.elasticsearch.datastreams.TSDBPassthroughIndexingIT org.elasticsearch.datastreams.TSDBPassthroughIndexingIT #121464 2025-02-01 09:06:05 +11:00
Patrick Doyle
0698d7384e
Add length limit FileSettingsHealthIndicatorService.description (#121334)
* Add length limit FileSettingsHealthIndicatorService.description

* [CI] Auto commit changes from spotless

* Add javadocs explaining `fileSettings.descriptionLengthLimit` setting

---------

Co-authored-by: elasticsearchmachine <infra-root+elasticsearchmachine@elastic.co>
2025-01-31 20:52:58 +01:00
Mayya Sharipova
f7901f0795
Support duplicate suggestions in completion field (#121324)
Currently if a document has duplicate suggestions across different
contexts, only the first gets indexed, and when a user tries to
search using the second context, she will get 0 results.

This PR addresses this, but adding support for duplicate suggestions
across different contexts, so documents like below with duplicate inputs
can be searched across all provided contexts.

```json
{
  "my_suggest": [
    {
      "input": [
        "foox",
        "boo"
      ],
      "weight" : 2,
      "contexts": {
        "color": [
          "red"
        ]
      }
    },
    {
      "input": [
        "foox"
      ],
      "weight" : 3,
      "contexts": {
        "color": [
         "blue"
        ]
      }
    }
  ]
}
```

Closes #82432
2025-01-31 13:58:14 -05:00
Patrick Doyle
38a3844441
Entitlement tests using reflection (#121436)
* Entitlement IT cases for reflection

* EntitlementBootstrap selfTest using reflection

* Remove errant logging setting

* Lambdas instead of booleans

* [CI] Auto commit changes from spotless

* Refactor: Extract lambdas to method refs

---------

Co-authored-by: elasticsearchmachine <infra-root+elasticsearchmachine@elastic.co>
2025-01-31 19:18:17 +01:00
Fang Xing
06fee76fb1
[ES|QL] Correct line and column numbers of missing named parameters (#120852)
* correct line and column numbers of missing named parameters
2025-01-31 13:13:17 -05:00
Nik Everett
d9da7c9940
ESQL: Expand HeapAttack for LOOKUP (#120754)
* ESQL: Expand HeapAttack for LOOKUP

This expands the heap attack tests for LOOKUP. Now there are three
flavors:
1. LOOKUP a single geo_point - about 30 bytes or so.
2. LOOKUP a one mb string.
3. LOOKUP no fields - just JOIN to alter cardinality.

Fetching a geo_point is fine with about 500 repeated docs before it
circuit breaks which works out to about 256mb of buffered results.
That's sensible on our 512mb heap and likely to work ok for most folks.
We'll flip to a streaming method eventually and this won't be a problem
any more. But for now, we buffer.

The no lookup fields is fine with like 7500 matches per incoming row.
That's quite a lot, really.

The 1mb string is trouble! We circuit break properly which is great and
safe, but if you join 1mb worth of columns in LOOKUP you are going to
need bigger heaps than our test. Again, we'll move from buffering these
results to streaming them and it'll work better, but for now we buffer.

* updates
2025-01-31 19:11:13 +01:00
David Turner
e1c6c3f9b2
Configurable limit on concurrent shard closing (#121267)
Today we limit the number of shards concurrently closed by the
`IndicesClusterStateService`, but this limit is currently a function of
the CPU count of the node. On nodes with plentiful CPU but poor IO
performance we may want to restrict this limit further. This commit
exposes the throttling limit as a setting.
2025-02-01 04:53:12 +11:00
Carlos Delgado
67c2f41724
Fix serverless test - wait for index green just after first insertion (#121180) 2025-01-31 17:45:52 +01:00
David Kyle
d3a8a4ba04
[ML] Fix infer on and elasticsearch service endpoint created with a deployment id (#121428)
Fixes a bug where the deployment Id was lost creating the text embedding
model configuration
2025-01-31 17:42:27 +01:00
Tim Grein
2993998b32
[Inference API] Remove second calculator instance as component and update tests (#121284) 2025-01-31 17:18:51 +01:00
Armin Braun
a4455d42e1
Remove AwaitsFix for #99929 (#118147)
This should be long fixed but we forgot the AwaitsFix.

closes #99929
2025-02-01 02:55:14 +11:00
Francisco Fernández Castaño
0c787bd8f0
Rename IndexShardRoutingTable unpromotable related methods (#121155) 2025-01-31 16:50:55 +01:00
Kathleen DeRusso
0cf00091fd
Fix bug where intercepted semantic knn queries did not respect filters (#121410) 2025-01-31 10:36:42 -05:00
Patrick Doyle
f205061e91
Reduce duplicate and dead entitlements code (#121409)
* Refactor: remove duplicate canWrite methods.

This serves as a good example of how Path and File handling could be
specialized in the future, but as long as they are identical, the duplication
causes more harm than good.

* Refactor: just one neverEntitled.

The original motivation was to avoid allocating a lambda object on each call,
but since that's a highly optimized operation in the JVM, it's unlikely to make
a difference in practice, and this smacks of premature optimization.

We're pretty liberal about lambdas elsewhere, so let's not sweat it here until
we have some evidence that it matters.

* Remove dead code
2025-01-31 16:29:53 +01:00
Michael Peterson
3fafb5f161
Improve resolve/cluster yaml test (#121315)
Updated indices.resolve_cluster.json to match new resolve/cluster spec.

Added new test for the no-index-expression endpoint.

Adjust syntax in 10_basic_resolve_cluster.yml syntax fix so that the elasticsearch-specification validation tests pass.
2025-01-31 10:20:04 -05:00
Mark Vieira
82b9b56039
Update buildkite pipeline 2025-01-31 07:11:30 -08:00
Ryan Ernst
37c929b9dc
Make entitlement IT tests reflective (#121355)
This commit adds an EntitlementTest annotation that can be used on
classes containing test actions for entitlements. The annotation mirrors
the parameters of CheckAction. Only file check actions are currently
converted, the rest can be moved and annotated as followups. Note that
the check action name is simply the method name, no fancy name
manipulation is done.
2025-01-31 16:09:51 +01:00
Mark Vieira
198a187a8a
Trigger DRA snapshots for 9.x branches as well 2025-01-31 07:09:20 -08:00
elasticsearchmachine
3444f91345 Mute org.elasticsearch.xpack.ml.integration.ClassificationIT testDependentVariableIsAliasToNested #121415 2025-02-01 02:02:03 +11:00
Tim Grein
4642f1511b
[Inference API] Wait for assignments to happen in InferenceServiceNodeLocalRateLimitCalculatorTests. (#121379) 2025-01-31 15:08:15 +01:00
elasticsearchmachine
9f572a310a Mute org.elasticsearch.test.rest.yaml.CcsCommonYamlTestSuiteIT org.elasticsearch.test.rest.yaml.CcsCommonYamlTestSuiteIT #121407 2025-02-01 01:05:31 +11:00
Jonathan Buttner
2a1b433982
[ML] Adding fields for Inference service configuration API (#121103)
* Adding fields and making some optional

* Fixing tests
2025-01-31 08:56:36 -05:00
Ryan Ernst
b1dcfb57b1
Always use String getLogger with log4j (#121250)
This commit forces the delegate for ES logging to always use the String
version of LogManager.getLogger instead of the one taking a Class. The
reason is that if a classloader is not in the hierarchy of the app
classloader, the ES logging configuration will not be found. By using
the String variant, the app classloader is always used.
2025-01-31 05:56:14 -08:00
Ryan Ernst
c3f752054e
Pass environment paths into entitlement bootstrap (#121347)
This commit adds the data dirs, config dir and temp dir into
entitlement bootstrapping. It doesn't yet use them in entitlement
policies, but makes them available to use within initialization.
2025-01-31 05:51:44 -08:00
elasticsearchmachine
859d92cfd7 Mute org.elasticsearch.test.rest.yaml.RcsCcsCommonYamlTestSuiteIT test {p0=search.vectors/42_knn_search_int4_flat/KNN Vector similarity search only} #121395 2025-02-01 00:50:15 +11:00
David Kyle
2e84950cb3
[ML] Unmute XPackRestIT and mute all ml and transform tests (#121377) 2025-01-31 13:15:35 +01:00
David Turner
f6ca4e17f0
Improve logging of put-mapping failures (#121372)
No sense in converting to a list just to convert to a string, we may as
well convert directly to a string. Also removes the unnecessary extra
`[]` wrapper.
2025-01-31 11:38:27 +00:00
Bogdan Pintea
0393e56fa7
ESQL: introduce a pre-mapping logical plan processing step (#121260)
This adds a pre-mapping logical plan processing step, occurring after the logical optimisation, but before mapping it to a physical plan. This step can perform async actions, if needed, and involves using a new `TransportActionServices` record with all available services.

Furthermore, the query rewriting step part of the `FullTextFunction`s planning (occurring on the coordinator only) is refactored a bit to update the queries in-place.
The verification done by `Match` and `Term` involving checking on the argument type is also now pulled back from post-optimisation to post-analysis. Their respective tests are moved accordingly as well.
2025-01-31 11:39:28 +01:00
Moritz Mack
a896779271
Fix LambdaMatchers.transformedMatch to handle null values (#121371) 2025-01-31 10:34:48 +01:00
Tim Grein
eee6973389
[Inference API] Fix tests in TransportInferenceActionTests (#121302) 2025-01-31 10:26:20 +01:00
Tim Grein
0a8605e8c2
Remove feature flag check in BaseTransportInferenceAction and rely on Noop implementation (#121270) 2025-01-31 10:21:18 +01:00
Mariusz Jozala
3c93ec4a72 Merge branch 'patch/serverless-fix' 2025-01-31 10:10:45 +01:00
Saikat Sarkar
09b1c6d912
Integrate watsonx for re-ranking task (#117176)
* Integrate watsonx reranking to inference api

* Add api_version to the watsonx api call

* Fix the return_doc option

* Add top_n parameter to task_settings

* Add truncate_input_tokens parameter to task_settings

* Add test for IbmWatonxRankedResponseEntity

* Add test for IbmWatonxRankedRequestEntity

* Add test for IbmWatonxRankedRequest

* [CI] Auto commit changes from spotless

* Add changelog

* Fix transport version

* Add test for IbmWatsonxService

* Remove canHandleStreamingResponses

* Add requireNonNull for modelId and projectId

* Remove maxInputToken method

* Convert all optionals to required

* [CI] Auto commit changes from spotless

* Set minimal_supported version to be ML_INFERENCE_IBM_WATSONX_RERANK_ADDED

* Remove extraction of unused fields from IbmWatsonxRerankServiceSettings

* Add space

* Add space

---------

Co-authored-by: elasticsearchmachine <infra-root+elasticsearchmachine@elastic.co>
2025-01-30 21:40:04 -07:00
Niels Bauman
da7d58c06c Merge main into multi-project 2025-01-31 11:21:48 +10:00
Oleksandr Kolomiiets
1225b0720a
Fix propagation of dynamic mapping parameter when applying copy_to (#121109) 2025-01-31 00:26:58 +01:00
elasticsearchmachine
1c1f195018 Mute org.elasticsearch.smoketest.SmokeTestMultiNodeClientYamlTestSuiteIT test {yaml=search.vectors/42_knn_search_int4_flat/Vector similarity with filter only} #121350 2025-01-31 10:20:16 +11:00
Martijn van Groningen
0d2db063ec
Update ESRestTestCase's ROLLUP_REQUESTS_OPTIONS (#121335)
Sometimes there are multiple warning.
2025-01-30 23:17:47 +01:00
elasticsearchmachine
884b61e1cc Mute org.elasticsearch.xpack.security.profile.ProfileIntegTests testActivateProfile #121151 2025-01-31 09:14:40 +11:00
elasticsearchmachine
c8aa582e7c Mute org.elasticsearch.xpack.security.profile.ProfileIntegTests testHasPrivileges #121346 2025-01-31 09:14:26 +11:00
Parker Timmins
eeb745cfa2
ReindexDataStreamIndex bug in assertion caused by reference equality (#121325)
Assertion was using reference equality on two boxed longs. So assertion could produce false positives. Change to Objects.equals to check value and avoid null check.
2025-01-30 16:09:04 -06:00
elasticsearchmachine
1f95d2178a Mute org.elasticsearch.smoketest.DocsClientYamlTestSuiteIT test {yaml=reference/snapshot-restore/apis/get-snapshot-api/line_751} #121345 2025-01-31 09:03:07 +11:00
Larisa Motova
6cf38353c8
[ES|QL] Add aggregate metric double feature flag to its capability (#121318)
AggregateMetricDouble should be behind a feature flag but on release
builds it was getting added when it should not have been. This commit
addresses that bug.
2025-01-30 11:53:56 -10:00
elasticsearchmachine
b66035998f Mute org.elasticsearch.smoketest.DocsClientYamlTestSuiteIT test {yaml=reference/rest-api/common-options/line_125} #121338 2025-01-31 08:40:48 +11:00
elasticsearchmachine
6553f0ffcc Mute org.elasticsearch.smoketest.DocsClientYamlTestSuiteIT test {yaml=reference/rest-api/security/invalidate-tokens/line_194} #121337 2025-01-31 08:39:48 +11:00
elasticsearchmachine
b3a23df83f Mute org.elasticsearch.index.engine.ShuffleForcedMergePolicyTests testDiagnostics #121336 2025-01-31 08:29:51 +11:00
Mark Vieira
385a4a60d9
Ignore main branch in staging DRA jobs 2025-01-30 11:59:10 -08:00
Fang Xing
b381a1ddfc
[ES|QL] Fix MapExpression and named parameter related tests in StatementParserTests (#121075)
* fix StatementParserTests.testNamedFunctionArgumentInMap, testNamedFunctionArgumentWithUnsupportedNamedParameterTypes

* separate snapshot test from release test

---------

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2025-01-30 14:55:32 -05:00
elasticsearchmachine
9ad3f680d9 Mute org.elasticsearch.env.NodeEnvironmentTests testGetBestDowngradeVersion #121316 2025-01-31 04:36:05 +11:00
Mark Vieira
d97b736662
Preparation for 9.0.0-beta1 release 2025-01-30 09:34:41 -08:00
Kostas Krikellas
d32583cd80
[TEST] Clean up skipped tests in rest-compat mode (#121298)
* Skip tests in rest-compat that fail due to versioning issues

* Clean up skipped tests in rest-compat mode

* restore some

* restore some
2025-01-30 19:02:37 +02:00
elasticsearchmachine
69bdf465b0 Bump to version 9.1.0 2025-01-30 16:55:46 +00:00
Patrick Doyle
2bbf7c72db
Fix PolicyManagerTests after package move (#121304)
* Fix PolicyManagerTests after package move

* Unmute
2025-01-30 17:47:37 +01:00
Dan Rubinstein
011557d61b
Fix inference update API calls with task_type in body or deployment_id defined (#121231)
* Fix inference update API calls with task_type in body or deployment_id defined

* Update docs/changelog/121231.yaml

* Fixing test

* Reuse existing deployment ID retrieval logic

---------

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2025-01-30 11:37:04 -05:00
Mark Vieira
befec5d0df
Add 8.18 branch to backport config 2025-01-30 08:32:53 -08:00
Mark Vieira
6cb7f0e296
Fix backport mapping 2025-01-30 08:31:34 -08:00
Mark Vieira
6c405093d7
Update BWC versions to support multiple staged releases 2025-01-30 08:22:54 -08:00
Mark Vieira
da65532e9c
Add 8.19.0 version constant 2025-01-30 08:22:54 -08:00
David Turner
aac1409814
Cheaper snapshot-related toString() impls (#121283)
If the `MasterService` needs to log a create-snapshot task description
then it will call `CreateSnapshotTask#toString`, which today calls
`RepositoryData#toString` which is not overridden so ends up calling
`RepositoryData#hashCode`. This can be extraordinarily expensive in a
large repository. Worse, if there's masses of create-snapshot tasks to
execute then it'll do this repeatedly, because each one only ends up
yielding a short hex string so we don't reach the description length
limit very easily.

With this commit we provide a more efficient implementation of
`CreateSnapshotTask#toString` and also override
`RepositoryData#toString` to protect against some other caller running
into the same issue.
2025-01-31 03:01:24 +11:00
elasticsearchmachine
ff3950d025 Mute org.elasticsearch.entitlement.runtime.policy.PolicyManagerTests testDuplicateFlagEntitlements #121300 2025-01-31 02:27:39 +11:00
Alexander Spies
70b397cf57
ESQL: Enable LOOKUP JOIN in non-snapshot builds (#121193)
This effectively releases LOOKUP JOIN into tech preview. Docs will follow in a separate PR.

* Enable the lexing/grammar for LOOKUP JOIN in non-snapshot builds.
* Remove the grammar for the unsupported | JOIN ... command (without LOOKUP as first keyword). The way the lexer modes work, otherwise we'd also have to enable | JOIN ... syntax on non-snapshot builds and would have to add additional validation to provide appropriate error messages.
* Remove grammar for LOOKUP JOIN index AS ... because qualifiers are not yet supported. Otherwise we'd have to put in additional validation as well to prevent such queries.

---------

Co-authored-by: Bogdan Pintea <bogdan.pintea@elastic.co>
Co-authored-by: elasticsearchmachine <infra-root+elasticsearchmachine@elastic.co>
Co-authored-by: Nik Everett <nik9000@gmail.com>
2025-01-30 16:08:49 +01:00
Patrick Doyle
45c191ec55
Refactor: separate package for entitlement records (#121204) 2025-01-30 16:00:12 +01:00
Kostas Krikellas
329651a84c
Skip tests in rest-compat that fail due to versioning issues (#121282) 2025-01-30 16:48:40 +02:00
Brian Seeders
a9522a0cbe
Add 9.0 back to branches.json 2025-01-30 09:36:03 -05:00
Niels Bauman
621a18d947 Merge main into multi-project 2025-01-30 17:26:28 +10:00
Niels Bauman
e996ac816a Make enrich CRUD APIs project aware (MP-1933)
Modifies the enrich CRUD APIs to be project aware.
2025-01-30 14:14:20 +10:00
Mariusz Józala
f498c70dbb
[TEST] Typo corrected in the comment (#121154) 2025-01-29 14:08:28 +01:00
Simon Cooper
6ae3f00eaa Add package docs for reserved state infrastructure (MP-1931) 2025-01-24 12:17:42 +00:00
Niels Bauman
02cdc6a859 Merge main into multi-project 2025-01-24 18:11:24 +10:00
Niels Bauman
b6629659be Mute new ESQL tests for MP 2025-01-24 16:54:28 +10:00
Niels Bauman
96b12ae48e Fix MP compilation in MlIndexRollover 2025-01-24 16:01:09 +10:00
Niels Bauman
6495dcbb40 Merge main into multi-project 2025-01-24 15:48:39 +10:00
Niels Bauman
3c77133e9c Make Data Stream Lifecycle APIs project aware (MP-1925)
Make remaining Data Stream Lifecycle APIs project aware.
2025-01-23 09:22:30 +00:00
Niels Bauman
1d106a83ed Make migrate data stream API project aware (MP-1928)
Allows migrating aliases to data streams in multi-projects.
2025-01-23 06:42:41 +00:00
Niels Bauman
6d747f4db0 Merge main into multi-project 2025-01-23 15:40:32 +10:00
Niels Bauman
d399f94f77 Mute migrate YAML tests for multi-project 2025-01-23 14:38:16 +10:00
Niels Bauman
682cf0a18f Merge remote-tracking branch 'public/main' into merge-main 2025-01-23 13:27:52 +10:00
Niels Bauman
82d15a3de0 Clean up active project instead of deleting (MP-1922)
Instead of deleting and recreating projects after every YAML
multi-project test, we should create the projects once at the start of
the test suite and clean up the active project after every test.
2025-01-23 09:10:14 +10:00
Simon Cooper
31fee7d1df Merge main into multi-project 2025-01-22 15:19:52 +00:00
Simon Cooper
49ceed728c Add required test mutes for blocks 2025-01-22 13:34:59 +00:00
Simon Cooper
d5fd25eaef Fix compile 2025-01-22 12:32:37 +00:00
Simon Cooper
569c1fc1cd Merge remote-tracking branch 'upstream-main/main' into merge-main-22-01-25T12 2025-01-22 12:22:36 +00:00
Simon Cooper
e6a3aff093 Merge commit '13c75c02f0' into merge-main-22-01-25T12 2025-01-22 12:09:34 +00:00
Niels Bauman
3e65cdcab9 Unmute various multi-project YAML tests (MP-1927)
These tests are already passing.
2025-01-22 08:07:10 +10:00
Niels Bauman
0e64300930 Make modify data stream API project aware (MP-1926)
Makes the modify data stream API (for changing the backing and failure
indices) project aware.
2025-01-21 07:19:52 +00:00
Niels Bauman
5ef1ace001 Make data stream aliases project aware (MP-1924)
Allows putting aliases for data streams.
2025-01-21 15:57:39 +10:00
Niels Bauman
3496e787b5 Merge main into multi-project 2025-01-21 14:29:47 +10:00
Niels Bauman
6c7d2d285b Merge main into multi-project 2025-01-21 11:04:37 +10:00
Niels Bauman
c7c8b1d74e Unmute data stream tests (MP-1919)
Unmutes several data stream yaml tests that are working in multi-project
mode.
2025-01-21 09:49:51 +10:00
Niels Bauman
0474c2b9ea Make simulate APIs project aware (MP-1920)
Updates all simulate APIs to be project aware.
2025-01-20 22:11:01 +10:00
Simon Cooper
33fd34c18f Remove ProjectState methods from MetadataIndexTemplateService (MP-1916)
This doesn't actually make the simulate actions multi-project aware, it pushes the `getProject` and related calls further towards the edge, so that `MetadataIndexTemplateService` _can_ be multi-project compatible.
The actual simulate actions will need to be made MP-compatible at a later point.
2025-01-20 09:18:44 +00:00
Tim Vernum
5541043153 Explain DBQ/UBQ yaml test failures (MP-1913)
Update the muted test list to explain why some delete_by_query and
update_by_query tests cannot run in our multi-project suite
2025-01-20 06:46:36 +00:00
Yang Wang
db0ee65e6c Merge main into multi-project
Merge main into multi-project
2025-01-20 14:28:41 +11:00
Yang Wang
e61035ee48 Fix compilation 2025-01-20 11:45:48 +11:00
Elastic Machine
a6bcbb6229 Merge branch 'multi-project' into mp/merge/main/2025-01-20T10 2025-01-20 00:23:39 +00:00
Yang Wang
7a1f5c5d4f Merge main into multi-project 2025-01-20 11:17:40 +11:00
Niels Bauman
b1a3e9c5a3 Make ML feature reset work on default project only (MP-1873)
Updates various places - mostly related to ML - to make the `POST
_features/_reset` API not fail when there are multiple projects.
This does not actually make those places project-aware,
but since nothing ML-related has been made project-aware,
this is the best way forward for now to make IT cleanup project aware.
2025-01-20 09:55:08 +10:00
Simon Cooper
bdbd6eb13e Convert ReservedComposableIndexTemplateAction to work on ProjectMetadata (MP-1889)
Make `ReservedComposableIndexTemplateAction` project-specific. All metadata of reserved state loaded from files
matches the source file structure, rather than where in cluster state the resulting state changes occur.
2025-01-17 10:08:19 +00:00
Tim Vernum
710c3fe7bd Merge main into multi-project 2025-01-17 19:43:56 +11:00
Tim Vernum
18528dde76 Merge main into multi-project 2025-01-17 16:32:24 +11:00
Tim Vernum
552cec7ff0 Merge revision 34059c9dbd into multi-project 2025-01-17 16:32:15 +11:00
Simon Cooper
b7c73e7093 Merge main into multi-project
Update from main 16-01-25T09
2025-01-16 11:17:22 +00:00
Simon Cooper
ead92b566d Fix compile 2025-01-16 10:13:04 +00:00
Simon Cooper
5a70623d8d Merge remote-tracking branch 'upstream-main/main' into merge-main-16-01-25 2025-01-16 09:23:46 +00:00
Simon Cooper
bfecd1c342 Add fix marker for ILM references (MP-1911)
ILM is not a thing for serverless, so we need to decide how to manage default project references in this class (and related) long-term. Add a marker to do this later.
2025-01-14 13:48:25 +00:00
Tim Vernum
5724e31171 Make resize (clone,shrink,split) project aware (MP-1901)
This updates `TransportResizeAction` to be project aware.

Although these actions are not supported on Serverless projects, we make
them work correctly with projects so that we can work towards removing
the deprecated `getProject` method.
2025-01-14 06:45:04 +00:00
Tim Vernum
ed3eb96930 Drop cluster scope method in DataStreamsActionUtil (MP-1910)
This removes the method

    getDataStreamNames(
        IndexNameExpressionResolver,
        ClusterState,
        String[],
        IndicesOptions
    )

from DataStreamsActionUtil and replaces all callers with the project
scoped version.

This necessitated the introduction of
`AcknowledgedTransportMasterNodeProjectAction` and some changes to
`TransportMasterNodeReadProjectAction` (and subclasses)
2025-01-14 05:36:00 +00:00
Tim Vernum
8980b1f2f4 Switch WildcardExpressionResolverTests to project (MP-1909)
This changes `WildcardExpressionResolverTests` to use the
`ProjectMetadata` based `Context` constructor instead of the
`ClusterState` based one
2025-01-14 01:41:07 +00:00
Tim Vernum
347be271f6 Make reindex/UBQ/DBQ project aware (MP-1902)
This updates the reindex module to be project aware
2025-01-14 01:38:56 +00:00
Simon Cooper
a307b1da4a Convert ReservedPipelineAction and ReservedSecurityStateHandler to project reserved state handlers (MP-1886)
Along with some infrastructure to support it
2025-01-13 11:06:39 +00:00
Tim Vernum
6d728c7fb8 Make /_cat/component_templates project aware (MP-1907)
This updates `RestCatComponentTemplateAction` to act on the selected
(resolved) project

Relates: https://github.com/elastic/elasticsearch/pull/119920
2025-01-13 07:57:16 +00:00
Simon Cooper
415a5e67d2 Merge main into multi-project 2025-01-13 06:20:35 +00:00
Tim Vernum
f76be23dfd Make cluster stats operate over all projects (MP-1892)
This updates the cluster stats action to take all projects into account
when calculating the statistics. This is true even if a specific project
is requested.

The only exception is the "health status" because we only have
primitives for calculating the health of a single project. The stats
response will always give the health of the targeted project.
2025-01-13 16:22:50 +11:00
Tim Vernum
2e9cca9aa3 Merge branch 'main' into merge-main-10-01-25T17 2025-01-13 16:14:58 +11:00
Tim Vernum
7af215e5de Merge branch 'multi-project' into merge-main-10-01-25T17 2025-01-13 16:03:58 +11:00
Tim Vernum
915c87fa91 Fix project resolution in RestIndicesAction(Tests) (MP-1908)
Fixes a bug introduced in MP-1897
2025-01-13 16:03:43 +11:00
Tim Vernum
cecac35f6b Mute new core test 2025-01-13 16:02:11 +11:00
Simon Cooper
b0cd47de08 Merge remote-tracking branch 'upstream-main/main' into merge-main-10-01-25T17 2025-01-10 17:00:07 +00:00
Simon Cooper
980959b654 Create multi-project FileSettingsService for project settings files (MP-1865)
Create a multi-project version of `FileSettingsService` to handle individual project settings files.
At the moment, there are no handlers for project-specific data, but it will create projects in the cluster based on the settings files that exist in the directory
2025-01-10 09:16:00 +00:00
Tim Vernum
1351a47c6c Make _cat/indices project aware (MP-1897)
This updates `RestIndicesAction` to act on the correct project in the
cluster state
2025-01-10 07:51:13 +00:00
Niels Bauman
7eb9bff7d9 Merge main into multi-project 2025-01-10 16:11:55 +10:00
Yang Wang
5e6b51b2fe Add an assertion for non-empty project indices blocks (MP-1890)
A project should have an entry in ClusterBlocks#projectBlocksMap when it
actually has any indices blocks. This PR adds such an assertion for it.
2025-01-10 06:03:55 +00:00
Niels Bauman
83acbcb36b Merge main into multi-project 2025-01-10 15:08:22 +10:00
Niels Bauman
052b53e567 Introduce TransportLocalProjectMetadataAction (MP-1885)
A new abstract subclass of `TransportLocalClusterStateAction` for
transport actions that want to read project data on the local node.
2025-01-10 01:34:13 +00:00
Simon Cooper
9cb4ba9828 Merge main into multi-project 2025-01-09 17:44:56 +00:00
Simon Cooper
66add2677a Apply spotless, fix compile 2025-01-09 16:22:34 +00:00
Simon Cooper
2e04ed09a9 Merge remote-tracking branch 'upstream-main/main' into merge-main-9-1-25 2025-01-09 16:09:21 +00:00
Tim Vernum
915ceb5aba Merge main into multi-project 2025-01-10 03:01:39 +11:00
Simon Cooper
f6d703d221 Mute new tests just added 2025-01-09 14:53:03 +00:00
Tim Vernum
280fcb1a57 Merge main into multi-project 2025-01-09 19:39:24 +11:00
Tim Vernum
df345db352 Unmute tsdb/settings tests (MP-1900)
These tests are no longer broken
2025-01-09 13:59:37 +11:00
Tim Vernum
69de93ded0 Unmute /_cat/segments tests (MP-1899)
These tests now work due to MP-1877
2025-01-09 13:59:25 +11:00
Tim Vernum
0f8b5edc86 Make "ResolveIndexAction" project aware (MP-1894)
This commit changes `ResolveIndexAction` to resolve against the target
project.
2025-01-08 08:34:17 +00:00
Tim Vernum
a22d6949d4 Unmute /_cat/aliases tests (MP-1898)
These tests now pass
2025-01-08 08:29:32 +00:00
Tim Vernum
7ca8dcd7b4 Enable muted authz tests (MP-1893)
Enable a number of muted "security/authz" tests that now work
2025-01-08 08:28:45 +00:00
Tim Vernum
207dc616b1 Merge main into multi-project 2025-01-08 16:24:32 +11:00
Tim Vernum
f1083a00c8 Merge main into multi-project 2025-01-08 14:28:12 +11:00
Tim Vernum
60010f991e Merge main into multi-project 2025-01-08 13:02:38 +11:00
Tim Vernum
93100ddfa7 Merge revision 393ea618d7 into multi-project 2025-01-08 12:42:57 +11:00
Tim Vernum
98592cb97d Merge main into multi-project 2025-01-07 21:09:10 +11:00
Tim Vernum
39175c41e2 Merge main into multi-project 2025-01-07 19:06:49 +11:00
Tim Vernum
36cfb3d499 Merge revision bf3edffedd into multi-project 2025-01-07 19:06:34 +11:00
Yang Wang
3b5ad91dd4 Merge main into multi-project
Merge main into multi-project
2025-01-06 14:36:37 +11:00
Yang Wang
e1151ef1ba Merge main into multi-project 2025-01-06 13:30:02 +11:00
Simon Cooper
955a702726 Make MetadataIndexTemplateService work on ProjectMetadata objects (MP-1887)
As a precursor to converting the reserved state handlers to work on
`ProjectMetadata`, convert `MetadataIndexTemplateService` to work on
`ProjectMetadata`, with temporary adaptor methods.
2025-01-03 10:14:38 +00:00
Tim Vernum
ebf43d8799 Make security role caching project aware (MP-1830)
Roles are cached per-project. Invalidation of roles can be either
project-scoped (index based roles) or cluster scoped (file based
roles), and the invalidation logic reflects this distinction.
2025-01-02 17:37:46 +11:00
Tim Vernum
de710eb6ee Merge main into multi-project 2024-12-31 16:54:13 +11:00
Tim Vernum
8bf5c2d0cb Merge main into multi-project 2024-12-31 15:41:30 +11:00
Tim Vernum
4ff691f066 Merge revision 7fb6ca447a into multi-project 2024-12-31 15:41:02 +11:00
Simon Cooper
8542468bf8 Add project reserved cluster state (MP-1833)
Add infrastructure to support project-specific reserved cluster state. 

Using this, most existing state handlers will next change from modifying `ClusterState` to modifying `ProjectMetadata`, with the remaining handlers (probably) changing from `ClusterState` to `Metadata`, at which point we can change `S` type to `M`, and change all the language from 'state' to 'metadata'.
2024-12-30 09:00:40 +00:00
Niels Bauman
a4a1a8e426 Fix BwC cluster blocks deserialization (MP-1883)
When we removed an index block from a project, the BwC deserialization
code would add an empty map for the default project. This commit fixes
that to return an empty map instead.
2024-12-24 21:13:46 +00:00
Niels Bauman
1c2db7e727 Merge main into multi-project 2024-12-24 21:10:29 +01:00
Niels Bauman
3738202979 Merge main into multi-project 2024-12-24 18:26:13 +01:00
Niels Bauman
537f4e87b2 Make lazy rollover project aware (MP-1881)
Allows marking data streams (and their failure stores) for lazy rollover
and executing the lazy rollover during indexing in a multi-project
setting.
2024-12-23 10:26:37 +00:00
Yang Wang
41f5cb4295 Fix more cluster-blocks usages and unmute tests (MP-1878)
This PR fixes two more cluster-blocks usages and unmuted tests that can
pass. Some of the tests can already pass without the fix so that this PR
also unmutes them.
2024-12-23 00:05:47 +00:00
Yang Wang
2c0fd8efef Project with no indices blocks do not need an entry in ClusterBlocks (MP-1875)
No need to add an empty placeholder entry for a project if it does not
have any indices blocks. This helps efficency for both serialization and
building. Relevant methods all take care of this optimization by
returning empty result when recieving requests for such projects.
2024-12-23 00:03:08 +00:00
Yang Wang
49d3ae7216 Merge main into multi-project
Merge main into multi-project
2024-12-23 09:53:19 +11:00
Yang Wang
22fc4818c8 Fix tests and mute tests
Fix ClusterStateTests
Relates: https://github.com/elastic/elasticsearch/pull/119083

Mute failure store related data stream tests that are renamed or new.
Relates: https://github.com/elastic/elasticsearch/pull/118662
2024-12-22 23:18:32 +11:00
Yang Wang
2fece80ac3 fix compilation and adapt multi-project 2024-12-22 21:02:27 +11:00
Yang Wang
e790688377 Merge main into multi-project 2024-12-22 19:36:33 +11:00
Niels Bauman
0df103d7af Make indices segments API project aware (MP-1877)
Updates the indices segments transport action to be project aware.
2024-12-19 14:40:21 +00:00
Niels Bauman
ddffe9ec03 Merge main into multi-project 2024-12-19 14:25:02 +01:00
Niels Bauman
5e3d11a8a0 Merge main into multi-project 2024-12-19 12:45:16 +01:00
Niels Bauman
626fb4021c Fix MetadataCreateIndexServiceTests tests 2024-12-19 11:46:14 +01:00
Niels Bauman
ee79f1e037 Mute ESQL tests that fail with multiple projects 2024-12-19 11:07:50 +01:00
Yang Wang
f3f07a2e43 fix compilation 2024-12-19 16:11:41 +11:00
Yang Wang
f7791a0f5f Merge main into multi-project 2024-12-19 14:36:37 +11:00
Niels Bauman
bd678373d8 Execute pipelines during indexing in multiple projects (MP-1866)
Allows executing pipelines during indexing and pipeline simulation in
multiple projects.
2024-12-18 12:34:20 +00:00
Niels Bauman
317c7993d3 Merge main into multi-project 2024-12-18 12:46:57 +01:00
Niels Bauman
9f841324da Merge main into multi-project 2024-12-18 11:31:40 +01:00
Yang Wang
c416f251cb Make open/close index and add index blocks work with multi-project (MP-1870)
This PR makes open/close indices and add index blocks work by replaces a
large percentage of usages for the deprecated methods with the
corresponding project-aware versions. The ones that are no longer used
are removed. Some deprecated methods still remain after this PR. They
require even more cascading changes in areas that have not been touched,
such as snapshot/restore, watcher, security index settings etc. I prefer
to leave them out since this PR is already big enough. The main changes
are in MetadataIndexStateService class where both routing table and
metadata need to be specific to the right project.
2024-12-18 01:33:35 +00:00
Niels Bauman
1111f0ebef Merge main into multi-project 2024-12-17 22:10:32 +01:00
Niels Bauman
44838ab084 Merge remote-tracking branch 'public/main' into merge-main 2024-12-17 21:06:08 +01:00
Yang Wang
9a2c421497 Merge main into multi-project
Merge main into multi-project
2024-12-18 04:50:18 +11:00
Niels Bauman
bbf8713de3 Merge main into multi-project 2024-12-17 17:37:50 +01:00
Elastic Machine
0f81cd5316 Merge branch 'multi-project' into mp/merge/main/20241217T15 2024-12-17 15:23:52 +00:00
Niels Bauman
5b85a250ac Make AutoFollow get and delete actions project aware (MP-1864)
Updates both transport actions to be able to handle mulitple projects.

This is part of an ongoing effort to make integration test cleanup
project aware.
2024-12-17 11:37:17 +01:00
Elastic Machine
cb84a3af36 Merge branch 'multi-project' into mp/merge/main/20241217T15 2024-12-17 10:29:10 +00:00
Yang Wang
06f5207aa0 Merge main into multi-project 2024-12-17 21:27:49 +11:00
Johannes Fredén
ffc92678ce Inject SP config for SAML Realm to allow custom impl (MP-1862)
This PR refactors the Service Provider part of the SAML Realm to allow a
plugin to inject a custom service provider provider. The default is now
called `SingleSamlSpConfiguration` and has no changes in behaviour.
2024-12-17 08:43:36 +01:00
Yang Wang
3eb891ef80 Adapt testInvalidToken for multi-project 2024-12-17 16:20:45 +11:00
Yang Wang
c4d82e7376 Adapt QueryableBuiltInRolesSynchronizer for multi-project 2024-12-17 15:56:35 +11:00
Yang Wang
34cfe23ac7 Merge main into multi-project 2024-12-17 15:53:44 +11:00
Yang Wang
c0ed4dfea2 Revert ShardLimitValidator to work with Metadata (MP-1869)
ShardLimitValidator enforces cluster/node wipe shard count limits. Hence
it needs to work with metadata instead of project metadata. This PR
ensures this is the case.
2024-12-16 15:02:21 +11:00
Tim Vernum
a0f5d34262 Merge main into multi-project 2024-12-16 01:31:51 +11:00
Tim Vernum
af08595ed2 Merge main into multi-project 2024-12-16 00:16:29 +11:00
Tim Vernum
affd6dfb5b Merge revision ce2a7dee86 into multi-project 2024-12-16 00:11:08 +11:00
Yang Wang
6707bef217 Make ClusterBlocks compatible with multi-project (MP-1859)
This PR adds a project layer to ClusterBlocks so that it works with
multiple projects. Previously the index level blocks are tracked with a
map of "index-name to set-of-blocks". This is changed to be a map of
"project-id to project-level-blocks", where project-level-blocks
currently contains just the index level blocks. This structure is
expandable in that if we want to support project-wide blocks (as opposed
to cluster-wide blocks), they can be added to the project-level-blocks.

One alternative that has been considered but decided against is to
update the map of "index-name to set-of-blocks" to "index-object/uuid to
set-of-blocks". This has a few issues: (1) ClusterBlocks has no
references to Metadata so it cannot serve a request for index blocks
given an index name (bwc); (2) Similarly, when deserializing from an
old node, which provides only index names, there is no easy way to
lookup for the associated index UUID; (3) The structure is rather rigid
and cannot be easily expanded for project-level blocks if they become a
thing; (4) No easy way to get all indices blocks for a project.

I chose to keep all existing ClusterBlocks methods that take index name
as argument to avoid too many cascading changes. I marked all of them as
deprecated for removal so that they can be easily spotted, replaced and
removed in subsequent PRs. That said, there are still test failures
where cascading changes are necessary.

Relates: ES-10162
2024-12-13 04:59:07 +00:00
Yang Wang
be6a7ceee0 Merge main into multi-project
Merge main into multi-project
2024-12-13 14:52:03 +11:00
Yang Wang
277c2cc5c1 Fix ArchiveAllocationDeciderTests
Legacy index version got changed in
https://github.com/elastic/elasticsearch/pull/118443
The test needs to update accordingly
2024-12-13 13:49:50 +11:00
Yang Wang
516f55da5f Mute new yaml tests that do not work with multi-project 2024-12-13 13:14:48 +11:00
Yang Wang
fda1fa19d4 Merge main into multi-project 2024-12-13 12:15:25 +11:00
Niels Bauman
26f991a055 Make rollover project aware (MP-1846)
Makes both alias and data stream rollover project aware.
2024-12-12 19:00:25 +00:00
Niels Bauman
344c3cd54c Allow putting index settings in multiple projects (MP-1838)
Updates the transport action to put index settings to support multiple
projects.
2024-12-12 18:51:19 +00:00
Tim Vernum
cecdc929f0 Fix proj-id conflict in ProjectStateObserverTests (MP-1857)
As part of MP-1853 this test was changed to sometimes use the default
project id. However the test would fail if one of the "other" projects
had the same id as the main project, which had a > 25% chance (50%
chance of main project being "default" and 50% of the first other
project also being "default")
2024-12-12 10:09:44 +01:00
Tim Vernum
3282284cf5 Merge main into multi-project 2024-12-12 19:06:33 +11:00
Tim Vernum
e5a0739005 Merge main into multi-project 2024-12-12 17:23:24 +11:00
Tim Vernum
56f779ba3f Merge main into multi-project 2024-12-11 19:02:42 +11:00
Tim Vernum
64e999f4b6 Mute broken test on MP 2024-12-11 17:54:54 +11:00
Tim Vernum
64d5baf753 Merge main into multi-project 2024-12-11 16:40:08 +11:00
Tim Vernum
aaa4a99963 Fixes for merge c57d41d
This commit fixes problems that arise from the merge commit
c57d41d0ff
2024-12-11 16:13:22 +11:00
Tim Vernum
c57d41d0ff Merge revision 0d57e1025e into multi-project 2024-12-11 15:25:03 +11:00
Tim Vernum
fe606be996 Merge main into multi-project 2024-12-10 23:10:36 +11:00
Niels Bauman
95249b11d2 Fix merge 2024-12-10 12:03:54 +01:00
Tim Vernum
2adb36e109 Merge main into multi-project 2024-12-10 18:47:23 +11:00
Tim Vernum
7df7ec4e35 Resolve RoleMappingMetadata from active project (MP-1837)
Role Mappings can be stored as a `ProjectCustom` on `ProjectMetadata`
(see `RoleMappingMetadata`).
This commit ensures that the role mapper looks for the mappings on the
active project.

A new MultiProject JWT test has been added to cover some of this
behaviour
2024-12-10 07:28:48 +00:00
Tim Vernum
b39236c363 Merge commit '5e859d9' into merge/multi-project/public-main/2024-12-10T1756 2024-12-10 18:04:09 +11:00
Niels Bauman
33f48b728f Merge main into multi-project 2024-12-10 05:23:29 +00:00
Yang Wang
a6202d2443 Merge main into multi-project
Merge main into multi-project
2024-12-09 10:35:22 +11:00
Yang Wang
b386491779 Merge main into multi-project 2024-12-09 09:29:42 +11:00
Simon Cooper
84a5424aad Set standard randomProjectId method to sometimes return the default id (MP-1853) 2024-12-06 14:25:13 +00:00
Pooya Salehi
9c492e990a Use ProjectResolver in PrevalidateNodeRemoval
Explicitly fail the API call if it is in a multi-project setup. Use `ProjectResolver` to get the default (only) project.
2024-12-06 12:17:54 +01:00
Pooya Salehi
1db9e0a1bb Merge branch 'multi-project' into ps241203-multiProject-prevalidateRemoval 2024-12-06 11:04:08 +01:00
Niels Bauman
e0c83ef783 Merge main into multi-project 2024-12-05 14:34:31 +01:00
Niels Bauman
ffe911bd3c Merge main into multi-project 2024-12-05 13:25:44 +01:00
Simon Cooper
7cca0b3329 Add project-specific ReservedStateMetadata to ProjectMetadata (MP-1845)
On deserialization, state is split into project and cluster based on the namespace, which is hardcoded in `Metadata.Builder.MOVED_PROJECT_RESERVED_STATE`
2024-12-05 10:57:53 +00:00
Niels Bauman
26c88c1050 Make UpdateTimeSeriesRangeService project aware (MP-1844)
Updates the service to process data streams in all projects.
2024-12-05 11:55:44 +01:00
Pooya Salehi
d8e93d9145 Merge remote-tracking branch 'upstream/multi-project' into ps241203-multiProject-prevalidateRemoval 2024-12-05 11:17:43 +01:00
Pooya Salehi
332a0c02fb Apply all suggestions 2024-12-05 11:17:27 +01:00
Yang Wang
08b818aa1e Merge main into multi-project
Merge main into multi-project
2024-12-05 10:41:09 +11:00
Yang Wang
3e8adafe56 Assertion on routing tables from the old state 2024-12-05 09:34:55 +11:00
Niels Bauman
04da446e42 Merge main into multi-project 2024-12-04 23:18:13 +01:00
Pooya Salehi
3b6a2776a2 Use ProjectResolver in PrevalidateNodeRemoval 2024-12-04 17:36:20 +01:00
Yang Wang
48281b8424 Insert empty project routing table when hiding state (MP-1843)
Instead of using an empty global routing table, this PR uses empty
project routing table to ensure the project actual has a routing table
(albeit empty) when routingTable(projectId) is called.
2024-12-04 07:51:07 +00:00
Niels Bauman
6a87781cff Make force merge project aware (MP-1839)
Updates the force merge transport action to support multiple projects.
2024-12-04 08:47:11 +01:00
Yang Wang
a6812c4488 Make cluster state recover work with multi-project (MP-1836)
As title says. Cluster state recover can happen when master node restart
or during an ungraceful fail-over.
2024-12-04 07:41:38 +00:00
Yang Wang
52f8ce29bb Merge main into multi-project
Merge main into multi-project
2024-12-04 17:32:37 +11:00
Yang Wang
da8a473134 Merge main into multi-project 2024-12-04 16:26:03 +11:00
Simon Cooper
72474df0ca Merge main into multi-project 2024-12-03 17:30:45 +00:00
Simon Cooper
d7d4a1e657 Fix compile 2024-12-03 16:04:43 +00:00
Simon Cooper
c4835ce585 Fix TransportSetUpgradeModeAction 2024-12-03 15:49:10 +00:00
Simon Cooper
73645b2daf Merge remote-tracking branch 'upstream-main/main' into merge-main-031224 2024-12-03 15:48:16 +00:00
Niels Bauman
1fd8a8ba34 Allow creating and retrieving data streams in multiple projects (MP-1817)
Modifies the PUT and GET data stream APIs to be project-aware.
2024-12-03 09:14:21 +00:00
Niels Bauman
aba38b96d4 Remove unused multi-project utility methods (MP-1841) 2024-12-02 10:53:09 +00:00
Yang Wang
3d547d94bd Merge main into multi-project
Merge main into multi-project
2024-11-30 13:38:12 +11:00
Yang Wang
7f50a53e27 Mute new yaml test since it needs close index 2024-11-30 12:27:28 +11:00
Yang Wang
c2be03cfb5 Merge main into multi-project 2024-11-30 11:26:26 +11:00
Tim Vernum
53be424c39 Update exclusion list for core yaml tests (MP-1835) 2024-11-29 04:08:16 +00:00
Tim Vernum
880814c90d Introduce base RestTestCase for MultiProject (MP-1829)
Introduces `MultiProjectRestTestCase` that provides support for writing
rest tests against multiple projects
2024-11-29 10:31:39 +11:00
Yang Wang
ba75f4a3a0 Merge main into multi-project
Merge main into multi-project
2024-11-29 09:54:08 +11:00
Yang Wang
92867cdf50 Merge main into multi-project 2024-11-29 08:50:54 +11:00
Tim Vernum
a79fb3c8c5 Assert yaml tests only affect intended project (MP-1821)
This changes the `MultipleProjectsClientYamlSuiteTestCase` to verify
that every project other than the active project is "empty" at the end
of the test.

"empty" means that it has no indices, and only has the templates,
pipelines and ILM polices that are installed by default
2024-11-28 10:22:43 +00:00
Niels Bauman
195fe67420 Make WriteLoadForecaster project aware (MP-1828)
Changes `WriteLoadForecaster` and sublcasses to take a `ProjectMetadata`
builder instead of a `Metadata` builder.
2024-11-28 09:37:00 +00:00
Niels Bauman
ada1a1d938 Make DataStreamAutoShardingService project aware (MP-1827)
Changes `DataStreamAutoShardingService` to take a ProjectState instead
of a ClusterState.
2024-11-28 08:52:08 +01:00
Tim Vernum
fff5ca2048 Make async search project aware (MP-1823)
This updates `CoordinatorRewriteContextProvider` to use `ProjectState`
(instead of `ClusterState`) and enables the async_search YAML tests
2024-11-28 01:45:40 +00:00
Tim Vernum
d0682bfa36 Remove cluster-scope method from ResolvedIndices (MP-1824)
This removes the deprecated
```
resolveWithIndicesRequest(IndicesRequest, ClusterState, ... )
```
method from `ResolvedIndices` now that it is unused.

The makes `ResolvedIndices` completely project scoped.
2024-11-28 09:43:35 +11:00
Yang Wang
f3ed2b2f2f Make put-alias project aware (MP-1805)
This PR makes put-alias project aware so that the aliases API works in a
multi-project setup. This is achieved by adding a new project-id field
to IndicesAliasesClusterStateUpdateRequest.

The alias actions are also used by MetadataRolloverService. These usages
are NOT updated in this PR and still assumes default project. They will
be handled separately.
2024-11-27 16:53:22 +00:00
Niels Bauman
8701fd0bea Merge main into multi-project 2024-11-27 16:02:56 +01:00
Niels Bauman
5fba9d8250 Merge remote-tracking branch 'public/main' into merge-main
# Conflicts:
#	server/src/main/java/org/elasticsearch/action/get/TransportGetAction.java
#	server/src/main/java/org/elasticsearch/action/get/TransportShardMultiGetAction.java
#	server/src/main/java/org/elasticsearch/action/search/TransportSearchAction.java
#	server/src/main/java/org/elasticsearch/cluster/routing/IndexRoutingTable.java
#	server/src/main/java/org/elasticsearch/cluster/routing/OperationRouting.java
#	server/src/main/java/org/elasticsearch/cluster/routing/ShardRouting.java
#	server/src/test/java/org/elasticsearch/cluster/routing/IndexRoutingTableTests.java
2024-11-27 13:57:22 +01:00
Tim Vernum
3f07b1b07a Fix SearchShards to be project aware (MP-1822)
This fixes 1 remaining place in `TransportSearchShardsAction` that
relied on the default project.

This change allows a lot of ES|QL tests to pass
2024-11-27 20:08:42 +11:00
Yang Wang
955299879c Merge main into multi-project
Merge main into multi-project
2024-11-27 17:13:41 +11:00
Elastic Machine
e226ea1eba Merge branch 'multi-project' into mp/merge/main/20241127T13 2024-11-27 05:05:24 +00:00
Yang Wang
f83bfbc42e Remove put-project from constants of operator action check (MP-1820) 2024-11-27 16:04:35 +11:00
Tim Vernum
5e6864b9cf Make explain project aware (MP-1812)
This commit updates `TransportExplainAction` to be project aware and
enables the YAML tests
2024-11-27 15:46:23 +11:00
Tim Vernum
a65f1443bb Cleanup XPack YAML exclusions (MP-1811)
This cleans up the exclusion list for
`xpack-rest-tests-with-multiple-projects` to enable some working tests
and be more explicit about which tests are disabled.
2024-11-27 03:46:56 +00:00
Tim Vernum
a9d4d8a254 Make validate_query project aware (MP-1813)
This updates `TransportValidateQueryAction` to be project aware and
enables the YAML tests
2024-11-27 13:37:34 +11:00
Yang Wang
878a162929 Merge main into multi-project 2024-11-27 13:31:50 +11:00
Yang Wang
b39876c006 Merge main into multi-project
Merge main into multi-project
2024-11-27 11:29:07 +11:00
Yang Wang
40db855554 Merge commit 'e9f899ee69' into mp/merge/main/20241127T09 2024-11-27 10:17:28 +11:00
Niels Bauman
49f3f549b2 Make ILM CRUD APIs (properly) project aware (MP-1802)
The PUT and DELETE APIs were already project aware, but pushed the
project resolver into the cluster state update task. This commit pushes
the project id down instead - which is consistent with other actions
that have been made project aware.

Additionally, this commit makes the GET ILM policy project aware and it
includes ILM's YAML REST tests in the multi-project test suite.
2024-11-26 16:07:02 +00:00
Yang Wang
8b06eab128 Add writeTo for DeleteProjectRequest (MP-1814)
See title
2024-11-26 16:03:52 +00:00
Niels Bauman
ae018d0aa0 Merge main into multi-project 2024-11-26 15:31:35 +01:00
Niels Bauman
a008545bf3 Merge remote-tracking branch 'public/main' into merge-main 2024-11-26 13:10:41 +01:00
Tim Vernum
079c8c7187 Project aware DeprecationRoleDescriptorConsumer (MP-1809)
Updates DeprecationRoleDescriptorConsumer to lookup indices in the
active project
2024-11-26 07:57:59 +11:00
Niels Bauman
5753f8e8cd Merge main into multi-project
Merge main into multi-project
2024-11-25 14:50:14 +01:00
Niels Bauman
ef2a7cad71 Merge main into multi-project 2024-11-25 13:43:34 +01:00
Tim Vernum
264a8852cb Make DiskThresholdMonitor project aware (MP-1804)
This commit updates `DiskThresholdMonitor` to track indices using the
`Index` object (which implicitly depends on the index UUID) rather than
using index names directly and then update the index read-only setting
in the owning project.
2024-11-25 11:28:35 +00:00
Yang Wang
9c6fdbc4e7 [Test] New helper method to random with the default projectId (MP-1803)
See title
2024-11-25 19:30:07 +11:00
Yang Wang
4a120ccb96 [Test] More precise matching for muted YAML tests (MP-1807)
The PR makes all patterns for muted YAML tests to start matching from
the beginning to avoid accidentally muting unrelated tests.
2024-11-25 07:07:36 +00:00
Tim Vernum
32739318dd Handle multiple projects in ML-assign-notifier log (MP-1806)
Updates `MlAssignmentNotifier.logLongTimeUnassigned` to process each
project explicitly
2024-11-25 06:56:12 +00:00
Yang Wang
7fbb2526a5 Make reroute command work with projects (MP-1733)
This PR proposes changes to make a YAML test pass for cluster reroute 
commands, specifically the cancel allocation command. The allocation 
command is initiated by user but batch executed in the cluster state 
update thread where it loses the thread context. It also no longer has 
access to the original request object at that time. This PR changes 
the parsing process to take the project id and inject it into the command 
objects itself.

The retry_failed parameter can be used without any specific allocation 
command. For the time being, the PR keeps it working at cluster level 
but adds constraint that it can only be used if there is no allocation 
command.
2024-11-25 03:20:08 +00:00
Yang Wang
3f923c78c8 Merge main into multi-project
Merge main into multi-project
2024-11-23 18:25:40 +11:00
Yang Wang
f8f0a87b69 Fix multi-project build.gradle
Remove erroneous import
2024-11-23 17:22:24 +11:00
Yang Wang
b8f8656fda Merge main into multi-project 2024-11-23 16:55:53 +11:00
Yang Wang
1b0abf9d11 New setting for enabling multi-project (MP-1800)
This PR introduces a new setting to enable the multi-project feature.
Default to false.
2024-11-23 07:33:41 +11:00
Tim Vernum
d2c30fc956 Make index deletion project aware (MP-1799)
This commit modifies `MetadataDeleteIndexService` to be able to delete
indices across multiple projects
2024-11-22 20:01:54 +11:00
Yang Wang
edfc6d1457 Mark Project APIs as internal (MP-1798)
Mark these APIs as internal otherwise they are not accessible in
stateless.
2024-11-22 18:37:10 +11:00
Tim Vernum
bff108d15e Make "_update" project aware (MP-1790)
This commit modifies `TransportUpdateAction` to be project aware
2024-11-22 03:29:52 +00:00
Tim Vernum
fc5b3aa309 Enable additional working YAML tests (MP-1795) 2024-11-22 03:23:36 +00:00
Tim Vernum
8e03a86414 Merge main into multi-project 2024-11-22 13:05:45 +11:00
Tim Vernum
8f8fe06550 Merge revision de73397 into multi-project 2024-11-22 11:55:39 +11:00
Tim Vernum
d81ff4b192 Enable indices.put_mapping yaml tests (MP-1794) 2024-11-22 10:45:25 +11:00
Tim Vernum
6931da5eb9 Enable indices.create yaml tests (MP-1793)
These tests now work due to other fixes, but were still muted.
2024-11-22 10:45:16 +11:00
Tim Vernum
813c1bde3f Enable various security YAML tests (MP-1792)
This unmutes a number of security-related YAML tests that correctly
function now that we have merged the following PRs

- MP-1752
- MP-1755
- MP-1764 
- MP-1771
- MP-1772
- MP-1775
- MP-1782
2024-11-22 10:44:20 +11:00
Niels Bauman
a40ad7df09 Make data stream deletion project-aware (MP-1678)
This commit allows the data stream deletion API to function in a
multi-project setting.
2024-11-21 15:25:55 +00:00
Yang Wang
991ff1b901 Reinstate the shardRouting parameter (MP-1796)
Though this parameter is unused in the stateful method. The overriden
method in stateless does use it.

Relates: MP-1616
2024-11-21 15:15:01 +00:00
Tim Vernum
66f9bd56f0 Merge main into multi-project 2024-11-22 01:13:24 +11:00
Tim Vernum
c8fbd078e0 Fix desired balance 2024-11-21 22:24:47 +11:00
Tim Vernum
b3555fe799 Fix merge 2024-11-21 21:33:44 +11:00
Tim Vernum
442138e86d Merge main into multi-project 2024-11-21 21:10:53 +11:00
Tim Vernum
192ed6c5a4 Merge main into multi-project 2024-11-21 11:25:11 +11:00
Niels Bauman
d56d860431 Make ingest pipelines project aware (MP-1788)
This makes the ingest CRUD APIs and the majority of the `IngestService`
project aware.
This does not include the parts of the `IngestService` that are related
to executing the pipelines in bulk requests.
2024-11-20 09:48:20 +01:00
Tim Vernum
369a2b3205 Make SecurityIndexManager project aware (MP-1764)
This changes `SecurityIndexManager` so that it is aware of projects, and
can deal with indices in each project having different states
(`.security` exists in some projects, but not others, has unavailable
shards in one project, etc).

The design is that the `SecurityIndexManager` handles all projects, and
has a single listener for cluster state events. It tracks the state of
the applicable security index in each individual project.

Methods that enquired about the state of an index have been move from
`SecurityIndexManager` itself to the inner class
`ProjectSecurityIndex`.

Callers now need to obtain a reference to the correct
`ProjectSecurityIndex` via either:
- `getProject(ProjectId)` _or_
- `forCurrentProject` (which relies on the `ProjectResolver`).

One side effect of this is that some calls that previously would have
seen the "live" state of the security index (i.e. state as at last
cluster change event) may now see something that is a millisecond or 2
old because `ProjectSecurityIndex` retains a point in time view of the
index state.
For the most part this is a benefit as it ensures that a series of
decisions about the state oif the index are made from a consistent view
of that state. The previous implementation has a `defensiveCopy` method
that was intended to be used for this purpose, but its use was optional
and not consistent.
2024-11-20 05:54:47 +01:00
Niels Bauman
0331a84c6a Make template retrieval APIs project-aware (MP-1767)
Make the retrieval APIs for component and index templates work with
multiple projects (properly).
2024-11-19 12:03:25 +01:00
Tim Vernum
03f3f6e150 Make SystemIndexMappingUpdateService project aware (MP-1782)
This commit changes `SystemIndexMappingUpdateService` so that it updates
system indices in any/every project.

There is a single cluster state listener that determines the set of
system indices that need to be updated across all loaded projects, and
triggers an update on each of these.
2024-11-19 12:02:11 +01:00
Yang Wang
0ad7bd7da0 Make get-alias project aware (MP-1785)
This PR makes get-alias API project aware and also unmuted relevant YAML
tests.
2024-11-19 10:56:08 +01:00
Tim Vernum
2820ba7ef2 Merge main into multi-project 2024-11-19 19:35:14 +11:00
Niels Bauman
0620f1ba10 Make legacy templates project-aware (MP-1787)
Updates the GET, DELETE, and PUT APIs for managing legacy templates in
multiple projects.
2024-11-19 09:23:52 +01:00
Tim Vernum
4cfb619448 Merge main into multi-project 2024-11-19 18:22:02 +11:00
Niels Bauman
5563b40d2c Merge main into multi-project 2024-11-18 12:04:07 +01:00
Niels Bauman
0edb9fa778 Merge remote-tracking branch 'public/main' into merge-main
# Conflicts:
#	server/src/main/java/org/elasticsearch/action/search/TransportSearchShardsAction.java
#	server/src/main/java/org/elasticsearch/cluster/routing/allocation/AllocationStatsService.java
#	server/src/main/java/org/elasticsearch/gateway/GatewayMetaState.java
#	server/src/main/java/org/elasticsearch/plugins/Plugin.java
#	server/src/test/java/org/elasticsearch/gateway/GatewayMetaStateTests.java
#	server/src/test/java/org/elasticsearch/ingest/IngestMetadataTests.java
2024-11-18 10:53:12 +01:00
Tim Vernum
c6da68ee77 Make TransportSearchAction project aware (MP-1775)
This commit updates `TransportSearchAction` to replace all applicable
cluster references with project references.
2024-11-18 15:42:13 +11:00
Niels Bauman
0eb7502124 Extract builder convenience on ProjectState (MP-1766) 2024-11-13 16:37:51 +01:00
Yang Wang
01dca5501c Make get-index-settings work with multi-project (MP-1779)
This PR makes the transport action works with multi-project and unmute
relevant YAML tests.
2024-11-12 08:59:39 +01:00
Yang Wang
f55fa9bd80 Make indices.flush YAML test work (MP-1781)
This PR makes TransportIndicesStatsAction project aware which allows
unmute for the indices.flush YAML tests.
2024-11-12 07:53:14 +01:00
Yang Wang
c279754a2c Selective mute for get-mappings yaml tests (MP-1780)
This PR selectively mute the ones rely on index-close and aliases and
unmute others.
2024-11-12 07:46:50 +01:00
Niels Bauman
7c31e75444 Introduce TransportMasterNodeReadProjectAction (MP-1773)
Introduces a new abstract subclass of TransportMasterNodeReadAction that
takes care of resolving the project.
2024-11-12 03:29:33 -03:00
Yang Wang
749195ff26 Merge main into multi-project
Merge main into multi-project
2024-11-12 16:40:16 +11:00
Yang Wang
869dc8f0aa fix test compilation 2024-11-12 15:37:22 +11:00
Yang Wang
acea078f85 fix compilation 2024-11-12 15:16:42 +11:00
Yang Wang
4878fb7a36 Merge remote-tracking branch 'origin/multi-project' into merge-multi-project-2024-11-12T14 2024-11-12 14:56:07 +11:00
Tim Vernum
b901c1f2d1 Make refresh work with multiple projects (MP-1776)
Changes `TransportShardRefreshAction` to lookup the project by Index
UUID rather than using the default project
2024-11-12 10:21:37 +11:00
Tim Vernum
917d162009 Add project scoped methods to ResolveIndices (MP-1771)
This refactors the `resolveWithIndicesRequest` and `resolveWithPIT` to
be project scoped (they take `ProjectMetadata` in place of
`ClusterState`)

The existing methods (that take `ClusterState`) still exist but are
deprecated and delegate to the new methods (taking `ProjectMetadata`)
2024-11-12 10:19:56 +11:00
Yang Wang
262550ef3a Make auto-create-index project aware (MP-1777)
As title says, this PR makes the auto-create-index action project aware
and unmute YAML tests that can now pass. Note this works for regular
indices. More work is still required for data-streams.
2024-11-12 09:40:53 +11:00
Tim Vernum
0e986c50e7 Make Async-Search cleanup handle multiple projects (MP-1742)
The `AsyncTaskMaintenanceService` deletes async search results after a
period of time (default: 1h)
This change makes this service work correctly when there are multiple
projects (and potentially multiple async-search indices).

A single instance of the service runs on each data node (this is
unchanged beahviour). The service checks each project for a copy of the
`.async-search` index, where the primary shard#0 is on the local node
(the only change here is to check each project) and then performs a
delete-by-query on the `.async-search` index in that project (the change
here is to make it project aware)
2024-11-11 20:32:47 +11:00
Tim Vernum
590f7e8491 Merge main into multi-project 2024-11-11 18:01:24 +11:00
Tim Vernum
17c27bc42b Merge main into multi-project 2024-11-11 16:28:45 +11:00
Tim Vernum
d35c513cf2 Make buildAliasFilter project scoped (MP-1772)
This commit changes `IndicesService.buildAliasFilter` to accept
`ProjectState` instead of `ClusterState`
2024-11-11 15:19:21 +11:00
Simon Cooper
8ffb46f45b Add some tests for multi-project changes (MP-1765) 2024-11-08 09:18:15 +00:00
Yang Wang
788f0fae55 Throw more consistently for not found project (MP-1768)
It is possible that a project may not be found in the cluster state due
to concurrent operations or other reasons. It is a valid exception case.
This PR makes sure the exception is thrown consistently and removes
unnecessary assertions.
2024-11-08 09:01:20 +01:00
Yang Wang
4adaac803b Add canSupportMultipleProjects to ProjectResolver interface (MP-1763)
There are places where we need to be certain whether the cluster runs in
a multi-project setup or not. The new method is to support that.
2024-11-08 07:50:28 +01:00
Yang Wang
7186654da0 Merge main into multi-project
See title
2024-11-08 16:44:33 +11:00
Yang Wang
c64e5a9e01 Merge remote-tracking branch 'origin/multi-project' into merge/main/20241108T15 2024-11-08 15:42:14 +11:00
Niels Bauman
d1d3f90fc8 Fix compilation of using ProjectResolver.getProjectId() 2024-11-07 13:29:55 -03:00
Niels Bauman
59f810f290 Allow putting and deleting component templates into multiple projects (MP-1757)
Updates both the PUT and DELETE _component_template APIs to be
project-aware.
2024-11-07 12:55:47 -03:00
Simon Cooper
d4a242bbf1 Migrate TransportSingleShardAction to multi-project (MP-1761) 2024-11-07 10:15:06 +00:00
Yang Wang
6f93794108 Merge main into multi-project
Merge main into multi-project
2024-11-07 16:37:41 +11:00
Yang Wang
8d376c89ce ProjectResolver.getProjectId now takes no argument (MP-1749)
A ProjectResolver should be able to fetch the ProjectId without the need
of a cluster state. This PR changes the method to take no argument and
fixes cascading changes. It also adds a separate ProjectIdResolver
interface to host the new no-arg getProjectId method. The existing
ProjectResolver interface extends the new interface.

The major impact of the change is for tests and test helpers. It has
been made more obvious that most tests rely on the default project ID.
Previously this was hidden by the no arg `singleProjectOnly()` that just
pops the only project from cluster state. This only project is the
default project anyway in the current tests. The change just made this
fact explicit which I think is not a bad thing. We can definitely tidy
up the tests and test helpers once more pieces fall into places. Happy
to take suggestions.
2024-11-07 11:21:38 +11:00
Yang Wang
4778f59858 Merge remote-tracking branch 'origin/multi-project' into merge-multi-project-2024-11-07T10 2024-11-07 09:53:53 +11:00
Niels Bauman
11d30e7f89 Allow deleting index templates in multiple projects (MP-1756)
Updates the DELETE _index_template API to be project-aware.
2024-11-06 13:35:21 -03:00
Simon Cooper
8ceb21ab70 Support GETs in multi-project (MP-1760)
You can now GET from indices
2024-11-06 15:55:53 +00:00
Simon Cooper
9aa0f4f983 Add projects to RoutingIteratorTests (MP-1759) 2024-11-06 15:52:22 +00:00
Niels Bauman
f9c206c1be Allow putting index templates into multiple projects (MP-1754)
Allows the PUT _index_template API to support multiple projects.
2024-11-06 11:03:22 -03:00
Simon Cooper
a2814ad65b Make OperationRouting multi-project aware (MP-1735)
Make methods in OperationRouting take a ProjectMetadata/Id, and propagate
2024-11-06 09:22:37 +00:00
Tim Vernum
e899a37297 Merge main into multi-project 2024-11-06 20:15:38 +11:00
Tim Vernum
da5da54f3f Merge main into multi-project 2024-11-06 16:05:33 +11:00
Tim Vernum
dd08af6caa Dont fail MlAssignmentNotifier with multi projects (MP-1747)
This changes `MlAssignmentNotifier` so that it can tolerate multiple
projects in a cluster.

If any project other than the default project has a persistent task,
then this code will still fail, however the mere existence of multiple
projects will not cause errors during cluster change events
2024-11-06 13:20:25 +11:00
Tim Vernum
f1dc8ac901 Preserve project-id when stashing thread context (MP-1755)
"stashing" the thread context is typically used to execute something
with a differenet set of privileges (access to system indices, or a
different user). In these cases we don't want to lose the project-id
from the context (just like we don't want to lose APM tracing
information).

This change preserves the project-id during stash.
2024-11-06 13:19:44 +11:00
Tim Vernum
534de3a361 Make more of bulk action project-aware (MP-1752)
`TransportBulkAction.populateMissingTargets` is responsible for
resolving the list of index-like targets need to have actions performed
before the bulk ingestion can be processed. This includes
- indices which need to created
- data-streams which need to rollover
- failure-stores that need to rollover

This change makes this method resolve the correct project rather than
operating on the default project.
2024-11-06 12:22:41 +11:00
Tim Vernum
ceff5832d0 Merge main into multi-project 2024-11-05 23:12:22 +11:00
Tim Vernum
9984255c10 Merge main into multi-project 2024-11-05 17:54:35 +11:00
Tim Vernum
5b1b3d61f3 Merge main into multi-project 2024-11-04 18:08:02 +11:00
Tim Vernum
de9a4b5995 Skip logsdb yaml tests 2024-11-04 16:59:54 +11:00
Tim Vernum
a855d74b2c Merge main into multi-project 2024-11-04 15:16:27 +11:00
Tim Vernum
859841ff8f Execute a block of code on a specific project (MP-1748)
This change adds a method to the project resolver that will run a block
of code (`CheckedRunnable`) in the context of a specified project.
2024-11-04 14:12:32 +11:00
Simon Cooper
fd79d54d22 Add test for indexing a document (MP-1725)
This also has some changes to make the test pass (specifically, test teardown), but still need actual multi-project work later on
2024-11-01 11:31:17 +00:00
Simon Cooper
f291efee4e Add a ProjectState object (MP-1746)
Adapted from https://github.com/elastic/elasticsearch-internal/pull/1745
---------
Co-authored-by: tvernum <tim.vernum@elastic.co>
2024-11-01 09:20:22 +00:00
Tim Vernum
24934c200f Merge main into multi-project 2024-11-01 18:46:35 +11:00
Tim Vernum
7750653621 Merge main into multi-project 2024-11-01 17:28:07 +11:00
Simon Cooper
7f83299c31 Add a ProjectId field to ClusterStateCreationUtils methods (MP-1737)
To aid with testing cluster states
2024-10-31 16:27:05 +00:00
Tim Vernum
2bf59f94c0 Merge main into multi-project 2024-10-31 14:33:05 +11:00
Tim Vernum
2ba2d2a995 Merge main into multi-project 2024-10-31 11:55:04 +11:00
Tim Vernum
a5ab8190e7 Make Searchable Snapshot deciders project aware (MP-1734)
This updates the various AllocationDeciders and Allocator for
searchable-snapshots to be able to work correctly in a multi-project
cluster
2024-10-30 14:10:53 +11:00
Tim Vernum
7d91c46324 Make Ccr AllocationDecider project aware (MP-1739)
Updates CcrPrimaryFollowerAllocationDecider so that it can handle
multiple projects
2024-10-30 14:10:19 +11:00
Tim Vernum
02227b7d0f Make ArchiveAllocationDecider project-aware (MP-1738)
Updates the ArchiveAllocationDecider (bwc/old-lucene-versions) to
support running with multiple projects
2024-10-30 09:53:02 +11:00
Simon Cooper
4df7c28762 Add ProjectMetadata overrides to all IndexNameExprResolver methods (MP-1730)
Create ProjectMetadata overrides for all methods in IndexNameExpressionResolver, so they can be used with a ProjectMetadata or a ClusterState
2024-10-29 13:43:33 +00:00
Tim Vernum
a89cb7b161 Use routing table to check project setup in tests (MP-1740)
In the multi-project yaml rest tests, switch to using the routing table
(from cluster state, see MP-1695) to determine that the projects have been
correctly created and configured in the test client.
2024-10-29 15:29:46 +11:00
Tim Vernum
8c390d4eae Common base class for multi-project YAML tests (MP-1736)
Extract a common base class for running YAML rest tests against core and
x-pack
2024-10-29 12:40:46 +11:00
Tim Vernum
c174706975 Run X-Pack YAML tests on Multi Project (MP-1731)
This runs the X-Pack YAML test suite against a cluster with multiple
projects
2024-10-28 23:20:10 +11:00
Tim Vernum
f459921a94 Support get-project-for-index on Metadata (MP-1693)
This commit adds methods to `Metadata` that allow the retrieval of the
`ProjectMetadata` (or `IndexMetadata`) for an `Index`

In practice this:
- Moves `ProjectLookup` from `GlobalRoutingTable` to `Metadata`
- Adds new methods like `projectFor(Index)` on `Metadata`
- Updates all references to `GlobalRoutingTable.getProjectLookup()` to
use the new methods on `Metadata`
- Hides the `ProjectLookup` interface so that it becomes an
implementation detail

There's probably some more cleanup that could be done, but this change
gets us moving in the right direction.
2024-10-28 21:23:00 +11:00
Tim Vernum
9b85c47f0d Merge main into multi-project 2024-10-28 16:54:48 +11:00
Tim Vernum
eaaec67125 Merge main into multi-project 2024-10-28 15:33:41 +11:00
Niels Bauman
b59a55e528 Allow RestClusterStateAction to output multiple projects (MP-1695)
This commit adds parameters to the REST action and request that allow
retrieving the cluster state with all projects serialized.
2024-10-25 11:34:13 -03:00
Yang Wang
67d9587abc Merge main into multi-project
Merge main into multi-project
2024-10-25 21:48:02 +11:00
Yang Wang
6a533beba0 Merge remote-tracking branch 'stateful/main' into merge/main/20241025T1914 2024-10-25 20:24:28 +11:00
Yang Wang
1206819628 Merge remote-tracking branch 'stateful/main' into tmp 2024-10-25 19:14:05 +11:00
Niels Bauman
b5d16f1010 Make cluster health API project-aware (MP-1668)
This commit allows the cluster health API to function in a multi-project
setting. Note: the API is only able to operate on a single project per
request. In the future, we might want to consider changing the API to
allow for multi-project responses, but that's a discussion for later.

This is part of an ongoing effort to get the cleanup part of integration
tests to work in a multi-project setting.
2024-10-25 16:49:27 +11:00
Tim Vernum
f4d2c97d84 Merge main into multi-project 2024-10-25 15:32:48 +11:00
Tim Vernum
fd55e00fa7 Merge main into multi-project 2024-10-25 14:21:13 +11:00
Tim Vernum
58bae4334f Enable more yaml tests on multi project (MP-1722)
This commit enables some more yaml rest tests that are already working
on multi-project
2024-10-24 21:47:07 +11:00
Simon Cooper
a3466d7f3f Make TransportShardBulkAction multi-project aware (MP-1719) 2024-10-24 09:04:40 +01:00
Tim Vernum
9390e1b2ee Merge main into multi-project 2024-10-24 15:48:47 +11:00
Tim Vernum
616bb2622e Merge main into multi-project 2024-10-24 13:09:21 +11:00
Simon Cooper
b2e0685ca1 Make BulkOperation multi-project aware (MP-1714) 2024-10-23 13:20:07 +01:00
Albert Zaharovits
6945137f4e Update index mappings in MP (MP-1703) 2024-10-23 12:17:53 +03:00
Tim Vernum
06f0c51ec2 Run a subset of core YAML Rest tests on Multi Project (MP-1717)
This introduces a new QA project that runs the core YAML rest tests
against a cluster with multiple projects.

At this point in time:
- Only 1 project is actively tested at a time
- That project is not the "default" project
- There are other projects in the cluster
- Those projects are empty
- There is a long exclude list of YAML tests
- There are a handful of tests that are executed successfully
2024-10-23 20:15:41 +11:00
Simon Cooper
47133c1f43 Merge branch 'update-main-22-10-24' into multi-project 2024-10-23 08:37:07 +01:00
Tim Vernum
465cbf2ddd Merge main into multi-project 2024-10-23 18:03:04 +11:00
Tim Vernum
ddb6c9cabb Fix test 2024-10-23 15:08:35 +11:00
Tim Vernum
8d79154cf1 Merge main into multi-project 2024-10-23 14:24:30 +11:00
Tim Vernum
c6fa3f599d Prevent contruction of invalid project ids (MP-1700)
This means that actions, parsers, etc that work with project-ids don't
need to have checks like

```
  if( Strings.isNullOrBlank(projectId.id()) )
```

Because they know that a project-id cannot be null or blank.

Similarly use of whitespace or non-ascii characters in project-ids can
lead to subtle or unexpected bugs. We assert that these are not used.
2024-10-23 14:01:54 +11:00
Tim Vernum
dc61a95c6f Use multiple projects in Metadata MP XContent test (MP-1711)
This updates `MetadataTests.testMultiProjectXContent` to test with
multiple projects
2024-10-23 14:01:07 +11:00
Simon Cooper
f35b57902b Update new tests 2024-10-22 16:25:30 +01:00
Simon Cooper
141a4b11c4 Fix compile 2024-10-22 15:32:53 +01:00
Simon Cooper
c7216ca9bb Merge branch 'main' into update-main-22-10-24 2024-10-22 15:13:32 +01:00
Tim Vernum
9d73948c21 Merge main into multi-project
Merge main into multi-project
2024-10-22 17:13:24 +11:00
Tim Vernum
d4e4b5abb0 Merge main into multi-project 2024-10-22 13:03:12 +11:00
Tim Vernum
feb1858d07 Single project XContent of non-default project (MP-1710)
When TransportClusterStateAction runs against a specific project, it
returns a `ClusterState` that contains a single project (the one
specified). This project may not have the default project id, but needs
to be able to be serialized in the XContent response.

This commit allows `Metadata` to serialize a single project in
non-multi-project mode, even if it is not the default project.
2024-10-22 11:21:02 +11:00
Tim Vernum
c5d55aa5a3 Improve error message in PutProjectAction (MP-1713)
Include the project-id in the error message so that the caller knows
which project id was invalid (useful when randomly generating project
ids)
2024-10-22 11:19:47 +11:00
Simon Cooper
909d41f79d Add ProjectResolver to TransportAbstractBulkAction (MP-1706) 2024-10-21 16:07:45 +01:00
Simon Cooper
48501d3329 Add ProjectResolver to TransportWriteAction (MP-1709) 2024-10-21 16:06:40 +01:00
Niels Bauman
4a7ebdf7f4 Add project deletion API (MP-1697)
This API simply removes the project from the metadata and global routing
table. That should be sufficient for now, but we might want to
reconsider in the future if we need to take more actions and/or handle
that differently.
2024-10-21 11:42:25 -03:00
Tim Vernum
aa6afe981e Merge main into multi-project 2024-10-21 17:51:02 +11:00
Tim Vernum
883471e3b2 Merge main into multi-project 2024-10-21 16:35:42 +11:00
Niels Bauman
bd23047ace Make rollup retrieval API project-aware (MP-1673)
This allows the project retrieval API to function with multiple projects
in the cluster.

This is part of an ongoing effort to get the cleanup part of integration
tests to work in a multi-project setting.
2024-10-19 14:28:00 -03:00
Albert Zaharovits
0382940170 Merge main into multi-project
Merge main into multi-project
2024-10-18 10:06:27 +03:00
Albert Zaharovits
1defecfead Merge main into multi-project 2024-10-17 19:28:15 +03:00
Albert Zaharovits
5160b991f2 Create index in multi-project (MP-1642)
Indices can be created in a multi-project aware cluster.
2024-10-17 17:06:15 +03:00
Niels Bauman
7598880e3a Make refresh and flush actions project-aware (MP-1675)
Allows the refresh and flush actions to work on multiple projects in the
cluster.
2024-10-17 09:24:35 -03:00
Tim Vernum
77303321ad Merge main into multi-project 2024-10-17 19:27:35 +11:00
Tim Vernum
ad798a15af Merge main into multi-project 2024-10-17 18:13:14 +11:00
Tim Vernum
e4624b802f Make ProjectId.toString just be the id (MP-1699)
ProjectId is a record which means it had an auto-generated toString that
included the class name.

However, most of the time, we actually want to do something like

    throw new IllegalStateException("cannot find project [" + id + "]");

and just have the raw project-id included.

This commit changes toString to do exactly that.
2024-10-17 16:30:40 +11:00
Tim Vernum
3c7ca9994b Make IndicesAndAliases resolve project scoped (MP-1701)
This updates `IndexAbstractionResolver` and
`IndicesAndAliasesResolver` to depend on `ProjectMetadata` instead of
`Metadata`.
 
Relates: MP-1662
2024-10-17 16:18:33 +11:00
Tim Vernum
2f726596d4 Merge main into multi-project 2024-10-16 11:40:45 +11:00
Tim Vernum
524a328819 Merge main into multi-project 2024-10-16 10:29:26 +11:00
Niels Bauman
7445a8949b Change the signature of the put project API (MP-1696)
This signature is significantly easier to work with. If we ever need
other JSON fields in the request, we can always still add them.
2024-10-15 20:18:03 -03:00
Niels Bauman
59de93a510 Merge pull request MP-1674 from nielsbauman/slm
Allow multiple projects in SLM policy retrieval API
2024-10-15 14:14:38 -03:00
Elastic Machine
27e3a27f1b Merge branch 'multi-project' into slm 2024-10-15 17:07:16 +02:00
Tim Vernum
5933b041ef Add @FixForMultiProject annotation (MP-1691)
This annotation (which will be removed in the future) marks places in
the source code that we need to revisit as part of the multi-project
initiative.

It can be used to mark
 * code that should be removed,
 * code where we have made decisions that we'd like to revisit
 * places that are known to break when operating on multiple projects
* anything else that needs to be looked at before the code can be
considered production-ready
2024-10-15 19:02:21 +11:00
Tim Vernum
30e28e59da Merge main into multi-project 2024-10-15 16:22:23 +11:00
Tim Vernum
586d543918 Merge main into multi-project 2024-10-15 15:08:06 +11:00
Simon Cooper
2d027c696b Make IndexNameExpressionResolver project-aware (MP-1688) 2024-10-14 11:53:47 +01:00
Simon Cooper
17a93e7456 Change ProjectLookup to return Optional<ProjectId> (MP-1685)
Rather than `@Nullable`, use `Optional`
2024-10-14 11:52:09 +01:00
Simon Cooper
5249d3baf9 Merge main into multi-project
Merge main into multi-project
2024-10-14 09:11:50 +01:00
Tim Vernum
413d7cb29d Fix compile error 2024-10-14 17:31:14 +11:00
Tim Vernum
1c62e4f533 Merge main into multi-project 2024-10-14 16:30:28 +11:00
Simon Cooper
82c28b3392 Add an exception indicating not multi-project compatible, and filter warnings using that exception (MP-1683)
Currently, test logs are filled with warnings about things not
supporting multiple projects. So we have a chance to filter out things
that we're actually working on, add and catch a specific exception type
for not-multi-project-compatible state listeners (and others, in time)
2024-10-10 16:12:09 +01:00
Niels Bauman
db5941da24 Merge branch 'multi-project' into slm 2024-10-10 10:50:07 -03:00
Simon Cooper
4ef221a6e5 Add multi-project module to ML integration tests (MP-1690)
The introduction of the multi-project feature means that the special
clusters created by native ML tests can't join as they don't also have
multi-project. This adds the module to those clusters, so they at least
have the multi-project feature
2024-10-10 14:42:21 +01:00
Simon Cooper
a63f5acca4 Update main, 10-10-24 2024-10-10 14:41:53 +01:00
Niels Bauman
fa3c617b37 Merge branch 'multi-project' into slm 2024-10-10 09:52:06 -03:00
Simon Cooper
f981d1f9e2 Merge remote-tracking branch 'upstream-main/main' into update-main-10-10-24 2024-10-10 13:27:33 +01:00
Simon Cooper
da094657c8 Fixup after merge 2024-10-10 10:51:14 +01:00
Simon Cooper
4832ad7ed9 Add a cluster feature for multi-project (MP-1682)
Add a cluster feature indicating the node is multi-project. Once a
node/cluster becomes multi-project, it should not go back to being
pre-multi-project. This node feature can also be used to check
conditions on various operations in the future.
2024-10-10 09:16:03 +01:00
Albert Zaharovits
e8873fa475 Merge pull request MP-1684 from elastic/main-update-9-10-24
Update main, 9-10-24
2024-10-10 09:39:12 +03:00
Simon Cooper
09f91cdaec Merge branch 'main' into main-update-9-10-24 2024-10-09 17:08:05 +01:00
Albert Zaharovits
ba5b32f8ce Merge main into multi-project
Merge main into multi-project
2024-10-07 17:50:17 +03:00
Albert Zaharovits
514104f996 Merge main into multi-project 2024-10-07 16:41:00 +03:00
Albert Zaharovits
6e1686cbe8 Merge main into multi-project
Merge main into multi-project
2024-10-06 15:03:12 +03:00
Albert Zaharovits
36fcdb5d0b Merge main into multi-project 2024-10-06 13:54:49 +03:00
Niels Bauman
6b6f0b1f81 Make SLM retrieval API project-aware 2024-10-04 18:00:31 -03:00
Niels Bauman
f0233fd8f0 Allow multiple projects in SLM policy retrieval API
This prevents the SLM policy retrieval API from breaking when there are
multiple projects in the cluster state. This does _not_ allow multiple
projects to have SLM policies yet.

This is part of an ongoing effort to get the cleanup part of integration
tests to work in a multi-project setting.
2024-10-02 10:32:40 -03:00
Niels Bauman
9fc87c8d62 Add MultiProjectResolver (MP-1665) 2024-10-01 16:15:47 +03:00
Albert Zaharovits
bbd0f02de4 Merge main into multi-project
Merge main into multi-project
2024-10-01 15:09:26 +03:00
Albert Zaharovits
90e9f03171 Merge main into multi-project 2024-10-01 14:03:54 +03:00
Albert Zaharovits
25b70063cc Merge main into multi-project
Merge main into multi-project
2024-10-01 10:54:09 +03:00
Albert Zaharovits
d8e2b88cdc Merge main into multi-project 2024-10-01 09:48:59 +03:00
Tim Vernum
9d278c88fb Make AuthorizationService project aware (MP-1662)
This commit updates `AuthorizationService` to use the `ProjectResolver`
to determine the set of indices against which authorization should be
applied.
2024-09-27 20:49:24 +10:00
Tim Vernum
b5ad2af6b2 Merge main into multi-project 2024-09-27 13:30:43 +10:00
Tim Vernum
844864c93e Merge main into multi-project 2024-09-27 10:46:25 +10:00
Niels Bauman
de837655de Merge main into multi-project
Merge main into multi-project
2024-09-26 17:16:43 -03:00
Niels Bauman
13e1063456 Merge main into multi-project 2024-09-26 15:25:34 -03:00
Niels Bauman
9b9ae07c37 Merge main into multi-project
Merge main into multi-project
2024-09-26 15:09:34 -03:00
Niels Bauman
11d8665d99 Merge main into multi-project
# Conflicts:
#	.buildkite/hooks/pre-command
2024-09-26 14:07:03 -03:00
Tim Vernum
d4f6048b10 Make ClusterStateAction project-aware (MP-1611)
Updates `TransportClusterStateAction` to be aware that the cluster
state can contain multiple projects and filter the routing table
down to only contain the current (requested) project(s)
2024-09-26 20:03:28 +10:00
Albert Zaharovits
ee5909bd34 Merge main into multi-project
Merge main into multi-project
2024-09-26 11:34:51 +03:00
Albert Zaharovits
71ccf2089f Merge main into multi-project 2024-09-26 09:57:32 +03:00
Tim Vernum
9753a73bba Make ProjectResolver available to plugins (MP-1659)
This is needed so that X-Pack modules such as Security can resolve
projects correctly
2024-09-26 10:47:57 +10:00
Simon Cooper
5f59086a9e Update Metadata/ProjectMetadata xcontent with new builder (MP-1657)
Use new ChunkedXContent builder lost in the latest main merge
2024-09-25 14:58:02 +01:00
Tim Vernum
68652748f9 Update allocation deciders for multiple projects (MP-1656)
This commit updates:
- `DiskThresholdDecider`
- `EnableAllocationDecider`
- `FilterAllocationDecider`
- `ResizeAllocationDecider`

to be aware of projects, and operate correctly when there are multiple
projects in a cluster.
2024-09-25 15:13:18 +10:00
Tim Vernum
d520f4b13f Merge main into multi-project 2024-09-25 14:09:02 +10:00
Tim Vernum
ad6435dede Merge main into multi-project 2024-09-25 12:49:01 +10:00
Tim Vernum
5821a712c9 Make AllocationService multi-project capable (MP-1654)
Updates `AllocationService.applyStartedShards` and
`PrimaryShardAllocator.makeAllocationDecision` to support multiple
projects
2024-09-23 15:44:49 +10:00
Tim Vernum
7736bba8b6 Merge main into multi-project 2024-09-23 13:55:31 +10:00
Tim Vernum
ccd5fea573 Work around weird multi-project transport version 2024-09-23 12:53:40 +10:00
Tim Vernum
f6458344ce Merge main into multi-project 2024-09-23 11:36:52 +10:00
Tim Vernum
d2e933e6b0 Fix tests that broken with index version change 2024-09-20 16:57:27 +10:00
Tim Vernum
d5d5131e25 Merge main into multi-project 2024-09-19 18:52:20 +10:00
Niels Bauman
690dd7b018 Make TimestampFieldMapperService project-aware (MP-1634)
This commit makes `TimestampFieldMapperService` apply to
all projects in the cluster.
2024-09-17 13:14:10 +02:00
Niels Bauman
6eea282322 Make MasterService project-aware (MP-1652)
This solely consists of extending the assertion logic to apply to all
projects in MasterService#patchVersions.
2024-09-16 15:31:54 +02:00
Niels Bauman
0be06a3ea2 Remove GlobalRoutingTable#version (MP-1650)
After removing RoutingTable#version, this version was also no longer
being used anywhere.
2024-09-16 15:28:11 +02:00
Niels Bauman
9da315d1c6 Merge main into multi-project
Merge main into multi-project
2024-09-14 13:29:59 +02:00
Niels Bauman
c41ed527b3 Merge main into multi-project 2024-09-14 10:52:45 +02:00
Niels Bauman
a0ffba2965 Merge main into multi-project
Merge main into multi-project
2024-09-13 13:56:54 +02:00
Niels Bauman
9968e076f7 Merge main into multi-project
# Conflicts:
#	x-pack/plugin/ilm/src/main/java/org/elasticsearch/xpack/ilm/action/ReservedLifecycleAction.java
2024-09-13 12:52:08 +02:00
Niels Bauman
5cc62de0fc Merge pull request MP-1649 from nielsbauman/update-main
Merge main into multi-project
2024-09-13 11:06:51 +02:00
Niels Bauman
158d66cc2e Merge main into multi-project 2024-09-12 15:16:45 +02:00
Niels Bauman
f3d83d2d6e Make ClusterChangedEvent project-aware (MP-1643)
This changes the methods in `ClusterChangedEvent` to be able to handle
multiple projects.
2024-09-11 15:49:24 +02:00
Niels Bauman
0ce3d4756f Make IndexLifecycleService allow multiple projects in cluster state (MP-1637)
This simply avoids the IndexLifecycleService from breaking when there
are multiple projects in the cluster state. It does not yet handle
multiple projects with IndexLifecycleMetadata.
2024-09-11 14:06:31 +02:00
Albert Zaharovits
8e1a004260 Metadata -> ProjectMetadata related to index creation (MP-1644)
Metadata -> ProjectMetadata related to index creation
2024-09-11 13:26:49 +03:00
Tim Vernum
44345193af Make RoutingNodes.allShardsActive project-scoped (MP-1646)
Changes RoutingNodes.allShardsActive to take `ProjectMetadata` instead
of `Metadata`, and updates `RebalanceOnlyWhenActiveAllocationDecider` to
resolve the correct project for the shard being checked
2024-09-11 10:28:46 +02:00
Tim Vernum
dff994c77e Make IndexMetadataUpdater project-aware (MP-1628)
This commit modifies `IndexMetadataUpdater` so that it can accept shard
updates for any project and apply the changes to the correct
`IndexMetadata` object in the correct project.
2024-09-11 10:28:22 +02:00
Tim Vernum
41fb5a36d8 Merge main into multi-project 2024-09-10 18:23:06 +02:00
Niels Bauman
67c93bf3aa Make ClusterState.isGlobalStateEquals project-aware (MP-1636)
This method is used to determine whether the cluster state needs to be
(re)persisted. Therefore, we return true if any project has changed.
2024-09-10 17:06:10 +02:00
Tim Vernum
56ba3385c8 Merge main into multi-project 2024-09-10 16:59:33 +02:00
Tim Vernum
ed8f44a4b3 Make DesiredBalanceReconciler project aware (MP-1641)
This updates `DesiredBalanceReconciler.allocateUnassignedInvariant` to
be aware of projects and consider all shards across all projects when
reconciling the cluster balance
2024-09-06 19:04:38 +10:00
Tim Vernum
3fe7ba35c3 Merge main into multi-project 2024-09-06 14:12:11 +10:00
Tim Vernum
26f0b75a3f Merge main into multi-project 2024-09-06 12:37:27 +10:00
Tim Vernum
eb343b0c3f Make OrderedShardsIterator project-aware (MP-1639)
This commit changes `OrderedShardsIterator` to be able to sort shards
from multiple projects.
The sort order ignores the project, and sorts shards according to
existing rules.

We do not know whether this is the behaviour we want long term, but it
is a necessary first step to having a working multi-project cluster.
2024-09-06 10:45:53 +10:00
Niels Bauman
811fc4695b Extract getSingleProjectWithCustom utility method (MP-1638)
I noticed I was repeating a pattern for both IngestService and
IndexLifecycleService. This PR extracts two utility methods that can be
used in those cases and probably more future cases.
2024-09-05 16:45:12 +02:00
Niels Bauman
ec194cc528 Make PersistedClusterStateService multi-project aware (MP-1619)
Persists indices and mappings for all projects to disk.
2024-09-05 10:24:02 +02:00
Niels Bauman
864bf505c6 Make IngestService allow multiple projects in cluster state (MP-1631)
This simply avoids the IngestService from breaking while applying a new
cluster state that contains multiple projects. It does not yet handle
multiple projects with ingest metadata.
2024-09-05 10:20:25 +02:00
Niels Bauman
ff2347afb8 Make ClusterState.initializeAsync project-aware (MP-1633)
Initializes the indices lookup for all the projects in the cluster.
2024-09-05 09:28:31 +02:00
Tim Vernum
fa919d84d1 Print GlobalRoutingTable in ClusterState XContent (MP-1625)
This updates `ClusterState.toXContentChunked` to print out the full
global routing table if the `multi-project` param is set.
2024-09-05 17:12:03 +10:00
Niels Bauman
ffacc0b32b Use ProjectId.fromXContent in PutProjectAction (MP-1632) 2024-09-04 14:37:22 +02:00
Albert Zaharovits
64b97b23a8 Merge main into multi-project
Merge main into multi-project
2024-09-04 12:57:38 +03:00
Tim Vernum
f0d7b00604 Adapt auto-exand replicas for multi project (MP-1626)
This changes `AutoExpandReplicas` and `AllocationService` to handle
multiple projects. Replica auto-expansion is performed across all
projects.
2024-09-04 18:48:54 +10:00
Albert Zaharovits
36a3eb7edc Merge main into multi-project 2024-09-04 10:10:04 +03:00
Albert Zaharovits
28f4a7b4f8 Index Settings provider with project metadata (MP-1630)
Restricts the "index settings" provider that's invoked when creating new
indices to only inspect the current project's metadata (rather than the
whole global metadata).
2024-09-03 15:12:47 +03:00
Tim Vernum
baa024dd68 Update cluster allocation for multiple projects (MP-1616)
Updates `RoutingAllocation`, `ShardsAllocator`, `AllocationDeciders` to
handle allocation across multiple projects
2024-09-03 09:06:28 +10:00
Albert Zaharovits
071212a0a3 ProjectMetadata.Builder for clusterStateCreateIndex (MP-1623)
When an index is created, there's an optional parameter hook function
that callers use to alter the metadata given the index metadata that's
being created.

This PR makes that hook parameter work with the `ProjectMetadata` rather
than the whole `Metadata`.
This generally improves per-project encapsulation, which in principle
should avoid accidental cross-project changes.
2024-09-01 19:57:59 +03:00
Simon Cooper
3843829ba2 Add multi-project serialization for Metadata and metadata diffs (MP-1598)
Co-authored-by: Tim Vernum <tim@adjective.org>
2024-08-30 10:02:28 +01:00
Tim Vernum
efd658bd22 Add toXContent test for ProjectMetadata (MP-1622) 2024-08-30 17:19:11 +10:00
Albert Zaharovits
2db5c9c24c Merge main into multi-project
Merge main into multi-project
2024-08-30 10:06:32 +03:00
Albert Zaharovits
62e93779d8 Merge main into multi-project 2024-08-29 17:46:47 +03:00
Tim Vernum
1e4975ee1e Enforce ProjectId on public builder method
This commit removes the public `ProjectMetadata.builder()` method so
that every constructed `ProjectMetadata` must have an `id`.

The only valid case we had for not providing an id when constructing the
`Builder` was when deserializing and in that case we can use the
package-protected `Builder` constructor.
2024-08-29 18:48:49 +10:00
Tim Vernum
9201f11d7d Merge main into multi-project 2024-08-28 21:26:26 +10:00
Tim Vernum
a100bc3131 Merge main into multi-project 2024-08-28 20:22:59 +10:00
Tim Vernum
093ca36d6b Move RoutingTable.of to GlobalRoutingTable.rebuild (MP-1612)
This commit adds a new `rebuild` method to `GlobalRoutingTable` that
recreates the routing table based on the state of `RoutingNodes`.

This new method is based on the previous behaviour of
`RoutingTable.of` which has now been modified to be responsible for
less.
2024-08-27 11:33:04 +10:00
Tim Vernum
90203614fe Add projectId(s) methods on ProjectResolver (MP-1615)
This commit adds 2 new methods to ProjectResolver
 - `projectId`
 - `projectIds`

The latter is needed because in some cases a request may be project-less
(that is it operates on all projects). The resolver needs some way to
indicate when a request falls into this category.

The options are:
 - Some flag for "all projects", such as a method like `isAllProjects()`
 - A method that returns all projects

The latter is preferred because it makes actions agnostic about how
project resolution works - if the action is capable of operating on
multiple projects, then it asks the resolver for the list of projects
and gets back 1 or many. It doesn't have to care about the distinction
between project-targeted requests and project-agnostic requests, it just
operates on the list of projects that the resolver returns.

This method returns `ProjectId` rather than `ProjectMetadata` for two
reasons.

Firstly, for clarity.
`ClusterState.metadata().projects()` already returns `ProjectMetadata`
and having two ways to get `ProjectMetadata` risks confusion. Using ids
here makes it less likely that methods calls or local variables will get
mixed up.

Secondly, for code simplicity. The examples we know about want to work
with project-ids rather than `ProjectMetadata` (e.g. to access the
routing table).

In addition this commit adds some sample implementations of
`ProjectResolver` within the test framework (see
`TestProjectResolvers`). This is useful when writing a unit test for a
class that depends on `ProjectResolver` - there are reliable
implementations that exhibit some different behaviours that may be
useful for testing.
2024-08-26 13:50:40 +10:00
Simon Cooper
4a58cadede Add multi-project option for xcontent output (MP-1600)
Add an option to output Metadata xcontent in a multi-project form, and
add code to read it back in again.
2024-08-23 14:31:14 +02:00
Tim Vernum
036456752c Support projects in IndexNameExpressionResolver (MP-1614)
This commit adds support for resolving index expressions within the
context of a project.

Existing support for resolving index expressions for a cluster is
retained, and (for now) assumes that there is a single project in the
cluster. In the future this should be changed to use `ProjectResolver`
instead.
2024-08-23 15:12:19 +10:00
Tim Vernum
dff93a3980 Update AllocationService.getHealthStatus (MP-1613)
This commit updates the `AllocationService.getHealthStatus` method to
determine the overall cluster health by inspecting the indices from all
projects
2024-08-22 14:18:24 +10:00
Tim Vernum
d2a88fb64f Update ClusterState.toString for multiple projects (MP-1610)
This commit changes the `toString` method on `ClusterState` to provide
working, sensible output when there are multiple projects
2024-08-21 21:43:40 +10:00
Tim Vernum
9c1cf94d2b Add builder for GlobalRoutingTable (MP-1607)
This commit adds the `GlobalRoutingTable.Builder` class and
`GlobalRoutingTable.builder()` methods to match the patterns used by
other cluster state objects
2024-08-21 10:29:31 +10:00
Tim Vernum
5fd22e0dfd Add id field to ProjectMetadata (MP-1609)
This commit returns the `id` field to `ProjectMetadata` so that a
project knows its own identifier
2024-08-19 15:06:35 +10:00
Tim Vernum
b06c58f33e Change RoutingNodes to be multi-project aware (MP-1608)
This commit changes the `RoutingNodes` class so that it is aware of
shards from all projects in the cluster.
2024-08-16 13:21:19 +10:00
Tim Vernum
67acd4bc54 Support multiple projects in GlobalRoutingTable (MP-1605)
This commit changes the `GlobalRoutingTable` to contain multiple
projects.
Note: Most code will break if there are, in fact, multiple projects
(because the `getRoutingTable` method can only return a single project
and will throw an exception if there are multiple)
2024-08-15 11:33:10 +10:00
Niels Bauman
c19dfdd154 Implement API for creating projects (MP-1606)
Implements a basic API for creating projects.

The API currently doesn't execute successfully because there are some
pieces of code that still depend on there being a single project.
2024-08-14 11:48:51 +02:00
Tim Vernum
4056e66ba2 Switch ClusterState to use GlobalRoutingTable (MP-1603)
This commit changes `ClusterState` to have a field of type
`GlobalRoutingTable` instead of (Project)`RoutingTable`.
2024-08-12 20:07:14 +10:00
Tim Vernum
0784571d27 Merge main into multi-project 2024-08-12 18:08:43 +10:00
Tim Vernum
862978ddc4 Merge main into multi-project 2024-08-12 15:48:18 +10:00
Tim Vernum
95156e573b Implement Writeable on ProjectId (MP-1602)
We need to write `ProjectId` instances to streams. This should be done
by treating it as a `Writeable` object rather than making consumers deal
with the internal fields.
2024-08-09 19:05:47 +10:00
Tim Vernum
8efaadc0c2 Add "GlobalRoutingTable" class (MP-1597)
Introduces a new `GlobalRoutingTable` that sits above the (project
scoped) `RoutingTable`.

For now this new class is not used anywhere, and it supports a single
`RoutingTable`. This will be changed in followup commits.

Relates: ES-9105
2024-08-09 09:53:12 +10:00
Tim Vernum
d8b5fa3568 Change default project id to "default" (MP-1599)
This commit changes the behaviour of `Metadata` so:
- The "default" or "single" project is the project with the id `default`
(it no longer tracks the cluster UUID)
- A default project is only created when absolutely needed, this
includes:
- When attempting to perform project-scoped operations on the cluster
level `Metadata`
- When constructing a `Metadata` object from a `Builder` that does not
have any projects in it.
2024-08-08 19:59:01 +10:00
Simon Cooper
7d05d02e84 Store ProjectMetadata objects in a map, allowing for multiple ProjectMetadata objects (MP-1594) 2024-08-05 13:43:40 +01:00
Tim Vernum
94a3b41d9f Merge main into multi-project 2024-08-02 17:51:10 +10:00
Tim Vernum
30eb6f1f69 Merge main into multi-project 2024-08-02 16:36:56 +10:00
Albert Zaharovits
7e73a1ad2c Initial changes to make ILM go through the ProjectResolver for project metadata (MP-1589)
The initial goal of this PR was to make the "put ILM" action go through the project resolver in order to resolve the project-scoped metadata, and hence avoid referring to the whole cluster state. This implies changing some methods to work on the project metadata rather than the whole cluster metadata.
It turns out, due to good code reuse, it is hard to only change one specific action to only refer to project-scoped metadata.
2024-08-01 17:32:29 +03:00
Albert Zaharovits
59a82236b3 Merge main into multi-project
Merge main into multi-project
2024-08-01 16:28:28 +03:00
Albert Zaharovits
c938ffc103 Merge main into multi-project 2024-08-01 15:02:14 +03:00
Simon Cooper
5b7cb67fb0 Change ProjectMetadata field in Metadata to private (MP-1592) 2024-07-31 12:16:22 +01:00
Simon Cooper
3aec611c46 Make fields in ProjectMetadata private (MP-1591)
Fields in ProjectMetadataDiff still need to be package due to BwC
reading in `Metadata`
2024-07-26 16:31:28 +03:00
Tim Vernum
e932700cf7 Merge main into multi-project 2024-07-26 19:49:21 +10:00
Tim Vernum
7b5774a473 Merge main into multi-project 2024-07-26 16:39:47 +10:00
Simon Cooper
c45b8e9db1 Move XContent output to ProjectMetadata (MP-1590) 2024-07-25 14:39:29 +01:00
Simon Cooper
cf428b2f0b Create ProjectMetadata diff object and move serialization into ProjectMetadata (MP-1588) 2024-07-25 13:21:59 +01:00
Simon Cooper
6eab834add Move remaining project methods to ProjectMetadata (MP-1586) 2024-07-22 14:59:13 +01:00
Albert Zaharovits
855c289b04 ProjectId for ProjectMetadata (MP-1585)
This adds a `ProjectId` to the `ProjectMetadata`.
The `ProjectId` contains just a `String` value and is initialiazed to
the `clusterUUID`, since righat now there only exists a single project.
2024-07-22 14:49:38 +03:00
Tim Vernum
f32441836c Merge main into multi-project
Merge main into multi-project
2024-07-22 14:31:21 +10:00
Simon Cooper
ea71e96124 Move various Metadata alias and with* methods to ProjectMetadata (MP-1584) 2024-07-19 12:42:06 +01:00
Simon Cooper
58645a6bab Move various Metadata alias methods to ProjectMetadata (MP-1581)
The ones that don't depend on customs
2024-07-19 10:28:58 +01:00
Tim Vernum
54436760ab Fix custom reference 2024-07-19 17:05:48 +10:00
Tim Vernum
ff2fd00774 Merge main into multi-project 2024-07-19 16:42:26 +10:00
Niels Bauman
0b58984bf8 Split Metadata.Custom into ClusterCustom and ProjectCustom (MP-1570) 2024-07-18 21:51:06 +02:00
Simon Cooper
8c507979f0 Create ProjectMetadata.Builder class (MP-1580)
For the moment, just delegate all method calls to Metadata.Builder to it
2024-07-18 13:33:29 +01:00
Simon Cooper
14edc96b55 Move Metadata.indicesLookup to ProjectMetadata (MP-1579)
Note that this copies the `custom` method to `ProjectMetadata`, but leaves the bulk change to https://github.com/elastic/elasticsearch-internal/pull/1570
2024-07-18 08:28:16 +01:00
Simon Cooper
d43191ecfc Remove the Metadata.getIndices and getTemplates methods (MP-1575)
Only use `ProjectMetadata.indices` and `ProjectMetadata.templates` now
2024-07-17 11:38:02 +01:00
Simon Cooper
6c2936ff5f Move Metadata.getIndexSafe and hasMetadata methods to ProjectMetadata (MP-1576) 2024-07-17 09:39:07 +01:00
Simon Cooper
bba8d96649 Define a transport version for all multi-project changes (MP-1577)
We don't need any BwC compatibility, so we can define this single
constant and use it for everything. At the point we come to merge this
into main, the multi-project constant should be updated to be a real
transport version with the right id schema
2024-07-17 09:19:51 +01:00
Simon Cooper
a0544500df Move Metadata.hasIndex and index methods to ProjectMetadata (MP-1574) 2024-07-16 14:28:34 +01:00
Albert Zaharovits
462e51053c Stub ProjectResolver for project-scoped cluster state (MP-1564)
This just adds some bare bones code that will support resolving
project-scoped cluster state.

ES-8868
2024-07-16 14:31:36 +03:00
Albert Zaharovits
a859107111 Merge pull request MP-1572 from albertzaharovits/public-main-2
Update multi-project from public main
2024-07-16 13:32:40 +03:00
Albert Zaharovits
de3e6fd48d Merge fallout 2024-07-16 12:25:11 +03:00
Albert Zaharovits
a2ff48dd3b Merge branch 'multi-project' into public-main-2 2024-07-16 12:09:50 +03:00
Salvatore Campagna
de8bdb4183 LogsDB quality assurance testing (#110479)
This PR improves our integration testing coverage. The idea is to have two data streams,
referred as the baseline acting as the source of truth and a contender data stream whose
contents and results of queries need to be checked against the baseline.

We also include some capability around matching results which needs to be extended
to be able to consider artifacts in results introduced by the usage of synthetic source.
2024-07-16 11:29:01 +03:00
Ignacio Vera
ca2cc967e5 [ESQL] Add test to check the consistency of spatial ESQL queries (#110831) 2024-07-16 11:29:01 +03:00
Nhat Nguyen
ef0f25ee96 Fork field-caps for ES|QL (#110738)
We need to fork the field-caps API for ES|QL to allow changes to the new
internal API without risking breaking the external field-caps API.
2024-07-16 11:29:01 +03:00
Oleksandr Kolomiiets
3e6b061280 Fix logsdb mapping rest tests on serverless (#110900)
Currently fails due to validation that is only performed in serverless:

```
java.lang.AssertionError: Failure at [logsdb/20_mapping:94]: 
Expected: "Failed to parse mapping: Indices with with index mode [logs] only support synthetic source"
     but: was "Failed to parse mapping: Parameter [mode=disabled] is not allowed in source"
```
2024-07-16 11:29:01 +03:00
Michael Peterson
57d701fd46 Revert "Search coordinator uses event.ingested in cluster state to do rewrites (#110352)" (#110881)
This reverts commit d45d164afe.
2024-07-16 11:29:01 +03:00
Fang Xing
4f58ab53e1 [ES|QL] add tests for stats by constant (#110593)
* add tests for stats by constant
2024-07-16 11:29:01 +03:00
Mark Tozzi
0d877f84ae remove unused core binary comparison classes (#110891)
Quick cleanup PR.  With
https://github.com/elastic/elasticsearch/pull/109413 merged, nothing in
ESQL production depends on the core binary comparison classes anymore. 
This PR removes them to avoid the potential for confusion, and open the
opportunity for merging the core `BinaryComparison` class with the
`EsqlBinaryComparison` base class, which is now its only direct
inheritor (work to be done in a future PR).
2024-07-16 11:29:01 +03:00
Oleksandr Kolomiiets
2824d9fd56 Add validation for synthetic source mode in logs mode indices (#110677) 2024-07-16 11:29:01 +03:00
Craig Taverner
e3713f49e2 Fix for union-types for multiple columns with the same name (#110793)
* Make union types use unique attribute names

* Cleanup leftover

* Added failing test and final fix to EsRelation

* Implement FieldAttribute.fieldName()

* Fix tests

* Refactor

* Do not ignore union typed field's parent

* Fix important typo

D'oh

* Mute unrelated (part of) test

* Move capability to better location

* Fix analyzer tests

* multi-node tests with an earlier version of union-types (before this change) fail

* Add capability to remaining failing tests

* Remove variable

* Add more complex test

* Consolidate union type cleanup rules

* Add 3 more required_capability's to make CI happy

* Update caps for union type subfield yaml tests

* Update docs/changelog/110793.yaml

* Refined changelog text

* Mute BWC for 8.15.0 for failing YAML tests

* union_types_remove_fields for all 160_union_types tests

The tests fail spordically, so safer to mute the entire suite.

---------

Co-authored-by: Alexander Spies <alexander.spies@elastic.co>
2024-07-16 11:29:01 +03:00
Jonathan Buttner
202a2cf7cd Anthropic docs (#110850) 2024-07-16 11:29:00 +03:00
Mark Vieira
3f07af5e89 Add runtime classpath as input to ThirdPartyAuditTask (#110882)
The runtime classpath of `ThirdPartyAuditTask` was not being tracked as
an input which can cause issues with task output caching and build
avoidance.
2024-07-16 11:29:00 +03:00
Iván Cea Fontenla
1a08d44e8a ESQL: Add boolean support to TOP aggregation (#110718)
- Added a custom implementation of BooleanBucketedSort to keep the top booleans
- Added boolean aggregator to TOP
- Added tests (Boolean aggregator tests, Top tests for boolean, and added boolean fields to CSV cases)
2024-07-16 11:29:00 +03:00
Jonathan Buttner
3afebb67cb [ML] Inference API request count telemetry and metrics core components (#110799)
* Adding new inference stats class

* Working test

* Adding factory to plugin

* Removing unnecessary changes

* Fixing test

* Removing close() for now

* Expanding modelId() comment

* using incrementby and refactoring interfaces
2024-07-16 11:29:00 +03:00
Volodymyr Krasnikov
efbbc3e734 AwaitsFix: https://github.com/elastic/elasticsearch/issues/110885 2024-07-16 11:29:00 +03:00
elasticsearchmachine
4f6ed653dc Mute org.elasticsearch.upgrades.FileSettingsUpgradeIT org.elasticsearch.upgrades.FileSettingsUpgradeIT #110884 2024-07-16 11:29:00 +03:00
Armin Braun
b184e9f6cf Ignore missing JNA in test framework module (#110880)
These come up as missing during third party audit.
2024-07-16 11:29:00 +03:00
Volodymyr Krasnikov
98d6f82a70 Implement RequestedRangeNotSatisfiedException for Azure and GCP (#110401)
* Implement RequestedRangeNotSatisfiedException for Azure and GCP

* spotless

* rename test

* Generalize 3rd party tests for 3 cloud blob containers

* Follow comments

* minimize changes with main

* Follow comments 2
2024-07-16 11:29:00 +03:00
Iván Cea Fontenla
d59d9522fe ESQL: Add grouping cases to aggregation tests (#110795)
- Added a test case with groups to the aggregation tests, which detected:
  - Fixed BitArray out of index error on `fill()`
  - Fixed BooleanArrayState out of index error on `getOrDefault()`, affecting Max and Min
    - Also, this bug affected the results of Max/Min in some specific cases
2024-07-16 11:29:00 +03:00
Armin Braun
d1d8459615 Speedup CanMatchPreFilterSearchPhase constructor (#110860)
This constructor is needlessly inefficient:
* Sorting an array is quite a bit faster than sorting an `ArrayList` the way we did it here (could do it faster via List.sort but array ist still better).
* Pre-size the hashmap of positions
* Faster `ShardId.compareTo`
* Much faster `SearchShardIterator.compareTo`!
2024-07-16 11:29:00 +03:00
David Turner
70f2eae466 Simplify reset-features API (#110866)
Today we return HTTP code 207 if some features successfully reset and
others failed. This is not an appropriate response code, it has a _very_
precise meaning according to the HTTP specification to which we do not
adhere. Since this API is used only in tests we can be stricter and
return a 500 unless it completely succeeds.
2024-07-16 11:28:59 +03:00
David Kyle
2061b285b8 [ML] Log model download cancelled message as a warning not error (#110776) 2024-07-16 11:28:59 +03:00
Iraklis Psaroudakis
f0d35efb45 Do not write dangling indices in a test (#110867)
So that the only expected disk write at the point of the assertion is from the bulk request. And not from the asynchronous runnable of updateDanglingIndicesInfo().

Fixes #110551
2024-07-16 11:28:59 +03:00
David Turner
4ac03e6355 Resolve repo earlier in TransportGetSnapshotsAction (#110863)
While it is _technically_ true that we only need to look up the
`Repository` instance in order to load `SnapshotInfo` blobs for
snapshots that aren't currently running, in practice the repository
should exist on all paths anyway, the lookup is cheap, and it simplifies
some future work to resolve it sooner.
2024-07-16 11:28:59 +03:00
Jedr Blaszyk
9a983a2bb6 [Connector APIs] Add docs for sync job claim endpoint (#110412) 2024-07-16 11:28:59 +03:00
Liam Thompson
e3d038d047 [DOCS] Add note about ML model 502 timeout when using Create inference API (#110835)
* [DOCS] Add note about ml model 502 timeout

* Add note to API ref
2024-07-16 11:28:59 +03:00
David Turner
39bc583b20 Deprecate timed PlainActionFuture#get (#110859)
The timed `PlainActionFuture#get` method is almost exclusively used in
tests, and never in a place where it really matters that it supplies a
`PlainActionFuture<T>` rather than an `ActionListener<T>`. Moreover some
of its usages wait for longer than `SAFE_AWAIT_TIMEOUT`, typically 30s,
but not for any good reason. We have several suitable test utility
methods for achieving the same thing, and these utilities automatically
deal with exceptions/interrupts/timeouts appropriately. This commit
replaces all the test usages with more suitable test utilities.

The only production usages are in the CCR module. While it would be good
to remove this blocking code, for now this commit just introduces a new
CCR-only utility for this behaviour. That way we can deprecate the
widely-available `PlainActionFuture#get` method and remove it in a
follow-up.
2024-07-16 11:28:59 +03:00
Iván Cea Fontenla
aa54333899 Fix CSV test cases names with SYNC or ASYNC (#110794)
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2024-07-16 11:28:59 +03:00
David Turner
5e5459e76c AwaitsFix for #110406 2024-07-16 11:28:59 +03:00
Armin Braun
f69d6be387 Use new runInParallel and startInParallel test util in more spots (#110853)
It's in the title. Use the utility in a couple more spots to save some code and thread creation.
2024-07-16 11:28:59 +03:00
Ryan Ernst
224726a1d9 Remove JNA from server dependencies (#110809)
All native methods are now bound through NativeAccess. This commit
removes the jna dependency from server.

relates #104876
2024-07-16 11:28:58 +03:00
Ryan Ernst
f79930462c Force resolution of fstat64 symbol with JNA (#110807)
When JNA loads libraries it creates a proxy object for the library.
Unfortunately it doesn't actually inspect any of the methods, those get
bound lazily at runtime when the method is called through the proxy. For
fstat64 we need to know at load time whether the symbol exists, so that
we can fallback to an alternate function if it doesn't.

This commit looks up the NativeLibrary object from JNA for libc and
checks if fstat64 exists during load time.
2024-07-16 11:28:58 +03:00
David Turner
0420300a5c Further reduce allocations in TransportGetSnapshotsAction (#110817)
Collecting the list of snapshot IDs over which to iterate within each
repository today involves several other potentially-large intermediate
collections and a bunch of other unnecessary allocations. This commit
replaces those temporary collections with an iterator which saves all
this temporary memory usage.

Relates ES-8906
2024-07-16 11:28:58 +03:00
Jack Conradson
134ff6fd11 Rename search response metric attribute (#110842)
This change renames the search response metric attribute status to response_status. This is more 
descriptive for an attribute that falls under the global labels namespace.

This also fixes a typo with succes to success.
2024-07-16 11:28:58 +03:00
Pat Whelan
cc5d9793e9 [ML] Consolidate ExecutableActions (#110806)
- Created two new ExecutableActions, SenderExecutableAction and
  SingleInputSenderExecutableAction
- Most chat completions are migrated over the
  SingleInputSenderExecutableAction
- Every other Action are migrated over to SenderExecutableAction
- RequestManagers and Error Message construction are migrated into the
  ActionCreator classes.

Relate #110805
2024-07-16 11:28:58 +03:00
Fang Xing
088a187f8a [ES|QL] Rewrite In with EvaluatorMapper (#109413)
* rewrite in with EvaluatorMapper
2024-07-16 11:28:58 +03:00
Nik Everett
0264cc2151 ESQL: Document the pattern to count TRUE (#110820)
This adds an example to the docs an example of counting the TRUE results
of an expression. You do `COUNT(a > 0 OR NULL)`. That turns the `FALSE`
into `NULL`. Which you need to do because `COUNT(false)` is `1` -
because it's a value. But `COUNT(null)` is `0` - because it's the
absence of values.

We could like to make something more intuitive for this one day. But for
now, this is what works.
2024-07-16 11:28:58 +03:00
Oleksandr Kolomiiets
5a9464a226 Add tests for applying custom settings/mapping to indices in logs mode (#110803) 2024-07-16 11:28:58 +03:00
Mark Tozzi
b26a61cb1b [ESQL] Count_distinct(_source) should return a 400 (#110824)
Resolves
[#105240](https://github.com/elastic/elasticsearch/issues/105240)

Count_distinct doesn't work on source, but the type resolution was
allowing that through.  This resulted in a 500 layer deeper in the
aggregations code.  This PR fixes the 500 error by correctly failing
during type resolution.
2024-07-16 11:28:58 +03:00
Kathleen DeRusso
0204c4e7df Remove preview from top level query rules API page (#110838) 2024-07-16 11:28:58 +03:00
Rene Groeschke
54e4f24d83 Ignore configs from DistributionDownload plugin and bwc for resolveAllDependencies (#110828) 2024-07-16 11:28:58 +03:00
David Turner
e3fce2fcca Enhance startup timeout message (#110763)
Includes the setting name as well as its value, and also add a link to
the relevant troubleshooting docs. Also reinstates a thread interrupt
flag that could technically get lost here otherwise.
2024-07-16 11:28:57 +03:00
Mark J. Hoy
c0443a59a6 [Inference API] Add Docs for Amazon Bedrock Support for the Inference API (#110594)
* Add Amazon Bedrock Inference API to docs

* fix example errors

* update semantic search tutorial; add changelog

* fix typo

* fix error; accept suggestions
2024-07-16 11:28:57 +03:00
Fang Xing
8ec8faf0eb [ES|QL] Pushdown string format for BinaryComparison on datetime fields (#110669)
Use string format in datetime field BinaryComparison.
2024-07-16 11:28:57 +03:00
Mark Tozzi
9d804d53bf [ESQL] Combine rule superclasses (#110728)
Small refactoring to merge some optimizer rule super classes that have
exactly one implementation with that implementation.  This makes sure
our tests are pointing at the right classes, and makes finding relevant
code a little easier.
2024-07-16 11:28:57 +03:00
Benjamin Trent
3c20f554b0 Correct tests, skipping on cluster features in mixed clusters is buggy (#110747)
Cluster feature "skip" just doesn't work as expected in a mixed cluster
scenario. It could be that the request is handled by a new node. I
honestly don't know whats happening there.

This adjusts the tests so that we verify that `allow_unmapped_fields`
modifies the behavior as expected.

closes: https://github.com/elastic/elasticsearch/issues/110720 closes:
https://github.com/elastic/elasticsearch/issues/110719
2024-07-16 11:28:57 +03:00
Moritz Mack
bc5ba14fae Skip stacktrace for exceptions when stacktrace is not relevant. (#110785)
These exceptions are expected and don't imply bugs, their stacktrace
isn't relevant and should not be logged.

Relates to ES-7097
2024-07-16 11:28:57 +03:00
Rene Groeschke
f74be310a5 [Gradle] Replace deprecated build scan api usage (#110783)
We updated to use develocity plugin a while ago but still used
a deprecated api in the build complete logic we have running on ci
2024-07-16 11:28:57 +03:00
elasticsearchmachine
28ca6596c0 Forward port release notes for v8.14.3 (#110787) 2024-07-16 11:28:57 +03:00
Niels Bauman
85bc57b4ab Add size_in_bytes to enrich cache stats (#110578)
As preparation for #106081, this PR adds the `size_in_bytes`
field to the enrich cache. This field is calculated by summing
the ByteReference sizes of all the search hits in the cache.
It's not a perfect representation of the size of the enrich cache
on the heap, but some experimentation showed that it's quite close.
2024-07-16 11:28:57 +03:00
Victor Michel
79a1a40063 Fix comment in profiling-symbols.json (#110808) 2024-07-16 11:28:57 +03:00
Mikhail Berezovskiy
15fef0d7b6 Use opaque id in task cancellation assertion (#110680)
Add use of Opaque ID HTTP header in task cancellation assertion. In some
tests, like this #88201 `testCatSegmentsRestCancellation`, we assert
that all tasks related to specific HTTP request are cancelled. But we do
blanket approach in assertion block catching all tasks by action name. I
think narrowing down assertion to specific http request in this case
would be more accurate.

It is still not clear why test mentioned above failing, but after hours
of investigation and injecting random delays, I'm inclining more to
@DaveCTurner's comment about interference from other tests or cluster
activity. I added additional log that will report when we spot task with
different opaque id.
2024-07-16 11:28:57 +03:00
Nik Everett
6807bd5ff7 ESQL: All descriptions are a full sentence (#110791)
This asserts that all functions have descriptions that are complete
sentences.
2024-07-16 11:28:57 +03:00
elasticsearchmachine
79978cde58 Mute org.elasticsearch.xpack.searchablesnapshots.cache.common.CacheFileTests testCacheFileCreatedAsSparseFile #110801 2024-07-16 11:28:56 +03:00
elasticsearchmachine
5fb4053172 Mute org.elasticsearch.xpack.security.ScrollHelperIntegTests testFetchAllEntities #110786 2024-07-16 11:28:56 +03:00
Stanislav Malyshev
b162e3aeb7 Add some Javadocs to TransportSearchAction and adjacent classes. (#110733) 2024-07-16 11:28:56 +03:00
Ryan Ernst
0f461a250b Move preallocate functionality to native access (#110678)
This commit moves the file preallocation functionality into
NativeAccess. The code is basically the same. One small tweak is that
instead of breaking Java access boundaries in order to get an open file
handle, the new code uses posix open directly.

relates #104876
2024-07-16 11:28:56 +03:00
Oleksandr Kolomiiets
eb7a5f0433 Stop iterating over all fields to extract @timestamp value (#110603) 2024-07-16 11:28:56 +03:00
elasticsearchmachine
7a53690286 Mute org.elasticsearch.xpack.security.authz.store.NativePrivilegeStoreCacheTests testPopulationOfCacheWhenLoadingPrivilegesForAllApplications #110789 2024-07-16 11:28:56 +03:00
Ioana Tagirta
1cdc2e5725 Document how to query for a specific feature within rank_features (#110749) 2024-07-16 11:28:56 +03:00
elasticsearchmachine
02bc261573 Prune changelogs after 8.14.3 release 2024-07-16 11:28:56 +03:00
elasticsearchmachine
ed968d0cda Bump versions after 8.14.3 release 2024-07-16 11:28:56 +03:00
Stef Nestor
5d50ddf5a9 (Doc+) Include cluster.blocks.* default settings (#110560)
👋 howdy, team! Mini doc update to include default settings for `cluster.blocks.*` settings.
2024-07-16 11:28:56 +03:00
Michael Peterson
00026a684b Search coordinator uses event.ingested in cluster state to do rewrites (#110352)
Min/max range for the event.ingested timestamp field (part of Elastic Common
Schema) was added to IndexMetadata in cluster state for searchable snapshots
in #106252.

This commit modifies the search coordinator to rewrite searches to MatchNone
if the query searches a range of event.ingested that, from the min/max range
in cluster state, is known to not overlap. This is the same behavior we currently
have for the @timestamp field.
2024-07-16 11:28:56 +03:00
Tim Grein
84007264fe [Inference API] Remove unused Cohere rerank service settings fields in a BWC way (#110427) 2024-07-16 11:28:55 +03:00
Stef Nestor
21b36fdec6 (+Doc) Link setting reference for action.auto_create_index (#110558)
👋 howdy, team! Mini request to cross-link doc setting to its reference.
2024-07-16 11:28:55 +03:00
Mark Tozzi
aa2459113d [ESQL] Fix parsing of large magnitude negative numbers (#110665)
Resolves https://github.com/elastic/elasticsearch/issues/104323

This fixes and adds tests for the first of the two bullets in the linked
issue.  `ExpressionBuilder#visitIntegerValue` will attempt to parse a
string as an integral value, and return a Literal of the appropriate
type.  The actual parsing happens in `StringUtils#parseIntegral`.  That
function has special handling for values that are larger than
`Long.MAX_VALUE` where it attempts to turn them into unsigned longs, and
if the number is still out of range, throw `InvalidArgumentException`. 
`ExpressionBuilder` catches that `InvalidArgumentException` and tries to
parse a `double` instead.  If, on the other hand, the value is smaller
than `Long.MIN_VALUE`, `StringUtils` never enters the unsigned long path
and just calls `intValueExact`, which throws `ArithmeticException`. 
This PR solves the issue by catching that `ArithmeticException` and
rethrowing it as an `InvalidArgumentException`.
2024-07-16 11:28:55 +03:00
Ioana Tagirta
b403c44847 Fix issue with returning incomplete fragment for plain highlighter. (#110707)
* Fix issue with noMatchSize for plain highlighter

* Update docs/changelog/110707.yaml
2024-07-16 11:28:55 +03:00
Jan Kuipers
ec9e6ffda5 Fix put inference endpoint with adaptive allocations (#110640)
* Fix put inference endpoint with adaptive allocations

* Better validation of adaptive allocations settings in inference endpoints

* Safeguard for max allocations

* remove debug code
2024-07-16 11:28:55 +03:00
Carlos Delgado
48ba3c76d2 Group vector queries into new section (#110722) 2024-07-16 11:28:55 +03:00
Jedr Blaszyk
4830bbeb05 [Connector API] Update mistake in docs (#110517) 2024-07-16 11:28:55 +03:00
Nik Everett
5c8463c0c3 ESQL: Move description of commands in docs (#110714)
This copies the first line of the description of each command to just
under the syntax so that it's "in order", before the `Parameters`
section. That way if you are reading from top to bottom you see:
```
syntax
short description
parameter names and descriptions
long description
examples
```

I've also removed the `Description` section entirely if the description
was just one sentence. So in some cases that just isn't `long
description`.
2024-07-16 11:28:55 +03:00
Alexander Spies
802194f44e Aggs: Scripted metric allow list docs (#109635)
* Document new settings
* Mention agg allow list in scripting security doc
2024-07-16 11:28:55 +03:00
Nik Everett
7e88465a26 ESQL: Document the profile option (#110727)
This adds some basic documentation for the `profile` option in ESQL but
doesn't really explain the results beyond "this is for human debugging."
We're not ready for any kind of specification for this thing, but it is
useful to look at.
2024-07-16 11:28:55 +03:00
Jonathan Buttner
828fa0e24b [ML] Adding pytorch oom to known issues (#110668)
* Adding pytorch oom to known issues

* Fixing section

* Updating text to exclude the pytorch version
2024-07-16 11:28:55 +03:00
Rene Groeschke
c1543a0e09 [CI] Do not cache any es distros when creating ci images (#110742) 2024-07-16 11:28:55 +03:00
Simon Cooper
c98f471fcb Add more tests for ReservedStateVersion (#110469) 2024-07-16 11:28:54 +03:00
Przemyslaw Gomulka
9d0b62274f Infrastructure to meter updates by script for ra-s nontimeseries (#108910)
this commit refactors the metering for billing api so that we can hide the implementation details of DocumentSizeObserver creation and adds additional field `originatesFromScript` on IndexRequest
There will no longer need to have a code checking if the request was already parsed in ingest service or updatehelper. This logic will be hidden in the implementation.
2024-07-16 11:28:54 +03:00
Luca Cavanna
58f3792c29 Make min num replicas for enrich index configurable (#110686)
The min num replicas for the enrich index is currenty hardcoded to 0. We'd like to be able
to override that value via a setting (currently not registered), like we already do for the downsample index.
2024-07-16 11:28:54 +03:00
Iván Cea Fontenla
b100209fe0 Fix broken "How to reproduce" lines in CSV tests (#110711)
Fixes https://github.com/elastic/elasticsearch/issues/105017

A quick summary:
- `randomizedtesting` library doesn't handle "+" chars in test names
- We currently have the "...#[skip:..., ...]" instructions as part of the test name

As removing the instructions from the name fixes both issues (And makes launching a single test in CLI far easier), the instructions have been moved out of the test name to another parameter.

Before:
```
gradlew ':x-pack:plugin:esql:test' --tests "org.elasticsearch.xpack.esql.CsvTests" -Dtests.method="test {stats.GroupByNull#[skip:-8.12.99,reason:bug fixed in 8.13+]}"
```

After:
```
gradlew ":x-pack:plugin:esql:test" --tests "org.elasticsearch.xpack.esql.CsvTests" -Dtests.method="test {stats.GroupByNull}"
```
2024-07-16 11:28:54 +03:00
Nhat Nguyen
5f5f8124f3 Allow querying index_mode (#110676)
This change allows querying the `index.mode` setting via a new 
`_index_mode` metadata field, enabling APIs such as `field_caps` or
`resolve_indices` to target indices that are either time_series or logs
only. This approach avoids adding and handling a new parameter for
`index_mode` in these APIs. Both ES|QL and the `_search` API should also
work with this new field.
2024-07-16 11:28:54 +03:00
Mark Vieira
7e724bb7f8 Ensure correct runtime Java is used when it matches build Java (#110730)
Ensures that the value provided by the `runtime.java` system property,
or `RUNTIME_JAVA_HOME` environment variable is respected, even when it
is the same as the current `JAVA_HOME`. The previous logic had
`isRuntimeJavaHomeSet` return `false` when the "requested" Java was the
same as the current one. This isn't strictly correct, as the behavior
when Java home is unset is to use the bundled JDK. The result was that
passing `-Druntime.java=17` when the Gradle daemon was also using Java
17 was to execute tests with the bundled JDK, which could be something
entirely different.
2024-07-16 11:28:54 +03:00
Nik Everett
e92514d6a6 ESQL: Documents STATS on multivalue groups (#110712)
This documents running `STATS` on a multivalued column. It also removes
a long out of date warning about a limitation of grouping.
2024-07-16 11:28:54 +03:00
elasticsearchmachine
559a3b1b8f Mute org.elasticsearch.xpack.security.LicenseDLSFLSRoleIT testQueryDLSFLSRolesShowAsDisabled #110729 2024-07-16 11:28:54 +03:00
Nik Everett
d9ec370747 ESQL: Flatten LogicalPlan extensions (#110715)
Previously you had to remember to use `EsqlAggregate` and
`EsqlUnresolvedRelation` instead of `Aggregate` and
`UnresolvedRelation`. This merges the `Esql*` extensions into their
plainly named extensions for easier hacking.
2024-07-16 11:28:54 +03:00
Oleksandr Kolomiiets
30f81c921a Another fix for rollup indexer tests (#110724)
I have recently fixed invocation of `maybeTriggerAsyncJob` in this test
but now invocation count does not match since it counts every _attempt_
to start a job even if it was not successful.
2024-07-16 11:28:54 +03:00
Ryan Ernst
634603cd69 Remove non-state transforms (#110646)
Reserved cluster state is build from handlers that modify cluster state.
In the past there was one "non-state" handler that stored it's state
outside cluster state. However, with that use case now gone, non-state
transforms are no longer needed. This commit removes support for
non-state transforms.
2024-07-16 11:28:53 +03:00
Jim Ferenczi
d233b72d8c Move Retriever Handling to Rewrite Phase (#110641)
This change moves the handling of the retriever to the rewrite phase. It also adds validation of the search source builder after extracting the retriever into the source builder.

Relates #110482
2024-07-16 11:28:53 +03:00
Benjamin Trent
11e6366e58 Enable madvise by default for all builds (#110159)
This feature flag has been enabled by default for snapshot builds for
some time, no significant bumps or changes in rally. 

This commit will enable it by default, even in release builds.
2024-07-16 11:28:53 +03:00
Benjamin Trent
fcc432c811 AwaitsFix: https://github.com/elastic/elasticsearch/issues/110720 2024-07-16 11:28:53 +03:00
Benjamin Trent
fd73147627 AwaitsFix: https://github.com/elastic/elasticsearch/issues/110719 2024-07-16 11:28:53 +03:00
Ignacio Vera
0ad95d52f4 Remove unused GeoShapeFieldMapper from server (#110689) 2024-07-16 11:28:53 +03:00
Mark Tozzi
fdbb08b20e [ESQL] move optimizer rules tests (#110654)
Just moving some code around. This pulls the Optimizer Rule unit tests out of the OptimizerRulesTests file and into individual class test files. As usual, this will reduce the risk of git conflicts when editing tests. It'll also help add visibility to which rules have unit tests and which still need them written.
2024-07-16 11:28:53 +03:00
ghostspiders
4e0eb78a5b KnnVectorQueryBuilder support for allowUnmappedFields (#107047)
* KnnVectorQueryBuilder  support for allowUnmappedFields

* Update and rename 106811.yaml to 107047.yaml

* Update 107047.yaml

* buildkite test

* spotless

* spotless

* Apply suggestions from code review

* fixing compilation

---------

Co-authored-by: Benjamin Trent <ben.w.trent@gmail.com>
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
Co-authored-by: Benjamin Trent <4357155+benwtrent@users.noreply.github.com>
2024-07-16 11:28:53 +03:00
Iván Cea Fontenla
ea899da10d ESQL: Add boolean support to Max and Min aggs (#110527)
- Added support for Booleans on Max and Min
- Added some helper methods to BitArray (`set(index, value)` and `fill(from, to, value)`). This way, the container is more similar to other BigArrays, and it's easier to work with

Part of https://github.com/elastic/elasticsearch/issues/110346, as Max
and Min are dependencies of Top.
2024-07-16 11:28:53 +03:00
Max Hniebergall
30f57a2ca6 [Inference API] Fix upgrade tests by accounting for breaking change of renaming models (#110547)
* Fix upgrade tests by accounting for breaking change of renaming "models" to "endpoints"

* improvements from review

---------

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2024-07-16 11:28:53 +03:00
Panagiotis Bailis
2b5816768b Unmuting tests related to free_context not being released in ESSingleNodeTestCase (#110620) 2024-07-16 11:28:52 +03:00
Benjamin Trent
293726ae52 Fix search template examples by removing params on put (#110660) 2024-07-16 11:28:52 +03:00
Carson Ip
10c3e9dc76 Update stack monitoring mapping for apm-server metrics (#110568)
Update stack monitoring template for .monitoring-beats-mb to include latest apm-server monitoring metrics. All stack monitoring apm-server metrics references in kibana should be intact. To avoid breaking stack monitoring UI, although beat.stats.apm_server.server.response.errors.concurrency is unused and is not present in apm-server stats, it is manually kept in the mapping.
2024-07-16 11:28:52 +03:00
Jedr Blaszyk
ebdc39959f [Connector API] Don't index literal nulls to connector doc (#110543) 2024-07-16 11:28:52 +03:00
David Turner
7eefc1e3b6 Docs links from repo analysis failures (#110681)
We still get too many cases about snapshot repositories which claim to
be S3-compatible but then fail repository analysis because of genuine
incompatibilities or implementation bugs. The info is all there in the
manual but it's not very easy to find. This commit adds more detail to
the response message, including docs links, to help direct users to the
information they need.
2024-07-16 11:28:52 +03:00
Iván Cea Fontenla
9bce4e2ea4 ESQL: Fix TOP agg tests expecting lists for single elements (#110658) 2024-07-16 11:28:52 +03:00
Moritz Mack
ca7b8f6c7b Remove version barrier for synthetic version based features in tests (#110656) 2024-07-16 11:28:52 +03:00
Craig Taverner
6c63fc3330 Fix union-types when aggregating on inline conversion function (#110652)
A query like:

```
FROM sample_data, sample_data_str
| STATS count=count(*) BY client_ip = TO_IP(client_ip)
| SORT count DESC, client_ip ASC
| KEEP count, client_ip
```

Failed due to unresolved aggregates from the union-type in the grouping key
2024-07-16 11:28:52 +03:00
Simon Cooper
549f49cb60 Add test for upgrading to ES with file settings (#110229) 2024-07-16 11:28:52 +03:00
Jan Kuipers
c249033dae Feature flag for adaptive allocations (#110639)
* Feature flag for adaptive allocations

* Update docs/changelog/110639.yaml

* Delete docs/changelog/110639.yaml
2024-07-16 11:28:52 +03:00
Moritz Mack
b22ea17280 Use valid documentation url for capabilities in rest specs (#110657) 2024-07-16 11:28:52 +03:00
Felix Barnsteiner
f74d1831f5 Remove default_field: message from metrics index templates (#110651)
This is a follow-up from
https://github.com/elastic/elasticsearch/pull/102456
2024-07-16 11:28:52 +03:00
Keith Massey
e79ff8ef32 Removing the use of Stream::peek from GeoIpDownloader::cleanDatabases (#110666) 2024-07-16 11:28:52 +03:00
Mark Vieira
9f20216fd2 Remove Windows BWC pull request pipeline (#110664)
We've already removed Windows-specific BWC jobs in our periodic
pipelines. They shouldn't behave differently and are very prone to
timeouts so let's just remove them from pull requests when the
`test-windows` label is added.
2024-07-16 11:28:51 +03:00
Ryan Ernst
ce7cf2158f Move exec syscall filtering to NativeAccess (#108970)
This commit moves the system call filtering initialization into
NativeAccess. The code is essentially unmodified from its existing
state, now existing within the *NativeAccess implementations.

relates #104876
2024-07-16 11:28:51 +03:00
Keith Massey
afec3e133c Adding a unit test for GeoIpDownloader.cleanDatabases (#110650)
Co-authored-by: Joe Gallo <joegallo@gmail.com>
2024-07-16 11:28:51 +03:00
Pat Whelan
5f8fd74073 [Transform] log search payload for preview (#110653)
A quick change to help debug search requests performed by the validate
and preview API.

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2024-07-16 11:28:51 +03:00
Pat Whelan
72521229f0 [Transform] Unmute testMaxPageSearchSizeIsResetToConfiguredValue (#110537)
This was fixed as part of PR#109876.

Relate #109844

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2024-07-16 11:28:51 +03:00
Stanislav Malyshev
fb531313c6 Add feature flag ccs_telemetry (#110619) 2024-07-16 11:28:51 +03:00
Nhat Nguyen
e937ab617e Adjust exchange timeout in tests (#110569)
Some of our tests use an exchange timeout that is too short, causing the 
exchange sinks to expire before the fetch page requests arrive. This
change adjusts the exchange timeout to between 3 and 4 seconds, which
should be sufficient without increasing the execution time of the
disruption tests.

Closes #109944
Closes #106641
2024-07-16 11:28:51 +03:00
Nik Everett
f9187757ac ESQL: Move Failures into the esql proper (#110585)
This moves the `Failueres` and `Failure` class into ESQL's main package,
further slimming down our custom fork of the shared ql code. Slowly
slowly slowly, it will be no more.
2024-07-16 11:28:51 +03:00
David Kyle
49c5544e6d [DOCS] Fix typo: though -> through (#110636) 2024-07-16 11:28:51 +03:00
Luigi Dell'Aquila
8ea900671b ES|QL: better validation for GROK patterns (#110574) 2024-07-16 11:28:51 +03:00
Albert Zaharovits
9192cca7a7 Remove dep com.nimbusds:nimbus-jose-jwt from module org.elasticsearch.xcore (#110565)
The types from com.nimbusds.jwt are almost not needed in x-pack/plugin/core.
They're only needed in module org.elasticsearch.security, x-pack:plugin:security project.
2024-07-16 11:28:51 +03:00
Simon Cooper
dd47c2cb85 Convert some internal engine classes to records (#110329) 2024-07-16 11:28:50 +03:00
Nik Everett
583e9787c8 ESQL: Remove unused option for lexer util (#110583)
This removes the option to match `UPPER_CASE` tokens from a lexer utility.
We only match `lower_case` tokens.
2024-07-16 11:28:50 +03:00
Valeriy Khakhutskyy
ea9d3ecf2a [ML] Updated filtering in DetectionRulesIt.testCondition() (#110628)
While working on elastic/ml-cpp#2677, I encountered a failure in the integration test DetectionRulesIt.testCondition(). It checks the number of return records. With the new change in ml-cpp the native code returns two more values that have no significant score. I added filtering those out in the integration test code so it continues working as expected.
2024-07-16 11:28:50 +03:00
Iván Cea Fontenla
5b7230cc82 ESQL: Fix Max doubles bug with negatives and add tests for Max and Min (#110586)
`MAX()` currently doesn't work with doubles smaller than
`Double.MIN_VALUE` (Note that `Double.MIN_VALUE` returns the smallest
non-zero positive, not the smallest double).

This PR adds tests for Max and Min, and fixes the bug (Detected by the
tests).

Also, as the tests now generate the docs, replaced the old docs with the
generated ones, and updated the Max&Min examples.
2024-07-16 11:28:50 +03:00
Iván Cea Fontenla
f97fbb4d26 ESQL: AVG aggregation tests and ignore complex surrogates (#110579)
Some work around aggregation tests, with AVG as an example:
- Added tests and autogenerated docs for AVG
- As AVG uses "complex" surrogates (A combination of functions), we can't trivially execute them without a complete plan. As I'm not sure it's worth it for most aggregations, I'm skipping those cases for now, as to avoid blocking other aggs tests.

The bad side effect of skipping those tests is that most tests in AvgTests are actually ignored (74 of 100)
2024-07-16 11:28:50 +03:00
Ievgen Degtiarenko
c6dd54ddc1 Reword exception message (#110481)
Rewords the exception message to make it clear the documents limit is per shard, not per index.
2024-07-16 11:28:50 +03:00
Jan Kuipers
87942133c9 Inference autoscaling (#109667)
* Python dev tool for inference autoscaling simulation.

Squashed commit of the following:

commit d98bd3d39d833329ab83a8274885473db41ed08a
Author: Jan Kuipers <jan.kuipers@elastic.co>
Date:   Mon May 13 17:27:38 2024 +0200

    Increase measurement interval to 10secs

commit e808ae5be52c5ea4d5ff8ccb881a4a80de0254f9
Author: Jan Kuipers <jan.kuipers@elastic.co>
Date:   Mon May 13 17:09:33 2024 +0200

    jump -> jumps

commit c38cbdebfcec43e6982bb8bd1670519293161154
Author: Jan Kuipers <jan.kuipers@elastic.co>
Date:   Mon May 13 14:32:42 2024 +0200

    Remove unused estimator

commit 16101f32b539481cd4d648ebb5637a3309853552
Author: Jan Kuipers <jan.kuipers@elastic.co>
Date:   Mon May 13 14:31:30 2024 +0200

    Measure latency periodically + documentation

commit bc73bf29fde1d772701f0b71a7c8a0908669eb0f
Author: Jan Kuipers <jan.kuipers@elastic.co>
Date:   Mon May 13 12:53:19 2024 +0200

    Init variance to None

commit 0e73fa836fa9deec6ba55ef1161cc0dd71f35044
Author: Jan Kuipers <jan.kuipers@elastic.co>
Date:   Mon May 13 11:18:21 2024 +0200

    No autodetection of dynamics changes for latency

commit 75924a744d26a72835529598a6df1a2d22bdaddc
Author: Jan Kuipers <jan.kuipers@elastic.co>
Date:   Mon May 13 10:10:34 2024 +0200

    Move autoscaling code to own class

commit 23553bb8cccd6ed80ac667b12ec38a6d5562dd29
Author: Jan Kuipers <jan.kuipers@elastic.co>
Date:   Wed May 8 18:01:55 2024 +0200

    Improved autoscaling simulation

commit 2db606b2bba69d741fa231f369c633ea793294d5
Author: Tom Veasey <tveasey@elastic.co>
Date:   Tue Apr 30 15:01:40 2024 +0100

    Correct the dependency on allocations

commit 0e45cfbaf901cf9d440efa9b404058a67d000653
Author: Tom Veasey <tveasey@elastic.co>
Date:   Tue Apr 30 11:11:05 2024 +0100

    Tweak

commit a0f23a4a05875cd5df3863e5ad067b46a67c8cda
Author: Tom Veasey <tveasey@elastic.co>
Date:   Tue Apr 30 11:09:30 2024 +0100

    Correction

commit f9cdb140d298bd99c64c79f020c058d60bfba134
Author: Tom Veasey <tveasey@elastic.co>
Date:   Tue Apr 30 09:57:59 2024 +0100

    Allow extrapolation

commit 57eb1a661a2b97412f479606c23c54dfb7887f52
Author: Tom Veasey <tveasey@elastic.co>
Date:   Tue Apr 30 09:55:17 2024 +0100

    Simplify and estimate average duration rather than rate

commit 36dff17194f2bcf816013b112cf07d70c9eec161
Author: Tom Veasey <tveasey@elastic.co>
Date:   Mon Apr 29 21:42:25 2024 +0100

    Kalman filter for simple state model for average inference duration as a function of time and allocation count

commit a1b85bd0deeabd5162f2ccd5a28672299025cee5
Author: Jan Kuipers <jan.kuipers@elastic.co>
Date:   Mon Apr 29 12:15:59 2024 +0200

    Improvements

commit 51040655fcfbfd221f2446542a955fb0f19fb145
Author: Jan Kuipers <jan.kuipers@elastic.co>
Date:   Mon Apr 29 09:33:10 2024 +0200

    Account for virtual cores / hyperthreading

commit 7a93407ecae6b6044108299a1d05f72cdf0d752a
Author: Jan Kuipers <jan.kuipers@elastic.co>
Date:   Fri Apr 26 16:58:25 2024 +0200

    Simulator for inference autoscaling.

* Better process variance upon dynamics changes, and propagate dynamics changes to the next iteration.

* Inference autoscaling (WIP)

* Inference autoscaling test scripts

* Debug logs

* Inference autoscaling API

* Update Autoscalers upon cluster changes

* Polish code / fix bugs

* Use correct string formatter

* More fixes

* Autoscaling tests

* spotless

* Remove scripts (moved to ml-data)

* Rebrand to "adaptive allocations".

* Move serialized field to end

* Rebranding leftover

* Improve adaptive allocation timing

* SystemAuditor for scaling messages

* Fix test

* Add documentation

* Update docs/changelog/109667.yaml

* Cooldown of 5mins after scaleup

* Polish code

* High-variance adaptive allocations test

* Fix AdaptiveAllocationsScalerServiceTests

* Fix typo in package name

* Wire adaptive allocations setting into put inference API

* Checkstyle

* Fix serialization of ElserInternalServiceSettings.

* Propagate adaptive allocations settings from put inference request to create trained model request

* Fix CustomElandInternalTextEmbeddingServiceSettingsTests

* Javadocs

* Improvements / fixes

* Disallow setting num_allocations when adaptive allocations is enabled

* Fix AdaptiveAllocationsScalerServiceTests

* spotless

* NPE fixes

* spotless

* Allow autoscaler to update num allocations

* Fix AdaptiveAllocationsScalerServiceTests.

* Fix bug in inference stats api

* Fix PyTorchResultProcessorTests
2024-07-16 11:28:50 +03:00
Luigi Dell'Aquila
b5c4064766 Remove 'emulated' option for CSV tests (#110124)
it's redundant, as we can use warningRegex instead
2024-07-16 11:28:50 +03:00
Chris Hegarty
42d4ccbe74 Implement xorBitCount in Elasticsearch (#110599)
This commit adds an implement of XOR bit count computed over signed bytes that is ~4x faster than that of Lucene 9.11, on ARM.

While already fixed in Lucene, it'll be in a Lucene version > 9.11. This is effectively a temporary workaround until Lucene 9.12, after which we can revert this.
2024-07-16 11:28:49 +03:00
Craig Taverner
f41607d1be An alternative approach to supporting union-types on stats grouping field (#110600)
* Added union-types field extration to ordinals aggregation

* Revert previous approach to getting union-types working in aggregations

Where the grouping field is erased by later commands, like a subsequent stats.
Instead we include union-type supports in the ordinals aggregation and mark the block loader as not supporting ordinals.
2024-07-16 11:28:49 +03:00
Chris Hegarty
5f88759444 Upgrade to JMH 1.37 (#110580)
This commit upgrades to JMH 1.37. There are some fixes for Mac that allow easier running of profilers, etc.
2024-07-16 11:28:49 +03:00
Armin Braun
5b8a629607 Deduplicate FieldInfo attributes and field names (#110561)
We can use a similar strategy to what worked with mappers+settings and
reuse the string deduplicator to deal with a large chunk (more than 70%
from heap dumps we've seen in production)  of the `FieldInfo`
duplication overhead without any Lucene changes. There's generally only
a very limited number of attribute maps out there and the "dedup up to
100" logic in here deals with all scenarios I have observed in the wild
thus far. As a side effect of deduplicating the field name and always
working with an interned string now, I would expect the performance of
field caps filtering for empty fields to improve measurably.
2024-07-16 11:28:49 +03:00
Nhat Nguyen
8daede8014 Fix translate metrics without rate (#110614)
Currently, we incorrectly remove the `@timestamp` attribute from 
the EsRelation when translating metric aggregates.
2024-07-16 11:28:49 +03:00
Panagiotis Bailis
ff49139e24 Updating ESSingleNodeTestCase to ensure that all free_context actions have been consumed before tearDown (#110595) 2024-07-16 11:28:49 +03:00
Armin Braun
9fbf76b558 Enhance test utility for running tasks in parallel (#110610)
Follow up to #110552, add utility for starting tasks at the same time
via a barrier as discussed there. Also, make use of the new tooling in a
couple more spots to save LoC and thread creation.
2024-07-16 11:28:49 +03:00
Oleksandr Kolomiiets
2d9b631948 Actually fix RollupIndexerStateTests#testMultipleJobTriggering (#110616)
`assertBusy` needs an assert to do something and there were none.

Closes #109627.
2024-07-16 11:28:49 +03:00
Nhat Nguyen
2a0f431ac3 Fix BWC for compute listener (#110615)
ComputeResponse from old nodes may have a null value instead of an empty
list for profiles.

Relates #110400 Closes #110591
2024-07-16 11:28:49 +03:00
Keith Massey
a27ee2d025 Updating CloseIndexRequestTests to account for master term (#110611) 2024-07-16 11:28:49 +03:00
Dianna Hohensee
84fd81ae3b Add debug logging for snapshots (#110246)
Specifically around pausing shard snapshots on
node removal, and finalizing shards snapshots
that change the shard generation of other non-
finalized snapshots

Relates ES-8566.
2024-07-16 11:28:49 +03:00
Patrick Doyle
a3f4fe5038 Use FileSystemProvider instead of RandomGenerator. (#110607)
FileSystemProvider is no longer provided by SPI as of Java 23 EA build 24.

See 42e3c842ae (diff-03546451d9e4189f639e3af3dcd6a9e44318fff5ceaadce8478cbf0203ac3f45L422-L435)
2024-07-16 11:28:48 +03:00
Benjamin Trent
4ff856c4dc Fix flaky test #109978 (#110245)
CCS tests could split the vectors over any number of shards. Through
empirical testing, I determined this commits values work to provide the
expected order, even if they are not all part of the same shard. 

quantization can have weird behaviors when there are uniform values,
just like this test does.

closes #109978
2024-07-16 11:28:48 +03:00
Jonathan Buttner
9a54d44729 [ML] Refactor inference input (#108167)
* Passing inference input through to 3rd party request classes

* Plumbing changes through the rest of the support integrations

* Clean up

* Including input changes with google vertex

* Backing out semantic query changes

* Addressing feedback and adding aws
2024-07-16 11:28:48 +03:00
Keith Massey
3ce80cd78d Do not run TickerScheduleTriggerEngine watches if the schedule trigger engine is paused (#110061) 2024-07-16 11:28:48 +03:00
Max Hniebergall
7c236fd726 [Inference API] Semantic text delete inference (#110487)
* Prevent inference endpoints from being deleted if they are referenced by a semantic text field

* Update docs/changelog/110399.yaml

* fix tests

* remove erroneous loging

* Apply suggestions from code review

Co-authored-by: David Kyle <david.kyle@elastic.co>
Co-authored-by: Carlos Delgado <6339205+carlosdelest@users.noreply.github.com>

* Fix serialization problem

* Update error messages

* Update Delete response to include new fields

* Refactor Delete Transport Action to return the error message on dry run

* Fix tests including disabling failing yaml tests

* Fix YAML tests

* move work off of transport thread onto utility threadpool

* clean up semantic text indexes after IT

* improvements from review

---------

Co-authored-by: David Kyle <david.kyle@elastic.co>
Co-authored-by: Carlos Delgado <6339205+carlosdelest@users.noreply.github.com>
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2024-07-16 11:28:48 +03:00
Rene Groeschke
6a042127e6 [CI] Temporally increase disk space for DRA build jobs (#110601) 2024-07-16 11:28:48 +03:00
David Kyle
290e0607d9 [ML] Fixes processing chunked results in AWS Bedrock service (#110592)
Fixes error using the Amazon Bedrock service with a large 
input that was chunked.
2024-07-16 11:28:48 +03:00
Tim Grein
9e5d012ebd [Inference API] Use extractOptionalPositiveInteger in MistralEmbeddingsServiceSettings for dims and maxInputTokens (#110485) 2024-07-16 11:28:48 +03:00
Oleksandr Kolomiiets
d133ecd4ed Fix MapperBuilderContext#isDataStream when used in dynamic mappers (#110554) 2024-07-16 11:28:48 +03:00
Max Hniebergall
49337b75d3 AwaitsFix: https://github.com/elastic/elasticsearch/issues/110591 2024-07-16 11:28:48 +03:00
Benjamin Trent
df7ca0c158 Fix ExactKnnQueryBuilderTests testToQuery (#110357) (#110589)
closes https://github.com/elastic/elasticsearch/issues/110357

With the loosening of what is considered a unit vector, we need to
ensure we only normalize for equality checking if the query vector is
indeed not a unit vector.
2024-07-16 11:28:48 +03:00
Tim Grein
44aba144e4 [Inference API] Use extractOptionalPositiveInteger in OpenAiEmbeddingsServiceSettings for dims and maxInputTokens (#110484) 2024-07-16 11:28:48 +03:00
elasticsearchmachine
80d21a34d6 Forward port release notes for v8.14.2 (#110538) 2024-07-16 11:28:47 +03:00
Joe Gallo
27d07cf1c1 A small tidiness refactor of the GeoIpTaskState's Metadata (#110553) 2024-07-16 11:28:47 +03:00
Tim Grein
97d00afeb8 [Inference API] Use extractOptionalPositiveInteger in AzureOpenAiEmbeddingsServiceSettings for dims and maxInputTokens (#110483) 2024-07-16 11:28:47 +03:00
Rene Groeschke
6cc9229c8f [Gradle] Only resolve latest patch version for resolveAllDependencies (#110584)
* Only resolve latest patch version for resolveAllDependencies

This should avoid downloading to many elasticsearch distributions
and reduce disk usage and speed up image creations.

* Some cleanup
2024-07-16 11:28:47 +03:00
Nik Everett
e26bb60b16 ESQL: Rework sequence for analyzing queries (#110566)
In service of the incoming INLINESTATS this flips the ordering of
analysis. Previously we made the entire sequence of analyze, optimize,
convert to physical plan, and optimize in a single async sequence in
`EsqlSession`. This flips it so `analyze` comes first in it's own async
sequence and then runs the remaining stuff in a separate sequence.
That's nice for INLINESTATS where we want to analyze one time, and then
run many runs of the extra sequence.

While we're here, we also take that sequence call it directly from the
CsvTests. That works well because that final sequence is exactly what
CsvTests have to do. They "analyze" totally differently, but they run
the final sequence in the same way.

Closes #107953
2024-07-16 11:28:47 +03:00
Craig Taverner
dfcb822aee Fix bug in union-types with type-casting in grouping key of STATS (#110476)
* Allow auto-generated type-cast fields in CsvTests

This allows, for example, a csv-spec test result header like `client_ip::ip:ip`, which is generated with a command like `STATS count=count(*) BY client_ip::ip`

It is also a small cleanup of the header parsing code, since it was using Strings.split() in an odd way.

* Fix bug in union-types with type-casting in grouping key of STATS

* Update docs/changelog/110476.yaml

* Added casting_operator required capability

Using the new `::` syntax requires disabling support for older versions in multi-cluster tests.

* Added more tests for inline stats over long/datetime

* Trying to fix the STATS...STATS bug

This makes two changes:

* Keeps the Alias in the aggs.aggregates from the grouping key, so that ReplaceStatsNestedExpressionWithEval still works
* Adds explicit support for union-types conversion at grouping key loading in the ordinalGroupingOperatorFactory

Neither fix the particular edge case, but do seem correct

* Added EsqlCapability for this change

So that mixed cluster tests don't fail these new queries.

* Fix InsertFieldExtract for union types

Union types require a FieldExtractExec to be performed first thing at
the bottom of local physical plans.

In queries like
```
  from testidx*
  | eval x = to_string(client_ip)
  | stats c = count(*) by x
  | keep c
```
The `stats` has the grouping `x` but the aggregates get pruned to just
`c`. In cases like this, we did not insert a FieldExtractExec, which
this fixes.

* Revert query that previously failed

With Alex's fix, this query now passes.

* Revert integration of union-types to ordinals aggregator

This is because we have not found a test case that actually demonstrates this is necessary.

* More tests that would fail without the latest fix

* Correct code style

* Fix failing case when aggregating on union-type with invalid grouping key

* Capabilities restrictions on the new YML tests

* Update docs/changelog/110476.yaml

---------

Co-authored-by: Alexander Spies <alexander.spies@elastic.co>
2024-07-16 11:28:47 +03:00
David Turner
732302cb10 Simplify HandshakingTransportAddressConnector (#110572)
Replaces the deeply-nested listener stack with a `SubscribableListener`
sequence to clarify the process, particularly its failure handling. Also
adds assertions that each step does not double-complete its listener.
2024-07-16 11:28:47 +03:00
Iván Cea Fontenla
7af6e98bde ESQL: Change TopList tests with random cases (#110327)
Instead of using simple hardcoded cases for aggregation tests, use random ones provided by the `<type>Cases()` methods
2024-07-16 11:28:47 +03:00
David Turner
ac2744cc13 Clarify logs/errors re. publish addresses (#110570)
These warning logs and error messages assume some level of understanding
of Elasticsearch's networking config and are not particularly
actionable. This commit adds links to the relevant section of the
manual, rewords them a little to match the terminology used in the
manual, and also documents that each node must have its own publish
address, distinct from those of all other nodes.
2024-07-16 11:28:47 +03:00
Simon Cooper
449a3e2663 Add known-issues for all affected releases for the feature upgrade issue (#110523) 2024-07-16 11:28:47 +03:00
Artem Prigoda
be7823c19d Revert "Trying to make SharedBlobCacheService async?"
This reverts commit 1c859c9f7a.
2024-07-16 11:28:47 +03:00
Artem Prigoda
29e2872cf0 Trying to make SharedBlobCacheService async? 2024-07-16 11:28:47 +03:00
David Turner
4977c2d01f Add ref docs links to allocation explain text (#110571)
We say "specify the target shard in the request" but this doesn't in
itself help users work out how to do this. Linking to the docs should
help.
2024-07-16 11:28:46 +03:00
David Turner
0bec702121 AwaitsFix for #110551 2024-07-16 11:28:46 +03:00
David Turner
a5bd451473 Simplify testListTasksWaitForCompletion (#110429)
Makes use of the recently-introduced `flushThreadPoolExecutor` utility
in another spot.

Relates #110405
2024-07-16 11:28:46 +03:00
David Turner
88f59c7ae6 Use actionGet instead of manual unwrapping (#110418)
Now that #102351 is fixed there won't be ≥10 layers of exceptions to
unwrap here so we can go back to using the regular test utilities for
accessing the root cause.

Relates #102352 Relates #102348
2024-07-16 11:28:46 +03:00
Armin Braun
5a9d5ab163 Introduce utility for concurrent execution of arbitrary Runnable in tests (#110552)
We have the same pattern in a bunch of places, I dried up a few here. We
want to run N tasks so we create N threads in a loop, start them and
join them right away. The node starting logic refactored here is
essentially the same since the threads have idle lifetime 0. This can be
dried up a little and made more efficient. Might as well always use
`N-1` tasks and run one of them on the calling thread. This saves quite
a few threads when running tests and speeds things up a little,
especially when running many concurrent Gradle workers and CPU is at
100% already (mostly coming from the speedup on starting nodes this
brings and the reduction in test thread sleeps).

No functional changes to the tests otherwise, except for some replacing
of `CountDownLatch` with `CyclicalBarrier` to make things work with the
new API.
2024-07-16 11:28:46 +03:00
Aditya Kukankar
9cd826697b Correct transport CA name in security autoconfig (#106520)
Updates the name of the transport CA in security autoconfiguration.

Previously both the HTTP and Transport CAs had the same name
(`CN=Elasticsearch security auto-configuration HTTP CA`).
The transport CA now has a different name
(`CN=Elasticsearch security auto-configuration transport CA`).

Closes: #106455

Co-authored-by: Aditya Kukankar <adityakukankar@gmail.com>
Co-authored-by: Tim Vernum <tim@adjective.org>
2024-07-16 11:28:46 +03:00
Nhat Nguyen
04f7e1106e Adjust cancellation message in task tests (#110546)
Adding `parent task was cancelled [test cancel]` to the list 
of allowed cancellation messages.
2024-07-16 11:28:46 +03:00
Ryan Ernst
5b27d50183 Update JDK23 to build 24 (#110549) 2024-07-16 11:28:46 +03:00
Parker Timmins
fa1c97fca2 Deprecate using slm privileges to access ilm (#110540)
Currently, read_slm privilege grants access to get the ILM status,
and manage_slm grants access to start/stop ILM. This access will
be removed in the future, but needs to be deprecated before
removal. Add deprecation warning to the read_slm and manage_slm docs.
2024-07-16 11:28:46 +03:00
Nhat Nguyen
e00d26710d Introduce compute listener (#110400)
Currently, if a child request fails, we automatically trigger  cancellation
for ES|QL requests. This can result in TaskCancelledException being
collected by the RefCountingListener first, which then returns that 
exception to the caller. For example, if we encounter a 
CircuitBreakingException (429), we might incorrectly return a 
TaskCancelledException (400) instead.

This change introduces the ComputeListener, a variant of 
RefCountingListener, which selects the most appropriate exception to return
to the caller. I also integrated the following features into ComputeListener to
simplify ComputeService:

- Automatic cancellation of sub-tasks on failure.
- Collection of profiles from sub-tasks.
- Collection of response headers from sub-tasks.
2024-07-16 11:28:46 +03:00
Pat Whelan
5e5451636d [ML] Wait for test to finish (#110542)
The tests can kick off tasks on another thread.  We should wait for
those threads to join back before we begin making assertions.

Fix #110536
2024-07-16 11:28:46 +03:00
Armin Braun
03c8b029ed Speedup ES87BloomFilterPostingsFormat.writeBloomFilters (#110289)
Aquiring a buffer is rather expensive and we use a buffer of constant
size throughout, lets leverage this fact and save contention on the
allocator.
Also, we can hoist the filter size calculation out of the loop and do
the write to the index output without without grabbing the file pointer
or allocating any bytes in msot cases.
2024-07-16 11:28:46 +03:00
Fang Xing
9f4c733e81 [ES|QL] validate mv_sort order (#110021)
* validate mv_sort order
2024-07-16 11:28:46 +03:00
Mark J. Hoy
5675e52701 [Inference API] Add Amazon Bedrock support to Inference API (#110248)
* Initial commit; setup Gradle; start service

* initial commit

* minor cleanups, builds green; needs tests

* bug fixes; tested working embeddings & completion

* use custom json builder for embeddings request

* Ensure auto-close; fix forbidden API

* start of adding unit tests; abstraction layers

* adding additional tests; cleanups

* add requests unit tests

* all tests created

* fix cohere embeddings response

* fix cohere embeddings response

* fix lint

* better test coverage for secrets; inference client

* update thread-safe syncs; make dims/tokens + int

* add tests for dims and max tokens positive integer

* use requireNonNull;override settings type;cleanups

* use r/w lock for client cache

* remove client reference counting

* update locking in cache; client errors; noop doc

* remove extra block in internalGetOrCreateClient

* remove duplicate dependencies; cleanup

* add fxn to get default embeddings similarity

* use async calls to Amazon Bedrock; cleanups

* use Clock in cache; simplify locking; cleanups

* cleanups around executor; remove some instanceof

* cleanups; use EmbeddingRequestChunker

* move max chunk size to constants

* oof - swapped transport vers w/ master node req

* use XContent instead of Jackson JsonFactory

* remove gradle versions; do not allow dimensions
2024-07-16 11:28:45 +03:00
Armin Braun
ab459e7bb7 Cleanup some outdated BwC in DocWriteRequests (#110386)
It's in the title, lots of the BwC is outdated + cleaning up one
instance of duplicating in the writing of update requests.
2024-07-16 11:28:45 +03:00
elasticsearchmachine
3452cdd0e8 Mute org.elasticsearch.xpack.ml.inference.assignment.TrainedModelAssignmentNodeServiceTests testLoadQueuedModelsWhenOneFails #110536 2024-07-16 11:28:45 +03:00
Nhat Nguyen
3420d2b34b Fix node tests for ToPartial (#110448)
This change makes the three-parameter constructor of ToPartial public so 
that EsqlNodeSubclassTests can pick it up properly.

Closes #110310
2024-07-16 11:28:45 +03:00
Nik Everett
778088dc3c ESQL: Fix compilation
Two PRs passing in the night, breaking each other.

This passes precommit locally but I haven't double checked tests. But at
least Elasticsearch compiles again.
2024-07-16 11:28:45 +03:00
Nik Everett
37cb526ea9 ESQL: Remove unused code from esql-core (#110440)
This removes a few unused classes from esql-core. we got them as part of
our clone of the shared ql code.
2024-07-16 11:28:45 +03:00
Nik Everett
f93ccb3d74 ESQL: Move LogicalPlan to esql proper (#110426)
This moves LogicalPlan and all subclasses and references out of our esql-core and into esql-proper so that we can further simplify things.
2024-07-16 11:28:45 +03:00
Nik Everett
1382cc1518 ESQL: Plumb a way to run phased plans (#110445)
INLINESTATS is going to run two ESQL commands - one to get the STATS and
one to join the stats results to the output. This plumbs a way for
`EsqlSession#execute` to run multiple dips into the compute engine using
a `BiConsumer<PhysicalPlan, ActionListener<Result>> runPhase`. For now,
we just plug that right into the output to keep things working as they
are now. But soon, so soon, we'll plug in a second phase.
2024-07-16 11:28:45 +03:00
Mayya Sharipova
a2049c0532 Fix bit vector tests (#110521)
Bit vector tests were failing in cases where an index has more than 1 shards.
For error cases when we expected a failure of the whole request, shards
with empty documents returned success and the whoel request unexpectedly returned 200.

Ensuring that index contains only 1 shard fixes these failures.

Closes #110290, #110291
2024-07-16 11:28:44 +03:00
Pat Whelan
062f12a274 [ML] Avoid ModelAssignment deadlock (#109684)
The model loading scheduled thread iterates through the model
queue and deploys each model. Rather than block and wait on each
deployment, the thread will attach a listener that will either iterate
to the next model (if one is in the queue) or reschedule the thread.

This change should not impact:
1. the iterative nature of the model deployment process - each model is
   still deployed one at a time, and no additional threads are consumed
   per model.
2. the 1s delay between model deployment tries - if a deployment fails
   but can be retried, the retry is added to the next batch of models
   that are consumed after the 1s scheduled delay.

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
Co-authored-by: David Kyle <david.kyle@elastic.co>
2024-07-16 11:28:44 +03:00
Ignacio Vera
d11f687fdd Add protection for OOM during aggregations partial reduction (#110520)
This commit adds a check the parent circuit breaker every 1024 call to the buckets consumer during aggregations 
partial reduction.
2024-07-16 11:28:44 +03:00
Johannes Fredén
740c7535d8 Add audit logging for bulk role APIs (#110410)
* Add audit logging for bulk put role
2024-07-16 11:28:44 +03:00
Martijn van Groningen
ed3598a55c Slightly adjust wording around potential savings mentioned in the description of the index.codec setting (#110468) 2024-07-16 11:28:44 +03:00
Albert Zaharovits
746c38c100 DOCS Query Roles (#110473)
These are the docs changes in relation to
https://github.com/elastic/elasticsearch/pull/108733
2024-07-16 11:28:44 +03:00
Johannes Fredén
3bfd45eac5 Always write empty role descriptor fields to index (#110424)
* Always write empty role descriptor fields to index
2024-07-16 11:28:44 +03:00
Ievgen Degtiarenko
698224beb6 Fix testRelocationFailureNotRetriedForever (#109855) 2024-07-16 11:28:44 +03:00
Mary Gouseti
418818e53d Wait for the logs templates to be initialised 5 sec longer (#110495)
We have witnessed some test failures in `DataStreamUpgradeRestIT`,
`EcsLogsDataStreamIT` and `LogsDataStreamIT` during which the `logs`
related index or component template gets initialised right after the 10
seconds have passed. We increase the timeout to make the test more
resilient to this scenario.
2024-07-16 11:28:44 +03:00
Nhat Nguyen
ba6cd28ab8 Fix esql enrich memory leak (#109275) (#110450)
This PR was reviewed in #109275

Block and Vector use a non-thread-safe RefCounted. Threads that increase
or decrease the references must have a happen-before relationship.
However, this order is not guaranteed in the enrich lookup for the
reference of selectedPositions. The driver can complete the
MergePositionsOperator, which decreases the reference count of
selectedPositions, while the finally block may also decrease it in a
separate thread. These actions occur without a defined happen-before
relationship.

Closes #108532
2024-07-16 11:28:44 +03:00
Armin Braun
15291377b8 Override BufferedInputStream to not sychronize single byte reads in Compressor (#109647)
With biased locking gone, we see some slowness in profiling
when we use this stream for single byte reads.
This is a recent regression that is a result of
https://openjdk.org/jeps/374.
-> the sychronization overhead for bulk reads hardly matters, but since
we do quite a few single byte reads lets fix this.
2024-07-16 11:28:44 +03:00
Oleksandr Kolomiiets
3f57555963 Reflect latest changes in synthetic source documentation (#109501) 2024-07-16 11:28:44 +03:00
Iván Cea Fontenla
d046d1b393 ESQL: Add tests to call aggregation intermediate states (#110279)
Test aggregations intermediate states on base aggregation test class.

Added another "middleware" to add "no rows" test cases.
2024-07-16 11:28:43 +03:00
Tim Grein
9c3e270fbb [Inference API] Use extractOptionalPositiveInteger instead of removeAsType in AzureAiStudioEmbeddingsServiceSettings (#110366) 2024-07-16 11:28:43 +03:00
Luca Cavanna
7d459b9008 Update replicas for downsample index only when necessary (#110467)
The number of replicas for the downsample index gets set to 0 by default (overridable via setting) and later incremented to a higher value.
This is done unconditionally, but in reality if the downsample index already has replicas, we should not override its number of replicas.

Closes #109968
2024-07-16 11:28:43 +03:00
István Zoltán Szabó
bd5fcbbf5e [DOCS] Adds 8.14.2 release notes to main. (#110471) 2024-07-16 11:28:43 +03:00
elasticsearchmachine
6d7e7ada28 Prune changelogs after 8.14.2 release 2024-07-16 11:28:43 +03:00
elasticsearchmachine
50249deed8 Bump versions after 8.14.2 release 2024-07-16 11:28:43 +03:00
elasticsearchmachine
e82f1d1ebb Bump to version 8.16.0 2024-07-16 11:28:43 +03:00
Tim Grein
486415d60d [Inference API] Use projectId for Google Vertex AI embeddings rate limit grouping (#110365) 2024-07-16 11:28:43 +03:00
Tim Grein
6ca7fd4f7b [Inference API] Make error message in AbstractBWCWireSerializationTestCase more explicit, that the number refers to the TransportVersion (#110433) 2024-07-16 11:28:43 +03:00
Simon Cooper
b8adf93616 Add some specific unit tests for ReservedClusterState methods (#110436) 2024-07-16 11:28:43 +03:00
Martijn van Groningen
7fc884c440 Add some information about the impact of index.codec setting. (#110413) 2024-07-16 11:28:43 +03:00
Mikhail Berezovskiy
6ecc87ad1b remove security manager supression (#110447)
Follow for #110358. We don't need security suppression after Netty's
SelfSignCertificate removal.
2024-07-16 11:28:43 +03:00
Nick Tindall
49378c3b98 Improve mechanism for extracting the result of a PlainActionFuture (#110019)
Closes #108125
2024-07-16 11:28:43 +03:00
Max Hniebergall
77a525eadb Revert "[Inference API] Prevent inference endpoints from being deleted if the…" (#110446)
This reverts commit 89a1bd9c2d.
2024-07-16 11:28:42 +03:00
Nik Everett
5b4cbddfb2 ESQL: Fix running tests in intellij (#110444)
When we added arrow support we needed to add a security permission to
hack around their initialization code. That confused intellij running
tests. This removes the confusion by manually resolving the location.
2024-07-16 11:28:42 +03:00
Max Hniebergall
9ebd26404d [Inference API] Prevent inference endpoints from being deleted if they are referenced by semantic text (#110399)
Following on https://github.com/elastic/elasticsearch/pull/109123
2024-07-16 11:28:42 +03:00
George Wallace
48c0837ed7 Update role-mapping-resources.asciidoc (#110441)
made it clear that some characters need to be escaped properly

Co-authored-by: Jan Doberstein <jan.doberstein@elastic.co>
2024-07-16 11:28:42 +03:00
Armin Braun
2cea9ddfbc Stop copying bucket list when doing desc sort (#110439)
No need to copy here, the list is freshly allocated for us in 100% of
cases here and we're not copying when sorting either.
2024-07-16 11:28:42 +03:00
David Turner
f048372d1c Add Javadocs for safeAwait() etc. test methods (#110407)
Seems worth adding a few words about what exactly these methods are for.
2024-07-16 11:28:42 +03:00
Nik Everett
b2a04a7bf7 ESQL: Rename isInteger to isWholeNumber (#110425)
It's confusing that we have a type called `integer` and we have a method
called `isInteger` which returns `true` for `integer` *and* `long`. This
renames that method to `isWholeNumber`. It also renames `isRational` to
`isRationalNumber` to line up.
2024-07-16 11:28:42 +03:00
Nik Everett
c6439cf33c ESQL: Merge more code into esql-proper (#110432)
This removes the `Graphviz` class which we don't currently use and
merges the `LoggingUtils` class into it's single caller,
`EsqlResponseListener`.
2024-07-16 11:28:42 +03:00
elasticsearchmachine
c1ea56ea9e Mute org.elasticsearch.test.rest.yaml.CcsCommonYamlTestSuiteIT test {p0=search.vectors/41_knn_search_half_byte_quantized/Test create, merge, and search cosine} #109978 2024-07-16 11:28:42 +03:00
Lisa Cawley
dd74e274db [DOCS] Add serverless details in Elasticsearch security privileges (#109718) 2024-07-16 11:28:42 +03:00
Max Hniebergall
1e76b0562c [Inference API] Fix serialization for inference delete endpoint response (#110431) 2024-07-16 11:28:42 +03:00
Oleksandr Kolomiiets
1ead5baf9a Improve reliability of RollupIndexerStateTests#testMultipleJobTriggering (#110397) 2024-07-16 11:28:41 +03:00
Kostas Krikellas
4d9bac0fcd Add a unittest for synthetic source on disabled keyword (#110428)
* Add test for nested array, fix sort  on nested test.

* Fix sort  on nested test.

* Add a unittest for synthetic source on disabled keyword
2024-07-16 11:28:41 +03:00
Albert Zaharovits
ff737f5b86 Move yml rest test for query roles (#110423)
This moves the query roles yml rest test away from the file that's also ran
in serverless (where the query-roles endpoint is not available).
2024-07-16 11:28:41 +03:00
Nik Everett
50b630dd37 ESQL: Merge function registries (#110402)
This merges the `FunctionRegistry` from `esql-core` into the
`EsqlFunctionRegistry` in `esql` proper in an effort to shave down the
complexity we got by attempting to share lots of infrastructure with SQL
and KQL. Since we no longer share we can compress these two together.
2024-07-16 11:28:41 +03:00
Nhat Nguyen
c1e0081188 Enable double rounding when test with more than 1 node (#110404)
With this change, we will enable rounding for double values in the 
single-node QA module in serverless tests, while keeping it disabled
in stateful tests.
2024-07-16 11:28:41 +03:00
Armin Braun
3d3494e05c Speedup index math for BigArray implementations (#110421)
Same as https://github.com/elastic/elasticsearch/pull/110377, provides a
little speedup to this at times very hot code.
2024-07-16 11:28:41 +03:00
Luigi Dell'Aquila
a9bb962cc0 ES|QL: Fix possible ClassCastException with ReplaceMissingFieldWithNull (#110373)
Fix ReplaceMissingFieldWithNull by explicitly listing the commands that
can be optimized replacing missing FieldAttributed with NULL Literals.

Also adding a unit test that demonstrates possible scenarios where
introducing a new command can lead to `ClassCastException` with
`ReplaceMissingFieldWithNull` local optimization rule and an integration
test that covers https://github.com/elastic/elasticsearch/issues/109974

Fixes #110150
2024-07-16 11:28:41 +03:00
David Turner
1ea48857a7 Stricter failure handling in TransportGetSnapshotsAction (#107191)
Today if there's a failure during a multi-repo get-snapshots request
then we record a per-repository failure but allow the rest of the
request to proceed. This is trappy for clients, it means that they must
always remember to check the `failures` response field or else risk
missing some results. It's also a pain for the implementation because it
means we have to collect the per-repository results separately first
before adding them to the final results set just in case the last one
triggers a failure.

This commit drops this leniency and bubbles all failures straight up to
the top level.
2024-07-16 11:28:41 +03:00
Nik Everett
0d31beeb4c ESQL: Add javadocs for some of DataType (#110396)
This adds some javadoc to a few of the methods on `DataType`. That's
important because `DataType` is pretty central to how ESQL works and is
referenced in tons of code. The method `isInteger` especially wants an
explanation - it's true for all whole numbers.
2024-07-16 11:28:41 +03:00
Nik Everett
b88dd01588 ESQL: Drop unused Node subclasses (#110419)
And merge NodeSubclassTests into EsqlNodeSubclassTests.
2024-07-16 11:28:41 +03:00
Tim Grein
3a286d703e [Inference API] Add Google Vertex AI reranking docs (#110390) 2024-07-16 11:28:41 +03:00
Johannes Fredén
f52a5392f1 AwaitsFix: https://github.com/elastic/elasticsearch/issues/110417 2024-07-16 11:28:41 +03:00
Johannes Fredén
9dda6b06b0 AwaitsFix: https://github.com/elastic/elasticsearch/issues/110416 2024-07-16 11:28:40 +03:00
Rene Groeschke
8448334796 Include ent search yaml rest specs in rest resources zip (#110411)
This should allow supporting ent-search api in Elasticsearch specification validation
2024-07-16 11:28:40 +03:00
Panagiotis Bailis
8b1060fd03 Adding trace logging for SearchProgressActionListenerIT (#110378) 2024-07-16 11:28:40 +03:00
Simon Cooper
61aceadd0b Add tests for FileSettingsService.handleSnapshotRestore (#110376)
Also streamline FileSettingsService tests a bit
2024-07-16 11:28:40 +03:00
Craig Taverner
2ad10eca72 Fix missing cases for ST_DISTANCE Lucene pushdown (#110391)
* Fix missing cases for ST_DISTANCE Lucene pushdown

The feature to pushdown ST_DISTANCE to Lucene was not working when combined with OR and NOT clauses, or more deeply nested. This fixes that by traversing the predicate tree recursively.

* Update docs/changelog/110391.yaml

* Fixed changelog
2024-07-16 11:28:40 +03:00
Nick Tindall
0ae11a9b6e Don't detect PlainActionFuture deadlock on concurrent complete (#110361)
Closes #110360
Closes #110181
2024-07-16 11:28:40 +03:00
Johannes Fredén
4f6cc2463c Add bulk delete roles API (#110383)
* Add bulk delete roles API
2024-07-16 11:28:40 +03:00
Sylvain Wallez
86977271b4 ESQL: add Arrow dataframes output format (#109873)
Initial support for Apache Arrow's streaming format as a response for ES|QL. It triggers based on the Accept header or the format request parameter.

Arrow has implementations in every mainstream language and is a backend of the Python Pandas library, which is extremely popular among data scientists and data analysts. Arrow's streaming format has also become the de facto standard for dataframe interchange. It is an efficient binary format that allows zero-cost deserialization by adding data access wrappers on top of memory buffers received from the network.

This PR builds on the experiment made by @nik9000 in PR #104877

Features/limitations:
- all ES|QL data types are supported
- multi-valued fields are not supported
- fields of type _source are output as JSON text in a varchar array. In a future iteration we may want to offer the choice of the more efficient CBOR and SMILE formats.

Technical details:

Arrow comes with its own memory management to handle vectors with direct memory, reference counting, etc. We don't want to use this as it conflicts with Elasticsearch's own memory management.

We therefore use the Arrow library only for the metadata objects describing the dataframe schema and the structure of the streaming format. The Arrow vector data is produced directly from ES|QL blocks.

---------

Co-authored-by: Nik Everett <nik9000@gmail.com>
2024-07-16 11:28:40 +03:00
Carlos Delgado
77d063db38 semantic_text: Updated copy-to docs (#110350) 2024-07-16 11:28:40 +03:00
Yang Wang
bd9e836e80 Minor javadoc fix for BalancedShardsAllocator (#110117)
Relates: #109662
2024-07-16 11:28:40 +03:00
Luigi Dell'Aquila
820afd51fb ES|QL: add tests for NaN on BUCKET function (#110380)
Closes #105166

Adding tests that verify that `BUCKET` (previously `AUTO_BUCKET`)
function does not return `NaN` when an invalid number of buckets is
provided (eg. 0, -1 or a very large integer)
2024-07-16 11:28:40 +03:00
David Turner
a1740883f5 AwaitsFix: https://github.com/elastic/elasticsearch/issues/110408 2024-07-16 11:28:39 +03:00
David Turner
013f596416 Fix testBatchCloseIndices (#110405)
It's not enough to wait for the tasks to appear in the pending tasks
queue, we must also then wait for the submitting threads to become idle
to ensure that the queue size is correct and therefore that the batch is
properly formed.

Closes #109187
2024-07-16 11:28:39 +03:00
David Turner
d94f83b774 AwaitsFix for #110406 2024-07-16 11:28:39 +03:00
David Turner
9d26b60c3a Avoid routing loops in TransportMasterNodeAction (#108909)
Closes #102351

Co-authored-by: Nick Tindall <nick.tindall@elastic.co>
2024-07-16 11:28:39 +03:00
Nhat Nguyen
868c8193e0 Fix serialization of to_partial and from_partial (#110403)
#110157 broke the serialization of ToPartial and FromPartial, where the 
parameters weren't properly assigned.

I will look into making these classes more compatible with 
AggregateFunction, but this small change should stabilize the CI.

Relates #110157
2024-07-16 11:28:39 +03:00
elasticsearchmachine
5cb235d9e4 Add 8.15 to branches.json 2024-07-16 11:28:39 +03:00
Fang Xing
64c75c0aa2 [ES|QL] weighted_avg (#109993)
* weighted_avg
2024-07-16 11:28:39 +03:00
Aurélien FOUCRET
4a40fc88a1 [LTR] Do not add fields extracted using a query to the FieldValueFeatureExtractor (#109437) 2024-07-16 11:28:39 +03:00
Matt Culbreth
278141cc7e Mark the Redact processor as Generally Available 2024-07-16 11:28:39 +03:00
Nik Everett
7f0c89d1e5 ESQL: Migrate all serialization of Expression (#110157)
This moves all of `Expression` serialization from ESQL's home grown
system into `NamedWriteable` which is how the rest of Elasticsearch
works. We previously implemented `NamedWriteable` on all `Expression`
subclasses and tested it. This just switches all production
serialization over. It is wire compatible with the old custom way, so no
one should notice anything other than less custom code.
2024-07-16 11:28:39 +03:00
David Turner
d957db826d AwaitsFix for #110398 2024-07-16 11:28:38 +03:00
Nik Everett
09288db86d ESQL docs: Push down needs index and doc_values (#110353)
This adds a `NOTE` to each comparison saying that pushing the comparison
to the search index requires that the field have an `index` and
`doc_values`. This is unique compared to the rest of Elasticsearch which
only requires an `index` and it's caused by our insistence that
comparisons only return true for single-valued fields. We can in future
accelerate comparisons without `doc_values`, but we just haven't written
that code yet.
2024-07-16 11:28:38 +03:00
Nik Everett
300d2ccb7d ESQL: Skip lookup csv tests on release builds (#110166)
LOOKUP isn't supported in release builds yet and it'll fail with a
helpful error message if you try it there. But some of the csv-spec
tests didn't realize that. Lots did, but these particular ones didn't.

Close #109170
2024-07-16 11:28:38 +03:00
Armin Braun
69e4192cb6 Speedup BigByteArray index math (#110377)
We only have a single hard code page size here. We can generate
faster code by using a static page size, saving field loads etc.
2024-07-16 11:28:38 +03:00
Armin Braun
03ce1f1cfa Stop using ReleasableLock in Translog (#107600)
As discussed in #107555 there's some overhead to the use of `ReleasableLock`
and it's probably not a good idea using it on the hot(ish) path in this class.
2024-07-16 11:28:38 +03:00
Carlos Delgado
9040334092 Fix https://github.com/elastic/elasticsearch/issues/110212 (#110392)
Closes https://github.com/elastic/elasticsearch/issues/110212

Fixes ArrayOutOfBounds when choosing a random element from the created
synonyms.
2024-07-16 11:28:38 +03:00
Kathleen DeRusso
262df1ac45 Pass over Sparse Vector docs for correctness (#110282)
* Remove legacy mentions of text expansion queries

* Add missing query_vector param to sparse_vector query docs

* Fix formatting errors in sparse vector query dsl doc

* Remove unnecessary test setup block
2024-07-16 11:28:38 +03:00
Carlos Delgado
6dd1660aec semantic_text: avoid nesting for multiple levels (#110344) 2024-07-16 11:28:38 +03:00
David Turner
99e8760b4f Tidy up SecurityNetty4TransportCloseNotifyIT (#110311)
Some suggestions from a post-merge review of #109899:

- Sometimes run on multi-node cluster.
- Use `SAFE_AWAIT_TIMEOUT` for waits.
- Remove unnecessary `assertBusy()`
2024-07-16 11:28:38 +03:00
James Baiera
dbeb396796 Add an index setting that captures the version of the failure store definition (#110354)
* Add an index setting that captures the version of the failure store definition

* I wish my PRs would precommit-fix themselves

---------

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2024-07-16 11:28:38 +03:00
Volodymyr Krasnikov
43742cadfa Avoid possible flaky builds (#110301)
* Segragate sys prop dependent tests by gradle tasks

* Add dependency to gradle check task + style

* Update server/src/test/java/org/elasticsearch/index/IndexSettingsOverrideTests.java

Co-authored-by: Yang Wang <ywangd@gmail.com>

---------

Co-authored-by: Yang Wang <ywangd@gmail.com>
2024-07-16 11:28:38 +03:00
Joe Gallo
cddd9afff7 Add auth and better tests to the ingest geoip http client (#110381) 2024-07-16 11:28:37 +03:00
Craig Taverner
4ac71500a2 Implement lucene pushdown on ST_DISTANCE for Equality (#110348)
* Reapply "Support ST_DISTANCE with EQ predicate"

This reverts commit 1deb7b76ba.

* Quantize points before calculating distance, and add more tests

Curiously I was not able to reproduce any difference in behaviour between Lucene (pushdown) and ESQL distance calculation, even when focusing in on same data generated to be on the edge of the quantization boundaries and the haversinDistance boundary.
2024-07-16 11:28:37 +03:00
Albert Zaharovits
76f7bf601a Query Roles API (#108733)
This adds the Query Roles API:

```
POST /_security/_query/role
GET /_security/_query/role
```

This is similar to the currently existing:  * [Query API key
API](https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-query-api-key.html)
* [Query User
API](https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-query-user.html)

Sample request:

```
POST /_security/_query/role
{
  "query": { 
    "bool": {
      "filter": [
        {
          "terms": {
            "applications.application": ["app-1", "app-2" ]
          }
        }
      ],
      "must_not": [
        {
          "match": {
            "description": {
              "query": "test match on role description (which is mapped as a text field)"
            }
          }
        }
      ]
    }
  },
  "sort": [ 
    "name"
  ],
  "search_after": [
    "role-name-1"
  ]
}
```

The query supports a subset of query types, including match_all, bool,
term, terms, match, ids, prefix, wildcard, exists, range, and simple
query string.

Currently, the supported fields are:  * name  * description  * metadata 
* applications.application  * applications.resources  *
applications.privileges

The query also supports pagination-related fields (`from`, `size`,
`search_after`), analogous to the generic [Search
API](https://www.elastic.co/guide/en/elasticsearch/reference/current/search-search.html).

The response format is similar to that of the [Query API
key](https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-query-api-key.html)
and [Query
User](https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-query-user.html)
APIs. It contains a **list** of roles, in the sorted order (if
specified). Unlike the [Get Roles
API](https://www.elastic.co/guide/en/elasticsearch/reference/current/security-api-get-role.html),
the role **name** is an attribute of the element in the list of roles
(in the get-roles API case, the role name was the key in the response
map, and the value was the rest of the role descriptor). In addition,
the element in the list of roles also contains the optional `_sort`
field, eg (sample response):

```
{
  "total": 3,
  "count": 3,
  "roles": [
    {
      "name": "LYdz2",
      "cluster": [],
      "indices": [],
      "applications": [
        {
          "application": "ejYWvGQTF",
          "privileges": [
            "pRCfBMgOy",
            "zDhFtMQfc",
            "roudxado"
          ],
          "resources": [
            "nWHEpmgxy",
            "SOML/hMYrqx",
            "YIqP/*",
            "ueEomwsA"
          ]
        },
        {
          "application": "ampUW9",
          "privileges": [
            "jDvRtp"
          ],
          "resources": [
            "99"
          ]
        }
      ],
      "run_as": [],
      "metadata": {
        "nFKc": [
          1,
          0
        ],
        "PExF": [],
        "qlqY": -433239865,
        "IQXm": []
      },
      "transient_metadata": {
        "enabled": true
      },
      "description": "KoLlsEbq",
      "_sort": [
        "LYdz2"
      ]
    },
    {
      "name": "oaxW0",
      "cluster": [],
      "indices": [],
      "applications": [
        {
          "application": "*",
          "privileges": [
            "qZYb"
          ],
          "resources": [
            "tFrSULaKb"
          ]
        },
        {
          "application": "aLaEN9",
          "privileges": [
            "fCOc"
          ],
          "resources": [
            "gozqXtSgE",
            "UX/JgydeIM",
            "sjUp",
            "Ivdz/UAmuNrQAG"
          ]
        },
        {
          "application": "rbxyuKIMPAp",
          "privileges": [
            "lluqieFRu",
            "xKU",
            "gHlb"
          ],
          "resources": [
            "99"
          ]
        }
      ],
      "run_as": [],
      "metadata": {},
      "transient_metadata": {
        "enabled": true
      },
      "_sort": [
        "oaxW0"
      ]
    },
    {
      "name": "vWAV1",
      "cluster": [],
      "indices": [],
      "applications": [
        {
          "application": "*",
          "privileges": [
            "kWBWjCAc"
          ],
          "resources": [
            "hvEtV",
            "gZJ"
          ]
        },
        {
          "application": "avVUV9",
          "privileges": [
            "newZTa",
            "gQpxNm"
          ],
          "resources": [
            "99"
          ]
        }
      ],
      "run_as": [],
      "metadata": {},
      "transient_metadata": {
        "enabled": true
      },
      "_sort": [
        "vWAV1"
      ]
    }
  ]
}
```
2024-07-16 11:28:37 +03:00
Joe Gallo
18ce15b7ef Tidy up some geoip code and fix a mistaken test (#110384) 2024-07-16 11:28:37 +03:00
elasticsearchmachine
08d591f5c6 Mute org.elasticsearch.search.aggregations.bucket.terms.RareTermsIT testSingleValuedString #110388 2024-07-16 11:28:37 +03:00
David Kyle
9e8f7c415c [ML] Sentence Chunker (#110334)
The Sentence chunker splits long text into smaller chunks on sentence boundaries.
2024-07-16 11:28:37 +03:00
Felix Barnsteiner
fc1f8593a2 Update docs now that keyword dimensions support ignore_above (#110385)
This is a follow-up from https://github.com/elastic/elasticsearch/pull/110337
2024-07-16 11:28:37 +03:00
Mark Tozzi
7a438016a1 fix compile error related to new PARTIAL_AGG data type (#110379) 2024-07-16 11:28:37 +03:00
Johannes Fredén
f06fe04b35 Add BulkPutRoles API (#109339)
* Add BulkPutRoles API
2024-07-16 11:28:37 +03:00
Patrick Doyle
943523e0a6 parseHeapRatioOrDeprecatedByteSizeValue for indices.breaker.total.limit (#110236)
* parseHeapRatioOrDeprecatedByteSizeValue for indices.breaker.total.limit

* Fix tests for indices.breaker.total.limit warning

* Spotless

* Warn if below minimum percent

* Update docs/changelog/110236.yaml

* Changelog

* Pick correct area for changelog entry

* Spotless again dammit

* assertCriticalWarnings in circuit breaker test

* Expect another warning
2024-07-16 11:28:37 +03:00
Mark Tozzi
193be9c5a3 [ESQL] Use DataType instead of Strings in ColumnInfo (#110288)
The ColumnInfo class, which is used for request and response serialization, stores a data type. Prior to this PR, it stored that type as a String, and there were several places (seen below) where we needed to switch behavior based on that string. Switching on strings is brittle, as there's no way for the compiler to enforce that all cases are covered, so we have to rely on a default -> throw pattern, and hope that a test catches that path. On the other hand, we can instead switch on the actual DataType enum value, which the compiler can then enforce checking all values.

Eventually, it would make sense for most or all of these switches to become functions on DataType, but the visibility between esql.core and esql right now makes that difficult.
2024-07-16 11:28:37 +03:00
Tim Grein
3b07680426 [Inference API] Use ObjectParser instead of manual parsing in GoogleVertexAiRerankResponseEntity (#110363) 2024-07-16 11:28:36 +03:00
Tim Grein
f54ce46d8a [Inference API] Add Google Vertex AI text embeddings docs (#110317) 2024-07-16 11:28:36 +03:00
Mike Pellegrini
61c5098692 Fix Semantic Query Parameter Formatting (#110355) 2024-07-16 11:28:36 +03:00
Ignacio Vera
6b24278f64 Run terms concurrently when cardinality is only lower than shard size (#110369)
To make sure the results are the same between concurrent and non-concurrent runs, we need to exclude situations 
where shard size == cardinality.
2024-07-16 11:28:36 +03:00
Martijn van Groningen
2e717c0c70 Disallow index.time_series.end_time setting from being set or updated in normal indices (#110268)
The index.mode setting validates other index settings. When updating the index.time_series.end_time setting and the index.mode setting isn't wasn't defined at index creation time (meaning that default is active), then this validation is skipped which results into (worse) errors at a later point in time.

This problem is fixed by enforced by making index.mode setting a dependency of index.time_series.end_time setting.

Note that this problem doesn't exist for the index.time_series.start_time and index.routing_path index settings, because these index settings are final, which mean these can only be defined when an index is being created.

Closes #110265
2024-07-16 11:28:36 +03:00
Pooya Salehi
df5675b70c Remove test logging for closed issue (#110367)
Relates #108237.
2024-07-16 11:28:36 +03:00
Yang Wang
fef48121c6 [Test] Reuse existing TLS setup infrastructure in tests (#110358)
Relates: #109899
Resolves: #110356
2024-07-16 11:28:36 +03:00
Felix Barnsteiner
9a5f5aed07 Support ignore_above on keyword dimensions (#110337)
At the moment, it's not possible to set `ignore_above` on `keyword`
dimension fields. This flag is used a lot in our integrations and in
ECS. It helps to reduce the number of logs/metrics we need to reject.

This is also somewhat inconsistent as it's possible to set
`ignore_malformed` on numeric dimension fields. Both options end up
adding malformed values to `_ignored` and don't add doc_values and
postings.

I'd like to propose adding support for `ignore_above` to be consistent
with allowing `ignore_malformed` on numeric fields. The other option
would be to take away the support for `ignore_malformed` but that seems
to be a breaking change.

I've added a test that verifies that ignoring those dimensions is safe
in the sense that it doesn't lead to document rejections due to
duplicate detection if the only dimensions that differ are ignored.
2024-07-16 11:28:36 +03:00
Tim Grein
ca4783cf9e [Inference API] Use extractOptionalPositiveInteger instead of remove as type in HuggingFaceServiceSettings (#110278) 2024-07-16 11:28:36 +03:00
Tim Grein
6b41cc93af [Inference API] Deduplicate getPersistedConfigMap (#110277) 2024-07-16 11:28:35 +03:00
Tim Grein
d8ae90de43 [Inference API] Use extractOptionalPositiveInteger instead of removeAsType in OpenAiChatCompletionServiceSettings (#110281) 2024-07-16 11:28:35 +03:00
Ievgen Degtiarenko
056a4d8903 Do not trip circuit breaker when getting shutdown status (#110332)
Update TransportGetShutdownStatusAction so that it can not trip circuit breaker.
If circuit breaker is tripped when orchestrator is checking the shutdown status 
then cluster is shutdown prematurely, leading to availability lose.
2024-07-16 11:28:35 +03:00
Simon Cooper
3ccf645037 Move various getter methods to ProjectMetadata (MP-1569) 2024-07-15 16:02:10 +01:00
Simon Cooper
86675a4854 Move index iteration to ProjectMetadata (MP-1568)
ES-8875. ProjectMetadata now implements Iterable
2024-07-15 13:33:47 +01:00
Simon Cooper
bc7d153672 Separate some Metadata fields into ProjectMetadata 2024-07-11 16:05:13 +01:00
Simon Cooper
5b68fdd702 Add to excluded list 2024-07-11 15:01:05 +01:00
Simon Cooper
a3fc850222 Separate some Metadata fields into ProjectMetadata 2024-07-11 14:53:07 +01:00
Brian Seeders
7952f58193 Some prep for elasticsearch-internal CI pipelines 2024-07-05 15:31:24 -04:00
12799 changed files with 413699 additions and 494574 deletions

View file

@ -1,10 +1,10 @@
{
"upstream" : "elastic/elasticsearch",
"targetBranchChoices" : [ "main", "8.x", "8.17", "8.16", "8.15", "8.14", "8.13", "8.12", "8.11", "8.10", "8.9", "8.8", "8.7", "8.6", "8.5", "8.4", "8.3", "8.2", "8.1", "8.0", "7.17", "6.8" ],
"targetBranchChoices" : [ "main", "8.x", "9.0", "8.18", "8.17", "8.16", "8.15", "8.14", "8.13", "8.12", "8.11", "8.10", "8.9", "8.8", "8.7", "8.6", "8.5", "8.4", "8.3", "8.2", "8.1", "8.0", "7.17", "6.8" ],
"targetPRLabels" : [ "backport" ],
"branchLabelMapping" : {
"^v9.0.0$" : "main",
"^v8.18.0$" : "8.x",
"^v9.1.0$" : "main",
"^v8.19.0$" : "8.x",
"^v(\\d+).(\\d+).\\d+(?:-(?:alpha|beta|rc)\\d+)?$" : "$1.$2"
}
}
}

View file

@ -44,6 +44,9 @@ export GRADLE_BUILD_CACHE_USERNAME
GRADLE_BUILD_CACHE_PASSWORD=$(vault read -field=password secret/ci/elastic-elasticsearch/migrated/gradle-build-cache)
export GRADLE_BUILD_CACHE_PASSWORD
DEVELOCITY_ACCESS_KEY="gradle-enterprise.elastic.co=$(vault read -field=accesskey secret/ci/elastic-elasticsearch/migrated/gradle-build-cache)"
export DEVELOCITY_ACCESS_KEY
BUILDKITE_API_TOKEN=$(vault read -field=token secret/ci/elastic-elasticsearch/buildkite-api-token)
export BUILDKITE_API_TOKEN
@ -91,6 +94,14 @@ if [[ "${USE_PROD_DOCKER_CREDENTIALS:-}" == "true" ]]; then
fi
fi
# Authenticate to the Docker Hub public read-only registry
if which docker > /dev/null 2>&1; then
DOCKERHUB_REGISTRY_USERNAME="$(vault read -field=username secret/ci/elastic-elasticsearch/docker_hub_public_ro_credentials)"
DOCKERHUB_REGISTRY_PASSWORD="$(vault read -field=password secret/ci/elastic-elasticsearch/docker_hub_public_ro_credentials)"
echo "$DOCKERHUB_REGISTRY_PASSWORD" | docker login --username "$DOCKERHUB_REGISTRY_USERNAME" --password-stdin docker.io
fi
if [[ "$BUILDKITE_AGENT_META_DATA_PROVIDER" != *"k8s"* ]]; then
# Run in the background, while the job continues
nohup .buildkite/scripts/setup-monitoring.sh </dev/null >/dev/null 2>&1 &

View file

@ -75,7 +75,7 @@ steps:
ES_VERSION:
- "9.0.0"
ES_COMMIT:
- "b2cc9d9b8f00ee621f93ddca07ea9c671aab1578" # update to match last commit before lucene bump
- "10352e57d85505984582616e1e38530d3ec6ca59" # update to match last commit before lucene bump maintained from combat-lucene-10-0-0 branch
agents:
provider: gcp
image: family/elasticsearch-ubuntu-2004
@ -96,7 +96,7 @@ steps:
- trigger: elasticsearch-dra-workflow
label: Trigger DRA snapshot workflow
async: true
branches: "main 8.* 7.17"
branches: "main 9.* 8.* 7.17"
build:
branch: "$BUILDKITE_BRANCH"
commit: "$BUILDKITE_COMMIT"

View file

@ -56,7 +56,7 @@ steps:
timeout_in_minutes: 300
matrix:
setup:
BWC_VERSION: ["8.16.4", "8.17.2", "8.18.0", "9.0.0"]
BWC_VERSION: ["8.17.6", "8.18.1", "8.19.0", "9.0.1", "9.1.0"]
agents:
provider: gcp
image: family/elasticsearch-ubuntu-2004
@ -76,7 +76,7 @@ steps:
ES_VERSION:
- "9.0.0"
ES_COMMIT:
- "b2cc9d9b8f00ee621f93ddca07ea9c671aab1578" # update to match last commit before lucene bump
- "10352e57d85505984582616e1e38530d3ec6ca59" # update to match last commit before lucene bump maintained from combat-lucene-10-0-0 branch
agents:
provider: gcp
image: family/elasticsearch-ubuntu-2004
@ -97,7 +97,7 @@ steps:
- trigger: elasticsearch-dra-workflow
label: Trigger DRA snapshot workflow
async: true
branches: "main 8.* 7.17"
branches: "main 9.* 8.* 7.17"
build:
branch: "$BUILDKITE_BRANCH"
commit: "$BUILDKITE_COMMIT"

View file

@ -0,0 +1,14 @@
steps:
- label: $FWC_VERSION / fwc
command: .ci/scripts/run-gradle.sh -Dbwc.checkout.align=true v$FWC_VERSION#fwcTest -Dtests.bwc.snapshot=false
timeout_in_minutes: 300
agents:
provider: gcp
image: family/elasticsearch-ubuntu-2004
machineType: n1-standard-32
buildDirectory: /dev/shm/bk
matrix:
setup:
FWC_VERSION: $FWC_LIST
env:
FWC_VERSION: $FWC_VERSION

View file

@ -0,0 +1,15 @@
# This file is auto-generated. See .buildkite/pipelines/periodic-fwc.template.yml
steps:
- label: $FWC_VERSION / fwc
command: .ci/scripts/run-gradle.sh -Dbwc.checkout.align=true v$FWC_VERSION#fwcTest -Dtests.bwc.snapshot=false
timeout_in_minutes: 300
agents:
provider: gcp
image: family/elasticsearch-ubuntu-2004
machineType: n1-standard-32
buildDirectory: /dev/shm/bk
matrix:
setup:
FWC_VERSION: []
env:
FWC_VERSION: $FWC_VERSION

View file

@ -287,8 +287,8 @@ steps:
env:
BWC_VERSION: 8.15.5
- label: "{{matrix.image}} / 8.16.4 / packaging-tests-upgrade"
command: ./.ci/scripts/packaging-test.sh -Dbwc.checkout.align=true destructiveDistroUpgradeTest.v8.16.4
- label: "{{matrix.image}} / 8.16.6 / packaging-tests-upgrade"
command: ./.ci/scripts/packaging-test.sh -Dbwc.checkout.align=true destructiveDistroUpgradeTest.v8.16.6
timeout_in_minutes: 300
matrix:
setup:
@ -301,10 +301,10 @@ steps:
machineType: custom-16-32768
buildDirectory: /dev/shm/bk
env:
BWC_VERSION: 8.16.4
BWC_VERSION: 8.16.6
- label: "{{matrix.image}} / 8.17.2 / packaging-tests-upgrade"
command: ./.ci/scripts/packaging-test.sh -Dbwc.checkout.align=true destructiveDistroUpgradeTest.v8.17.2
- label: "{{matrix.image}} / 8.17.6 / packaging-tests-upgrade"
command: ./.ci/scripts/packaging-test.sh -Dbwc.checkout.align=true destructiveDistroUpgradeTest.v8.17.6
timeout_in_minutes: 300
matrix:
setup:
@ -317,10 +317,10 @@ steps:
machineType: custom-16-32768
buildDirectory: /dev/shm/bk
env:
BWC_VERSION: 8.17.2
BWC_VERSION: 8.17.6
- label: "{{matrix.image}} / 8.18.0 / packaging-tests-upgrade"
command: ./.ci/scripts/packaging-test.sh -Dbwc.checkout.align=true destructiveDistroUpgradeTest.v8.18.0
- label: "{{matrix.image}} / 8.18.1 / packaging-tests-upgrade"
command: ./.ci/scripts/packaging-test.sh -Dbwc.checkout.align=true destructiveDistroUpgradeTest.v8.18.1
timeout_in_minutes: 300
matrix:
setup:
@ -333,10 +333,10 @@ steps:
machineType: custom-16-32768
buildDirectory: /dev/shm/bk
env:
BWC_VERSION: 8.18.0
BWC_VERSION: 8.18.1
- label: "{{matrix.image}} / 9.0.0 / packaging-tests-upgrade"
command: ./.ci/scripts/packaging-test.sh -Dbwc.checkout.align=true destructiveDistroUpgradeTest.v9.0.0
- label: "{{matrix.image}} / 8.19.0 / packaging-tests-upgrade"
command: ./.ci/scripts/packaging-test.sh -Dbwc.checkout.align=true destructiveDistroUpgradeTest.v8.19.0
timeout_in_minutes: 300
matrix:
setup:
@ -349,7 +349,39 @@ steps:
machineType: custom-16-32768
buildDirectory: /dev/shm/bk
env:
BWC_VERSION: 9.0.0
BWC_VERSION: 8.19.0
- label: "{{matrix.image}} / 9.0.1 / packaging-tests-upgrade"
command: ./.ci/scripts/packaging-test.sh -Dbwc.checkout.align=true destructiveDistroUpgradeTest.v9.0.1
timeout_in_minutes: 300
matrix:
setup:
image:
- rocky-8
- ubuntu-2004
agents:
provider: gcp
image: family/elasticsearch-{{matrix.image}}
machineType: custom-16-32768
buildDirectory: /dev/shm/bk
env:
BWC_VERSION: 9.0.1
- label: "{{matrix.image}} / 9.1.0 / packaging-tests-upgrade"
command: ./.ci/scripts/packaging-test.sh -Dbwc.checkout.align=true destructiveDistroUpgradeTest.v9.1.0
timeout_in_minutes: 300
matrix:
setup:
image:
- rocky-8
- ubuntu-2004
agents:
provider: gcp
image: family/elasticsearch-{{matrix.image}}
machineType: custom-16-32768
buildDirectory: /dev/shm/bk
env:
BWC_VERSION: 9.1.0
- group: packaging-tests-windows
steps:

View file

@ -78,14 +78,15 @@ steps:
BWC_VERSION: "{{matrix.BWC_VERSION}}"
- group: java-matrix
steps:
- label: "{{matrix.ES_RUNTIME_JAVA}} / {{matrix.GRADLE_TASK}} / java-matrix"
command: .ci/scripts/run-gradle.sh -Dbwc.checkout.align=true $$GRADLE_TASK
- label: "{{matrix.ES_RUNTIME_JAVA}} / entitlements={{matrix.ENTITLEMENTS_ENABLED}} / {{matrix.GRADLE_TASK}} / java-matrix"
command: .ci/scripts/run-gradle.sh -Dbwc.checkout.align=true -Dtests.jvm.argline="-Des.entitlements.enabled=$$ENTITLEMENTS_ENABLED" $$GRADLE_TASK
timeout_in_minutes: 300
matrix:
setup:
ES_RUNTIME_JAVA:
- openjdk21
- openjdk23
- openjdk24
GRADLE_TASK:
- checkPart1
- checkPart2
@ -93,6 +94,9 @@ steps:
- checkPart4
- checkPart5
- checkRestCompat
ENTITLEMENTS_ENABLED:
- "true"
- "false"
agents:
provider: gcp
image: family/elasticsearch-ubuntu-2004
@ -101,6 +105,7 @@ steps:
env:
ES_RUNTIME_JAVA: "{{matrix.ES_RUNTIME_JAVA}}"
GRADLE_TASK: "{{matrix.GRADLE_TASK}}"
ENTITLEMENTS_ENABLED: "{{matrix.ENTITLEMENTS_ENABLED}}"
- label: "{{matrix.ES_RUNTIME_JAVA}} / {{matrix.BWC_VERSION}} / java-matrix-bwc"
command: .ci/scripts/run-gradle.sh -Dbwc.checkout.align=true v$$BWC_VERSION#bwcTest
timeout_in_minutes: 300
@ -213,7 +218,7 @@ steps:
ES_VERSION:
- "9.0.0"
ES_COMMIT:
- "b2cc9d9b8f00ee621f93ddca07ea9c671aab1578" # update to match last commit before lucene bump
- "10352e57d85505984582616e1e38530d3ec6ca59" # update to match last commit before lucene bump maintained from combat-lucene-10-0-0 branch
agents:
provider: gcp
image: family/elasticsearch-ubuntu-2004

View file

@ -306,8 +306,8 @@ steps:
- signal_reason: agent_stop
limit: 3
- label: 8.16.4 / bwc
command: .ci/scripts/run-gradle.sh -Dbwc.checkout.align=true v8.16.4#bwcTest
- label: 8.16.6 / bwc
command: .ci/scripts/run-gradle.sh -Dbwc.checkout.align=true v8.16.6#bwcTest
timeout_in_minutes: 300
agents:
provider: gcp
@ -316,7 +316,7 @@ steps:
buildDirectory: /dev/shm/bk
preemptible: true
env:
BWC_VERSION: 8.16.4
BWC_VERSION: 8.16.6
retry:
automatic:
- exit_status: "-1"
@ -325,8 +325,8 @@ steps:
- signal_reason: agent_stop
limit: 3
- label: 8.17.2 / bwc
command: .ci/scripts/run-gradle.sh -Dbwc.checkout.align=true v8.17.2#bwcTest
- label: 8.17.6 / bwc
command: .ci/scripts/run-gradle.sh -Dbwc.checkout.align=true v8.17.6#bwcTest
timeout_in_minutes: 300
agents:
provider: gcp
@ -335,7 +335,7 @@ steps:
buildDirectory: /dev/shm/bk
preemptible: true
env:
BWC_VERSION: 8.17.2
BWC_VERSION: 8.17.6
retry:
automatic:
- exit_status: "-1"
@ -344,8 +344,8 @@ steps:
- signal_reason: agent_stop
limit: 3
- label: 8.18.0 / bwc
command: .ci/scripts/run-gradle.sh -Dbwc.checkout.align=true v8.18.0#bwcTest
- label: 8.18.1 / bwc
command: .ci/scripts/run-gradle.sh -Dbwc.checkout.align=true v8.18.1#bwcTest
timeout_in_minutes: 300
agents:
provider: gcp
@ -354,7 +354,7 @@ steps:
buildDirectory: /dev/shm/bk
preemptible: true
env:
BWC_VERSION: 8.18.0
BWC_VERSION: 8.18.1
retry:
automatic:
- exit_status: "-1"
@ -363,8 +363,8 @@ steps:
- signal_reason: agent_stop
limit: 3
- label: 9.0.0 / bwc
command: .ci/scripts/run-gradle.sh -Dbwc.checkout.align=true v9.0.0#bwcTest
- label: 8.19.0 / bwc
command: .ci/scripts/run-gradle.sh -Dbwc.checkout.align=true v8.19.0#bwcTest
timeout_in_minutes: 300
agents:
provider: gcp
@ -373,7 +373,45 @@ steps:
buildDirectory: /dev/shm/bk
preemptible: true
env:
BWC_VERSION: 9.0.0
BWC_VERSION: 8.19.0
retry:
automatic:
- exit_status: "-1"
limit: 3
signal_reason: none
- signal_reason: agent_stop
limit: 3
- label: 9.0.1 / bwc
command: .ci/scripts/run-gradle.sh -Dbwc.checkout.align=true v9.0.1#bwcTest
timeout_in_minutes: 300
agents:
provider: gcp
image: family/elasticsearch-ubuntu-2004
machineType: n1-standard-32
buildDirectory: /dev/shm/bk
preemptible: true
env:
BWC_VERSION: 9.0.1
retry:
automatic:
- exit_status: "-1"
limit: 3
signal_reason: none
- signal_reason: agent_stop
limit: 3
- label: 9.1.0 / bwc
command: .ci/scripts/run-gradle.sh -Dbwc.checkout.align=true v9.1.0#bwcTest
timeout_in_minutes: 300
agents:
provider: gcp
image: family/elasticsearch-ubuntu-2004
machineType: n1-standard-32
buildDirectory: /dev/shm/bk
preemptible: true
env:
BWC_VERSION: 9.1.0
retry:
automatic:
- exit_status: "-1"
@ -448,7 +486,7 @@ steps:
setup:
ES_RUNTIME_JAVA:
- openjdk21
BWC_VERSION: ["8.16.4", "8.17.2", "8.18.0", "9.0.0"]
BWC_VERSION: ["8.17.6", "8.18.1", "8.19.0", "9.0.1", "9.1.0"]
agents:
provider: gcp
image: family/elasticsearch-ubuntu-2004
@ -459,14 +497,15 @@ steps:
BWC_VERSION: "{{matrix.BWC_VERSION}}"
- group: java-matrix
steps:
- label: "{{matrix.ES_RUNTIME_JAVA}} / {{matrix.GRADLE_TASK}} / java-matrix"
command: .ci/scripts/run-gradle.sh -Dbwc.checkout.align=true $$GRADLE_TASK
- label: "{{matrix.ES_RUNTIME_JAVA}} / entitlements={{matrix.ENTITLEMENTS_ENABLED}} / {{matrix.GRADLE_TASK}} / java-matrix"
command: .ci/scripts/run-gradle.sh -Dbwc.checkout.align=true -Dtests.jvm.argline="-Des.entitlements.enabled=$$ENTITLEMENTS_ENABLED" $$GRADLE_TASK
timeout_in_minutes: 300
matrix:
setup:
ES_RUNTIME_JAVA:
- openjdk21
- openjdk23
- openjdk24
GRADLE_TASK:
- checkPart1
- checkPart2
@ -474,6 +513,9 @@ steps:
- checkPart4
- checkPart5
- checkRestCompat
ENTITLEMENTS_ENABLED:
- "true"
- "false"
agents:
provider: gcp
image: family/elasticsearch-ubuntu-2004
@ -482,6 +524,7 @@ steps:
env:
ES_RUNTIME_JAVA: "{{matrix.ES_RUNTIME_JAVA}}"
GRADLE_TASK: "{{matrix.GRADLE_TASK}}"
ENTITLEMENTS_ENABLED: "{{matrix.ENTITLEMENTS_ENABLED}}"
- label: "{{matrix.ES_RUNTIME_JAVA}} / {{matrix.BWC_VERSION}} / java-matrix-bwc"
command: .ci/scripts/run-gradle.sh -Dbwc.checkout.align=true v$$BWC_VERSION#bwcTest
timeout_in_minutes: 300
@ -490,7 +533,7 @@ steps:
ES_RUNTIME_JAVA:
- openjdk21
- openjdk23
BWC_VERSION: ["8.16.4", "8.17.2", "8.18.0", "9.0.0"]
BWC_VERSION: ["8.17.6", "8.18.1", "8.19.0", "9.0.1", "9.1.0"]
agents:
provider: gcp
image: family/elasticsearch-ubuntu-2004
@ -594,7 +637,7 @@ steps:
ES_VERSION:
- "9.0.0"
ES_COMMIT:
- "b2cc9d9b8f00ee621f93ddca07ea9c671aab1578" # update to match last commit before lucene bump
- "10352e57d85505984582616e1e38530d3ec6ca59" # update to match last commit before lucene bump maintained from combat-lucene-10-0-0 branch
agents:
provider: gcp
image: family/elasticsearch-ubuntu-2004

View file

@ -7,16 +7,19 @@ steps:
command: |
.ci/scripts/run-gradle.sh :build-tools-internal:bootstrapPerformanceTests
.ci/scripts/install-gradle-profiler.sh
.ci/scripts/run-gradle-profiler.sh --benchmark --scenario-file build-tools-internal/build/performanceTests/elasticsearch-build-benchmark-{{matrix.part}}.scenarios --project-dir . --output-dir profile-out
mkdir build
tar -czf build/$BUILDKITE_BUILD_NUMBER.tar.bz2 profile-out
.ci/scripts/run-gradle-profiler.sh --benchmark --scenario-file build-tools-internal/build/performanceTests/elasticsearch-{{matrix.part}}.scenarios --measure-config-time --project-dir . --output-dir profile-out
mkdir -p build
buildkite-agent artifact upload "profile-out/*"
cat << EOF | buildkite-agent annotate --style "info"
Benchmark Html Report <a href="artifact://profile-out/benchmark.html">Benchmark Html Report</a>
EOF
matrix:
setup:
part:
- part1
- part2
- esql-tests
env:
BUILD_PERFORMANCE_TEST: "true"
agents:
provider: gcp
image: family/elasticsearch-ubuntu-2004

View file

@ -1,5 +1,7 @@
config:
allow-labels: "Team:Security"
allow-labels:
- Team:Security
- test-fips
steps:
- label: part-1-fips
command: .ci/scripts/run-gradle.sh -Dignore.tests.seed -Dtests.fips.enabled=true checkPart1

View file

@ -1,5 +1,7 @@
config:
allow-labels: "Team:Security"
allow-labels:
- Team:Security
- test-fips
steps:
- label: part-2-fips
command: .ci/scripts/run-gradle.sh -Dignore.tests.seed -Dtests.fips.enabled=true checkPart2

View file

@ -1,5 +1,7 @@
config:
allow-labels: "Team:Security"
allow-labels:
- Team:Security
- test-fips
steps:
- label: part-3-fips
command: .ci/scripts/run-gradle.sh -Dignore.tests.seed -Dtests.fips.enabled=true checkPart3

View file

@ -1,5 +1,7 @@
config:
allow-labels: "Team:Security"
allow-labels:
- Team:Security
- test-fips
steps:
- label: part-4-fips
command: .ci/scripts/run-gradle.sh -Dignore.tests.seed -Dtests.fips.enabled=true checkPart4

View file

@ -1,5 +1,7 @@
config:
allow-labels: "Team:Security"
allow-labels:
- Team:Security
- test-fips
steps:
- label: part-5-fips
command: .ci/scripts/run-gradle.sh -Dignore.tests.seed -Dtests.fips.enabled=true checkPart5

View file

@ -2,3 +2,7 @@
# This determines which branches will have pipelines triggered periodically, for dra workflows.
BRANCHES=( $(cat branches.json | jq -r '.branches[].branch') )
# Sort them to make ordering predictable
IFS=$'\n' BRANCHES=($(sort <<<"${BRANCHES[*]}"))
unset IFS

View file

@ -6,7 +6,7 @@ WORKFLOW="${DRA_WORKFLOW:-snapshot}"
BRANCH="${BUILDKITE_BRANCH:-}"
# Don't publish main branch to staging
if [[ "$BRANCH" == *.x && "$WORKFLOW" == "staging" ]]; then
if [[ ("$BRANCH" == "main" || "$BRANCH" == *.x) && "$WORKFLOW" == "staging" ]]; then
exit 0
fi
@ -70,6 +70,7 @@ echo --- Building release artifacts
$VERSION_QUALIFIER_ARG \
buildReleaseArtifacts \
exportCompressedDockerImages \
exportDockerContexts \
:distribution:generateDependenciesReport
PATH="$PATH:${JAVA_HOME}/bin" # Required by the following script

View file

@ -7,10 +7,6 @@ echo "steps:"
source .buildkite/scripts/branches.sh
for BRANCH in "${BRANCHES[@]}"; do
if [[ "$BRANCH" == "main" ]]; then
export VERSION_QUALIFIER="alpha1"
fi
INTAKE_PIPELINE_SLUG="elasticsearch-intake"
BUILD_JSON=$(curl -sH "Authorization: Bearer ${BUILDKITE_API_TOKEN}" "https://api.buildkite.com/v2/organizations/elastic/pipelines/${INTAKE_PIPELINE_SLUG}/builds?branch=${BRANCH}&state=passed&per_page=1" | jq '.[0] | {commit: .commit, url: .web_url}')
LAST_GOOD_COMMIT=$(echo "${BUILD_JSON}" | jq -r '.commit')

View file

@ -46,4 +46,15 @@ EOF
branch: "$BRANCH"
commit: "$LAST_GOOD_COMMIT"
EOF
# Include forward compatibility tests only for the bugfix branch
if [[ "${BRANCH}" == "${BRANCHES[2]}" ]]; then
cat <<EOF
- trigger: elasticsearch-periodic-fwc
label: Trigger periodic-fwc pipeline for $BRANCH
async: true
build:
branch: "$BRANCH"
commit: "$LAST_GOOD_COMMIT"
EOF
fi
done

View file

@ -15,7 +15,9 @@ BWC_VERSION:
- "8.13.4"
- "8.14.3"
- "8.15.5"
- "8.16.4"
- "8.17.2"
- "8.18.0"
- "9.0.0"
- "8.16.6"
- "8.17.6"
- "8.18.1"
- "8.19.0"
- "9.0.1"
- "9.1.0"

View file

@ -1,29 +1,24 @@
gradle.settingsEvaluated { settings ->
settings.pluginManager.withPlugin("com.gradle.develocity") {
settings.develocity {
server = 'https://gradle-enterprise.elastic.co'
}
}
}
final String buildCacheUrl = System.getProperty('org.elasticsearch.build.cache.url')
final boolean buildCachePush = Boolean.valueOf(System.getProperty('org.elasticsearch.build.cache.push', 'false'))
if (buildCacheUrl) {
gradle.settingsEvaluated { settings ->
settings.buildCache {
local {
// Disable the local build cache in CI since we use ephemeral workers and it incurs an IO penalty
enabled = false
}
remote(HttpBuildCache) {
url = buildCacheUrl
push = buildCachePush
credentials {
username = System.getenv("GRADLE_BUILD_CACHE_USERNAME")
password = System.getenv("GRADLE_BUILD_CACHE_PASSWORD")
gradle.settingsEvaluated { settings ->
settings.pluginManager.withPlugin("com.gradle.develocity") {
settings.develocity {
server = "https://gradle-enterprise.elastic.co"
}
if (buildCacheUrl) {
settings.buildCache {
local {
// Disable the local build cache in CI since we use ephemeral workers and it incurs an IO penalty
enabled = false
}
remote(settings.develocity.buildCache) {
enabled = true
push = buildCachePush
}
}
}
}
}

View file

@ -2,7 +2,7 @@
set -e
# profiler version we wanna install
PROFILER_VERSION="0.16.0"
wget https://repo.gradle.org/gradle/ext-releases-local/org/gradle/profiler/gradle-profiler/$PROFILER_VERSION/gradle-profiler-$PROFILER_VERSION.zip -O $WORKSPACE/gradle-profiler-$PROFILER_VERSION.zip
PROFILER_VERSION="0.22.0"
wget https://repo1.maven.org/maven2/org/gradle/profiler/gradle-profiler/$PROFILER_VERSION/gradle-profiler-$PROFILER_VERSION.zip -O $WORKSPACE/gradle-profiler-$PROFILER_VERSION.zip
unzip $WORKSPACE/gradle-profiler-$PROFILER_VERSION.zip
mv $WORKSPACE/gradle-profiler-$PROFILER_VERSION $WORKSPACE/gradle-profiler

View file

@ -3,7 +3,7 @@
# opensuse 15 has a missing dep for systemd
if which zypper > /dev/null ; then
sudo zypper install -y insserv-compat
sudo zypper install -y insserv-compat docker-buildx
fi
if [ -e /etc/sysctl.d/99-gce.conf ]; then

View file

@ -1,5 +1,6 @@
BWC_VERSION:
- "8.16.4"
- "8.17.2"
- "8.18.0"
- "9.0.0"
- "8.17.6"
- "8.18.1"
- "8.19.0"
- "9.0.1"
- "9.1.0"

View file

@ -226,5 +226,8 @@ indent_size = 2
[*.{xsd,xml}]
indent_size = 4
[verification-metadata.xml]
indent_size = 3
[*.{csv,sql}-spec]
trim_trailing_whitespace = false

7
.gitattributes vendored
View file

@ -13,6 +13,9 @@ x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/parser/EsqlBasePar
x-pack/plugin/esql/src/main/generated/** linguist-generated=true
x-pack/plugin/esql/src/main/generated-src/** linguist-generated=true
# ESQL functions docs are autogenerated. More information at `docs/reference/esql/functions/README.md`
docs/reference/esql/functions/*/** linguist-generated=true
# ESQL functions docs are autogenerated. More information at `docs/reference/query-languages/esql/README.md`
docs/reference/query-languages/esql/_snippets/functions/*/** linguist-generated=true
#docs/reference/query-languages/esql/_snippets/operators/*/** linguist-generated=true
docs/reference/query-languages/esql/images/** linguist-generated=true
docs/reference/query-languages/esql/kibana/** linguist-generated=true

1
.github/CODEOWNERS vendored
View file

@ -49,6 +49,7 @@ distribution/docker/src @elastic/es-delivery
# Core/Infra
distribution/tools @elastic/es-core-infra
libs/core @elastic/es-core-infra
libs/entitlement @elastic/es-core-infra
libs/logging @elastic/es-core-infra
libs/native @elastic/es-core-infra
libs/plugin-analysis-api @elastic/es-core-infra

View file

@ -1,21 +0,0 @@
---
name: Comment on PR for .asciidoc changes
on:
# We need to use pull_request_target to be able to comment on PRs from forks
pull_request_target:
types:
- synchronize
- opened
- reopened
branches:
- main
- master
- "9.0"
jobs:
comment-on-asciidoc-change:
permissions:
contents: read
pull-requests: write
uses: elastic/docs-builder/.github/workflows/comment-on-asciidoc-changes.yml@main

19
.github/workflows/docs-build.yml vendored Normal file
View file

@ -0,0 +1,19 @@
name: docs-build
on:
push:
branches:
- main
pull_request_target: ~
merge_group: ~
jobs:
docs-preview:
uses: elastic/docs-builder/.github/workflows/preview-build.yml@main
with:
path-pattern: docs/**
permissions:
deployments: write
id-token: write
contents: read
pull-requests: read

14
.github/workflows/docs-cleanup.yml vendored Normal file
View file

@ -0,0 +1,14 @@
name: docs-cleanup
on:
pull_request_target:
types:
- closed
jobs:
docs-preview:
uses: elastic/docs-builder/.github/workflows/preview-cleanup.yml@main
permissions:
contents: none
id-token: write
deployments: write

View file

@ -1,29 +0,0 @@
name: Docs Preview Links
on:
pull_request_target:
types: [opened]
paths:
- "**.asciidoc"
jobs:
doc-preview:
if: github.repository == 'elastic/elasticsearch'
permissions:
pull-requests: write
runs-on: ubuntu-latest
steps:
- uses: actions/github-script@v6
name: Add doc preview links
with:
script: |
const pr = context.payload.pull_request;
const comment = `Documentation preview:
- ✨ [Changed pages](https://${context.repo.repo}_bk_${pr.number}.docs-preview.app.elstc.co/diff)`;
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: comment,
});

View file

@ -9,6 +9,7 @@
<inspection_tool class="PointlessBooleanExpression" enabled="false" level="WARNING" enabled_by_default="false">
<option name="m_ignoreExpressionsContainingConstants" value="true" />
</inspection_tool>
<inspection_tool class="StringTemplateMigration" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="jol" enabled="false" level="WARNING" enabled_by_default="false" />
</profile>
</component>

View file

@ -467,7 +467,7 @@ expensive messages that will usually be discarded:
Logging is an important behaviour of the system and sometimes deserves its own
unit tests, especially if there is complex logic for computing what is logged
and when to log it. You can use a `org.elasticsearch.test.MockLogAppender` to
and when to log it. You can use a `org.elasticsearch.test.MockLog` to
make assertions about the logs that are being emitted.
Logging is a powerful diagnostic technique, but it is not the only possibility.

View file

@ -154,9 +154,11 @@ if (request.getRestApiVersion() == RestApiVersion.V_7 && request.hasParam("limit
The above code checks the request's compatible version and if the request has the parameter in question. In this case the deprecation warning is not automatic and requires the developer to manually log the warning. `request.param` is also required since it consumes the value as to avoid the error of unconsumed parameters.
### Testing
### Testing Backwards Compatibility
The primary means of testing compatibility is via the prior major version's YAML REST tests. The build system will download the latest prior version of the YAML rest tests and execute them against the current cluster version. Prior to execution the tests will be transformed by injecting the correct headers to enable compatibility as well as other custom changes to the tests to allow the tests to pass. These customizations are configured via the build.gradle and happen just prior to test execution. Since the compatibility tests are manipulated version of the tests stored in Github (via the past major version), it is important to find the local (on disk) version for troubleshooting compatibility tests.
The primary means of testing compatibility is via the prior major version's YAML REST tests. The build system will download the latest prior version of the YAML rest tests and execute them against the current cluster version. For example if you are testing main versioned as 9.0.0 the build system will download the yaml tests in the 8.x branch and execute those against the current cluster version for 9.0.0.
Prior to execution the tests will be transformed by injecting the correct headers to enable compatibility as well as other custom changes to the tests to allow the tests to pass. These customizations are configured via the build.gradle and happen just prior to test execution. Since the compatibility tests are manipulated version of the tests stored in Github (via the past major version), it is important to find the local (on disk) version for troubleshooting compatibility tests.
The tests are wired into the `check` task, so that is the easiest way to test locally prior to committing. More specifically the task is called `yamlRestCompatTest`. These behave nearly identical to it's non-compat `yamlRestTest` task. The only variance is that the tests are sourced from the prior version branch and the tests go through a transformation phase before execution. The transformation task is `yamlRestCompatTestTransform`.
@ -170,6 +172,36 @@ Since these are a variation of backward compatibility testing, the entire suite
In some cases the prior version of the YAML REST tests are not sufficient to fully test changes. This can happen when the prior version has insufficient test coverage. In those cases, you can simply add more testing to the prior version or you can add custom REST tests that will run along side of the other compatibility tests. These custom tests can be found in the `yamlRestCompatTest` sourceset. Custom REST tests for compatibility will not be modified prior to execution, so the correct headers need to be manually added.
#### Breaking Changes
It is possible to be in a state where you have intentionally made a breaking change and the compatibility tests will fail irrespective of checks for `skip` or `requires` cluster or test features in the current version such as 9.0.0. In this state, assuming the breaking changes are reasonable and agreed upon by the breaking change committee, the correct behavior is to skip the test in the `build.gradle` in 9.0.0. For example, if you make a breaking change that causes the `range/20_synthetic_source/Date range` to break then this test can be disabled temporarily in this file `rest-api-spec/build.gradle` like within this snippet:
```groovy
tasks.named("yamlRestCompatTestTransform").configure({task ->
task.skipTest("range/20_synthetic_source/Date range", "date range breaking change causes tests to produce incorrect values for compatibility")
task.skipTest("indices.sort/10_basic/Index Sort", "warning does not exist for compatibility")
task.skipTest("search/330_fetch_fields/Test search rewrite", "warning does not exist for compatibility")
task.skipTestsByFilePattern("indices.create/synthetic_source*.yml", "@UpdateForV9 -> tests do not pass after bumping API version to 9 [ES-9597]")
})
```
When skipping a test temporarily in 9.0.0, we have to implement the proper `skip` and `requires` conditions to previous branches, such as 8.latest. After these conditions are implemented in 8.latest, you can re-enable the test in 9.0.0 by removing the `skipTest` condition.
The team implementing the changes can decide how to clean up or modify tests based on how breaking changes were backported. e.g.:
In 8.latest:
* Add `skip` / `requires` conditions to existing tests that check the old behavior. This prevents those tests from failing during backward compatibility or upgrade testing from 8.latest to 9.0.0
In 9.0.0:
* Add `requires` conditions for new tests that validate the updated API or output format
* Add `skip` conditions for older tests that would break in 9.0.0
#### Test Features
Both cluster and test features exist. Cluster features are meant for new capability and test features can specifically be used to gate and manage `skip` and `requires` yaml test operations. For more information, see [Versioning.md](docs/internal/Versioning.md#cluster-features). When backporting and using these features they can not overlap in name and must be consistent when backported so that clusters built with these features are compatible.
### Developer's workflow
There should not be much, if any, deviation in a developers normal workflow to introduce and back-port changes. Changes should be applied in main, then back ported as needed.

View file

@ -82,19 +82,21 @@ To get realistic results, you should exercise care when running benchmarks. Here
NOTE: Linux only. Sorry Mac and Windows.
Disassembling is fun! Maybe not always useful, but always fun! Generally, you'll want to install `perf` and the JDK's `hsdis`.
`perf` is generally available via `apg-get install perf` or `pacman -S perf`. `hsdis` you'll want to compile from source. is a little more involved. This worked
`perf` is generally available via `apg-get install perf` or `pacman -S perf linux-tools`. `hsdis` you'll want to compile from source. is a little more involved. This worked
on 2020-08-01:
```
git clone git@github.com:openjdk/jdk.git
cd jdk
git checkout jdk-17-ga
cd src/utils/hsdis
git checkout jdk-24-ga
# Get a known good binutils
wget https://ftp.gnu.org/gnu/binutils/binutils-2.35.tar.gz
tar xf binutils-2.35.tar.gz
make BINUTILS=binutils-2.35 ARCH=amd64
sudo cp build/linux-amd64/hsdis-amd64.so /usr/lib/jvm/java-17-openjdk/lib/server/
bash configure --with-hsdis=binutils --with-binutils-src=binutils-2.35 \
--with-boot-jdk=~/.gradle/jdks/oracle_corporation-24-amd64-linux.2
make build-hsdis
cp ./build/linux-x86_64-server-release/jdk/lib/hsdis-amd64.so \
~/.gradle/jdks/oracle_corporation-24-amd64-linux.2/lib/hsdis.so
```
If you want to disassemble a single method do something like this:
@ -105,6 +107,30 @@ gradlew -p benchmarks run --args ' MemoryStatsBenchmark -jvmArgs "-XX:+UnlockDia
If you want `perf` to find the hot methods for you, then do add `-prof perfasm`.
NOTE: `perfasm` will need more access:
```
sudo bash
echo -1 > /proc/sys/kernel/perf_event_paranoid
exit
```
If you get warnings like:
```
The perf event count is suspiciously low (0).
```
then check if you are bumping into [this](https://man.archlinux.org/man/perf-stat.1.en#INTEL_HYBRID_SUPPORT)
by running:
```
perf stat -B dd if=/dev/zero of=/dev/null count=1000000
```
If you see lines like:
```
765019980 cpu_atom/cycles/ # 1.728 GHz (0.60%)
2258845959 cpu_core/cycles/ # 5.103 GHz (99.18%)
```
then `perf` is just not going to work for you.
## Async Profiler
Note: Linux and Mac only. Sorry Windows.

View file

@ -25,7 +25,6 @@ base {
archivesName = 'elasticsearch-benchmarks'
}
tasks.named("test").configure { enabled = false }
tasks.named("javadoc").configure { enabled = false }
configurations {
@ -52,8 +51,10 @@ dependencies {
api "org.openjdk.jmh:jmh-core:$versions.jmh"
annotationProcessor "org.openjdk.jmh:jmh-generator-annprocess:$versions.jmh"
// Dependencies of JMH
runtimeOnly 'net.sf.jopt-simple:jopt-simple:5.0.4'
runtimeOnly 'net.sf.jopt-simple:jopt-simple:5.0.2'
runtimeOnly 'org.apache.commons:commons-math3:3.6.1'
testImplementation(project(':test:framework'))
}
// enable the JMH's BenchmarkProcessor to generate the final benchmark classes

44
benchmarks/run.sh Executable file
View file

@ -0,0 +1,44 @@
#!/bin/bash
#
# Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
# or more contributor license agreements. Licensed under the "Elastic License
# 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side
# Public License v 1"; you may not use this file except in compliance with, at
# your election, the "Elastic License 2.0", the "GNU Affero General Public
# License v3.0 only", or the "Server Side Public License, v 1".
#
EXTRA=""
POSITIONAL_ARGS=()
while [[ $# -gt 0 ]]; do
case $1 in
--test)
# Get inaccurate results quickly by shortening all measurements
# to 50ms each and skip self tests.
EXTRA="-r 50ms -w 50ms -jvmArgsAppend -DskipSelfTest=true"
shift
;;
*)
POSITIONAL_ARGS+=("$1")
shift
;;
esac
done
set -- "${POSITIONAL_ARGS[@]}"
run() {
../gradlew run --args "$2 -rf json $EXTRA"
mv jmh-result.json build/benchmarks/$1.json
}
cd "$(dirname "$0")"
mkdir -p build/benchmarks
run 'esql_agg' 'AggregatorBenchmark -pgrouping=none,longs -pfilter=none -pblockType=vector_longs,half_null_longs'
run 'esql_block_keep_mask' 'BlockKeepMaskBenchmark -pdataTypeAndBlockKind=BytesRef/array,BytesRef/vector,long/array,long/vector'
run 'esql_block_read' 'BlockReadBenchmark -paccessType=sequential'
run 'esql_eval' 'EvalBenchmark'
run 'esql_parse_ip' 'ParseIpBenchmark'
run 'esql_topn' 'TopNBenchmark'
run 'esql_values_agg' 'ValuesAggregatorBenchmark'
run 'esql_values_source_reader' 'ValuesSourceReaderBenchmark'

View file

@ -60,6 +60,9 @@ import java.util.concurrent.TimeUnit;
import java.util.stream.LongStream;
import java.util.stream.Stream;
/**
* Benchmark for many different kinds of aggregator and groupings.
*/
@Warmup(iterations = 5)
@Measurement(iterations = 7)
@BenchmarkMode(Mode.AverageTime)
@ -110,6 +113,12 @@ public class AggregatorBenchmark {
static {
// Smoke test all the expected values and force loading subclasses more like prod
if (false == "true".equals(System.getProperty("skipSelfTest"))) {
selfTest();
}
}
static void selfTest() {
try {
for (String grouping : AggregatorBenchmark.class.getField("grouping").getAnnotationsByType(Param.class)[0].value()) {
for (String op : AggregatorBenchmark.class.getField("op").getAnnotationsByType(Param.class)[0].value()) {
@ -155,7 +164,7 @@ public class AggregatorBenchmark {
if (grouping.equals("none")) {
return new AggregationOperator(
List.of(supplier(op, dataType, filter, 0).aggregatorFactory(AggregatorMode.SINGLE).apply(driverContext)),
List.of(supplier(op, dataType, filter).aggregatorFactory(AggregatorMode.SINGLE, List.of(0)).apply(driverContext)),
driverContext
);
}
@ -182,33 +191,33 @@ public class AggregatorBenchmark {
default -> throw new IllegalArgumentException("unsupported grouping [" + grouping + "]");
};
return new HashAggregationOperator(
List.of(supplier(op, dataType, filter, groups.size()).groupingAggregatorFactory(AggregatorMode.SINGLE)),
List.of(supplier(op, dataType, filter).groupingAggregatorFactory(AggregatorMode.SINGLE, List.of(groups.size()))),
() -> BlockHash.build(groups, driverContext.blockFactory(), 16 * 1024, false),
driverContext
);
}
private static AggregatorFunctionSupplier supplier(String op, String dataType, String filter, int dataChannel) {
private static AggregatorFunctionSupplier supplier(String op, String dataType, String filter) {
return filtered(switch (op) {
case COUNT -> CountAggregatorFunction.supplier(List.of(dataChannel));
case COUNT -> CountAggregatorFunction.supplier();
case COUNT_DISTINCT -> switch (dataType) {
case LONGS -> new CountDistinctLongAggregatorFunctionSupplier(List.of(dataChannel), 3000);
case DOUBLES -> new CountDistinctDoubleAggregatorFunctionSupplier(List.of(dataChannel), 3000);
case LONGS -> new CountDistinctLongAggregatorFunctionSupplier(3000);
case DOUBLES -> new CountDistinctDoubleAggregatorFunctionSupplier(3000);
default -> throw new IllegalArgumentException("unsupported data type [" + dataType + "]");
};
case MAX -> switch (dataType) {
case LONGS -> new MaxLongAggregatorFunctionSupplier(List.of(dataChannel));
case DOUBLES -> new MaxDoubleAggregatorFunctionSupplier(List.of(dataChannel));
case LONGS -> new MaxLongAggregatorFunctionSupplier();
case DOUBLES -> new MaxDoubleAggregatorFunctionSupplier();
default -> throw new IllegalArgumentException("unsupported data type [" + dataType + "]");
};
case MIN -> switch (dataType) {
case LONGS -> new MinLongAggregatorFunctionSupplier(List.of(dataChannel));
case DOUBLES -> new MinDoubleAggregatorFunctionSupplier(List.of(dataChannel));
case LONGS -> new MinLongAggregatorFunctionSupplier();
case DOUBLES -> new MinDoubleAggregatorFunctionSupplier();
default -> throw new IllegalArgumentException("unsupported data type [" + dataType + "]");
};
case SUM -> switch (dataType) {
case LONGS -> new SumLongAggregatorFunctionSupplier(List.of(dataChannel));
case DOUBLES -> new SumDoubleAggregatorFunctionSupplier(List.of(dataChannel));
case LONGS -> new SumLongAggregatorFunctionSupplier();
case DOUBLES -> new SumDoubleAggregatorFunctionSupplier();
default -> throw new IllegalArgumentException("unsupported data type [" + dataType + "]");
};
default -> throw new IllegalArgumentException("unsupported op [" + op + "]");

View file

@ -37,6 +37,7 @@ import org.elasticsearch.compute.data.LongVector;
import java.util.ArrayList;
import java.util.BitSet;
import java.util.Random;
import java.util.stream.IntStream;
public class BlockBenchmark {
/**
@ -112,7 +113,7 @@ public class BlockBenchmark {
blocks[blockIndex] = blockFactory.newBooleanArrayBlock(
values,
totalPositions,
null,
IntStream.rangeClosed(0, totalPositions).toArray(),
null,
Block.MvOrdering.DEDUPLICATED_AND_SORTED_ASCENDING
);
@ -120,7 +121,7 @@ public class BlockBenchmark {
case "array-multivalue-null" -> {
int[] firstValueIndexes = randomFirstValueIndexes(totalPositions);
int positionCount = firstValueIndexes.length - 1;
BitSet nulls = randomNulls(positionCount);
BitSet nulls = nullsFromFirstValues(firstValueIndexes);
blocks[blockIndex] = blockFactory.newBooleanArrayBlock(
values,
@ -141,7 +142,7 @@ public class BlockBenchmark {
blocks[blockIndex] = new BooleanBigArrayBlock(
valuesBigArray,
totalPositions,
null,
IntStream.rangeClosed(0, totalPositions).toArray(),
null,
Block.MvOrdering.DEDUPLICATED_AND_SORTED_ASCENDING,
blockFactory
@ -150,7 +151,7 @@ public class BlockBenchmark {
case "big-array-multivalue-null" -> {
int[] firstValueIndexes = randomFirstValueIndexes(totalPositions);
int positionCount = firstValueIndexes.length - 1;
BitSet nulls = randomNulls(positionCount);
BitSet nulls = nullsFromFirstValues(firstValueIndexes);
BitArray valuesBigArray = new BitArray(totalPositions, BigArrays.NON_RECYCLING_INSTANCE);
for (int i = 0; i < values.length; i++) {
if (values[i]) {
@ -211,7 +212,7 @@ public class BlockBenchmark {
blocks[blockIndex] = blockFactory.newBytesRefArrayBlock(
values,
totalPositions,
null,
IntStream.rangeClosed(0, totalPositions).toArray(),
null,
Block.MvOrdering.DEDUPLICATED_AND_SORTED_ASCENDING
);
@ -219,7 +220,7 @@ public class BlockBenchmark {
case "array-multivalue-null" -> {
int[] firstValueIndexes = randomFirstValueIndexes(totalPositions);
int positionCount = firstValueIndexes.length - 1;
BitSet nulls = randomNulls(positionCount);
BitSet nulls = nullsFromFirstValues(firstValueIndexes);
blocks[blockIndex] = blockFactory.newBytesRefArrayBlock(
values,
@ -257,7 +258,7 @@ public class BlockBenchmark {
blocks[blockIndex] = blockFactory.newDoubleArrayBlock(
values,
totalPositions,
null,
IntStream.rangeClosed(0, totalPositions).toArray(),
null,
Block.MvOrdering.DEDUPLICATED_AND_SORTED_ASCENDING
);
@ -265,7 +266,7 @@ public class BlockBenchmark {
case "array-multivalue-null" -> {
int[] firstValueIndexes = randomFirstValueIndexes(totalPositions);
int positionCount = firstValueIndexes.length - 1;
BitSet nulls = randomNulls(positionCount);
BitSet nulls = nullsFromFirstValues(firstValueIndexes);
blocks[blockIndex] = blockFactory.newDoubleArrayBlock(
values,
@ -284,7 +285,7 @@ public class BlockBenchmark {
blocks[blockIndex] = new DoubleBigArrayBlock(
valuesBigArray,
totalPositions,
null,
IntStream.rangeClosed(0, totalPositions).toArray(),
null,
Block.MvOrdering.DEDUPLICATED_AND_SORTED_ASCENDING,
blockFactory
@ -293,7 +294,7 @@ public class BlockBenchmark {
case "big-array-multivalue-null" -> {
int[] firstValueIndexes = randomFirstValueIndexes(totalPositions);
int positionCount = firstValueIndexes.length - 1;
BitSet nulls = randomNulls(positionCount);
BitSet nulls = nullsFromFirstValues(firstValueIndexes);
DoubleArray valuesBigArray = blockFactory.bigArrays().newDoubleArray(totalPositions, false);
for (int i = 0; i < values.length; i++) {
valuesBigArray.set(i, values[i]);
@ -344,7 +345,7 @@ public class BlockBenchmark {
blocks[blockIndex] = blockFactory.newIntArrayBlock(
values,
totalPositions,
null,
IntStream.rangeClosed(0, totalPositions).toArray(),
null,
Block.MvOrdering.DEDUPLICATED_AND_SORTED_ASCENDING
);
@ -352,7 +353,7 @@ public class BlockBenchmark {
case "array-multivalue-null" -> {
int[] firstValueIndexes = randomFirstValueIndexes(totalPositions);
int positionCount = firstValueIndexes.length - 1;
BitSet nulls = randomNulls(positionCount);
BitSet nulls = nullsFromFirstValues(firstValueIndexes);
blocks[blockIndex] = blockFactory.newIntArrayBlock(
values,
@ -371,7 +372,7 @@ public class BlockBenchmark {
blocks[blockIndex] = new IntBigArrayBlock(
valuesBigArray,
totalPositions,
null,
IntStream.rangeClosed(0, totalPositions).toArray(),
null,
Block.MvOrdering.DEDUPLICATED_AND_SORTED_ASCENDING,
blockFactory
@ -380,7 +381,7 @@ public class BlockBenchmark {
case "big-array-multivalue-null" -> {
int[] firstValueIndexes = randomFirstValueIndexes(totalPositions);
int positionCount = firstValueIndexes.length - 1;
BitSet nulls = randomNulls(positionCount);
BitSet nulls = nullsFromFirstValues(firstValueIndexes);
IntArray valuesBigArray = blockFactory.bigArrays().newIntArray(totalPositions, false);
for (int i = 0; i < values.length; i++) {
valuesBigArray.set(i, values[i]);
@ -431,7 +432,7 @@ public class BlockBenchmark {
blocks[blockIndex] = blockFactory.newLongArrayBlock(
values,
totalPositions,
null,
IntStream.rangeClosed(0, totalPositions).toArray(),
null,
Block.MvOrdering.DEDUPLICATED_AND_SORTED_ASCENDING
);
@ -439,7 +440,7 @@ public class BlockBenchmark {
case "array-multivalue-null" -> {
int[] firstValueIndexes = randomFirstValueIndexes(totalPositions);
int positionCount = firstValueIndexes.length - 1;
BitSet nulls = randomNulls(positionCount);
BitSet nulls = nullsFromFirstValues(firstValueIndexes);
blocks[blockIndex] = blockFactory.newLongArrayBlock(
values,
@ -458,7 +459,7 @@ public class BlockBenchmark {
blocks[blockIndex] = new LongBigArrayBlock(
valuesBigArray,
totalPositions,
null,
IntStream.rangeClosed(0, totalPositions).toArray(),
null,
Block.MvOrdering.DEDUPLICATED_AND_SORTED_ASCENDING,
blockFactory
@ -467,7 +468,7 @@ public class BlockBenchmark {
case "big-array-multivalue-null" -> {
int[] firstValueIndexes = randomFirstValueIndexes(totalPositions);
int positionCount = firstValueIndexes.length - 1;
BitSet nulls = randomNulls(positionCount);
BitSet nulls = nullsFromFirstValues(firstValueIndexes);
LongArray valuesBigArray = blockFactory.bigArrays().newLongArray(totalPositions, false);
for (int i = 0; i < values.length; i++) {
valuesBigArray.set(i, values[i]);
@ -526,10 +527,10 @@ public class BlockBenchmark {
return firstValueIndexes.stream().mapToInt(x -> x).toArray();
}
private static BitSet randomNulls(int positionCount) {
BitSet nulls = new BitSet(positionCount);
for (int i = 0; i < positionCount; i++) {
if (random.nextDouble() < NULL_PERCENTAGE) {
private static BitSet nullsFromFirstValues(int[] firstValueIndexes) {
BitSet nulls = new BitSet(firstValueIndexes.length - 1);
for (int i = 0; i < firstValueIndexes.length - 1; i++) {
if (firstValueIndexes[i + 1] - firstValueIndexes[i] == 1 && random.nextDouble() < NULL_PERCENTAGE) {
nulls.set(i);
}
}

View file

@ -42,7 +42,13 @@ import java.util.concurrent.TimeUnit;
@Fork(1)
public class BlockKeepMaskBenchmark extends BlockBenchmark {
static {
// Smoke test all the expected values and force loading subclasses more like prod
if (false == "true".equals(System.getProperty("skipSelfTest"))) {
// Smoke test all the expected values and force loading subclasses more like prod
selfTest();
}
}
static void selfTest() {
int totalPositions = 10;
for (String paramString : RELEVANT_TYPE_BLOCK_COMBINATIONS) {
String[] params = paramString.split("/");

View file

@ -26,6 +26,13 @@ import java.util.stream.IntStream;
@Fork(1)
public class BlockReadBenchmark extends BlockBenchmark {
static {
if (false == "true".equals(System.getProperty("skipSelfTest"))) {
// Smoke test all the expected values and force loading subclasses more like prod
selfTest();
}
}
static void selfTest() {
// Smoke test all the expected values and force loading subclasses more like prod
int totalPositions = 10;
long[] actualCheckSums = new long[NUM_BLOCKS_PER_ITERATION];

View file

@ -11,20 +11,27 @@ package org.elasticsearch.benchmark.compute.operator;
import org.apache.lucene.util.BytesRef;
import org.elasticsearch.common.breaker.NoopCircuitBreaker;
import org.elasticsearch.common.logging.LogConfigurator;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.util.BigArrays;
import org.elasticsearch.compute.data.Block;
import org.elasticsearch.compute.data.BlockFactory;
import org.elasticsearch.compute.data.BooleanBlock;
import org.elasticsearch.compute.data.BooleanVector;
import org.elasticsearch.compute.data.BytesRefBlock;
import org.elasticsearch.compute.data.BytesRefVector;
import org.elasticsearch.compute.data.DoubleBlock;
import org.elasticsearch.compute.data.DoubleVector;
import org.elasticsearch.compute.data.LongBlock;
import org.elasticsearch.compute.data.LongVector;
import org.elasticsearch.compute.data.OrdinalBytesRefVector;
import org.elasticsearch.compute.data.Page;
import org.elasticsearch.compute.operator.DriverContext;
import org.elasticsearch.compute.operator.EvalOperator;
import org.elasticsearch.compute.operator.Operator;
import org.elasticsearch.core.TimeValue;
import org.elasticsearch.logging.LogManager;
import org.elasticsearch.logging.Logger;
import org.elasticsearch.xpack.esql.core.expression.Expression;
import org.elasticsearch.xpack.esql.core.expression.FieldAttribute;
import org.elasticsearch.xpack.esql.core.expression.FoldContext;
@ -40,9 +47,13 @@ import org.elasticsearch.xpack.esql.expression.function.scalar.math.Abs;
import org.elasticsearch.xpack.esql.expression.function.scalar.multivalue.MvMin;
import org.elasticsearch.xpack.esql.expression.function.scalar.nulls.Coalesce;
import org.elasticsearch.xpack.esql.expression.function.scalar.string.RLike;
import org.elasticsearch.xpack.esql.expression.function.scalar.string.ToLower;
import org.elasticsearch.xpack.esql.expression.function.scalar.string.ToUpper;
import org.elasticsearch.xpack.esql.expression.predicate.operator.arithmetic.Add;
import org.elasticsearch.xpack.esql.expression.predicate.operator.comparison.Equals;
import org.elasticsearch.xpack.esql.planner.Layout;
import org.elasticsearch.xpack.esql.plugin.EsqlPlugin;
import org.elasticsearch.xpack.esql.session.Configuration;
import org.openjdk.jmh.annotations.Benchmark;
import org.openjdk.jmh.annotations.BenchmarkMode;
import org.openjdk.jmh.annotations.Fork;
@ -56,8 +67,10 @@ import org.openjdk.jmh.annotations.State;
import org.openjdk.jmh.annotations.Warmup;
import java.time.Duration;
import java.time.ZoneOffset;
import java.util.Arrays;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.concurrent.TimeUnit;
@ -80,9 +93,18 @@ public class EvalBenchmark {
static final DriverContext driverContext = new DriverContext(BigArrays.NON_RECYCLING_INSTANCE, blockFactory);
static {
// Smoke test all the expected values and force loading subclasses more like prod
LogConfigurator.configureESLogging();
if (false == "true".equals(System.getProperty("skipSelfTest"))) {
// Smoke test all the expected values and force loading subclasses more like prod
selfTest();
}
}
static void selfTest() {
Logger log = LogManager.getLogger(EvalBenchmark.class);
try {
for (String operation : EvalBenchmark.class.getField("operation").getAnnotationsByType(Param.class)[0].value()) {
log.info("self testing {}", operation);
run(operation);
}
} catch (NoSuchFieldException e) {
@ -106,7 +128,11 @@ public class EvalBenchmark {
"long_equal_to_int",
"mv_min",
"mv_min_ascending",
"rlike" }
"rlike",
"to_lower",
"to_lower_ords",
"to_upper",
"to_upper_ords" }
)
public String operation;
@ -169,7 +195,7 @@ public class EvalBenchmark {
new Coalesce(Source.EMPTY, lhs, List.of(f2)),
layout(f1, f2)
).get(driverContext);
String desc = operation.endsWith("lazy") ? "CoalesceLazyEvaluator" : "CoalesceEagerEvaluator";
String desc = operation.endsWith("lazy") ? "CoalesceLongLazyEvaluator" : "CoalesceLongEagerEvaluator";
if (evaluator.toString().contains(desc) == false) {
throw new IllegalArgumentException("Evaluator was [" + evaluator + "] but expected one containing [" + desc + "]");
}
@ -214,6 +240,16 @@ public class EvalBenchmark {
RLike rlike = new RLike(Source.EMPTY, keywordField, new RLikePattern(".ar"));
yield EvalMapper.toEvaluator(FOLD_CONTEXT, rlike, layout(keywordField)).get(driverContext);
}
case "to_lower", "to_lower_ords" -> {
FieldAttribute keywordField = keywordField();
ToLower toLower = new ToLower(Source.EMPTY, keywordField, configuration());
yield EvalMapper.toEvaluator(FOLD_CONTEXT, toLower, layout(keywordField)).get(driverContext);
}
case "to_upper", "to_upper_ords" -> {
FieldAttribute keywordField = keywordField();
ToUpper toUpper = new ToUpper(Source.EMPTY, keywordField, configuration());
yield EvalMapper.toEvaluator(FOLD_CONTEXT, toUpper, layout(keywordField)).get(driverContext);
}
default -> throw new UnsupportedOperationException();
};
}
@ -234,6 +270,23 @@ public class EvalBenchmark {
return new FieldAttribute(Source.EMPTY, "keyword", new EsField("keyword", DataType.KEYWORD, Map.of(), true));
}
private static Configuration configuration() {
return new Configuration(
ZoneOffset.UTC,
Locale.ROOT,
null,
null,
null,
EsqlPlugin.QUERY_RESULT_TRUNCATION_MAX_SIZE.get(Settings.EMPTY),
EsqlPlugin.QUERY_RESULT_TRUNCATION_DEFAULT_SIZE.get(Settings.EMPTY),
null,
false,
Map.of(),
0,
false
);
}
private static Layout layout(FieldAttribute... fields) {
Layout.Builder layout = new Layout.Builder();
layout.append(Arrays.asList(fields));
@ -366,10 +419,35 @@ public class EvalBenchmark {
}
}
}
case "to_lower" -> checkBytes(operation, actual, false, new BytesRef[] { new BytesRef("foo"), new BytesRef("bar") });
case "to_lower_ords" -> checkBytes(operation, actual, true, new BytesRef[] { new BytesRef("foo"), new BytesRef("bar") });
case "to_upper" -> checkBytes(operation, actual, false, new BytesRef[] { new BytesRef("FOO"), new BytesRef("BAR") });
case "to_upper_ords" -> checkBytes(operation, actual, true, new BytesRef[] { new BytesRef("FOO"), new BytesRef("BAR") });
default -> throw new UnsupportedOperationException(operation);
}
}
private static void checkBytes(String operation, Page actual, boolean expectOrds, BytesRef[] expectedVals) {
BytesRef scratch = new BytesRef();
BytesRefVector v = actual.<BytesRefBlock>getBlock(1).asVector();
for (int i = 0; i < BLOCK_LENGTH; i++) {
BytesRef expected = expectedVals[i % 2];
BytesRef b = v.getBytesRef(i, scratch);
if (b.equals(expected) == false) {
throw new AssertionError("[" + operation + "] expected [" + expected + "] but was [" + b + "]");
}
}
if (expectOrds) {
if (v.asOrdinals() == null) {
throw new IllegalArgumentException("expected ords but got " + v);
}
} else {
if (v.asOrdinals() != null) {
throw new IllegalArgumentException("expected non-ords but got " + v);
}
}
}
private static Page page(String operation) {
return switch (operation) {
case "abs", "add", "date_trunc", "equal_to_const" -> {
@ -440,7 +518,7 @@ public class EvalBenchmark {
}
yield new Page(builder.build());
}
case "rlike" -> {
case "rlike", "to_lower", "to_upper" -> {
var builder = blockFactory.newBytesRefVectorBuilder(BLOCK_LENGTH);
BytesRef[] values = new BytesRef[] { new BytesRef("foo"), new BytesRef("bar") };
for (int i = 0; i < BLOCK_LENGTH; i++) {
@ -448,6 +526,16 @@ public class EvalBenchmark {
}
yield new Page(builder.build().asBlock());
}
case "to_lower_ords", "to_upper_ords" -> {
var bytes = blockFactory.newBytesRefVectorBuilder(BLOCK_LENGTH);
bytes.appendBytesRef(new BytesRef("foo"));
bytes.appendBytesRef(new BytesRef("bar"));
var ordinals = blockFactory.newIntVectorFixedBuilder(BLOCK_LENGTH);
for (int i = 0; i < BLOCK_LENGTH; i++) {
ordinals.appendInt(i % 2);
}
yield new Page(new OrdinalBytesRefVector(ordinals.build(), bytes.build()).asBlock());
}
default -> throw new UnsupportedOperationException();
};
}

View file

@ -0,0 +1,61 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the "Elastic License
* 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side
* Public License v 1"; you may not use this file except in compliance with, at
* your election, the "Elastic License 2.0", the "GNU Affero General Public
* License v3.0 only", or the "Server Side Public License, v 1".
*/
package org.elasticsearch.benchmark.compute.operator;
import org.apache.lucene.document.InetAddressPoint;
import org.apache.lucene.util.BytesRef;
import org.elasticsearch.common.breaker.NoopCircuitBreaker;
import org.elasticsearch.common.network.InetAddresses;
import org.elasticsearch.compute.operator.BreakingBytesRefBuilder;
import org.elasticsearch.xpack.esql.expression.function.scalar.convert.ParseIp;
import org.openjdk.jmh.annotations.Benchmark;
import org.openjdk.jmh.annotations.BenchmarkMode;
import org.openjdk.jmh.annotations.Fork;
import org.openjdk.jmh.annotations.Measurement;
import org.openjdk.jmh.annotations.Mode;
import org.openjdk.jmh.annotations.OutputTimeUnit;
import org.openjdk.jmh.annotations.Scope;
import org.openjdk.jmh.annotations.State;
import org.openjdk.jmh.annotations.Warmup;
import java.net.InetAddress;
import java.util.concurrent.TimeUnit;
@Warmup(iterations = 5)
@Measurement(iterations = 7)
@BenchmarkMode(Mode.AverageTime)
@OutputTimeUnit(TimeUnit.NANOSECONDS)
@State(Scope.Thread)
@Fork(1)
public class ParseIpBenchmark {
private final BytesRef ip = new BytesRef("192.168.0.1");
private final BreakingBytesRefBuilder scratch = ParseIp.buildScratch(new NoopCircuitBreaker("request"));
@Benchmark
public BytesRef leadingZerosRejected() {
return ParseIp.leadingZerosRejected(ip, scratch);
}
@Benchmark
public BytesRef leadingZerosAreDecimal() {
return ParseIp.leadingZerosAreDecimal(ip, scratch);
}
@Benchmark
public BytesRef leadingZerosAreOctal() {
return ParseIp.leadingZerosAreOctal(ip, scratch);
}
@Benchmark
public BytesRef original() {
InetAddress inetAddress = InetAddresses.forString(ip.utf8ToString());
return new BytesRef(InetAddressPoint.encode(inetAddress));
}
}

View file

@ -69,6 +69,10 @@ public class TopNBenchmark {
static {
// Smoke test all the expected values and force loading subclasses more like prod
selfTest();
}
static void selfTest() {
try {
for (String data : TopNBenchmark.class.getField("data").getAnnotationsByType(Param.class)[0].value()) {
for (String topCount : TopNBenchmark.class.getField("topCount").getAnnotationsByType(Param.class)[0].value()) {
@ -98,8 +102,8 @@ public class TopNBenchmark {
case DOUBLES -> List.of(ElementType.DOUBLE);
case BOOLEANS -> List.of(ElementType.BOOLEAN);
case BYTES_REFS -> List.of(ElementType.BYTES_REF);
case TWO_LONGS -> List.of(ElementType.INT, ElementType.INT);
case LONGS_AND_BYTES_REFS -> List.of(ElementType.INT, ElementType.BYTES_REF);
case TWO_LONGS -> List.of(ElementType.LONG, ElementType.LONG);
case LONGS_AND_BYTES_REFS -> List.of(ElementType.LONG, ElementType.BYTES_REF);
default -> throw new IllegalArgumentException("unsupported data type [" + data + "]");
};
List<TopNEncoder> encoders = switch (data) {
@ -127,7 +131,7 @@ public class TopNBenchmark {
}
private static void checkExpected(int topCount, List<Page> pages) {
if (topCount != pages.size()) {
if (topCount != pages.stream().mapToLong(Page::getPositionCount).sum()) {
throw new AssertionError("expected [" + topCount + "] but got [" + pages.size() + "]");
}
}
@ -191,7 +195,7 @@ public class TopNBenchmark {
try (Operator operator = operator(data, topCount)) {
Page page = page(data);
for (int i = 0; i < 1024; i++) {
operator.addInput(page);
operator.addInput(page.shallowCopy());
}
operator.finish();
List<Page> results = new ArrayList<>();

View file

@ -0,0 +1,346 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the "Elastic License
* 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side
* Public License v 1"; you may not use this file except in compliance with, at
* your election, the "Elastic License 2.0", the "GNU Affero General Public
* License v3.0 only", or the "Server Side Public License, v 1".
*/
package org.elasticsearch.benchmark.compute.operator;
import org.apache.lucene.util.BytesRef;
import org.elasticsearch.common.breaker.NoopCircuitBreaker;
import org.elasticsearch.common.util.BigArrays;
import org.elasticsearch.compute.aggregation.AggregatorFunctionSupplier;
import org.elasticsearch.compute.aggregation.AggregatorMode;
import org.elasticsearch.compute.aggregation.ValuesBytesRefAggregatorFunctionSupplier;
import org.elasticsearch.compute.aggregation.ValuesIntAggregatorFunctionSupplier;
import org.elasticsearch.compute.aggregation.ValuesLongAggregatorFunctionSupplier;
import org.elasticsearch.compute.aggregation.blockhash.BlockHash;
import org.elasticsearch.compute.data.Block;
import org.elasticsearch.compute.data.BlockFactory;
import org.elasticsearch.compute.data.BytesRefBlock;
import org.elasticsearch.compute.data.ElementType;
import org.elasticsearch.compute.data.IntBlock;
import org.elasticsearch.compute.data.LongBlock;
import org.elasticsearch.compute.data.LongVector;
import org.elasticsearch.compute.data.Page;
import org.elasticsearch.compute.operator.AggregationOperator;
import org.elasticsearch.compute.operator.DriverContext;
import org.elasticsearch.compute.operator.HashAggregationOperator;
import org.elasticsearch.compute.operator.Operator;
import org.openjdk.jmh.annotations.Benchmark;
import org.openjdk.jmh.annotations.BenchmarkMode;
import org.openjdk.jmh.annotations.Fork;
import org.openjdk.jmh.annotations.Measurement;
import org.openjdk.jmh.annotations.Mode;
import org.openjdk.jmh.annotations.OutputTimeUnit;
import org.openjdk.jmh.annotations.Param;
import org.openjdk.jmh.annotations.Scope;
import org.openjdk.jmh.annotations.State;
import org.openjdk.jmh.annotations.Warmup;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
import java.util.stream.IntStream;
import java.util.stream.LongStream;
/**
* Benchmark for the {@code VALUES} aggregator that supports grouping by many many
* many values.
*/
@Warmup(iterations = 5)
@Measurement(iterations = 7)
@BenchmarkMode(Mode.AverageTime)
@OutputTimeUnit(TimeUnit.MILLISECONDS)
@State(Scope.Thread)
@Fork(1)
public class ValuesAggregatorBenchmark {
static final int MIN_BLOCK_LENGTH = 8 * 1024;
private static final int OP_COUNT = 1024;
private static final int UNIQUE_VALUES = 6;
private static final BytesRef[] KEYWORDS = new BytesRef[] {
new BytesRef("Tokyo"),
new BytesRef("Delhi"),
new BytesRef("Shanghai"),
new BytesRef("São Paulo"),
new BytesRef("Mexico City"),
new BytesRef("Cairo") };
static {
assert KEYWORDS.length == UNIQUE_VALUES;
}
private static final BlockFactory blockFactory = BlockFactory.getInstance(
new NoopCircuitBreaker("noop"),
BigArrays.NON_RECYCLING_INSTANCE // TODO real big arrays?
);
static {
if (false == "true".equals(System.getProperty("skipSelfTest"))) {
// Smoke test all the expected values and force loading subclasses more like prod
selfTest();
}
}
static void selfTest() {
// Smoke test all the expected values and force loading subclasses more like prod
try {
for (String groups : ValuesAggregatorBenchmark.class.getField("groups").getAnnotationsByType(Param.class)[0].value()) {
for (String dataType : ValuesAggregatorBenchmark.class.getField("dataType").getAnnotationsByType(Param.class)[0].value()) {
run(Integer.parseInt(groups), dataType, 10);
}
}
} catch (NoSuchFieldException e) {
throw new AssertionError();
}
}
private static final String BYTES_REF = "BytesRef";
private static final String INT = "int";
private static final String LONG = "long";
@Param({ "1", "1000", /*"1000000"*/ })
public int groups;
@Param({ BYTES_REF, INT, LONG })
public String dataType;
private static Operator operator(DriverContext driverContext, int groups, String dataType) {
if (groups == 1) {
return new AggregationOperator(
List.of(supplier(dataType).aggregatorFactory(AggregatorMode.SINGLE, List.of(0)).apply(driverContext)),
driverContext
);
}
List<BlockHash.GroupSpec> groupSpec = List.of(new BlockHash.GroupSpec(0, ElementType.LONG));
return new HashAggregationOperator(
List.of(supplier(dataType).groupingAggregatorFactory(AggregatorMode.SINGLE, List.of(1))),
() -> BlockHash.build(groupSpec, driverContext.blockFactory(), 16 * 1024, false),
driverContext
);
}
private static AggregatorFunctionSupplier supplier(String dataType) {
return switch (dataType) {
case BYTES_REF -> new ValuesBytesRefAggregatorFunctionSupplier();
case INT -> new ValuesIntAggregatorFunctionSupplier();
case LONG -> new ValuesLongAggregatorFunctionSupplier();
default -> throw new IllegalArgumentException("unsupported data type [" + dataType + "]");
};
}
private static void checkExpected(int groups, String dataType, Page page) {
String prefix = String.format("[%s][%s]", groups, dataType);
int positions = page.getPositionCount();
if (positions != groups) {
throw new IllegalArgumentException(prefix + " expected " + groups + " positions, got " + positions);
}
if (groups == 1) {
checkUngrouped(prefix, dataType, page);
return;
}
checkGrouped(prefix, groups, dataType, page);
}
private static void checkGrouped(String prefix, int groups, String dataType, Page page) {
LongVector groupsVector = page.<LongBlock>getBlock(0).asVector();
for (int p = 0; p < groups; p++) {
long group = groupsVector.getLong(p);
if (group != p) {
throw new IllegalArgumentException(prefix + "[" + p + "] expected group " + p + " but was " + groups);
}
}
switch (dataType) {
case BYTES_REF -> {
// Build the expected values
List<Set<BytesRef>> expected = new ArrayList<>(groups);
for (int g = 0; g < groups; g++) {
expected.add(new HashSet<>(KEYWORDS.length));
}
int blockLength = blockLength(groups);
for (int p = 0; p < blockLength; p++) {
expected.get(p % groups).add(KEYWORDS[p % KEYWORDS.length]);
}
// Check them
BytesRefBlock values = page.getBlock(1);
for (int p = 0; p < groups; p++) {
checkExpectedBytesRef(prefix, values, p, expected.get(p));
}
}
case INT -> {
// Build the expected values
List<Set<Integer>> expected = new ArrayList<>(groups);
for (int g = 0; g < groups; g++) {
expected.add(new HashSet<>(UNIQUE_VALUES));
}
int blockLength = blockLength(groups);
for (int p = 0; p < blockLength; p++) {
expected.get(p % groups).add(p % KEYWORDS.length);
}
// Check them
IntBlock values = page.getBlock(1);
for (int p = 0; p < groups; p++) {
checkExpectedInt(prefix, values, p, expected.get(p));
}
}
case LONG -> {
// Build the expected values
List<Set<Long>> expected = new ArrayList<>(groups);
for (int g = 0; g < groups; g++) {
expected.add(new HashSet<>(UNIQUE_VALUES));
}
int blockLength = blockLength(groups);
for (int p = 0; p < blockLength; p++) {
expected.get(p % groups).add((long) p % KEYWORDS.length);
}
// Check them
LongBlock values = page.getBlock(1);
for (int p = 0; p < groups; p++) {
checkExpectedLong(prefix, values, p, expected.get(p));
}
}
default -> throw new IllegalArgumentException(prefix + " unsupported data type " + dataType);
}
}
private static void checkUngrouped(String prefix, String dataType, Page page) {
switch (dataType) {
case BYTES_REF -> {
BytesRefBlock values = page.getBlock(0);
checkExpectedBytesRef(prefix, values, 0, Set.of(KEYWORDS));
}
case INT -> {
IntBlock values = page.getBlock(0);
checkExpectedInt(prefix, values, 0, IntStream.range(0, UNIQUE_VALUES).boxed().collect(Collectors.toSet()));
}
case LONG -> {
LongBlock values = page.getBlock(0);
checkExpectedLong(prefix, values, 0, LongStream.range(0, UNIQUE_VALUES).boxed().collect(Collectors.toSet()));
}
default -> throw new IllegalArgumentException(prefix + " unsupported data type " + dataType);
}
}
private static int checkExpectedBlock(String prefix, Block values, int position, Set<?> expected) {
int valueCount = values.getValueCount(position);
if (valueCount != expected.size()) {
throw new IllegalArgumentException(
prefix + "[" + position + "] expected " + expected.size() + " values but count was " + valueCount
);
}
return valueCount;
}
private static void checkExpectedBytesRef(String prefix, BytesRefBlock values, int position, Set<BytesRef> expected) {
int valueCount = checkExpectedBlock(prefix, values, position, expected);
BytesRef scratch = new BytesRef();
for (int i = values.getFirstValueIndex(position); i < valueCount; i++) {
BytesRef v = values.getBytesRef(i, scratch);
if (expected.contains(v) == false) {
throw new IllegalArgumentException(prefix + "[" + position + "] expected " + v + " to be in " + expected);
}
}
}
private static void checkExpectedInt(String prefix, IntBlock values, int position, Set<Integer> expected) {
int valueCount = checkExpectedBlock(prefix, values, position, expected);
for (int i = values.getFirstValueIndex(position); i < valueCount; i++) {
Integer v = values.getInt(i);
if (expected.contains(v) == false) {
throw new IllegalArgumentException(prefix + "[" + position + "] expected " + v + " to be in " + expected);
}
}
}
private static void checkExpectedLong(String prefix, LongBlock values, int position, Set<Long> expected) {
int valueCount = checkExpectedBlock(prefix, values, position, expected);
for (int i = values.getFirstValueIndex(position); i < valueCount; i++) {
Long v = values.getLong(i);
if (expected.contains(v) == false) {
throw new IllegalArgumentException(prefix + "[" + position + "] expected " + v + " to be in " + expected);
}
}
}
private static Page page(int groups, String dataType) {
Block dataBlock = dataBlock(groups, dataType);
if (groups == 1) {
return new Page(dataBlock);
}
return new Page(groupingBlock(groups), dataBlock);
}
private static Block dataBlock(int groups, String dataType) {
int blockLength = blockLength(groups);
return switch (dataType) {
case BYTES_REF -> {
try (BytesRefBlock.Builder builder = blockFactory.newBytesRefBlockBuilder(blockLength)) {
for (int i = 0; i < blockLength; i++) {
builder.appendBytesRef(KEYWORDS[i % KEYWORDS.length]);
}
yield builder.build();
}
}
case INT -> {
try (IntBlock.Builder builder = blockFactory.newIntBlockBuilder(blockLength)) {
for (int i = 0; i < blockLength; i++) {
builder.appendInt(i % UNIQUE_VALUES);
}
yield builder.build();
}
}
case LONG -> {
try (LongBlock.Builder builder = blockFactory.newLongBlockBuilder(blockLength)) {
for (int i = 0; i < blockLength; i++) {
builder.appendLong(i % UNIQUE_VALUES);
}
yield builder.build();
}
}
default -> throw new IllegalArgumentException("unsupported data type " + dataType);
};
}
private static Block groupingBlock(int groups) {
int blockLength = blockLength(groups);
try (LongVector.Builder builder = blockFactory.newLongVectorBuilder(blockLength)) {
for (int i = 0; i < blockLength; i++) {
builder.appendLong(i % groups);
}
return builder.build().asBlock();
}
}
@Benchmark
public void run() {
run(groups, dataType, OP_COUNT);
}
private static void run(int groups, String dataType, int opCount) {
DriverContext driverContext = driverContext();
try (Operator operator = operator(driverContext, groups, dataType)) {
Page page = page(groups, dataType);
for (int i = 0; i < opCount; i++) {
operator.addInput(page.shallowCopy());
}
operator.finish();
checkExpected(groups, dataType, operator.getOutput());
}
}
static DriverContext driverContext() {
return new DriverContext(BigArrays.NON_RECYCLING_INSTANCE, blockFactory);
}
static int blockLength(int groups) {
return Math.max(MIN_BLOCK_LENGTH, groups);
}
}

View file

@ -92,6 +92,10 @@ public class ValuesSourceReaderBenchmark {
static {
// Smoke test all the expected values and force loading subclasses more like prod
selfTest();
}
static void selfTest() {
try {
ValuesSourceReaderBenchmark benchmark = new ValuesSourceReaderBenchmark();
benchmark.setupIndex();
@ -261,8 +265,44 @@ public class ValuesSourceReaderBenchmark {
null,
false,
null,
null
).blockLoader(null);
null,
false
).blockLoader(new MappedFieldType.BlockLoaderContext() {
@Override
public String indexName() {
return "benchmark";
}
@Override
public MappedFieldType.FieldExtractPreference fieldExtractPreference() {
return MappedFieldType.FieldExtractPreference.NONE;
}
@Override
public IndexSettings indexSettings() {
throw new UnsupportedOperationException();
}
@Override
public SearchLookup lookup() {
throw new UnsupportedOperationException();
}
@Override
public Set<String> sourcePaths(String name) {
throw new UnsupportedOperationException();
}
@Override
public String parentField(String field) {
throw new UnsupportedOperationException();
}
@Override
public FieldNamesFieldMapper.FieldNamesFieldType fieldNames() {
throw new UnsupportedOperationException();
}
});
}
/**

View file

@ -0,0 +1,271 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the "Elastic License
* 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side
* Public License v 1"; you may not use this file except in compliance with, at
* your election, the "Elastic License 2.0", the "GNU Affero General Public
* License v3.0 only", or the "Server Side Public License, v 1".
*/
package org.elasticsearch.benchmark.index.codec.tsdb;
import org.apache.lucene.analysis.standard.StandardAnalyzer;
import org.apache.lucene.codecs.DocValuesFormat;
import org.apache.lucene.document.Document;
import org.apache.lucene.document.SortedDocValuesField;
import org.apache.lucene.document.SortedNumericDocValuesField;
import org.apache.lucene.document.SortedSetDocValuesField;
import org.apache.lucene.index.IndexWriter;
import org.apache.lucene.index.IndexWriterConfig;
import org.apache.lucene.index.LogByteSizeMergePolicy;
import org.apache.lucene.search.Sort;
import org.apache.lucene.search.SortField;
import org.apache.lucene.search.SortedNumericSortField;
import org.apache.lucene.store.Directory;
import org.apache.lucene.store.FSDirectory;
import org.apache.lucene.util.BytesRef;
import org.elasticsearch.cluster.metadata.DataStream;
import org.elasticsearch.common.logging.LogConfigurator;
import org.elasticsearch.index.codec.Elasticsearch900Lucene101Codec;
import org.elasticsearch.index.codec.tsdb.es819.ES819TSDBDocValuesFormat;
import org.openjdk.jmh.annotations.Benchmark;
import org.openjdk.jmh.annotations.BenchmarkMode;
import org.openjdk.jmh.annotations.Fork;
import org.openjdk.jmh.annotations.Level;
import org.openjdk.jmh.annotations.Measurement;
import org.openjdk.jmh.annotations.Mode;
import org.openjdk.jmh.annotations.OutputTimeUnit;
import org.openjdk.jmh.annotations.Param;
import org.openjdk.jmh.annotations.Scope;
import org.openjdk.jmh.annotations.Setup;
import org.openjdk.jmh.annotations.State;
import org.openjdk.jmh.annotations.Threads;
import org.openjdk.jmh.annotations.Warmup;
import org.openjdk.jmh.profile.AsyncProfiler;
import org.openjdk.jmh.runner.Runner;
import org.openjdk.jmh.runner.RunnerException;
import org.openjdk.jmh.runner.options.Options;
import org.openjdk.jmh.runner.options.OptionsBuilder;
import java.io.IOException;
import java.nio.file.Files;
import java.util.Random;
import java.util.concurrent.TimeUnit;
import java.util.function.Supplier;
@BenchmarkMode(Mode.SingleShotTime)
@OutputTimeUnit(TimeUnit.MILLISECONDS)
@State(Scope.Benchmark)
@Fork(1)
@Threads(1)
@Warmup(iterations = 0)
@Measurement(iterations = 1)
public class TSDBDocValuesMergeBenchmark {
static {
// For Elasticsearch900Lucene101Codec:
LogConfigurator.loadLog4jPlugins();
LogConfigurator.configureESLogging();
LogConfigurator.setNodeName("test");
}
private static final String TIMESTAMP_FIELD = "@timestamp";
private static final String HOSTNAME_FIELD = "host.name";
private static final long BASE_TIMESTAMP = 1704067200000L;
public static void main(String[] args) throws RunnerException {
final Options options = new OptionsBuilder().include(TSDBDocValuesMergeBenchmark.class.getSimpleName())
.addProfiler(AsyncProfiler.class)
.build();
new Runner(options).run();
}
@State(Scope.Benchmark)
public static class StateDenseWithoutOptimizeMerge {
@Param("20431204")
private int nDocs;
@Param("1000")
private int deltaTime;
@Param("42")
private int seed;
private Directory directory;
private final Supplier<IndexWriterConfig> iwc = () -> createIndexWriterConfig(false);
@Setup(Level.Trial)
public void setup() throws IOException {
directory = FSDirectory.open(Files.createTempDirectory("temp2-"));
createIndex(directory, iwc.get(), false, nDocs, deltaTime, seed);
}
}
@Benchmark
public void forceMergeDenseWithoutOptimizedMerge(StateDenseWithoutOptimizeMerge state) throws IOException {
forceMerge(state.directory, state.iwc.get());
}
@State(Scope.Benchmark)
public static class StateDenseWithOptimizeMerge {
@Param("20431204")
private int nDocs;
@Param("1000")
private int deltaTime;
@Param("42")
private int seed;
private Directory directory;
private final Supplier<IndexWriterConfig> iwc = () -> createIndexWriterConfig(true);
@Setup(Level.Trial)
public void setup() throws IOException {
directory = FSDirectory.open(Files.createTempDirectory("temp1-"));
createIndex(directory, iwc.get(), false, nDocs, deltaTime, seed);
}
}
@Benchmark
public void forceMergeDenseWithOptimizedMerge(StateDenseWithOptimizeMerge state) throws IOException {
forceMerge(state.directory, state.iwc.get());
}
@State(Scope.Benchmark)
public static class StateSparseWithoutOptimizeMerge {
@Param("20431204")
private int nDocs;
@Param("1000")
private int deltaTime;
@Param("42")
private int seed;
private Directory directory;
private final Supplier<IndexWriterConfig> iwc = () -> createIndexWriterConfig(false);
@Setup(Level.Trial)
public void setup() throws IOException {
directory = FSDirectory.open(Files.createTempDirectory("temp4-"));
createIndex(directory, iwc.get(), true, nDocs, deltaTime, seed);
}
}
@Benchmark
public void forceMergeSparseWithoutOptimizedMerge(StateSparseWithoutOptimizeMerge state) throws IOException {
forceMerge(state.directory, state.iwc.get());
}
@State(Scope.Benchmark)
public static class StateSparseWithOptimizeMerge {
@Param("20431204")
private int nDocs;
@Param("1000")
private int deltaTime;
@Param("42")
private int seed;
private Directory directory;
private final Supplier<IndexWriterConfig> iwc = () -> createIndexWriterConfig(true);
@Setup(Level.Trial)
public void setup() throws IOException {
directory = FSDirectory.open(Files.createTempDirectory("temp3-"));
createIndex(directory, iwc.get(), true, nDocs, deltaTime, seed);
}
}
@Benchmark
public void forceMergeSparseWithOptimizedMerge(StateSparseWithOptimizeMerge state) throws IOException {
forceMerge(state.directory, state.iwc.get());
}
private void forceMerge(Directory directory, IndexWriterConfig config) throws IOException {
try (var indexWriter = new IndexWriter(directory, config)) {
indexWriter.forceMerge(1);
}
}
static void createIndex(Directory directory, IndexWriterConfig iwc, boolean sparse, int nDocs, int deltaTime, int seed)
throws IOException {
long counter1 = 0;
long counter2 = 10_000_000;
long[] gauge1Values = new long[] { 2, 4, 6, 8, 10, 12, 14, 16 };
long[] gauge2Values = new long[] { -2, -4, -6, -8, -10, -12, -14, -16 };
int numHosts = 10000;
String[] tags = new String[] { "tag_1", "tag_2", "tag_3", "tag_4", "tag_5", "tag_6", "tag_7", "tag_8" };
final Random random = new Random(seed);
try (var indexWriter = new IndexWriter(directory, iwc)) {
for (int i = 0; i < nDocs; i++) {
final Document doc = new Document();
final int batchIndex = i % numHosts;
final String hostName = "host-" + batchIndex;
// Slightly vary the timestamp in each document
final long timestamp = BASE_TIMESTAMP + ((i % numHosts) * deltaTime) + random.nextInt(0, deltaTime);
doc.add(new SortedDocValuesField(HOSTNAME_FIELD, new BytesRef(hostName)));
doc.add(new SortedNumericDocValuesField(TIMESTAMP_FIELD, timestamp));
if (sparse == false || random.nextBoolean()) {
doc.add(new SortedNumericDocValuesField("counter_1", counter1++));
}
if (sparse == false || random.nextBoolean()) {
doc.add(new SortedNumericDocValuesField("counter_2", counter2++));
}
if (sparse == false || random.nextBoolean()) {
doc.add(new SortedNumericDocValuesField("gauge_1", gauge1Values[i % gauge1Values.length]));
}
if (sparse == false || random.nextBoolean()) {
doc.add(new SortedNumericDocValuesField("gauge_2", gauge2Values[i % gauge1Values.length]));
}
if (sparse == false || random.nextBoolean()) {
int numTags = tags.length % (i + 1);
for (int j = 0; j < numTags; j++) {
doc.add(new SortedSetDocValuesField("tags", new BytesRef(tags[j])));
}
}
indexWriter.addDocument(doc);
if (i % 10000 == 0) {
indexWriter.commit();
}
}
}
}
private static IndexWriterConfig createIndexWriterConfig(boolean optimizedMergeEnabled) {
var config = new IndexWriterConfig(new StandardAnalyzer());
// NOTE: index sort config matching LogsDB's sort order
config.setIndexSort(
new Sort(
new SortField(HOSTNAME_FIELD, SortField.Type.STRING, false),
new SortedNumericSortField(TIMESTAMP_FIELD, SortField.Type.LONG, true)
)
);
config.setLeafSorter(DataStream.TIMESERIES_LEAF_READERS_SORTER);
config.setMergePolicy(new LogByteSizeMergePolicy());
var docValuesFormat = new ES819TSDBDocValuesFormat(4096, optimizedMergeEnabled);
config.setCodec(new Elasticsearch900Lucene101Codec() {
@Override
public DocValuesFormat getDocValuesFormatForField(String field) {
return docValuesFormat;
}
});
return config;
}
}

View file

@ -17,6 +17,7 @@ import org.elasticsearch.cluster.metadata.DataStream;
import org.elasticsearch.cluster.metadata.IndexMetadata;
import org.elasticsearch.cluster.metadata.IndexNameExpressionResolver;
import org.elasticsearch.cluster.metadata.Metadata;
import org.elasticsearch.cluster.project.DefaultProjectResolver;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.common.util.concurrent.ThreadContext;
import org.elasticsearch.index.Index;
@ -84,7 +85,11 @@ public class IndexNameExpressionResolverBenchmark {
}
int mid = indices.length / 2;
clusterState = ClusterState.builder(ClusterName.DEFAULT).metadata(mb).build();
resolver = new IndexNameExpressionResolver(new ThreadContext(Settings.EMPTY), new SystemIndices(List.of()));
resolver = new IndexNameExpressionResolver(
new ThreadContext(Settings.EMPTY),
new SystemIndices(List.of()),
DefaultProjectResolver.INSTANCE
);
indexListRequest = new Request(IndicesOptions.lenientExpandOpenHidden(), indices);
starRequest = new Request(IndicesOptions.lenientExpandOpenHidden(), "*");
String[] mixed = indices.clone();

View file

@ -14,7 +14,10 @@ import org.elasticsearch.cluster.ClusterName;
import org.elasticsearch.cluster.ClusterState;
import org.elasticsearch.cluster.metadata.IndexMetadata;
import org.elasticsearch.cluster.metadata.Metadata;
import org.elasticsearch.cluster.metadata.ProjectId;
import org.elasticsearch.cluster.metadata.ProjectMetadata;
import org.elasticsearch.cluster.node.DiscoveryNodes;
import org.elasticsearch.cluster.routing.GlobalRoutingTable;
import org.elasticsearch.cluster.routing.RoutingTable;
import org.elasticsearch.cluster.routing.ShardRouting;
import org.elasticsearch.cluster.routing.allocation.AllocationService;
@ -126,19 +129,20 @@ public class AllocationBenchmark {
Settings.builder().put("cluster.routing.allocation.awareness.attributes", "tag").build()
);
Metadata.Builder mb = Metadata.builder();
final ProjectId projectId = ProjectId.DEFAULT;
ProjectMetadata.Builder pmb = ProjectMetadata.builder(projectId);
for (int i = 1; i <= numIndices; i++) {
mb.put(
pmb.put(
IndexMetadata.builder("test_" + i)
.settings(Settings.builder().put(IndexMetadata.SETTING_VERSION_CREATED, IndexVersion.current()))
.numberOfShards(numShards)
.numberOfReplicas(numReplicas)
);
}
Metadata metadata = mb.build();
Metadata metadata = Metadata.builder().put(pmb).build();
RoutingTable.Builder rb = RoutingTable.builder(TestShardRoutingRoleStrategies.DEFAULT_ROLE_ONLY);
for (int i = 1; i <= numIndices; i++) {
rb.addAsNew(metadata.index("test_" + i));
rb.addAsNew(metadata.getProject(projectId).index("test_" + i));
}
RoutingTable routingTable = rb.build();
DiscoveryNodes.Builder nb = DiscoveryNodes.builder();
@ -151,7 +155,7 @@ public class AllocationBenchmark {
}
initialClusterState = ClusterState.builder(ClusterName.DEFAULT)
.metadata(metadata)
.routingTable(routingTable)
.routingTable(GlobalRoutingTable.builder().put(projectId, routingTable).build())
.nodes(nb)
.nodeIdsToCompatibilityVersions(compatibilityVersions)
.build();

View file

@ -14,6 +14,7 @@ import org.elasticsearch.cluster.ClusterState;
import org.elasticsearch.cluster.metadata.IndexMetadata;
import org.elasticsearch.cluster.metadata.Metadata;
import org.elasticsearch.cluster.node.DiscoveryNodes;
import org.elasticsearch.cluster.project.DefaultProjectResolver;
import org.elasticsearch.cluster.routing.IndexRoutingTable;
import org.elasticsearch.cluster.routing.IndexShardRoutingTable;
import org.elasticsearch.cluster.routing.RecoverySource;
@ -178,7 +179,12 @@ public class ShardsAvailabilityHealthIndicatorBenchmark {
new TaskManager(Settings.EMPTY, threadPool, Collections.emptySet())
);
clusterService.getClusterApplierService().setInitialState(initialClusterState);
indicatorService = new ShardsAvailabilityHealthIndicatorService(clusterService, allocationService, new SystemIndices(List.of()));
indicatorService = new ShardsAvailabilityHealthIndicatorService(
clusterService,
allocationService,
new SystemIndices(List.of()),
DefaultProjectResolver.INSTANCE
);
}
private int toInt(String v) {

View file

@ -83,7 +83,7 @@ public class ScriptScoreBenchmark {
private final ScriptModule scriptModule = new ScriptModule(Settings.EMPTY, pluginsService.filterPlugins(ScriptPlugin.class).toList());
private final Map<String, MappedFieldType> fieldTypes = Map.ofEntries(
Map.entry("n", new NumberFieldType("n", NumberType.LONG, false, false, true, true, null, Map.of(), null, false, null, null))
Map.entry("n", new NumberFieldType("n", NumberType.LONG, false, false, true, true, null, Map.of(), null, false, null, null, false))
);
private final IndexFieldDataCache fieldDataCache = new IndexFieldDataCache.None();
private final CircuitBreakerService breakerService = new NoneCircuitBreakerService();

View file

@ -0,0 +1,346 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the "Elastic License
* 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side
* Public License v 1"; you may not use this file except in compliance with, at
* your election, the "Elastic License 2.0", the "GNU Affero General Public
* License v3.0 only", or the "Server Side Public License, v 1".
*/
package org.elasticsearch.benchmark.search.query.range;
import org.apache.lucene.analysis.standard.StandardAnalyzer;
import org.apache.lucene.document.Document;
import org.apache.lucene.document.Field;
import org.apache.lucene.document.LongPoint;
import org.apache.lucene.document.SortedDocValuesField;
import org.apache.lucene.document.SortedNumericDocValuesField;
import org.apache.lucene.document.StringField;
import org.apache.lucene.index.DirectoryReader;
import org.apache.lucene.index.IndexWriter;
import org.apache.lucene.index.IndexWriterConfig;
import org.apache.lucene.search.IndexOrDocValuesQuery;
import org.apache.lucene.search.IndexSearcher;
import org.apache.lucene.search.IndexSortSortedNumericDocValuesRangeQuery;
import org.apache.lucene.search.Query;
import org.apache.lucene.search.Sort;
import org.apache.lucene.search.SortField;
import org.apache.lucene.search.SortedNumericSortField;
import org.apache.lucene.store.Directory;
import org.apache.lucene.store.FSDirectory;
import org.apache.lucene.util.BytesRef;
import org.openjdk.jmh.annotations.Benchmark;
import org.openjdk.jmh.annotations.BenchmarkMode;
import org.openjdk.jmh.annotations.Fork;
import org.openjdk.jmh.annotations.Level;
import org.openjdk.jmh.annotations.Measurement;
import org.openjdk.jmh.annotations.Mode;
import org.openjdk.jmh.annotations.OutputTimeUnit;
import org.openjdk.jmh.annotations.Param;
import org.openjdk.jmh.annotations.Scope;
import org.openjdk.jmh.annotations.Setup;
import org.openjdk.jmh.annotations.State;
import org.openjdk.jmh.annotations.TearDown;
import org.openjdk.jmh.annotations.Threads;
import org.openjdk.jmh.annotations.Warmup;
import org.openjdk.jmh.infra.Blackhole;
import org.openjdk.jmh.profile.AsyncProfiler;
import org.openjdk.jmh.runner.Runner;
import org.openjdk.jmh.runner.RunnerException;
import org.openjdk.jmh.runner.options.Options;
import org.openjdk.jmh.runner.options.OptionsBuilder;
import java.io.IOException;
import java.nio.file.Files;
import java.util.Random;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;
/**
* Benchmark for measuring query performance with and without doc values skipper in Elasticsearch.
*
* <p><b>Goal:</b> This benchmark is designed to mimic and benchmark the execution of a range query in LogsDB,
* with and without a sparse doc values index on the {@code host.name} and {@code @timestamp} fields.
*
* <p><b>Document Structure:</b>
* <ul>
* <li>{@code host.name}: A keyword field (sorted, non-stored).</li>
* <li>{@code @timestamp}: A numeric field, indexed for range queries and using doc values with or without a doc values sparse index.</li>
* </ul>
*
* <p><b>Index Sorting:</b>
* The index is sorted primarily by {@code host.name} (ascending) and secondarily by {@code @timestamp} (descending).
* Documents are grouped into batches, where each hostname gets a dedicated batch of timestamps.
* This is meant to simulate collecting logs from a set of hosts over a certain time interval.
*
* <p><b>Batched Data Behavior:</b>
* <ul>
* <li>The {@code host.name} value is generated in batches (e.g., "host-0", "host-1", ...).</li>
* <li>Each batch contains a fixed number of documents ({@code batchSize}).</li>
* <li>The {@code @timestamp} value resets to {@code BASE_TIMESTAMP} at the start of each batch.</li>
* <li>A random timestamp delta (0{@code deltaTime} ms) is added so that each document in a batch differs slightly.</li>
* </ul>
*
* <p><b>Example Output:</b>
* <pre>
* | Document # | host.name | @timestamp (ms since epoch) |
* |-----------|-----------|------------------------------|
* | 1 | host-0 | 1704067200005 |
* | 2 | host-0 | 1704067201053 |
* | 3 | host-0 | 1704067202091 |
* | ... | ... | ... |
* | 10000 | host-0 | 1704077199568 |
* | 10001 | host-1 | 1704067200042 |
* | 10002 | host-1 | 1704067201099 |
* | ... | ... | ... |
* </pre>
*
* <p>When running the range query, we retrieve only a fraction of the total data,
* simulating a real-world scenario where a dashboard only needs the most recent logs.
*/
@BenchmarkMode(Mode.SampleTime)
@OutputTimeUnit(TimeUnit.MILLISECONDS)
@State(Scope.Benchmark)
@Fork(1)
@Threads(1)
@Warmup(iterations = 3)
@Measurement(iterations = 5)
public class DateFieldMapperDocValuesSkipperBenchmark {
/**
* Total number of documents to index.
*/
@Param("1343120")
private int nDocs;
/**
* Number of documents per hostname batch.
*/
@Param({ "1340", "121300" })
private int batchSize;
/**
* Maximum random increment (in milliseconds) added to each doc's timestamp.
*/
@Param("1000")
private int deltaTime;
/**
* Fraction of the total time range (derived from {@code batchSize * deltaTime}) that the range query will cover.
*/
@Param({ "0.01", "0.2", "0.8" })
private double queryRange;
/**
* Number of docs to index before forcing a commit, thus creating multiple Lucene segments.
*/
@Param({ "7390", "398470" })
private int commitEvery;
/**
* Seed for random data generation.
*/
@Param("42")
private int seed;
private static final String TIMESTAMP_FIELD = "@timestamp";
private static final String HOSTNAME_FIELD = "host.name";
private static final long BASE_TIMESTAMP = 1704067200000L;
private IndexSearcher indexSearcherWithoutDocValuesSkipper;
private IndexSearcher indexSearcherWithDocValuesSkipper;
private ExecutorService executorService;
/**
* Main entry point for running this benchmark via JMH.
*
* @param args command line arguments (unused)
* @throws RunnerException if the benchmark fails to run
*/
public static void main(String[] args) throws RunnerException {
final Options options = new OptionsBuilder().include(DateFieldMapperDocValuesSkipperBenchmark.class.getSimpleName())
.addProfiler(AsyncProfiler.class)
.build();
new Runner(options).run();
}
/**
* Sets up the benchmark by creating Lucene indexes (with and without doc values skipper).
* Sets up a single-threaded executor for searching the indexes and avoid concurrent search threads.
*
* @throws IOException if an error occurs while building the index
*/
@Setup(Level.Trial)
public void setup() throws IOException {
executorService = Executors.newSingleThreadExecutor();
final Directory tempDirectoryWithoutDocValuesSkipper = FSDirectory.open(Files.createTempDirectory("temp1-"));
final Directory tempDirectoryWithDocValuesSkipper = FSDirectory.open(Files.createTempDirectory("temp2-"));
indexSearcherWithoutDocValuesSkipper = createIndex(tempDirectoryWithoutDocValuesSkipper, false, commitEvery);
indexSearcherWithDocValuesSkipper = createIndex(tempDirectoryWithDocValuesSkipper, true, commitEvery);
}
/**
* Creates an {@link IndexSearcher} after indexing documents in batches.
* Each batch commit forces multiple segments to be created.
*
* @param directory the Lucene {@link Directory} for writing the index
* @param withDocValuesSkipper true if we should enable doc values skipper on certain fields
* @param commitEvery number of documents after which to commit (and thus segment)
* @return an {@link IndexSearcher} for querying the newly built index
* @throws IOException if an I/O error occurs during index writing
*/
private IndexSearcher createIndex(final Directory directory, final boolean withDocValuesSkipper, final int commitEvery)
throws IOException {
final IndexWriterConfig config = new IndexWriterConfig(new StandardAnalyzer());
// NOTE: index sort config matching LogsDB's sort order
config.setIndexSort(
new Sort(
new SortField(HOSTNAME_FIELD, SortField.Type.STRING, false),
new SortedNumericSortField(TIMESTAMP_FIELD, SortField.Type.LONG, true)
)
);
final Random random = new Random(seed);
try (IndexWriter indexWriter = new IndexWriter(directory, config)) {
int docCountSinceLastCommit = 0;
for (int i = 0; i < nDocs; i++) {
final Document doc = new Document();
addFieldsToDocument(doc, i, withDocValuesSkipper, random);
indexWriter.addDocument(doc);
docCountSinceLastCommit++;
// Force commit periodically to create multiple Lucene segments
if (docCountSinceLastCommit >= commitEvery) {
indexWriter.commit();
docCountSinceLastCommit = 0;
}
}
indexWriter.commit();
// Open a reader and create a searcher on top of it using a single thread executor.
DirectoryReader reader = DirectoryReader.open(indexWriter);
return new IndexSearcher(reader, executorService);
}
}
/**
* Populates the given {@link Document} with fields, optionally using doc values skipper.
*
* @param doc the Lucene document to fill
* @param docIndex index of the document being added
* @param withDocValuesSkipper true if doc values skipper is enabled
* @param random seeded {@link Random} for data variation
*/
private void addFieldsToDocument(final Document doc, int docIndex, boolean withDocValuesSkipper, final Random random) {
final int batchIndex = docIndex / batchSize;
final String hostName = "host-" + batchIndex;
// Slightly vary the timestamp in each document
final long timestamp = BASE_TIMESTAMP + ((docIndex % batchSize) * deltaTime) + random.nextInt(0, deltaTime);
if (withDocValuesSkipper) {
// Sparse doc values index on `@timestamp` and `host.name`
doc.add(SortedNumericDocValuesField.indexedField(TIMESTAMP_FIELD, timestamp));
doc.add(SortedDocValuesField.indexedField(HOSTNAME_FIELD, new BytesRef(hostName)));
} else {
// Standard doc values, points and inverted index
doc.add(new StringField(HOSTNAME_FIELD, hostName, Field.Store.NO));
doc.add(new SortedDocValuesField(HOSTNAME_FIELD, new BytesRef(hostName)));
doc.add(new LongPoint(TIMESTAMP_FIELD, timestamp));
doc.add(new SortedNumericDocValuesField(TIMESTAMP_FIELD, timestamp));
}
}
/**
* Calculates the upper bound for the timestamp range query based on {@code batchSize},
* {@code deltaTime}, and {@code queryRange}.
*
* @return the computed upper bound for the timestamp range query
*/
private long rangeEndTimestamp() {
return BASE_TIMESTAMP + (long) (batchSize * deltaTime * queryRange);
}
/**
* Executes a range query without doc values skipper.
*
* @param bh the blackhole consuming the query result
* @throws IOException if a search error occurs
*/
@Benchmark
public void rangeQueryWithoutDocValuesSkipper(final Blackhole bh) throws IOException {
bh.consume(rangeQuery(indexSearcherWithoutDocValuesSkipper, BASE_TIMESTAMP, rangeEndTimestamp(), true));
}
/**
* Executes a range query with doc values skipper enabled.
*
* @param bh the blackhole consuming the query result
* @throws IOException if a search error occurs
*/
@Benchmark
public void rangeQueryWithDocValuesSkipper(final Blackhole bh) throws IOException {
bh.consume(rangeQuery(indexSearcherWithDocValuesSkipper, BASE_TIMESTAMP, rangeEndTimestamp(), false));
}
/**
* Runs the actual Lucene range query, optionally combining a {@link LongPoint} index query
* with doc values ({@link SortedNumericDocValuesField}) via {@link IndexOrDocValuesQuery},
* and then wrapping it with an {@link IndexSortSortedNumericDocValuesRangeQuery} to utilize the index sort.
*
* @param searcher the Lucene {@link IndexSearcher}
* @param rangeStartTimestamp lower bound of the timestamp range
* @param rangeEndTimestamp upper bound of the timestamp range
* @param isIndexed true if we should combine indexed and doc value queries
* @return the total number of matching documents
* @throws IOException if a search error occurs
*/
private long rangeQuery(final IndexSearcher searcher, long rangeStartTimestamp, long rangeEndTimestamp, boolean isIndexed)
throws IOException {
assert rangeEndTimestamp > rangeStartTimestamp;
final Query rangeQuery = isIndexed
? new IndexOrDocValuesQuery(
LongPoint.newRangeQuery(TIMESTAMP_FIELD, rangeStartTimestamp, rangeEndTimestamp),
SortedNumericDocValuesField.newSlowRangeQuery(TIMESTAMP_FIELD, rangeStartTimestamp, rangeEndTimestamp)
)
: SortedNumericDocValuesField.newSlowRangeQuery(TIMESTAMP_FIELD, rangeStartTimestamp, rangeEndTimestamp);
final Query query = new IndexSortSortedNumericDocValuesRangeQuery(
TIMESTAMP_FIELD,
rangeStartTimestamp,
rangeEndTimestamp,
rangeQuery
);
return searcher.count(query);
}
/**
* Shuts down the executor service after the trial completes.
*/
@TearDown(Level.Trial)
public void tearDown() {
if (executorService != null) {
executorService.shutdown();
try {
if (executorService.awaitTermination(30, TimeUnit.SECONDS) == false) {
executorService.shutdownNow();
}
} catch (InterruptedException e) {
executorService.shutdownNow();
Thread.currentThread().interrupt();
}
}
}
}

View file

@ -10,10 +10,14 @@
package org.elasticsearch.benchmark.vector;
import org.apache.lucene.util.BytesRef;
import org.elasticsearch.common.logging.LogConfigurator;
import org.elasticsearch.index.IndexVersion;
import org.elasticsearch.script.field.vectors.BinaryDenseVector;
import org.elasticsearch.script.field.vectors.BitBinaryDenseVector;
import org.elasticsearch.script.field.vectors.BitKnnDenseVector;
import org.elasticsearch.script.field.vectors.ByteBinaryDenseVector;
import org.elasticsearch.script.field.vectors.ByteKnnDenseVector;
import org.elasticsearch.script.field.vectors.DenseVector;
import org.elasticsearch.script.field.vectors.KnnDenseVector;
import org.openjdk.jmh.annotations.Benchmark;
import org.openjdk.jmh.annotations.BenchmarkMode;
@ -27,475 +31,210 @@ import org.openjdk.jmh.annotations.Scope;
import org.openjdk.jmh.annotations.Setup;
import org.openjdk.jmh.annotations.State;
import org.openjdk.jmh.annotations.Warmup;
import org.openjdk.jmh.infra.Blackhole;
import java.io.IOException;
import java.nio.ByteBuffer;
import java.util.Random;
import java.util.concurrent.TimeUnit;
import java.util.function.Consumer;
import java.util.function.DoubleSupplier;
/**
* Various benchmarks for the distance functions
* used by indexed and non-indexed vectors.
* Parameters include element, dims, function, and type.
* Various benchmarks for the distance functions used by indexed and non-indexed vectors.
* Parameters include doc and query type, dims, function, and implementation.
* For individual local tests it may be useful to increase
* fork, measurement, and operations per invocation. (Note
* to also update the benchmark loop if operations per invocation
* is increased.)
* fork, measurement, and operations per invocation.
*/
@Fork(1)
@Warmup(iterations = 1)
@Measurement(iterations = 2)
@BenchmarkMode(Mode.AverageTime)
@OutputTimeUnit(TimeUnit.NANOSECONDS)
@OperationsPerInvocation(25000)
@OperationsPerInvocation(DistanceFunctionBenchmark.OPERATIONS)
@State(Scope.Benchmark)
public class DistanceFunctionBenchmark {
@Param({ "float", "byte" })
private String element;
public static final int OPERATIONS = 25000;
@Param({ "96" })
static {
LogConfigurator.configureESLogging();
}
public enum VectorType {
FLOAT,
BYTE,
BIT
}
public enum Function {
DOT,
COSINE,
L1,
L2,
HAMMING
}
public enum Implementation {
KNN,
BINARY
}
@Param
private VectorType docType;
@Param
private VectorType queryType;
@Param({ "1024" })
private int dims;
@Param({ "dot", "cosine", "l1", "l2", "hamming" })
private String function;
@Param
private Function function;
@Param({ "knn", "binary" })
private String type;
@Param
private Implementation type;
private abstract static class BenchmarkFunction {
private DoubleSupplier benchmarkImpl;
final int dims;
private BenchmarkFunction(int dims) {
this.dims = dims;
private static float calculateMag(float[] vector) {
float mag = 0;
for (float f : vector) {
mag += f * f;
}
abstract void execute(Consumer<Object> consumer);
return (float) Math.sqrt(mag);
}
private abstract static class KnnFloatBenchmarkFunction extends BenchmarkFunction {
final float[] docVector;
final float[] queryVector;
private KnnFloatBenchmarkFunction(int dims, boolean normalize) {
super(dims);
docVector = new float[dims];
queryVector = new float[dims];
float docMagnitude = 0f;
float queryMagnitude = 0f;
for (int i = 0; i < dims; ++i) {
docVector[i] = (float) (dims - i);
queryVector[i] = (float) i;
docMagnitude += (float) (dims - i);
queryMagnitude += (float) i;
}
docMagnitude /= dims;
queryMagnitude /= dims;
if (normalize) {
for (int i = 0; i < dims; ++i) {
docVector[i] /= docMagnitude;
queryVector[i] /= queryMagnitude;
}
}
private static float calculateMag(byte[] vector) {
float mag = 0;
for (byte b : vector) {
mag += b * b;
}
return (float) Math.sqrt(mag);
}
private abstract static class BinaryFloatBenchmarkFunction extends BenchmarkFunction {
final BytesRef docVector;
final float[] docFloatVector;
final float[] queryVector;
private BinaryFloatBenchmarkFunction(int dims, boolean normalize) {
super(dims);
docFloatVector = new float[dims];
queryVector = new float[dims];
float docMagnitude = 0f;
float queryMagnitude = 0f;
for (int i = 0; i < dims; ++i) {
docFloatVector[i] = (float) (dims - i);
queryVector[i] = (float) i;
docMagnitude += (float) (dims - i);
queryMagnitude += (float) i;
}
docMagnitude /= dims;
queryMagnitude /= dims;
ByteBuffer byteBuffer = ByteBuffer.allocate(dims * 4 + 4);
for (int i = 0; i < dims; ++i) {
if (normalize) {
docFloatVector[i] /= docMagnitude;
queryVector[i] /= queryMagnitude;
}
byteBuffer.putFloat(docFloatVector[i]);
}
byteBuffer.putFloat(docMagnitude);
this.docVector = new BytesRef(byteBuffer.array());
private static float normalizeVector(float[] vector) {
float mag = calculateMag(vector);
for (int i = 0; i < vector.length; i++) {
vector[i] /= mag;
}
return mag;
}
private abstract static class KnnByteBenchmarkFunction extends BenchmarkFunction {
final byte[] docVector;
final byte[] queryVector;
final float queryMagnitude;
private KnnByteBenchmarkFunction(int dims) {
super(dims);
ByteBuffer docVector = ByteBuffer.allocate(dims);
queryVector = new byte[dims];
float queryMagnitude = 0f;
for (int i = 0; i < dims; ++i) {
docVector.put((byte) (dims - i));
queryVector[i] = (byte) i;
queryMagnitude += (float) i;
}
this.docVector = docVector.array();
this.queryMagnitude = queryMagnitude / dims;
}
private static BytesRef generateVectorData(float[] vector) {
return generateVectorData(vector, calculateMag(vector));
}
private abstract static class BinaryByteBenchmarkFunction extends BenchmarkFunction {
final BytesRef docVector;
final byte[] vectorValue;
final byte[] queryVector;
final float queryMagnitude;
private BinaryByteBenchmarkFunction(int dims) {
super(dims);
ByteBuffer docVector = ByteBuffer.allocate(dims + 4);
queryVector = new byte[dims];
vectorValue = new byte[dims];
float docMagnitude = 0f;
float queryMagnitude = 0f;
for (int i = 0; i < dims; ++i) {
docVector.put((byte) (dims - i));
vectorValue[i] = (byte) (dims - i);
queryVector[i] = (byte) i;
docMagnitude += (float) (dims - i);
queryMagnitude += (float) i;
}
docVector.putFloat(docMagnitude / dims);
this.docVector = new BytesRef(docVector.array());
this.queryMagnitude = queryMagnitude / dims;
private static BytesRef generateVectorData(float[] vector, float mag) {
ByteBuffer buffer = ByteBuffer.allocate(vector.length * Float.BYTES + Float.BYTES);
for (float f : vector) {
buffer.putFloat(f);
}
buffer.putFloat(mag);
return new BytesRef(buffer.array());
}
private static class DotKnnFloatBenchmarkFunction extends KnnFloatBenchmarkFunction {
private static BytesRef generateVectorData(byte[] vector) {
float mag = calculateMag(vector);
private DotKnnFloatBenchmarkFunction(int dims) {
super(dims, false);
}
@Override
public void execute(Consumer<Object> consumer) {
new KnnDenseVector(docVector).dotProduct(queryVector);
}
ByteBuffer buffer = ByteBuffer.allocate(vector.length + Float.BYTES);
buffer.put(vector);
buffer.putFloat(mag);
return new BytesRef(buffer.array());
}
private static class DotKnnByteBenchmarkFunction extends KnnByteBenchmarkFunction {
private DotKnnByteBenchmarkFunction(int dims) {
super(dims);
}
@Override
public void execute(Consumer<Object> consumer) {
new ByteKnnDenseVector(docVector).dotProduct(queryVector);
}
}
private static class DotBinaryFloatBenchmarkFunction extends BinaryFloatBenchmarkFunction {
private DotBinaryFloatBenchmarkFunction(int dims) {
super(dims, false);
}
@Override
public void execute(Consumer<Object> consumer) {
new BinaryDenseVector(docFloatVector, docVector, dims, IndexVersion.current()).dotProduct(queryVector);
}
}
private static class DotBinaryByteBenchmarkFunction extends BinaryByteBenchmarkFunction {
private DotBinaryByteBenchmarkFunction(int dims) {
super(dims);
}
@Override
public void execute(Consumer<Object> consumer) {
new ByteBinaryDenseVector(vectorValue, docVector, dims).dotProduct(queryVector);
}
}
private static class CosineKnnFloatBenchmarkFunction extends KnnFloatBenchmarkFunction {
private CosineKnnFloatBenchmarkFunction(int dims) {
super(dims, true);
}
@Override
public void execute(Consumer<Object> consumer) {
new KnnDenseVector(docVector).cosineSimilarity(queryVector, false);
}
}
private static class CosineKnnByteBenchmarkFunction extends KnnByteBenchmarkFunction {
private CosineKnnByteBenchmarkFunction(int dims) {
super(dims);
}
@Override
public void execute(Consumer<Object> consumer) {
new ByteKnnDenseVector(docVector).cosineSimilarity(queryVector, queryMagnitude);
}
}
private static class CosineBinaryFloatBenchmarkFunction extends BinaryFloatBenchmarkFunction {
private CosineBinaryFloatBenchmarkFunction(int dims) {
super(dims, true);
}
@Override
public void execute(Consumer<Object> consumer) {
new BinaryDenseVector(docFloatVector, docVector, dims, IndexVersion.current()).cosineSimilarity(queryVector, false);
}
}
private static class CosineBinaryByteBenchmarkFunction extends BinaryByteBenchmarkFunction {
private CosineBinaryByteBenchmarkFunction(int dims) {
super(dims);
}
@Override
public void execute(Consumer<Object> consumer) {
new ByteBinaryDenseVector(vectorValue, docVector, dims).cosineSimilarity(queryVector, queryMagnitude);
}
}
private static class L1KnnFloatBenchmarkFunction extends KnnFloatBenchmarkFunction {
private L1KnnFloatBenchmarkFunction(int dims) {
super(dims, false);
}
@Override
public void execute(Consumer<Object> consumer) {
new KnnDenseVector(docVector).l1Norm(queryVector);
}
}
private static class L1KnnByteBenchmarkFunction extends KnnByteBenchmarkFunction {
private L1KnnByteBenchmarkFunction(int dims) {
super(dims);
}
@Override
public void execute(Consumer<Object> consumer) {
new ByteKnnDenseVector(docVector).l1Norm(queryVector);
}
}
private static class HammingKnnByteBenchmarkFunction extends KnnByteBenchmarkFunction {
private HammingKnnByteBenchmarkFunction(int dims) {
super(dims);
}
@Override
public void execute(Consumer<Object> consumer) {
new ByteKnnDenseVector(docVector).hamming(queryVector);
}
}
private static class L1BinaryFloatBenchmarkFunction extends BinaryFloatBenchmarkFunction {
private L1BinaryFloatBenchmarkFunction(int dims) {
super(dims, true);
}
@Override
public void execute(Consumer<Object> consumer) {
new BinaryDenseVector(docFloatVector, docVector, dims, IndexVersion.current()).l1Norm(queryVector);
}
}
private static class L1BinaryByteBenchmarkFunction extends BinaryByteBenchmarkFunction {
private L1BinaryByteBenchmarkFunction(int dims) {
super(dims);
}
@Override
public void execute(Consumer<Object> consumer) {
new ByteBinaryDenseVector(vectorValue, docVector, dims).l1Norm(queryVector);
}
}
private static class HammingBinaryByteBenchmarkFunction extends BinaryByteBenchmarkFunction {
private HammingBinaryByteBenchmarkFunction(int dims) {
super(dims);
}
@Override
public void execute(Consumer<Object> consumer) {
new ByteBinaryDenseVector(vectorValue, docVector, dims).hamming(queryVector);
}
}
private static class L2KnnFloatBenchmarkFunction extends KnnFloatBenchmarkFunction {
private L2KnnFloatBenchmarkFunction(int dims) {
super(dims, false);
}
@Override
public void execute(Consumer<Object> consumer) {
new KnnDenseVector(docVector).l2Norm(queryVector);
}
}
private static class L2KnnByteBenchmarkFunction extends KnnByteBenchmarkFunction {
private L2KnnByteBenchmarkFunction(int dims) {
super(dims);
}
@Override
public void execute(Consumer<Object> consumer) {
new ByteKnnDenseVector(docVector).l2Norm(queryVector);
}
}
private static class L2BinaryFloatBenchmarkFunction extends BinaryFloatBenchmarkFunction {
private L2BinaryFloatBenchmarkFunction(int dims) {
super(dims, true);
}
@Override
public void execute(Consumer<Object> consumer) {
new BinaryDenseVector(docFloatVector, docVector, dims, IndexVersion.current()).l1Norm(queryVector);
}
}
private static class L2BinaryByteBenchmarkFunction extends BinaryByteBenchmarkFunction {
private L2BinaryByteBenchmarkFunction(int dims) {
super(dims);
}
@Override
public void execute(Consumer<Object> consumer) {
consumer.accept(new ByteBinaryDenseVector(vectorValue, docVector, dims).l2Norm(queryVector));
}
}
private BenchmarkFunction benchmarkFunction;
@Setup
public void setBenchmarkFunction() {
switch (element) {
case "float" -> {
switch (function) {
case "dot" -> benchmarkFunction = switch (type) {
case "knn" -> new DotKnnFloatBenchmarkFunction(dims);
case "binary" -> new DotBinaryFloatBenchmarkFunction(dims);
default -> throw new UnsupportedOperationException("unexpected type [" + type + "]");
};
case "cosine" -> benchmarkFunction = switch (type) {
case "knn" -> new CosineKnnFloatBenchmarkFunction(dims);
case "binary" -> new CosineBinaryFloatBenchmarkFunction(dims);
default -> throw new UnsupportedOperationException("unexpected type [" + type + "]");
};
case "l1" -> benchmarkFunction = switch (type) {
case "knn" -> new L1KnnFloatBenchmarkFunction(dims);
case "binary" -> new L1BinaryFloatBenchmarkFunction(dims);
default -> throw new UnsupportedOperationException("unexpected type [" + type + "]");
};
case "l2" -> benchmarkFunction = switch (type) {
case "knn" -> new L2KnnFloatBenchmarkFunction(dims);
case "binary" -> new L2BinaryFloatBenchmarkFunction(dims);
default -> throw new UnsupportedOperationException("unexpected type [" + type + "]");
};
default -> throw new UnsupportedOperationException("unexpected function [" + function + "]");
}
}
case "byte" -> {
switch (function) {
case "dot" -> benchmarkFunction = switch (type) {
case "knn" -> new DotKnnByteBenchmarkFunction(dims);
case "binary" -> new DotBinaryByteBenchmarkFunction(dims);
default -> throw new UnsupportedOperationException("unexpected type [" + type + "]");
};
case "cosine" -> benchmarkFunction = switch (type) {
case "knn" -> new CosineKnnByteBenchmarkFunction(dims);
case "binary" -> new CosineBinaryByteBenchmarkFunction(dims);
default -> throw new UnsupportedOperationException("unexpected type [" + type + "]");
};
case "l1" -> benchmarkFunction = switch (type) {
case "knn" -> new L1KnnByteBenchmarkFunction(dims);
case "binary" -> new L1BinaryByteBenchmarkFunction(dims);
default -> throw new UnsupportedOperationException("unexpected type [" + type + "]");
};
case "l2" -> benchmarkFunction = switch (type) {
case "knn" -> new L2KnnByteBenchmarkFunction(dims);
case "binary" -> new L2BinaryByteBenchmarkFunction(dims);
default -> throw new UnsupportedOperationException("unexpected type [" + type + "]");
};
case "hamming" -> benchmarkFunction = switch (type) {
case "knn" -> new HammingKnnByteBenchmarkFunction(dims);
case "binary" -> new HammingBinaryByteBenchmarkFunction(dims);
default -> throw new UnsupportedOperationException("unexpected type [" + type + "]");
};
default -> throw new UnsupportedOperationException("unexpected function [" + function + "]");
}
}
default -> throw new UnsupportedOperationException("unexpected element [" + element + "]");
public void findBenchmarkImpl() {
if (dims % 8 != 0) throw new IllegalArgumentException("Dims must be a multiple of 8");
Random r = new Random();
float[] floatDocVector = new float[dims];
byte[] byteDocVector = new byte[dims];
byte[] bitDocVector = new byte[dims / 8];
float[] floatQueryVector = new float[dims];
byte[] byteQueryVector = new byte[dims];
byte[] bitQueryVector = new byte[dims / 8];
r.nextBytes(byteDocVector);
r.nextBytes(bitDocVector);
r.nextBytes(byteQueryVector);
r.nextBytes(bitQueryVector);
for (int i = 0; i < dims; i++) {
floatDocVector[i] = r.nextFloat();
floatQueryVector[i] = r.nextFloat();
}
;
DenseVector vectorImpl = switch (docType) {
case FLOAT -> switch (type) {
case KNN -> {
if (function == Function.COSINE) {
normalizeVector(floatDocVector);
normalizeVector(floatQueryVector);
}
yield new KnnDenseVector(floatDocVector);
}
case BINARY -> {
BytesRef vectorData;
if (function == Function.COSINE || function == Function.L1 || function == Function.L2) {
float mag = normalizeVector(floatDocVector);
vectorData = generateVectorData(floatDocVector, mag);
normalizeVector(floatQueryVector);
} else {
vectorData = generateVectorData(floatDocVector);
}
yield new BinaryDenseVector(floatDocVector, vectorData, dims, IndexVersion.current());
}
};
case BYTE -> switch (type) {
case KNN -> new ByteKnnDenseVector(byteDocVector);
case BINARY -> new ByteBinaryDenseVector(byteDocVector, generateVectorData(byteDocVector), dims);
};
case BIT -> switch (type) {
case KNN -> new BitKnnDenseVector(bitDocVector);
case BINARY -> new BitBinaryDenseVector(bitDocVector, new BytesRef(bitDocVector), bitDocVector.length);
};
};
benchmarkImpl = switch (queryType) {
case FLOAT -> switch (function) {
case DOT -> () -> vectorImpl.dotProduct(floatQueryVector);
case COSINE -> () -> vectorImpl.cosineSimilarity(floatQueryVector, false);
case L1 -> () -> vectorImpl.l1Norm(floatQueryVector);
case L2 -> () -> vectorImpl.l2Norm(floatQueryVector);
case HAMMING -> throw new UnsupportedOperationException("Unsupported function " + function);
};
case BYTE -> switch (function) {
case DOT -> () -> vectorImpl.dotProduct(byteQueryVector);
case COSINE -> {
float mag = calculateMag(byteQueryVector);
yield () -> vectorImpl.cosineSimilarity(byteQueryVector, mag);
}
case L1 -> () -> vectorImpl.l1Norm(byteQueryVector);
case L2 -> () -> vectorImpl.l2Norm(byteQueryVector);
case HAMMING -> () -> vectorImpl.hamming(byteQueryVector);
};
case BIT -> switch (function) {
case DOT -> () -> vectorImpl.dotProduct(bitQueryVector);
case COSINE -> throw new UnsupportedOperationException("Unsupported function " + function);
case L1 -> () -> vectorImpl.l1Norm(bitQueryVector);
case L2 -> () -> vectorImpl.l2Norm(bitQueryVector);
case HAMMING -> () -> vectorImpl.hamming(bitQueryVector);
};
};
}
@Fork(1)
@Benchmark
public void benchmark() throws IOException {
for (int i = 0; i < 25000; ++i) {
benchmarkFunction.execute(Object::toString);
public void benchmark(Blackhole blackhole) {
for (int i = 0; i < OPERATIONS; ++i) {
blackhole.consume(benchmarkImpl.getAsDouble());
}
}
@Fork(value = 1, jvmArgsPrepend = { "--add-modules=jdk.incubator.vector" })
@Benchmark
public void vectorBenchmark(Blackhole blackhole) {
for (int i = 0; i < OPERATIONS; ++i) {
blackhole.consume(benchmarkImpl.getAsDouble());
}
}
}

View file

@ -19,6 +19,7 @@ import org.apache.lucene.store.IndexOutput;
import org.apache.lucene.store.MMapDirectory;
import org.apache.lucene.util.hnsw.RandomVectorScorer;
import org.apache.lucene.util.hnsw.RandomVectorScorerSupplier;
import org.apache.lucene.util.hnsw.UpdateableRandomVectorScorer;
import org.apache.lucene.util.quantization.QuantizedByteVectorValues;
import org.apache.lucene.util.quantization.ScalarQuantizer;
import org.elasticsearch.common.logging.LogConfigurator;
@ -76,10 +77,10 @@ public class VectorScorerBenchmark {
float vec2Offset;
float scoreCorrectionConstant;
RandomVectorScorer luceneDotScorer;
RandomVectorScorer luceneSqrScorer;
RandomVectorScorer nativeDotScorer;
RandomVectorScorer nativeSqrScorer;
UpdateableRandomVectorScorer luceneDotScorer;
UpdateableRandomVectorScorer luceneSqrScorer;
UpdateableRandomVectorScorer nativeDotScorer;
UpdateableRandomVectorScorer nativeSqrScorer;
RandomVectorScorer luceneDotScorerQuery;
RandomVectorScorer nativeDotScorerQuery;
@ -118,12 +119,16 @@ public class VectorScorerBenchmark {
in = dir.openInput("vector.data", IOContext.DEFAULT);
var values = vectorValues(dims, 2, in, VectorSimilarityFunction.DOT_PRODUCT);
scoreCorrectionConstant = values.getScalarQuantizer().getConstantMultiplier();
luceneDotScorer = luceneScoreSupplier(values, VectorSimilarityFunction.DOT_PRODUCT).scorer(0);
luceneDotScorer = luceneScoreSupplier(values, VectorSimilarityFunction.DOT_PRODUCT).scorer();
luceneDotScorer.setScoringOrdinal(0);
values = vectorValues(dims, 2, in, VectorSimilarityFunction.EUCLIDEAN);
luceneSqrScorer = luceneScoreSupplier(values, VectorSimilarityFunction.EUCLIDEAN).scorer(0);
luceneSqrScorer = luceneScoreSupplier(values, VectorSimilarityFunction.EUCLIDEAN).scorer();
luceneSqrScorer.setScoringOrdinal(0);
nativeDotScorer = factory.getInt7SQVectorScorerSupplier(DOT_PRODUCT, in, values, scoreCorrectionConstant).get().scorer(0);
nativeSqrScorer = factory.getInt7SQVectorScorerSupplier(EUCLIDEAN, in, values, scoreCorrectionConstant).get().scorer(0);
nativeDotScorer = factory.getInt7SQVectorScorerSupplier(DOT_PRODUCT, in, values, scoreCorrectionConstant).get().scorer();
nativeDotScorer.setScoringOrdinal(0);
nativeSqrScorer = factory.getInt7SQVectorScorerSupplier(EUCLIDEAN, in, values, scoreCorrectionConstant).get().scorer();
nativeSqrScorer.setScoringOrdinal(0);
// setup for getInt7SQVectorScorer / query vector scoring
float[] queryVec = new float[dims];

View file

@ -0,0 +1,18 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the "Elastic License
* 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side
* Public License v 1"; you may not use this file except in compliance with, at
* your election, the "Elastic License 2.0", the "GNU Affero General Public
* License v3.0 only", or the "Server Side Public License, v 1".
*/
package org.elasticsearch.benchmark.compute.operator;
import org.elasticsearch.test.ESTestCase;
public class AggregatorBenchmarkTests extends ESTestCase {
public void test() {
AggregatorBenchmark.selfTest();
}
}

View file

@ -0,0 +1,18 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the "Elastic License
* 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side
* Public License v 1"; you may not use this file except in compliance with, at
* your election, the "Elastic License 2.0", the "GNU Affero General Public
* License v3.0 only", or the "Server Side Public License, v 1".
*/
package org.elasticsearch.benchmark.compute.operator;
import org.elasticsearch.test.ESTestCase;
public class BlockKeepMaskBenchmarkTests extends ESTestCase {
public void test() {
BlockKeepMaskBenchmark.selfTest();
}
}

View file

@ -0,0 +1,18 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the "Elastic License
* 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side
* Public License v 1"; you may not use this file except in compliance with, at
* your election, the "Elastic License 2.0", the "GNU Affero General Public
* License v3.0 only", or the "Server Side Public License, v 1".
*/
package org.elasticsearch.benchmark.compute.operator;
import org.elasticsearch.test.ESTestCase;
public class BlockReadBenchmarkTests extends ESTestCase {
public void test() {
BlockKeepMaskBenchmark.selfTest();
}
}

View file

@ -0,0 +1,18 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the "Elastic License
* 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side
* Public License v 1"; you may not use this file except in compliance with, at
* your election, the "Elastic License 2.0", the "GNU Affero General Public
* License v3.0 only", or the "Server Side Public License, v 1".
*/
package org.elasticsearch.benchmark.compute.operator;
import org.elasticsearch.test.ESTestCase;
public class EvalBenchmarkTests extends ESTestCase {
public void test() {
EvalBenchmark.selfTest();
}
}

View file

@ -0,0 +1,18 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the "Elastic License
* 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side
* Public License v 1"; you may not use this file except in compliance with, at
* your election, the "Elastic License 2.0", the "GNU Affero General Public
* License v3.0 only", or the "Server Side Public License, v 1".
*/
package org.elasticsearch.benchmark.compute.operator;
import org.elasticsearch.test.ESTestCase;
public class TopNBenchmarkTests extends ESTestCase {
public void test() {
TopNBenchmark.selfTest();
}
}

View file

@ -0,0 +1,18 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the "Elastic License
* 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side
* Public License v 1"; you may not use this file except in compliance with, at
* your election, the "Elastic License 2.0", the "GNU Affero General Public
* License v3.0 only", or the "Server Side Public License, v 1".
*/
package org.elasticsearch.benchmark.compute.operator;
import org.elasticsearch.test.ESTestCase;
public class ValuesAggregatorBenchmarkTests extends ESTestCase {
public void test() {
ValuesAggregatorBenchmark.selfTest();
}
}

View file

@ -0,0 +1,18 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the "Elastic License
* 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side
* Public License v 1"; you may not use this file except in compliance with, at
* your election, the "Elastic License 2.0", the "GNU Affero General Public
* License v3.0 only", or the "Server Side Public License, v 1".
*/
package org.elasticsearch.benchmark.compute.operator;
import org.elasticsearch.test.ESTestCase;
public class ValuesSourceReaderBenchmarkTests extends ESTestCase {
public void test() {
ValuesSourceReaderBenchmark.selfTest();
}
}

View file

@ -5,7 +5,7 @@
"branch": "main"
},
{
"branch": "8.16"
"branch": "9.0"
},
{
"branch": "8.18"

View file

@ -6,6 +6,11 @@
* your election, the "Elastic License 2.0", the "GNU Affero General Public
* License v3.0 only", or the "Server Side Public License, v 1".
*/
plugins {
id "com.gradle.develocity" version "3.19.2"
}
rootProject.name = 'build-conventions'
dependencyResolutionManagement {

View file

@ -15,6 +15,7 @@ import org.gradle.api.GradleException;
import org.gradle.api.Plugin;
import org.gradle.api.Project;
import org.gradle.api.Transformer;
import org.gradle.api.invocation.Gradle;
import org.gradle.api.plugins.JavaBasePlugin;
import org.gradle.api.plugins.JavaPluginExtension;
import org.gradle.api.tasks.Copy;
@ -38,6 +39,15 @@ public class EclipseConventionPlugin implements Plugin<Project> {
@Override
public void apply(Project project) {
project.getPlugins().apply(EclipsePlugin.class);
Gradle gradle = project.getGradle();
boolean isEclipse = project.getProviders().systemProperty("eclipse.launcher").isPresent() || // Gradle launched from Eclipse
project.getProviders().systemProperty("eclipse.application").isPresent() || // Gradle launched from the Eclipse compiler server
gradle.getStartParameter().getTaskNames().contains("eclipse") || // Gradle launched from the command line to do eclipse stuff
gradle.getStartParameter().getTaskNames().contains("cleanEclipse");
// for eclipse ide specific hacks...
project.getExtensions().add("isEclipse", isEclipse);
EclipseModel eclipseModel = project.getExtensions().getByType(EclipseModel.class);
EclipseProject eclipseProject = eclipseModel.getProject();

View file

@ -282,8 +282,6 @@ dependencies {
api "org.elasticsearch:build-conventions:$version"
api "org.elasticsearch.gradle:build-tools:$version"
// same version as http client transitive dep
api buildLibs.commons.codec
api buildLibs.apache.compress
api buildLibs.nebula.info
api buildLibs.apache.rat
@ -303,8 +301,8 @@ dependencies {
api buildLibs.antlrst4
api buildLibs.asm
api buildLibs.asm.tree
api buildLibs.httpclient
api buildLibs.httpcore
api buildLibs.httpclient5
api buildLibs.httpcore5
compileOnly buildLibs.checkstyle
compileOnly buildLibs.reflections

View file

@ -1,7 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionSha256Sum=296742a352f0b20ec14b143fb684965ad66086c7810b7b255dee216670716175
distributionUrl=https\://services.gradle.org/distributions/gradle-8.12.1-all.zip
distributionSha256Sum=fba8464465835e74f7270bbf43d6d8a8d7709ab0a43ce1aa3323f73e9aa0c612
distributionUrl=https\://services.gradle.org/distributions/gradle-8.13-all.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME

View file

@ -1,72 +0,0 @@
// ensure branch scenario is listed first as this is the gradle version that will picked for inspecting the build
default-scenarios = ["buildConfiguration_branch", "buildConfiguration_main", "single_project_branch", "single_project_main"]
buildConfiguration_main {
title = "configuration phase (main)"
versions = ["@mainWrapper@"]
tasks = ["help"]
gradle-args = ["--no-scan", "--no-build-cache", "--stacktrace"]
run-using = cli // value can be "cli" or "tooling-api"
daemon = warm // value can be "warm", "cold", or "none"
warm-ups = 5
iterations = 10
system-properties {
"BUILD_PERFORMANCE_TEST" = "true"
}
git-checkout = {
build = "main"
}
}
buildConfiguration_branch {
title = "configuration phase (@testGitCommit@)"
versions = ["@branchWrapper@"]
tasks = ["help"]
gradle-args = ["--no-scan", "--no-build-cache", "--stacktrace"]
run-using = cli // value can be "cli" or "tooling-api"
daemon = warm // value can be "warm", "cold", or "none"
warm-ups = 5
iterations = 10
system-properties {
"BUILD_PERFORMANCE_TEST" = "true"
}
git-checkout = {
build = "@testGitCommit@"
}
}
single_project_main {
title = "single project (main)"
versions = ["@mainWrapper@"]
tasks = [":server:precommit"]
gradle-args = ["--no-scan", "--stacktrace"]
apply-abi-change-to = "server/src/main/java/org/elasticsearch/bootstrap/BootstrapInfo.java"
run-using = cli // value can be "cli" or "tooling-api"
daemon = warm // value can be "warm", "cold", or "none"
warm-ups = 5
iterations = 10
system-properties {
"BUILD_PERFORMANCE_TEST" = "true"
}
git-checkout = {
build = "main"
}
}
single_project_branch {
title = "single project (@testGitCommit@)"
versions = ["@branchWrapper@"]
tasks = [":server:precommit"]
gradle-args = ["--no-scan", "--stacktrace"]
apply-abi-change-to = "server/src/main/java/org/elasticsearch/bootstrap/BootstrapInfo.java"
run-using = cli // value can be "cli" or "tooling-api"
daemon = warm // value can be "warm", "cold", or "none"
warm-ups = 5
iterations = 10
system-properties {
"BUILD_PERFORMANCE_TEST" = "true"
}
git-checkout = {
build = "@testGitCommit@"
}
}

View file

@ -1,38 +0,0 @@
// ensure branch scenario is listed first as this is the gradle version that will picked for inspecting the build
default-scenarios = ["precommit_branch", "precommit_main"]
precommit_main {
title = "precommit (main)"
versions = ["@mainWrapper@"]
cleanup-tasks = ["clean"]
tasks = ["precommit"]
gradle-args = ["--no-scan", "--no-build-cache", "--stacktrace"]
run-using = cli // value can be "cli" or "tooling-api"
daemon = warm // value can be "warm", "cold", or "none"
warm-ups = 5
iterations = 10
system-properties {
"BUILD_PERFORMANCE_TEST" = "true"
}
git-checkout = {
build = "main"
}
}
precommit_branch {
title = "precommit (@testGitCommit@)"
versions = ["@branchWrapper@"]
cleanup-tasks = ["clean"]
tasks = ["precommit"]
gradle-args = ["--no-scan", "--no-build-cache", "--stacktrace"]
run-using = cli // value can be "cli" or "tooling-api"
daemon = warm // value can be "warm", "cold", or "none"
warm-ups = 5
iterations = 10
system-properties {
"BUILD_PERFORMANCE_TEST" = "true"
}
git-checkout = {
build = "@testGitCommit@"
}
}

View file

@ -0,0 +1,118 @@
default-scenarios = ["TEST_ESQL_ABI_CHANGE_TAPI", TEST_ESQL_ABI_CHANGE_TAPI_MAIN, "TEST_ESQL_ABI_CHANGE_TAPI_CC", "TEST_ESQL_ABI_CHANGE_TAPI_CC_NOINIT", "TEST_ESQL_ABI_CHANGE_TAPI_CC_MAIN", "TEST_ESQL_ABI_CHANGE_TAPI_CC_NOINIT_MAIN"]
TEST_ESQL_ABI_CHANGE_TAPI {
apply-abi-change-to = "x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/action/ColumnInfoImpl.java"
tasks = [":x-pack:plugin:esql:test", "--tests", "org.elasticsearch.gradle.benchmarking.BenchmarkingTests"]
gradle-args = ["-I", ".ci/init.gradle"]
run-using = tooling-api // value can be "cli" or "tooling-api"
daemon = warm // value can be "warm", "cold", or "none"
copy-file = {
source = "build-tools-internal/performance/test-files/BenchmarkingTests.java"
target = "x-pack/plugin/esql/src/test/java/org/elasticsearch/gradle/benchmarking/BenchmarkingTests.java"
schedule = SCENARIO
}
git-checkout = {
cleanup = "@testGitCommit@"
build = "@testGitCommit@"
}
warm-ups = 3
iterations = 10
}
TEST_ESQL_ABI_CHANGE_TAPI_CC {
apply-abi-change-to = "x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/action/ColumnInfoImpl.java"
tasks = [":x-pack:plugin:esql:test", "--tests", "org.elasticsearch.gradle.benchmarking.BenchmarkingTests"]
gradle-args = ["--configuration-cache", "-I", ".ci/init.gradle"]
run-using = tooling-api // value can be "cli" or "tooling-api"
daemon = warm // value can be "warm", "cold", or "none"
copy-file = {
source = "build-tools-internal/performance/test-files/BenchmarkingTests.java"
target = "x-pack/plugin/esql/src/test/java/org/elasticsearch/gradle/benchmarking/BenchmarkingTests.java"
schedule = SCENARIO
}
git-checkout = {
cleanup = "@testGitCommit@"
build = "@testGitCommit@"
}
warm-ups = 3
iterations = 10
}
TEST_ESQL_ABI_CHANGE_TAPI_CC_NOINIT {
apply-abi-change-to = "x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/action/ColumnInfoImpl.java"
tasks = [":x-pack:plugin:esql:test", "--tests", "org.elasticsearch.gradle.benchmarking.BenchmarkingTests"]
gradle-args = ["--configuration-cache"]
run-using = tooling-api // value can be "cli" or "tooling-api"
daemon = warm // value can be "warm", "cold", or "none"
copy-file = {
source = "build-tools-internal/performance/test-files/BenchmarkingTests.java"
target = "x-pack/plugin/esql/src/test/java/org/elasticsearch/gradle/benchmarking/BenchmarkingTests.java"
schedule = SCENARIO
}
git-checkout = {
cleanup = "@testGitCommit@"
build = "@testGitCommit@"
}
warm-ups = 3
iterations = 10
}
TEST_ESQL_ABI_CHANGE_TAPI_MAIN {
apply-abi-change-to = "x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/action/ColumnInfoImpl.java"
tasks = [":x-pack:plugin:esql:test", "--tests", "org.elasticsearch.gradle.benchmarking.BenchmarkingTests"]
gradle-args = ["-I", ".ci/init.gradle"]
run-using = tooling-api // value can be "cli" or "tooling-api"
daemon = warm // value can be "warm", "cold", or "none"
copy-file = {
source = "build-tools-internal/performance/test-files/BenchmarkingTests.java"
target = "x-pack/plugin/esql/src/test/java/org/elasticsearch/gradle/benchmarking/BenchmarkingTests.java"
schedule = SCENARIO
}
git-checkout = {
cleanup = "main"
build = "main"
}
warm-ups = 3
iterations = 10
}
TEST_ESQL_ABI_CHANGE_TAPI_CC_MAIN {
apply-abi-change-to = "x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/action/ColumnInfoImpl.java"
tasks = [":x-pack:plugin:esql:test", "--tests", "org.elasticsearch.gradle.benchmarking.BenchmarkingTests"]
gradle-args = ["--configuration-cache", "-I", ".ci/init.gradle"]
run-using = tooling-api // value can be "cli" or "tooling-api"
daemon = warm // value can be "warm", "cold", or "none"
copy-file = {
source = "build-tools-internal/performance/test-files/BenchmarkingTests.java"
target = "x-pack/plugin/esql/src/test/java/org/elasticsearch/gradle/benchmarking/BenchmarkingTests.java"
schedule = SCENARIO
}
git-checkout = {
cleanup = "main"
build = "main"
}
warm-ups = 3
iterations = 10
}
TEST_ESQL_ABI_CHANGE_TAPI_CC_NOINIT_MAIN {
apply-abi-change-to = "x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/action/ColumnInfoImpl.java"
tasks = [":x-pack:plugin:esql:test", "--tests", "org.elasticsearch.gradle.benchmarking.BenchmarkingTests"]
gradle-args = ["--configuration-cache"]
run-using = tooling-api // value can be "cli" or "tooling-api"
daemon = warm // value can be "warm", "cold", or "none"
copy-file = {
source = "build-tools-internal/performance/test-files/BenchmarkingTests.java"
target = "x-pack/plugin/esql/src/test/java/org/elasticsearch/gradle/benchmarking/BenchmarkingTests.java"
schedule = SCENARIO
}
git-checkout = {
cleanup = "main"
build = "main"
}
warm-ups = 3
iterations = 10
}

View file

@ -0,0 +1,17 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/
package org.elasticsearch.gradle.benchmarking;
import org.elasticsearch.test.ESTestCase;
public class BenchmarkingTests extends ESTestCase {
public void testBenchmarking() {
assertTrue(true);
}
}

View file

@ -5,7 +5,11 @@ pluginManagement {
}
includeBuild "../build-conventions"
includeBuild "../build-tools"
includeBuild "../build-tools"
}
plugins {
id "com.gradle.develocity" version "3.19.2"
}
dependencyResolutionManagement {

View file

@ -20,6 +20,22 @@ abstract class AbstractGradleInternalPluginFuncTest extends AbstractJavaGradleFu
plugins {
id 'elasticsearch.java-toolchain'
}
toolchainManagement {
jvm {
javaRepositories {
repository('bundledOracleOpendJdk') {
resolverClass = org.elasticsearch.gradle.internal.toolchain.OracleOpenJdkToolchainResolver
}
repository('adoptiumJdks') {
resolverClass = org.elasticsearch.gradle.internal.toolchain.AdoptiumJdkToolchainResolver
}
repository('archivedOracleJdks') {
resolverClass = org.elasticsearch.gradle.internal.toolchain.ArchivedOracleJdkToolchainResolver
}
}
}
}
""" + settingsFile.text
buildFile << """

View file

@ -13,6 +13,27 @@ package org.elasticsearch.gradle.fixtures;
abstract class AbstractRestResourcesFuncTest extends AbstractGradleFuncTest {
def setup() {
settingsFile.text = """
plugins {
id 'elasticsearch.java-toolchain'
}
toolchainManagement {
jvm {
javaRepositories {
repository('bundledOracleOpendJdk') {
resolverClass = org.elasticsearch.gradle.internal.toolchain.OracleOpenJdkToolchainResolver
}
repository('adoptiumJdks') {
resolverClass = org.elasticsearch.gradle.internal.toolchain.AdoptiumJdkToolchainResolver
}
repository('archivedOracleJdks') {
resolverClass = org.elasticsearch.gradle.internal.toolchain.ArchivedOracleJdkToolchainResolver
}
}
}
}
""" + settingsFile.text
subProject(":test:framework") << "apply plugin: 'elasticsearch.java'"
subProject(":test:test-clusters") << "apply plugin: 'elasticsearch.java'"
subProject(":test:yaml-rest-runner") << "apply plugin: 'elasticsearch.java'"

View file

@ -14,9 +14,55 @@ import org.gradle.testkit.runner.TaskOutcome
class ElasticsearchTestBasePluginFuncTest extends AbstractGradleFuncTest {
def setup() {
// see https://github.com/gradle/gradle/issues/24172
configurationCacheCompatible = false
def "can disable assertions via cmdline param"() {
given:
file("src/test/java/acme/SomeTests.java").text = """
public class SomeTests {
@org.junit.Test
public void testAsserts() {
assert false;
}
}
"""
buildFile.text = """
plugins {
id 'java'
id 'elasticsearch.test-base'
}
repositories {
mavenCentral()
}
dependencies {
testImplementation 'junit:junit:4.12'
}
"""
when:
def result = gradleRunner("test").buildAndFail()
then:
result.task(':test').outcome == TaskOutcome.FAILED
when:
result = gradleRunner("test", "-Dtests.asserts=false").build()
then:
result.task(':test').outcome == TaskOutcome.SUCCESS
when:
result = gradleRunner("test", "-Dtests.jvm.argline=-da").build()
then:
result.task(':test').outcome == TaskOutcome.SUCCESS
when:
result = gradleRunner("test", "-Dtests.jvm.argline=-disableassertions").build()
then:
result.task(':test').outcome == TaskOutcome.SUCCESS
when:
result = gradleRunner("test", "-Dtests.asserts=false", "-Dtests.jvm.argline=-da").build()
then:
result.task(':test').outcome == TaskOutcome.SUCCESS
}
def "can configure nonInputProperties for test tasks"() {

View file

@ -179,9 +179,9 @@ echo "Running elasticsearch \$0"
file(distProjectFolder, 'src/config/elasticsearch.properties') << "some propes"
file(distProjectFolder, 'src/config/jvm.options') << """
-Xlog:gc*,gc+age=trace,safepoint:file=logs/gc.log:utctime,level,pid,tags:filecount=32,filesize=64m
-XX:ErrorFile=logs/hs_err_pid%p.log
-XX:HeapDumpPath=data
-Xlog:gc*,gc+age=trace,safepoint:file=gc.log:utctime,level,pid,tags:filecount=32,filesize=64m
-XX:ErrorFile=hs_err_pid%p.log
# -XX:HeapDumpPath=/heap/dump/path
"""
file(distProjectFolder, 'build.gradle') << """
import org.gradle.api.internal.artifacts.ArtifactAttributes;

View file

@ -34,7 +34,7 @@ subprojects {
}
def calculateBranchVersion() {
File f = rootProject.file(".git/refs/heads/origin")
File f = layout.settingsDirectory.file(".git/refs/heads/origin").asFile
def branchName = f.list()?.first().trim()
return branchName + ".1"

View file

@ -11,9 +11,11 @@ rootProject.name = "root"
include ":distribution:bwc:bugfix"
include ":distribution:bwc:bugfix2"
include ":distribution:bwc:bugfix3"
include ":distribution:bwc:minor"
include ":distribution:bwc:major"
include ":distribution:bwc:staged"
include ":distribution:bwc:staged2"
include ":distribution:bwc:maintenance"
include ":distribution:archives:darwin-tar"
include ":distribution:archives:oss-darwin-tar"

View file

@ -32,7 +32,9 @@ develocity {
// Automatically publish scans from Elasticsearch CI
if (onCI) {
publishing.onlyIf { true }
server = 'https://gradle-enterprise.elastic.co'
if(server.isPresent() == false) {
server = 'https://gradle-enterprise.elastic.co'
}
} else if( server.isPresent() == false) {
publishing.onlyIf { false }
}
@ -131,6 +133,9 @@ develocity {
}
} else {
tag 'LOCAL'
if (System.getProperty('idea.active') == 'true') {
tag 'IDEA'
}
}
}
}

View file

@ -47,7 +47,7 @@ plugins.withType(InternalJavaRestTestPlugin) {
tasks.withType(StandaloneRestIntegTestTask).configureEach {
testClassesDirs = sourceSets.javaRestTest.output.classesDirs
classpath = sourceSets.javaRestTest.runtimeClasspath
usesDefaultDistribution()
usesDefaultDistribution("BWC tests require full distribution for now")
}
}

View file

@ -0,0 +1,34 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the "Elastic License
* 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side
* Public License v 1"; you may not use this file except in compliance with, at
* your election, the "Elastic License 2.0", the "GNU Affero General Public
* License v3.0 only", or the "Server Side Public License, v 1".
*/
import org.elasticsearch.gradle.VersionProperties
import org.elasticsearch.gradle.testclusters.StandaloneRestIntegTestTask
def fwcVersions = buildParams.bwcVersions.released.findAll { it.major == VersionProperties.elasticsearchVersion.major && it.minor == VersionProperties.elasticsearchVersion.minor }
def previousMinorSnapshot = buildParams.bwcVersions.unreleased.find { it.major == VersionProperties.elasticsearchVersion.major && it.minor == VersionProperties.elasticsearchVersion.minor - 1 }
fwcVersions.each { fwcVersion ->
tasks.register("v${fwcVersion}#fwcTest", StandaloneRestIntegTestTask) {
usesBwcDistribution(previousMinorSnapshot)
usesBwcDistribution(fwcVersion)
systemProperty("tests.old_cluster_version", previousMinorSnapshot)
systemProperty("tests.new_cluster_version", fwcVersion)
nonInputProperties.systemProperty 'tests.fwc', 'true'
}
}
gradle.taskGraph.whenReady { graph ->
if (graph.allTasks.any { it.name.endsWith('#fwcTest') } && Boolean.parseBoolean(System.getProperty("tests.bwc.snapshot", "true"))) {
throw new GradleException("Running forward compatibility tests requires passing `-Dtests.bwc.snapshot=false`.")
}
if (graph.allTasks.any { it.name.endsWith('#fwcTest') } && graph.allTasks.any { it.name.endsWith('#bwcTest') }) {
throw new GradleException("Backward compatibility and forward compatibility tests cannot be executed in the same build.")
}
}

View file

@ -145,26 +145,30 @@ if (providers.systemProperty('idea.active').getOrNull() == 'true') {
}
}
// modifies the idea module config to enable preview features on ':libs:native' module
// modifies the idea module config to enable preview features on module that need them
tasks.register("enablePreviewFeatures", EnablePreviewFeaturesTask) {
group = 'ide'
description = 'Enables preview features on native library module'
description = 'Enables preview features on modules that need them'
dependsOn tasks.named("enableExternalConfiguration")
doLast {
enablePreview('.idea/modules/libs/native/elasticsearch.libs.native.main.iml', 'JDK_21_PREVIEW')
enablePreview('.idea/modules/libs/native/elasticsearch.libs.native.test.iml', 'JDK_21_PREVIEW')
// due to org.elasticsearch.plugins.PluginsLoader
enablePreview('.idea/modules/server/elasticsearch.server.main.iml', 'JDK_21_PREVIEW')
enablePreview('.idea/modules/server/elasticsearch.server.test.iml', 'JDK_21_PREVIEW')
enablePreview('.idea/modules/libs/entitlement/elasticsearch.libs.entitlement.main.iml', 'JDK_21_PREVIEW')
enablePreview('.idea/modules/libs/entitlement/elasticsearch.libs.entitlement.test.iml', 'JDK_21_PREVIEW')
enablePreview('.idea/modules/libs/entitlement/bridge/elasticsearch.libs.entitlement.bridge.main.iml', 'JDK_21_PREVIEW')
enablePreview('.idea/modules/libs/entitlement/bridge/elasticsearch.libs.entitlement.bridge.test.iml', 'JDK_21_PREVIEW')
enablePreview('.idea/modules/libs/entitlement/qa/entitlement-test-plugin/elasticsearch.libs.entitlement.qa.entitlement-test-plugin.main.iml', 'JDK_21_PREVIEW')
enablePreview('.idea/modules/libs/entitlement/qa/entitlement-test-plugin/elasticsearch.libs.entitlement.qa.entitlement-test-plugin.test.iml', 'JDK_21_PREVIEW')
}
}
tasks.register('buildDependencyArtifacts') {
group = 'ide'
description = 'Builds artifacts needed as dependency for IDE modules'
dependsOn([':plugins:repository-hdfs:hadoop-client-api:jar',
':x-pack:plugin:esql:compute:ann:jar',
dependsOn([':x-pack:plugin:esql:compute:ann:jar',
':x-pack:plugin:esql:compute:gen:jar',
':server:generateModulesList',
':server:generatePluginsList',
@ -175,7 +179,7 @@ if (providers.systemProperty('idea.active').getOrNull() == 'true') {
// this path is produced by the extractLibs task above
String testLibraryPath = TestUtil.getTestLibraryPath("${elasticsearchProject.left()}/libs/native/libraries/build/platform")
def enableIdeaCC = providers.gradleProperty("org.elasticsearch.idea-configuration-cache").getOrElse("true").toBoolean()
idea {
project {
vcs = 'Git'
@ -205,6 +209,11 @@ if (providers.systemProperty('idea.active').getOrNull() == 'true') {
}
}
runConfigurations {
defaults(org.jetbrains.gradle.ext.Gradle) {
scriptParameters = enableIdeaCC ? [
'--configuration-cache'
].join(' ') : ''
}
defaults(JUnit) {
vmParameters = [
'-ea',

View file

@ -17,10 +17,7 @@ import org.elasticsearch.gradle.internal.precommit.JarHellPrecommitPlugin;
import org.elasticsearch.gradle.internal.test.ClusterFeaturesMetadataPlugin;
import org.elasticsearch.gradle.plugin.PluginBuildPlugin;
import org.elasticsearch.gradle.plugin.PluginPropertiesExtension;
import org.elasticsearch.gradle.testclusters.ElasticsearchCluster;
import org.elasticsearch.gradle.testclusters.TestClustersPlugin;
import org.elasticsearch.gradle.util.GradleUtils;
import org.gradle.api.NamedDomainObjectContainer;
import org.gradle.api.Plugin;
import org.gradle.api.Project;
@ -39,7 +36,7 @@ public class BaseInternalPluginBuildPlugin implements Plugin<Project> {
project.getPluginManager().apply(JarHellPrecommitPlugin.class);
project.getPluginManager().apply(ElasticsearchJavaPlugin.class);
project.getPluginManager().apply(ClusterFeaturesMetadataPlugin.class);
boolean isCi = project.getRootProject().getExtensions().getByType(BuildParameterExtension.class).isCi();
boolean isCi = project.getRootProject().getExtensions().getByType(BuildParameterExtension.class).getCi();
// Clear default dependencies added by public PluginBuildPlugin as we add our
// own project dependencies for internal builds
// TODO remove once we removed default dependencies from PluginBuildPlugin
@ -81,29 +78,6 @@ public class BaseInternalPluginBuildPlugin implements Plugin<Project> {
if (isModule == false || isXPackModule) {
addNoticeGeneration(project, extension);
}
project.afterEvaluate(p -> {
@SuppressWarnings("unchecked")
NamedDomainObjectContainer<ElasticsearchCluster> testClusters = (NamedDomainObjectContainer<ElasticsearchCluster>) project
.getExtensions()
.getByName(TestClustersPlugin.EXTENSION_NAME);
p.getExtensions().getByType(PluginPropertiesExtension.class).getExtendedPlugins().forEach(pluginName -> {
// Auto add any dependent modules
findModulePath(project, pluginName).ifPresent(
path -> testClusters.configureEach(elasticsearchCluster -> elasticsearchCluster.module(path))
);
});
});
}
Optional<String> findModulePath(Project project, String pluginName) {
return project.getRootProject()
.getAllprojects()
.stream()
.filter(p -> GradleUtils.isModuleProject(p.getPath()))
.filter(p -> p.getPlugins().hasPlugin(PluginBuildPlugin.class))
.filter(p -> p.getExtensions().getByType(PluginPropertiesExtension.class).getName().equals(pluginName))
.findFirst()
.map(Project::getPath);
}
/**

View file

@ -145,7 +145,14 @@ public class BwcSetupExtension {
loggedExec.args("-DisCI");
}
loggedExec.args("-Dbuild.snapshot=true", "-Dscan.tag.NESTED");
loggedExec.args("-Dscan.tag.NESTED");
if (System.getProperty("tests.bwc.snapshot", "true").equals("false")) {
loggedExec.args("-Dbuild.snapshot=false", "-Dlicense.key=x-pack/plugin/core/snapshot.key");
} else {
loggedExec.args("-Dbuild.snapshot=true");
}
final LogLevel logLevel = project.getGradle().getStartParameter().getLogLevel();
List<LogLevel> nonDefaultLogLevels = Arrays.asList(LogLevel.QUIET, LogLevel.WARN, LogLevel.INFO, LogLevel.DEBUG);
if (nonDefaultLogLevels.contains(logLevel)) {

View file

@ -165,7 +165,8 @@ public class BwcVersions implements Serializable {
.sorted(reverseOrder(comparing(s -> Version.fromString(s, Version.Mode.RELAXED))))
.toList();
boolean existingBugfix = false;
int bugfixCount = 0;
boolean existingStaged = false;
for (int i = 0; i < featureFreezeBranches.size(); i++) {
String branch = featureFreezeBranches.get(i);
Version version = versions.stream()
@ -193,11 +194,13 @@ public class BwcVersions implements Serializable {
if (i == featureFreezeBranches.size() - 1) {
result.put(version, new UnreleasedVersionInfo(version, branch, ":distribution:bwc:maintenance"));
} else if (version.getRevision() == 0) { // This is the next staged minor
result.put(version, new UnreleasedVersionInfo(version, branch, ":distribution:bwc:staged"));
} else { // This is a bugfix
String project = existingBugfix ? "bugfix2" : "bugfix";
String project = existingStaged ? "staged2" : "staged";
result.put(version, new UnreleasedVersionInfo(version, branch, ":distribution:bwc:" + project));
existingStaged = true;
} else { // This is a bugfix
bugfixCount++;
String project = "bugfix" + (bugfixCount > 1 ? bugfixCount : "");
result.put(version, new UnreleasedVersionInfo(version, branch, ":distribution:bwc:" + project));
existingBugfix = true;
}
}

View file

@ -8,6 +8,8 @@
*/
package org.elasticsearch.gradle.internal;
import com.google.common.collect.Iterables;
import org.gradle.api.DefaultTask;
import org.gradle.api.file.FileCollection;
import org.gradle.api.tasks.Input;
@ -85,7 +87,7 @@ public class ConcatFilesTask extends DefaultTask {
public void concatFiles() throws IOException {
if (getHeaderLine() != null) {
getTarget().getParentFile().mkdirs();
Files.write(getTarget().toPath(), (getHeaderLine() + '\n').getBytes(StandardCharsets.UTF_8));
Files.writeString(getTarget().toPath(), getHeaderLine() + '\n');
}
// To remove duplicate lines
@ -95,11 +97,12 @@ public class ConcatFilesTask extends DefaultTask {
uniqueLines.addAll(Files.readAllLines(f.toPath(), StandardCharsets.UTF_8));
}
}
Files.write(getTarget().toPath(), uniqueLines, StandardCharsets.UTF_8, StandardOpenOption.APPEND);
for (String additionalLine : additionalLines) {
Files.write(getTarget().toPath(), (additionalLine + '\n').getBytes(StandardCharsets.UTF_8), StandardOpenOption.APPEND);
}
Files.write(
getTarget().toPath(),
Iterables.concat(uniqueLines, additionalLines),
StandardCharsets.UTF_8,
StandardOpenOption.APPEND
);
}
}

View file

@ -155,7 +155,7 @@ public class DependenciesInfoTask extends ConventionTask {
output.append(dep.getGroup() + ":" + dep.getName() + "," + dep.getVersion() + "," + url + "," + licenseType + "\n");
}
Files.write(outputFile.toPath(), output.toString().getBytes("UTF-8"), StandardOpenOption.CREATE);
Files.writeString(outputFile.toPath(), output.toString(), StandardOpenOption.CREATE);
}
@Input

View file

@ -14,35 +14,45 @@ package org.elasticsearch.gradle.internal;
*/
public enum DockerBase {
// "latest" here is intentional, since the image name specifies "9"
DEFAULT("docker.elastic.co/ubi9/ubi-minimal:latest", "", "microdnf"),
DEFAULT("redhat/ubi9-minimal:latest", "", "microdnf", "Dockerfile.default"),
// The Iron Bank base image is UBI (albeit hardened), but we are required to parameterize the Docker build
IRON_BANK("${BASE_REGISTRY}/${BASE_IMAGE}:${BASE_TAG}", "-ironbank", "yum"),
IRON_BANK("${BASE_REGISTRY}/${BASE_IMAGE}:${BASE_TAG}", "-ironbank", "yum", "Dockerfile"),
// Chainguard based wolfi image with latest jdk
// This is usually updated via renovatebot
// spotless:off
WOLFI("docker.elastic.co/wolfi/chainguard-base:latest@sha256:bd401704a162a7937cd1015f755ca9da9aba0fdf967fc6bf90bf8d3f6b2eb557",
WOLFI(
"docker.elastic.co/wolfi/chainguard-base:latest@sha256:29150cd940cc7f69407d978d5a19c86f4d9e67cf44e4d6ded787a497e8f27c9a",
"-wolfi",
"apk"
"apk",
"Dockerfile"
),
FIPS(
"docker.elastic.co/wolfi/chainguard-base-fips:sha256-ebfc3f1d7dba992231747a2e05ad1b859843e81b5e676ad342859d7cf9e425a7@sha256:ebfc3f1d7dba992231747a2e05ad1b859843e81b5e676ad342859d7cf9e425a7",
"-fips",
"apk",
"Dockerfile"
),
// spotless:on
// Based on WOLFI above, with more extras. We don't set a base image because
// we programmatically extend from the wolfi image.
CLOUD_ESS(null, "-cloud-ess", "apk");
CLOUD_ESS(null, "-cloud-ess", "apk", "Dockerfile.cloud-ess"),;
private final String image;
private final String suffix;
private final String packageManager;
private final String dockerfile;
DockerBase(String image, String suffix) {
this(image, suffix, "apt-get");
this(image, suffix, "apt-get", "dockerfile");
}
DockerBase(String image, String suffix, String packageManager) {
DockerBase(String image, String suffix, String packageManager, String dockerfile) {
this.image = image;
this.suffix = suffix;
this.packageManager = packageManager;
this.dockerfile = dockerfile;
}
public String getImage() {
@ -56,4 +66,8 @@ public enum DockerBase {
public String getPackageManager() {
return packageManager;
}
public String getDockerfile() {
return dockerfile;
}
}

View file

@ -110,6 +110,8 @@ public abstract class ElasticsearchBuildCompletePlugin implements Plugin<Project
projectDirFiles.include("**/build/testrun/*/temp/**");
projectDirFiles.include("**/build/**/hs_err_pid*.log");
projectDirFiles.include("**/build/**/replay_pid*.log");
// core dump files are in the working directory of the installation, which is not project specific
projectDirFiles.include("distribution/**/build/install/*/core.*");
projectDirFiles.exclude("**/build/testclusters/**/data/**");
projectDirFiles.exclude("**/build/testclusters/**/distro/**");
projectDirFiles.exclude("**/build/testclusters/**/repo/**");

View file

@ -58,7 +58,6 @@ public class ElasticsearchJavaBasePlugin implements Plugin<Project> {
@Override
public void apply(Project project) {
project.getRootProject().getPlugins().apply(GlobalBuildInfoPlugin.class);
// make sure the global build info plugin is applied to the root project
project.getRootProject().getPluginManager().apply(GlobalBuildInfoPlugin.class);
buildParams = project.getRootProject().getExtensions().getByType(BuildParameterExtension.class);
@ -162,7 +161,7 @@ public class ElasticsearchJavaBasePlugin implements Plugin<Project> {
compileTask.getConventionMapping().map("sourceCompatibility", () -> java.getSourceCompatibility().toString());
compileTask.getConventionMapping().map("targetCompatibility", () -> java.getTargetCompatibility().toString());
compileOptions.getRelease().set(releaseVersionProviderFromCompileTask(project, compileTask));
compileOptions.setIncremental(buildParams.isCi() == false);
compileOptions.setIncremental(buildParams.getCi() == false);
});
// also apply release flag to groovy, which is used in build-tools
project.getTasks().withType(GroovyCompile.class).configureEach(compileTask -> {

View file

@ -137,10 +137,15 @@ public abstract class ElasticsearchTestBasePlugin implements Plugin<Project> {
test.jvmArgs((Object[]) argline.split(" "));
}
if (Util.getBooleanProperty("tests.asserts", true)) {
test.jvmArgs("-ea", "-esa");
}
// Check if "tests.asserts" is false or "tests.jvm.argline" contains the "-da" flag.
boolean disableAssertions = Util.getBooleanProperty("tests.asserts", true) == false
|| (argline != null && (argline.contains("-da")))
|| (argline != null && (argline.contains("-disableassertions")));
if (disableAssertions) {
System.out.println("disable assertions");
test.setEnableAssertions(false);
}
Map<String, String> sysprops = Map.of(
"java.awt.headless",
"true",

View file

@ -19,6 +19,8 @@ import org.gradle.api.Project;
import org.gradle.api.Task;
import org.gradle.api.file.ArchiveOperations;
import org.gradle.api.plugins.BasePlugin;
import org.gradle.api.provider.ListProperty;
import org.gradle.api.provider.Provider;
import org.gradle.api.tasks.Copy;
import org.gradle.api.tasks.TaskProvider;
@ -103,22 +105,26 @@ public class InternalDistributionArchiveCheckPlugin implements Plugin<Project> {
) {
TaskProvider<Task> checkMlCppNoticeTask = project.getTasks().register("checkMlCppNotice", task -> {
task.dependsOn(checkExtraction);
final Provider<Path> noticePath = checkExtraction.map(
c -> c.getDestinationDir()
.toPath()
.resolve("elasticsearch-" + VersionProperties.getElasticsearch() + "/modules/x-pack-ml/NOTICE.txt")
);
ListProperty<String> expectedMlLicenses = extension.expectedMlLicenses;
task.doLast(new Action<Task>() {
@Override
public void execute(Task task) {
// this is just a small sample from the C++ notices,
// the idea being that if we've added these lines we've probably added all the required lines
final List<String> expectedLines = extension.expectedMlLicenses.get();
final Path noticePath = checkExtraction.get()
.getDestinationDir()
.toPath()
.resolve("elasticsearch-" + VersionProperties.getElasticsearch() + "/modules/x-pack-ml/NOTICE.txt");
final List<String> expectedLines = expectedMlLicenses.get();
final List<String> actualLines;
try {
actualLines = Files.readAllLines(noticePath);
actualLines = Files.readAllLines(noticePath.get());
for (final String expectedLine : expectedLines) {
if (actualLines.contains(expectedLine) == false) {
throw new GradleException("expected [" + noticePath + " to contain [" + expectedLine + "] but it did not");
throw new GradleException(
"expected [" + noticePath.get() + " to contain [" + expectedLine + "] but it did not"
);
}
}
} catch (IOException ioException) {
@ -133,16 +139,12 @@ public class InternalDistributionArchiveCheckPlugin implements Plugin<Project> {
private TaskProvider<Task> registerCheckNoticeTask(Project project, TaskProvider<Copy> checkExtraction) {
return project.getTasks().register("checkNotice", task -> {
task.dependsOn(checkExtraction);
task.doLast(new Action<Task>() {
@Override
public void execute(Task task) {
final List<String> noticeLines = Arrays.asList("Elasticsearch", "Copyright 2009-2024 Elasticsearch");
final Path noticePath = checkExtraction.get()
.getDestinationDir()
.toPath()
.resolve("elasticsearch-" + VersionProperties.getElasticsearch() + "/NOTICE.txt");
assertLinesInFile(noticePath, noticeLines);
}
var noticePath = checkExtraction.map(
copy -> copy.getDestinationDir().toPath().resolve("elasticsearch-" + VersionProperties.getElasticsearch() + "/NOTICE.txt")
);
task.doLast(t -> {
final List<String> noticeLines = Arrays.asList("Elasticsearch", "Copyright 2009-2024 Elasticsearch");
assertLinesInFile(noticePath.get(), noticeLines);
});
});
}
@ -150,26 +152,24 @@ public class InternalDistributionArchiveCheckPlugin implements Plugin<Project> {
private TaskProvider<Task> registerCheckLicenseTask(Project project, TaskProvider<Copy> checkExtraction) {
TaskProvider<Task> checkLicense = project.getTasks().register("checkLicense", task -> {
task.dependsOn(checkExtraction);
task.doLast(new Action<Task>() {
@Override
public void execute(Task task) {
String licenseFilename = null;
if (project.getName().contains("oss-") || project.getName().equals("integ-test-zip")) {
licenseFilename = "AGPL-3.0+SSPL-1.0+ELASTIC-LICENSE-2.0.txt";
} else {
licenseFilename = "ELASTIC-LICENSE-2.0.txt";
}
final List<String> licenseLines;
try {
licenseLines = Files.readAllLines(project.getRootDir().toPath().resolve("licenses/" + licenseFilename));
final Path licensePath = checkExtraction.get()
.getDestinationDir()
.toPath()
.resolve("elasticsearch-" + VersionProperties.getElasticsearch() + "/LICENSE.txt");
assertLinesInFile(licensePath, licenseLines);
} catch (IOException ioException) {
ioException.printStackTrace();
}
String projectName = project.getName();
Provider<Path> licensePathProvider = checkExtraction.map(
copy -> copy.getDestinationDir().toPath().resolve("elasticsearch-" + VersionProperties.getElasticsearch() + "/LICENSE.txt")
);
File rootDir = project.getLayout().getSettingsDirectory().getAsFile();
task.doLast(t -> {
String licenseFilename = null;
if (projectName.contains("oss-") || projectName.equals("integ-test-zip")) {
licenseFilename = "AGPL-3.0+SSPL-1.0+ELASTIC-LICENSE-2.0.txt";
} else {
licenseFilename = "ELASTIC-LICENSE-2.0.txt";
}
final List<String> licenseLines;
try {
licenseLines = Files.readAllLines(rootDir.toPath().resolve("licenses/" + licenseFilename));
assertLinesInFile(licensePathProvider.get(), licenseLines);
} catch (IOException ioException) {
ioException.printStackTrace();
}
});
});

View file

@ -73,7 +73,7 @@ public class InternalDistributionBwcSetupPlugin implements Plugin<Project> {
project.getPlugins().apply(JvmToolchainsPlugin.class);
toolChainService = project.getExtensions().getByType(JavaToolchainService.class);
var buildParams = loadBuildParams(project).get();
Boolean isCi = buildParams.isCi();
Boolean isCi = buildParams.getCi();
buildParams.getBwcVersions().forPreviousUnreleased((BwcVersions.UnreleasedVersionInfo unreleasedVersion) -> {
configureBwcProject(
project.project(unreleasedVersion.gradleProjectPath()),
@ -355,8 +355,9 @@ public class InternalDistributionBwcSetupPlugin implements Plugin<Project> {
String bwcTaskName = buildBwcTaskName(projectName);
bwcSetupExtension.bwcTask(bwcTaskName, c -> {
boolean useNativeExpanded = projectArtifact.expandedDistDir != null;
boolean isReleaseBuild = System.getProperty("tests.bwc.snapshot", "true").equals("false");
File expectedOutputFile = useNativeExpanded
? new File(projectArtifact.expandedDistDir, "elasticsearch-" + bwcVersion.get() + "-SNAPSHOT")
? new File(projectArtifact.expandedDistDir, "elasticsearch-" + bwcVersion.get() + (isReleaseBuild ? "" : "-SNAPSHOT"))
: projectArtifact.distFile;
c.getInputs().file(new File(project.getBuildDir(), "refspec")).withPathSensitivity(PathSensitivity.RELATIVE);
if (useNativeExpanded) {
@ -364,7 +365,7 @@ public class InternalDistributionBwcSetupPlugin implements Plugin<Project> {
} else {
c.getOutputs().files(expectedOutputFile);
}
c.getOutputs().doNotCacheIf("BWC distribution caching is disabled for local builds", task -> buildParams.isCi() == false);
c.getOutputs().doNotCacheIf("BWC distribution caching is disabled for local builds", task -> buildParams.getCi() == false);
c.getArgs().add("-p");
c.getArgs().add(projectPath);
c.getArgs().add(assembleTaskName);

View file

@ -30,7 +30,7 @@ public class InternalTestClustersPlugin implements Plugin<Project> {
TestClustersPlugin testClustersPlugin = project.getPlugins().apply(TestClustersPlugin.class);
testClustersPlugin.setRuntimeJava(buildParams.getRuntimeJavaHome());
testClustersPlugin.setIsReleasedVersion(
version -> (version.equals(VersionProperties.getElasticsearchVersion()) && buildParams.isSnapshotBuild() == false)
version -> (version.equals(VersionProperties.getElasticsearchVersion()) && buildParams.getSnapshotBuild() == false)
|| buildParams.getBwcVersions().unreleasedInfo(version) == null
);

View file

@ -111,7 +111,11 @@ public abstract class JarApiComparisonTask extends PrecommitTask {
List<String> classNames() throws IOException {
Pattern classEnding = Pattern.compile(".*\\.class$");
try (JarFile jf = new JarFile(this.path)) {
return jf.stream().map(ZipEntry::getName).filter(classEnding.asMatchPredicate()).collect(Collectors.toList());
return jf.stream()
.map(ZipEntry::getName)
.filter(classEnding.asMatchPredicate())
.filter(c -> c.startsWith("org/elasticsearch/logging/internal/") == false)
.collect(Collectors.toList());
}
}

View file

@ -139,7 +139,7 @@ public class MrjarPlugin implements Plugin<Project> {
compileOptions.getRelease().set(javaVersion);
});
if (isMainSourceSet) {
project.getTasks().create(sourceSet.getJavadocTaskName(), Javadoc.class, javadocTask -> {
project.getTasks().register(sourceSet.getJavadocTaskName(), Javadoc.class, javadocTask -> {
javadocTask.getJavadocTool().set(javaToolchains.javadocToolFor(spec -> {
spec.getLanguageVersion().set(JavaLanguageVersion.of(javaVersion));
}));
@ -163,6 +163,7 @@ public class MrjarPlugin implements Plugin<Project> {
project.getConfigurations().register("java" + javaVersion);
TaskProvider<Jar> jarTask = project.getTasks().register("java" + javaVersion + "Jar", Jar.class, task -> {
task.from(sourceSet.getOutput());
task.getArchiveClassifier().set("java" + javaVersion);
});
project.getArtifacts().add("java" + javaVersion, jarTask);
}

View file

@ -29,56 +29,14 @@ public abstract class RestrictedBuildApiService implements BuildService<Restrict
ListMultimap<Class<?>, String> map = ArrayListMultimap.create(1, 200);
map.put(LegacyRestTestBasePlugin.class, ":docs");
map.put(LegacyRestTestBasePlugin.class, ":distribution:docker");
map.put(LegacyRestTestBasePlugin.class, ":modules:lang-expression");
map.put(LegacyRestTestBasePlugin.class, ":modules:lang-mustache");
map.put(LegacyRestTestBasePlugin.class, ":modules:mapper-extras");
map.put(LegacyRestTestBasePlugin.class, ":modules:parent-join");
map.put(LegacyRestTestBasePlugin.class, ":modules:percolator");
map.put(LegacyRestTestBasePlugin.class, ":modules:rank-eval");
map.put(LegacyRestTestBasePlugin.class, ":modules:reindex");
map.put(LegacyRestTestBasePlugin.class, ":modules:repository-url");
map.put(LegacyRestTestBasePlugin.class, ":modules:transport-netty4");
map.put(LegacyRestTestBasePlugin.class, ":plugins:analysis-icu");
map.put(LegacyRestTestBasePlugin.class, ":plugins:analysis-kuromoji");
map.put(LegacyRestTestBasePlugin.class, ":plugins:analysis-nori");
map.put(LegacyRestTestBasePlugin.class, ":plugins:analysis-phonetic");
map.put(LegacyRestTestBasePlugin.class, ":plugins:analysis-smartcn");
map.put(LegacyRestTestBasePlugin.class, ":plugins:analysis-stempel");
map.put(LegacyRestTestBasePlugin.class, ":plugins:analysis-ukrainian");
map.put(LegacyRestTestBasePlugin.class, ":plugins:discovery-azure-classic");
map.put(LegacyRestTestBasePlugin.class, ":plugins:discovery-ec2");
map.put(LegacyRestTestBasePlugin.class, ":plugins:discovery-gce");
map.put(LegacyRestTestBasePlugin.class, ":plugins:mapper-annotated-text");
map.put(LegacyRestTestBasePlugin.class, ":plugins:mapper-murmur3");
map.put(LegacyRestTestBasePlugin.class, ":plugins:repository-hdfs");
map.put(LegacyRestTestBasePlugin.class, ":plugins:store-smb");
map.put(LegacyRestTestBasePlugin.class, ":qa:ccs-rolling-upgrade-remote-cluster");
map.put(LegacyRestTestBasePlugin.class, ":qa:mixed-cluster");
map.put(LegacyRestTestBasePlugin.class, ":qa:multi-cluster-search");
map.put(LegacyRestTestBasePlugin.class, ":qa:remote-clusters");
map.put(LegacyRestTestBasePlugin.class, ":qa:repository-multi-version");
map.put(LegacyRestTestBasePlugin.class, ":qa:rolling-upgrade-legacy");
map.put(LegacyRestTestBasePlugin.class, ":qa:smoke-test-http");
map.put(LegacyRestTestBasePlugin.class, ":qa:smoke-test-ingest-disabled");
map.put(LegacyRestTestBasePlugin.class, ":qa:smoke-test-ingest-with-all-dependencies");
map.put(LegacyRestTestBasePlugin.class, ":qa:smoke-test-plugins");
map.put(LegacyRestTestBasePlugin.class, ":qa:system-indices");
map.put(LegacyRestTestBasePlugin.class, ":qa:verify-version-constants");
map.put(LegacyRestTestBasePlugin.class, ":test:external-modules:test-apm-integration");
map.put(LegacyRestTestBasePlugin.class, ":test:external-modules:test-delayed-aggs");
map.put(LegacyRestTestBasePlugin.class, ":test:external-modules:test-die-with-dignity");
map.put(LegacyRestTestBasePlugin.class, ":test:external-modules:test-error-query");
map.put(LegacyRestTestBasePlugin.class, ":test:external-modules:test-latency-simulating-directory");
map.put(LegacyRestTestBasePlugin.class, ":test:yaml-rest-runner");
map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:core");
map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:ent-search");
map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:fleet");
map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:logstash");
map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:mapper-constant-keyword");
map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:mapper-unsigned-long");
map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:mapper-version");
map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:vector-tile");
map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:wildcard");
map.put(LegacyRestTestBasePlugin.class, ":x-pack:qa:mixed-tier-cluster");
map.put(LegacyRestTestBasePlugin.class, ":x-pack:qa:repository-old-versions");
map.put(LegacyRestTestBasePlugin.class, ":x-pack:qa:rolling-upgrade");
@ -92,9 +50,6 @@ public abstract class RestrictedBuildApiService implements BuildService<Restrict
map.put(LegacyRestTestBasePlugin.class, ":x-pack:qa:smoke-test-plugins-ssl");
map.put(LegacyRestTestBasePlugin.class, ":x-pack:qa:smoke-test-security-with-mustache");
map.put(LegacyRestTestBasePlugin.class, ":x-pack:qa:xpack-prefix-rest-compat");
map.put(LegacyRestTestBasePlugin.class, ":modules:ingest-geoip:qa:file-based-update");
map.put(LegacyRestTestBasePlugin.class, ":plugins:discovery-ec2:qa:amazon-ec2");
map.put(LegacyRestTestBasePlugin.class, ":plugins:discovery-gce:qa:gce");
map.put(LegacyRestTestBasePlugin.class, ":x-pack:qa:multi-cluster-search-security:legacy-with-basic-license");
map.put(LegacyRestTestBasePlugin.class, ":x-pack:qa:multi-cluster-search-security:legacy-with-full-license");
map.put(LegacyRestTestBasePlugin.class, ":x-pack:qa:multi-cluster-search-security:legacy-with-restricted-trust");
@ -103,12 +58,6 @@ public abstract class RestrictedBuildApiService implements BuildService<Restrict
map.put(LegacyRestTestBasePlugin.class, ":x-pack:qa:third-party:slack");
map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:async-search:qa:rest");
map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:autoscaling:qa:rest");
map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:ccr:qa:downgrade-to-basic-license");
map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:ccr:qa:multi-cluster");
map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:ccr:qa:non-compliant-license");
map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:ccr:qa:rest");
map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:ccr:qa:restart");
map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:ccr:qa:security");
map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:deprecation:qa:early-deprecation-rest");
map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:deprecation:qa:rest");
map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:downsample:qa:with-security");
@ -119,7 +68,6 @@ public abstract class RestrictedBuildApiService implements BuildService<Restrict
map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:eql:qa:ccs-rolling-upgrade");
map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:eql:qa:correctness");
map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:eql:qa:mixed-node");
map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:fleet:qa:rest");
map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:identity-provider:qa:idp-rest-tests");
map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:ilm:qa:multi-cluster");
map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:ilm:qa:multi-node");
@ -136,8 +84,6 @@ public abstract class RestrictedBuildApiService implements BuildService<Restrict
map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:security:qa:tls-basic");
map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:shutdown:qa:multi-node");
map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:shutdown:qa:rolling-upgrade");
map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:slm:qa:multi-node");
map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:slm:qa:rest");
map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:snapshot-based-recoveries:qa:fs");
map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:snapshot-based-recoveries:qa:license-enforcing");
map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:snapshot-repo-test-kit:qa:hdfs");
@ -150,12 +96,10 @@ public abstract class RestrictedBuildApiService implements BuildService<Restrict
map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:sql:qa:mixed-node");
map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:sql:qa:server:security:with-ssl");
map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:sql:qa:server:security:without-ssl");
map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:stack:qa:rest");
map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:text-structure:qa:text-structure-with-security");
map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:transform:qa:multi-cluster-tests-with-security");
map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:transform:qa:multi-node-tests");
map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:transform:qa:single-node-tests");
map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:vector-tile:qa:multi-cluster");
map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:watcher:qa:rest");
map.put(LegacyRestTestBasePlugin.class, ":x-pack:plugin:watcher:qa:with-security");
return map;

View file

@ -0,0 +1,57 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the "Elastic License
* 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side
* Public License v 1"; you may not use this file except in compliance with, at
* your election, the "Elastic License 2.0", the "GNU Affero General Public
* License v3.0 only", or the "Server Side Public License, v 1".
*/
package org.elasticsearch.gradle.internal.dependencies.patches;
import org.objectweb.asm.ClassVisitor;
import org.objectweb.asm.ClassWriter;
import java.util.Arrays;
import java.util.HexFormat;
import java.util.function.Function;
public final class PatcherInfo {
private final String jarEntryName;
private final byte[] classSha256;
private final Function<ClassWriter, ClassVisitor> visitorFactory;
private PatcherInfo(String jarEntryName, byte[] classSha256, Function<ClassWriter, ClassVisitor> visitorFactory) {
this.jarEntryName = jarEntryName;
this.classSha256 = classSha256;
this.visitorFactory = visitorFactory;
}
/**
* Creates a patcher info entry, linking a jar entry path name and its SHA256 digest to a patcher factory (a factory to create an ASM
* visitor)
*
* @param jarEntryName the jar entry path, as a string
* @param classSha256 the SHA256 digest of the class bytes, as a HEX string
* @param visitorFactory the factory to create an ASM visitor from a ASM writer
*/
public static PatcherInfo classPatcher(String jarEntryName, String classSha256, Function<ClassWriter, ClassVisitor> visitorFactory) {
return new PatcherInfo(jarEntryName, HexFormat.of().parseHex(classSha256), visitorFactory);
}
boolean matches(byte[] otherClassSha256) {
return Arrays.equals(this.classSha256, otherClassSha256);
}
public String jarEntryName() {
return jarEntryName;
}
public byte[] classSha256() {
return classSha256;
}
public ClassVisitor createVisitor(ClassWriter classWriter) {
return visitorFactory.apply(classWriter);
}
}

View file

@ -0,0 +1,140 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the "Elastic License
* 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side
* Public License v 1"; you may not use this file except in compliance with, at
* your election, the "Elastic License 2.0", the "GNU Affero General Public
* License v3.0 only", or the "Server Side Public License, v 1".
*/
package org.elasticsearch.gradle.internal.dependencies.patches;
import org.objectweb.asm.ClassReader;
import org.objectweb.asm.ClassWriter;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Enumeration;
import java.util.HexFormat;
import java.util.Locale;
import java.util.function.Function;
import java.util.jar.JarEntry;
import java.util.jar.JarFile;
import java.util.jar.JarOutputStream;
import java.util.stream.Collectors;
import static org.objectweb.asm.ClassWriter.COMPUTE_FRAMES;
import static org.objectweb.asm.ClassWriter.COMPUTE_MAXS;
public class Utils {
private static final MessageDigest SHA_256;
static {
try {
SHA_256 = MessageDigest.getInstance("SHA-256");
} catch (NoSuchAlgorithmException e) {
throw new RuntimeException(e);
}
}
private record MismatchInfo(String jarEntryName, String expectedClassSha256, String foundClassSha256) {
@Override
public String toString() {
return "[class='"
+ jarEntryName
+ '\''
+ ", expected='"
+ expectedClassSha256
+ '\''
+ ", found='"
+ foundClassSha256
+ '\''
+ ']';
}
}
/**
* Patches the classes in the input JAR file, using the collection of patchers. Each patcher specifies a target class (its jar entry
* name) and the SHA256 digest on the class bytes.
* This digest is checked against the class bytes in the JAR, and if it does not match, an IllegalArgumentException is thrown.
* If the input file does not contain all the classes to patch specified in the patcher info collection, an IllegalArgumentException
* is also thrown.
* @param inputFile the JAR file to patch
* @param outputFile the output (patched) JAR file
* @param patchers list of patcher info (classes to patch (jar entry name + optional SHA256 digest) and ASM visitor to transform them)
*/
public static void patchJar(File inputFile, File outputFile, Collection<PatcherInfo> patchers) {
var classPatchers = patchers.stream().collect(Collectors.toMap(PatcherInfo::jarEntryName, Function.identity()));
var mismatchedClasses = new ArrayList<MismatchInfo>();
try (JarFile jarFile = new JarFile(inputFile); JarOutputStream jos = new JarOutputStream(new FileOutputStream(outputFile))) {
Enumeration<JarEntry> entries = jarFile.entries();
while (entries.hasMoreElements()) {
JarEntry entry = entries.nextElement();
String entryName = entry.getName();
// Add the entry to the new JAR file
jos.putNextEntry(new JarEntry(entryName));
var classPatcher = classPatchers.remove(entryName);
if (classPatcher != null) {
byte[] classToPatch = jarFile.getInputStream(entry).readAllBytes();
var classSha256 = SHA_256.digest(classToPatch);
if (classPatcher.matches(classSha256)) {
ClassReader classReader = new ClassReader(classToPatch);
ClassWriter classWriter = new ClassWriter(classReader, COMPUTE_MAXS | COMPUTE_FRAMES);
classReader.accept(classPatcher.createVisitor(classWriter), 0);
jos.write(classWriter.toByteArray());
} else {
mismatchedClasses.add(
new MismatchInfo(
classPatcher.jarEntryName(),
HexFormat.of().formatHex(classPatcher.classSha256()),
HexFormat.of().formatHex(classSha256)
)
);
}
} else {
// Read the entry's data and write it to the new JAR
try (InputStream is = jarFile.getInputStream(entry)) {
is.transferTo(jos);
}
}
jos.closeEntry();
}
} catch (IOException ex) {
throw new RuntimeException(ex);
}
if (mismatchedClasses.isEmpty() == false) {
throw new IllegalArgumentException(
String.format(
Locale.ROOT,
"""
Error patching JAR [%s]: SHA256 digest mismatch (%s). This JAR was updated to a version that contains different \
classes, for which this patcher was not designed. Please check if the patcher still \
applies correctly, and update the SHA256 digest(s).""",
inputFile.getName(),
mismatchedClasses.stream().map(MismatchInfo::toString).collect(Collectors.joining())
)
);
}
if (classPatchers.isEmpty() == false) {
throw new IllegalArgumentException(
String.format(
Locale.ROOT,
"error patching [%s]: the jar does not contain [%s]",
inputFile.getName(),
String.join(", ", classPatchers.keySet())
)
);
}
}
}

View file

@ -0,0 +1,61 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the "Elastic License
* 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side
* Public License v 1"; you may not use this file except in compliance with, at
* your election, the "Elastic License 2.0", the "GNU Affero General Public
* License v3.0 only", or the "Server Side Public License, v 1".
*/
package org.elasticsearch.gradle.internal.dependencies.patches.awsv2sdk;
import org.elasticsearch.gradle.internal.dependencies.patches.PatcherInfo;
import org.elasticsearch.gradle.internal.dependencies.patches.Utils;
import org.gradle.api.artifacts.transform.CacheableTransform;
import org.gradle.api.artifacts.transform.InputArtifact;
import org.gradle.api.artifacts.transform.TransformAction;
import org.gradle.api.artifacts.transform.TransformOutputs;
import org.gradle.api.artifacts.transform.TransformParameters;
import org.gradle.api.file.FileSystemLocation;
import org.gradle.api.provider.Provider;
import org.gradle.api.tasks.Classpath;
import org.jetbrains.annotations.NotNull;
import java.io.File;
import java.util.List;
import static org.elasticsearch.gradle.internal.dependencies.patches.PatcherInfo.classPatcher;
@CacheableTransform
public abstract class Awsv2ClassPatcher implements TransformAction<TransformParameters.None> {
private static final String JAR_FILE_TO_PATCH = "aws-query-protocol";
private static final List<PatcherInfo> CLASS_PATCHERS = List.of(
// This patcher is needed because of this AWS bug: https://github.com/aws/aws-sdk-java-v2/issues/5968
// As soon as the bug is resolved and we upgrade our AWS SDK v2 libraries, we can remove this.
classPatcher(
"software/amazon/awssdk/protocols/query/internal/marshall/ListQueryMarshaller.class",
"213e84d9a745bdae4b844334d17aecdd6499b36df32aa73f82dc114b35043009",
StringFormatInPathResolverPatcher::new
)
);
@Classpath
@InputArtifact
public abstract Provider<FileSystemLocation> getInputArtifact();
@Override
public void transform(@NotNull TransformOutputs outputs) {
File inputFile = getInputArtifact().get().getAsFile();
if (inputFile.getName().startsWith(JAR_FILE_TO_PATCH)) {
System.out.println("Patching " + inputFile.getName());
File outputFile = outputs.file(inputFile.getName().replace(".jar", "-patched.jar"));
Utils.patchJar(inputFile, outputFile, CLASS_PATCHERS);
} else {
System.out.println("Skipping " + inputFile.getName());
outputs.file(getInputArtifact());
}
}
}

View file

@ -0,0 +1,89 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the "Elastic License
* 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side
* Public License v 1"; you may not use this file except in compliance with, at
* your election, the "Elastic License 2.0", the "GNU Affero General Public
* License v3.0 only", or the "Server Side Public License, v 1".
*/
package org.elasticsearch.gradle.internal.dependencies.patches.awsv2sdk;
import org.objectweb.asm.ClassVisitor;
import org.objectweb.asm.ClassWriter;
import org.objectweb.asm.MethodVisitor;
import org.objectweb.asm.Type;
import java.util.Locale;
import static org.objectweb.asm.Opcodes.ASM9;
import static org.objectweb.asm.Opcodes.GETSTATIC;
import static org.objectweb.asm.Opcodes.INVOKESTATIC;
class StringFormatInPathResolverPatcher extends ClassVisitor {
StringFormatInPathResolverPatcher(ClassWriter classWriter) {
super(ASM9, classWriter);
}
@Override
public MethodVisitor visitMethod(int access, String name, String descriptor, String signature, String[] exceptions) {
return new ReplaceCallMethodVisitor(super.visitMethod(access, name, descriptor, signature, exceptions));
}
/**
* Replaces calls to String.format(format, args); with calls to String.format(Locale.ROOT, format, args);
*/
private static class ReplaceCallMethodVisitor extends MethodVisitor {
private static final String CLASS_INTERNAL_NAME = Type.getInternalName(String.class);
private static final String METHOD_NAME = "format";
private static final String OLD_METHOD_DESCRIPTOR = Type.getMethodDescriptor(
Type.getType(String.class),
Type.getType(String.class),
Type.getType(Object[].class)
);
private static final String NEW_METHOD_DESCRIPTOR = Type.getMethodDescriptor(
Type.getType(String.class),
Type.getType(Locale.class),
Type.getType(String.class),
Type.getType(Object[].class)
);
private boolean foundFormatPattern = false;
ReplaceCallMethodVisitor(MethodVisitor methodVisitor) {
super(ASM9, methodVisitor);
}
@Override
public void visitLdcInsn(Object value) {
if (value instanceof String s && s.startsWith("%s")) {
if (foundFormatPattern) {
throw new IllegalStateException(
"A previous string format constant was not paired with a String.format() call. "
+ "Patching would generate an unbalances stack"
);
}
// Push the extra arg on the stack
mv.visitFieldInsn(GETSTATIC, Type.getInternalName(Locale.class), "ROOT", Type.getDescriptor(Locale.class));
foundFormatPattern = true;
}
super.visitLdcInsn(value);
}
@Override
public void visitMethodInsn(int opcode, String owner, String name, String descriptor, boolean isInterface) {
if (opcode == INVOKESTATIC
&& foundFormatPattern
&& CLASS_INTERNAL_NAME.equals(owner)
&& METHOD_NAME.equals(name)
&& OLD_METHOD_DESCRIPTOR.equals(descriptor)) {
// Replace the call with String.format(Locale.ROOT, format, args)
mv.visitMethodInsn(INVOKESTATIC, CLASS_INTERNAL_NAME, METHOD_NAME, NEW_METHOD_DESCRIPTOR, false);
foundFormatPattern = false;
} else {
super.visitMethodInsn(opcode, owner, name, descriptor, isInterface);
}
}
}
}

Some files were not shown because too many files have changed in this diff Show more