Commit Graph

8996 Commits

Author SHA1 Message Date
Keith Massey 72f2121b13
Adding a test for data stream effective mappings (#130491) 2025-07-03 08:34:23 -05:00
Yang Wang f15ef7c2ed
Snapshots support multi-project (#130000)
This PR makes snapshot service code and APIs multi-project compatible. 

Resolves: ES-10225 Resolves: ES-10226
2025-07-03 18:48:44 +10:00
Quentin Pradet f99cf38585
Add data-streams tests to restResourcesZip (#130424)
* Add data-streams tests to restResourcesZip

* Rename to restTests
2025-07-03 09:30:02 +04:00
Jordan Powers a6c4c08527
Fix index version check in match_only_text (#130415)
Accidentally used the wrong backport index version in #130363.
2025-07-03 04:18:07 +10:00
Patrick Doyle 89f701f4c4
Bootstrap entitlements for testing (#129268)
* Fix ExceptionSerializationTests to use getCodeSource instead of getResource.

Using getResource makes this sensitive to unrelated classpath entries,
such as the entitlement bridge library, that get prepended to the classpath.

* FIx logging tests to use org.elasticsearch.index instead of root logger.

Using the root logger makes this sensitive to unrelated
logging, such as from the entitlement library.

* Fix entitlement error message by stashing the module name in ModuleEntitlements.

Taking the actual module name from the class doesn't work in tests,
where those classes are loaded from the classpath and so their module
info is misleading.

* Ignore server locations whose representative class isn't loaded

* Partial initial implementation

* System properties: testOnlyClasspath and enableForTests

* Trivially allow some packages

* DEBUG: use TreeMap in TestScopeResolver for readability

* Special case bouncycastle for security plugin

* Add CONFIG to TestPathLookup

* Add the classpath to the source path list for every plugin

* Add @WithoutEntitlements to tests that run ES nodes

* Set es.entitlement.enableForTests for all libs

* Use @WithoutEntitlements on ingest plugin tests

* Substitute ALL-UNNAMED for module name in non-modular plugins

* Add missing entitlements found by unit tests

* Comment in TestScopeResolver

* Properly compute bridge jar location for patch-module

* Call out nonServerLibs

* Don't build two TestPathLookups

* More comments for meta-tests

* Remove redundant dependencies for bridgeJarConfig.

These are alread set in ElasticsearchJavaBasePlugin.

* Add bridge+agent dependencies only if those exist.

For serverless, those project dependencies don't exist, and we'll need
to add the dependencies differently, using Maven coordinates.

* [CI] Auto commit changes from spotless

* Pass testOnlyPath in environment instead of command line.

It's typically a very very long string, which made Windows angry.

* [CI] Auto commit changes from spotless

* Split testOnlyPathString at File.pathSeparator

* Use doFirst to delay setting testOnlyPath env var

* Trivially allow jimfs (??)

* Don't enforce entitlements on internalClusterTest for now

* Replace forbidden APIs

* Match testOnlyClasspath using URI instead of String.

We already get the "needle" in the form of a URI, so this skips
a step, and has the benefit of also working on Windows.

* [CI] Auto commit changes from spotless

* More forbidden APIs

* Disable configuration cache for LegacyYamlRestTestPluginFuncTest

* Strip carriage-return characters in expected output for ReleaseNotesGeneratorTest.

The template generator also strips these, so we need to do so to make this pass
on Windows.

Note that we use replace("\r", "") where the template generator uses
replace("\\r", ""). The latter didn't work for me when I tried it on Windows,
for reasons I'm not aware of.

* Move configureEntitlements to ElasticsearchTestBasePlugin as-is

* Use matching instead of if

* Remove requireNonNull

* Remove default configuration

* Set inputs instead of dependencies

* Use test.systemProperty

* Respond to PR comments

* Disable entitlement enforcement for ScopedSettingsTests.

This test works by altering the logging on the root logger.
With entitlements enabled, that will cause additional log statements to appear,
which interferes with the test.

* Address PR comments

* Moritz's configureJavaBaseModuleOptions

* Allow for entitlements not yet enforced in serverless

* fix entitlementBridge config after rename

* drop empty file collections

* Remove workaround in LegacyYamlRestTestPluginFuncTest

---------

Co-authored-by: elasticsearchmachine <infra-root+elasticsearchmachine@elastic.co>
Co-authored-by: Lorenzo Dematté <lorenzo.dematte@elastic.co>
Co-authored-by: Moritz Mack <mmack@apache.org>
2025-07-02 13:44:38 -04:00
Jordan Powers a69c48477f
Add index version for match_only_text stored field in binary format (#130363)
Follow-up to #130049 to gate using the binary format for the stored field
in match_only_text fields behind an index version.
2025-07-01 18:19:18 -07:00
Ryan Ernst 4b7de2fa30
Add http-only headers to ElasticsearchException (#130348)
When return an error from Elasticsearch exceptions may contain values
written as http response headers. ElasticsearchException contains a map
of headers that are added to the response. But these values are also
written to a special "header" section of the response body.

This commit renames the existing "headers" in ElasticsearchException to
"body headers", which are both http headers and written to the response
body. A new "http headers" is added for headers that should only be
written as response headers.
2025-07-01 15:03:08 -07:00
Keith Massey ae450dad20
Correctly handling data stream settings when component templates are used (#130394) 2025-07-01 12:40:37 -05:00
Keith Massey ff52007996
Adding rest actions for getting and updating data stream mappings (#130241) 2025-06-30 13:05:13 -05:00
Martijn van Groningen 15c0028c04
Fix match_only_text bugs if defined as multi-field (#130188)
* Fix match_only_text bugs if defined as multi-field

Bugs starting to occur when #129126 was merged.

Closes #129737
2025-06-30 17:35:54 +10:00
Sam Xiao a85a8ac6bb
Fix TransportPutDatabaseConfigurationActionTests (#130227) 2025-06-28 12:01:30 +08:00
Keith Massey 48f60b651f
Fixing multiproject handling in TransportUpdateDataStreamMappingsAction (#130247) 2025-06-27 17:18:34 -05:00
Tim Brooks ea2e7b4382
Reapply "Dispatch ingest work to coordination thread pool (#130152)
This reverts commit 73b0a60.

Additionally, it adds thread pool documentation.
2025-06-27 11:34:28 -06:00
Keith Massey 21bb836ce5
Adding actions to get and update data stream mappings (#130042) 2025-06-27 10:29:06 -05:00
Sam Xiao 6cb7b2d2f2
Make TransportPutDatabaseConfigurationAction project aware (#130063) 2025-06-27 16:15:49 +08:00
Joe Gallo 5931f08129
Tidy up project metadata fetching (#130130) 2025-06-26 19:00:22 -04:00
Jordan Powers 40a7d02269
Pull match_only_text fixes into main (#130049)
This brings in the fixes from #130020, with minor fixes to address review
nits from that PR.

Co-authored-by: Martijn van Groningen <martijn.v.groningen@gmail.com>
2025-06-27 04:31:33 +10:00
Martijn van Groningen c0b2bb1f75
Stop configuring `index.number_of_replicas` in mapper-extras yaml tests. (#130099) 2025-06-26 17:59:03 +02:00
Parker Timmins 9aaba25d58
Simple version of patterned_text with a single doc value for arguments (#129292)
Initial version of patterned_text mapper. Behaves similarly to match_only_text. This version uses a single SortedSetDocValues for a template and another for arguments. It splits the message by delimiters, the classifies a token as an argument if it contains a digit. All arguments are concatenated and inserted as a single doc value. A single inverted index is used, without positions. Phrase queries are still possible, using the SourceConfirmedTextQuery, but are not fast.
2025-06-25 21:31:32 -05:00
Keith Massey 528bd9c234
Adding mappings to data streams (#129787) 2025-06-25 15:03:28 -05:00
Sam Xiao 285b09ef8d
Remove geoip multi-project tests from release build (#129976) 2025-06-26 00:01:39 +08:00
Sam Xiao 41a47c24b7
Make GeoIP database node loader project-aware (#129829)
- loads the downloaded GeoIP databases from system index to ingest node file system for each project
- each project's databases are loaded to directory `tmp/geoip-databases/{nodeId}/{projectId}`
2025-06-25 12:46:47 +08:00
Brendan Cully 73b0a60a77
Revert "Dispatch ingest work to coordination thread pool (#129820)" (#129949)
This reverts commit 53dae7a3a2.
2025-06-24 14:38:50 -07:00
Keith Massey 0b58a53a98
Adding the ability to unset data stream settings (#129677) 2025-06-24 10:30:15 -05:00
David Turner 8573865341
Remove dead `@TestIssueLogging` anns from repo-s3 (#129906)
These logging directives relate to test failures that have long-since
been closed so can be removed.

Relates #101608
Relates #88841
2025-06-24 14:04:16 +01:00
Tim Brooks 53dae7a3a2
Dispatch ingest work to coordination thread pool (#129820)
The vast majority of ingest pipelines are light CPU
operations. We don't want these to be put behind IO work on the write
executor. Instead, execute these on the coordination pool.
2025-06-23 09:31:36 -06:00
Niels Bauman bae6e3c66d
Fix data stream stats YAML test (#129813)
Occasional shard allocation issues were causing the YAML tests to fail
because the shard that had the document with the max timestamp in it
would be unavailable.

Fixes #118217
2025-06-24 01:22:48 +10:00
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