Commit graph

16636 commits

Author SHA1 Message Date
Nhat Nguyen
da95df1186
Fix BlockHash DirectEncoder (#108283) (#108329)
The DirectEncoder currently returns the incorrect value for the
positionCount() method, which should be the number of positions ready in
the current batch. We need to keep track of whether a position is loaded
via encodeNextBatch() and consumed via the read() method. However, we
can always return 1 for positionCount(), indicating that one position is
already loaded. Our tests failed to catch this because mv_ordering
wasn't enabled when generating test blocks, effectively disabling the
DirectEncoders.

Closes #108268
2024-05-06 12:54:58 -04:00
Nhat Nguyen
a928c58248
Fix random limit in AsyncOperatorTests (#108289) (#108323)
Adjust the lower bound to include the case where the number of positions is zero.

Closes #107847
2024-05-06 11:39:59 -04:00
Yang Wang
9094f79a28
Ensure necessary security context for s3 bulk deletions (#108280) (#108299)
This PR moves the doPrivileged wrapper closer to the actual deletion
request to ensure the necesary security context is established at all
times. Also added a new repository setting to configure max size for s3
deleteObjects request.

Fixes: #108049
(cherry picked from commit bcf4297e89)

# Conflicts:
#	docs/reference/snapshot-restore/repository-s3.asciidoc
#	modules/repository-s3/src/main/java/org/elasticsearch/repositories/s3/S3BlobStore.java
2024-05-06 07:34:57 -04:00
Simon Cooper
0fe59cac90
Backport serialization fixes to 8.13 (#108250)
Backport of #107862 to 8.13
2024-05-03 16:59:01 +01:00
Pat Whelan
28e54f61ef
Revert "[Transform] Allow transforms to use PIT with remote clusters … (#107970)
This reverts commit 9b584aa1f2.
2024-04-29 07:39:59 -04:00
Slobodan Adamović
bc676f31ab
[Test] Fix AsyncSearchResponse resource leak in security tests (#107809) (#107819)
Closes #107759
2024-04-24 05:31:25 -04:00
Bogdan Pintea
5f9392a485
SQL: Fix JdbcPreparedStatementIT.testDatetimeWithNanos (#107629) (#107686)
Fixes #105677
2024-04-22 08:18:11 -04:00
Bogdan Pintea
1375558ca0
SQL: Limit how much space some string functions can use (#107333) (#107621)
This will check and fail if certain functions would generate a result
exceeding a certain fixed byte size.

This prevents an operation/query to fail the entire VM.
2024-04-18 11:10:43 -04:00
Alexander Spies
ecb06ef904
ESQL: Fix missing refs due to pruning renamed grouping columns (#107328) (#107599)
Sometimes, CombineProjections does not correctly update an aggregation's groupings when combining with a preceding projection.
Fix this by resolving any aliases used in the groupings and de-duplicating them.

---------

Co-authored-by: Andrei Stefan <astefan@users.noreply.github.com>
(cherry picked from commit adaa4763f3)

# Conflicts:
#	x-pack/plugin/esql/qa/testFixtures/src/main/resources/stats.csv-spec
#	x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/optimizer/LogicalPlanOptimizerTests.java
2024-04-18 05:03:51 -04:00
Przemyslaw Gomulka
8c36f081f3
Improve EarlyDeprecationindexingIT test reliability backport(#105696) #107540
this test intends to test the bulkProcessor2's request consumer (see DeprecationIndexingComponent#getBulkProcessor) scheduling requests before the startup is completed (flush is enabled). To verify this behaviour the flush has to happen before the templates are loaded. To test this reliably the flush interval in the test should be as small as possible (not hardcoded 5s as of now)

This commit introduces a setting (not meant to be exposed/documented) to allow for the flush interval to be configured. It also adds additional trace logging to help with troubleshooting.

relates #104716
2024-04-16 18:18:46 +02:00
Alexander Spies
cb33b9d19c
ESQL: Fix version test failure on non-SNAPSHOT builds (#107138) (#107365)
Test the snapshot ESQL version separately and take the current build
into account.

(cherry picked from commit ad77d32271)
2024-04-11 17:43:56 +02:00
Alexander Spies
c1b7823259
ESQL: Introduce language versioning to REST API (#106824) (#107301)
For the _query endpoint, add a parameter for the ESQL language version to the JSON payload.
For now, it is optional and is only validated with no further action.
2024-04-10 13:39:47 +02:00
Niels Bauman
f9506522f1
Avoid unintentionally clearing the DataStream.rolloverOnWrite flag (#107122) (#107206)
A lot of places in the code use a `DataStream` constructor that sets the
`rolloverOnWrite` flag to `false`. For some places, this was
intentional, but for others, this was erroneous (and for most tests, it
didn't matter much).

This PR fixes the erroneous spots and avoids similar unintentional
behavior in the future by removing the constructor in question
altogether. Most use cases just want to copy the flag over and if you
_do_ want to set the flag to false, it makes more sense to do so
explicitly yourself rather than letting the constructor do it for you.

An additional small bonus is that we have one less constructor for the
`DataStream` class :).

Follow up of
[this](https://github.com/elastic/elasticsearch/pull/107035#discussion_r1549299287)
discussion.
2024-04-08 15:09:34 +02:00
Costin Leau
dd2060156c
ESQL: Fix bug when combining projections (#107131) (#107167)
Recursive aliases (eval x = 1, x1 = x) were not taken into account when
 combining projections causing the target field to be lost (and only the
 immediate intermediate named expression to be used instead which became
 invalid).

Fix #107083

(cherry picked from commit a9388e16ad)
2024-04-05 15:03:43 -04:00
David Kyle
7ff6bf5e42
[ML] Update last usages of model_id to inference_id (#107133) (#107149) 2024-04-05 08:10:40 -04:00
Alexander Spies
02c93e160e
[8.13] ESQL: Fix fully pruned aggregates (#106673) (#107144)
Fix a bug where PruneColumns would sometimes completely replace an Aggregate, producing the wrong number of rows as a result.

(cherry picked from commit edc9e6787a and updated the test skips)
2024-04-05 13:01:06 +02:00
Martijn van Groningen
4d62a32810
Fix a downsample persistent task assignment bug (#106247) (#106280)
If as part of the persistent task assignment the source downsample index no longer exists, then the persistent task framework will continuously try to find an assignment and fail with IndexNotFoundException (which gets logged as a warning on elected master node).

This fixes a bug in resolving the shard routing, so that if the index no longer exists any node is returned and the persistent task can fail gracefully at a later stage.

The original fix via #98769 didn't get this part right.

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2024-04-05 03:57:52 -04:00
Albert Zaharovits
2eb9729a00
[8.13] Query API Keys support for both aggs and aggregations keywords (#… (#107108)
The Query API Key Information endpoint supports aggs since #104895.
But some lang clients actually use the aggregations term in requests, as the preferred synonym.
This PR adds support for the aggregations request term as a synonym for the existing aggs term.

Backport of #107054
2024-04-05 10:49:52 +03:00
Alexander Spies
b1eb32bdfd
[8.13] ESQL: Fix count pushdown for unmapped fields (#106690) (#106710)
Backport #106690 but avoid introducing the same optimization regression by also including the fix from #106720.
2024-04-05 09:10:40 +02:00
Albert Zaharovits
ee1acffa05
Query API Key Information API support for the typed_keys request parameter (#106873) (#107110)
The typed_keys request parameter is the canonical parameter,
that's also used in the regular index _search enpoint, in order to
return the types of aggregations in the response.
This is required by typed language clients of the _security/_query/api_key
endpoint that are using aggregations.

Backport of #106873
2024-04-05 09:50:30 +03:00
Jedr Blaszyk
a28a31a5a0
[Connector API] Support numeric for configuration select option value type (#107059) (#107098) 2024-04-04 08:49:25 -04:00
Efe Gürkan YALAMAN
13da633c16
Update license acknowledgement messages for Search (#106857) (#107014)
License state messages are shown to user when license expires, or
license state changed. Updated Search text to include current features.
2024-04-02 14:45:10 -04:00
Salvatore Campagna
8c28f22b74
Update mixed cluster test skip version for downsampling (#106942) (#106944)
All nodes on the mixed cluster need to be at least on version
8.10 since PR #97557 introduced execution of downsampling tasks
using the persisten task framework which is incompatible with
how execution was coordinated before.
2024-03-30 20:05:07 -04:00
Nhat Nguyen
ba9f7af873
Fix downsample action request serialization (#106920)
Backport of #106919
2024-03-29 10:29:37 -07:00
Nhat Nguyen
9287f29bba
Fix downsample persistent task params serialization bwc (#106878) (#106896)
Missing a check on the transport version results in unreadable cluster state
if it includes a serialized instance of DownsampleShardTaskParams.
serie indices.
Reading an optional array requires reading a boolean first which is required to
know if an array of values exists in serialized form. From 8.13 on we try to
read such a boolean which is not there because older versions don't write any
boolean nor any string array. Here we include the check on versions for backward
compatibility skipping reading any boolean or array whatsoever whenever not possible.

Customers using downsampling might have cluster states including such serielized
objects and would be unable to upgrade to version 8.13. They will be able to
upgrade to any version including this fix.

This fix has a side effect #106880

Co-authored-by: Salvatore Campagna <93581129+salvatore-campagna@users.noreply.github.com>
2024-03-28 23:51:48 -04:00
Julia Bardi
b96c1d5036
[Fleet] Added all privilege to kibana_system to logs-fleet_server.* index pattern (#106815) (#106863)
* Update KibanaOwnedReservedRoleDescriptors.java

* replaced all with read, delete_index
2024-03-28 07:25:34 -04:00
Pat Whelan
d361eec8a8
[Transform] Fail checkpoint on missing clusters (#106793) (#106842)
When there are no remote or local clusters for a given source index, we
call the listener's `onFailure` method with a `CheckpointException`.
A running transform will fail and retry, eventually moving into an
unhealthy and failed state.  Any call to the stats API will note the
checkpoint failure and return.

This fixes a timeout issue calling the Transform stats API and prevents
the Transform from being stuck in indexing.

Fix #106790
Fix #104533
2024-03-27 16:15:31 -04:00
Przemysław Witek
7bc04a6b3c
[Transform] Raise loglevel of events related to transform lifecycle from DEBUG to INFO (#106602) (#106816) 2024-03-27 16:37:33 +01:00
Luca Cavanna
57b0de7318
Fix concurrency bug in AbstractStringScriptFieldAutomatonQuery (#106678)
Back when we introduced queries against runtime fields, Elasticsearch did not support
inter-segment concurrency yet. At the time, it was fine to assume that segments will be
searched sequentially. AbstractStringScriptFieldAutomatonQuery used to have a BytesRefBuilder
instance shared across the segments, which gets re-initialized when each segment starts its work.
This is no longer possible with inter-segment concurrency.

Closes #105911
2024-03-26 17:39:31 +01:00
Rene Groeschke
341446d3e1
Update Gradle wrapper to 8.7 (#105854) (#106713)
removed tiny issue on build script that seems like an oversight and doesn't do anything at all
2024-03-26 08:33:54 +01:00
David Kyle
416589d13e
[ML] Fix Array out of bounds exception in the XLM Roberta tokenizer (#106655) (#106661)
Increases the buffer size for the normalised form of the input unicode 
character. Certain characters can have surprisingly long normalised forms
2024-03-22 07:58:57 -04:00
Przemysław Witek
c212abddeb
[Transform] Fix _reset API when called with force=true on a failed transform (#106574) (#106589) 2024-03-21 06:42:13 -04:00
Mark Vieira
d1c98f39fd
Validate that test cluster BWC nodes use the default distribution (#106559) (#106565)
We have instances where BWC tests configure old ES version nodes with
the integTest distribution. This isn't a valid configuration, and while
we in reality resolve the default distribution artifact, we have other
configuration logic that behaves differently based on whether the
integTest distro was _requested_. Specifically, what to set ES_JAVA_HOME
to. This bug resulted in us attempting to run old nodes using the
current bundled JDK version, which may be incompatible with that older
version of Elasticsearch.

Closes #104858
2024-03-20 12:55:47 -04:00
Aurélien FOUCRET
e29365583d
Ensure ILM policy is installed before starting the tests. (#106523) (#106545) 2024-03-20 09:19:11 -04:00
Nhat Nguyen
76aee0b313
Fix testCancelRequestWhenFailingFetchingPages (#106447) (#106515)
If we proceed without waiting for pages, we might cancel the main 
request before starting the data-node request. As a result, the exchange
sinks on data-nodes won't be removed until the inactive_timeout elapses,
which is longer than the assertBusy timeout.

Closes #106443
2024-03-19 18:54:03 -04:00
Nhat Nguyen
9a8864c21e
AwaitsFix #106443 (#106453) 2024-03-18 21:59:24 -04:00
Nhat Nguyen
aa2e022b31
Resume driver when failing to fetch pages (#106392) (#106436)
I investigated a heap attack test failure and found that an ESQL request
was stuck. This occurred in the following:

1. The ExchangeSource on the coordinator was blocked on reading because
there were no available pages.

2. Meanwhile, the ExchangeSink on the data node had pages ready for
fetching.

3. When an exchange request tried to fetch pages, it failed due to a
CircuitBreakingException. Despite the failure, no cancellation was
triggered because the status of the ExchangeSource on the coordinator
remained unchanged.  To fix this issue, this PR introduces two changes:

Resumes the ExchangeSourceOperator and Driver on the coordinator,
eventually allowing the coordinator to trigger cancellation of the
request when failing to fetch pages.

Ensures that an exchange sink on the data nodes fails when a data node
request is cancelled. This callback was inadvertently omitted when
introducing the node-level reduction in Run empty reduction node level
on data nodes #106204.

I plan to spend some time to harden the exchange and compute service.

Closes #106262
2024-03-18 12:04:22 -07:00
Craig Taverner
5dd26f762d
Make new spatial sort tests less flaky (#106401) (#106405)
The tests that assert sorting on spatial types causes consistent error messages, also were flaky for the non-error message cases under rare circumstances where the results were returned in different order. We now sort those on a sortable field for deterministic behaviour.
2024-03-18 07:47:33 -04:00
Athena Brown
97d4a86427
Adjust interception of requests for specific shard IDs (#101656) (#106376)
Some index requests target shard IDs specifically, which may not match the indices that the request targets as given by `IndicesRequest#indices()`, which requires a different interception strategy in order to make sure those requests are handled correctly in all cases and that any malformed messages are caught early to aid in troubleshooting.

This PR adds and interface allowing requests to report the shard IDs they target as well as the index names, and adjusts the interception of those requests as appropriate to handle those shard IDs in the cases where they are relevant.
2024-03-14 19:52:33 -04:00
Craig Taverner
45576fc0b4
ESQL: Fix error on sorting unsortable geo_point and cartesian_point (#106351) (#106379)
* Fix error on sorting unsortable geo_point and cartesian_point

Without a LIMIT the correct error worked, but with LIMIT it did not. This fix mimics the same error with LIMIT and adds tests for all three scenarios:
* Without limit
* With Limit
* From row with limit

* Update docs/changelog/106351.yaml

* Add tests for geo_shape and cartesian_shape also

* Updated changelog

* Separate point and shape error messages

* Move error to later so we get it only if geo field is actually used in sort.

* Implemented planner check in Verifier instead

This is a much better solution.

* Revert previous solution

* Also check non-field attributes so the same error is provided for ROW

* Changed "can't" to "cannot"

* Add unit tests for verifier error

* Added sort limitations to documentation

* Added unit tests for spatial fields in VerifierTests

* Don't run the new yaml tests on older versions

These tests mostly test the validation errors which were changed only in 8.14.0, so should not be tested in earlier versions.

* Simplify check based on code review, skip duplicate forEachDown
2024-03-14 19:08:05 -04:00
Kathleen DeRusso
b835827311
Fix Search Applications bug where deleting an alias before deleting an application intermittently caused errors (#106329) (#106354)
* Update delete object to never fail if alias does not exist

* Update docs/changelog/106329.yaml

* Update changelog

* Fix area in changelog
2024-03-14 09:18:16 -04:00
Lloyd
44e8f72b47
[IdP plugin] Fix exception handling (#106231) (#106336)
* Add regression tests that test ACS and entity id mismatch, causing
  us to go into the initCause branch

* Fix up exception creation: initCause it not
  allowed because ElasticsearchException
  initialises the cause to `null` already if
  it isn't passed as a contructor param.

Signed-off-by: lloydmeta <lloydmeta@gmail.com>
2024-03-13 20:25:30 -04:00
Youhei Sakurai
5198e7f041
Handling exceptions on watcher reload (#105442) (#106210) 2024-03-13 15:46:24 -05:00
Jonathan Buttner
74dfe58f11
Allowing byte and int8 (#106299) (#106326)
(cherry picked from commit de33a57f55)

# Conflicts:
#	x-pack/plugin/inference/src/main/java/org/elasticsearch/xpack/inference/services/cohere/CohereService.java
#	x-pack/plugin/inference/src/main/java/org/elasticsearch/xpack/inference/services/cohere/CohereServiceSettings.java
#	x-pack/plugin/inference/src/main/java/org/elasticsearch/xpack/inference/services/openai/OpenAiService.java
#	x-pack/plugin/inference/src/main/java/org/elasticsearch/xpack/inference/services/openai/embeddings/OpenAiEmbeddingsServiceSettings.java
#	x-pack/plugin/inference/src/test/java/org/elasticsearch/xpack/inference/services/cohere/CohereServiceSettingsTests.java
#	x-pack/plugin/inference/src/test/java/org/elasticsearch/xpack/inference/services/cohere/embeddings/CohereEmbeddingsServiceSettingsTests.java
#	x-pack/plugin/inference/src/test/java/org/elasticsearch/xpack/inference/services/openai/embeddings/OpenAiEmbeddingsServiceSettingsTests.java

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2024-03-13 16:05:57 -04:00
Kostas Krikellas
be29f7fe3b
[TEST] Increase timeout for rollover to exceed look_ahead_time (#106290) (#106291)
`look_ahead_time` is set to 1 minute, the `assertBusy` loop needs to
wait for longer than that to get a readonly backing index. 

Note that this is only relevant when the `UpdateTimeSeriesRangeService`
kicks in to bump the end time of the head index. This is rare (it runs
every 10 minutes) but can happen.

Fixes #101428
2024-03-13 11:20:25 -04:00
Rene Groeschke
aefa784360
Cleanup SamlAuthenticationIT (#106227) (#106287)
Remove comments about awaitsFix
2024-03-13 09:32:55 -04:00
Rene Groeschke
63e4917775
Add Saml test connection timeout debugging output (#104801) (#106226)
Add additional logging to idp test fixture container

(cherry picked from commit 46beceb180)
2024-03-13 13:07:11 +01:00
Kostas Krikellas
3d7122996b
backport pr-106225 (#106278) 2024-03-13 04:27:45 -04:00
David Kyle
f30f6adf98
[ML] Make task settings optional when creating Cohere embedding models (#106241) (#106258)
# Conflicts:
#	x-pack/plugin/inference/src/test/java/org/elasticsearch/xpack/inference/services/cohere/CohereServiceTests.java
2024-03-12 14:33:44 -04:00
Aurélien FOUCRET
ad161a1586
Ensure LTR models are cached when used as a rescorer. (#106161) 2024-03-11 14:59:50 +01:00