Commit Graph

8969 Commits

Author SHA1 Message Date
Sam Xiao e3838a4b9c
Make GeoIp downloader multi-project aware (#128282)
This change makes the GeoIp persistent task executor/downloader multi-project aware. 
- the database downloader persistent task will be at the project level, meaning there will be a downloader instance per project
- persistent task id is prefixed with project id, namely `<project-id>/geoip-downloader` for cluster in MP mode
2025-06-23 15:07:40 +08:00
Luke Whiting a952245178
Fix missing feature flag on Streams YAML tests (#129747)
* Fix missing feature flag on YAML tests

* Unmute tests
2025-06-20 21:12:51 +10:00
Mikhail Berezovskiy eeca493860
Move HTTP content aggregation from Netty into RestController (#129302) 2025-06-19 09:05:17 -07:00
Luke Whiting 1ccf1c6806
Streams - Log's Enable, Disable and Status endpoints (#129474)
* Enable And Disable Endpoint

* Status Endpoint

* Integration Tests

* REST Spec

* REST Spec tests

* Some documentation

* Update docs/changelog/129474.yaml

* Fix failing security test

* PR Fixes

* PR Fixes - Add missing feature flag name to YAML spec

* PR Fixes - Fix support for timeout and master_timeout parameters

* PR Fixes - Make the REST handler validation happy with the new params

* Delete docs/changelog/129474.yaml

* PR Fixes - Switch to local metadata action type and improve request handling

* PR Fixes - Make enable / disable endpoint cancellable

* PR Fixes - Switch timeout param name for status endpoint

* PR Fixes - Switch timeout param name for status endpoint in spec

* PR Fixes - Enforce local only use for status action

* PR Fixes - Refactor StreamsMetadata into server

* PR Fixes - Add streams module to multi project YAML test suite

* PR Fixes - Add streams cluster module to multi project YAML test suite
2025-06-19 11:48:44 +01:00
Pete Gillin 8555c16290
Fix `testPurgeCacheEntriesForDatabase` on Windows (#129648)
Our hypothesis is that the path is not round-tripping on Windows. This
fixes the test by always using the canonical string for the path, when
inserting and when purging.

Fixes #129635
2025-06-19 09:06:09 +01:00
Yang Wang 91ee26f690
[Test] Use default project s3 repo tests (#129683)
The stateful side tests generally do not exercise multi-project.
Therefore we need to use the default project-id instead of random one.

Relates: #127631
2025-06-19 16:42:19 +10:00
Yang Wang 92b32b535b
Passing in project-id when creating s3 client (#129301)
Enables creating different s3 clients for different projects

Relates: #127631
2025-06-19 12:34:11 +10:00
Keith Massey 92e4244f8e
Putting the ingest otel processor behind the logs stream feature flag (#129667) 2025-06-18 17:40:12 -05:00
Pooya Salehi a229c8d932
Integrate project global blocks into existing checks for cluster blocks (Part 2) (#129570)
Relates https://github.com/elastic/elasticsearch/pull/129467
Resolves ES-11209
2025-06-18 19:51:40 +10:00
Pete Gillin c4249a8596
ES-11372: Add project ID to key for geoip cache (#129572)
In this change, the lazy loader passes in the default project ID. That
will be fixed in a later PR.

ES-11372 #comment Project ID added to cache key in https://github.com/elastic/elasticsearch/pull/129572
2025-06-18 09:19:04 +01:00
Keith Massey 90c24d06e7
Fixing for loop in DataStreamSettingsIT (#129564) 2025-06-18 05:30:16 +10:00
Jordan Powers 5d1999781a
Use optimized text in match_only_text fields (#129371)
Follow-up to #126492 to use the json parsing optimizations for
match_only_text fields.

Relates to #129072.
2025-06-17 08:15:40 -07:00
Niels Bauman 9f78d11639
Remove usages of `DataStream#getDefaultBackingIndexName` (#129466)
These usages had the potential of causing test failures when a data
stream was created before midnight and the backing index name generation
ran the next day - which would be millisecconds apart. To avoid these
failures, we update the tests to be robust to these time differences.

Resolves #123376
2025-06-17 11:02:52 -03:00
Niels Bauman 398da36f49
Make use of new `projectClient` method and remove old one (#129393)
We added a new `projectClient` method on `Client` in #129174. We now
update the usages of the old method (on `ProjectResolver`) to use the
new one and we delete the old method.
2025-06-17 13:39:04 +02:00
Pooya Salehi d3d10c2efb
Integrate project global blocks into existing checks for cluster blocks (#129467)
This PR updates some of the existing checks for cluster blocks to also consider project global blocks. It adds a few project-aware flavour of existing methods in `ClusterBlocks`. `globalBlockedException(ClusterBlockLevel)` is the mostly used one. I've updated only some of the obvious ones here. 
Follow up to https://github.com/elastic/elasticsearch/pull/127978
Relates ES-11209
2025-06-17 12:36:59 +02:00
Martijn van Groningen a0cc698fa2
Update multi field stored by default index version check (#129386)
Relates to #129126
2025-06-17 12:20:38 +02:00
Yang Wang adf4d1005f
Setting for estimated shard heap allocation decider (#128722)
This PR adds a new setting to toggle the collection for shard heap
usages as well as wiring ShardHeapUsage into ClusterInfoSimulator.

Relates: #128723
2025-06-17 13:28:00 +10:00
Moritz Mack 9e5cac34a4
Expand bcUpgradeTask to run more test suites. (#128983)
Relates to ES-11904

#128984 contains the changes to the PR buildkite pipeline to test this change while the buildkite changes are not merged yet.
2025-06-13 12:58:49 +02:00
Niels Bauman 87c6fa7e9b
Introduce projectClient method on Client (#129174)
We originally defined the `projectClient` method on `ProjectResolver` as
a convenience method to execute API calls for specific projects. That
method requires a reference to both a `ProjectResolver` and a `Client`.

We now introduce the same method directly on the `Client` interface and
inject a `ProjectResolver` there, removing the need for a
`ProjectResolver` reference in places that just want to execute API
requests on a specific project.

To reduce the number of changes, this change solely focuses on
introducing the new method. Future changes will migrate the uses of the
original method to the new one and remove the original altogether.
2025-06-12 15:19:16 -03:00
Simon Cooper 3988ee1935
Check positions on MultiPhraseQueries as well as phrase queries (#129326) 2025-06-12 16:05:07 +01:00
Ignacio Vera f02a3c423f
Revert "Use IndexOrDocValuesQuery in NumberFieldType#termQuery implementations (#128293)" (#129206)
This reverts commit de7c91c1d9.
2025-06-12 10:10:29 +02:00
Martijn van Groningen 33af83a0ca
Synthetic source: avoid storing multi fields of type text and match_only_text by default. (#129126)
Don't store text and match_only_text field by default when source mode is synthetic and a field is a multi field or when there is a suitable multi field.

Without this change, ES would store field otherwise twice in a multi-field configuration.

For example:

```
...
"os": {
  "properties": {
    "name": {
      "ignore_above": 1024,
      "type": "keyword",
      "fields": {
        "text": {
          "type": "match_only_text"
        }
      }
    }
...
```

In this case, two stored fields were added, one in case for the `name` field and one for `name.text` multi-field.
This change prevents this, and would never store a stored field when text or match_only_text field is a multi-field.
2025-06-10 16:32:47 +02:00
Luigi Dell'Aquila aa87f46681
Optimize date rounding (#128687) 2025-06-10 10:56:56 +02:00
Tanguy Leroux fa383afcc5
Small changes in concurrent multipart upload interfaces (#128977)
Small changes in BlobContainer interface and wrapper.

Relates ES-11815
2025-06-06 16:58:39 +02:00
Niels Bauman 3f037751b4
Remove non-test usages of `Metadata.Builder#putCustom` (#128801)
This removes all non-test usages of
```
Metadata.Builder.putCustom(String type, ProjectCustom custom)
```
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-06-06 09:00:24 +02:00
Iván Cea Fontenla 36828e2f72
Aggs: Fix significant terms not finding background documents for nested fields (#128472)
Closes https://github.com/elastic/elasticsearch/issues/101163

Fixes the `significant_terms` aggregation not working correctly on nested fields.
2025-06-04 15:54:35 +03:00
Tanguy Leroux f190a69f5f
Add documentation to concurrent multipart upload utility methods (#128821)
In the hope to make more sense of how the flux of byte buffer works.
Also remove the synchronization on the input stream.

Relates ES-11815
2025-06-04 18:28:37 +10:00
eyalkoren d3d2d9b996
Adding `NormalizeForStreamProcessor` (#125699) 2025-06-03 13:11:12 -04:00
Mary Gouseti 9764730d49
Remove include_default query param from get data stream options. (#128730)
Initially we added to the `include_defaults` to the get data stream
options REST API as it was used in the lifecycler API; however, we
decided to simplify it and not use it. We remove it now before it gets
adopted.
2025-06-03 18:15:42 +10:00
Ben Chaplin 13bce60be9
Fix inner hits + aggregations concurrency bug (#128036)
Validate Gradle Wrapper / Validation (push) Has been cancelled Details
Fork InnerHitSubContext instances before source is fetched in 
aggregations to prevent inter-segment race conditions.

Relates to #122419
2025-06-02 16:44:53 -04:00
Tanguy Leroux 9b2252afb2
Fix computation of last block size in Azure concurrent multipart uploads (#128746)
Last part size is wrongly computed to 0 when the last part's length is
exactly equal to the size of a part. Would have probably be caught by an
existing assertion.

Relates ES-11815
2025-06-03 00:11:16 +10:00
Benjamin Trent 2a44166a2c
Applying Apache Lucene fix: https://github.com/apache/lucene/pull/14732 (#128671)
* Applying Apache Lucene fix: https://github.com/apache/lucene/pull/14732

* fixing test

* fixing annot
2025-06-02 09:50:25 -04:00
Iván Cea Fontenla d597e50117
Use StringBuilder instead of StringBuffer (#128665) 2025-06-02 14:29:22 +03:00
Yang Wang b2867481de
[CI] Fix testClientsLifeCycleForSingleProject (#128718)
docs-build / docs-preview (push) Waiting to run Details
Validate Gradle Wrapper / Validation (push) Waiting to run Details
More robust test for closed clients holder. Also changes
IllegalStateException to AlreadyClosedException for both closed manager
and holder.

Resolves: #128707
2025-06-02 09:53:57 +10:00
Yang Wang 6311bb3512
Support per-project s3 clients (#127631)
With project secrets in place, we can now create and manage per-project
repository clients in addition to the cluster level repository clients.
This PR adds a manager class for that. Note that the logic is not yet
fully wired because it needs per-project repository/objec_store which
will be added in separate PRs (as part of MP snapshots and MP
objecStoreService). As such the tests are currently unit tests.

Relates: https://github.com/elastic/elasticsearch/pull/126584 Resolves:
ES-11713
2025-05-30 22:53:58 +10:00
Lorenzo Dematté 554b96aec9
[Entitlements] Add missing NIO async network instrumentation (#128582)
This PR adds some additional instrumentation to ensure we capture more cases in which we use async network usage via channels and `select`
2025-05-29 19:52:10 +03:00
Keith Massey dc2fbe19a6
Removing the data stream settings feature flag (#128594) 2025-05-29 09:50:14 -05:00
Tanguy Leroux e5cdc581cf
Add integration test for concurrent multipart uploads on Azure (#128503)
Enhances existing integration test to account for #128449.

Relates ES-11815
2025-05-28 10:59:35 +02:00
Yang Wang 6bc1452b43
Make repositories project aware (#128285)
docs-build / docs-preview (push) Waiting to run Details
Validate Gradle Wrapper / Validation (push) Waiting to run Details
Pass project-id explicitly to repository factory and make it part of the
repository interface.

Relates: ES-11839
2025-05-28 17:29:39 +10:00
Keith Massey 41f186dca0
Adding prefer_ilm as a whitelisted data stream setting (#128375) 2025-05-27 15:42:08 -05:00
Tanguy Leroux 3bc6a4368a
Support concurrent multipart uploads in Azure (#128449)
Introduces some basic support for concurrent multipart uploads 
on Azure, to help with benchmarking.

Relates ES-11815
2025-05-27 13:01:41 +02:00
David Turner 7bcbca1268
Upgrade MinIO test container (#128424)
Validate Gradle Wrapper / Validation (push) Waiting to run Details
Earlier versions of MinIO had a bug which can cause repository analysis
failures. This commit upgrades the MinIO test container version to pick
up the bug fix, and reverts the workaround implemented in #127166.

Relates https://github.com/minio/minio/issues/21189
2025-05-27 07:24:41 +01:00
Keith Massey 7207692056
Adding dry_run mode for setting data stream settings (#128269) 2025-05-23 11:29:00 -05:00
Ignacio Vera de7c91c1d9
Use IndexOrDocValuesQuery in NumberFieldType#termQuery implementations (#128293) 2025-05-23 16:58:50 +02:00
Lorenzo Dematté 6bf531660c
Fix NPE in APMTracer through RestController (#128314)
Our APMTracer doesn't like nulls - this is a sensible thing, as APM in general does not allow nulls (it only allows a precise set of types).
This PR changes the attribute to a sentinel "" in place of null values. It also makes a small change to APMTracer to give a better error message in case of null values in attributes.
2025-05-23 09:32:22 +02:00
David Turner 3504c27e7d
Remove exception-mangling in connect/close listeners (#127954)
The close-listeners are never completed exceptionally today so they do
not need the exception mangling of a `ListenableFuture`. The connect-
and remove-listeners sometimes see an exception if the connection
attempt fails, but they also do not need any exception-mangling.

This commit removes the exception-mangling by replacing these
`ListenableFuture` instances with `SubscribableListener` ones.
2025-05-22 21:22:04 +10:00
David Turner c3a1d58e25
Remove first `FlowControlHandler` from HTTP pipeline (#128099)
Today we have a `FlowControlHandler` near the top of the Netty HTTP
pipeline in order to hold back a request body while validating the
request headers. This is inefficient since once we've validated the
headers we can handle the body chunks as fast as they arrive, needing no
more flow control. Moreover today we always fork the validation
completion back onto the event loop, forcing any available chunks to be
buffered in the `FlowControlHandler`.

This commit moves the flow-control mechanism into
`Netty4HttpHeaderValidator` itself so that we can bypass it on validated
message bodies. Morever in the (common) case that validation completes
immediately, e.g. because the credentials are available in cache, then
with this commit we skip the flow-control-related buffering entirely.
2025-05-22 18:14:11 +10:00
Nick Tindall 268e39b05b
Make GoogleCloudStorageRetryingInputStream request same generation on resume (#127626) 2025-05-22 17:00:20 +10:00
Simon Chase e713f7c315
transport: pass network channel exceptions to close listeners (#127895)
docs-build / docs-preview (push) Waiting to run Details
Validate Gradle Wrapper / Validation (push) Waiting to run Details
Previously, exceptions encountered on a netty channel were caught and logged at
some level, but not passed to the TcpChannel or Transport.Connection close
listeners. This limited observability. This change implements this exception
reporting and passing, with TcpChannel.onException and NodeChannels.closeAndFail
reporting exceptions and their close listeners receiving them. Some test
infrastructure (FakeTcpChannel) and assertions in close listener onFailure
methods have been updated.
2025-05-21 12:04:45 -07:00
Pete Gillin 1fe3b77a2a
ES-10063 Add multi-project support for more stats APIs (#127650)
* Add multi-project support for more stats APIs

This affects the following APIs:
 - `GET _nodes/stats`:
   - For `indices`, it now prefixes the index name with the project ID (for non-default projects). Previously, it didn't tell you which project an index was in, and it failed if two projects had the same index name.
   - For `ingest`, it now gets the pipeline and processor stats for all projects, and prefixes the pipeline ID with the project ID. Previously, it only got them for the default project.
 - `GET /_cluster/stats`:
   - For `ingest`, it now aggregates the pipeline and processor stats for all projects. Previously, it only got them for the default project.
 - `GET /_info`:
   - For `ingest`, same as for `GET /_nodes/stats`.

This is done by making `IndicesService.stats()` and `IngestService.stats()` include project IDs in the `NodeIndicesStats` and `IngestStats` objects they return, and making those stats objects incorporate the project IDs when converting to XContent.

The transitive callers of these two methods are rather extensive (including all callers to `NodeService.stats()`, all callers of `TransportNodesStatsAction`, and so on). To ensure the change is safe, the callers were all checked out, and they fall into the following cases:
 - The behaviour change is one of the desired enhancements described above.
 - There is no behaviour change because it was getting node stats but neither `indices` nor `ingest` stats were requested.
 - There is no behaviour change because it was getting `indices` and/or `ingest` stats but only using aggregate values.
 - In `MachineLearningUsageTransportAction` and `TransportGetTrainedModelsStatsAction`, the `IngestStats` returned will return stats from all projects instead of just the default with this change, but they have been changed to filter the non-default project stats out, so this change is a noop there. (These actions are not MP-ready yet.)
 - `MonitoringService` will be affected, but this is the legacy monitoring module which is not in use anywhere that MP is going to be enabled. (If anything, the behaviour is probably improved by this change, as it will now include project IDs, rather than producing ambiguous unqualified results and failing in the case of duplicates.)

* Update test/external-modules/multi-project/build.gradle

Change suggested by Niels.

Co-authored-by: Niels Bauman <33722607+nielsbauman@users.noreply.github.com>

* Respond to review comments

* fix merge weirdness

* [CI] Auto commit changes from spotless

* Fix test compilation following upstream change to base class

* Update x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/datatiers/DataTierUsageFixtures.java

Co-authored-by: Niels Bauman <33722607+nielsbauman@users.noreply.github.com>

* Make projects-by-index map nullable and omit in single-project; always include project prefix in XContent in multip-project, even if default; also incorporate one other review comment

* Add a TODO

* update IT to reflect changed behaviour

* Switch to using XContent.Params to indicate whether it is multi-project or not

* Refactor NodesStatsMultiProjectIT to common up repeated assertions

* Defer use of ProjectIdResolver in REST handlers to keep tests happy

* Include index UUID in "unknown project" case

* Make the index-to-project map empty rather than null in the BWC deserialization case.

This works out fine, for the reasons given in the comment. As it happens, I'd already forgotten to do the null check in the one place it's actively used.

* remove a TODO that is done, and add a comment

* fix typo

* Get REST YAML tests working with project ID prefix TODO finish this

* As a drive-by, fix and un-suppress one of the health REST tests

* [CI] Auto commit changes from spotless

* TODO ugh

* Experiment with different stashing behaviour

* [CI] Auto commit changes from spotless

* Try a more sensible stash behaviour for assertions

* clarify comment

* Make checkstyle happy

* Make the way `Assertion` works more consistent, and simplify implementation

* [CI] Auto commit changes from spotless

* In RestNodesStatsAction, make the XContent params to channel.request(), which is the value it would have had before this change

---------

Co-authored-by: Niels Bauman <33722607+nielsbauman@users.noreply.github.com>
Co-authored-by: elasticsearchmachine <infra-root+elasticsearchmachine@elastic.co>
2025-05-21 19:04:22 +01:00