Commit Graph

6203 Commits

Author SHA1 Message Date
David Turner 35b016cd89
Log reindex bulk request completion (#75935)
Today we log at `DEBUG` when we receive a scroll response and send the
bulk request but do not log the completion of the bulk request or the
start of the next scroll request. This makes it impossible to tell from
the logs how long these things are taking.

This commit adds the missing logging.
2021-08-02 15:57:18 +01:00
Jack Conradson 33e9c07ce9
Remove un-used doc fields phase in Painless (#75851)
Originally, a doc fields phase was created to collect information about what fields are accessed using constant values. This was going to be used for detecting cyclical field access in runtime fields, but another approach was taken instead. This change deletes the un-used phase.
2021-07-30 09:01:06 -07:00
Armin Braun ffeaab8e58
Fix Issues in Netty4MessageChannelHandler (#75861)
Fixes a few rough edges in this class:
* we need to always pass a flush call down the pipeline and not just conditionally
if they apply to the message handler, otherwise we lose flushes e.g. when a channel
becomes not-writable due to a write from off the event-loop that exceeds the outbound
buffer size
  * this is suspected of causing recently observed intermittent and unexplained slow message writes (logged by the outbound slow logger) where a message became stuck until a subsequent message was sent (e.g. during period leader checks or so)
* Pass size `0` messages down the pipeline instead of just resolving their promise to avoid
unexpected behavior (though we don't make use of `0`-length writes as of today
* Avoid unnecessary flushes in queued-writes loop and only flush if the channel stops being
writable
* Release buffers on queued writes that we fail on channel close (not doing this wasn't causing bugs today because we release the underlying bytes elsewhere but could cause trouble later)

Unfortunately, I was not able to reproduce the issue in the first point reliably as the timing is really tricky. I therefore tried to make this PR as short and uncontroversial as possible. I think there's possible further improvements here and this should have been caught by a test but it's not yet clear to me how to design a reliable reproducer here.
2021-07-30 16:09:11 +02:00
Mark Vieira 9d14bc91d7
Set netty available processors system property for tests globally (#75699) 2021-07-27 11:21:42 -07: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
Przemko Robakowski bbfc6d2a45
Update licenses and attributions for GeoIP module (#75178)
Update licenses and attributions for GeoIP module
2021-07-26 14:16:14 +02:00
Przemko Robakowski b3ddec71f4
Add warning header after 25 days after last db update (#75311)
Add warning header after 25 days after last db update
2021-07-26 14:14:55 +02:00
Adrien Grand 9dceb86d09
Address recent percolator failures. (#75620)
They are due to changes to `indices.query.bool.max_clause_count` that got pushed
in #75297.

Closes #75591
Closes #75592
2021-07-22 12:04:38 +02:00
Mark Vieira 9104061343 Mute CandidateQueryTests.testPercolateSmallAndLargeDocument 2021-07-21 16:19:05 -07:00
Przemyslaw Gomulka ec7d9d22cd
[Rest Api Compatibility] Enable parent_join inner_hits test (#75560)
The test in 7.x was fixed in #75534
2021-07-21 09:42:11 +02:00
Przemko Robakowski e245a80ac3
Mute GeoIpDownloaderIT#testInvalidTimestamp (#75398) 2021-07-15 18:56:48 -04:00
Tim Vernum 940a890958
Update "ssl-config" to support X-Pack features (#74887)
This commit upgrades the existing SSPL licensed "ssl-config" library
to include additional features that are supported by the X-Pack SSL
library.

This commit does not make any changes to X-Pack to use these new
features - it introduces them in preparation for their future use by
X-Pack.

The reindex module is updated to reflect API changes in ssl-config
2021-07-15 19:46:00 +10:00
Przemko Robakowski 0f2e2213a8
Make GeoIpDownloaderIT.testInvalidTimestamp more robust (#75330)
This change adds additional assertion in GeoIpDownloaderIT.testInvalidTimestamp which makes sure that validity checks work both ways (so going out of validity and back) and it should fix race in cleanUp method leading to occasional failures.

Closes #75221
Closes #74358
2021-07-15 01:27:08 +02:00
Ignacio Vera dcd38779f9
Geometry formatters should be applied to the full array (#75177)
Changes the way we fetch values from source in geo fields so we can format all data in one go.
2021-07-14 16:23:30 +02:00
Przemyslaw Gomulka 71e05838a6
[Rest Api Compatibility] Enable tests after types and cat api fixed (#75179)
Some tests are fixed after typed api is available with compatible api.
Also cat api returning text fixed some tests
relates #51816
2021-07-14 08:37:38 +02:00
Stuart Tettemer e4df4d7205
Script: Def encoding parser (#74840)
Parse and validate the def encoding string.

Broken out of e26fa4e
2021-07-09 11:30:57 -05:00
Martijn van Groningen 9780f674ac
Improve stability of GeoIpDownloaderIT test suite. (#74558)
Adjust GeoIpDownloaderIT test suit to wait for managed databases files
to be removed after each test.

After each test geoip downloader is disabled,  which should eventually
remove the managed geoip database files. This happens in the background.
However a new test starts that assumes that the builtin databases are used
then that test can fail, because expected assertions will fail. The changes
in this commit should address this.

Closes #74358
2021-07-09 11:53:53 +02:00
Felix Barnsteiner 0a8f725647
Support for wildcards and override option for dot_expander processor (#74601) 2021-07-08 14:39:27 +02:00
Felix Barnsteiner 404e9865b6
Json processor: add_to_root_conflict_strategy option (#74967) 2021-07-08 14:36:22 +02:00
Przemyslaw Gomulka 1f726800a6
[Rest Api Compatibility] Clean up x-pack/plugin rest compat tests (#74701)
this PR removes tests which are not meant to be fixed (ml/, vectors/) to a separate "not to be fixed list" so that we can see which compatible changes are meant to be implemented.

relates #51816
2021-07-08 11:04:55 +02:00
Luca Cavanna c6641bf00c
Rename ParseContext to DocumentParserContext (#74963)
ParseContext is used to parse documents. It was easily confused with ParserContext (now renamed to MappingParserContext) which is instead used to parse mappings.

To remove any confusion, this commit renames ParseContext to DocumentParserContext and adapts its subclasses accordingly.
2021-07-06 09:15:59 -04:00
Felix Barnsteiner 67fbc337ea
Json processor: allow duplicate keys (#74956) 2021-07-06 15:02:32 +02:00
Luca Cavanna 2700cc802c
Simplify ParseContext (#74831)
We currently have one ParseContext class, which is used to parse incoming documents, not to be confused with the former ParserContext (now renamed to MappingParserContext) which is instead used to parse mappings.

There are a few implementations of ParseContext, but mostly the InternalParseContext one is used. There is also a FilterParseContext that allows to delegate to a given context for all methods besides the one explicitly overridden by it.

This commit attempts to simplify ParseContext by extracting its InternalParseContext implementation and moving it where it's used, within DocumentParser and making it private, so that the super-class can be used. This allows to hide some implementation details that only InternalParseContext knows about on nested documents and the way they are stored in lucene.

Also, we are introducing separate test implementations in place of reusing InternalParseContext in tests too.

Additionally FilterParseContext can be greatly simplified by relying on a copy constructor, that makes it so that it does not have to override every single method to delegate to the provided context, at least for the behaviour that can't be overridden (final methods).
2021-07-06 13:26:10 +02:00
Przemyslaw Gomulka 744c75d34a
[Rest Api Compatibility] Rename BulkItemResponse.Failure type field (#74937)
it should return type instead of _type
relates #51816
2021-07-06 10:50:38 +02:00
Przemko Robakowski 04a9282994
Fix GeoIpProcessor when there's no updated db (#74944)
This change fixes problem with GeoIpProcessor when there's GeoIpTaskState present in the cluster state but there's no database matching the one used by the processor. It can happen when there are some but not all databases already updated.
2021-07-06 07:54:14 +02:00
Ignacio Vera 0f30c79e4b
Remove legacy geo code from AbstractGeometryQueryBuilder classes (#74741)
removes references to Legacy ShapeParser and ShapeBuilder in AbstractGeometryQueryBuilder classes 
in favour to Geometry and GeometryParser.
2021-07-05 07:31:55 +02:00
Stuart Tettemer e26fa4e6da
Script: User funcs are script instance methods (#74268)
User defined functions are instance methods on the Script class.

Update lambdas and method references to capture the script `this`
reference.

Def method encoding string takes an extra char at index 1, whether
to capture the script reference.

For runtime fields, this means emit, which is an script instance
method already, now works in user defined functions.

Fixes: #69742
Refs: #68235
2021-07-01 08:41:44 -05:00
Nhat Nguyen 174f65ef82
Upgrade to Lucene 8.9.0 (#74729) 2021-06-30 08:49:53 -04:00
Przemyslaw Gomulka d460088b05
Remove percolator compat test and allow for 7.x warning #74744
Remove custom percolator query with types test as it is in 7.x
add transformation to 7.x test to allow type removal warning
2021-06-30 14:37:41 +02:00
Przemyslaw Gomulka 603ebf7b7f
[Rest Api Compatibility] Types for Percolate Query Api (#74698)
Previously removed in #46985. The yaml test is included in this PR, but
will be removed once #74689 is merged.

relates #54160
relates main meta issue #51816
2021-06-30 13:49:53 +02:00
Mark Vieira 4ef48e8db5 Fix thirdPartyAudit task configuration 2021-06-29 15:43:05 -07:00
Armin Braun 8947c1e980
Save Memory on Large Repository Metadata Blob Writes (#74313)
This PR adds a new API for doing streaming serialization writes to a repository to enable repository metadata of arbitrary size and at bounded memory during writing. 
The existing write-APIs require knowledge of the eventual blob size beforehand. This forced us to materialize the serialized blob in memory before writing, costing a lot of memory in case of e.g. very large `RepositoryData` (and limiting us to `2G` max blob size).
With this PR the requirement to fully materialize the serialized metadata goes away and the memory overhead becomes completely bounded by the outbound buffer size of the repository implementation. 

As we move to larger repositories this makes master node stability a lot more predictable since writing out `RepositoryData` does not take as much memory any longer (same applies to shard level metadata), enables aggregating multiple metadata blobs into a single larger blobs without massive overhead and removes the 2G size limit on `RepositoryData`.
2021-06-29 11:29:55 +02:00
Przemyslaw Gomulka 5ac94b5263
[Rest Api Compatibility] Enable tests that are already fixed (#74174)
With types removal changes being available under rest api compatibility I have removed the block entries for tests which are already fixed
relates #51816
2021-06-29 09:11:31 +02:00
Przemko Robakowski 9706d676a1
Enable GeoIP downloader by default (#74323)
This change will enable geoip downloader by default again. It also brings back relevant documentation.
2021-06-28 09:04:49 +02:00
bellengao 307b82c474
Fix ignore_missing takes no effect in Rename Ingest Processor (#74248) 2021-06-25 07:48:03 -05:00
Jay Modi d4afd6a216
Protect newly introduced system indices fully (#74186)
This change updates the way we handle net new system indices, which are
those that have been newly introduced and do not require any BWC
guarantees around non-system access. These indices will not be included
in wildcard expansions for user searches and operations. Direct access
to these indices will also not be allowed for user searches.

The first index of this type is the GeoIp index, which this change sets
the new flag on.

Closes #72572
2021-06-24 14:13:57 -04:00
Christos Soulios df941367df
Add dimension mapping parameter (#74450)
Added the dimension parameter to the following field types:

    keyword
    ip
    Numeric field types (integer, long, byte, short)

The dimension parameter is of type boolean (default: false) and is used 
to mark that a field is a time series dimension field.

Relates to #74014
2021-06-24 20:16:27 +03:00
Armin Braun cbf48e0633
Flatten Get Snapshots Response (#74451)
This PR returns the get snapshots API to the 7.x format (and transport client behavior) and enhances it for requests that ask for multiple repositories.
The changes for requests that target multiple repositories are:
* Add `repository` field to `SnapshotInfo` and REST response
* Add `failures` map alongside `snapshots` list instead of returning just an exception response as done for single repo requests
* Pagination now works across repositories instead of being per repository for multi-repository requests

closes #69108
closes #43462
2021-06-24 16:58:33 +02:00
Luca Cavanna 7cedc3ec3a
Make Document a top-level class (#74472)
There is no reason for Document to be an inner class of ParseContext, especially as it is public and accessed directly from many different places.

This commit takes it out to its own top-level class file, which has the advantage of simplifying ParseContext which could use some love too.
2021-06-24 10:56:30 +02:00
Luca Cavanna 0d0e403258
Move and rename ParserContext (#74402)
ParserContext is an inner class of Mapper.TypeParser but is used outside of the context of parsing mappers, for instance also to parse runtime fields. Its purpose is to be used to parse mappings in general, and its name is confusing as it differs ever so slightly from ParseContext which is used for parsing incoming documents.

This commit moves ParserContext to be a top-level class, and renames it to MappingParserContext.
2021-06-23 09:28:56 +02:00
bellengao 42c0be4c67
Add template snippets support for KV ingest processor (#73758) 2021-06-22 16:32:11 -05:00
Rene Groeschke e509059360
Fix deprecated configuration of javaexec (#74405)
Remove some more deprecated gradle api usages in our build.
2021-06-22 14:46:15 +02:00
David Kyle f5e0536e24
Mute GeoIpDownloaderIT testUseGeoIpProcessorWithDownloadedDBs (#74373)
For #74358
2021-06-21 16:40:15 +01:00
Przemko Robakowski 05d3316a76
Adjust serialisation versioning after ingest geoip processor change (#74328)
Adjust serialisation versioning now that: 'change GeoIP downloader policy after 30 days of no updates'  change has been back ported via #74296
2021-06-21 08:41:44 +02:00
Przemko Robakowski 331a44ba42
Change GeoIP downloader policy after 30 days of no updates (#74099)
This PR changes the way GeoIpDownloader and GeoIpProcessor handle situation when we are unable to update databases for 30 days. In that case:

GeoIpDownloader will delete all chunks from .geoip_databases index
DatabaseRegistry will delete all files on ingest nodes
GeoIpProcessor will tag document with tags: ["_geoip_expired_database"] field (same way as in Logstash)
This change also fixes bug with that breaks DatabaseRegistry and when it tires to download databases after updating timestamp only (GeoIpDownloader checks if there are new databases and updates timestamp because local databases are up to date)
2021-06-18 13:51:12 +02:00
Dan Hermann bad29e1bf4
Expose Community ID processor in Painless (#73963) 2021-06-17 14:29:46 -05:00
Alan Woodward 7d665616da
Deprecate setting version on analyzers (#74073)
The version field on all lucene Analyzers is unused, and is being removed
in lucene 9. This commit deprecates setting a version on an analyzer in
index settings and removes the related calls to Analyzer.setVersion()

Relates to #74057
2021-06-16 09:40:41 +01:00
Rory Hunter a5d2251064
Order imports when reformatting (#74059)
Change the formatter config to sort / order imports, and reformat the
codebase. We already had a config file for Eclipse users, so Spotless now
uses that.

The "Eclipse Code Formatter" plugin ought to be able to use this file as
well for import ordering, but in my experiments the results were poor.
Instead, use IntelliJ's `.editorconfig` support to configure import
ordering.

I've also added a config file for the formatter plugin.

Other changes:
   * I've quietly enabled the `toggleOnOff` option for Spotless. It was
     already possible to disable formatting for sections using the markers
     for docs snippets, so enabling this option just accepts this reality
     and makes it possible via `formatter:off` and `formatter:on` without
     the restrictions around line length. It should still only be used as
     a very last resort and with good reason.
   * I've removed mention of the `paddedCell` option from the contributing
     guide, since I haven't had to use that option for a very long time. I
     moved the docs to the spotless config.
2021-06-16 09:22:22 +01:00
Dan Hermann 57846495e9
Expose URI parts processor in Painless (#73634) 2021-06-15 17:19:59 -05:00
Adrien Grand a90ca8dfae
Prevent Lucene from automatically flushing in SourceIntervalsSourceTests. (#73990)
Closes #72130
2021-06-10 13:44:28 +02:00
Ignacio Vera 6466ce752d
Separate parsing geo format from fields API geo formats (#73806)
This change removes the current GeometryFormat interface and replace then with a GeometryParser that deals 
with Parsing formats and a GeometryFormatFactory that deals with fields API formats.
2021-06-09 06:32:12 +02:00
Ryan Ernst ab1a2e4a84
Add precommit task for detecting split packages (#73784)
Modularization of the JDK has been ongoing for several years. Recently
in Java 16 the JDK began enforcing module boundaries by default. While
Elasticsearch does not yet use the module system directly, there are
some side effects even for those projects not modularized (eg #73517).
Before we can even begin to think about how to modularize, we must
Prepare The Way by enforcing packages only exist in a single jar file,
since the module system does not allow packages to coexist in multiple
modules.

This commit adds a precommit check to the build which detects split
packages. The expectation is that we will add the existing split
packages to the ignore list so that any new classes will not exacerbate
the problem, and the work to cleanup these split packages can be
parallelized.

relates #73525
2021-06-08 15:04:23 -07:00
Ryan Ernst 63012c8a40
Move ParseField to o.e.c.xcontent (#73923)
ParseField is part of the x-content lib, yet it doesn't exist under the
same root package as the rest of the lib. This commit moves the class to
the appropriate package.

relates #73784
2021-06-08 13:32:14 -07:00
Ryan Ernst 68817d7ca2
Rename o.e.common in libs/core to o.e.core (#73909)
When libs/core was created, several classes were moved from server's
o.e.common package, but they were not moved to a new package. Split
packages need to go away long term, so that Elasticsearch can even think
about modularization. This commit moves all the classes under o.e.common
in core to o.e.core.

relates #73784
2021-06-08 09:53:28 -07:00
Ryan Ernst f98b374cf6
Revert "Upgrade Azure SDK and Jackson (#72833) (#72995)" (#73837)
The recent upgrade of the Azure SDK has caused a few test failures that
have been difficult to debug and do not yet have a fix. In particular, a
change to the netty reactor resolving
(https://github.com/reactor/reactor-netty/issues/1655). We need to wait
for a fix for that issue, so this reverts commit
6c4c4a0ecb.

relates #73493
2021-06-07 10:20:46 -07:00
Julie Tibshirani 59000da936 Fix typo in ParentIdFieldMapper comment 2021-06-07 08:49:58 -07:00
Ryan Ernst 64054de1ac
Rename bootstrap package in core jar (#73788)
The org.elasticsearch.bootstrap package exists in server with classes
for starting up Elasticsearch. The elasticsearch-core jar has a handful
of classes that were split out from there, namely java version parsing
and jarhell. This commit moves those classes to a new
org.elasticsearch.jdk package so as to not split the server owned
bootstrap package.

relates #73784
2021-06-07 08:14:44 -07:00
Julie Tibshirani 58c1477095 Adjust REST test skip version for join field retrieval
The version can be updated now that the test was backported.
2021-06-05 17:14:25 -07:00
Julie Tibshirani dc86babfe6
Fix error when fetching values for parent ID join field (#73639)
The parent ID join field is an internal field that links child documents to
their parent. Although it's internal, we include it when listing all field
types. This means a search with `"fields": "*"` can attempt to fetch values from
the parent ID field and fail.

This PR applies a simple fix to return an empty result instead of failing.
2021-06-04 11:26:45 -07:00
Luca Cavanna 05ca9cf876
Remove getMatchingFieldTypes method (#73655)
FieldTypeLookup and MappingLookup expose the getMatchingFieldTypes method to look up matching field type by a string pattern. We have migrated ExistsQueryBuilder to instead rely on getMatchingFieldNames, hence we can go ahead and remove the remaining usages and the method itself.

The remaining usages are to find specific field types from the mappings, specifically to eagerly load global ordinals and for the join field type. These are operations that are performed only once when loading the mappings, and may be refactored to work differently in the future. For now, we remove getMatchingFieldTypes and rather call for the two mentioned scenarios getMatchingFieldNames(*) and then getFieldType for each of the returned field name. This is a bit wasteful but performance can be sacrificed for these scenarios in favour of less code to maintain.
2021-06-03 10:01:22 +02:00
Nhat Nguyen 5efb6eaba6
Update Lucene to 8.9.0-snapshot-ddc238e5df8 (#73568)
Just include LUCENE-9980, which fixes #39591.

Closes #39591
2021-05-31 13:49:29 -04:00
Jack Conradson 1a719eb4c0
Fix several function reference bugs in Painless (#73538)
This changes fixes three bugs all related to function references in Painless.

First:
Fixes a bug where if a primitive type is used as a capture a VerifyError is returned from the compiler. 
The primitive is now boxed automatically on behalf of the user.

Example:
long test(Supplier s) {return s.get();} int i = 1; return test(i::intValue);

Second:
Fix a bug where we output an internal error as opposed to a user error in the case of a static method 
used with a non-static capture. We now give the user feedback that they cannot do this instead of no 
useful information.

Example:
int test(Function f, String s) {return f.apply(s);} Integer i = Integer.valueOf(1); test(i::parseInt, '1')

Third:
Fix a bug where interface methods using reflection do not match their method handle counterparts 
for overridden methods on Object. CharSequence specifically overrides toString, but the 
MethodHandle it gets is for Object. Function references now take this into account and write out the 
correct constant for a method reference interface.

Example:
CharSequence test(Supplier s) {return s.get();} CharSequence s = 's'; return test(s::toString);
2021-05-28 14:32:04 -07:00
Dan Hermann bb5fea160b
Refactor uri_parts processor so it can be exposed in Painless (#73344) 2021-05-28 08:41:20 -05:00
Ryan Ernst e9970aa7e3
Upgrade netty to 4.1.63 (#73011) 2021-05-27 15:51:35 -07:00
Ryan Ernst 6c4c4a0ecb
Upgrade Azure SDK and Jackson (#72833) (#72995)
This commit upgrades the Azure SDK to 12.11.0 and Jackson to 2.12.2. The
Jackson upgrade must happen at the same time due to Azure depending on
this new version of Jackson.

closes #66555
closes #67214

Co-authored-by: Francisco Fernández Castaño <francisco.fernandez.castano@gmail.com>
2021-05-27 07:55:18 -07:00
Ignacio Vera 409b6cefe3
Add painless script support for geo_shape field (#72886)
Users can access the centroid, bounding box and dimensional type of the shape.
2021-05-26 18:55:45 +02:00
Nhat Nguyen 1764e8ba15
Upgrade to Lucene-8.9.0-SNAPSHOT-efdc43fee18 (#73130)
Upgrades to Lucene-8.9 snapshot which includes:

- LUCENE-9507: Custom order for leaves (/cc @mayya-sharipova)
- LUCENE-9935: Enable bulk merge for stored fields with index sort
2021-05-17 09:37:20 -04:00
David Turner b2956b3ae7
Identify cancelled tasks in list tasks API (#72931)
This commit adds a `cancelled` flag to each cancellable task in the
response to the list tasks API, allowing users to see that a task has
been properly cancelled and will complete as soon as possible.

Closes #72907
2021-05-17 11:02:50 +01:00
Jack Conradson e394250062
Add LinkageError to the errors we catch as part of the Painless sandbox (#73116)
This changes the Painless sandbox to be more encompassing of possible 
compiler bugs including JVM bugs. This prevents any single script from 
crashing a node under a wider array of circumstances that in theory should 
be recoverable with possible changes to a user-defined script.
2021-05-14 10:50:22 -07:00
Alan Woodward 3bd594ebe8
Replace simpleMatchToFullName (#72674)
MappingLookup has a method simpleMatchToFieldName that attempts
to return all field names that match a given pattern; if no patterns match,
then it returns a single-valued collection containing just the pattern that
was originally passed in. This is a fairly confusing semantic.

This PR replaces simpleMatchToFullName with two new methods:

* getMatchingFieldNames(), which returns a set of all mapped field names
  that match a pattern. Calling getFieldType() with a name returned by
  this method is guaranteed to return a non-null MappedFieldType
* getMatchingFieldTypes, that returns a collection of all MappedFieldTypes
  in a mapping that match the passed-in pattern.

This allows us to clean up several call-sites because we know that
MappedFieldTypes returned from these calls will never be null. It also
simplifies object field exists query construction.
2021-05-13 11:35:23 +01:00
Przemyslaw Gomulka 85ed9100df
[Rest Api Compatibility] Typed endpoints for search and related endpoints (#72155)
Implements a V7 compatible typed endpoints for REST for search related apis
retrofits the REST layer change removed in #41640

relates main meta issue #51816
relates types removal issue #54160
2021-05-12 21:00:19 +02:00
Stuart Tettemer f6bf99ce77
Script: Mangle user function names (#72892)
Prepend `&` to user function names.  In future changes user
functions will switch from being static methods to member methods.
The mangled user function names will prohibit users from overriden
other script methods.

Refs: #69742
2021-05-10 12:27:03 -05:00
Armin Braun 52e7b926a9
Make Large Bulk Snapshot Deletes more Memory Efficient (#72788)
Use an iterator instead of a list when passing around what to delete.
In the case of very large deletes the iterator is a much smaller than
the actual list of files to delete (since we save all the prefixes
which adds up if the individual shard folders contain lots of deletes).
Also this commit as a side-effect adjusts a few spots in logging where the
log messages could be catastrophic in size when trace logging is activated.
2021-05-10 13:40:57 +02:00
Przemko Robakowski a7ff5e7141
Disable GeoIP downloader (#72716)
Due to problems discovered in #72572 we have to disable geoip downloader for now. We use ingest.geoip.downloader.enabled.default as feature flag.
This change also reverts changes to docs.
2021-05-10 13:03:30 +02:00
Armin Braun bef9dab643
Cleanup BlobPath Class (#72860)
There should be a singleton for the empty version of this.
All the copying to `String[]` or use as an iterator make
no sense either when we can just use the list outright.
2021-05-10 00:10:39 +02:00
Ryan Ernst 8cd3944a0a
Revert "Upgrade Azure SDK and Jackson (#72833)"
This reverts commit dca0e92bef.
2021-05-06 20:51:31 -07:00
Ryan Ernst dca0e92bef
Upgrade Azure SDK and Jackson (#72833)
This commit upgrades the Azure SDK to 12.11.0 and Jackson to 2.12.2. The
Jackson upgrade must happen at the same time due to Azure depending on
this new version of Jackson.

closes #66555
closes #67214
2021-05-06 20:36:42 -07:00
Dan Hermann 43bd3f273a
Javadocs for Painless processor methods (#72766) 2021-05-06 07:21:08 -05: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
Luca Cavanna 5523976242
Extract parseDocument from MappingLookup (#72694)
MappingLookup became capable of parsing documents because we needed the search execution context to expose the ability to parse a document that did not depend on a mutable document mapper (only the percolator uses this feature).

In hindsight, parsing documents is quite a specific usecase that does not quite fit in MappingLookup. Also, it introduces the need for MappingLookup to hold IndexSettings, IndexAnalyzers and DocumentParser only for that purpose.

Instead, we can expose the DocumentParser by making it public and make its parse method accept a MappingLookup instance.
2021-05-05 15:28:59 +02:00
Luca Cavanna b92b9d1c94
Replace some DocumentMapper usages with MappingLookup (#72400)
We recently replaced some usages of DocumentMapper with MappingLookup in the search layer, as document mapper is mutable which can cause issues. In order to do that, MappingLookup grew and became quite similar to DocumentMapper in what it does and holds.

In many cases it makes sense to use MappingLookup instead of DocumentMapper, and we may even be able to remove DocumentMapper entirely in favour of MappingLookup in the long run.

This commit replaces some of its straight-forward usages.
2021-05-03 09:42:37 +02:00
Alan Woodward 009f23e7a9
Explicitly say if stored fields aren't supported in MapperTestCase (#72474)
MapperTestCase has a check that if a field mapper supports stored fields,
those stored fields are available to index time scripts. Many of our mappers
do not support stored fields, and we try and catch this with an assumeFalse
so that those mappers do not run this test. However, this test is fragile - it
does not work for mappers created with an index version below 8.0, and it
misses mappers that always store their values, e.g. match_only_text.

This commit adds a new supportsStoredField method to MapperTestCase,
and overrides it for those mappers that do not support storing values. It
also adds a minimalStoredMapping method that defaults to the minimal
mapping plus a store parameter, which is overridden by match_only_text
because storing is not configurable and always available on this mapper.
2021-04-30 08:59:56 +01:00
Adrien Grand 1f74b2072f
Enable mixed-version cluster tests for `match_only_text`. (#72102)
These tests can be enabled now that the new field type has been backported to
7.14.
2021-04-29 16:41:39 +02:00
Alan Woodward b27eaa38dc
Remove 'external values', and replace with swapped out XContentParsers (#72203)
The majority of field mappers read a single value from their positioned
XContentParser, and do not need to call nextToken. There is a general
assumption that the same holds for any multifields defined on them, and
so the XContentParser is passed down to their multifields builder as-is.
This assumption does not hold for mappers that accept json objects,
and so we have a second mechanism for passing values around called
'external values', where a mapper can set a specific value on its context
and child mappers can then check for these external values before reading
from xcontent. The disadvantage of this is that every field mapper now
needs to check its context for external values. Because the values are
defined by their java class, we can also know that in the vast majority of
cases this functionality is unused. We have only two mappers that actually
make use of this, CompletionFieldMapper and GeoPointFieldMapper.

This commit removes external values entirely, and replaces it with the ability
to pass a modified XContentParser to multifields. FieldMappers can just check
the parser attached to their context for data and don't need to worry about
multiple sources.

Plugins implementing field mappers will need to take the removal of external
values into account. Implementations that are passing structured objects
as external values should instead use ParseContext.switchParser and
wrap the objects using MapXContentParser.wrapObject().

GeoPointFieldMapper passes on a fake parser that just wraps its input data
formatted as a geohash; CompletionFieldMapper has a slightly more complicated
parser that in general wraps its metadata, but if textOrNull() is called without
the parser being advanced just returns its text input.

Relates to #56063
2021-04-29 09:17:18 +01:00
Przemko Robakowski 3130614196
Fail geoip processor if database is older than 30 days (#72367)
As required by MaxMind license we can't use databases that are older than 30 days as we could miss "don't sell" request.
This check was missing before and this change fixes that.
2021-04-28 22:12:00 +02:00
Przemko Robakowski e32a2f59b1
Hide .geoip_databases index (#72377)
Hidden index will no longer be target for wildcard (*) queries, this way we can avoid accidentally downloading huge amount of data
2021-04-28 16:18:02 +02:00
Alan Woodward e002aa809b
Make FieldNamesFieldMapper responsible for adding its own doc fields (#71929)
The FieldNamesFieldMapper is a metadata mapper defining a field that
can be used for exists queries if a mapper does not use doc values or
norms. Currently, data is added to it via a special method on FieldMapper
that pulls the metadata mapper from a mapping lookup, checks to see
if it is enabled, and then adds the relevant value to a lucene document.

This is one of only two places that pulls a metadata mapper from the
MappingLookup, and it would be nice to remove this method. This commit
refactors field name handling by instead storing the names of fields to
index in the fieldnames field in a set on the ParseContext, and then
building the field itself in FieldNamesFieldMapper.postParse(). This means
that all of the responsibility for enabling indexing, etc, is handled within
the metadata mapper itself.
2021-04-27 16:03:46 +01:00
Jack Conradson 50152589ca
Fix Painless execute api output (#72135)
This fixes the output for the date type, geo point type, and ip type to match as 
if it was coming from the fields API. This also ensures it's in a "pretty", 
human-readable format.
2021-04-27 07:18:01 -07:00
Armin Braun 47c77160ef
Fix ListenableFuture Resolving Listeners under Mutex (#71943) (#72087)
We shouldn't loop over the listeners under the mutex in `done` since in most use-cases we used `DirectExecutorService`
with this class.
Also, no need to create an `AbstractRunnable` for direct execution. We use this listener on the hot path in authentication
making this a worthwhile optimization I think.
Lastly, no need to clear and thus loop over `listeners`, the list is not used again after the `done` call returns anyway
so no point in retaining it at all (especially when in a number of use cases we add listeners only after the `done` call
so we can also save the instantiation by making the field non-final).
2021-04-26 19:33:34 +02:00
Armin Braun d65a16ad1d
Use NettyByteBufSizer for Outbound Connections (#72193)
We should also use the sizer for outbound connections like
we do for inbound. Also made it a singleton since we use it in 3
spots now and there's no point instantiating it multiple times.
2021-04-26 19:26:08 +02:00
Alan Woodward 78c63ff4d1
Don't index object subpaths in _field_names field (#72243)
Back when we indexed every value-containing field from a document in
the _field_names field, it made sense to also index object subpaths
from that field so that we count efficiently run exists queries against
objects. However, since many fields now instead use docvalues or norms
iterators for their exists queries, and don't store their field names in
_field_names, object exists queries cannot make use of these
intermediate paths. We're still storing them, however.

This commit stops storing these intermediate paths in the _field_names
field, as they are unused and just take up extra space.
2021-04-26 16:54:45 +01:00
Rene Groeschke 5bcd02cb4d
Restructure build tools java packages (#72030)
Related to #71593 we move all build logic that is for elasticsearch build only into
the org.elasticsearch.gradle.internal* packages

This makes it clearer if build logic is considered to be used by external projects
Ultimately we want to only expose TestCluster and PluginBuildPlugin logic
to third party plugin authors.

This is a very first step towards that direction.
2021-04-26 14:53:55 +02:00
Adrien Grand 314574026a Make sure there are no merges.
Closes #72130
2021-04-23 14:17:46 +02:00
Martijn van Groningen 1c5272cc72
Adjust geoip downloader (#72094)
Instead of doing a refresh as part of each index request, perform
this separately after all chunks have been indexed.

Also perform a flush, so that the translog is trimmed and
doesn't contain all these large write operations (1mb) until
an automatic refresh happens (which may take a while since
no other indexing will take place for a while).
2021-04-23 09:07:28 +02:00
Luca Cavanna 1d514c53cb
Remove MapperService#parse method (#72080)
We have recently split DocumentMapper creation from parsing Mapping. There was one method leftover that exposed parsing mapping into DocumentMapper, which is generally not needed. Either you only need to parse into a Mapping instance, which is more lightweight, or like in some tests you need to apply a mapping update for which you merge new mappings and get the resulting document mapper. This commit addresses this and removes the method.
2021-04-22 16:08:34 +02:00
Adrien Grand 83113ec8d3
Add `match_only_text`, a space-efficient variant of `text`. (#66172)
This adds a new `match_only_text` field, which indexes the same data as a `text`
field that has `index_options: docs` and `norms: false` and uses the `_source`
for positional queries like `match_phrase`. Unlike `text`, this field doesn't
support scoring.
2021-04-22 08:41:47 +02:00
Alan Woodward 72f9c4c122
Add null-field checks to shape field mappers (#71999)
#71696 introduced a regression to the various shape field mappers,
where they would no longer handle null values. This commit fixes
that regression and adds a testNullValues method to MapperTestCase
to ensure that all field mappers correctly handle nulls.

Fixes #71874
2021-04-21 15:54:22 +01:00
Christoph Büscher 5315ed6c32
Fix range queries on runtime double field (#71915)
DoubleScriptFieldRangeQuery which is used on runtime fields of type "double"
currently uses simple double type comparison for checking its upper and lower
bounds. Unfortunately it seems that -0.0 == 0.0, but when we want to exclude a
0.0 bound via "lt" the generated range query uses -0.0 as its upper bound which
erroneously includes the 0.0 value. We can use `Double.compare` instead which
seems to handle this edge case well.

Closes #71786
2021-04-20 16:44:45 +02:00
Francisco Fernández Castaño 9d8fb9fba2
Use the remaining scroll response documents on update by query bulk requests (#71430)
In update by query requests where max_docs < size and conflicts=proceed
we weren't using the remaining documents from the scroll response in
cases where there were conflicts and in the first bulk request the
successful updates < max_docs. This commit address that problem and
use the remaining documents from the scroll response instead of
requesting a new page.

Closes #63671
2021-04-20 14:45:17 +02:00
Luca Cavanna 9be4d3312e
Rename string_field script context to keyword_field (#71854)
Up until now, the name of the script contexts that runtime fields use was internal only. They recently got exposed through the painless execute API. This commit fixes the discrepancy between the field type used to define a runtime field of type keyword and the script context needed to simulate its corresponding script: string_field should be keyword_field.
2021-04-20 14:32:06 +02:00