Commit graph

15537 commits

Author SHA1 Message Date
elasticsearchmachine
970973a7bc Bump versions after 8.16.4 release 2025-02-11 20:18:32 +00:00
elasticsearchmachine
91666d14f2 Bump versions after 8.17.2 release 2025-02-11 19:50:48 +00:00
Lorenzo Dematté
546d1844eb
Add test to ensure backports from 9.1 are done correctly (#122016) 2025-02-11 10:30:34 +01:00
John Verwolf
7dce3566b7
Fix privileges for system index migration WRITE block (#122214)
* 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.

* Update release notes

* Delete docs/changelog/122214.yaml
2025-02-11 09:51:40 +11:00
Luca Cavanna
f078c384cc
Fix SearchTimeoutIT (#120390) (#122191)
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-11 06:43:46 +11:00
Martijn van Groningen
5634676786
Conditionally use sequential stored field reader in LuceneSyntheticSourceChangesSnapshot (#121636) (#122202)
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-11 06:38:06 +11:00
Samiul Monir
e54acc36f9
Fix - Requesting _inference_fields when using legacy format causes shard failure (#121720) (#122177)
* 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-11 01:52:25 +11:00
Mary Gouseti
a699e976b0
[9.0] [Deprecation API] Adjust details in the SourceFieldMapper deprecation warning (#122041) (#122068)
* [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.

* Remove bwc code
2025-02-08 10:25:09 +11:00
Nik Everett
e1f8b51648
Aggs: Comment on deprecated execution mode (#122046) (#122077)
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 06:56:39 +11:00
David Turner
4fa137d6b2
Fork post-snapshot-delete cleanup off master thread (#122047) (#122073)
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 06:14:31 +11:00
Ryan Ernst
f5d3f3810f
Add 9.0 patch transport version constants #121985 (#121986)
* 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 is a backport of #121985, adding unique transport version patch
numbers for each change intended for 9.0.

* match constant naming in main
2025-02-07 12:10:23 +11:00
Joe Gallo
eb32a9beb2
Fix geoip databases index access after system feature migration (#121196) (#121946)
Co-authored-by: Keith Massey <keith.massey@elastic.co>
2025-02-07 11:20:16 +11:00
Mark Vieira
a4014054f1
Upgrade mockito (#121849) (#121931) 2025-02-06 12:22:10 -08:00
David Turner
6bd583ada8
[9.0] Validate transport handshake from known version (#121747) (#121801)
* 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.

* Fix version/transportversion confusion

* CI poke
2025-02-07 04:33:32 +11:00
Mark Tozzi
e0dac2e855
Aggregations cancellation after collection (#120944) (#121921)
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-07 04:25:44 +11:00
David Turner
eea697edb8
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:57:49 +00:00
David Turner
24b7b6982c
[9.0] Improve logging of put-mapping failures (#121372) (#121385)
* 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.

* CI poke

* CI poke
2025-02-07 02:03:29 +11:00
David Turner
6ac2c15481
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:32:58 +00:00
Armin Braun
7e954bcd6d
Remove redundant list copy in CanMatchNodeRequest (#121700) (#121866)
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 14:56:26 +11:00
Ryan Ernst
9a477f7816
Rename environment dir accessors (#121803) (#121834)
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-06 10:14:00 +11:00
Nik Everett
b5442275ee
ESQL: Add description to status and profile (#121783) (#121823)
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 18:01:45 -05:00
Mayya Sharipova
4b16ef0d70
Analyze API to return 400 for wrong custom analyzer (#121568) (#121814)
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 09:45:47 +11:00
Armin Braun
4efc72bf5b
Remvoe some more dead code from o.e.search.aggregations (#121498) (#121812)
Just some obvious dead code removal.
2025-02-06 08:23:42 +11:00
Artem Prigoda
c28b54de7b
[9.0] Don't return or accept node_version in the Desired Nodes API (#119049) (#121775)
Backports #119049 to 9.0

>  Re-submission of #114580
>  node_version was deprecated in #104209 (8.13) and shouldn't be set or returned in 9.0
2025-02-06 04:59:51 +11:00
Oleksandr Kolomiiets
a8eb81a1e6
Fix synthetic source issue with deeply nested ignored source fields (#121715) (#121788)
* Fix synthetic source issue with deeply nested ignored source fields

* Update docs/changelog/121715.yaml
2025-02-06 04:48:53 +11:00
Artem Prigoda
83eb627984
[9.0] Remove the failures field from snapshot responses (#114496) (#121770)
Backports #114496 to 9.0

> 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 17:41:28 +01:00
Artem Prigoda
66e8b106f9
[9.0] Simplify TransportStats assertions in v9 (#114700) (#121761)
Backports #114700 to 9.0

> Transport handling times were added in #80581 (8.1), we don't need assertions for version prior to that in 9.0
2025-02-06 02:20:50 +11:00
David Turner
28ee4d1c24
Migrate to v9 transport handshake (#121646) (#121755)
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-06 00:10:49 +11:00
Nhat Nguyen
ee4be36d83
Unmute EsqlSpecIT for more logging (#121500) (#121630)
Tracked at #121411
2025-02-04 18:30:38 +11:00
Nhat Nguyen
e140e3be97
Fix relocation targets in FieldCapabilitiesIT (#121606) (#121622)
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-04 16:29:25 +11:00
Mike Pellegrini
161ffa72fb
Enable New Semantic Text Format Only On Newly Created Indices (#121556) (#121571) 2025-02-04 09:08:04 +11:00
Simon Cooper
a95b0a9a5f
Use NavigableSet for representing test version sets, rather than List (#121266) (#121531) 2025-02-04 02:19:22 +11:00
Simon Cooper
ede1e771b6
Update transport and index version id numbers to S_PP (#121380) (#121518)
Backport #121380 to 9.0
2025-02-03 12:40:42 +00:00
Simon Cooper
e85610fe37
[9.0] Create transport version for 9.0 release (#120936) (#121388)
Also bump the minimum compatible version to something similar to what 8.18 will be
2025-02-03 09:54:24 +00:00
Patrick Doyle
7795011c0c
Always use String getLogger with log4j (#121250) (#121421)
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.

Co-authored-by: Ryan Ernst <ryan@iernst.net>
2025-02-01 03:42:27 +11:00
Simon Cooper
3606326d53
Integrate watsonx for re-ranking task (#117176) (#121389)
* 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: Saikat Sarkar <132922331+saikatsarkar056@users.noreply.github.com>
Co-authored-by: elasticsearchmachine <infra-root+elasticsearchmachine@elastic.co>
2025-01-31 09:21:53 -07:00
Mark Vieira
803b7c1733
Remove 8.19.0 version constant from 9.0 2025-01-31 07:22:32 -08:00
Ryan Ernst
08775c3ed4
Pass environment paths into entitlement bootstrap (#121347) (#121397)
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-02-01 02:03:11 +11:00
Patrick Doyle
e4854aa866
Backport Refactor: separate package for entitlement records (#121204) (#121339)
* Refactor: separate package for entitlement records (#121204)

* Fix PolicyManagerTests after package move (#121304)

* Fix PolicyManagerTests after package move

* Unmute
2025-02-01 01:50:25 +11:00
Kostas Krikellas
21710e7a84
Fix propagation of dynamic mapping parameter when applying copy_to (#121109) (#121386)
(cherry picked from commit 1225b0720a)

# Conflicts:
#	rest-api-spec/build.gradle

Co-authored-by: Oleksandr Kolomiiets <oleksandr.kolomiiets@elastic.co>
2025-01-31 15:31:04 +02:00
Mark Vieira
1681488c90
Add 8.19.0 version constant 2025-01-30 09:23:22 -08:00
David Turner
3d32222575
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-30 16:14:14 +00:00
Chris Hegarty
4baffe4de1
Upgrade to Lucene 10.1.0 (#119308)
This commit upgrades to Lucene 10.1.0.
2025-01-30 13:41:02 +00:00
Oleksandr Kolomiiets
10aec784fe
Ensure that feature flag is enabled in new KeywordFieldMapperTests (#121248)
`DOC_VALUES_SPARSE_INDEX` is needed for tests to work.
2025-01-30 11:19:55 +11:00
Tim Grein
a40370ab56
[Inference API] Add node-local rate limiting for the inference API (#120400)
* Add node-local rate limiting for the inference API

* Fix integration tests by using new LocalStateInferencePlugin instead of InferencePlugin and adjust formatting.

* Correct feature flag name

* Add more docs, reorganize methods and make some methods package private

* Clarify comment in BaseInferenceActionRequest

* Fix wrong merge

* Fix checkstyle

* Fix checkstyle in tests

* Check that the service we want to the read the rate limit config for actually exists

* [CI] Auto commit changes from spotless

* checkStyle apply

* Update docs/changelog/120400.yaml

* Move rate limit division logic to RequestExecutorService

* Spotless apply

* Remove debug sout

* Adding a few suggestions

* Adam feedback

* Fix compilation error

* [CI] Auto commit changes from spotless

* Add BWC test case to InferenceActionRequestTests

* Add BWC test case to UnifiedCompletionActionRequestTests

* Update x-pack/plugin/inference/src/main/java/org/elasticsearch/xpack/inference/common/InferenceServiceNodeLocalRateLimitCalculator.java

Co-authored-by: Adam Demjen <demjened@gmail.com>

* Update x-pack/plugin/inference/src/main/java/org/elasticsearch/xpack/inference/common/InferenceServiceNodeLocalRateLimitCalculator.java

Co-authored-by: Adam Demjen <demjened@gmail.com>

* Remove addressed TODO

* Spotless apply

* Only use new rate limit specific feature flag

* Use ThreadLocalRandom

* [CI] Auto commit changes from spotless

* Use Randomness.get()

* [CI] Auto commit changes from spotless

* Fix import

* Use ConcurrentHashMap in InferenceServiceNodeLocalRateLimitCalculator

* Check for null value in getRateLimitAssignment and remove AtomicReference

* Remove newAssignments

* Up the default rate limit for completions

* Put deprecated feature flag back in

* Check feature flag in BaseTransportInferenceAction

* spotlessApply

* Export inference.common

* Do not export inference.common

* Provide noop rate limit calculator, if feature flag is disabled

* Add proper dependency injection

---------

Co-authored-by: elasticsearchmachine <infra-root+elasticsearchmachine@elastic.co>
Co-authored-by: Jonathan Buttner <jonathan.buttner@elastic.co>
Co-authored-by: Adam Demjen <demjened@gmail.com>
2025-01-29 18:50:17 -05:00
Larisa Motova
bcd8d159d6
[ES|QL] Support some stats on aggregate_metric_double (#120343)
Adds non-grouping support for min, max, sum, and count, using
CompositeBlock as the underlying block type and an internal
FromAggregateMetricDouble function to handle converting from
CompositeBlock to the correct metric subfields.

Closes #110649
2025-01-29 12:08:46 -10:00
Jim Ferenczi
dbeb55cb3d
Enable Mapped Field Types to Override Default Highlighter (#121176)
This commit introduces the `MappedFieldType#getDefaultHighlighter`, allowing a specific highlighter to be enforced for a field.
The semantic field mapper utilizes this new functionality to set the `semantic` highlighter as the default.
All other fields will continue to use the `unified` highlighter by default.
2025-01-29 21:55:53 +00:00
Oleksandr Kolomiiets
74f91780e0
Fix check for sort fields being in nested objects (#121084) 2025-01-29 21:03:47 +01:00
Slobodan Adamović
c5ab17c3aa
Deprecate certificate-based remote cluster security model (#120806)
Today, Elasticsearch supports two models to establish secure connections
and trust between two Elasticsearch clusters:

- API key based security model
- Certificate based security model

This PR deprecates the _Certificate based security model_ in favour of *API key based security model*.
The _API key based security model_ is preferred way to configure remote clusters,
as it allows to follow security best practices when setting up remote cluster connections
and defining fine-grained access control.

Users are encouraged to migrate remote clusters from certificate to API key authentication.
2025-01-29 19:43:04 +01:00
Joe Gallo
d763805141
Optimize IngestDocument FieldPath allocation (#120573) 2025-01-29 13:38:43 -05:00