Commit Graph

9190 Commits

Author SHA1 Message Date
Jason Tedor 144e1698cf Do not pass executor shutdown to super constructor
The main constructor for rejected execution exception its executor
shutdown constructor parameter to the super constructor where it would
be used as a formatting parameter. This is a mistake so this commit
fixes this issue.
2017-12-05 07:11:14 -05:00
Jason Tedor eb574425b7
Simplify rejected execution exception
This exception type has several unnecessary constructor overrides so
this commit removes them.

Relates #27664
2017-12-05 06:58:34 -05:00
Martijn van Groningen b447967104
removed redundant import 2017-12-05 11:01:25 +01:00
Martijn van Groningen 4d78e1a9ad
Added msearch api to high level client 2017-12-05 10:17:47 +01:00
Boaz Leskes c203cff692 fix java9 compilation 2017-12-05 09:28:56 +01:00
Jim Ferenczi 8635f68ece Fix term vectors generator with keyword and normalizer (bis)
Fallback on the index analyzer if the normalizer is null.

Closes #27320
2017-12-05 01:33:14 +01:00
Jason Tedor 963ed25cf5
Only fsync global checkpoint if needed
In the global checkpoint sync action, we fsync the translog. However,
the last synced global checkpoint might already be equal to the current
global checkpoint in which case the fsyncing the translog is unnecessary
as either the sync needed guard in the translog will skip the translog,
or the translog needs an fsync for another reason that will be picked up
elsewhere (e.g., at the end of a bulk request).

Relates #27652
2017-12-04 18:10:04 -05:00
Jason Tedor 72800bb90b
Fix Lucene version for 6.2.0 constant in master
This commit fixes the Lucene version constant in master for the 6.2.0
version.

Relates #27658
2017-12-04 16:38:45 -05:00
Nhat Nguyen 4b558636f0
TEST: Rewrite GeoPointParsingTests#testEqualsHashCodeContract (#27634)
The hashCode contract states that equal objects must have equal hash
codes, however the unequal objects are not required to have unequal
hashCodes.

This commit rewrites GeoPointParsingTests#testEqualsHashCodeContract
using#checkEqualsAndHashCode helper.

