Commit Graph

6521 Commits

Author SHA1 Message Date
Lee Hinman 2f01f65e1a Add rudimentary logstash and beats template BWC tests (#20588)
This tests that the templates shipped with 5.0 versions of Logstash and
Beats still work on an Elasticsearch 6.0+ node, so that we ensure that
ES can be upgraded prior to upgrading tools dependent on it.

Related to #20491
Resolves #17275
2016-10-18 09:49:09 -06:00
Lee Hinman c1721c6d79 Only negate index expression on all indices with preceding wildcard (#20898)
* Only negate index expression on all indices with preceding wildcard

There is currently a very confusing behavior in Elasticsearch for the
following:

Given the indices: `[test1, test2, -foo1, -foo2]`

```
DELETE /-foo*
```

Will cause the `test1` and `test2` indices to be deleted, when what is
usually intended is to delete the `-foo1` and `-foo2` indices.

Previously we added a change in #20033 to disallow creating indices
starting with `-` or `+`, which will help with this situation. However,
users may have existing indices starting with these characters.

This changes the negation to only take effect in a wildcard (`*`) has
been seen somewhere in the expression, so in order to delete `-foo1` and
`-foo2` the following now works:

```
DELETE /-foo*
```

As well as:

```
DELETE /-foo1,-foo2
```

so in order to actually delete everything except for the "foo" indices
(ie, `test1` and `test2`) a user would now issue:

```
DELETE /*,--foo*
```

Relates to #19800
2016-10-18 17:24:22 +02:00
Jason Tedor 9bb8bd0578 Fix typo in param. name in TransportService method
This commit fixes a typo in a parameter name for the
TransportService#setTracerLogExclude method.

Relates #20970
2016-10-18 10:07:57 -04:00
Fanfan d30de66949 tracelLogExclude to tracerLogExclude (#20970)
fix a variable name for misspelling "tracerLogExclude" to "tracelLogExclude"
2016-10-18 14:22:41 +02:00
Boaz Leskes ba6f759f58 ClusterState publishing shouldn't trigger circuit breakers (#20986)
Updating the circuit breaker settings (and other settings) should always be possible, even if the cluster is under stress. With #20827 we updated the cluster settings request to not trigger circuit breakers. However that change is not complete since the resulting cluster state can potentially not be published. This change makes sure cluster state publishing to not trigger circuit breakers as well.

Relates to #20960 where this was discovered.
2016-10-18 12:57:07 +02:00
Christoph Büscher abff485d68 Use Lucenes expectThrows() when testing exceptions
Cleaning up a few remaining occurences of using junits ExpectedException rule in
favor of using LuceneTestCase#expectThrows() which is more concise and versatile.
2016-10-18 10:34:48 +02:00
Ryan Ernst e57720e091 Fix test to check for boolean instead of integer for boolean field 2016-10-17 12:31:54 -07:00
Christoph Büscher c63c5fa3f2 Use expectThrows() instead of try-catch blocks for testing expected exceptions 2016-10-17 21:06:29 +02:00
Ryan Ernst 3d3dd7185d Add support for booleans in scripts (#20950)
* Scripting: Add support for booleans in scripts

Since 2.0, booleans have been represented as numeric fields (longs).
However, in scripts, this is odd, since you expect doing a comparison
against a boolean to work. While languages like groovy will auto convert
between booleans and longs, painless does not.

This changes the doc values accessor for boolean fields in scripts to
return Boolean objects instead of Long objects.

closes #20949

* Make Booleans final and remove wrapping of `this` for getValues()
2016-10-17 11:11:42 -07:00
Jason Tedor 5a03eb91e6 Add precise logging on unknown or invalid settings
Today when logging an unknown or invalid setting, the log message does
not contain the source. This means that if we are archiving such a
setting, we do not specify where the setting is from (an index, and
which index, or a persistent or transient cluster setting). This commit
provides such logging for the end user can better understand the
consequences of the unknown or invalid setting.

Relates #20951
2016-10-14 23:55:15 -04:00
Christoph Büscher 289a69bf68 Use ObjectParser in ScriptSortBuilder 2016-10-14 20:19:21 +02:00
Christoph Büscher 1b78618106 Use ObjectParser in ScoreSortBuilder and FieldSortBuilder 2016-10-14 20:19:21 +02:00
Jun Ohtani dd4ff9b0a7 Merge pull request #20904 from johtani/remove_nullable_in_mapper_builder_context
IndexSettings should not be Null in Mapper.BuildContext
2016-10-14 23:51:20 +09:00
Simon Willnauer cff5993318 Parse alias filters on the coordinating node (#20916)
Today we don't parse alias filters on the coordinating node, we only forward
the alias patters to executing node and resolve it late. This has several problems
like requests that go through filtered aliases are never cached if they use date math,
since the parsing happens very late in the process even without rewriting. It also used
to be processed on every shard while we can only do it once per index on the coordinating node.
Another nice side-effect is that we are never prone to cluster-state updates that change an alias,
all nodes will execute the exact same alias filter since they are process based on the same
cluster state.
2016-10-14 16:26:09 +02:00
Jun Ohtani ddced5df1a IndexSettings should not be Null in Mapper.BuildContext
Rename method name
Change validation

Closes #20174
2016-10-14 22:01:31 +09:00
Jason Tedor 595ec8c948 Remove artificial default processors limit
Today Elasticsearch limits the number of processors used in computing
thread counts to 32. This was from a time when Elasticsearch created
more threads than it does now and users would run into out of memory
errors. It appears the real cause of these out of memory errors was not
well understood (it's often due to ulimit settings) and so users were
left hitting these out of memory errors on boxes with high core
counts. Today Elasticsearch creates less threads (but still a lot) and
we have a bootstrap check in place to ensure that the relevant ulimit is
not too low.

There are some caveats still to having too many concurrent indexing
threads as it can lead to too many little segments, and it's not a
magical go faster knob if indexing is already bottlenecked by disk, but
this limitation is artificial and surprising to users and so it should
be removed.

This commit also increases the lower bound of the max processes ulimit,
to prepare for a world where Elasticsearch instances might be running
with more the previous cap of 32 processors. With the current settings,
Elasticsearch wants to create roughly 576 + 25 * p / 2 threads, where p
is the number of processors. Add in roughly 7 * p / 8 threads for the GC
threads and a fudge factor, and 4096 should cover us pretty well up to
256 cores.

Relates #20874
2016-10-14 05:47:26 -04:00
Simon Willnauer 7f7e99e10b [TEST] Add basic tests for ExplainRequest and ShardValidationQueryRequest 2016-10-14 10:06:38 +02:00
Simon Willnauer b2c8da25fd Remove unreleased version constant
Some people apparently never run tests when they change this file.
Neither do they read comments right below the line they change that
they should do the change after all.
2016-10-13 22:13:18 +02:00
Clinton Gormley e739ecf67c Fix version constant for 5.0.0 2016-10-13 20:42:43 +02:00
Clinton Gormley feefb71007 Renamed v5.0.0-rc2 to 5.0.0 2016-10-13 20:21:49 +02:00
kunal642 e20d9d6478 Removed unnecessary assertion on boolean values (#20910)
* Removed unnecessary assertion on boolean values

* Reversed changes for false assertion

* corrected formatting

* reverted changes for SettingsUpdater
2016-10-13 12:12:57 -04:00
Simon Willnauer 7e5d8a6e5a [TEST] use a different node ID for the test nodes 2016-10-13 17:39:19 +02:00
Simon Willnauer 61fd1cd582 Make AbstractSearchAsyncAction more testable and add a basic test case (#20890)
`AbstractSearchAsyncAction` has only been tested in integration tests.
The infrastructure is rather critical and should be tested on a unit-test
level. This change takes the first step.
2016-10-13 16:07:31 +02:00
Jay Modi fdceb64072 Use TimveValue instead of long for CacheBuilder methods
This changes the CacheBuilder methods that are used to set expiration times to accept a
TimeValue instead of long. Accepting a long can lead to issues where the incorrect value is
passed in as the time unit is not clearly identified. By using TimeValue the caller no longer
needs to worry about the time unit used by the cache or builder.
2016-10-13 09:27:31 -04:00
Simon Willnauer 43d11600ab [TEST] Add test that shows how to use a classic pull-parser with the object parser 2016-10-13 11:47:17 +02:00
Jun Ohtani 75c9e4f418 IndexSettings should not be Null in Mapper.BuildContext
Remove Nullable notation
Add unit test

Closes #20174
2016-10-13 18:11:08 +09:00
Simon Willnauer ce1a9a2b06 [TEST] Add test that filtered alias with date math isn't cached by the request cache 2016-10-13 10:18:40 +02:00
Colin Goodheart-Smithe 71aa807acd Fixes MultiMatchQuery so that it doesn't provide a null context (#20882)
Before this change the `MultiMatchQuery` called the field types
`termQuery()` with a null context. This is not correct so this change
fixes this so the `MultiMatchQuery` now uses the `ShardQueryContext` it
stores as a field.

Relates to https://github.com/elastic/elasticsearch/pull/20796#pullrequestreview-3606305
2016-10-13 08:44:41 +01:00
Simon Willnauer 12392b5425 Ensure port range is readable in the exception message (#20893)
Both netty3 and netty4 http implementation printed the default
toString representation of PortRange if ports couldn't be bound.
This commit adds a better default toString method to PortRange and
uses the string representation for the error message in the http
implementations.
2016-10-12 22:33:47 +02:00
Simon Willnauer 968fbaceef Never use ThreadPool#estimatedTimeInMillis as wall-clock time replacement 2016-10-12 22:13:13 +02:00
Areek Zillur 133be6631d Merge branch 'master' into cleanup/transport_bulk 2016-10-12 13:09:29 -04:00
Yannick Welsch 3d3ed7a83a Increase number of allowed failures in MockRepository for snapshot restore test
The test testDataFileCorruptionDuringRestore expects failures to happen when accessing snapshot data. It would sometimes
fail however as MockRepository (by default) only simulates 100 failures.
2016-10-12 19:03:49 +02:00
Simon Willnauer 06cfffa0a9 Explain how unreleased versions should be added to the codebase without adding it to Version.java (#20892)
Sometimes it's useful / needed to use unreleased Version constants but we should not add those to the Version.java class for several reasons ie. BWC tests and assertions along those lines. Yet, it's not really obvious how to do that so I added some comments and a simple test for this.
2016-10-12 17:49:24 +02:00
Christoph Büscher c3e564a9cd Merge pull request #20673
Add test for using fuzziness parameter in multi_match query
2016-10-12 16:57:11 +02:00
Christoph Büscher 6c0e4fc13d Add test for using fuzziness parameter in multi_match query
There was an issue with using fuzziness parameter in multi_match query that has
been reported in #18710 and was fixed in Lucene 6.2 that is now used on master.
In order to verify that fix and close the original issue this PR adds the test
from that issue as an integration test.
2016-10-12 15:55:30 +02:00
Boaz Leskes 27c87ab961 improve testAutoGenerateIdNoDuplicates logging on failure
Add unique doc content and log the results of the search results on failure, so we can better see what went wrong
2016-10-12 15:31:00 +02:00
Simon Willnauer 7b65c97483 Use Arrays.toString to stringify a String[] 2016-10-12 14:20:41 +02:00
Simon Willnauer f96ea58db8 Prevent double release in TcpTransport if send listener throws an exception (#20880)
today we might release a bytes array more than once if the send listener
throws an exception but already has released the array. Yet, this is already fixed
in the BytesArray class we use in production to ensure 3rd party users don't release
twice but our mocks still enforce it.
2016-10-12 12:53:15 +02:00
Christoph Büscher 608c7eb9fa Merge pull request #20873: Use ConstructingObjectParser with DirectCandidateGeneratorBuilder
Use ConstructingObjectParser for parsing DirectCandidateGenerator
2016-10-12 10:28:33 +02:00
Tanguy Leroux 44ac5d057a Remove empty javadoc (#20871)
This commit removes as many as empty javadocs comments my regexp has found
2016-10-12 10:27:09 +02:00
Yannick Welsch 075047065d Keep snapshot restore state and routing table in sync (#20836)
The snapshot restore state tracks information about shards being restored from a snapshot in the cluster state. For example it records if a shard has been successfully restored or if restoring it was not possible due to a corruption of the snapshot. Recording these events is usually based on changes to the shard routing table, i.e., when a shard is started after a successful restore or failed after an unsuccessful one. As of now, there were two communication channels to transmit recovery failure / success to update the routing table and the restore state. This lead to issues where a shard was failed but the restore state was not updated due to connection issues between data and master node. In some rare situations, this lead to an issue where the restore state could not be properly cleaned up anymore by the master, making it impossible to start new restore operations. The following change updates routing table and restore state in the same cluster state update so that both always stay in sync. It also eliminates the extra communication channel for restore operations and uses standard cluster state listener mechanism to update restore listener upon successful
completion of a snapshot.
2016-10-12 09:06:37 +02:00
Nik Everett cb8fe00b0e Fix imports in GeoDistanceIT
Wildcard imports are not allowed.

Relates to #20860
2016-10-11 16:59:04 -04:00
brandonkearby a3908c4c40 Fixed writeable name from range to geo_distance (#20860)
* Fixed writeable name from range to geo_distance

* Added testGeoDistanceAggregation

* Added asserts for correct result in testGeoDistanceAggregation

* Setup mapping on test index.
2016-10-11 16:56:56 -04:00
Areek Zillur 481f7909ae Merge branch 'master' into cleanup/transport_bulk 2016-10-11 16:04:47 -04:00
Areek Zillur 0e8b6532ec rename DocumentRequest to DocWriteRequest 2016-10-11 16:00:10 -04:00
Areek Zillur 661067d160 change DocumentRequest<?> to DocumentRequest for readibility 2016-10-11 15:58:36 -04:00
Christoph Büscher ba4a3db03b Use ConstructingObjectParser for parsing DirectCandidateGenerator
When refactoring DirectCandidateGeneratorBuilder recently, the
ConstructingObjectParser that we have today was not available. Instead we used
some workaround, but it is better to remove this now and use
ConstructingObjectParser instead.
2016-10-11 21:17:47 +02:00
Areek Zillur 225a04b2cc fix update operation in bulk execution 2016-10-11 14:21:09 -04:00
Nik Everett f3b8e7c238 Add `s` to _cat response parameters
`s` is used for sorting!

Relates to #20658
2016-10-11 12:29:55 -04:00
Alexander Lin 10ddcc4616 Adding built-in sorting capability to _cat apis. (#20658)
* Adding built-in sorting capability to _cat apis.

Closes #16975

* addressing pr comments

* changing value types back to original implementation and fixing cosmetic issues

* Changing compareTo, hashCode of value types to a better implementation

* Changed value compareTos to use Double.compare instead of if statements + fixed some failed unit tests
2016-10-11 12:29:22 -04:00