Commit Graph

7423 Commits

Author SHA1 Message Date
David Roberts f0008d3c27
Removing local abort availability checks (#75785)
Now that #74115 is backported to 7.x the code to check whether
local abort is supported within a cluster is redundant, as 8.x
only supports running in a mixed cluster with 7.last, and 7.last
contains the local abort functionality.

This change removes the redundant code.

Followup to #74115
2021-07-28 17:08:09 +01:00
Keith Massey 0790107f9a
Re-enabling BWC tests, and updating supported versions for shard count feature after backport (#75789) 2021-07-28 09:43:49 -05:00
Przemyslaw Gomulka c96139d006
[Rest Api Compatibility] Deprecate the use of synced flush (#75372)
synced flush is going to be replaced by flush. This commit allows to synced_flush api only in v7 compatibility mode.
Worth noting - sync_id is gone and won't be available in v7 responses from indices.stats

relates removal pr #50882
relates #51816
2021-07-28 14:17:49 +02:00
Julie Tibshirani ace7ac89e1 Remove incorrect assertion in CollapsingTopDocsCollectorSearchAfterTests
This assertion was simply wrong, but took time to catch as it was very rarely
triggered. The test already checks the correct assertion at an earlier time.

Fixes #75736.
2021-07-28 11:01:14 +03:00
Ignacio Vera 368e2e0755
Add 'mvt' field type format to geo fields (#75367)
In this commit we extend the Fields API formats for geo data in order to produce vector tiles features directly 
on the data nodes. That helps the vector tile API to reduce the size of the data that needs to pull in order to 
create the answer.
2021-07-28 09:24:54 +02:00
Rory Hunter 944b3f3b56
Fix compiler warnings in :server - part 1 (#75708)
Part of #40366. Fix a number of javac issues when linting is enforced in `server/`.
2021-07-27 19:40:40 +01:00
Ignacio Vera 02c29433d1
Vector tiles: order hits by geometry size by default (#75621)
_mvt end point gives priority to geometries with larger area
2021-07-27 18:34:21 +02:00
Armin Braun b22180e3c6
Enhance Shard Level Metdata check in BlobStoreTestUtil (#75737)
Adding check that shard level index metadata actually contains the snapshots
it's supposed to contain. This would have caught a number of recent bugs.
2021-07-27 18:07:52 +02:00
Keith Massey ddc3b37580
Adding shard count to node stats api (#75433)
* Adding shard count to _nodes/stats api

Added a shards section to each node returned by the _nodes/stats api. Currently this new section only contains a total count of all shards on the node.
2021-07-27 10:39:53 -05:00
Armin Braun f1ba7c4d5d
Fix Concurrent Snapshot Repository Corruption from Operations Queued after Failing Operations (#75733)
The node executing a shard level operation would in many cases communicate `null` for the shard state update,
leading to follow-up operations incorrectly assuming an empty shard snapshot directory and starting from scratch.

closes #75598
2021-07-27 16:13:21 +02:00
Armin Braun 7bf112f3a3
Fix testConcurrentRestoreDeleteAndClone Corner Case (#75728)
Follow up to #75332, there is a somewhat unlikely but possible edge case
left in this test. If the random deletes execute before the clones
we can see the clones conflicting.
Also, even less likely the snapshot delete could have finished before the
clone completes so we have to catch that case also.
2021-07-27 13:41:04 +02:00
Yannick Welsch 5096097ae8
Use reader wrapper in ReadOnlyEngine (#75724)
Ensures the reader wrapper is always used in ReadOnlyEngine.
2021-07-27 13:30:45 +02:00
David Turner 3f77adcc66
Include reason in cancellation exceptions (#75332)
Today when a task is cancelled we record the reason for the cancellation
but this information is very rarely exposed to users. This commit
centralises the construction of the `TaskCancellationException` and
includes the reason in the exception message.

Closes #74825
2021-07-27 11:08:09 +01:00
Armin Braun 195efa4150
Fix testConcurrentRestoreDeleteAndClone Timing Issue (#75523)
Even though it would be nice to wait for the clones and restores to queue up before
triggering the deletes this does not work. At times the clones or restores are so quick
that they complete before we even get to look at the cluster state, thus making the test
wait for a state that is never to come and fail.
2021-07-27 11:59:18 +02:00
David Turner 98504ea258
Drop ReceiveTimeoutTransportException stack trace (#75671)
We only create a `ReceiveTimeoutTransportException` in one place, the
timeout handler for the corresponding transport request, so the stack
trace contains no useful information and just adds noise if ever it is
logged. With this commit we drop the stack trace from these exceptions.
2021-07-26 09:24:55 +01:00
David Turner b6efb38aae
Distinguish timeouts/failures in follower checker (#75519)
Today when a node is removed from the cluster because of repeated
follower check failures it is not clear whether those failures are due
to active rejections or timeouts. It's important for further
investigation to distinguish these two cases. This commit adds tracking
for the number of timeouts separately from the number of active
failures, and includes the counts of each in the removal reason.
2021-07-26 09:13:00 +01:00
Armin Braun 1098737fe7
Mute org.elasticsearch.search.aggregations.bucket.TermsDocCountErrorIT.testIncrementalReduction (#75668)
Relates #75667
2021-07-25 14:14:41 +02:00
David Roberts bce246dbb7
[ML] Integrating ML with the node shutdown API (#75188)
When the node shutdown API is used to indicate that
an ML node is going to be shut down, ML will do the
following:

1. Isolate all datafeeds on the node and unassign
   their persistent tasks.
2. Tell all anomaly detection jobs on the node to go
   through the motions of closing, but not actually
   close and instead unassign their persistent tasks.
3. Report that the node is safe to shut down once all
   persistent tasks associated with anomaly detection
   jobs and model snapshot upgrades have either
   completed or been unassigned.
2021-07-22 19:24:23 +01:00
Nikita Glashenko 1db17ada95
Fix wrong error upper bound when performing incremental reductions (#43874)
When performing incremental reductions, 0 value of docCountError may mean that 
the error was not previously calculated, or that the error was indeed previously 
calculated and its value was 0. We end up rejecting true values set to 0 this 
way. This may lead to wrong upper bound of error in result. To fix it, this PR 
makes docCountError nullable. null values mean that error was not calculated 
yet.

Fixes #40005

Co-authored-by: Igor Motov <igor@motovs.org>
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2021-07-22 08:18:24 -10:00
Dan Hermann 0232675e30
Create data stream aliases from template (#73867) 2021-07-22 13:12:20 -05:00
Alan Woodward ffcaffc29f
Handle runtime subfields when shadowing dynamic mappings (#75595)
In #75454 we changed our dynamic shadowing logic to check that an unmapped
field was truly shadowed by a runtime field before returning no-op mappers. However,
this does not handle the case where the runtime field can have multiple subfields, as
will be true for the upcoming composite field type. We instead need to check that
the field in question would not be shadowed by any field type returned by any
runtime field.

This commit abstracts this logic into a new isShadowed() method on
DocumentParserContext, which uses a set of runtime field type names built from
the mapping lookup at construction time. It also simplifies the no-op mapper
slightly by making it a singleton object, as we don't need to preserve field names
here.
2021-07-22 13:15:07 +01:00
Francisco Fernández Castaño 90148fe31e
Add the ability to fetch the latest successful shard snapshot (#75080)
This commit adds a new master transport action TransportGetShardSnapshotAction
that allows getting the last successful snapshot for a particular
shard in a set of repositories. It deals with the different
implementation details around BwC for repositories.

Relates #73496
2021-07-22 13:55:32 +02:00
Rory Hunter 08ecf2306f
Print suggestion to view log on fatal error (#75418)
Closes #61767.

When Elasticsearch fails to start up, it tries to print a message to
suggest to the user that they consult the log for more information.
However, if a fatal error is encountered, Elasticsearch exits directly and
no such message is printed.

Improve this situation by printing the same message when Elasticsearch
is about to exit due to a fatal unexpected error.
2021-07-21 16:47:02 +01:00
Benjamin Trent 79c176cf0f
[ML] adding new p_value scoring heuristic to significant terms aggregation (#75313)
This commit adds a new p_value score heuristic to significant terms. 

The p_value is calculating assuming that the foreground set and the background set are independent Bernoulli trials with the null hypothesis that the probabilities are the same.
2021-07-21 11:39:05 -04:00
Armin Braun 175d007c55
Fix Tripped Assertion on Failed Snapshot Clone Cleanup (#75582)
We have to put the entry into `endingSnapshots`, otherwise we trip
an assertion about listener consistency with the cluster state if
there's other concurrent operations.
2021-07-21 16:17:57 +02:00
Benjamin Trent 9b88db7f4c
Significant terms test refactor for extendability (#75452)
The original PR #75264 made some test mistakes

NXY Significant term heuristics have additional values that need to be set when testing
basicScore properties.

Additionally, previous refactor kept the abstract test class in a package that other plugins
don't have access to.

closes #75442, #75561
2021-07-21 08:12:55 -04:00
Martijn van Groningen 9d0140b075
Enable bwc tests for #74784 (#75568) 2021-07-21 13:49:17 +02:00
Armin Braun 11698287c8
Fix RoutingTable Lookup by Index (#75530)
This is likely one source of bugs in at least snapshotting as it can lead
to looking up the wrong index from an old shard id (if an index has been
deleted and a new index is created in its place concurrently)
2021-07-21 13:16:48 +02:00
Adrien Grand feb6620d14
`indices.query.bool.max_clause_count` now limits all query clauses (#75297)
In the upcoming Lucene 9 release, `indices.query.bool.max_clause_count` is
going to apply to the entire query tree rather than per `bool` query. In order
to avoid breaks, the limit has been bumped from 1024 to 4096.

The semantics will effectively change when we upgrade to Lucene 9, this PR
is only about agreeing on a migration strategy and documenting this change.

To avoid further breaks, I am leaning towards keeping the current setting name
even though it contains `bool`. I believe that it still makes sense given that
`bool` queries are typically the main contributors to high numbers of clauses.

Co-authored-by: James Rodewig <40268737+jrodewig@users.noreply.github.com>
2021-07-21 12:16:30 +02:00
Martijn van Groningen 641e051a27
Fix the use of wildcard expressions for data streams in update aliases api (#75526)
Prior to this change, supplying a wildcard expression in the `indices` field
of an alias action would always result in a 404, despite data streams existing
that could match with the provided wildcard expression.

Closes #75456
2021-07-21 09:34:23 +02:00
Albert Zaharovits b9bc7a6f3f
Configure security for the initial node cli (#74868)
This introduces a new cmd line tool that generates the security configuration
for a new node in a new cluster (as opposed to joining an existing cluster).
The security configuration consists of TLS key and certificates, which
are stored in a directory inside the config path, as well as settings appended
to the elasticsearch.yml referencing the aforementioned certs.
2021-07-21 07:45:39 +03:00
Mark Tozzi 7af39dbc35
Remove deprecated date histo interval (#75000)
Date histogram interval parameter was deprecated in 7.2, in favor of the more specific fixed_interval and calendar_interval parameters.  The old logic used some poorly understood guessing to decide if it should operate in fixed or calendar mode.  The new logic requires a specific choice by the user, which is more explicit.  In 7.x REST compatibility mode, we will parse the interval as calendar if possible, and otherwise interpret it as fixed.
2021-07-20 13:08:45 -04:00
Julie Tibshirani 7049061a82
Align XCombinedFieldQuery with latest changes (#75483)
In #74678 we released an early fix for a Lucene bug around `combined_fields`
queries with missing fields. This PR brings our fix up-to-date with what was
actually committed to Lucene.
2021-07-20 08:01:33 -07:00
Joe Gallo 8e98381c33 Bump version after 7.13.4 release 2021-07-20 10:39:54 -04:00
Martijn van Groningen 3dde09a7b4
Add filter support to data stream aliases (#74784)
This allows specifying a query as filter on data stream alias,
which will then always be applied when searching via this alias.

Relates #66163
2021-07-20 11:21:27 +02:00
Nhat Nguyen db7d679791
Fix toXContent of PointInTimeBuilder (#75476)
We should use getStringRep instead of toString to avoid serializing the 
keep_alive of a point in time in fractional format; otherwise, we won't 
be able to parse it.

Fixes #75446
2021-07-19 18:28:21 -04:00
Julie Tibshirani a40ca70de6
Correct XCombinedFieldQuery equals and hashCode (#75402)
Previously the equals and hashCode methods only compared the query terms. This
meant that queries on different fields, or with different field weights, were
considered equal.

During boolean query rewrites, duplicate clauses are removed. So because equals/
hashCode was incorrect, rewrites could accidentally drop combined_fields query
clauses.
2021-07-19 09:47:46 -07:00
Christoph Büscher 5f782e2209
Fix failure on attempt to overwrite multi fields (#75454)
We used to throw a parsing exception when trying to overwrite a multi field on
indexing a document. These errors got lost on some recent changes in
DocumentParser around runtime fields and not detected in tests. This PR adds a
test for this case and restores parts of the logic in
DocumentParser#getLeafMapper to prevent this kind of overwrite from happening.

Fixes #75343
2021-07-19 16:18:58 +02:00
Przemyslaw Gomulka 5485d3ebdd
[Rest Api Compatibility] Do not return _doc for empty mappings in template (#75448)
Previously the compatibility layer was always returning an _doc in mappings for get
template.
This commit does not return _doc in empty mappings.
Returning just {} empty object (v7 and v8 behaviour)

also moving term lookups tests which are already fixed (relates #74544)

relates #70966
relates main meta issue #51816
relates types removal meta #54160
2021-07-19 13:21:00 +02:00
Alan Woodward cf575f4766
Make NestedObjectMapper its own class (#74410)
Nested objects are implemented via a Nested class directly on object mappers,
even though nested and non-nested objects have quite different semantics. In
addition, most call-sites that need to get an object mapper in fact need a nested
object mapper. To make it clearer that nested and object mappers are different
beasts with different implementations and different requirements, we should
split them into different classes.
2021-07-19 09:44:48 +01:00
Yannick Welsch 7c6f13b2c7
Weaken assertions in SearchWhileRelocatingIT (#75345)
Closes #74767
2021-07-16 16:27:06 +02:00
Armin Braun 3bd2672813
Fix Snapshot Out of Order Finalization Repo Corruption (#75362)
* Fix up shard generations in `SnapshotsInProgress` during snapshot finalization (don't do it earlier because it's a really heavy computation and we have a ton of places where it would have to run).
* Adjust finalization queue to be able to work with changing snapshot entries after they've been enqueued for finalisation
* Still one remaining bug left after this (see TODO about leaking generations) that I don't feel confident in fixing for `7.13.4` due to the complexity of a fix and how minor the blob leak is (+ it's cleaned up just fine during snapshot deletes)

Closes #75336
2021-07-16 14:51:12 +02:00
Dan Hermann a1d98f3407
Remove obsolete BWC in OS stats (#75376) 2021-07-16 07:16:44 -05:00
Przemyslaw Gomulka 4af7150a40
[Rest Api Compatibility] Allow to use size -1 (#75342)
previously disallowed in #70209. However since now the recommendation is
to not set the field at all - and rely on a default - this would be a
shape change for users prefering to set -1 so far.
With request compatible with v7 they will still be allowed to do this
and will get a warning.

relates #69548
relates #51816
2021-07-16 12:46:05 +02:00
Christos Soulios 8bd8f2a180
Fix broken test for dimension keywords (#75408)
Test was failing because it was testing 1024 bytes long keyword and assertion was failing.

Closes #75225
2021-07-16 12:01:40 +03:00
Gordon Brown 2aff8e59c7
Ensure system index upgrade mechanism can handle integer _meta.verion (#75383)
Some system indices, such as .tasks, had integer _meta.version
properties before we switched to using an Elasticsearch version there.
This commit ensures the code that reads the _meta.version from the
mapping can handle integers as well as "real" versions.
2021-07-15 16:22:25 -06:00
Dan Hermann 5ed1edf4f4
Resolve date math expressions before looking up index metadata (#75314) 2021-07-15 07:16:48 -05:00
Tanguy Leroux 935a38895b
Introduce searchable snapshots index setting for cascade deletion of snapshots (#74977)
Today there is no relationship between the lifecycle of a 
snapshot mounted as an index and the lifecycle of index 
itself. This lack of relationship makes it possible to delete 
a snapshot in a repository while the mounted index still 
exists, causing the shards to fail in the future.

On the other hand creating a snapshot that contains a 
single index to later mount it as a searchable snapshot 
index becomes more and more natural for users and 
ILM; but it comes with the risk to forget to delete the
 snapshot when the searchable snapshot index is 
deleted from the cluster, "leaking" snapshots in 
repositories.

We'd like to improve the situation and provide a way 
to automatically delete the snapshot when the mounted 
index is deleted. To opt in for this behaviour, a user has 
to enable a specific index setting when mounting the 
snapshot (the proposed name for the setting is 
index.store.snapshot.delete_searchable_snapshot). 

Elasticsearch then verifies that the snapshot to mount 
contains only 1 snapshotted index and that the snapshot 
is not used by another mounted index with a different 
value for the opt in setting, and mounts the snapshot 
with the new private index setting. 

This is the part implemented in this commit.

In follow-up pull requests this index setting will be used 
when the last mounted index is deleted and removed 
from the cluster state in order to add the searchable 
snapshot id to a list of snapshots to delete in the 
repository metadata. Snapshots that are marked as 
"to delete" will not be able to be restored or cloned, and 
Elasticsearch will take care of deleting the snapshot as 
soon as possible. Then ILM will be changed to use this 
setting when mounting a snapshot as a cold or frozen 
index and delete_searchable_snapshot option in ILM 
will be removed. Finally, deleting a snapshot that is 
still used by mounted indices will be prevented.
2021-07-15 12:22:52 +02:00
Tanguy Leroux 9c7a869c34
Move some constants from SearchableSnapshotsConstants to server (#75308)
Elasticsearch's server sometimes has to do things 
differently in order to handle searchable snapshots 
shards. In such cases it relies on index settings 
and hard coded values to know if a shard is a 
searchable snapshot one.

This commit adds a new SearchableSnapshotsSettings 
class in server that provides methods to check if 
an index is a searchable snapshot index. This class 
also contains the names of some index settings 
related to searchable snapshots that are required 
by the server.
2021-07-15 09:43:01 +02:00
Gordon Brown 26ad7e4f64
Implement system index access level that includes everything except net-new indices (#74803)
This PR implements a system index access level that includes all system indices, except net-new system indices.

This new access level is leveraged to fix the error in the Get Alias API described in #74687.
2021-07-14 16:26:56 -06:00