Commit graph

18831 commits

Author SHA1 Message Date
Nik Everett
3263429a78
ESQL: Speed up VALUES for many buckets (#123073) (#123229)
* 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.

* Fix

* Compile
2025-02-27 07:35:57 +11:00
Nikolaj Volgushev
ae2d918938
[8.16] Upgrade Netty to 4.1.118.Final (#122371) (#123481)
* Upgrade Netty to `4.1.118.Final` (#122371)

This PR upgrades Netty to `4.1.118.Final`.

* Bring back old netty versions for hdfs test fixture
2025-02-26 23:01:58 +11:00
Niels Bauman
c8c16d0566
[8.16] Fix failing test(s) in TimeSeriesDataStreamsIT (#123378) (#123475)
* 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

(cherry picked from commit f0f0eeb077)

# Conflicts:
#	x-pack/plugin/ilm/qa/multi-node/src/javaRestTest/java/org/elasticsearch/xpack/ilm/TimeSeriesDataStreamsIT.java

* Fix compilation
2025-02-26 22:49:14 +11:00
David Turner
19402e2c68
Reduce licence checks in LicensedWriteLoadForecaster (#123369) (#123408)
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.

Backport of #123346 to 8.x
Closes #123247
2025-02-26 06:59:14 +11:00
Johannes Fredén
33f973ba70
[8.16] Bump json-smart and oauth2-oidc-sdk (#122737) (#122915)
* Bump json-smart and oauth2-oidc-sdk (#122737)

* Bump json-smart and oauth2-oidc-sdk

---------

Co-authored-by: elasticsearchmachine <infra-root+elasticsearchmachine@elastic.co>
(cherry picked from commit e16664573e)

# Conflicts:
#	gradle/verification-metadata.xml

* fixup! Add back verification data for test dep
2025-02-19 09:54:53 +01:00
Felix Barnsteiner
bfd77c9485
Add _metric_names_hash field to OTel metric mappings (#120952) (#122881)
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-19 05:40:06 +11:00
Mike Pellegrini
4d408d4591
[8.16] Fix ArrayIndexOutOfBoundsException in ShardBulkInferenceActionFilter (#122538) (#122854)
* Fix ArrayIndexOutOfBoundsException in ShardBulkInferenceActionFilter (#122538)

(cherry picked from commit 229d392e63)

# Conflicts:
#	x-pack/plugin/inference/src/internalClusterTest/java/org/elasticsearch/xpack/inference/action/filter/ShardBulkInferenceActionFilterIT.java

* Fix compilation & test failures
2025-02-19 02:26:23 +11:00
Joe Gallo
a55e76936c
Fix redact processor arraycopy bug (#122640) (#122767) 2025-02-18 03:21:45 +11:00
Johannes Fredén
4f9c33f546
Improve jwt logging on failed auth (#122247) (#122784)
Update docs/changelog/122247.yaml
2025-02-18 03:18:57 +11:00
Rene Groeschke
020afb97b1
[Build] Fix the manifest target and source information for jdbc projects (#121888) (#122240)
The nebula info broker plugin takes the information for the manifest from the java project settings rather then from
the compile task configuration. Instead of setting the compiler task configuration explicitly we now set the project
configuration accordingly. Also tweaked the javaTestCompile tasks to keep compiling with general minimum runtime version as we did before

(cherry picked from commit 6e6e42f5d4)
2025-02-12 09:13:11 +01:00
Luigi Dell'Aquila
622c3c924d
EQL: fix JOIN command validation (not supported) (#122011) (#122172) 2025-02-11 01:23:37 +11:00
Nik Everett
f70771f1db
Retry timeout tests for aggs (#122031) (#122082)
The aggs timeout test waits for the agg to return and then double checks
that the agg is stopped using the tasks API. We're seeing some failures
where the tasks API reports that the agg is still running. I can't
reproduce them because computers. This adds two things:
1. Logs the hot_threads so we can see if the query is indeed still
   running.
2. Retries the _tasks API for a minute. If it goes away soon after the
   _search returns that's *fine*. If it sticks around for more than a
   few seconds then the cancel isn't working. We wait for a minute
   because CI can't be trusted to do anything quickly.

Closes #121993
2025-02-08 07:05:16 +11:00
Luigi Dell'Aquila
e1176cdfce
ES|QL: fix ENRICH validation for use of wildcards (#121911) (#122020) 2025-02-07 23:46:35 +11:00
Mark Tozzi
cf36d97a32
Aggregations cancellation after collection (#120944) (#121936)
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.

---------



 Conflicts:
	server/src/main/java/org/elasticsearch/search/aggregations/bucket/BucketsAggregator.java
	test/framework/src/main/java/org/elasticsearch/search/aggregations/AggregatorTestCase.java

Co-authored-by: elasticsearchmachine <infra-root+elasticsearchmachine@elastic.co>
2025-02-07 06:51:21 +11:00
Andrei Stefan
bb77d4979e
ESQL: use field_caps native nested fields filtering (#121918)
* [8.x] ESQL: use field_caps native nested fields filtering (#117201) (#117375) (#121645)

* Just filter the nested fields natively with field_caps support

(cherry picked from commit 73381dbeb1)

* Add import
2025-02-06 19:39:53 +02:00
Carson Ip
0396027494
Add missing apm-server tail sampling monitoring metrics to stack monitoring mapping (#121543) (#121579)
Add missing apm-server tail sampling monitoring metrics to stack monitoring mapping. They were missed in #110568.

(cherry picked from commit f3f5135f06)

# Conflicts:
#	x-pack/plugin/monitoring/src/main/java/org/elasticsearch/xpack/monitoring/MonitoringTemplateRegistry.java
2025-02-04 22:35:16 +11:00
Luigi Dell'Aquila
ad192c5456
[8.16] Fix docs.testFilterToday JDBC test (#121504) (#121635)
* Unmute

* Fix docs.testFilterToday JDBC test (#121504)
2025-02-04 19:46:46 +11:00
Nhat Nguyen
49eb1f8f24
Fix ClusterRequestTests (#121570) (#121618)
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-03 20:21:37 -08:00
Rene Groeschke
40b279c9ad
[8.16] [Gradle] Make rolling upgrade tests configuration cache compatible (#119577) (#120317)
* [Gradle] Make rolling upgrade tests configuration cache compatible (#119577)

With this, all rolling upgrade tests that involve a
`nextNodeToNextVersion` update are gradle configuration cache
compatible.

Simplify API around test cluster registry and cc compatible usage of
test cluster in TestClusterAware tasks.

(cherry picked from commit 7b6bdfa323)

# Conflicts:
#	qa/ccs-rolling-upgrade-remote-cluster/build.gradle
#	x-pack/plugin/sql/qa/jdbc/security/build.gradle
#	x-pack/plugin/sql/qa/server/security/build.gradle

* Fix backport merge issue
2025-01-30 04:07:37 +11:00
Panagiotis Bailis
c5a57fc690
[8.16] backporting fix for negative scores in text_similarity_ranker retriever (#121056) 2025-01-28 18:30:16 +02:00
Panagiotis Bailis
7b02cb221f
[8.16] backporting support for deprecated window_size param for rank rrf (#120935) 2025-01-28 12:12:46 +02:00
Aurélien FOUCRET
12ea3b2f64
[8.16] LTR - Fix explain failure when index has multiple shards (#120717) (#120794)
* LTR - Fix explain failure when index has multiple shards  (#120717)

* Fix test failing in 8.x branch.
2025-01-24 23:21:43 +01:00
Aurélien FOUCRET
149fbf215f
LTR sometines throw NullPointerException: Cannot read field "approximation" because "top" is null (#120809) (#120827)
* Add check on the DisiPriorityQueue size.

* Update docs/changelog/120809.yaml

* Add a unit test.
2025-01-25 06:15:42 +11:00
Niels Bauman
8adafb01d7
[8.16] Improve memory aspects of enrich cache (#120256) (#120762)
* Improve memory aspects of enrich cache (#120256)

This commit reduces the occupied heap space of the enrich cache and
corrects inaccuracies in tracking the occupied heap space (for cache
size limitation purposes).

---------

Co-authored-by: Joe Gallo <joegallo@gmail.com>

* Fix compilation

---------

Co-authored-by: Joe Gallo <joegallo@gmail.com>
2025-01-24 16:18:14 +11:00
Felix Barnsteiner
ae7ae7b9e4
Map scope.name as a dimension (#120590) (#120615) 2025-01-23 00:00:12 +11:00
Jan Kuipers
eef2fb3ddb
[8.16] Test ML model server (#120270) (#120589)
* Test ML model server (#120270)

* Fix model downloading for very small models.

* Test MlModelServer

* Tiny ELSER

* unmute TextEmbeddingCrudIT and DefaultEndPointsIT

* update ELSER

* Improve MlModelServer

* tiny E5

* more logging

* improved E5 model

* tiny reranker

* scan for ports

* [CI] Auto commit changes from spotless

* Serve default models when optimized model is requested

* @ClassRule

* polish code

* Respect dynamic setting ML model repo

* fix metadata for optimized models

* improve logging

---------

Co-authored-by: elasticsearchmachine <infra-root+elasticsearchmachine@elastic.co>

* backport HttpHeaderParser

* Fix stripping platform

---------

Co-authored-by: elasticsearchmachine <infra-root+elasticsearchmachine@elastic.co>
2025-01-22 23:00:56 +11:00
Matteo Piergiovanni
1b9e9e9a66
unmute testRestartAfterCompletion (#120361) (#120375) 2025-01-18 00:48:48 +11:00
Joe Gallo
4b72f44a72
Tidy up some enrich code (#120330) (#120337) 2025-01-17 11:19:27 +11:00
Jan Kuipers
4849cee246
backport datafeeds test fixes (#120289) (#120303)
* Fix(?) and unmute DatafeedJobsRestIT. (#119839)

* Fix(?) and unmute DatafeedJobsRestIT.

* [CI] Auto commit changes from spotless

---------



* Datafeed jobs it wait for task cancel (#120177)

* Fix task cancellation in DatafeedJobsIT.

* fix

* unmute DatafeedJobsIT

* unmute

---------

Co-authored-by: elasticsearchmachine <infra-root+elasticsearchmachine@elastic.co>
2025-01-17 04:13:04 +11:00
Mike Pellegrini
7141ff1866
[8.16] Update Text Similarity Reranker to Properly Handle Aliases (#120062) (#120077)
* Update Text Similarity Reranker to Properly Handle Aliases (#120062)

(cherry picked from commit 264d1c29d4)

# Conflicts:
#	x-pack/plugin/inference/src/main/java/org/elasticsearch/xpack/inference/InferenceFeatures.java

* Fix compilation error
2025-01-14 07:03:09 +11:00
Michael Peterson
87211f249c
Resolve/cluster should mark remotes as not connected when a security exception is thrown (#119793) (#119866)
Fixes two bugs in _resolve/cluster.

First, the code that detects older clusters versions and does a fallback to the _resolve/index
endpoint was using an outdated string match for error detection. That has been adjusted.

Second, upon security exceptions, the _resolve/cluster endpoint was marking the clusters as connected: true,
under the assumption that all security exceptions related to cross cluster calls and remote index access were
coming from the remote cluster, but that is not always the case. Some cross-cluster security violations can
be detected on the local querying cluster after issuing the remoteClient.execute call but before the transport
layer actually sends the request remotely. So we now mark the connected status as false for all ElasticsearchSecurityException cases. End user docs have been updated with this information.
2025-01-10 01:57:36 +11:00
Felix Barnsteiner
7324f31e01
Add missing traces ilm policy for OTel traces data streams (#119449) (#119825) 2025-01-09 18:55:23 +11:00
Niels Bauman
0522df05c4
Fix ILMDownsampleDisruptionIT.testILMDownsampleRollingRestart (#119196) (#119815)
This removes a redundant thread creation when triggering a rolling
restart as the method is already async and drops the check for cluster
health as that might hit a node that's being shut down (the master node
in particular).
2025-01-09 14:33:29 +11:00
Jonathan Buttner
e7ba9f45d0
[ML] Fix loss of context in the inference API for streaming APIs (#118999) (#119223)
* Adding context preserving fix

* Update docs/changelog/118999.yaml

* Update docs/changelog/118999.yaml

* Using a setonce and adding a test

* Updating the changelog

(cherry picked from commit 7ba3cb9d0d)

# Conflicts:
#	x-pack/plugin/inference/qa/inference-service-tests/src/javaRestTest/java/org/elasticsearch/xpack/inference/InferenceBaseRestTest.java
#	x-pack/plugin/inference/qa/inference-service-tests/src/javaRestTest/java/org/elasticsearch/xpack/inference/InferenceCrudIT.java
#	x-pack/plugin/inference/src/main/java/org/elasticsearch/xpack/inference/InferencePlugin.java
#	x-pack/plugin/inference/src/main/java/org/elasticsearch/xpack/inference/rest/RestUnifiedCompletionInferenceAction.java
#	x-pack/plugin/inference/src/test/java/org/elasticsearch/xpack/inference/rest/RestUnifiedCompletionInferenceActionTests.java
2025-01-07 14:25:49 -05:00
Nikolaj Volgushev
da8c68c7ea
Merge (#119683) 2025-01-08 04:08:24 +11:00
Jan Kuipers
1dddbd7e4b
Fix spike detection for short spikes at the tail of the data. (#119637) (#119668)
* Fix spike detection for short spikes at the tail of the data.

* Update docs/changelog/119637.yaml
2025-01-08 03:39:01 +11:00
Jan Kuipers
054308ba17
[8.x] Backport 119578 + 114289 (#119638) (#119645)
* Refactor change point detection (#114289)

* Move change detection code to separate class

* Uniformize ChangeDetector and SkipeAndDipDetector

* Separate ChangeDetectorTests and ChangePointAggregatorTests.

* Public entrypoint for change point detection

* Move p-value computation to ChangeDetector

* Move main entrypoint to a separate file

* Fix change point detection for uncertain non-stationary distributions. (#119578)

* Fix change point detection for uncertain non-stationary distributions.

* Replace -1 by ChangeType.NO_CHANGE_POINT
2025-01-08 01:55:54 +11:00
Mark Vieira
0009de3575
Upgrade Bouncy Castle FIPS dependencies (#112989) (#119614)
This PR updates `bc-fips` and `bctls-fips` dependencies to the latest
minor versions.

(cherry picked from commit 6ea3e01958)

Co-authored-by: Slobodan Adamović <slobodanadamovic@users.noreply.github.com>
2025-01-07 08:03:17 +11:00
Rene Groeschke
4d17b2193a
Update Gradle wrapper to 8.12 (#118683) (#119357)
This updates the gradle wrapper to 8.12

We addressed deprecation warnings due to the update that includes:

- Fix change in TestOutputEvent api
- Fix deprecation in groovy syntax
- Use latest ospackage plugin containing our fix
- Remove project usages at execution time
- Fix deprecated project references in repository-old-versions

(cherry picked from commit ba61f8c7f7)

# Conflicts:
#	build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/distribution/DockerCloudElasticsearchDistributionType.java
#	build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/distribution/DockerUbiElasticsearchDistributionType.java
#	build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/test/Fixture.java
#	plugins/repository-hdfs/hadoop-client-api/build.gradle
#	server/src/main/java/org/elasticsearch/inference/ChunkingOptions.java
#	x-pack/plugin/kql/build.gradle
#	x-pack/plugin/migrate/build.gradle
#	x-pack/plugin/security/qa/security-basic/build.gradle
2024-12-31 08:37:28 +01:00
Rene Groeschke
f75095c7ef
[Build] Make test cluster plugin configuration cache compatible (#116890) (#119367)
This adds infrastructure to make the legacy test cluster plugin and
the legacy test cluster based test plugins generally configuration cache compatible.

(cherry picked from commit 8c20ac5884)

# Conflicts:
#	qa/mixed-cluster/build.gradle
2024-12-31 06:04:16 +11:00
Rene Groeschke
c158859921
[8.16] Reapply "[Build] Do not invalidate configuration cache when branch is switched (#118894)" (#119300) (#119325) (#119338)
* Reapply "[Build] Do not invalidate configuration cache when branch is switched (#118894)" (#119300) (#119325)

* Reapply "[Build] Do not invalidate configuration cache when branch is switched (#118894)" (#119300)

The original PR (#118894) has broken serverless.

* Fix gitinfo plugin for serverless usage

* Update buildscan git revision reference

(cherry picked from commit 5278159987)

# Conflicts:
#	build-conventions/src/main/java/org/elasticsearch/gradle/internal/conventions/PublishPlugin.java

* Fix merge conflict
2024-12-30 15:31:36 +01:00
Mark Vieira
30e418f653
[ci] Add Alma Linux 9 to matrix in packaging and platform jobs (#118331) (#119315)
SmbTestContainer base image upgraded from Ubuntu 16.04 to 24.04 to avoid
 hanging Python module compilation when installing samba package.
 Installing SMB had to be moved from container building to starting because
 SYS_ADMIN capability is required.

(cherry picked from commit a0f64d2c9d)

# Conflicts:
#	.buildkite/pipelines/pull-request/packaging-tests-unix.yml

Co-authored-by: Mariusz Józala <377355+jozala@users.noreply.github.com>
2024-12-28 04:39:13 +11:00
Francesco Gualazzi
08997a27da
apm-data: add event.ingested field to APM documents (#117970) (#119209)
Restore a field originally populated by Fleet final ingest pipeline
in all APM documents.

---------

Signed-off-by: inge4pres <francesco.gualazzi@elastic.co>
(cherry picked from commit 78385f3701)
2024-12-23 23:58:12 +00:00
Niels Bauman
24816e8594
Expose BwC enrich cache setting in plugin (#119131) (#119195)
This actually allows users to set the BwC setting.
2024-12-24 06:49:25 +11:00
Bogdan Pintea
37f0de2416
Allow warning for some date specifiers (#119216) (#119232)
Allow warning header for date specifiers that could change in JDK23.
Relevant for 8.x BWC tests.

Related: #118603

Fixes #119148 Fixes #119151 Fixes #119152 Fixes #119153 Fixes #119154
Fixes #119160 Fixes #119161 Fixes #119162 Fixes #119163 Fixes #119164
Fixes #119165 Fixes #119166 Fixes #119167
2024-12-24 05:34:18 +11:00
Bogdan Pintea
fc20a26683
ESQL: allow DATE_PARSE to read the timezones (#118603) (#119119)
This just removes fixing a formatter to a timezone (UTC), allowing
`DATE_PARSE` to correctly read timezones.

Fixes #117680.
2024-12-20 04:58:35 +11:00
Bogdan Pintea
ec17616c76
ESQL: Docs: add example of date bucketing with offset (#116680) (#118986)
Add an example of how to create date histograms with an offset.

Fixes #114167
2024-12-19 04:19:01 +11:00
Jim Ferenczi
d563999ea8
Improve handling of nested fields in index reader wrappers (#118757) (#118981)
This update enhances the handling of parent filters to ensure proper exclusion of child documents.
2024-12-19 03:50:39 +11:00
Artem Prigoda
6ae803b9ae
[8.16] Mute NodesCachesStatsIntegTests#testNodesCachesStats (#118966)
See #116375
2024-12-19 02:25:10 +11:00
Andrei Stefan
323ec8330c
Adjust the test based on the year change (#118827) (#118833) 2024-12-17 23:13:30 +11:00