Commit graph

46 commits

Author SHA1 Message Date
David Turner
bdac01785a
Inline MockTransportService#getLocalDiscoNode() (#114883) (#114887)
This method just delegates to `getLocalNode()`, we may as well call the
more widely-used method with the shorter name directly.
2024-10-16 21:47:07 +11:00
Mariusz Józala
58781e2114
[8.x] [TEST] Migrated ccs-unavailable-clusters QA tests (#114764) (#114826)
* [TEST] Migrated ccs-unavailable-clusters QA tests (#114764)

Ccs-unavailable-clusters QA tests migrated to the new REST testing
framework, using 'elasticsearch.internal-java-rest-test' Gradle plugin

(cherry picked from commit 551a7d6d94)

* [TEST] Fix ccs-unavailable-clusters QA tests build (#114833)

Properly use `configureEach` on the task configuration to postpone the
tasks creation and configuration in the build process
2024-10-16 03:04:00 +11:00
Mark Vieira
0279c0a909
Add AGPLv3 as a supported license 2024-09-13 14:30:33 -07:00
Joe Gallo
f2e7b64c18
Remove gradle references to the rest-high-level client (#104871) 2024-01-29 14:13:06 -05:00
Armin Braun
36f08ea441
Make use of constants and utility methods to build empty SearchHits instances (#103983)
This are to be made ref-counted shortly. There's no point in having any
pooling/leak-tracking for empty instances though. To prepare for that,
lets add some short-cuts for dealing with empty instances to make the
overall change smaller and cleanup code already.
2024-01-05 17:43:06 +01:00
Armin Braun
7fc1fcb2ee
Remove InternalSearchResponse as well as most usage of SearchResponseSections (#103583)
This indirection isn't really necessary now that its use in the high
level rest client went away. -> flattened the `SearchResponse` class to
make ref counting easier -> removed `InternalSearchResponse` whose
functionality was completely redundant now -> removed serialization and
most of the usage of `SearchResponseSections`, only keeping this for the
few search execution spots that currently use it and where removing it
won't get us anything and will be a huge changeset.

enables the last steps in #102030
2023-12-20 12:57:36 -05:00
Armin Braun
c45b95d0eb
Remove some more ActionType subclasses (#102354)
Removing a couple more of these from the search package.

Co-authored-by: Joe Gallo <joegallo@gmail.com>
2023-11-27 19:11:19 +01:00
Ignacio Vera
cfa1a2e1da
Remove HighLevelRestClient from CrossClusterSearchUnavailableClusterIT (#102049) 2023-11-13 17:00:31 +01:00
Matteo Piergiovanni
d9c15c526e
Add counters to _clusters response for all states (#99566)
To help the user know what the possible cluster states are and to 
provide an accurate accounting, we added counters summarising
`running`, `partial` and `failed` clusters to the `_clusters` section.
Changes:
- Now in the response is present the number of `running` clusters.
- We split up `partial` and `successful` (before was summed up in the 
`successful` counter).
- We now have a counter for `failed` clusters.
- Now `total` is always equal to `running` + `skipped` + `failed` + 
`partial` + `successful`.
2023-09-28 09:28:45 +02:00
Dianna Hohensee
f69c5b1460
Call TransportService#registerRequestHandler with Executor (#99385)
Remove temporary TransportService#registerRequestHandler functions
that take String instead of Executor and update the callers. This
is part of a larger change to pass Executor into request handlers,
rather than creating and stashing Strings that are only used to
eventually fetch appropriate Executors anyway.

Extensive testing changes were required to make TransportService and
ThreadPool mocks capable of looking up Executors from Strings for
TransportAction constructors. Added a new MockUtils class to
modularize the additional test setup.

Part of the changes for #97879
2023-09-08 17:12:40 -04:00
Dianna Hohensee
7433b5122c Revert "Call TransportService#registerRequestHandler with Executor (#98998)"
This reverts commit df38bc8a84.
2023-09-08 13:40:21 -04:00
Dianna Hohensee
df38bc8a84
Call TransportService#registerRequestHandler with Executor (#98998)
Remove temporary TransportService#registerRequestHandler functions
that take String instead of Executor and update the callers. This
is part of a larger change to pass Executor into request handlers,
rather than creating and stashing Strings that are only used to
eventually fetch appropriate Executors anyway.

Extensive testing changes were required to make TransportService and
ThreadPool mocks capable of looking up Executors from Strings for
TransportAction constructors. Added a new MockUtils class to
modularize the additional test setup.

Part of the changes for #97879
2023-09-08 13:21:53 -04:00
Simon Cooper
f554a6ab2d
Remove the DiscoveryNode constructor that takes a Version (#97136) 2023-06-27 16:41:45 +01:00
Ryan Ernst
164e97e2ca
Encapsulate TransportVersion.CURRENT (#96681)
This commit changes access to the latest TransportVersion constant to
use a static method instead of a public static field. By encapsulating
the field we will be able to (in a followup) lazily determine what the
latest is, outside of clinit.
2023-06-13 18:44:15 -04:00
Nhat Nguyen
7da55d00b4
Integrate CCS with new search_shards API (#95894)
This PR integrates CCS with the new search_shards API. With this change, 
we will be able to skip shards on the coordinator on remote clusters
using the timestamps stored in the cluster state.

Relates #94534
Closes #93730
2023-05-17 11:36:52 -07:00
Simon Cooper
0d09580110
Add separate TransportVersion parameter to MockTransportService (#94105) 2023-02-27 09:24:22 +00:00
Mark Vieira
c2eda511de
Add JUnit rule based integration test cluster orchestration framework (#92379)
This commit adds a new test framework for configuring and orchestrating
test clusters for both Java and YAML REST testing. This will eventually
replace the existing "test-clusters" Gradle plugin and the build-time
cluster orchestration.
2022-12-21 15:33:46 -08:00
Rene Groeschke
5604f80958
Port QA projects to use javaRestTest and yamlRestTest (#86703)
Do not use deprecated elasticsearch.rest-test plugin
2022-05-12 11:32:07 +02:00
Mark Vieira
12ad399c48 Reformat Elasticsearch source 2021-10-27 08:19:51 -07:00
Lee Hinman
c017e1acdb
Add deprecation headers to HLRC classes (#79754)
This commit adds the @Deprecated annotation and Javadoc to HLRC classes.
2021-10-25 16:11:16 -06:00
Chris Hegarty
20c9f756d2
Fix split package org.elasticsearch.common.xcontent (#78831)
Fix the split package org.elasticsearch.common.xcontent, between server and the x-content lib. Move the x-content lib exported package from org.elasticsearch.common.xcontent to org.elasticsearch.xcontent ( following the naming convention of similar libraries ). Removing split packages is a prerequisite to modularization.
2021-10-08 17:14:26 +01:00
Rene Groeschke
e609e07cfe
Remove internal build logic from public build tool plugins (#72470)
Extract usage of internal API from TestClustersPlugin and PluginBuildPlugin and related plugins and build logic

This includes a refactoring of ElasticsearchDistribution to handle types
better in a way we can differentiate between supported Elasticsearch
Distribution types supported in TestCkustersPlugin and types only supported
in internal plugins.

It also introduces a set of internal versions of public plugins.

As part of this we also generate the plugin descriptors now.

As a follow up on this we can actually move these public used classes into 
an extra project (declared as included build)

We keep LoggedExec and VersionProperties effectively public And workaround for RestTestBase
2021-05-06 14:02:35 +02:00
Lyudmila Fokina
3b0b7941ae
Warn users if security is implicitly disabled (#70114)
* Warn users if security is implicitly disabled

Elasticsearch has security features implicitly disabled by default for
Basic and Trial licenses, unless explicitly set in the configuration
file.
This may be good for onboarding, but it also lead to unintended insecure
 clusters.
 This change introduces clear warnings when security features are
 implicitly disabled.
 - a warning header in each REST response if security is implicitly
 disabled;
 - a log message during cluster boot.
2021-04-13 18:33:41 +02:00
Mark Vieira
a92a647b9f Update sources with new SSPL+Elastic-2.0 license headers
As per the new licensing change for Elasticsearch and Kibana this commit
moves existing Apache 2.0 licensed source code to the new dual license
SSPL+Elastic license 2.0. In addition, existing x-pack code now uses
the new version 2.0 of the Elastic license. Full changes include:

 - Updating LICENSE and NOTICE files throughout the code base, as well
   as those packaged in our published artifacts
 - Update IDE integration to now use the new license header on newly
   created source files
 - Remove references to the "OSS" distribution from our documentation
 - Update build time verification checks to no longer allow Apache 2.0
   license header in Elasticsearch source code
 - Replace all existing Apache 2.0 license headers for non-xpack code
   with updated header (vendored code with Apache 2.0 headers obviously
   remains the same).
 - Replace all Elastic license 1.0 headers with new 2.0 header in xpack.
2021-02-02 16:10:53 -08:00
Rene Groeschke
680ea07f7f
Remove deprecated usage of testCompile configuration (#57921)
* Remove usage of deprecated testCompile configuration
* Replace testCompile usage by testImplementation
* Make testImplementation non transitive by default (as we did for testCompile)
* Update CONTRIBUTING about using testImplementation for test dependencies
* Fail on testCompile configuration usage
2020-06-12 13:34:53 +02:00
Tim Brooks
94f5accfed
Remove seeds depedency for remote cluster settings (#52796)
Currently 3 remote cluster settings (ping interval, skip unavailable,
and compression) have a dependency on the seeds setting being
comfigured. With proxy mode, it is now possible that these settings the
seeds setting has not been configured. This commit removes this
dependency and adds new validation for these settings.
2020-02-26 08:12:41 -07:00
Tim Brooks
342a2920a9
Rename the remote connection mode simple to proxy (#50291)
This commit renames the simple connection mode to the proxy connection
mode for remote cluster connections. In order to do this, the mode specific
settings which we namespaced by their mode (ex: sniff.seed and
proxy.addresses) have been reverted.
2019-12-19 09:31:28 -07:00
Tim Brooks
4f4140431b
Allow simple connection strategy to be configured (#49066)
Currently the simple connection strategy only exists in the code. It
cannot be configured. This commit moves in the direction of allowing it
to be configured. It introduces settings for the addresses and socket
count. Additionally it introduces new settings for the sniff strategy
so that the more generic number of connections and seed node settings
can be deprecated.

The simple settings are not yet registered as the registration is
dependent on follow-up work to validate the settings.
2019-11-19 09:08:03 -07:00
Rory Hunter
3a3e5f6176
Apply 2-space indent to all gradle scripts (#48849)
Closes #48724. Update `.editorconfig` to make the Java settings the default
for all files, and then apply a 2-space indent to all `*.gradle` files.
Then reformat all the files.
2019-11-13 10:14:04 +00:00
Alpar Torok
854215cae2
Testclusters: Convert additional projects (#43625)
* Testclusters: Convert additional projects

Found some more that were not using testclusters from elasticsearch-ci/1

* Allow IOException too

* Make the client more resilient
2019-06-28 16:38:17 +03:00
Mark Vieira
12d583dbf6
Remove unnecessary usage of Gradle dependency substitution rules (#42773) 2019-06-03 16:18:45 -07:00
Jason Tedor
0195626b6d
Remove cluster state size (#40061)
This commit removes the cluster state size field from the cluster state
response, and drops the backwards compatibility layer added in 6.7.0 to
continue to support this field. As calculation of this field was
expensive and had dubious value, we have elected to remove this field.
2019-03-15 13:06:22 -04:00
Luca Cavanna
622fb7883b
Introduce ability to minimize round-trips in CCS (#37828)
With #37566 we have introduced the ability to merge multiple search responses into one. That makes it possible to expose a new way of executing cross-cluster search requests, that makes CCS much faster whenever there is network latency between the CCS coordinating node and the remote clusters. The coordinating node can now send a single search request to each remote cluster, which gets reduced by each one of them. from + size results are requested to each cluster, and the reduce phase in each cluster is non final (meaning that buckets are not pruned and pipeline aggs are not executed). The CCS coordinating node performs an additional, final reduction, which produces one search response out of the multiple responses received from the different clusters.

This new execution path will be activated by default for any CCS request unless a scroll is provided or inner hits are requested as part of field collapsing. The search API accepts now a new parameter called ccs_minimize_roundtrips that allows to opt-out of the default behaviour.

Relates to #32125
2019-01-31 15:12:14 +01:00
Mayya Sharipova
f884b2b1cd
Deprecate types in index API (#36575)
* Deprecate types in index API

- deprecate type-based constructors of IndexRequest
- update tests to use typeless IndexRequest constructors
- no yaml tests as they have been already added in #35790

Relates to #35190
2018-12-18 08:53:49 -05:00
Jim Ferenczi
18866c4c0b
Make hits.total an object in the search response (#35849)
This commit changes the format of the `hits.total` in the search response to be an object with
a `value` and a `relation`. The `value` indicates the number of hits that match the query and the
`relation` indicates whether the number is accurate (in which case the relation is equals to `eq`)
or a lower bound of the total (in which case it is equals to `gte`).
This change also adds a parameter called `rest_total_hits_as_int` that can be used in the
search APIs to opt out from this change (retrieve the total hits as a number in the rest response).
Note that currently all search responses are accurate (`track_total_hits: true`) or they don't contain
`hits.total` (`track_total_hits: true`). We'll add a way to get a lower bound of the total hits in a
follow up (to allow numbers to be passed to `track_total_hits`).

Relates #33028
2018-12-05 19:49:06 +01:00
Martijn van Groningen
7624734f14
Added wait_for_metadata_version parameter to cluster state api. (#35535)
The `wait_for_metadata_version` parameter will instruct the cluster state
api to only return a cluster state until the metadata's version is equal or
greater than the version specified in `wait_for_metadata_version`. If  
the specified `wait_for_timeout` has expired then a timed out response 
is returned. (a response with no cluster state and wait for timed out flag set to true)
In  the case metadata's version is equal or higher than  `wait_for_metadata_version`
then the api will immediately return.

This feature is useful to avoid external components from constantly
polling the cluster state to whether somethings have changed in the
cluster state's metadata.
2018-11-26 08:50:08 +01:00
Jason Tedor
9a404f3def
Include fallback settings when checking dependencies (#33522)
Today when checking settings dependencies, we do not check if fallback
settings are present. This means, for example, that if
cluster.remote.*.seeds falls back to search.remote.*.seeds, and
cluster.remote.*.skip_unavailable and search.remote.*.skip_unavailable
depend on cluster.remote.*.seeds, and we have set search.remote.*.seeds
and search.remote.*.skip_unavailable, then validation will fail because
it is expected that cluster.ermote.*.seeds is set here. This commit
addresses this by also checking fallback settings when validating
dependencies. To do this, we adjust the settings exist method to also
check for fallback settings, a case that it was not handling previously.
2018-09-07 20:09:53 -04:00
Jason Tedor
d71ced1b00
Generalize search.remote settings to cluster.remote (#33413)
With features like CCR building on the CCS infrastructure, the settings
prefix search.remote makes less sense as the namespace for these remote
cluster settings than does a more general namespace like
cluster.remote. This commit replaces these settings with cluster.remote
with a fallback to the deprecated settings search.remote.
2018-09-05 20:43:44 -04:00
Nik Everett
2c81d7f77e
Build: Rework shadow plugin configuration (#32409)
This reworks how we configure the `shadow` plugin in the build. The major
change is that we no longer bundle dependencies in the `compile` configuration,
instead we bundle dependencies in the new `bundle` configuration. This feels
more right because it is a little more "opt in" rather than "opt out" and the
name of the `bundle` configuration is a little more obvious.

As an neat side effect of this, the `runtimeElements` configuration used when
one project depends on another now contains exactly the dependencies needed
to run the project so you no longer need to reference projects that use the
shadow plugin like this:

```
testCompile project(path: ':client:rest-high-level', configuration: 'shadow')
```

You can instead use the much more normal:

```
testCompile "org.elasticsearch.client:elasticsearch-rest-high-level-client:${version}"
```
2018-08-21 20:03:28 -04:00
Luca Cavanna
049966a829
Check that client methods match API defined in the REST spec (#31825)
We have been encountering name mismatches between API defined in our
REST spec and method names that have been added to the high-level REST
client. We should check this automatically to prevent furher mismatches,
and correct all the current ones.

This commit adds a test for this and corrects the issues found by it.
2018-07-17 11:26:28 +02:00
Nik Everett
4d83a0dd5a
HLREST: Bundle the x-pack protocol project (#31904)
The `:x-pack:protocol` project is an implementation detail shared by the
xpack projects and the high level rest client and really doesn't deserve
its own maven coordinants and published javadoc. This change bundles
`:x-pack:protocol` into the high level rest client.

Relates to #29827
2018-07-10 17:59:15 -04:00
Ryan Ernst
59e7c6411a
Core: Combine messageRecieved methods in TransportRequestHandler (#31519)
TransportRequestHandler currently contains 2 messageReceived methods,
one which takes a Task, and one that does not. The first just delegates
to the second. This commit changes all existing implementors of
TransportRequestHandler to implement the version which takes Task, thus
allowing the class to be a functional interface, and eliminating the
need to throw exceptions when a task needs to be ensured.
2018-06-22 07:36:03 -07:00
Luca Cavanna
be4a101ea1
Add high-level client methods that accept RequestOptions (#31069)
With #30490 we have introduced a new way to provide request options
whenever sending a request using the high-level REST client. Before you
could provide headers as the last argument varargs of each API method,
now you can provide `RequestOptions` that in the future will allow to
provide more options which can be specified per request.

This commit deprecates all of the client methods that accept a `Header`
varargs argument in favour of new methods that accept `RequestOptions`
instead. For some API we don't even go through deprecation given that
they were not released since they were added, hence in that case we can
just move them to the new method.
2018-06-06 23:17:45 +02:00
Nik Everett
6695d11a97
Switch many QA projects to use new style requests (#30574)
In #29623 we added `Request` object flavored requests to the low level
REST client and in #30315 we deprecated the the old requests. This
changes many calls in the `qa` projects to use the new version.
2018-05-15 17:48:47 -04:00
Lee Hinman
8e8fdc4f0e
Decouple XContentBuilder from BytesReference (#28972)
* Decouple XContentBuilder from BytesReference

This commit removes all mentions of `BytesReference` from `XContentBuilder`.
This is needed so that we can completely decouple the XContent code and move it
into its own dependency.

While this change appears large, it is due to two main changes, moving
`.bytes()` and `.string()` out of XContentBuilder itself into static methods
`BytesReference.bytes` and `Strings.toString` respectively. The rest of the
change is code reacting to these changes (the majority of it in tests).

Relates to #28504
2018-03-14 13:47:57 -06:00
Luca Cavanna
29450de7b5
Cross Cluster Search: make remote clusters optional (#27182)
Today Cross Cluster Search requires at least one node in each remote cluster to be up once the cross cluster search is run. Otherwise the whole search request fails despite some of the data (either local and/or remote) is available. This happens when performing the _search/shards calls to find out which remote shards the query has to be executed on. This scenario is different from shard failures that may happen later on when the query is actually executed, in case e.g. remote shards are missing, which is not going to fail the whole request but rather yield partial results, and the _shards section in the response will indicate that.

This commit introduces a boolean setting per cluster called search.remote.$cluster_alias.skip_if_disconnected, set to false by default, which allows to skip certain clusters if they are down when trying to reach them through a cross cluster search requests. By default all clusters are mandatory.

Scroll requests support such setting too when they are first initiated (first search request with scroll parameter), but subsequent scroll rounds (_search/scroll endpoint) will fail if some of the remote clusters went down meanwhile.

The search API response contains now a new _clusters section, similar to the _shards section, that gets returned whenever one or more clusters were disconnected and got skipped:

"_clusters" : {
    "total" : 3,
    "successful" : 2,
    "skipped" : 1
}
Such section won't be part of the response if no clusters have been skipped.

The per cluster skip_unavailable setting value has also been added to the output of the remote/info API.
2017-11-21 11:41:47 +01:00