Commit Graph

7402 Commits

Author SHA1 Message Date
Felix Barnsteiner 75d9bd7790
Rename component templates and pipelines according to the new naming conventions (#99975)
- Creates a new StackTemplateRegistry that uses the new names
- The new registry only respects stack.templates.enabled for index templates
- Renames the old registry to LegacyStackTemplateRegistry
- Component templates are not duplicated but registered under two different names
- Documents the new naming convention
- Index templates are not renamed, at least for now, as there are some challenges with it
  See 7fd0423 for more details.
2023-10-25 11:56:28 +02:00
Ignacio Vera 8a9f4fed55
Remove explicit SearchResponse references from LegacyGeo, Aggregations and parent-join modules (#101250) 2023-10-24 17:46:25 +02:00
Stuart Tettemer ecd13e3f11
Metrics test framework (#101168)
Adds a test framework that validates instruments are registered before they are called and are not double registered.

Also records all invocations of Instruments and allows test authors to add validation to instruments.
2023-10-24 09:05:16 -05:00
Luca Cavanna b07feb507d
Percolator to support parsing script score query with params (#101051)
While dot expansion is disabled when parsing percolator queries at index
time, as that would interfere with query parsing,  we still use a wrapper parser
that is conservative about what methods it supports, assuming that
document parsing needs nextToken and not much more. Turns out that when
parsing queries instead, we need to support all the XContentParser
methods including map, list etc.

This commit adds a test for script score query parsing through document
parsing via percolator field mapper, and removes the limitations in the
wrapper parser when dots expansion is disabled.
2023-10-24 11:03:28 +02:00
Yang Wang aa30dad01f
S3 CAS operation should respect abortMutipartUpload failure (#101253)
We inadvertently made s3 CAS operation to ignore abortMutipartUpload
failures in #98664. This PR fixes it.
2023-10-24 04:37:05 -04:00
David Turner 2757e30010
Make S3 anti-contention delay configurable (#101245)
The anti-contention delay in the S3 repository's compare-and-exchange
operation is hard-coded at 1 second today, but sometimes we encounter a
repository that needs much longer to perform a compare-and-exchange
operation when under contention. With this commit we make the
anti-contention delay configurable.
2023-10-24 08:13:55 +01:00
Lorenzo Dematté b094268961
Remove not needed node selector from some aggregation tests (#100947) 2023-10-24 08:58:29 +02:00
Stuart Tettemer d8b2c52c82
Metrics refactor - split registry and service (#101154)
This splits out the registry and the service, which makes testing easier and removes much of the delegation from the old `APMMeter` to `Instruments` (now renamed `APMMeterRegistry`).

APMMeterService takes care of the lifecycle and APMMeterRegistry holds the instruments.
2023-10-23 13:28:46 -05:00
Armin Braun 3945ee75d0
Use assertAcked more (#101201)
Just found that we have a lot of inconsistency and needless verbosity
here in tests. We can just use `assertAcked` in a couple spots
to save `.get`, `.actionGet` etc., especially with the signature
change I added here.
2023-10-23 19:48:10 +02:00
Martijn van Groningen af08d28d38
Fix painless execute api and tsdb issue. (#101212)
Today using painless execute api with tsdb index can fail with a `_id must be unset or set to [cn4exTOUtxytuLkQAAABeRnR_mY] but was [_id] because [test_index] is in time_series mode` error.
This change addresses this.

The painless execute api shouldn't set use a static _id, but
let the TsidExtractingIdFieldMapper generate it.
Otherwise validation TsidExtractingIdFieldMapper fails.

Closes #101072
2023-10-23 16:40:21 +02:00
David Turner 9794c6e205
Use ESIntegTestCase#prepareSearch more (#101179)
The refactoring in #101175 only covered all the one-arg call sites. This
PR does the rest.
2023-10-20 18:33:00 +01:00
Armin Braun 1521484d11
Remove more explicit references to SearchResponse in tests (#101092) (#101172)
Follow-up to #100966.

Add more assertion overloads that consume a requestBuilder as in the
other PRs and start using `assertHitCount` in more places that were
duplicating what it does. Also add a shortcut for
`client().prepareSearch()` to integ tests and bulk-replace some usages
of this pattern to avoid these changes from blowing up test code line
count further.
2023-10-20 07:48:37 -04:00
David Turner 1eda6ac74b
Extract ESIntegTestCase#prepareSearch (#101175)
Relates #101172
2023-10-20 06:18:58 -04:00
Ryan Ernst 8a1db8c6c3
Move index version constants to IndexVersions (#101094)
Similar to the TransportVersions holder class, IndexVersions is the new
place to contain all constants for IndexVersion. This commit moves all
existing constants to the new class. It is purely mechanical.
2023-10-19 20:44:51 -04:00
Armin Braun ca6295e582
Remove more explicit references to SearchResponse in tests (#101092)
Remove `assertSearchResponse` which was just an alias for
`assertNoFailures` and then cleanup many spots in the result
by combining the hit count and no failure assertion into a single
method.

follow-up to #100966
2023-10-19 17:53:13 +02:00
Armin Braun 03ea4bbe6e
Remove more explicit references to SearchResponse in tests (#101052)
Follow up to #100966 introducing new combined assertion `assertSearchHitsWithoutFailures`
to combine no-failure, count, and id assertions into one block.
2023-10-18 20:27:52 +02:00
Mark Vieira 2a6c16079c
Migrate painless and runtime fields common tests to new test clusters (#101021) 2023-10-18 07:39:39 -07:00
David Turner 3ce905b754
Remove more unnecessary ActionType subclasses (#101053)
Relates #97721
2023-10-18 13:56:40 +01:00
Armin Braun dcaba064dd
Remove more explicit SearchResponse references from test code (#100985)
Follow-up to #100966 adding more overrides to assertions that
consume a request builder.
2023-10-18 07:20:01 +02:00
Keith Massey 92ec9d6605
Add executed pipelines to bulk api response (#100031)
This change allows users to pass a new list_executed_pipelines parameter
to the bulk API, which results in an executed_pipelines list being returned.
2023-10-17 09:39:09 -05:00
Ryan Ernst af2f0609ac
Improve painless error wrapping (#100872)
Painless sandboxes some errors from Java for which it can recover. These
errors are wrapped within a ScriptException. However, retaining the
error as a cause can be confusing when walking the error chain. This
commit wraps the error so that the real error type does not appear,
but maintains the same error message in xcontent serialized form.
2023-10-17 06:59:13 -07:00
Armin Braun bae6991fb3
Remove ~600 references to SearchResponse in tests (#100966)
We'd like to make `SearchResponse` reference counted and pooled but there are around 6k
instances of tests that create a `SearchResponse` local variable that would need to be
released manually to avoid leaks in the tests.
This does away with about 10% of these spots by adding an override for `assertHitCount`
that handles the actual execution of the search request and its release automatically
and making use of it in all spots where the `.get()` on the request build could be inlined
semi-automatically and in a straight-forward fashion without other code changes.
2023-10-17 15:43:36 +02:00
Albert Zaharovits d6df838307
Refactor REST tests to the new internal cluster rule orchestration (#100399)
This PR is migrating some of the ITs that use either the
`elasticsearch.legacy-java-rest-test` or the
`elasticsearch.legacy-yaml-rest-test` gradle test plugins to the new 
`elasticsearch.internal-java-rest-test` and
`elasticsearch.internal-yaml-rest-test` equivalents. This is the list of
the affected ITs:  * SamlAuthenticationIT  * OperatorPrivilegesIT  *
ProfileIT  * SetSecurityUserProcessorWithWithSecurityDisabledIT  *
AsyncSearchSecurityIT  * SecurityRealmSmokeTestCase  *
KibanaSystemIndexIT  * KerberosAuthenticationIT  * ReindexWithSecurityIT
and ReindexWithSecurityClientYamlTestSuiteIT  *
ReloadSecureSettingsWithPasswordProtectedKeystoreRestIT  * PermissionsIT
from slm:qa:with-security  * Permissions IT from
runtime-fields:with-security  * Permissions IT from ilm:qa:with-securiy 
* GraphWithSecurityIT and GraphWithSecurityInsufficientRoleIT

Related: ES-6751
2023-10-17 07:42:43 -04:00
David Turner 596c3cbd4b
TransportNodesAction impls are local-only (#100867)
There are no remote invocations of any actions derived from
`TransportNodesAction` so there is no need to register the top-level
action with the `TransportService`, and that means that all the code
related to de/serialization of the top-level request and response is
unused and can be removed.

Relates #100111 Relates #100878
2023-10-17 04:27:37 -04:00
Ievgen Degtiarenko 14952cd7ea
Fix collision in field names (#100940)
Emmited metrics could not be index as elasticsearch.metrics.s3.exceptions field
is both long counter and a parent object for a histogram. This change renames
histogram to avoid the conflict.
2023-10-17 09:40:41 +02:00
Ignacio Vera a82f0ac7b0
Add runtime field of type geo_shape (#100492)
This commit adds the possibility to create runtime fields of type geo-shape. In order to create them, users can 
define an emit function that takes either a geojson object or a WKT string that internally creates a geometry object.
2023-10-16 13:14:28 +02:00
Alan Woodward edab22a31c
Consistent scores for multi-term SourceConfirmedTestQuery (#100846)
SourceConfirmedTestQuery uses a QueryVisitor to collect terms from
its inner query to build its internal SimScorer. It is important to hold these
terms in a consistent order so that when scores for each term are summed,
the order of summation is the same as it would be for the inner query. This
commit changes the call to visit to use a LinkedHashSet to ensure that
terms are iterated in the order in which they are collected.

Fixes #98712
2023-10-16 10:11:10 +01:00
Yang Wang 65b4d594ae
Push s3 requests count via metrics API (#100383)
This PR builds on top of #100464 to publish s3 request count via the metrics API.
The metric takes the name of `repositories.requests.count` with 
attributes/dimensions of 
`{"repo_type": "s3", "repo_name": "xxx", "operation": "xxx", "purpose": "xxx"}`.

Closes: ES-6801
2023-10-16 10:01:26 +11:00
Kostas Krikellas ff6ef15fff
[TEST] Mute all tsdb tests in mixedClusterTests, for versions 8.7 - 8.10 (#100805)
* Don't print synthetic source in mapping for bwc tests

* Move comment.

* Don't print synthetic source in mapping for bwc tests #2

* Don't print synthetic source in mapping for bwc tests #2

* Revert "Don't print synthetic source in mapping for bwc tests #2"

This reverts commit 034262c5d2.

* Revert "Don't print synthetic source in mapping for bwc tests #2"

This reverts commit 44e815635e.

* Revert "Don't print synthetic source in mapping for bwc tests (#100572)"

This reverts commit 9322ab9b91.

* Exclude synthetic source test from mixedClusterTests

* Update comment.

* Mute all tsdb tests in mixedClusterTests

This is an interim step to stop sporadic test failures, while we try to
fix version skip for mixed cluster tests.

* Remove old exclusion

* Add aggregations too

* Mute tests for versions between 8.7-8.10

* Remove mute
2023-10-13 13:33:03 +03:00
Kostas Krikellas a9562a1e73
Accept fielddata memory size 0 (#100756)
Terms aggregation supports a `global_ordinals` execution hint that
switches the underlying implementation to use
`GlobalOrdinalsStringTermsAggregator`. If applied on a text field,
fielddata get populated. However, in mixedClusterTests there are many
nodes, and some contain no data so fielddata won't get populated either.

Fixes #99774
2023-10-13 09:18:00 +03:00
Volodymyr Krasnikov 6029e557f8
Support complex datemath expressions in index and index alias names (#100646)
* Support complex datemath expressions in index and index alias names

* Update docs/changelog/100646.yaml

* Follow PR comments

* fix

---------

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2023-10-12 16:18:49 -07:00
David Turner 63030a31cb
Compute repo format version within delete/cleanup (#100714)
Today we rely on the caller computing the appropriate repository format
version based on the nodes in the cluster and the snapshots in (some
recent copy of) the `RepositoryData`. This commit moves that computation
into `createSnapshotsDeletion` so that (a) we can be sure to use the
same `RepositoryData` used for the rest of the process, and (b) we avoid
dispatching work to the SNAPSHOT pool twice.

Relates a comment on #100657
2023-10-12 02:23:07 -04:00
Keith Massey 1c1f0fd24d
Adding replica shards for ingest-common yaml rest tests (#100638) 2023-10-11 13:18:34 -05:00
Keith Massey add3fdc50f
Allowing a warning in a 230_change_target_index yaml rest test (#100686)
This adds an allowed warning when an index template is created in `Test
Change Target Index with Default Pipeline`. This appears to happen more
frequently now that we're running in the new test framework
(https://github.com/elastic/elasticsearch/pull/100537). The index
template creation was also just recently added in
https://github.com/elastic/elasticsearch/pull/100540. Closes #100584
2023-10-11 12:03:29 -04:00
Ignacio Vera 9fb550be44
WellKnownBinary#toWKB should not throw an IOException (#100669)
The only reason this method is throwing an exception is because the
method ByteArrayOutputStream#close() is declaring it although it is a
noop. Therefore it can be safely ignored.

Thanks @romseygeek for bringing into attention.
2023-10-11 08:24:32 -04:00
Mary Gouseti 5dc7cccf13
Fix remaining logs tests (#100407)
In this PR we convert the remaining 3 yaml logs tests to java rest
tests. This should remove all the flaky tests from the data stream yaml
suite that's why we are reenabling it.

Closes: https://github.com/elastic/elasticsearch/issues/99911 Closes:
https://github.com/elastic/elasticsearch/issues/97795
2023-10-11 05:00:52 -04:00
Andrei Dan 370c8266b1
DSL waits for the tsdb time boundaries to lapse (#100470)
TSDB indices are expected to receive a large amounts of writes whilst
their time bounds are "active" (i.e they include `now`).
This ensures TSDB doesn't execute any ingest disruptive operations (like
delete, forcemerge, downsample) until the `end_time` for the TSDS
backing indices has lapsed.
2023-10-11 08:18:04 +01:00
David Turner b5843e4b98
Encapsulate snapshots deletion process (#100617)
Introduces the `SnapshotsDeletion` class which encapsulates the process
of deleting some collection of snapshots. In particular this class gives
us somewhere to store various deletion-wide data which significantly
reduces the length of some argument lists.

Relates #100568
2023-10-11 02:03:31 -04:00
Volodymyr Krasnikov 15828c9b6a
Add support for reindex over CCS (#96968)
* Allow prefix index naming while reindexing from remote

* Update docs/changelog/96968.yaml

* Add ignore_unavailable index option to query parameters

* Code style

* Fix asciidoc

* Exclude remote index names from reindex alias validation

* spotless fix

* Fix test

* Fix test

* code style fix

* Do not eval remote expr locally + IT test

* Fix test

* in progress

* Reverting back a bit (sync with main)

* Ignore remote names in ReindexValidator

* Add IT test, fix double re-indexing

* codestyle

* reduce scope of PR (do not handle ignore_unavailable request option)

* minus api specs file

* add datemath index name tests for within-cluster reindexing

* Move out (to separate PR) logic which handles complex datemath expressions
2023-10-10 13:11:11 -07:00
Przemyslaw Gomulka 3465a2bf18
Fix metric gauge creation model (#100609)
OTEL gauges should follow the callback model otherwise they will not be sent by
apm java agent. (or use BatchCallback)
This commit changes the gagues creation model to return Observable*Gauge
and uses AtomicLong/Double to store current value which will be polled when
metrics are exported (and callback is called)
2023-10-10 13:28:02 -05:00
Ievgen Degtiarenko 77b4fd12bf
Log aws request metrics (#100272)
This change logs amount of requests, exceptions and throttles from 
aws s3 api aggregated over a tumbling window.
2023-10-10 17:16:04 +02:00
Yang Wang 35737a50d0
[Test] Explicitly set number_of_shards to 1 (#100171)
Some tests rely on the natural index order for test assertions. This
works when the index has a single primary shard but fails otherwise.
This PR adjusts the relevant tests so that they explicitly configure the
number of shards to 1.

Relates: ES-6540
2023-10-10 23:51:52 +11:00
David Turner 969fd2acbf
Snapshot deletion process cleanups (#100568)
Reorders the methods involved in snapshot deletion to be closer together
and better match the flow of execution, and harmonises the names of many
parameters and local variables to make it easier to follow them through
the process.
2023-10-10 13:39:58 +01:00
David Turner 4369e79ae4 AwaitsFix for #99774 2023-10-10 12:19:59 +01:00
Keith Massey 878127ce77
Avoiding using the _template API in an iangest-common yaml rest test (#100540) 2023-10-09 17:29:30 -05:00
Keith Massey 1f85ad561b
Updating ingest-common rest tests to run in new rest test framework (#100537) 2023-10-09 17:27:42 -05:00
Keith Massey b92a2acc55
Allowing reroute processor yaml rest tests to work with indices or data streams (#100463) 2023-10-09 11:59:52 -05:00
Simon Cooper d81dbfa8da
Fix race condition in InstrumentsConcurrencyTests (#100518)
Fix a race condition between the two threads in
InstrumentsConcurrencyTests. If the second thread gets the lock first,
the test fails.

Fixes #100251
2023-10-09 11:57:13 -04:00
Yang Wang 525fe59ee2
Make APM meter available in s3 blobstore (#100464)
This PR wires the new Meter interface into S3BlobStore. The new meter
field remains unused in this PR. Actual metric collection will be
addressed in follow-ups.

Relates: ES-6801
2023-10-09 06:01:20 -04:00
Yang Wang a4db40d89c
Record operation purpose for s3 stats collection (#100236)
A new no-op OperationPurpose parameter is added in #99615 to all blob
store/container operation method. This PR updates the s3 stats
collection code to actually use this parameter for finer grained stats
collection and reports. This differentiation between purposes are kept 
internally for now. The stats are currently aggregated over operations for 
existing stats reporting. This means responses from both 
GetRepositoriesMetering API and GetBlobStoreStats API will not be changed. 
We will have follow-ups to expose the finer stats separately.

Relates: #99615
Relates: ES-6800
2023-10-09 19:55:31 +11:00