Commit Graph

5616 Commits

Author SHA1 Message Date
Julie Tibshirani d4039228ae Fix regressions around nested hits and disabled _source. (#66572)
This PR fixes two bugs that can arise when _source is disabled and we fetch nested documents:
* Fix exception when highlighting `inner_hits` with disabled _source.
* Fix exception in nested `top_hits` with disabled _source.
* Add more tests for highlighting `inner_hits`.
2020-12-18 15:21:37 -08:00
Gordon Brown df8c92cfef
Mute tests failing on Debian 8 due to memory reporting (#66648) 2020-12-18 15:27:07 -07:00
Albert Zaharovits 480561dbc3
Store and use only internal security headers (#66365)
For async searches (EQL included) the client's request headers were
erroneously stored in the .tasks index. This might expose the requesting
client's HTTP Authorization header. This PR fixes that by employing the
usual approach to store only the security-internal headers, which carry
the authentication result, instead of the original Authorization header,
which is commonly utilized to redo authentication for scheduled tasks.
2020-12-17 23:40:55 +02:00
Julie Tibshirani 24c0f01543 Ensure all query builder tests consider older versions. (#66401)
This PR removes outdated overrides in some tests that prevent them from testing
older index versions. Also removes an old comment + logic from
AggregatorFactoriesTests.
2020-12-16 11:57:01 -08:00
asce0705 5000ec87ca Fix constructors of NoOpResult (#66269) 2020-12-16 13:37:49 -05:00
Jay Modi 01d54d222b
Fix cat tasks api params in spec and handler (#66294)
This commit fixes the cat tasks api parameter specification and the
handler so that the parameters are consumed during request preparation.

Closes #59493
Backport of #66272
2020-12-14 13:44:09 -07:00
Jim Ferenczi 330de82d59 Fix composite aggregation on unsigned long (#65715)
This commit ensures that the after key is parsed with the doc value formatter.
This is needed for unsigned longs that uses shifted longs internally.

Closes #65685
2020-12-14 16:59:07 +01:00
Armin Braun 7e1fc6dc67
Adjust Cleanup Order of Internal State in SnapshotsService (#66225) (#66244)
In the assertion mentioned in the new comment we first get the `endingSnapshots`
and then check that we don't have a listener that isn't referred to by it so we need
to remove from the listers map before removing from `endingSnapshots` to avoid rare, random
assertion tripping here with concurrent repository operations.
2020-12-14 12:24:39 +01:00
Nhat Nguyen cc674e7d74 Fix TranslogTests#testStats (#66227)
If creating the latest translog file and retrieving a translog stats 
happen within the same millisecond, then the earliestLastModifiedAge
will be zero.

Closes #66092
2020-12-13 10:44:27 -05:00
Julie Tibshirani b2d3c3f6f9
Fix bug where fvh fragments could be loaded from wrong doc (#66142)
This PR fixes a regression where fvh fragments could be loaded from the wrong
document _source.

Some `FragmentsBuilder` implementations contain a `SourceLookup` to load from
_source. The lookup should be positioned to load from the current hit document.
However, since `FragmentsBuilder` are cached and shared across hits, the lookup
is never updated to load from the new documents. This means we accidentally
load _source from a different document.

The regression was introduced in #60179, which started storing `SourceLookup`
on `FragmentsBuilder`.

Fixes #65533.
2020-12-09 17:52:58 -08:00
Francisco Fernández Castaño 55246d8d9b [7.10] Bump version after 7.10.1 release 2020-12-09 16:11:29 +01:00
Lee Hinman 8cbb9612d0
[7.10] Create AllocationDeciders in the main method of the ILM step (#65037) (8ac30f9a) (#66070)
Backports the following commits to 7.x:

    Create AllocationDeciders in the main method of the ILM step (#65037) (8ac30f9)
2020-12-08 16:56:25 -07:00
Gordon Brown fb65fd8723
[7.10] Correctly determine defaults of settings which depend on other settings (#65989)
This commit adjusts the behavior when calculating the diff between two
`AbstractScopedSettings` objects, so that the default values of settings
whose default values depend on the values of other settings are
correctly calculated. Previously, when calculating the diff, the default
value of a depended setting would be calculated based on the default
value of the setting(s) it depends on, rather than the current value of
those settings.
2020-12-08 13:21:00 -07:00
Tanguy Leroux 16fae5d66d
Also reroute after shard snapshot size fetch failure (#66008)
In #61906 we added the possibility for the master node to fetch
the size of a shard snapshot before allocating the shard to a
data node with enough disk space to host it. When merging
this change we agreed that any failure during size fetching
should not prevent the shard to be allocated.

Sadly it does not work as expected: the service only triggers
reroutes when fetching the size succeed but never when it
 fails. It means that a shard might stay unassigned until
another cluster state update triggers a new allocation
(as in #64372). More sadly, the test I wrote was wrong as
it explicitly triggered a reroute.

This commit changes the InternalSnapshotsInfoService
so that it also triggers a reroute when fetching the snapshot
shard size failed, ensuring that the allocation can move
forward by using an UNAVAILABLE_EXPECTED_SHARD_SIZE
shard size. This unknown shard size is kept around in the
snapshot info service until no corresponding unassigned
shards need the information.

Backport of #65436
2020-12-08 12:10:37 +01:00
Przemko Robakowski eaab5c65e0
Allow more legit cases in Metadata.Builder.validateDataStreams (#65791) (#65938)
This change simplifies logic and allow more legit cases in Metadata.Builder.validateDataStreams.
It will only show conflict on names that are in form of .ds-<data stream name>-<[0-9]+> and will allow any names like .ds-<data stream name>-something-else-<[0-9]+>.
This fixes problem with rollover when you have 2 data streams with names like a and a-b - currently if a-b has generation greater than a you won't be able to rollover a anymore.

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2020-12-07 19:54:46 +01:00
Nhat Nguyen 26d67c1662 Ensure notify when proxy connections disconnect (#65697)
TransportService doesn't respond to the pending requests of proxy
connections when the underlying connections get disconnected because
proxy connections do not override the getCacheKey method. Some CCS
requests would never be completed because of this bug.
2020-12-03 14:53:17 -05:00
Armin Braun 745f527fea
Deduplicate Index Meta Generations when Deserializing (#65619) (#65666)
These strings are quite long individually and will be repeated
potentially up to the number of snapshots in the repository times.
Since these make up more than half of the size of the repository metadata
and are likely the same for all snapshots the savings from deduplicating them
can make up for more than half the size of `RepositoryData` easily in most real-world
cases.
2020-12-01 12:34:35 +01:00
Armin Braun f8f08ba3a7
Fix NPE in ClusterInfoService (#65654) (#65659)
Store stats can be `null` if e.g. the shard was already closed
when the stats where retrieved. Don't record those shards in the
sizes map to fix an NPE in this case.
2020-12-01 10:33:36 +01:00
Armin Braun 6bbeedc932
Reset Deflater/Inflater after Use in DeflateCompressor (#65617) (#65646)
We should reset after use, not before reuse. Otherwise we keep the input buffers
on these objects around for a long time and they can grow to O(MB).
2020-12-01 02:44:36 +01:00
Przemko Robakowski bb0fcb150b Fix TranslogTests.testTotalTests when n=0 (#65632)
When n=0 in TranslogTests.testTotalTests we never update earliestLastModifiedAge so it fails comparison with default value of total.getEarliestLastModifiedAge() which is 0.
In this change we always check this special case and then select n>0

Closes #65629
2020-11-30 18:35:55 -05:00
Howard 0137c1679b Fix the earliest last modified age of translog stats (#64753)
Currently translog's `earliest_last_modified_age` field is always 0 in `_nodes/stats` response.
2020-11-30 17:34:55 -05:00
Alan Woodward fb84b6710d
Restore use of default search and search_quote analyzers (#65491) (#65562)
In the refactoring of TextFieldMapper, we lost the ability to define
a default search or search_quote analyzer in index settings. This
commit restores that ability, and adds some more comprehensive
testing.

Fixes #65434
2020-11-26 18:34:59 +00:00
Ioannis Kakavas f6921af885 Revert "Gracefully handle exceptions from Security Providers (#65464) (#65554)"
This reverts commit 12ba9e3e16. This
commit was mechanically backported to 7.10 while it shouldn't have
been.
2020-11-26 17:11:34 +02:00
Ioannis Kakavas 12ba9e3e16
Gracefully handle exceptions from Security Providers (#65464) (#65554)
In certain situations, such as when configured in FIPS 140 mode,
the Java security provider in use might throw a subclass of
java.lang.Error. We currently do not catch these and as a result
the JVM exits, shutting down elasticsearch.

This commit attempts to address this by catching subclasses of Error
that might be thrown for instance when a PBKDF2 implementation
is used from a Security Provider in FIPS 140 mode, with the password
input being less than 14 bytes (112 bits).

- In our PBKDF2 family of hashers, we catch the Error and
throw an ElasticsearchException while creating or verifying the
hash. We throw on verification instead of simply returning false
on purpose so that the message bubbles up and the cause becomes
obvious (otherwise it would be indistinguishable from a wrong
password).
- In KeyStoreWrapper, we catch the Error in order to wrap and re-throw 
a GeneralSecurityException with a helpful message. This can happen when 
using any of the keystore CLI commands, when the node starts or when we 
attempt to reload secure settings.
- In the `elasticsearch-users` tool, we catch the ElasticsearchException that
the Hasher class re-throws and throw an appropriate UserException.

Tests are missing because it's not trivial to set CI in fips approved mode
right now, and thus any tests would need to be muted. There is a parallel
effort in #64024 to enable that and tests will be added in a followup.
2020-11-26 17:04:34 +02:00
Ioannis Kakavas b4b4483e24
Do not interpret SecurityException in KeystoreAwareCommand (#65366) (#65486)
KeyStoreAwareCommand attempted to deduce whether an error occurred
because of a wrong password by checking the cause of the
SecurityException that KeyStoreWrapper.decrypt() throws. Checking
for AEADBadTagException was wrong becase that exception could be
(and usually is) wrapped in an IOException. Furthermore, since we
are doing the check already in KeyStoreWrapper, we can just return
the message of the SecurityException to the user directly, as we do
in other places.
2020-11-26 13:12:18 +02:00
Jim Ferenczi 88993e763f Fix handling of null values in geo_point (#65307)
A bug was introduced in 7.10 that causes explicit `null` values to be indexed in the _field_names
field. This change fixes this bug for newly ingested data but `null` values ingested with 7.10 will
continue to match `exists` query so a reindex is required.

Fixes #65306
2020-11-24 11:00:37 +01:00
Jim Ferenczi 359b89a19b
Fix cacheability of custom LongValuesSource in TermsSetQueryBuilder (#65367) (#65389)
This change fixes the equals and hashCode methods of the custom FieldValuesSource
that is used internally to extract the value from a doc value field.
Using the field data instance to check equality prevented the query to be cached in
previous versions. Switching to the field name should make the query eligible for
caching again.
2020-11-23 22:21:01 +01:00
Jay Modi 1a13a0b10f
Watcher understands hidden expand wildcard value (#65372)
Watcher has a search template that stores indices options to be used as
part of a search during watch execution, but this was not updated to be
aware of hidden indices and the `hidden` expand_wildcards option. This
change makes use of the `IndicesOptions#toXContent` method in Watcher,
which already handles the new value. Additionally, the XContent parsing
is moved to the IndicesOptions class so that we will be less likely to
miss updating this in the future.

Closes #65148
Backport of #65332
2020-11-23 09:17:49 -07:00
Nik Everett 56605e4d9a Fixup reduceRandom tests (#65263)
In aa1ea96b8698aa12bed1c4e8d704882a2a639791 I made all
`testReduceRandom` tests for aggs mimick production more precisely.
More precisely, they pick the correct "lead" result when performing
partial reduction. This is great, but, sadly, some tests assumed that we
always reduced against the "first" aggregator. This fixes those tests.

Closes #65163
2020-11-20 13:10:34 -05:00
James Rodewig feca22729c
[DOCS] Remove duplicated word in replica shard allocator comment (#65295) (#65317)
Co-authored-by: Howard <danielhuang@tencent.com>
2020-11-20 12:25:52 -05:00
Jay Modi 893e1a5282
Fix date math hidden index resolution (#65278)
This commit updates the IndexAbstractionResolver so that hidden indices
are properly resolved when date math is in use and when we are checking
if the index is visible.

Closes #65157
Backport of #65236
2020-11-19 12:40:14 -07:00
Julie Tibshirani 5495032b00 Remove unused method Analysis#isNoStopwords. 2020-11-17 16:34:33 -08:00
Sylvain Wallez b2475f9ccf
Fix parsing RareTerms aggregation response in RestHighLevelClient (#65144)
Backport of #64454

- Add LongRareTerms and StringRareTerms to the DefaultNamedXContents,
  ensure that the response of RareTerms aggregation can be parsed
  correctly.
- Add testSearchWithRareTermsAgg method to test the response of
  RareTerms aggregation can be parsed correctly.
- Add some test code to ensure the AggregationsTests can execute
  successfully.

Co-authored-by: bellengao <gbl_long@163.com>
2020-11-17 17:43:51 +01:00
Julie Tibshirani 3974c3b066 Move the shared fetch cache to highlighting. (#65105)
The cache is only used by highlighters, so it can be scoped to only the
highlighting context.
2020-11-16 18:54:32 -08:00
Mark Vieira afd12fddaf Remove reference to 7.9.4 relase which won't happen 2020-11-16 10:31:36 -08:00
Przemysław Witek de668ab84b
[7.10] [ML] Extract dependent variable's mapping correctly in case of a multi-field (#63813) (#64287) 2020-11-16 10:34:58 +01:00
Alan Woodward caf143f4a5
Unused boost parameter should not throw mapping exception (#64999) (#65014)
We were correctly dealing with boosts that had an effect, but mappers
that had a silently accepted but ignored boost parameter were throwing
an error instead of continuing to ignore the boost but emitting a
warning.

Fixes #64982
2020-11-12 19:28:32 +00:00
James Rodewig 75b4af5833
[DOCS] Fix plugins service comment typo (#64902) (#64933)
Co-authored-by: Howard <danielhuang@tencent.com>
2020-11-11 10:30:44 -05:00
Daniel Mitterdorfer a6302d2169
Mute RolloverIT#testRolloverWithClosedIndexInAlias (#64925)
Relates #64921
2020-11-11 14:33:48 +01:00
Andrei Dan cd35122e48
Bump versions after 7.10 release (#64856) 2020-11-11 13:08:16 +00:00
Tim Brooks f96dccd1ec
Propogate rejected execution during bulk actions (#64886)
Currently a rejected execution exception can be swallowed when async
actions return during transport bulk actions. This includes scenarios
where we went async to perform ingest pipelines or index creation. This
commit resolves the issue by propagating a rejected exception.
2020-11-10 12:16:40 -07:00
Nhat Nguyen 207e4b00f9 Busily assert in testCreateSearchContextFailure (#64243)
If a background refresh is running, then the refCount assertion will 
fail as Engine#refreshIsNeeded can increase the refCount by 2.

Closes #64052
2020-11-10 11:51:41 -05:00
Armin Braun d173ba6b2d
Fix NPE in toString of FailedShard (#64770) (#64779)
The concatenation took precedence over the null check, leading to an NPE
because `null` was passed to `ExceptionsHelper.stackTrace(failure))`.
2020-11-09 17:02:11 +01:00
David Turner 33f703ef1f Fix up roles after rolling upgrade (#64693)
Node roles vary by version, and new roles are suppressed for BWC. This
means we can receive a join from a node that's already in the cluster
but with a different set of roles: the node didn't change roles, but the
cluster state came via an older master. This commit ensures that we
properly process a join from such a node to ensure that the roles are
correct.

Closes #62840
2020-11-06 12:33:09 +00:00
Armin Braun 51e9d6f227
Revert Serializing Outbound Transport Messages on IO Threads (#64632) (#64654)
Serializing outbound transport message on the IO loop was introduced in https://github.com/elastic/elasticsearch/pull/56961. Unfortunately it turns out that this is incompatible with assumptions made by CCR code here: f22ddf822e/x-pack/plugin/ccr/src/main/java/org/elasticsearch/xpack/ccr/action/repositories/GetCcrRestoreFileChunkAction.java (L60-L61) and that are not easy to work around on short notice.

Raising reverting this move (as a temporary solution, it's still a valuable change long-term) as a blocker therefore as this seriously affects the stability of the initial phase of the CCR following by causing corrupted bytes to be send to the follower.
2020-11-05 16:29:12 +01:00
Jim Ferenczi 9e4105ec37 Validate PIT on _msearch (#63167)
This change ensures that we validate point in times provided by individual search
requests in _msearch.

Relates #63132
2020-11-05 15:38:28 +01:00
Jim Ferenczi 3e2fa09666 Fix merging of terms aggregation with compound order (#64469)
This change fixes a bug introduced in #61779 that uses a compound order to
compare buckets when merging. The bug is triggered when the compound order
uses a primary sort ordered by key (asc or desc).
This commit ensures that we always extract the primary sort when comparing keys
during merging.
The PR is marked as no-issue since the bug has not been released in any official version.
2020-11-05 12:05:19 +01:00
markharwood 1fb6206fbc
SignificantText aggregation had include/exclude logic back to front (#64520) (#64538)
Backport bugfix. SignificantText aggregation had include/exclude logic back to front.
Added test.

Closes #64519
2020-11-03 16:43:03 +00:00
Ignacio Vera 4851bc7bae
Upgrade to Lucene-8.7.0 (#64532) (#64537) 2020-11-03 16:57:04 +01:00
Ignacio Vera 156c931745
LinearCounting recompute size tripping assertion (#64465) (#64531)
Guard recomputeSize method from out of bounds exception
2020-11-03 15:52:48 +01:00
James Rodewig 4a64134718
[DOCS] Fix typo in IndexService.java (#64034) (#64447)
Co-authored-by: mushaoqiong <mushaoqiong@126.com>
2020-11-02 08:16:29 -05:00
Armin Braun dad3b26560
Fix Typo in Repository Exception Message (#64412) (#64434)
Missing space fixed.
2020-10-30 21:10:17 +01:00
Jason Tedor fedaa3be05
Remove mute from testDiscoveryNodeRoleWithOldVersion
This commit removes a mute on
DiscoveryNodeTest#testDiscoveryNodeRoleWithOldVersion after a fix was
pushed in 6b119a43c1.

Relates #64385
2020-10-29 22:37:38 -04:00
Jason Tedor 6b119a43c1
Fix version in testDiscoveryNodeRoleWithOldVersion
This commits fixes the version when reading from the stream in
DiscoveryNodeTests#testDiscoveryNodeRoleWithOldVersion.

Closes #64385
2020-10-29 22:36:14 -04:00
Yang Wang 533b929e6c [Test] Mute DiscoveryNodeTests.testDiscoveryNodeRoleWithOldVersion
The issue is tracked at
https://github.com/elastic/elasticsearch/issues/64385
2020-10-30 13:28:52 +11:00
Jason Tedor 1126ba4df8
Serialize can contain data with roles (#64324)
This commit internalizes whether or not a role represents the ability to
contain data. In the future, this will let us remove the compatibility
role notion.
2020-10-29 20:44:39 -04:00
Jason Tedor 827dd39a12
Filter node.roles setting in transport client (#64276)
This commit filters out the node.roles setting from the transport
client, since the transport client does not take on these roles.
2020-10-28 16:24:14 -04:00
Jason Tedor 5d42c2b06e
Deprecate the no-jdk distributions (#64275)
This commit adds logging to indicate that the no-jdk distributions are
deprecated and will be removed in a future release.
2020-10-28 10:35:23 -04:00
Nik Everett 0c47d49784
Make sure non-collecting aggs include sub-aggs (backport of #64214) (#64247)
Now that we're consistently using `cat_match` to filter which shards we
run on we can get this confusing case:
1. You have a search with, say, a range and a sub-agg.
2. That search has a query that `can_match` can recognize will match no
   docs. On *any* shard.
3. So we dutifully run it on a single shard so it can produce the
   "empty" aggs.
4. The shard we pick happens to not have the target of the range mapped.
5. This kicks in the special range aggregator that doesn't collect any
   documents.
6. Before this commit, that range aggregator *also* never produced any
   sub-aggs.

So, without this change, it was quite possible for a search that
happened to match no documents to "throw away" the sub-aggs of a range
and a few other aggs.

We've had this problem for a long, long time but it is more confusing
now because `can_match` is really kicking in and causing us to see cases
where it looks like you are targeting a lot of shards but you really are
only targeting a couple. It used to be that to get the "no sub-aggs"
behavior you had to explicitly target only shards that didn't map the
target field of the `range` agg. And, like, in that case it isn't too
bad because you targeted a sort of degenerate shard. But now that
`can_match` is doing its thing you can end up with the confusing steps
above. It took me several hours to track down what what happening I know
how the individual pieces of all of this works. It took four hours to
figure out how they fit together in this case....

Anyway! This replaces all the aggregator implementations that throw out
the sub-aggregators with ones that keep them. I think this'll be less
confusing in the future.

Closes #64142
2020-10-28 08:38:05 -04:00
Jason Tedor 78c741ab32
Log whether or not we are using the bundled JDK (#64255)
This commit adds logging to indicate whether or not we are using the
bundled JDK. We distinguish between using a distribution that bundles
the JDK versus using a distribution that does not bundle the JDK.
2020-10-28 07:10:47 -04:00
Armin Braun 2983584ef6
Fix #invariant Assertion in CacheFile (#64180) (#64264)
Fix #invariant Assertion in CacheFile

closes #64141
2020-10-28 10:22:47 +01:00
Armin Braun a697d5edae
Don't Generate an Index Setting History UUID unless it's Supported (#64164) (#64213)
In 7.x we can't just by default generate this setting as it might not be
supported by data nodes that are assigned shards for an older version in mixed version
clusters.

Closes #64152
2020-10-28 09:03:09 +01:00
Jason Tedor dfc8ae48cc
Fix using bundled JDK detection on macOS (#64236)
This commit fixes an issue with the detection on macOS for whether or
not the bundled JDK is being used. The logic between macOS and non-macOS
is different because the JDK has a different directory structure on
macOS versus non-macOS. However, due to notarization issues, we changed
the top-level directory from jdk to jdk.app, yet never updated this
detection logic to account for that.

Ideally, we would have a packaging test that asserts that we have the
behavior here correct, and it maintains over time. Alas, we do not
currently have packaging tests on macOS.
2020-10-27 16:47:02 -04:00
Nhat Nguyen 566d1fd459 Return the same point in time in search response (#64188)
With this change, we will always return the same point in time in a
search response as its input until we implement the retry mechanism
for the point in times.
2020-10-27 10:17:44 -04:00
Jim Ferenczi e34014eb6a Fix sorted query when date_nanos is used as the numeric_type (#64183)
The formatting of the global bottom value does not take the resolution of the provided
numeric_type into account. This change fixes this bug by providing the resolution
directly in the doc value format if the numeric_type is provided as `date_nanos`.

Closes #63719
2020-10-27 11:00:23 +01:00
Armin Braun e02561476e
Fix Broken Clone Snapshot CS Update (#64116) (#64159)
We must not remove the snapshot from the initializing set
in the `timeout` getter. This was a plain oversight/mistake
and went unnoticed. It can lead to the removal of a valid
snapshot clone from the cluster state in rare circumstances
(e.g. when a node concurrently joins the cluster or a routing
change happens as it did in the linked test failure).

Closes #64115
2020-10-26 14:32:42 +01:00
Armin Braun 96407268a0
Fix Background Merge Breaking Snapshot Restore Test (#63579) (#64129)
If we run into a background merge between creating the snapshot and closing the index
then with compound files we could be in a situation where we get zero file reuse
on restore.
Force merging before the snapshot gives us a single segment that won't change down the line
so the restore always sees file reuse from the close index.

Closes #63476
2020-10-26 09:34:43 +01:00
Armin Braun bdea16301d
Fix testMasterFailoverDuringCloneStep1 (#63580) (#64127)
Assuming the clone failed when the request failed is not sufficient.
There are failure modes where the request fails but the clone still works out
because the data node resent the requeest after the first clone had already been
failed and removed from the cluster state when master was restarted.

Closes #63473
2020-10-26 09:30:09 +01:00
Marios Trivyzas 9b8ea63cd2
[7.10] Bump version after 7.9.3 release (#63818) 2020-10-22 17:49:21 +02:00
Przemyslaw Gomulka bab426be2c
[7.10] add 6.8.14 version (#63824)
adding 6.8.14 after version 6.8.13 release
2020-10-22 16:51:01 +02:00
Armin Braun e0f73c96f7
Fix testStartCloneWithSuccessfulShardSnapshotPendingFinalization (#63966) (#64000)
We have to wait for no more operations here not for `1`. This mostly worked
because the test thread would add the listener quickly enough so that it sees the
state where either the snapshot or clone but not both have already finished
but randomly the test thread would be slow and time out on a state without snaphots in it.
2020-10-21 15:33:12 +02:00
markharwood b933bd9f45
Search - make term/prefix/wildcard/regex query parsing more lenient (#63926)
Remove errors when case_insensitive flag set to false

Closes #63893
2020-10-21 13:33:19 +01:00
Henning Andersen ddd897f747 Fix test timeout for health on master failover (#63455)
testHealthOnMasterFailover could timeout on some of the health requests
in the case where an index is added, since the recovery leads to
extended test run time.

Closes #62690
2020-10-21 14:31:53 +02:00
Nik Everett 8d30766a7d
Fix scripted metric BWC serialization (backport of #63821) (#63897)
We had and an error when serializing fully reduced scripted metrics.
Small typo and sever lack of tests..... Anyway, this fixed the one
character typo and adds a bunch more tests.
2020-10-20 13:15:26 -04:00
Ignacio Vera d0f5066310
Upgrade to lucene-8.7.0-snapshot-72d8528c3a6 (#63912) (#63928) (#63933) 2020-10-20 15:08:06 +02:00
Tanguy Leroux b2e07076a0
Add snapshot shard size based test in DiskThresholdDeciderTests (#63913)
This commit adds a test in DiskThresholdDeciderTests that verifies
 the allocation of a snapshot recovery source based shard in the 
situation where the snapshot shard size was successfully provided 
by the SnapshotInfoService introduced in #61906 and when the 
service failed to provide the size.

Relates #61906
2020-10-20 14:59:00 +02:00
Jim Ferenczi 3423f214dd Composite aggregation must check live docs when the index is sorted (#63864)
This change ensures that the live docs are checked in the composite aggregator
when the index is sorted.
2020-10-20 11:40:28 +02:00
Armin Braun 1880bcdc09
Add REST Test for Snapshot Clone API (#63863) (#63881)
Adds snapshot clone REST tests and HLRC support for the API.
2020-10-20 09:48:03 +02:00
Nik Everett 5583db5a73
Fix broken parent and child aggregator (backport #63811) (#63892)
In #57892 I broke *some* sub-aggregations inside of the `parent` and
`child` aggregator, specifically any sub-aggregations that do work in
the `postCollect` phase. This fixes it by delaying the post collect
phase of aggs under `parent` and `child` until `beforeBuildingBuckets`
because, well, we haven't done *any* collection until after that phase.
2020-10-19 13:05:22 -04:00
Mayya Sharipova c0c1a7a9a6 Apply boost only once for distance_feature query (#63767)
Currently if distance_feature query contains boost,
it incorrectly  gets applied twice: in AbstractQueryBuilder::toQuery and
we also pass this boost to Lucene's LongPoint.newDistanceFeatureQuery.
As a result we get incorrect scores.

This fixes this error to ensure that boost is applied only once.

Closes #63691
2020-10-16 10:02:55 -04:00
Ioannis Kakavas 364511395d
[7.10] Move RestRequestFilter to core (#63507)
Move RestRequestFilter to core so that Rest requests outside xpack can use 
it to filter fields and expand its usage.

Backport of #63507
2020-10-16 13:57:52 +03:00
Tanguy Leroux 7ea44d20c3
Try to fix DiskThresholdDeciderIT (#63614) (#63721)
This is another attempt to fix #62326 as my previous 
attempts failed (#63112, #63385).
2020-10-16 09:20:54 +02:00
Jay Modi 822fea9889
Fix threadpool setting test for system_write (#63706)
This commit fixes the UpdateThreadPoolSettingsTests to be aware of the
hard limit on the maximum size of the system_write executor. This
executor has a hard limit that matches the write executor, which is
the number of allocated processors.

Closes #63131
Backport #63700
2020-10-14 14:57:43 -06:00
James Rodewig ac2b668016
[DOCS] Fix AbstractDiffable typo (#59034) (#63668)
Co-authored-by: Howard <danielhuang@tencent.com>
2020-10-14 09:56:56 -04:00
Armin Braun 424b313784
Adapt Shard Generation Assertion for 7.x (#63625) (#63642)
In 7.x we can have `null` generations so we need to adjust the `assert`
accordingly.
See e.g. failure https://gradle-enterprise.elastic.co/s/dgypleytdotfu/tests/:server:internalClusterTest/org.elasticsearch.snapshots.ConcurrentSnapshotsIT/testConcurrentSnapshotWorksWithOldVersionRepo
2020-10-14 06:57:25 +02:00
Nhat Nguyen 9015b50e1b
Check docs limit before indexing on primary (#63273)
Today indexing to a shard with 2147483519 documents will fail that
shard. We should check the number of documents and reject the write
requests instead.

Closes #51136
2020-10-13 17:39:08 -04:00
Lee Hinman 7371e51583
[7.10] Add DiscoveryNodeRole compatibility role for bwc tier serialization (#63581) (#63613)
Backports the following commits to 7.10:

    Add DiscoveryNodeRole compatibility role for bwc tier serialization (#63581)
2020-10-13 09:17:15 -06:00
Armin Braun f70391c6cc
Fix Broken Snapshot State Machine in Corner Case (#63534) (#63608)
This fixes a gap in testing and a bug that can occur in various forms:
When we would start a snapshot or clone related to a shard that was done
snapshotting/cloning but its overall operation was not yet finalized
at the time of starting the operation, we would base the operation off of
the wrong generation. This would not cause a corrupted repo, but would
cause the operation to be `PARTIAL`.
This commit fixes the state machine to take into account the correct generation
in this case.

Closes #63498
2020-10-13 16:05:34 +02:00
James Rodewig 845ccc2264
[DOCS] Fix dup word in ShardRouting hashcode method. (#63452) (#63583)
Co-authored-by: Howard <danielhuang@tencent.com>
2020-10-13 09:05:19 -04:00
Tanguy Leroux 8499924e51
InternalSnapshotsInfoService should also removed failed snapshot shard size infos (#63492) (#63592)
Relates #61906
2020-10-13 10:42:38 +02:00
Julie Tibshirani 9e52513c7b
Add support for missing value fetchers. (#63585)
This PR implements value fetching for the following field types:
* `text` phrase and prefix subfields
* `search_as_you_type`, plus its subfields
* `token_count`, which is implemented by fetching doc values

Supporting these types helps ensure that retrieving all fields through
`"fields": ["*"]` doesn't fail because of unsupported value fetchers.
2020-10-12 17:34:21 -07:00
Tim Brooks 56092b1a9f
Flush translog writer before adding new operation (#63505)
Currently we flush the Translog buffer when a new operation causes the
buffer to breach 1MB. This introduces a scenario where an exception is
thrown AFTER the writer has accepted the operation. To avoid this, this
commit flushes the Translog in an #add call before adding a new
operation.

This fixes #63299.
2020-10-09 10:02:55 -06:00
Julie Tibshirani ae2fc4118d Add factory methods for common value fetchers. (#63438)
This PR adds factory methods for the most common implementations:
* `SourceValueFetcher.identity` to pass through the source value untouched.
* `SourceValueFetcher.toString` to simply convert the source value to a string.
2020-10-08 12:14:53 -07:00
Julie Tibshirani c6b915c8e6 Make TextFieldMapper.FAST_PHRASE_SUFFIX private. 2020-10-08 11:45:53 -07:00
Tanguy Leroux 943fcaf970
Simplify reroute counting in InternalSnapshotsInfoServiceTests (#63416) (#63491)
Closes #63352
2020-10-08 18:20:07 +02:00
Dan Hermann 85886e71c2
Handle error conditions when simulating ingest pipelines with verbosity enabled (#63327) (#63484) 2020-10-08 09:21:05 -05:00
Przemyslaw Gomulka d7391bc040
[7.10] Fix incorrect use of Format.equals instead of matches backport#63462 #63463
closes #63459
backports #63462
2020-10-08 15:35:13 +02:00
Christoph Büscher 517d3e4336 Mute DiskThresholdDeciderIT.testHighWatermarkNotExceeded 2020-10-08 15:14:50 +02:00
Mayya Sharipova e022b78198
Upgrade to lucene-8.7.0-snapshot-5c4168d (#63466)
This disables sort optim on _doc, which may still be unstable.
Backport for #63444
2020-10-08 08:20:43 -04:00
Christoph Büscher 564823b00f Muting parts of JavaJodaTimeDuellingTests 2020-10-08 11:50:47 +02:00