Commit Graph

28544 Commits

Author SHA1 Message Date
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
Matt Weber e89d9400c9 ICUCollationKeywordFieldMapper use SortedSetDocValuesField (#26267)
Switch ICUCollationKeywordFieldMapper from using SortedDocValuesField to SortedSetDocValuesField
so we can support fields with multiple values.
2017-08-21 10:40:56 +02:00
Yannick Welsch 41f81e2279 Use explicit test classes output dir for configuring test task
This allows the build to run with Gradle 4.1 as well, where oldTestTask.testClassesDir will return null
at configuration time.
2017-08-21 14:55:23 +09:30
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
michaelbaamonde c0dbd236c3 Fix typo re: bootstrap.memory_lock in Docker docs. (#26265)
`bootstrap_memory_lock` should be `bootstrap.memory_lock`.
2017-08-18 11:55:56 -04: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
Zachary Tong 9f295b4ba8 Add REST tests for percentiles agg (#26266)
There's a separate test for each TDigest and HDR Histo,
to keep things clean.

Related to #26220
2017-08-18 10:31:59 -04:00
Jason Tedor a894f89235 Create keystore on RPM and Debian package install
When Elasticsearch starts up, it tries to create a keystore if one does
not exist; this is so the keystore can be seeded. With the RPM and
Debian packages, the keystore would be located in
/etc/elasticsearch. This configuration directory is typically not
writable by the elasticsearch user so the Elasticsearch process will not
have permission to create the keystore. Instead, the RPM and Debian
packages should create the keystore (if it does not exist) on package
installation. This commit enables these packages to do that in the
post-install routines.

Relates #26282
2017-08-18 10:31:27 -04:00
Jason Tedor 65c353350a Add safer empty variable checking for Windows
We need to check if JAVA_TOOL_OPTIONS, and JAVA_OPTS are set, and if
ES_PATH_CONF is not set. However, if these variables are defined and
contain quotes, the current mechanism busts on them. Instead, we should
use safer mechanism for checking if these variable are defined or
not. This commit does that.

Relates #26268
2017-08-17 22:50:27 -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
Jason Tedor 4e97be02a9 Export HOSTNAME environment variable
We previously explicitly set the HOSTNAME environment variable so that
${HOSTNAME} could be used a placeholder for defining the node.name in
elasticsearch.yml. We removed explicitly setting this because bash
defines HOSTNAME. The problem is that bash defines HOSTNAME as a bash
variable, not as an environment variable. Therefore, to restore the
previous behavior, we export the bash value for HOSTNAME as an
environment variable named HOSTNAME. For consistency between Windows and
the Unix-like systems, we also define HOSTNAME with a value equal to the
environment variable COMPUTERNAME on Windows.

Relates #26262
2017-08-17 16:51:02 -04:00
Jason Tedor 4651920b68 Remove extraneous quotes from Windows env script
We quoted some strings in the Windows elasticsearch-env script but echo
on Windows includes these quotes in the output. This commit removes
these quotes, they do not need to be output and are noise. Note that one
of the commands is wrapped in parentheses, this is to make obvious that
the space at the end of the corresponding line is intentionally there.
2017-08-17 16:14:21 -04:00
Jason Tedor ee94a02015 Fix warning for JAVA_TOOL_OPTIONS on Windows
The error message for warning about the use of JAVA_TOOL_OPTIONS on
Windows incorrectly uses $JAVA_TOOL_OPTIONS to dereference the
environment variable JAVA_TOOL_OPTIONS; on Windows it should be
%JAVA_TOOL_OPTIONS%.
2017-08-17 15:05:31 -04:00
Luca Cavanna 1309dfd44d Add links to external classes in clients javadoc (#25998)
The client sniffer depends on the low-level REST client, while the Java high-level REST client and the transport client depend on Elasticsearch itself. Javadoc are not that useful unless they have links to the Elasticsearch classes in the latter case, and to the low-level REST client in the sniffer javadoc. This commit adds those links.
2017-08-17 21:03:47 +02:00
Jack Conradson 23858789f0 Remove Sort enum from Painless Definition (#26179)
This is step toward making Definition instanceable which is necessary for custom whitelists in different contexts.
2017-08-17 12:02:11 -07:00
Nik Everett 7e76b2a8c3 Docs: fold section into current chapter
In #25602 we added a new *chapter* on aggregating by day of the
week. We intended to add a new *section* but we were missing a
single `=`.
2017-08-17 11:19:02 -04:00
Nik Everett b840fa3117 Fix some links in Painless method reference
Links to inner classes were using `$` in urls instead of `.`, causing
them to 404.

Also fixes the doc generation code to generate docs into the correct
directory. We moved the docs but never updated the generation code.
2017-08-17 10:50:38 -04:00
Zachary Tong 67e003da0d Add REST tests for value_count, stats, extended_stats and cardinality aggs (#26239)
* Add REST tests for value_count, stats, extended_stats and cardinality aggs

Also updates the document type of of other agg REST tests to `doc`

Related to #26220
2017-08-17 10:33:01 -04: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
Nik Everett 6d2c40e546 Enforce that responses in docs are valid json (#26249)
All of the snippets in our docs marked with `// TESTRESPONSE` are
checked against the response from Elasticsearch but, due to the
way they are implemented they are actually parsed as YAML instead
of JSON. Luckilly, all valid JSON is valid YAML! Unfurtunately
that means that invalid JSON has snuck into the exmples!

This adds a step during the build to parse them as JSON and fail
the build if they don't parse.

But no! It isn't quite that simple. The displayed text of some of
these responses looks like:
```
{
    ...
    "aggregations": {
        "range": {
            "buckets": [
                {
                    "to": 1.4436576E12,
                    "to_as_string": "10-2015",
                    "doc_count": 7,
                    "key": "*-10-2015"
                },
                {
                    "from": 1.4436576E12,
                    "from_as_string": "10-2015",
                    "doc_count": 0,
                    "key": "10-2015-*"
                }
            ]
        }
    }
}
```

Note the `...` which isn't valid json but we like it anyway and want
it in the output. We use substitution rules to convert the `...`
into the response we expect. That yields a response that looks like:
```
{
    "took": $body.took,"timed_out": false,"_shards": $body._shards,"hits": $body.hits,
    "aggregations": {
        "range": {
            "buckets": [
                {
                    "to": 1.4436576E12,
                    "to_as_string": "10-2015",
                    "doc_count": 7,
                    "key": "*-10-2015"
                },
                {
                    "from": 1.4436576E12,
                    "from_as_string": "10-2015",
                    "doc_count": 0,
                    "key": "10-2015-*"
                }
            ]
        }
    }
}
```

That is what the tests consume but it isn't valid JSON! Oh no! We don't
want to go update all the substitution rules because that'd be huge and,
ultimately, wouldn't buy much. So we quote the `$body.took` bits before
parsing the JSON.

Note the responses that we use for the `_cat` APIs are all converted into
regexes and there is no expectation that they are valid JSON.

Closes #26233
2017-08-17 09:02:10 -04: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
Simon Willnauer d26c8b5c88 Evaluate settings values before passing it to task closure (#26243)
The secure settings tool reads from stdIn and we use a closure to
provide a value for this. Yet, we evaluate they value too late and end up
with the last provided value for all keys.
2017-08-16 22:31:49 +02:00
Lee Hinman cfad6688b0 Migrate migration docs from 6.0 to 7.0 (#26227)
* Migrate migration docs from 6.0 to 7.0

Since we only keep one version of migration docs and master is now on 7.0, we
should migrate these so breaking changes can be added in the right place.

* Remove release notes as well

They link to the migration guides, so they have to go.

* Add placeholder notes for 7.0 so doc build is happy
2017-08-16 13:12:44 -06:00
Tim Brooks f69cc78b67 Release pipelined http responses on close (#26226)
Right now it is possible for the `HttpPipeliningHandler` to queue
pipelined responses. On channel close, we do not clear and release these
responses. This commit releases the responses and completes the promise.
2017-08-16 13:23:32 -05: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
Zachary Tong 2978b5df8b Add REST tests for avg/min/max/sum metric aggs (#26225)
Adds some REST tests for avg/min/max/sum metric aggregations

Related to #26220
2017-08-16 09:26:38 -04:00
Jason Tedor 6d8ef3153c Fix script setting names in script security docs
The names of two settings in the script security docs are incorrect,
referring to the prefix as "scripts" instead of "script". This commit
fixes this issue.

Relates #26236
2017-08-16 09:07:46 -04: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
Jason Tedor 7fb910599a Add packaging test for systemd runtime directive
We previously added a RuntimeDirectory directive to the systemd service
file for Elasticsearch. This commit adds a packaging test for the
situation that this directive was intended to address.

Relates #26229
2017-08-16 04:35:02 -04: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
Lisa Cawley 1697f1521c [DOCS] Clarified readme for testing a single page 2017-08-15 15:11:12 -07: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
Glen Smith dfe1bc6883 Update version information (#25226)
Bump current major version to 5, reflect bifurcation of packages.
2017-08-15 15:00:11 -06:00
R Tsien c7c8a9d1a9 "result" : created -> "result" : "created" (#25446) 2017-08-15 14:53:05 -06:00
Jordan Sissel f76fde04cd Set RuntimeDirectory (#23526)
This instruction tells systemd to create a directory /var/run/elasticsearch before starting Elasticsearch.

Without this change, the default PID_DIR (/var/run/elasticsearch) may not exist, and without it, Elasticsearch will fail to start.
2017-08-15 14:20:31 -06:00
Nik Everett d150884ded Drop upgrade from full cluster restart tests (#26224)
Our documentation for the API is:
```
The _upgrade API is no longer useful and will be removed.
Instead, see Reindex to upgrade.
```

Given that, I don't think we need to test the API anymore.

Closes #25311
2017-08-15 16:00:35 -04:00
Nik Everett 5ea6f90968 Further improve docs for requests_per_second
In #26185 we made the description of `requests_per_second` sane
for reindex. This improves on the description by using some more
common vocabulary ("batch size", etc) and improving the formatting
of the example calculation so it stands out and doesn't require
scrolling.
2017-08-15 15:57:07 -04:00
Berg Lloyd-Haig dd4f7eee22 Docs disambiguate reindex's requests_per_second (#26185)
Reindex's docs were somewhere between unclear and
inaccurate around `requests_per_second`. This makes
them much more clear and accurate.
2017-08-15 15:57:06 -04:00
Lisa Cawley 07f67cd8b5 [DOCS] Cleanup link for ec2 discovery (#26222) 2017-08-15 11:49:58 -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
Ryan Ernst a51faea79f Docs: Cleanup docs for ec2 discovery (#26065)
This commit clears up which settings are allowed for ec2 discovery, and
clearly marks those that require setting in the keystore.

closes #25619
2017-08-15 10:14:51 -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