Commit Graph

58286 Commits

Author SHA1 Message Date
Nhat Nguyen dc1609a37c
Adjust Lucene version after backporting (#71694)
Relates #71587
2021-04-14 12:28:00 -04:00
Jack Conradson 301dcb64aa
Add Runtime Fields Contexts to Painless Execute API (#71374)
This change adds support for the 7 different runtime fields contexts to the Painless Execute API. Each 
context can accept the standard script input (source and params) along with a user-defined document 
and an index name to pull mappings from. The results depend on the output of the runtime field 
type.

Closes #70467
2021-04-14 08:56:56 -07:00
David Turner 0a176fe7d6
Improve SnapshotInfo serialization tests (#71677)
Today we have no tests that directly verify that `SnapshotInfo`
correctly round-trips through its in-repository `XContent`-based
representation. We do have tests that verify that it correctly
round-trips through the wire format, but these tests always use an empty
collection for `featureStates`.

This commit strengthens the wire format round-trip tests to use
nontrivial `featureStates`, and generalizes these tests to also verify
that the `XContent` representation is faithful.
2021-04-14 15:46:34 +01:00
Nhat Nguyen 52d1d626ed
Disable BWC tests (#71690)
Relates #71589
2021-04-14 09:50:39 -04:00
Armin Braun 2e8b2884b3
Remove Outdated BwC Logic from Snapshot Codebase (#71623)
7.12 has been released so we can drop a lot of unnecessary BwC logic in `master`.
2021-04-14 15:19:05 +02:00
Andrew Stucki c102566a64
Network direction processor supports dynamic internal networks specification (#68712) 2021-04-14 08:13:42 -05:00
Nhat Nguyen a461597c75
Upgrade to Lucene 8.8.2 on 8.0 (#71587) 2021-04-14 08:52:23 -04:00
Andrew Stucki f491af65c0
Registered domain processor (#67611) 2021-04-14 07:18:03 -05:00
Benjamin Trent d84824fa36
[ML] muting upgrade mode tests due to cleanup failure (#71684) 2021-04-14 08:15:54 -04:00
Henning Andersen 1c85ce701c
Fix testHealthOnMasterFailover on Mac OS (#71275)
Give a bit more time to complete test on mac since darwin CI workers are
(sometimes) slow.

Closes #62690
2021-04-14 13:53:44 +02:00
Benjamin Trent 514463dcf6
[ML] prevent APIs from being called when upgrade mode is set (#71654) 2021-04-14 07:13:52 -04:00
Alan Woodward 05551dd77b
Add index-time scripts to date field mapper (#71633)
This commit allows you to set 'script' and 'on_script_error' parameters
on date field mappers, meaning that runtime date fields can be made indexed
simply by moving their definitions from the runtime section of the mappings
to the properties section.
2021-04-14 09:18:05 +01:00
Jason Tedor 6823b8eb5e
Remove the ability for plugins to add roles (#71527)
This commit removes the ability for plugins to add roles. Roles are
fairly tightly coupled with the behavior of the system (as evidenced by
the fact that some roles from the default distribution leaked behavior
into the OSS distribution). We previously had this plugin extension
point so that we could support a difference in the set of roles between
the OSS and default distributions. We no longer need to maintain that
differentiation, and can therefore remove this plugin extension
point. This was technical debt that we were willing to accept to allow
the default distribution to have additional roles, but now we no longer
need to be encumbered with that technical debt.
2021-04-13 22:53:05 -04:00
Mark Vieira 50d6e1369a Mute Netty4HeadBodyIsEmptyIT.testTemplateExists 2021-04-13 18:00:01 -07:00
Nik Everett b4bac7b769
Test: assert adjacency matrix cache (#69440)
Adds an assertion that the adjacency matrix aggregation can hit the
request cache even when the request contains a lookup style `terms`
filter.
2021-04-13 16:57:26 -04:00
Nik Everett 8c398b50b0
Disable module inference in Eclipse (#71649)
We recently upgrade to gradle 7.0 (#69096) which turned on module
inference by default. I'm sure that's lovely, but its broken eclipse. We
should probably support modules one day, but that day ain't today. This
turns off module inference for eclipse so it can continue compiling
things just like it did yesterday.

Closes #71648
2021-04-13 16:56:37 -04:00
Jack Conradson 065d7696c2
Add missing boolean array to unknown value writers for xcontent (#71651)
This change adds the ability to call value on an XContentBuilder and consume a boolean[]. This was 
missing from the set of other writers for the unknown value call.
2021-04-13 12:49:14 -07:00
Alan Woodward 78c79134b9
Forbid setting copy_to on scripted field mappers (#71621)
copy_to is currently implemented at document parse time, and does not
work with values generated from index-time scripts. We may want to add
this functionality in future, but for now this commit ensures that we throw
an exception if copy_to and script are both set on a field mapper.
2021-04-13 20:37:17 +01:00
Nik Everett 6607a48435
Advise against dates with decimal points (#71578)
We accept dates with a decimal point like `2113413.13241324` and parse
them *somehow*. But there are cases where we'll lose precision on those
dates, see #70085. This advises folks not to use that format. We'll
continue to accept those dates for backwards compatibility but you
should avoid using them.

Co-authored-by: Adrien Grand <jpountz@gmail.com>
2021-04-13 15:11:05 -04:00
Nhat Nguyen f887cf28d1
Avoid return negative value in CounterMetric (#71446)
A CounterMetric is used to track the number of completed and outstanding 
items, for example, the number of executed refreshes, the currently used
memory by indexing, the current pending search requests. In all cases,
the current count of CounterMetric is always non-negative.

However, as this metric is implemented using a LongAdder, the returned
count is NOT an atomic snapshot; invocation in the absence of concurrent
updates returns an accurate result, but concurrent updates that occur
while the sum is being calculated might not be incorporated.

We can replace LongAdder with AtomicLong, but this commit chooses to 
continue using LongAdder but returns 0 when the sum value is negative.

Relates #52411
Closes #70968
2021-04-13 13:53:13 -04: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
Przemko Robakowski 46efa6ad04
Fix problems in GeoIPv2 code (#71598)
This change fixes number of problems in GeoIPv2 code:

- closes streams from Files.list in GeoIpCli, which should fix tests on Windows
- makes sure that total download time in GeoIP stats is non-negative (we serialize it as vInt which can cause problems with negative numbers and it can happen when clock was changed during operation)
- fixes handling of failed/simultaneous downloads, #69951 was meant as a way to prevent 2 persistent tasks to index chunks but it would prevent any update if single download failed mid indexing, this change uses timestamp (lastUpdate) as sort of UUID. This should still prevent 2 tasks to step on each other toes (overwriting chunks) but in the end still only single task should be able to update task state (this is handled by persistent tasks framework)
Closes #71145
2021-04-13 17:10:45 +02:00
David Roberts c4364584aa
[ML] Use feature reset API in ML REST test cleanup (#71552)
Now that we have a feature reset API, we should use
this for cleaning up in between tests instead of running
lots of bespoke cleanup code.

During testing of this change we found we need to
delete custom cluster state as part of the reset process,
so this PR also implements that.

Additionally we no longer assign persistent tasks
during feature reset.
2021-04-13 16:04:47 +01:00
Rory Hunter fb1921c9dc
Change deprecation logs data stream name (#68737)
More fixes to deprecation log indexing so that the data stream name and document
contents are more ECS-compatible.
2021-04-13 15:11:57 +01:00
Armin Braun d3d7220cf9
Cleanup Duplicate Code in Snapshot State Machine (#71624)
The logic for interpreting the primary routing entry was duplicated across
snapshotting and cloning needlessly. Also, dried up determining if there's an active
deletion for a repo since we were doing that operation in a number of spots as well.
2021-04-13 15:20:19 +02:00
Armin Braun e910b2d780
Cleanup SnapshotsInProgress for Readability (#71620)
* Formatting `SnapshotsInProgress` in a more reasonable way instead of mixing nested class, fields and methods.
* Removing pointless constants for the x-content serialization.
* Cleaning up double wrapping in `unmodifiableList`.
* Removing unused and incorrectly documented constructor from `SnapshotDeletionsInProgress`
2021-04-13 15:07:20 +02:00
Nik Everett b2caf4d230
Convert parent-join example script to runtime field (#71423)
Runtime fields are much more flexible than script_fields because you
can filter and aggregate on them so we hope folks use them! This
converts the example of using a `parent_join` field in a script to a
runtime field so folks get used to seeing them and hopefully using them.

While I was editing this I took the opportunity to replace the script
with a real-ish example. Scripts that just load the field value are nice
and short but I hope no one uses them in real life because they just add
overhead when compared to accessing the field directly. So I made the
script do something.

Relates to #69291
2021-04-13 09:00:18 -04:00
Alan Woodward 67db2538f8
Add index-time scripts to IP field mapper (#71617)
This commit allows you to set 'script' and 'on_script_error' parameters
on IP field mappers, meaning that runtime IP fields can be made indexed
simply by moving their definitions from the runtime section of the mappings
to the properties section.
2021-04-13 13:40:10 +01:00
Nik Everett 57e6c78a52
Fix profiled global agg (#71575)
This fixes the `global` aggregator when `profile` is enabled. It does so
by removing all of the special case handling for `global` aggs in
`AggregationPhase` and having the global aggregator itself perform the
scoped collection using the same trick that we use in filter-by-filter
mode of the `filters` aggregation.

Closes #71098
2021-04-13 08:36:51 -04:00
Dan Hermann 502ff027a8
URI parts processor handles URLs containing spaces (#71559) 2021-04-13 07:35:37 -05:00
Henning Andersen adf117245c
Frozen tier autoscaling decider based on shards (#71042)
The frozen tier only holds shared cache searchable snapshots. This
commit adds an autoscaling decider that scales the total memory on
the tier adequately to hold the shards. A frozen shard is assigned
a memory size of 64GB/2000, i.e., each 64GB node can hold 2000 shards
before scaling further.
2021-04-13 14:31:38 +02:00
Yang Wang 1d88a09538
[Test] Fix comparison for long value (#71513)
The epochMillis value is always a long value. Hence the test should convert
the actual value to long first before comparison.
2021-04-13 20:52:46 +10:00
Bogdan Pintea 6d1d8dc736
Update Tableau connector generation scripts (#71614)
This updates the output directory, to better align with the stack
building infrastructure.
2021-04-13 12:49:41 +02:00
Andrei Dan b2639d700a
DOCS: update `delete_searchable_snapshot` option documentation (#71547)
If enabled, the `delete_searchable_snapshot` option will attempt to delete the
index snapshot generated in any previous phase, for the purpose of mounting the
index as a searchable snapshot.
2021-04-13 11:25:15 +01:00
Rory Hunter ac371b070a
Refresh formatter config (#71588)
Write out the formatter config using the latest Eclipse. This has the
effect of configuring assertion formatting properly, which has improved
how some of our assertion messsages are formatted. Also reconfigure how
annotations are formatted, so that they are correctly line-wrapped.
2021-04-13 09:33:41 +01:00
Luca Cavanna 4bf96e9cfa
Remove FieldStats version checks (#71574)
We recently added script stats to the existing field type stats. That change is now backported hence master does not need to support the scenario where such info is not available, only the 7.x branch does to account for mixed cluster scenarios.

Relates to #71219
2021-04-13 10:14:17 +02:00
Martijn van Groningen a478b5ff72
Fix GeoIpProcessorNonIngestNodeIT#testLazyLoading(...) (#71579)
Ensure that the index request is routed to the ingest,
so that the lazy loading occurs of geoip database
on ingest node (which is what is asserted later on)
Otherwise the database is lazy loaded on a different node.

(without this fix, this test fails reproducible with
`-Dtests.seed=2E234CC71CE96F4F`)

Closes #71251
2021-04-13 10:01:52 +02:00
Rene Groeschke 0f40889879
Update build to Gradle 7.0 (#68506)
- Update gradle wrapper to gradle 7.0
- Remove deprecated usages to make build 7.0 compatible
- Fix excludes in docs snippet tasks (See https://github.com/gradle/gradle/issues/16160 for details)
- Fix deprecation warnings in 7.0
- Add explicit dependencies that have been missed
- Make extract native licenses tasks output dir more explicit
- Use a snapshot of the ospackage plugin that includes a fix for 7.0 already
- fix test runtime classpath setup in repository-hdfs
- Make task dependency explicit to fix further deprecation warnings
- Remove manual check for http repo usages that has been deprecated in gradle 7.0
- Update spock to latest 2.0 milestone required for groovy 3
2021-04-13 09:15:08 +02:00
Yang Wang 1cb605e05d
Always add file and native realms unless explicitly disabled (#69096)
This PR makes sure that the file and native realms are always added to the
beginning of the realm chain unless explicitly disabled.

Currently, they are only impliciltly added when:
* No other realms are configured
* No configured realms can be used with current license (so an expired license
  can fallback to these basic realms)

A side effect (intended?) is that file and native realm cannot be truely
disabled at all time because the above two rules always apply regardless
whether the realms are disabled or not.

This PR makes the behaviour more explicit. If the file or native realm is
explicitly disabled, it will be disabled at all time. If they are not
explicitly disabled, they will always be added to the beginning of the realm
chain. Two scenarios are possible:

* File or native realm is explicitly configured. In this case, their order
  value must be provided and honoured
* File or native realm is not configured. In this case, they are implicitly
  added to the beginning of the realm chain (file then native).
2021-04-13 16:31:38 +10:00
Yang Wang c1257afaf6
Update version constants for API key metadata (#71603)
This PR updates the version constants for API key metadata to be 7.13.0
since #70956 is backported.
2021-04-13 10:53:49 +10:00
Jack Conradson 597b8b4519
Remove loop counter for foreach loops (#71602)
This changes remove the loop counter for for each loops which is a regression from 7.9.3 
documented in #71584. Not loop counting for each loops should be relatively safe as they have a 
natural ending point. We can consider adding the check back in once we have configurable loop 
counters.
2021-04-12 16:35:50 -07:00
Jack Conradson bc11a3489e
Add utility methods to return runtime field values in doc value order (#71599)
This adds utility methods to each type of runtime field to return the results of a document in an ordered array based on the same order that doc values are ordered in. This is useful for supporting execute api in this #71374.
2021-04-12 16:22:45 -07:00
Nik Everett 0623b03170
Fit runtime field on line (#71470)
This shrinks a runtime field definition so that it fits on the screen
without scrolling. It also converts the doc into a test so we can be
sure it continues to work.

Relates to #69291
2021-04-12 18:15:44 -04:00
Nik Everett e4451bda05
Convert date_nanos example script to runtime field (#71351)
Runtime fields are much more flexible than script_fields because you
can filter and aggregate on them so we hope folks use them! This
converts the example of using a `date_nanos` field in a script to a
runtime field so folks get used to seeing them and hopefully using them.

While I was editing this I took the opportunity to replace the script
with a real-ish example. Scripts that just load the field value are nice
and short but I hope no one uses them in real life because they just add
overhead when compared to accessing the field directly. So I made the
script do something.

Relates to #69291

Co-authored-by: Adam Locke <adam.locke@elastic.co>
2021-04-12 17:22:02 -04:00
Armin Braun b583ea82ad
Use ByteBufferStreamInput to Stream Byte Arrays (#71538)
For bulk operations that fall back to hotspot intrinsic code (reading short, int, long)
using this stream brings a massive speedup. The added benchmark for reading `long` values
sees a ~100x speedup in local benchmarking and the vLong read benchmark still sees a slightly
under ~10x speedup.
Also, this PR moves creation of the `StreamInput` out of the hot benchmark loop for all the bytes
reference benchmarks to make the benchmark less noisy and more practically useful.
(the `readLong` case using intrinsic operations is so fast that it wouldn't even show up in a profile relative to
instantiating the stream otherwise).

Relates work in #71181
2021-04-12 22:25:06 +02:00
Jack Conradson 82d666811c
Change script context names for run time fields to type_field (#71581)
This changes all the script context names specifically for runtime fields to be *_field such as long_field 
and geo_point_field, etc. This change is internal detail that will only be exposed through the Painless 
execute API as part of (#71374) and should not have bwc issues. I tested this change locally on a 
mixed cluster to ensure scripts stored with the old runtime fields context names are both still 
retrievable and delete-able. This works because the context name is only used during the request to 
check for valid compilation, but never actually stored as part of the cluster state.
2021-04-12 13:00:49 -07:00
Luca Cavanna 5f6cb46cac
IndexFeatureStats to implement ToXContentObject (#71573)
IndexFeatureStats prints out a whole object, hence it should be a ToXContentObject. This way consumers like Strings#toString automatically know not to wrap it into a new object when printing it out.
2021-04-12 21:25:31 +02:00
Nik Everett 3583ba0eb5
Tests for runtime field queries with fbf aggs (#71503)
This adds a few tests for runtime field queries applied to
"filter-by-filter" style aggregations. We expect to still be able to
use filter-by-filter aggregations to speed up collection when the top
level query is a runtime field. You'd think that filter-by-filter would
be slow when the top level query is slow, like it is with runtime
fields, but we only run filter-by-filter when we can translate each
aggregation bucket into a quick query. So long as the results of those
queries don't "overlap" we shouldn't end up running the slower top level
query more times than we would during regular collection.

This also adds some javadoc to that effect to the two places where we
chose between filter-by-filter and a "native" aggregation
implementation.
2021-04-12 15:25:10 -04:00
Rory Hunter de24331e6b
Upgrade Spotless from 5.9.0 to 5.12.0 (#71561)
Upgrade Spotless from 5.9.0 to 5.12.0. This causes a few formatting changes around
how lambdas are arranged, mostly for the better.
2021-04-12 19:34:44 +01:00
Mark Vieira 7b5cf95edd
Avoid spinning up test fixtures during compilation (#71571) 2021-04-12 10:34:22 -07:00