Commit Graph

60468 Commits

Author SHA1 Message Date
Armin Braun 8b9c52ebe3
Fix Queued Snapshot Clone not Starting after Data Node Drops Out (#77111)
We have to account for queued up clones when dealing with nodes dropping out
and start them when they become ready to execute because of a node leaving the cluster.
Added test to reproduce the issue in #77101 and another test to verify that the more complex
case of clone queued after snapshot queued after clone still works correctly as well.
The solution here is the most direct fix I could think of and the by far easiest to backport.
That said, I added a TODO that asks for a follow-up that should allow for completely removing
the duplicate code across handling shard updates and external changes. The difference between
the two ways of updating the state is a left-over from the time before we had concurrent
operations and has become a needless complexity nowadays.

closes #77101
2021-09-01 20:45:22 +02:00
Lisa Cawley 007469af63
[DOCS] Replaces index pattern in ML docs (#77041) 2021-09-01 10:26:06 -07:00
Martijn van Groningen 4a4d604463
Add 7.14.2 version. 2021-09-01 18:30:51 +02:00
Nik Everett dde7d418a8
Add matching pattern to error in fields (#76903)
This adds the pattern into the error message returned when trying to
fetch fields. So this:
```
POST _search {
  "fields": [ { "field": "*", "format": "date_time" } ]
}
```

Will return an error message like
```
error fetching [foo] which matches [*]: Field [foo] of type [keyword] doesn't support formats
```
2021-09-01 12:15:54 -04:00
Adam Locke 32e364d394
[DOCS] Clarify indexing a runtime field (#77117)
* [DOCS] Clarify indexing a runtime field

* Clarify wording based on reviewer feedback
2021-09-01 11:59:11 -04:00
David Kyle 7a283104c5
[ML] Multiple items in a single inference request (#75759)
Inference requests can be batched by adding more rows to the input tensor. 
These batch calls are more performant than making multiple calls to forward()
with a single input when all the inputs are of a similar length. The expected 
input is now a 2D array of tokens and 2D arrays of supporting arguments, 
the output is a 3D array.
2021-09-01 16:52:45 +01:00
Alan Woodward 5d48fdc741
Replace Lucene DataInput/DataOutput with Elasticsearch StreamInput/StreamOutput (#77118)
In a number of places, we read and write binary data into byte arrays using lucene's
DataInput and DataOutput abstractions. In lucene 9 these abstractions are changing
the endianness of their read/writeInt methods. To avoid dealing with this formatting
change, this commit changes things to use elasticsearch StreamInput/StreamOutput
abstractions instead, which have basically the same API but will preserve endianness.

Relates to #73324
2021-09-01 16:21:26 +01:00
Mark Vieira 2396bad707 Add debian 11 to pull request packaging test matrix 2021-09-01 08:17:09 -07:00
Rory Hunter be6d1ba2af
Rework how we render groovy templates for docs (#77125)
On Windows, rendered Groovy templates contain carriage returns, which
breaks the unit tests and results in them sneaking into the output. Fix
this by rendering into a string and removing the carriage returns.
2021-09-01 15:45:41 +01:00
Rory Hunter 33c4129a60 Revert "Reapply "Handle cgroups v2 in `OsProbe` (#76883)" (#77106)"
This reverts commit 54d4737b23.
2021-09-01 14:32:24 +01:00
Jason Tedor 3c589efef7
Use a real out of memory error in die with dignity (#77039)
Today when testing dying with dignity, we simply throw an
OutOfMemoryError. We know this should not get caught by any intermediate
code and end up in the uncaught exception handler. This allows us to
test that this exception handler is able to successfully kill the
VM. However, it is on the table to no longer use the uncaught exception
handler, but instead the built-in support for ExitOnOutOfMemoryError. A
fake OutOfMemoryError would not be processed by this handler, so to
prepare the way, we switch to using a real OutOfMemoryError.
2021-09-01 09:30:53 -04:00
Nik Everett 429beba517
Centralize doc values checking (#77089)
This adds two utility methods for to validate the parameters to the
`docValueFormat` method and replaces a pile of copy and pasted code with
calls to them. They just emit a standard error message if the any
unsupported parameters are provided.
2021-09-01 09:06:24 -04:00
Benjamin Trent 0e1efa6533
[ML] generalize pytorch sentiment analysis to text classification (#77084)
* [ML] generalize pytorch sentiment analysis to text classification

* Update x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/inference/trainedmodel/TextClassificationConfig.java
2021-09-01 08:45:13 -04:00
Dimitris Athanasiou 7afa5e5646
[ML] Fix failure on datafeed preview with date_nanos time field (#77109)
Preview datafeed currently fails when the time field is of type
`date_nanos`. The failure contains the error message:

```
date [...] is after 2262-04-11T23:47:16.854775807 and cannot be
stored in nanosecond resolution
```

This commit fixes this failure. The cause of the issue was that
preview generates a search with a range query on the time field
whose upper bound is `Long.MAX_VALUE` in order to include all
available data in the preview. However, that value is parsed
with `DateUtils.toLong` when the time field is `date_nanos` and
it hits the limitation that values can't be larger than
`DateUtils.MAX_NANOSECOND_INSTANT`. The fix checks whether the
time field is `date_nanos` and uses `DateUtils.MAX_NANOSECOND_INSTANT`
as the upper bound instead of `Long.MAX_VALUE`.
2021-09-01 15:39:25 +03:00
Benjamin Trent 2d70114096
[ML] track feature usage for data frame analytics, inference, and anomaly jobs (#76789)
This adds feature tracking for machine learning features.

Model Snapshot upgrader
Anomaly jobs
Data frame analytics jobs
Can all take advantage of the license state tracking built for persistent tasks.

The ModelLoadingService needed special handling to ensure that models cached and referenced
by pipelines are tracked.

License tracking is done per-node and allows for a simple view into when a feature was last used on a given node.
2021-09-01 07:51:37 -04:00
Benjamin Trent 100f222650
Adds support for the rate aggregation under a composite agg (#76992)
rate aggregation should support being a sub-aggregation
of a composite agg.

The catch is that the composite aggregation source
must be a date histogram. Other sources can be present
but their must be exactly one date histogram source
otherwise the rate aggregation does not know which
interval to compare its unit rate to.

closes https://github.com/elastic/elasticsearch/issues/76988
2021-09-01 07:29:13 -04:00
Dan Hermann 6a141236df
Re-enable REST compatibility test after backport of #76752 2021-09-01 06:18:38 -05:00
Armin Braun 0920e21445
Implement Sort By Repository Name in Get Snapshots API (#77049)
This one is the last sort column not yet implemented but used by Kibana.
2021-09-01 13:01:58 +02:00
Rory Hunter 54d4737b23
Reapply "Handle cgroups v2 in `OsProbe` (#76883)" (#77106)
Re-apply #76883. Somehow a line was missed from security.policy.
2021-09-01 11:46:49 +01:00
Ignacio Vera 46dd252100
Replace Lucene DataInput/DataOutput with Elasticsearch StreamInput/StreamOutput when reading/writing Histogram doc values (#77100)
This commit replaces lucene DataInput / DataOutput with Elasticsearch StreamInput / StreamOutput abstractions.
2021-09-01 11:55:14 +02:00
Rory Hunter 54a9c3ba05 Revert "Handle cgroups v2 in `OsProbe` (#76883)"
This reverts commit e827ec6078.
2021-09-01 09:42:45 +01:00
Rory Hunter e827ec6078
Handle cgroups v2 in `OsProbe` (#76883)
Closes #76812.

`OsProbe` was only capable of handle cgroup data in the v1 format.
However, Debian 11 uses cgroups v2 by default, and Elasticsearch isn't
capable of reporting any cgroup information. Therefore, add support for
the v2 layout.
2021-09-01 09:29:01 +01:00
Rene Groeschke 5ffada50f6
Fix YamlRestTestPluginFuncTest on Windows (#77063)
* Fix YamlRestTestPluginFuncTest on Windows

- need to normalize output before comparison
- should fix #77060

* Minor cleanup after review
2021-09-01 04:16:28 -04:00
Rene Groeschke eec1a181c9
Document general gradle build guidelines (#76551)
This introduces a general document to track guidelines for working on and with
the elasticsearch gradle build

Co-authored-by: Rory Hunter <pugnascotia@users.noreply.github.com>
2021-09-01 09:32:01 +02:00
Rory Hunter ac803f078c
Drop version field from changelog YAML (#76985)
The changelog generation process currently relies on version
information being present in the changelog YAML descriptors. However,
this makes them difficult to update in some scenarios. For example,
if a PR is merged and subsequently labelled for backporting, our
automation won't update the versions in the changelog YAML.

We can make the process more flexible by removing version data from
the changelog YAML files, and instead inferring the versions from
each changelog YAML file's existence in the git tree at each tag
in the minor series.

This change makes the process more ergonomic for developers, but
harder to test, since I can't simply concoct YAML data for a range
of versions. Instead, I've added a number of unit tests, and tried
to exercise all the relevant parts.

It is now an error to include `versions` the YAML file.
2021-09-01 07:25:29 +01:00
Ignacio Vera 07715438b5
Refactor of GeoShape integration tests (#77052)
This commit joins GeoFilterIT and GeoShapeIntegrationIT into one test case called GeoShapeIntegTestCase 
which is moved into the test framework.
2021-09-01 07:21:15 +02:00
Ignacio Vera 648a7aefbe
Replace Lucene DataInput/DataOutput with Elasticsearch StreamInput/StreamOutput when reading/writing geo_shape doc values (#76162)
This commit introduces a new ByteArrayStreamInput that allows reusability and random reads.
2021-09-01 07:05:56 +02:00
Christos Soulios 707dd497e4
Add multiple validators to Parameters (#77073)
This PR implements support for multiple validators to a FieldMapper.Parameter.

The Parameter#setValidator method was replaced by Parameter#addValidator that can be called multipled times
to add validation to a parameter.

All validators of a parameter will be executed in the same order as they have been added and if any of them fails all validation will failed.
2021-08-31 21:28:14 +03:00
Francois-Clement Brossard ec11f9f931
Execute enrich policy wait_for_completion docfix (#77046) 2021-08-31 14:02:24 -04:00
Adam Locke b9ad9860af
[DOCS] Add ES security principles (#76850)
* [DOCS] Add ES security principles

* Incorporating review feedback

* More changes from review feedback

* Fix cross-link to Painless guide

* Clarify callout text

* Add information about elasticsearch user

* Minor wording edits

* Consolidate Java Security Manager description, plus other edits

* Clarify not running as root

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2021-08-31 12:37:22 -04:00
David Turner ead0020497
Tidy up ClusterApplierService (#76837)
This commit cleans up some cruft left over from older versions of the
`ClusterApplierService`:

- `UpdateTask` doesn't need to implement lots of interfaces and give
  access to its internals, it can just pass appropriate arguments to
  `runTasks()`.
- No need for the `runOnApplierThread` override with a default priority,
  just have callers be explicit about the priority.
- `submitStateUpdateTask` takes a config which never has a timeout, may
  as well just pass the priority and remove the dead code
- `SafeClusterApplyListener` doesn't need to be a
  `ClusterApplyListener`, may as well just be an `ActionListener<Void>`.
- No implementations of `ClusterApplyListener` care about the source
  argument, may as well drop it.
- Adds assertions to prevent `ClusterApplyListener` implementations from
  throwing exceptions since we just swallow them.
- No need to override getting the current time in the
  `ClusterApplierService`, we can control this from the `ThreadPool`.
2021-08-31 17:35:32 +01:00
Lukas Wegmann 627c0ee9c6
SQL: Fix disjunctions (and `IN`) with multiple date math expressions (#76424)
* SQL: Fix disjunctions with multiple date math expressions

* review comments

* remove redundant FieldAttribute parameter

* address comments and add more specs

* fix typo
2021-08-31 17:30:49 +02:00
Armin Braun 37516daa56
Make some Mappers Singletons (#77067)
Just some obvious singletons we can use to save a little memory/cache
that I found during other experiments.
2021-08-31 17:25:05 +02:00
Jack Conradson 9e9a6d5601
Adds a lookup method to Painless for finding methods of all sub classes (#77044)
This change adds a method to the PainlessLookup used to find methods of all allow listed sub classes. 
A method is specified for a specific super class, and then a list is built with all matching methods from 
the all the allow listed sub classes. If no matches are found, null is returned which is consistent with 
the behavior of the other look up methods. It is up to the caller to check.
2021-08-31 08:12:04 -07:00
Mark Tozzi 5aa0dd7f33
fix git blame after autoformtting (#77040)
* fix git blame after autoformtting
2021-08-31 10:55:52 -04:00
Armin Braun f89eda5f9d
Fix Snapshot BwC Version Randomization Behavior (#77057)
The randomization of the repo version often wasn't used because of the repository cache.
Force re-creating the repository every time we manually mess with the versions.
2021-08-31 15:28:57 +02:00
Dan Hermann 90d2899323
ECS support for Grok processor (#76885) 2021-08-31 06:40:52 -05:00
markharwood 2d0773cd3c
Add support for QueryString-parsed wildcard queries on runtime keyword fields. (#76867)
The QueryStringQuery parser assumes that wildcard queries should use normalized values in queries.
The KeywordScriptFieldType did not support this so was throwing an error. Given there is currently no concept of normalisation in scripted fields I assume it is safe to just add support for this in the same way un-normalized wildcard queries are handled - it feels right that they should behave the same rather than throw an error.
Added a test too.

Closes #76838
2021-08-31 11:35:54 +01:00
Alexander Reelsen 441d7b5199
Watcher: Fix index action simulation when indexing several documents (#76820)
When using the index action to index several documents at once,
simulation the action ended up in indexed documents because there was
not break in case the action should only be simulated.

This commits adds such an abortion condition together with a proper
simulation response.

Closes #74148 #66735
2021-08-31 09:14:42 +02:00
Rene Groeschke 35ec6f348c
Introduce simple public yaml-rest-test plugin (#76554)
This introduces a basic public yaml rest test plugin that is supposed to be used by external 
elasticsearch plugin authors. This is driven by #76215

- Rename yaml-rest-test to intern-yaml-rest-test
- Use public yaml plugin in example plugins

Co-authored-by: Mark Vieira <portugee@gmail.com>
2021-08-31 08:45:52 +02:00
Mark Tozzi d715449766
Apply spotless to aggregations (#76682)
* spotless apply for core analytics code

* spotless apply for x-pack:plugin:analytics

* spotless apply for matrix stats

* don't format huge lists of HLL constants

* Spotless for Rollups

* Don't exclude HLLPP, we added narrower inline exclusions
2021-08-30 13:42:20 -04:00
Gordon Brown 7c5bd03738
Add `replace` shutdown type (#75908)
This PR adds the `REPLACE` shutdown type. As of this PR, `REPLACE` behaves identically to `REMOVE`.

Co-authored-by: Lee Hinman <lee@writequit.org>
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2021-08-30 11:34:42 -06:00
Julie Tibshirani 061253ee0e
Break up and simplify TransportFieldCapabilitiesAction (#76958)
`TransportFieldCapabilitiesAction` currently holds a lot of logic. This PR
breaks it up into smaller pieces and simplifies its large `doExecute` method.
Simplifying the class will help before we start to make field caps
optimizations.

Changes:
* Factor some methods out of `doExecute` to reduce its length
* Pull `AsyncShardAction` out into its own class to simplify and better match
the code structure in 7.x
2021-08-30 10:14:42 -07:00
István Zoltán Szabó ea007902ef
[DOCS] Adds anomaly job health alert type docs (#76659)
Co-authored-by: Lisa Cawley <lcawley@elastic.co>
2021-08-30 16:11:34 +02:00
Armin Braun 111100ebfd
Adjust GetSnapshotsRequest BwC Serialization after Backport (#77019)
Once #77018 is merged, we can merge this to enabled the new sort columns
in 7.16+.
2021-08-30 14:59:04 +02:00
Armin Braun 48f3784a6d
Add Sort By Shard Count and Failed Shard Count to Get Snapshots API (#77011)
It's in the title. As requested by the Kibana team, adding these two additional sort columns.

relates #74350
2021-08-30 13:39:51 +02:00
Dan Hermann c4aad2965f
[DOCS] Map iteration support in ForEach processor (#76972) 2021-08-27 07:35:11 -05:00
Dan Hermann 4886753dec
[DOCS] Final pipelines may not change target index (#76997) 2021-08-27 07:32:02 -05:00
Yang Wang c605cdf0c6
[Test] More robust assertions for watcher execution (#76977)
Since the test is really for making sure the serialised authentication
header can work after cluster upgrade, it is sufficient to just assert
that the watcher execute successfully once regardless of the total
number of execution.
2021-08-27 10:31:58 +10:00
debadair 12dda6fb36
[DOCS] Add ILM error/troubleshooting info. Closes #75849 (#76957)
* [DOCS] Add ILM error/troubleshooting info. Closes #75849

* Apply suggestions from code review

Co-authored-by: James Rodewig <40268737+jrodewig@users.noreply.github.com>

* Updated xref & fixed whitespace issues

Co-authored-by: James Rodewig <40268737+jrodewig@users.noreply.github.com>
2021-08-26 15:44:50 -04:00