Closes #27633
2017-12-04 16:34:34 -05:00
Jim Ferenczi e0b1a6544d
Fix term vectors generator with keyword and normalizer (#27608)
This change applies the normalizer defined on the field when building term vectors dynamically on a keyword field.

Fixes #27320
2017-12-04 21:32:16 +01:00
Jim Ferenczi da50fa4540
Fix highlighting on a keyword field that defines a normalizer (#27604)
* Fix highlighting on a keyword field that defines a normalizer

The `plain` and sometimes the `unified` highlighters need to re-analyze the content to highlight a field
This change makes sure that we don't ignore the normalizer defined on the keyword field for this analysis.
2017-12-04 21:04:14 +01:00
Jason Tedor 17a2d574de
Obey translog durability in global checkpoint sync
After write operations in some situations we fire a post-operation
global checkpoint sync. The global checkpoint sync unconditionally
fsyncs the translog and this can then look like an fsync
per-request. This violates the translog durability settings on the index
if this durability is set to async. This commit changes the global
checkpoint sync to observe the translog durability.

Relates #27641
2017-12-04 12:14:25 -05:00
Simon Willnauer 84ec472428
Include internal refreshes in refresh stats (#27615)
Today we exclude internal refreshes in the refresh stats. Yet, it's very much
confusing to not take these into account. This change includes internal refreshes
into the stats until we have a dedicated stats for this.
2017-12-04 16:33:47 +01:00
Nhat Nguyen e213fa033d
Tighten the CountedBitSet class
This commit addresses the missed comments from https://github.com/elastic/elasticsearch/pull/27547.
2017-12-04 09:51:34 -05:00
Boaz Leskes 2900e3f345 adapt testWaitForPendingSeqNo to stricter operation recovery range
Before we use to ship anything in the translog above a certain point. #27580 changed to have a strict upper bound.
2017-12-04 13:18:42 +01:00
Boaz Leskes 1a976ea7a4 Cherry pick tests and seqNo recovery hardning from #27580 2017-12-04 13:15:40 +01:00
Catalin Ursachi b44ae25c27 Updated "string" datatype in docs & tests to "text" (#27629) 2017-12-04 11:51:00 +01:00
Adrien Grand 6323bb0d97
Upgrade to lucene-7.2.0-snapshot-8c94404. (#27619)
This new snapshot mostly brings a change to TopFieldCollector which can now
early terminate collection when trackTotalHits is `false`.

As a follow-up, we should replace our usage of
`EarlyTerminatingSortingCollector` with this new option.
2017-12-04 09:40:08 +01:00
Nhat Nguyen 49df50f662
Simplify MultiSnapshot#SeqNoset (#27547)
Today, we maintain two sets in a SeqNoSet: ongoing sets and completed
sets. We can remove the completed sets and use only the ongoing sets by
releasing the internal bitset of a CountedBitSet when all its bits are
set. This behaves like two sets but simpler. This commit also makes
CountedBitSet as a drop-in replacement for BitSet.

Relates #27268
2017-12-03 15:20:57 -05:00
Lee Hinman 623d3700f0
Add accounting circuit breaker and track segment memory usage (#27116)
* Add accounting circuit breaker and track segment memory usage

This commit adds a new circuit breaker "accounting" that is used for tracking
the memory usage of non-request-tied memory users. It also adds tracking for the
amount of Lucene segment memory used by a shard as a user of the new circuit
breaker.

The Lucene segment memory is updated when the shard refreshes, and removed when
the shard relocates away from a node or is deleted. It should also be noted that
all tracking for segment memory uses `addWithoutBreaking` so as not to fail the
shard if a limit is reached.

The `accounting` breaker has a default limit of 100% and will contribute to the
parent breaker limit.

Resolves #27044
2017-12-01 07:59:45 -07:00
David Turner 5060007d20
Fix sporadic failures in testCorruptedShards (#27613)
Add assertBusy() to retry in case the shards are not yet all failed, and remove `@AwaitsFix`.

Resolves #12416.
2017-12-01 13:33:23 +00:00
Luca Cavanna 3e8ca38fca
Deprecate the transport client in favour of the high-level REST client (#27085) 2017-12-01 12:24:16 +01:00
David Turner 1e6bd99248 Reinstate AwaitsFix 2017-11-30 21:09:01 +00:00
Simon Willnauer 67cd1e9c5f
Reset LiveVersionMap on sync commit (#27534)
Today we carry on the size of the live version map to ensure that
we minimze rehashing. Yet, once we are idle or we can issue a sync-commit
we can resize it to defaults to free up memory.

Relates to #27516
2017-11-30 20:44:05 +01:00
Simon Willnauer b116221540
Ensure shard is refreshed once it's inactive (#27559)
Once a shard goes inactive we want the shard to be refreshed if
the refresh interval is default since we might hold on to unnecessary
segments and in the inactive case we stopped indexing and can release
old segments.

Relates to #27500
2017-11-30 19:04:05 +01:00
Mayya Sharipova c6b73239ae
Limit the number of tokens produced by _analyze (#27529)
Add an index level setting `index.analyze.max_token_count` to control
the number of generated tokens in the  _analyze endpoint.
Defaults to 10000.

Throw an error if the number of generated tokens exceeds this limit.

Closes #27038
2017-11-30 11:54:39 -05:00
David Turner 92a24de509 Add more logging to testCorruptedShards to help investigate sporadic failures 2017-11-30 16:34:23 +00:00
David Turner 1f89e9d94e Reinstate AwaitsFix
This reverts commit 29c5540323.
2017-11-30 13:01:22 +00:00
olcbean d25c9671de Deprecate `jarowinkler` in favor of `jaro_winkler` (#27526)
Jaro and Winkler are two people, so we should use the same naming convention as for Damerau–Levenshtein.
2017-11-30 12:49:34 +00:00
Tanguy Leroux 41f73e0acf Fix version for include_global_state in Snapshot Status API
It also adds a Rest test.

Related #26853
2017-11-30 11:33:01 +01:00
kel efac982e35 Include include_global_state in Snapshot status API (#26853)
This commit adds a field include_global_state to snapshot status api response. For legacy snapshot, the field is not present.

Closes #22423
2017-11-30 10:38:07 +01:00
Tanguy Leroux 192d1f03f8
Do not swallow exception in ChecksumBlobStoreFormat.writeAtomic() (#27597)
The ChecksumBlobStoreFormat.writeAtomic() method writes a blob using a
temporary name and then moves the blob to its final name. The move
operation can fail and in this case the temporary blob is deleted. If
this delete operation also fails, then the initial exception is lost.

This commit ensures that when something goes wrong during the move
operation the initial exception is kept and thrown, and if the delete
operation also fails then this additional exception is added
as a suppressed exception to the initial one.
2017-11-30 10:09:49 +01:00
Jason Tedor 55cb8ddd80
Do not set data paths on no local storage required
Today when configuring the data paths for the environment, we set data
paths to either the specified path.data or default to data relative to
the Elasticsearch home. Yet if node.local_storage is false, data paths
do not even make sense. In this case, we should reject if path.data is
set, and instead of defaulting data paths to data relative to home, we
should set this to empty paths. This commit does this.

Relates #27587
2017-11-29 17:35:00 -05:00
David Turner 29c5540323 Remove AwaitsFix 2017-11-29 18:12:18 +00:00
Tanguy Leroux 547f006118
Remove XContentType auto detection in BlobStoreRepository (#27480) 2017-11-29 09:39:49 +01:00
Simon Willnauer 4aa840698f
Ensure threadcontext is preserved when refresh listeners are invoked (#27565)
today a refresh listener won't preserve the entire context ie. won't carry
on response headers etc. from the caller side. This change adds support for
stored contexts.
2017-11-28 21:32:16 +01:00
Simon Willnauer 184b7f06ee
Make Segment statistics aware of segments hold by internal readers (#27558)
Today we only expose the external readers segments. Yet, from a statistics
perspective both internal and external segments are relevant. This commit
exposes the additional segments of the internal and external reader respectively.
2017-11-28 17:37:03 +01:00
Jason Tedor cefb46d0fc
Throw UOE from compressible bytes stream reset
A compressible bytes output stream is a stream output which supports a
reset method. However, compressible bytes output streams are unusual in
that the current implementation sometimes supports a reset (if the
stream is not compressed) and sometimes does not support a rest (if the
stream is compressed). This inconsistent behavior is puzzling and
instead we should simply always throw an unsupported operation
exception.

Relates #27564
2017-11-28 11:29:47 -05:00
Jim Ferenczi 37653c9dca [TEST] AggregationsIntegrationIT#testScroll can timeout
This change sets the scroll timeout for this test to 1m instead of 500ms in order
to avoid loosing the scroll on slow machines.

Relates #26378
2017-11-28 16:18:54 +01:00
Adrien Grand d01fcee645
Fix illegal cast of the "low cardinality" optimization of the `terms` aggregation. (#27543)
The GlobalOrdinalsStringTermsAggregator.LowCardinality aggregator casts global
values to `GlobalOrdinalMapping`, even though the implementation of global
values is different when a `missing` value is configured.

This commit adds a new API that gives access to the ordinal remapping in order
to fix this problem.
2017-11-28 14:55:09 +01:00
Adrien Grand 996990ad1f
Upgrade to lucene-7.2.0-snapshot-8c94404. (#27496)
The main highlight of this new snapshot is that it introduces the opportunity
for queries to opt out of caching. In case a query opts out of caching, not only
will it never be cached, but also no compound query that wraps it will be
cached.
2017-11-28 14:52:42 +01:00
Martijn van Groningen cb1204774b
Include the _index, _type and _id to nested search hits in the top_hits and inner_hits response.
Also include _type and _id for parent/child hits inside inner hits.

In the case of top_hits aggregation the nested search hits are
directly returned and are not grouped by a root or parent document, so
it is important to include the _id and _index attributes in order to know
to what documents these nested search hits belong to.

Closes #27053
2017-11-28 14:05:29 +01:00
Nhat Nguyen 000f62c1d2
TEST: makes sure to corrupt referenced tlog files (#27546)
Method TruncateTranslogIT#corruptTranslogFiles corrupts some random
existing *.tlog files in a translog directory. However, this may not
actually corrupt translog at all if it corrupts only tlog files which
are not referenced by the Checkpoint (eg. their translog generations are
smaller the Checkpoint).

This commit makes sure that we corrupt some tlog files which are
referenced by the Checkpoint.

Closes #27538
2017-11-27 20:18:58 -05:00
Simon Willnauer 0eb87e5d57 [TEST] Fix broken test that still tried to acquire the shards to set it non-idle 2017-11-27 22:52:34 +01:00
Jason Tedor d8c28044da
Forbid granting the all permission in production
Running with the all permission java.security.AllPermission granted is
equivalent to disabling the security manager. This commit adds a
bootstrap check that forbids running with this permission granted.

Relates #27548
2017-11-27 16:05:27 -05:00
Jason Tedor 379d51fcfa
Bubble exceptions when closing compressible streams
Compressible bytes output stream swallows exceptions that occur when
closing. This commit changes this behavior so that such exceptions
bubble up.

Relates #27542
2017-11-27 13:48:04 -05:00
Simon Willnauer f23ed6188d
Skip shard refreshes if shard is `search idle` (#27500)
Today we refresh automatically in the background by default very second.
This default behavior has a significant impact on indexing performance
if the refreshes are not needed.
This change introduces a notion of a shard being `search idle` which a
shard transitions to after (default) `30s` without any access to an
external searcher. Once a shard is search idle all scheduled refreshes
will be skipped unless there are any refresh listeners registered.
If a search happens on a `serach idle` shard the search request _park_
on a refresh listener and will be executed once the next scheduled refresh
occurs. This will also turn the shard into the `non-idle` state immediately.

This behavior is only applied if there is no explicit refresh interval set.
2017-11-27 18:16:10 +01:00
Martijn van Groningen 3f98b85489
inner_hits: Return an empty _source for nested inner hit when filtering on a field that doesn't exist.
Before this change the search request would fail with an error indicating that it couldn't detect xcontent type based on the string: `null`
2017-11-27 10:51:24 +01:00
Nhat Nguyen a4b4e14186
Dedup translog operations by reading in reverse (#27268)
Currently, translog operations are read and processed one by one. This
may be a problem as stale operations in translogs may suddenly reappear
in recoveries. To make sure that stale operations won't be processed, we
read the translog files in a reverse order (eg. from the most recent
file to the oldest file) and only process an operation if its sequence
number was not seen before.

Relates to #10708
2017-11-26 16:44:30 -05:00
Jason Tedor 0519fa223c
Ensure logging is configured for CLI commands
Any CLI commands that depend on core Elasticsearch might touch classes
(directly or indirectly) that depends on logging. If they do this and
logging is not configured, Log4j will dump status error messages to the
console. As such, we need to ensure that any such CLI command configures
logging (with a trivial configuration that dumps log messages to the
console). Previously we did this in the base CLI command but with the
refactoring of this class out of core Elasticsearch, we no longer
configure logging there (since we did not want this class to depend on
settings and logging). However, this meant for some CLI commands (like
the plugin CLI) we were no longer configuring logging. This commit adds
base classes between the low-level command and multi-command classes
that ensure that logging is configured. Any CLI command that depends on
core Elasticsearch should use this infrastructure to ensure logging is
configured. There is one exception to this: Elasticsearch itself because
it takes reponsibility into its own hands for configuring logging from
Elasticsearch settings and log4j2.properties. We preserve this special
status.

Relates #27523
2017-11-25 11:40:08 -05:00
Simon Willnauer a29dc20c26
Ensure `doc_stats` are changing even if refresh is disabled (#27505)
Today if refresh is disabled the doc stats are not updated anymore.
In a bulk index scenario this might cause confusion since even if
we refresh internal readers etc. doc stats are never advancing.
This change cuts over to the internal reader that is refreshed outside
of the external readers refresh interval but always equally `fresh` or
`fresher` which will cause less confusion.
2017-11-25 14:24:16 +01:00
Jason Tedor 0b6448726c
Fix classes that can exit
In a previous change, we locked down the classes that can exit by
specifying explicit classes rather than packages than can exit. Alas,
there was a bug in the sense that the class that we exit from in the
case of an uncaught exception is not
ElasticsearchUncaughtExceptionHandler but rather an anonymous nested
class of ElasticsearchUncaughtExceptionHandler. To address this, we
replace this anonymous class with a bonafide nested class
ElasticsearchUncaughtExceptionHandler$PrivilegedHaltAction. Note that if
we try to get this class name we have a $ in the middle of the string
which is a special regular expression character; as such, we have to
escape it.

Relates #27518
2017-11-24 19:00:18 -05:00
Nhat Nguyen e0e1a92d36 Revert "Adjust CombinedDeletionPolicy for multiple commits (#27456)"
The commit looks harmless, unfortunately it can break the engine flush
scheduler and the translog rolling. Both `uncommittedOperations` and
`uncommittedSizeInBytes` are currently calculated based on the minimum
required generation for recovery rather than the translog generation of
the last index commit. This is not correct if other index commits are
reserved for snapshotting even though we are keeping the last index
commit only.

This reverts commit e95d18ec23.
2017-11-24 15:19:50 -05:00
Nhat Nguyen 06d35f4f01 Backport wait_for_initialiazing_shards to cluster health API
Relates #27489
2017-11-24 09:56:16 -05:00
Simon Willnauer 17e9940fc1
Carry over version map size to prevent excessive resizing (#27516)
Today we create a new concurrent hash map everytime we refresh
the internal reader. Under defaults this isn't much of a deal but
once the refresh interval is set to `-1` these maps grow quite large
and it can have a significant impact on indexing throughput. Under low
memory situations this can cause up to 2x slowdown. This change carries
over the map size as the initial capacity wich will be auto-adjusted once
indexing stops.

Closes #20498
2017-11-24 14:57:31 +01:00
Jim Ferenczi c6724abe74
Fix scroll query with a sort that is a prefix of the index sort (#27498)
During a scroll, if the search sort matches the index sort we use the sort values of the last doc returned by
the previous scroll to optimize the main query with a `SearchAfterSortedDocQuery`.
This query can "jump" directly to the first document that sorts after the provided sort values.
This optim is also applied if the search sort is a prefix of the index sort but this case throws an exception
because we use the index sort (instead of the search sort) to validate the sort values of the last document.
This change fixes this bug and adds a test for it.
2017-11-24 13:44:47 +01:00
Tanguy Leroux 5dc5580eac
Delete shard store files before restoring a snapshot (#27476)
Pull request #20220 added a change where the store files
that have the same name but are different from the ones in the
snapshot are deleted first before the snapshot is restored.
This logic was based on the `Store.RecoveryDiff.different`
set of files which works by computing a diff between an
existing store and a snapshot.

This works well when the files on the filesystem form valid
shard store, ie there's a `segments` file and store files
are not corrupted. Otherwise, the existing store's snapshot
metadata cannot be read (using Store#snapshotStoreMetadata())
and an exception is thrown
(CorruptIndexException, IndexFormatTooOldException etc) which
is later caught as the begining of the restore process
(see RestoreContext#restore()) and is translated into
an empty store metadata (Store.MetadataSnapshot.EMPTY).

This will make the deletion of different files introduced
in #20220 useless as the set of files will always be empty
even when store files exist on the filesystem. And if some
files are present within the store directory, then restoring
a snapshot with files with same names will fail with a
FileAlreadyExistException.

This is part of the #26865 issue.

There are various cases were some files could exist in the
 store directory before a snapshot is restored. One that
Igor identified is a restore attempt that failed on a node
and only first files were restored, then the shard is allocated
again to the same node and the restore starts again (but fails
 because of existing files). Another one is when some files
of a closed index are corrupted / deleted and the index is
restored.

This commit adds a test that uses the infrastructure provided
by IndexShardTestCase in order to test that restoring a shard
succeed even when files with same names exist on filesystem.

Related to #26865
2017-11-24 13:15:34 +01:00
kel 4885acb048 Replace `delimited_payload_filter` by `delimited_payload` (#26625)
The `delimited_payload_filter` is renamed to `delimited_payload`, the old name is 
deprecated and should be replaced by `delimited_payload`.

Closes #21978
2017-11-24 13:03:19 +01:00
Alexander Kazakov 43a91f4184 Fix merging of _meta field (#27352) 2017-11-24 09:44:39 +01:00
Nhat Nguyen 46b508d6c9
Add wait_for_no_initializing_shards to cluster health API (#27489)
This adds a new option to the cluster health request allowing to wait
until there is no initializing shards.

Closes #25623
2017-11-23 15:09:58 -05:00
Simon Willnauer 93a988c557 [TEST] use routing partition size based on the max routing shards of the second split 2017-11-23 17:59:07 +01:00
Nhat Nguyen e95d18ec23
Adjust CombinedDeletionPolicy for multiple commits (#27456)
Today, we keep only the last index commit and use only it to calculate
the minimum required translog generation. This may no longer be correct
as we introduced a new deletion policy which keeps multiple index
commits. This change adjusts the CombinedDeletionPolicy so that it can
work correctly with a new index deletion policy.

Relates to #10708, #27367
2017-11-23 11:34:50 -05:00
olcbean fd564b10db Deprecate `levenstein` in favor of `levenshtein` (#27409)
Support both spellings thoughout 6.x, reporting the incorrect one as deprecated.
2017-11-23 12:53:47 +00:00
Simon Willnauer fadbe0de08
Automatically prepare indices for splitting (#27451)
Today we require users to prepare their indices for split operations.
Yet, we can do this automatically when an index is created which would
make the split feature a much more appealing option since it doesn't have
any 3rd party prerequisites anymore.

This change automatically sets the number of routinng shards such that
an index is guaranteed to be able to split once into twice as many shards.
The number of routing shards is scaled towards the default shard limit per index
such that indices with a smaller amount of shards can be split more often than
larger ones. For instance an index with 1 or 2 shards can be split 10x
(until it approaches 1024 shards) while an index created with 128 shards can only
be split 3x by a factor of 2. Please note this is just a default value and users
can still prepare their indices with `index.number_of_routing_shards` for custom
splitting.

NOTE: this change has an impact on the document distribution since we are changing
the hash space. Documents are still uniformly distributed across all shards but since
we are artificually changing the number of buckets in the consistent hashign space
document might be hashed into different shards compared to previous versions.

This is a 7.0 only change.
2017-11-23 09:48:54 +01:00
olcbean 05998f91d0 Validate `op_type` for `_create` (#27483) 2017-11-23 07:19:47 +01:00
Nicholas Knize 4017049bac Minor ShapeBuilder cleanup
Remove some auto generated comments and make CoordinateNode ctors package private.
2017-11-22 23:08:15 -06:00
Martijn van Groningen 9fbbc46ba4
Added 6.2 version 2017-11-22 17:37:19 +01:00
Mayya Sharipova 57e4d10007
Limit the number of nested documents (#27405)
Add an index level setting `index.mapping.nested_objects.limit` to control
the number of nested json objects that can be in a single document
across all fields. Defaults to 10000.

Throw an error if the number of created nested documents exceed this
limit during the parsing of a document.

Closes #26962
2017-11-22 10:16:28 -05:00
Jason Tedor 4cffe8f3bd Fix whitespace on docs for read/writeArray methods 2017-11-21 16:46:52 -05:00
Jason Tedor 1d5d246e32 Fix whitespace in Security.java 2017-11-21 16:46:10 -05:00
Jason Tedor f5a79af578
Tighten which classes can exit
Today we allow exiting solely by being in certain packages. This commit
upgrades the securesm dependency to a new version that supports being
explicit about which classes can exit. We utilize that here to only
allow exiting from the uncaught exception handler and the base CLI
command class.

Relates #27482
2017-11-21 16:37:41 -05:00
Jim Ferenczi 3427062c3a [Test] Fix AggregationsTests#testFromXContentWithRandomFields
Exclude "key" field from random modifications in tests, the composite agg uses
an array of object for bucket key and values are checked.
Relates #26800
2017-11-21 19:28:27 +01:00
javanna 3eeccb7791 Update version check for CCS optional remote clusters
also fixed the remote.info yaml test to clean up the registered remote cluster once the test is completed.

Relates to #27182
2017-11-21 16:52:45 +01:00
Simon Willnauer cc78b24867 Bump BWC version to 6.1.0 for #27469 2017-11-21 16:16:31 +01:00
Adrien Grand 6ac799074e
Fix dynamic mapping update generation. (#27467)
When a field is not mapped, Elasticsearch tries to generate a mapping update
from the parsed document. Some documents can introduce corner-cases, for
instance in the event of a multi-valued field whose values would be mapped to
different field types if they were supplied on their own, see for instance:

```
PUT index/doc/1
{
  "foo": ["2017-11-10T02:00:01.247Z","bar"]
}
```

In that case, dynamic mappings want to map the first value as a `date` field
and the second one as a `text` field. This currently throws an exception,
which is expected, but the wrong one since it throws a `class_cast_exception`
(which triggers a HTTP 5xx code) when it should throw an
`illegal_argument_exception` (HTTP 4xx).
2017-11-21 15:31:18 +01:00
Simon Willnauer 5a0b6d1977
Use the primary_term field to identify parent documents (#27469)
This change stops indexing the `_primary_term` field for nested documents
to allow fast retrieval of parent documents. Today we create a docvalues
field for children to ensure we have a dense datastructure on disk. Yet,
since we only use the primary term to tie-break on when we see the same
seqID on indexing having a dense datastructure is less important. We can
use this now to improve the nested docs performance and it's memory footprint.

Relates to #24362
2017-11-21 15:14:03 +01:00
Jim Ferenczi 6319424e4a
Move composite aggregation to core (#27474)
This change removes the module named aggs-composite and adds the `composite` aggs
as a core aggregation. This allows other plugins to use this new aggregation
and simplifies the integration in the HL rest client.
2017-11-21 13:31:01 +01:00
Simon Willnauer ea35abca28
Protect shard splitting from illegal target shards (#27468)
While we have an assertion that checks if the number of routing shards is a multiple
of the number of shards we need a real hard exception that checks this way earlier.
This change adds a check and test that is executed before we create the index.

Relates to #26931
2017-11-21 12:09:45 +01:00
Luca Cavanna 29450de7b5
Cross Cluster Search: make remote clusters optional (#27182)
Today Cross Cluster Search requires at least one node in each remote cluster to be up once the cross cluster search is run. Otherwise the whole search request fails despite some of the data (either local and/or remote) is available. This happens when performing the _search/shards calls to find out which remote shards the query has to be executed on. This scenario is different from shard failures that may happen later on when the query is actually executed, in case e.g. remote shards are missing, which is not going to fail the whole request but rather yield partial results, and the _shards section in the response will indicate that.

This commit introduces a boolean setting per cluster called search.remote.$cluster_alias.skip_if_disconnected, set to false by default, which allows to skip certain clusters if they are down when trying to reach them through a cross cluster search requests. By default all clusters are mandatory.

Scroll requests support such setting too when they are first initiated (first search request with scroll parameter), but subsequent scroll rounds (_search/scroll endpoint) will fail if some of the remote clusters went down meanwhile.

The search API response contains now a new _clusters section, similar to the _shards section, that gets returned whenever one or more clusters were disconnected and got skipped:

"_clusters" : {
    "total" : 3,
    "successful" : 2,
    "skipped" : 1
}
Such section won't be part of the response if no clusters have been skipped.

The per cluster skip_unavailable setting value has also been added to the output of the remote/info API.
2017-11-21 11:41:47 +01:00
Jason Tedor 190da14bfe Move resync request serialization assertion
This commit moves an assertion that some guard code that will eventually
be dead code in the resync replication request read serialization is
removed when the master branch is bumped to version 8.0.0.
2017-11-20 20:59:41 -05:00
Jason Tedor 28660be40a
Fix resync request serialization
This commit addresses a subtle bug in the serialization routine for
resync requests. The problem here is that Translog.Operation#readType is
not compatible with the implementations of
Translog.Operation#writeTo. Unfortunately, this issue prevents
primary-replica from succeeding, issues which we will address in
follow-ups.

Relates #27418
2017-11-20 20:56:48 -05:00
Nicholas Knize 093218e052 [TEST] Fix `GeoShapeQueryTests#testPointsOnly` failure
Changes unnecessary geoIntersection query to a matchAll query.

closes #27454
2017-11-20 12:11:18 -06:00
Tim Brooks 0a8f48d592
Transition transport apis to use void listeners (#27440)
Currently we use ActionListener<TcpChannel> for connect, close, and send
message listeners in TcpTransport. However, all of the listeners have to
capture a reference to a channel in the case of the exception api being
called. This commit changes these listeners to be type <Void> as passing
the channel to onResponse is not necessary. Additionally, this change
makes it easier to integrate with low level transports (which use
different implementations of TcpChannel).
2017-11-20 10:47:47 -07:00
Simon Willnauer d02f45f694 AwaitsFix GeoShapeQueryTests#testPointsOnly #27454 2017-11-20 17:16:36 +01:00
Simon Willnauer 720e96e288
Ensure nested documents have consistent version and seq_ids (#27455)
Today we index dummy values for seq_ids and version on nested documents.
This is on the one hand trappy since users can request these values via
inner hits and on the other hand not necessarily good for compression since
the dummy value will likely not compress well when seqIDs are lowish.

This change ensures that we share the same field values for all documents in a
nested block. This won't have any overhead, in-fact it might be more efficient since
we even reduce the work needed slightly.
2017-11-20 16:50:08 +01:00
Christoph Büscher 682a85b2c1
Delete some seemingly unused exceptions (#27439) 2017-11-20 09:05:03 +01:00
Michael Basnight 2949c53174
Remove config prompting for secrets and text (#27216)
This commit removes the ability to use ${prompt.secret} and
${prompt.text} as valid config settings. Secure settings has obsoleted
the need for this, and it cleans up some of the code in Bootstrap.
2017-11-19 22:33:17 -06:00
Michael Basnight cb3e8f4763
Move the CLI into its own subproject (#27114)
Projects the depend on the CLI currently depend on core. This should not
always be the case. The EnvironmentAwareCommand will remain in :core,
but the rest of the CLI components have been moved into their own
subproject of :core, :core:cli.
2017-11-18 21:42:57 -06:00
Jason Tedor 56540281a8
Avoid NPE when getting build information
When the Elasticsearch code is loaded in an unusual classloading
environment (e.g., when using the high-level REST client) in Jetty, the
code source can be null and we trip with an NPE. This commit addresses
this.

Relates #27442
2017-11-18 07:19:22 -05:00
Nhat Nguyen 4f711a828b
Removes BWC snapshot status handler used in 6.x (#27443)
We introduced a new snapshot status update handler in 6.1.0. We will
keep the old handler along with this new one in all 6.x. This commit
removes the old handler from 7.0.

Relates #27151
2017-11-17 20:13:56 -05:00
Tim Brooks cc3be6ddda
Remove parameters on HandshakeResponseHandler (#27444)
This is a followup to #27407. That commit removed the channel type
parameter from TcpTransport. This commit removes the parameter from the
handshake response handler.
2017-11-17 14:53:15 -07:00
Nicholas Knize 075c77fc81 [GEO] fix pointsOnly bug for MULTIPOINT
This commit fixes a bug where geo_shape indexes configured for "points_only" : "true" reject documents containing multipoint shape types.
2017-11-17 14:43:36 -06:00
Mayya Sharipova 858b2c7cb8
Standardize underscore requirements in parameters (#27414)
Stardardize underscore requirements in parameters across different type of
requests:
_index, _type, _source, _id keep their underscores
params like version and retry_on_conflict will be without underscores
Throw an error if older versions of parameters are used

BulkRequest, MultiGetRequest, TermVectorcRequest, MoreLikeThisQuery
were changed

Closes #26886
2017-11-17 15:31:52 -05:00
Jason Tedor da115151a5
Log primary-replica resync failures
Today we do not fail a replica shard if the primary-replica resync to
that replica fails. Yet, we should at least log the failure
messages. This commit causes this to be the case.

Relates #27421
2017-11-17 13:33:58 -05:00
Nhat Nguyen db688e1a17
Uses TransportMasterNodeAction to update shard snapshot status (#27165)
Currently, we are using a plain TransportRequestHandler to post snapshot
status messages to the master. However, it doesn't have a robust retry
mechanism as TransportMasterNodeAction. This change migrates from
TransportRequestHandler to TransportMasterNodeAction for the new
versions and keeps the current implementation for the old versions.

Closes #27151
2017-11-17 11:54:44 -05:00
Lee Hinman d92afa1e0a Enforce a minimum task execution and service time of 1 nanosecond
Resolves #27371
2017-11-17 09:39:55 -07:00
Yannick Welsch 76203e72bd
Fix place-holder in allocation decider messages (#27436)
Allocation decider messages were using the wrong place-holder, which resulted in output of the form "no allocations are allowed due to {}" when showing diagnostics information in the explain API.
2017-11-17 17:27:19 +01:00
Jim Ferenczi c91b7cad83 [#27380] Adjust bwc for multi_match lenient option 2017-11-17 15:45:45 +01:00
Jim Ferenczi 53462f6499
Make fields optional in multi_match query and rely on index.query.default_field by default (#27380)
* Make fields optional in multi_match query and rely on index.query.default_field by default

This commit adds the ability to send `multi_match` query without providing any `fields`.
When no fields are provided the `multi_match` query will use the fields defined in the index setting `index.query.default_field`
(which in turns defaults to `*`).
The same behavior is already implemented in `query_string` and `simple_query_string` so this change just applies
the heuristic to `multi_match` queries.
Relying on `index.query.default_field` rather than `*` is safer for big mappings that break the 1024 field expansion limit added in 7.0 for all
text queries. For these kind of mappings the admin can change the `index.query.default_field` in order to make sure that exploratory queries using
`multi_match`, `query_string` or `simple_query_string` do not throw an exception.
2017-11-17 10:25:21 +01:00
David Turner 492edb91b9 Bump version to 6.0.1 2017-11-16 18:39:20 +00:00