Commit Graph

8820 Commits

Author SHA1 Message Date
Christoph Büscher 62a7cac3a0 Merge branch 'master' into feature/rank-eval 2017-08-23 11:19:16 +02:00
Colin Goodheart-Smithe c3cc8262a7 Migrates more ToXContentClasses (#26321)
* More XContent migrations

* Removes ToXContentToBytes

* Adds toString to classes that used to extend ToXContentToBytes

* use XContentHelper

* more review comments

* prettify tostring output
2017-08-23 08:17:32 +01:00
Jim Ferenczi 8b8c06398e remove Lucene class copies that are not needed anymore (#26325) 2017-08-23 09:02:00 +02:00
Yannick Welsch 4b813adf52 [TEST] Account for relocating primary in SearchWhileCreatingIndexIT
The test verifies that search on the primary works by executing a search with preference _primary. If the primary is relocating, however, it
does not take the primary relocation target into account. The test only makes sense, however, if balancing is not happening yet, i.e., the
cluster is not green.
2017-08-23 14:23:14 +09:30
Yannick Welsch 73dff6d21f Add workaround for Javadoc generation issues on JDK 9 b181
The javadoc tool on JDK 9 has issues with the combination of anonymous classes and varargs parameters.
This commit simply refactors a few anonymous classes to private inner classes.
2017-08-23 10:15:01 +09:30
Tal Levy 6ab4b6b0ac revamp TransportRequest handlers to support Writeable (#26315)
This PR begins the long journey to deprecating Streamable.

The idea here is to add additional method signatures that
support Writeable.Reader, so that the work to migrate objects TransportMessage to
implement Writeable and not Streamable.

One example conversion is done in this PR: SimulatePipelineRequest.
2017-08-22 15:47:05 -07:00
Jim Ferenczi 4756c9a884 Fix nested query highlighting (#26305)
This commit extracts the inner query in the ESToParentBlockJoinQuery for highlighting.
This query has been added in 5.4 and breaks plain highlighting on nested queries.
Highlighters that use postings or term vectors are not affected because they can't highlight nested documents correctly.

Fixes #26230
2017-08-22 11:36:45 +02:00
Yannick Welsch 3d8feff66e Use Java 9 FilePermission model (#26302)
This commit makes the security code aware of the Java 9 FilePermission changes (see #21534) and allows us to remove the `jdk.io.permissionsUseCanonicalPath` system property.
2017-08-22 11:22:00 +09:30
Andy Bristol bdefcbdcd6 reroute API: log messages from commands (#25955)
Gives allocation commands from the cluster reroute API
the ability to provide messages to be logged once the 
cluster state change has been committed. 

The purpose of this change is to create a record in the 
logs when allocation commands which could potentially
be destructive are applied. The allocate_empty_primary
and allocate_stale_primary commands are the only ones
that currently provide log messages.

Closes #22821
2017-08-21 17:09:40 -07:00
Jim Ferenczi a48616272f #26173: Removed global_ordinals_hash and global_ordinals_low_cardinality exeuction hint deprecated in 6.1 2017-08-21 20:44:34 +02:00
Jim Ferenczi 977dcfe789 Deprecate global_ordinals_hash and global_ordinals_low_cardinality (#26173)
* Deprecate global_ordinals_hash and global_ordinals_low_cardinality

This change deprecates the `global_ordinals_hash` and `global_ordinals_low_cardinality` and
makes the `global_ordinals` execution hint choose internally if global ords should be remapped or use the segment ord directly.
These hints are too sensitive and expert to be exposed and we should be able to take the right decision internally based on the agg tree.
2017-08-21 19:12:27 +02:00
Christoph Büscher 5dae277bb2 Support distance units in GeoHashGrid aggregation precision (#26291)
Currently the `precision` parameter must be a precision level
in the range of [1,12]. In #5042 it was suggested also supporting
distance units like "1km" to automatically approcimate the needed
precision level. This change adds this support to the Rest API by
making use of GeoUtils#geoHashLevelsForPrecision.

Plain integer values without a unit are still treated as precision
levels like before. Distance values that are too small to be represented
by a precision level of 12 (values approx. less than 0.056m) are
rejected.

Closes #5042
2017-08-21 17:29:28 +02:00
Christoph Büscher 4ff12c9a0b Throw exception in scroll requests using `from` (#26235)
The `from` search parameter cannot really be used in scrolled searches. This
commit adds a check for this case to the SearchRequest#validate() method so we
can reported it as an error rather than silently ignoring it.

Closes #9373
2017-08-21 15:12:34 +02:00
Boaz Leskes 181e881a0f enable testIssue8226
The linked issue has been long closed
2017-08-21 14:33:04 +02:00
Jim Ferenczi 8fd71a5d6d #26145 Fix test expectation with MatchNoDocsQuery 2017-08-21 14:17:43 +02:00
Jim Ferenczi 4bce727165 Refactor simple_query_string to handle text part like multi_match and query_string (#26145)
This change is a continuation of #25726 that aligns field expansions for the simple_query_string with the query_string and multi_match query.
The main changes are:

 * For exact field name, the new behavior is to rewrite to a matchnodocs query when the field name is not found in the mapping.

 * For partial field names (with * suffix), the expansion is done only on keyword, text, date, ip and number field types. Other field types are simply ignored.

 * For all fields (*), the expansion is done on accepted field types only (see above) and metadata fields are also filtered.

The use_all_fields option is deprecated in this change and can be replaced by setting `*` in the fields parameter.
This commit also changes how text fields are analyzed. Previously the default search analyzer (or the provided analyzer) was used to analyze every text part
, ignoring the analyzer set on the field in the mapping. With this change, the field analyzer is used instead unless an analyzer has been forced in the parameter of the query.

Finally now that all full text queries can handle the special "*" expansion (`all_fields` mode), the `index.query.default_field` is now set to `*` for indices created in 6.
2017-08-21 13:12:27 +02:00
Sergey Galkin 9a3216dfee Stricter validation for min/max values for whole numbers (#26137) 2017-08-21 12:16:45 +02:00
Antonio Matarrese 93cc2d0372 Configurable distance limit with the AUTO fuzziness. (#25731)
Make the distance thresholds configurable with the AUTO fuzziness.
2017-08-21 11:00:20 +02:00
Ryan Ernst 96b0d3e0cc Script: Convert script query to a dedicated script context (#26003)
This commit converts script query to use a new FilterScript context. The
new context returns a boolean, so the error that would have previously
happened at runtime if a non boolean was returned would now happen at
script compilation. Also, the leniency of supporting returning a number
and 0 mapping to false, non-zero to true is gone, but it was never
documented. With the new context compilation will now also fail if
special variables are used at compilation time, instead of runtime, eg
ctx.
2017-08-18 15:18:35 -07:00
Tim Brooks 5d7a78fcdb Use PlainListenableActionFuture for CloseFuture (#26242)
Right now we use a custom future for the CloseFuture associated with a
channel. This is because we need special unwrapping logic to ensure that
exceptions from a future failure are a certain type (opposed to an
UncategorizedException). However, the current version is limiting
because we can only attach one listener.

This commit changes the CloseFuture to extend the
PlainListenableActionFuture. This change allows us to attach multiple
listeners.
2017-08-18 13:38:38 -05:00
Andy Bristol 6eef6c4f7a [TEST] wait until reindex tasks ready for rethrottle (#26250)
When slices is set as auto, there's an additional network call
needed for the reindex tasks to know how to rethrottle. Sometimes
the rethrottle action happens before the reindex task is fully
initialized, so in the test we wait for the task to be ready.

This commit also adds some safeguards to ensure that
cancel and rethrottle operations are handled correctly

Closes #26192
2017-08-18 11:01:27 -07:00
Jason Tedor 8a7d48538e Add friendlier message on bad keystore permissions
If we do not have permissions to write the keystore, an unclear access
denied exception is thrown. This commit catches this exception so that
we can decorate it with a friendlier error message.

Relates #26284
2017-08-18 10:39:38 -04:00
Nik Everett 542fe864f8 Handle the 5.5.2 release
That looks to be as simple as adding the 5.5.3 version constant.
2017-08-17 20:08:44 -04:00
Lee Hinman f18ec511ca Disallow : in cluster and index/alias names (#26247)
We use `:` for cross-cluster search (eg `cluster:index`), therefore, we should
not allow the ambiguity when allowing cluster or index names.

Relates to #23892
2017-08-17 14:57:26 -06:00
Simon Willnauer e3cc24685d Persist created keystore on startup unless keystore is present (#26253)
We already added the functionality to create a new keystore on startup
in #26126 but apparently missed to persist the keystore. This change adds
peristence and adds a test for the boostrap loading.
2017-08-17 15:32:23 +02:00
Adrien Grand 15b7aeeb0f Remove back compat layer with 2.x indices. (#26245)
As of 6.0 we do not need to support 2.x indices.
2017-08-17 10:16:24 +02:00
Adrien Grand 22292e8d96 Add segment attributes to the `_segments` API. (#26157)
This contains information about whether high compression was enabled for instance.

Closes #26130
2017-08-16 19:01:29 +02:00
Colin Goodheart-Smithe a975f4e5d6 Moves more classes over to ToXContentObject/Fragment (#26234)
* Moves more classes over to ToXContentObject/Fragment

* review comments
2017-08-16 15:40:40 +01:00
Simon Willnauer 54bf7d78e8 Prevent cluster internal `ClusterState.Custom` impls to leak to a client (#26232)
Today a `ClusterState.Custom` can be fetched by a transport client and
leaks to the user even if the classes are private etc since the serialized
bytes can be reconstructed. This change adds an option to customs to mark
them as private such that our clusterstate action will never leak it.
2017-08-16 12:54:17 +02:00
Yannick Welsch ca6eaf9831 [TEST] Reenable RareClusterStateIt#testDeleteCreateInOneBulk
The AwaitsFix issue has been closed as the deleting an index and recreating with same name will give the
shard a fresh folder to be written to (based on the index uuid).
2017-08-16 15:41:11 +08:00
Yannick Welsch 01f6851691 Serialize and expose timeout of acknowledged requests in REST layer (#26189)
Due to the weird way of structuring the serialization code in AcknowledgedRequest, many request types forgot to properly serialize the request timeout, for example "index deletion", "index rollover", "index shrink", "putting pipeline", and other requests. This means that if those requests were not directly sent to the master node, the acknowledgement timeout information would be lost (and the default used instead).
Some requests also don't properly expose the timeout mechanism in the REST layer, such as put / delete stored script. This commit fixes all that.
2017-08-16 07:43:05 +08:00
desmorto 292dd8f992 (refactor) some opportunities to use diamond operator (#25585)
* (refactor) some opportunities to use diamond operator

* Update ExceptionRetryIT.java

update typo
2017-08-15 16:36:42 -06:00
Ryan Ernst b2d6ff9116 Settings: Add keystore.seed auto generated secure setting (#26149)
This commit adds a keystore.seed setting that is automatically
generated when the ES keystore is created. This setting may be used by
plugins as a secure, random value. This commit also auto creates the
keystore upon startup to ensure the new setting is always available.
2017-08-15 14:04:03 -07:00
Jason Tedor 1ff8334d26 Fix document field equals and hash code test
For the document field equals and hash code tests, we try to mutate the
document field to intentionally produce a document field not equal to
our provided one. We do this by randomly choosing a document field that
has either
 - a randomly chosen field name and the same field value as the provided
   document field
 - a randomly chosen field value and the same field value as the
   provided document field

If we are unlucky, it can be that the document field chosen by this
method can be equal to the provided document field. In this case, our
test will fail because the mutation really should be not equal. In this
case, we should simply try the other mutation. Note that random document
field produced by the second method can be equal to the provided
document because it has the same field name and we can get unlucky with
our randomly chosen field values. It is not the case that the random
document field produced by the first method can be equal to the provided
document field; this is because the current implementation guarantees
that the field name length will be different guaranteeing that we have a
different field name. Nevertheless, we fix the issue here by checking
that our random choice gives us a non-equal document field, and assert
that if we got unlucky the other one will work for us.
2017-08-15 14:11:13 -04:00
Jason Tedor d1780a8052 Use holder pattern for lazy deprecation loggers
In a few places we need to lazy initialize static deprecation
loggers. This is needed to avoid touching logging before logging is
configured, but deprecation loggers that are used in foundational
classes like settings and parsers would be initialized before logging is
configured. Previously we used a lazy set once pattern which is fine,
but there's a simpler approach: the holder pattern.

Relates #26218
2017-08-15 13:46:19 -04:00
Ryan Ernst 7ed501b230 Settings: Add keystore creation to add commands (#26126)
This commits changes the keystore cli add commands to prompt for
creating the keystore if it does not exist. This will make it easier on
users starting out, not having to run a separate command for creation.
2017-08-15 10:15:55 -07:00
Zachary Tong d26becc040 Fix NPE when `values` is omitted on percentile_ranks agg (#26046)
An array of values is required because there is no default (or
reasonable way to set a default).  But validation for values
only happens if it is actually set.  If the values param is omitted
entirely than the agg builder will NPE.
2017-08-15 13:09:15 -04:00
Simon Willnauer a9169e536b Several internal improvements to internal test cluster infra (#26214)
This chance adds several random test infrastructure improvements that caused
issues in on-going developments but are generally useful. For instance is it impossible
to restart a node with a secure setting source since we close it after the node is started.
This change makes it cloneable such that we can reuse it for a restart.
2017-08-15 17:42:15 +02:00
Jason Tedor 1331741d7c Fix typo in comment in o/e/b/Elasticsearch
This commit fixes a typo (missing word) in
org/elasticsearch/bootstrap/Elasticsearch.java.
2017-08-15 09:43:35 -04:00
Christoph Büscher 34610b841d Reject multiple methods in `percentiles` aggregation (#26163)
Currently the `percentiles` aggregation allows specifying both possible methods
in the query DSL, but only the later one is used. This changes it to rejecting
such requests with an error. Setting the method multiple times via the java API
still works (and the last one wins).

Closes #26095
2017-08-15 14:11:57 +02:00
Colin Goodheart-Smithe f6d14717ed Makes hashCode and equals in InternalAggregations abstract (#26216)
This simply removes the default identity hashcode and equals methods in InternalAggregation which where only temporarily put there while we implmeneted the methods in the subclasses.
2017-08-15 11:14:57 +01:00
Yannick Welsch 0127528d97 Register setting cluster.indices.tombstones.size (#26193)
The node setting `cluster.indices.tombstones.size` was not registered with the settings infrastructure, making it impossible for it to be set by a user.

Closes #26191
2017-08-15 09:21:38 +08:00
Yannick Welsch fe0c68ec8f Allow wildcards for shard IP filtering (#26187)
Fixes the broken usage of wildcards for IP-based allocation filtering (introduced by PR #22591), which is documented at https://www.elastic.co/guide/en/elasticsearch/reference/current/shard-allocation-filtering.html

Closes #26184
2017-08-15 09:16:53 +08:00
Jason Tedor 447d92e482 Allow not configure logging without config
For CLI tools, we configure logging without reading the
log4j2.properties file. This because any log statements in a CLI tool
should dump to the console while reading from the log4j2.properties file
would cause them to dump whereever the log configuration there indicates
(e.g., possibly a remote machine). To do this, we added some code to the
base implementation of all CLI tools to configure logging without a
config file. This code is also executed when Elasticsearch starts up. In
the past this was fine yet we previously added detection to
Elasticsearch to find cases where we use logging before it is
configured. Because of configuring logging without a config, this means
we only catch uses of logging before the logging without config is
performed. To correct this, we enable a CLI tool to skip enabling
logging without a config and then in the Elasticsearch CLI we indeed
utilize this to skip configuring logging without a config.

Relates #26209
2017-08-14 19:39:14 -04:00
Jason Tedor 685e35e0ae Fix DiskThresholdMonitor flood warning
The flood warning checks the wrong threshold, namely the high
watermark. This would impact any node for which the disk usage is above
the high watermark and below the flood stage watermark. This commit
fixes this so that it compares to the flood threshold.

Relates #26204
2017-08-15 00:22:27 +09:00
Jim Ferenczi d896e62703 Rewrite range queries with open bounds to exists query (#26160)
* Rewrite range queries with open bounds to exists query

This change rewrites range query with open bounds to an exists query that should be faster to execute.

Fixes #22640
2017-08-14 09:50:36 +02:00
Christoph Büscher 6e085c75af Fix eclipse compilation problem (#26170) 2017-08-13 19:19:12 +02:00
Albert Zaharovits 3e3132fe3f Epoch millis and second formats parse float implicitly (Closes #14641) (#26119)
`epoch_millis` and `epoch_second` date formats truncate float values, as numbers or as strings.
The `coerce` parameter is not defined for `date` field type and this is not changing.
See PR #26119

Closes #14641
2017-08-13 08:35:45 +03:00
Martijn van Groningen 1146a35870
Move more token filters to analysis-common module
The following token filters were moved: arabic_stem, brazilian_stem, czech_stem, dutch_stem, french_stem, german_stem and russian_stem.

Relates to #23658
2017-08-11 17:39:24 +02:00
Andy Bristol 7e3cd6a019 reindex: automatically choose the number of slices (#26030)
In reindex APIs, when using the `slices` parameter to choose the number of slices, adds the option to specify `slices` as "auto" which will choose a reasonable number of slices. It uses the number of shards in the source index, up to a ceiling. If there is more than one source index, it uses the smallest number of shards among them.

This gives users an easy way to use slicing in these APIs without having to make decisions about how to configure it, as it provides a good-enough configuration for them out of the box. This may become the default behavior for these APIs in the future.
2017-08-11 08:25:25 -07:00