Commit Graph

1042 Commits

Author SHA1 Message Date
Simon Willnauer 0ffd99cca3 Drop commons-lang dependency
commons-lang really is only used by some core classes to join strings or modiy arrays.
It's not worth carrying the dependency. This commit removes the dependency on commons-lang
entirely.
2015-08-18 22:59:31 +02:00
Robert Muir e07f039659 Workaround JDK bug 8034057
This causes a FileSystemException when trying to retrieve FileStore for a path,
and falsely returns false for Files.isWritable

Squashed commit of the following:

commit d2cc0d966f3bc94aa836b316a42b3c5724bc01ef
Author: Robert Muir <rmuir@apache.org>
Date:   Tue Aug 18 15:49:48 2015 -0400

    fixes for the non-bogus comments

commit 6e0a272f5f8ef7358654ded8ff4ffc31831fa5c7
Author: Robert Muir <rmuir@apache.org>
Date:   Tue Aug 18 15:30:43 2015 -0400

    Fix isWritable too

commit 2a8764ca118fc4c950bfc60d0b97de873e0e82ad
Author: Robert Muir <rmuir@apache.org>
Date:   Tue Aug 18 14:49:50 2015 -0400

    try to workaround filestore bug
2015-08-18 16:44:57 -04:00
Igor Motov 509edefb04 Improve stability of restoreIndexWithMissingShards test
Replaced awaitBusy with assertBusy and increased the timeout.
2015-08-18 14:27:24 -04:00
Ryan Ernst 2a57539a28 Tweak exception message 2015-08-18 10:35:37 -07:00
Ryan Ernst a0c41218ff Merge branch 'master' into no_more_toe_stepping 2015-08-18 10:34:29 -07:00
Ryan Ernst a3afe57792 Fix compile failure from bad merge after renaming of
ExtensionPoint.TypeExtensionPoint
2015-08-18 10:32:12 -07:00
Ryan Ernst c0444ccbc6 Merge branch 'master' into module_culling3 2015-08-18 10:16:40 -07:00
Ryan Ernst 4c5cfd02cc Add javadocs to repository types registry methods 2015-08-18 10:13:01 -07:00
Ryan Ernst c3a22e6f0e Merge branch 'master' into construct_it_yourself 2015-08-18 09:50:47 -07:00
Ryan Ernst e61c5ce5c3 Fix naming problem with test plugin 2015-08-18 09:49:58 -07:00
Simon Willnauer 60f273c891 Suppress forbiddenAPI in logger when using localhost 2015-08-18 17:32:20 +02:00
Simon Willnauer 1e511eda28 Remove usage or `InetAddress#getLocalHost`
this method is very confusing and if it's used it's likely the wrong thing
with respect to the actual bound / published address. This change discourages
it's use and removes all useage. It's replaced with the actual published address
most of the time.
2015-08-18 16:48:34 +02:00
David Pilato 20851a4e4a Merge branch 'pr/shorten-artifactids' 2015-08-18 15:25:38 +02:00
javanna 501a1996a3 Query DSL: remove attemped (not working) support for array in not query parser
Closes #12890
2015-08-18 14:58:53 +02:00
javanna 8e93ac5d5c Java api: remove execution from TermsQueryBuilder as it has no effect
Also introduced ParseField for execution in TermsQueryParser so proper deprecation warnings get printed out when requested.

Closes #12884
2015-08-18 14:57:33 +02:00
David Pilato 692cc80523 [maven] also rename parent project artifactId
Also fixed bad scm links
2015-08-18 13:41:12 +02:00
David Pilato e19090b2ad [plugin] shorten plugin names
We can now simplify PluginHandle as `name` and `repo` are the same thing.
2015-08-18 13:41:12 +02:00
David Pilato 33e8fae824 [plugin] shorten plugin names
We don't need to prefix anymore plugin names with `elasticsearch-` or `es-`.
2015-08-18 13:41:12 +02:00
David Pilato 2c902a4d2f [maven] rename Elasticsearch names to Elasticsearch: 2015-08-18 13:38:49 +02:00
David Pilato 0bb9593596 Fix a typo in comment 2015-08-18 13:38:48 +02:00
javanna 3f04ee076e Internal: IndicesQueriesRegitry back to being created only once
With #12921 we refactored IndicesModule but we forgot to make sure we create IndicesQueriesRegistry once. IndicesQueriesModule used to do `bind(IndicesQueriesRegistry.class).asEagerSingleton();` otherwise we get multiple instances of the registry. This needs to be ported do the IndicesModule.
2015-08-18 13:04:30 +02:00
Martijn van Groningen e74f559fd4 parent/child: Explicitly disabled the query cache
It was already disabled, but during tests the test framework enabled the query cache by setting the static default query cache. The caching behaviour should be the same in production and in tests.
2015-08-18 12:56:37 +02:00
Adrien Grand c169386dd4 Merge pull request #12931 from jpountz/fix/murmur3_defaults
Move the `murmur3` field to a plugin and fix defaults.
2015-08-18 12:09:32 +02:00
Ryan Ernst dc1fa6736a Merged AbstractPlugin and Plugin. Also added Settings back to
indexModules and shardModules
2015-08-18 02:46:32 -07:00
Adrien Grand a91b3fcbb9 Move the `murmur3` field to a plugin and fix defaults.
This move the `murmur3` field to the `mapper-murmur3` plugin and fixes its
defaults so that values will not be indexed by default, as the only purpose
of this field is to speed up `cardinality` aggregations on high-cardinality
string fields, which only requires doc values.

I also removed the `rehash` option from the `cardinality` aggregation as it
doesn't bring much value (rehashing is cheap) and allowed to remove the
coupling between the `cardinality` aggregation and the `murmur3` field.

Close #12874
2015-08-18 11:41:52 +02:00
Martijn van Groningen 2b97f5d9eb Pass down the EngineConfig to IndexSearcherWrapper
If a new IndexSearcher gets created the engine config can be used to get the query cache and query cache policy from.
2015-08-18 10:41:24 +02:00
Ryan Ernst 2bf84593e0 Plugins: Simplify Plugin API for constructing modules
The Plugin interface currently contains 6 different methods for
adding modules. Elasticsearch has 3 different levels of injectors,
and for each of those, there are two methods. The first takes no
arguments and returns a collection of class objects to construct. The
second takes a Settings object and returns a collection of module
objects already constructed. The settings argument is unecessary because
the plugin can already get the settings from its constructor. Removing
that, the only difference between the two versions is returning an
already constructed Module, or a module Class, and there is no reason
the plugin can't construct all their modules themselves.

This change reduces the plugin api down to just 3 methods for adding
modules. Each returns a Collection<Module>. It also removes the
processModule method, which was unnecessary since onModule
implementations fullfill the same requirement. And finally, it renames
the modules() method to nodeModules() so it is clear these are created
once for each node.
2015-08-17 20:41:45 -07:00
Robert Muir 34635a4b4f Merge pull request #12951 from rmuir/more_networking_cleanup
Use preferIPv6Addresses for sort order, not preferIPv4Stack
2015-08-17 23:30:35 -04:00
Robert Muir 3ca12889e5 Use preferIPv6Addresses for sort order, not preferIPv4Stack
java.net.preferIPv6Addresses is a better choice. preferIPv4Stack is a nuclear option
and you just won't even bind to any IPv6 addresses. This reduces confusion.
2015-08-17 22:52:22 -04:00
Igor Motov 4114a8359d Improve stability of Snapshot/Restore test
The restore portion of some snapshot/restore test is failing randomly due to #9421. This change suspends rebalance during snapshot/restore operations until #9421 is fixed.

Closes #12855
2015-08-17 21:30:46 -04:00
Ryan Ernst 2e90be77ff Plugins: Ensure additionalSettings() do not conflict
Plugins can preovide additional settings to be added to the settings
provided in elasticsearch.yml. However, if two different plugins supply
the same setting key, the last one to be loaded wins, which is
indeterminate. This change enforces plugins cannot have conflicting
settings, at startup time. As a followup, we should do this when
installing plugins as well, to give earlier errors when two plugins
collide.
2015-08-17 17:01:00 -07:00
Ryan Ernst 6f124e6eec Internal: Simplify custom repository type setup
Custom repository types are registered through the RepositoriesModule.
Later, when a specific repository type is used, the RespositoryModule
is installed, which in turn would spawn the module that was
registered for that repository type. However, a module is not needed
here. Each repository type has two associated classes, a Repository and
an IndexShardRepository.

This change makes the registration method for custom repository
types take both of these classes, instead of a module.

See #12783.
2015-08-17 15:08:08 -07:00
Nicholas Knize ee227efc62 move integration test dependency file gzippedmap.gz from sources to resources 2015-08-17 16:49:25 -05:00
Simon Willnauer 8624022222 Print es.node.mode if integration tests fail 2015-08-17 22:50:54 +02:00
Nicholas Knize b2ba3847f7 Refactor geo_point validate* and normalize* options to ignore_malformed and coerce*
For consistency geo_point mapper's validate and normalize options are converted to ignore_malformed and coerced
2015-08-17 14:46:23 -05:00
Robert Muir 68307aa9f3 Fix network binding for ipv4/ipv6
When elasticsearch is configured by interface (or default: loopback interfaces),
bind to all addresses on the interface rather than an arbitrary one.

If the publish address is not specified, default it from the bound addresses
based on the following sort ordering:

* ipv4/ipv6 (java.net.preferIPv4Stack, defaults to true)
* ordinary addresses
* site-local addresses
* link local addresses
* loopback addresses

One one address is published, and multicast is still always over ipv4: these
need to be future improvements.

Closes #12906
Closes #12915

Squashed commit of the following:

commit 7e60833312f329a5749f9a256b9c1331a956d98f
Author: Robert Muir <rmuir@apache.org>
Date:   Mon Aug 17 14:45:33 2015 -0400

    fix java 7 compilation oops

commit c7b9f3a42058beb061b05c6dd67fd91477fd258a
Author: Robert Muir <rmuir@apache.org>
Date:   Mon Aug 17 14:24:16 2015 -0400

    Cleanup/fix logic around custom resolvers

commit bd7065f1936e14a29c9eb8fe4ecab0ce512ac08e
Author: Robert Muir <rmuir@apache.org>
Date:   Mon Aug 17 13:29:42 2015 -0400

    Add some unit tests for utility methods

commit 0faf71cb0ee9a45462d58af3d1bf214e8a79347c
Author: Robert Muir <rmuir@apache.org>
Date:   Mon Aug 17 12:11:48 2015 -0400

    localhost all the way down

commit e198bb2bc0d1673288b96e07e6e6ad842179978c
Merge: b55d092 b93a75f
Author: Robert Muir <rmuir@apache.org>
Date:   Mon Aug 17 12:05:02 2015 -0400

    Merge branch 'master' into network_cleanup

commit b55d092811d7832bae579c5586e171e9cc1ebe9d
Author: Robert Muir <rmuir@apache.org>
Date:   Mon Aug 17 12:03:03 2015 -0400

    fix docs, fix another bug in multicast (publish host = bad here!)

commit 88c462eb302b30a82585f95413927a5cbb7d54c4
Author: Robert Muir <rmuir@apache.org>
Date:   Mon Aug 17 11:50:49 2015 -0400

    remove nocommit

commit 89547d7b10d68b23d7f24362e1f4782f5e1ca03c
Author: Robert Muir <rmuir@apache.org>
Date:   Mon Aug 17 11:49:35 2015 -0400

    fix http too

commit 9b9413aca8a3f6397b5031831f910791b685e5be
Author: Robert Muir <rmuir@apache.org>
Date:   Mon Aug 17 11:06:02 2015 -0400

    Fix transport / interface code

    Next up: multicast and then http
2015-08-17 15:43:07 -04:00
Ryan Ernst 75ced057ed Fix changed class name after bad merge, see #12921 2015-08-17 12:14:01 -07:00
Ryan Ernst 52f3eb5898 Merge pull request #12921 from rjernst/module_culling2
Flatten IndicesModule and add tests
2015-08-17 12:08:17 -07:00
Nik Everett 4307e165c1 Tests: Make a test less flakey
EsExecutorsTests had a test that was failing spuriously due to threadpools
being threadpools. This weakens the assertions that the test makes to what
should always be true.
2015-08-17 08:20:18 -07:00
Simon Willnauer ea03e5dd17 Add build short hash to the download manager headers to identify staging builds
It might turn out to be useful to have the actual commit hash of the version we are
looking for if our download manager can just redirect to the right staging repository.
2015-08-17 15:17:45 +02:00
Tanguy Leroux 8e052f0da2 Make platform specific assumptions in OS & Process probes tests 2015-08-17 14:47:23 +02:00
Boaz Leskes e424701819 Merge pull request #12922 from xuzha/xu-network
Refactor, remove _node/network and _node/stats/network. 

Closes #12889 , Closes #12922
2015-08-17 14:46:05 +02:00
Boaz Leskes bb34b2fd85 Elasticsearch bootstrap help shouldn't mention plugins
We have a dedicated entry point for that.

Closes #12933
2015-08-17 14:36:13 +02:00
Boaz Leskes 6c4ef32160 Test: un-mute PluginManagerUnitTests.testSimplifiedNaming 2015-08-17 14:14:50 +02:00
Simon Willnauer 9608fe9dff Fix test - and don't use URL.equals() 2015-08-17 14:14:23 +02:00
Boaz Leskes cd9552eb07 Test: mute PluginManagerUnitTests.testSimplifiedNaming 2015-08-17 14:02:09 +02:00
Martijn van Groningen e649d96eb1 Merge pull request #12881 from martijnvg/allow_for_customable_query_cache
Allow a plugin to supply its own query cache implementation
2015-08-17 11:13:45 +02:00
Martijn van Groningen 5123167a99 test: added a unit test for #12261 2015-08-17 11:10:05 +02:00
Simon Willnauer e7d075f6ae Add elasticsearch version as a prefix for the staging URL
This is purely for maintainance reasons since it easier to see if we can drop
certain stageing urls if we have the version next to the hash.
I also removed the gpg passphrase from the example URL since it's better to get prompted?
2015-08-17 11:05:49 +02:00
Simon Willnauer 59f390f5d0 Endless recovery loop with `indices.recovery.file_chunk_size=0Bytes`
This is caused by sending the same file to the chunk handler with offset
`0` which in-turn opens a new outputstream and waits for bytes. But the next round
will send 0 bytes again with offset 0. This commit adds some checks / validators that those
settings are positive byte values and fixes the RecoveryStatus to throw an IAE if the same file
is opened twice.
2015-08-17 09:58:17 +02:00
Martijn van Groningen 12c40fa58a Allow plugins to register custom `QueryCache` implementations. 2015-08-17 09:55:32 +02:00
Adrien Grand 7765b0497d Merge pull request #12497 from oyiadom/master
Update BulkProcessor.java
2015-08-17 09:43:41 +02:00
Adrien Grand 1f2345db34 Merge pull request #12913 from xuzha/xu-exception
Validate class before cast.
2015-08-17 09:38:59 +02:00
Harish Kayarohanam 3976854ada Improve error handling of ClassCastException in terms aggregations.
What is the problem we are trying to solve ?
===========================================

When we are doing aggregations against a field name as shown in
https://github.com/HarishAtGitHub/elasticsearch-tester/blob/master/12135.py#L37-L46

search = {
           "aggs": {
             "NAME": {
               "terms": {
                 "field": "ip_str",
                 "size": 10
               }
             }
           }
         }
and when the field "ip_str" has values of different types in different indices
. say one is of type StringTerms type and other is of IP(LongTerms type) then
the aggregation fails as the types do not match(incompatible).
The failure throws a class cast exception as follows:
{
   "error": {
      "root_cause": [],
      "type": "reduce_search_phase_exception",
      "reason": "[reduce] ",
      "phase": "query",
      "grouped": true,
      "failed_shards": [],
      "caused_by": {
         "type": "class_cast_exception",
         "reason": "org.elasticsearch.search.aggregations.bucket.terms.LongTerms$Bucket cannot be cast to org.elasticsearch.search.aggregations.bucket.terms.StringTerms$Bucket"
      }
   },
   "status": 503
}

which is hard to understand . User cannot infer anything about the cause of the problem and what he should do from seeing the
class cast exception.

What can be the possible solution ?
===================================

Make the exception more readable by showing him the root cause of the problem so that he can
understand which area actually caused the problem, so that he can take necessary steps further.

Code Analysis
=============

Debugging code shows that:
the query /{indices}/_search?search_type=count involves two phases
1) search phase
***************
     searchService.sendExecuteQuery(...) [Ref: TransportSearchCountAction]

     what happens here ?
        the phase 1, which is the search phase goes without error.
        In this phase the shards for the given indexes are collected and the search is done on all asynchronously
        and finally collected in the variable "firstResults" and given to meger phase.

        [Flow: .... -> TransportSearchTypeAction -> method performFirstPhase]

2) merge phase
**************
     searchPhaseController.merge(...firstResults...) [Ref: TransportSearchCountAction]

     what happens here ?
        the "firstresults" QuerySearchResults are now to be aggregated and combined.

        [Flow: SearchPhaseController.merge(...) -> ..... -> InternalTerms.doReduce(...)]

the phase 1, which is the search phase goes without error.
The problem comes in phase 2, which is merge phase.
Now the individual term buckets are available.
As per the test case , there are two indices cast and cast2, so by default 10 shards.
cast has ip_str of type StringTerms
cast2 has ip_str of type ip which is actually LongTerms

so here two types of Buckets exist. StringTerms_Bucket and LongTerms_Bucket.
Now the aggregation is to be put inside the BucketPriorityQueue(size 2: as out of 10, 2 has hits) finally.
(docs of PriorityQueue: https://lucene.apache.org/core/4_4_0/core/org/apache/lucene/util/PriorityQueue.html#insertWithOverflow(T))

Now first the LongTerms$Bucket is put inside.
then the StringTerms$Bucket is to be put in.
This is the area where exception is thrown. What happens is when adding the StringTerms$Bucket now it has to
goes through the code "lessThan(element, heap[1])"
which finally calls

---------------------------------------------------------------------------------------------
|      StringTerms$Bucket.compareTerms(other)  <---------------- Area of exception          |
|                                                                                           |
--------------------------------------------------------------------------------------------

where when comparing one to other a type cast is done and it fails as StringTerms$Bucket and LongTerms$Bucket are
incompatible.

Approach to solve:
==================

The best way is to make user understand that the problem is when reducing/merging/aggregating the buckets which came as a result of
querying different shards, so that this will make them infer that the problem is because the values of the fields are of different types.
The message is also user friendly and much better than the indecipherable classcastexception.

The only place to infer correctly that the aggregation has failed is in the place where aggregations take place.
so

at InternalTerms.java -> (BucketPriorityQueue)ordered.insertWithOverflow(b);

so here I can throw AggregationExecutionException saying it is because the buckets are of different
types.

But when can I infer at this point that the failure is due to mismatch of types of buckets ???
it can be possible only if at this point it is informed that the problem which occurred deep inside
is due to buckets that were incomparable.
so from just a classCastException we cannot make such a pointed exact inference, because
as class cast exception can be due to a number of scenarios and at a number of places.

so unless we inform the exact problem to InternalTerms it will not be able to infer properly.
so infer the classCastException at the compareTerms function itself that it is a IncomparableTermBucktesTypeException.
This is the best place to infer classCastException as this the place which generated the exception.
Best inference of exceptions can be done only at the source/origin of the exception.

so IncomparableTermBucktesTypeException to InternalTerms-> will make it infer and conclude on why
aggregation failed and give best information to user.

Close #12821
2015-08-17 09:35:32 +02:00
xuzha 7624ae4f96 There is no longer a network section in the nodes info and stats
requests. Remove _node/network and _node/stats/network

closes #12889
2015-08-16 19:34:04 -07:00
Ryan Ernst 2450e3ccc8 Internal: Flatten IndicesModule and add tests
The IndicesModule was made up of two submodules, one which
handled registering queries, and the other for registering
hunspell dictionaries. This change moves those into
IndicesModule. It also adds a new extension point type,
InstanceMap. This is simply a Map<K,V>, where K and V are
actual objects, not classes like most other extension points.
I also added a test method to help testing instance map extensions.
This was particularly painful because of how guice binds the key
and value as separate bindings, and then reconstitutes them
into a Map at injection time. In order to gain access to the
object which links the key and value, I had to tweak our
guice copy to not use an anonymous inner class for the Provider.

Note that I also renamed the existing extension point types, since
they were very redundant. For example, ExtensionPoint.MapExtensionPoint
is now ExtensionPoint.ClassMap.

See #12783.
2015-08-16 17:56:35 -07:00
Martijn van Groningen 532806af1a inner hits: Use provided StreamContext instead of fetching a new one.
Closes #12905
2015-08-16 23:39:31 +02:00
Ryan Ernst 9974b79c8a Merge pull request #12916 from rjernst/module_culling
Flatten ClusterModule and add more tests
2015-08-16 10:08:40 -07:00
Simon Willnauer 5ab0833990 Don't swallow cause if Store stats can't be build 2015-08-16 16:36:22 +02:00
Simon Willnauer 5699492575 Merge pull request #12917 from HarishAtGitHub/refactorprocessFirstPhase
Refactor - shard variable dependency from processFirstPhaseResults as shard is no more needed
2015-08-16 16:21:13 +02:00
Simon Willnauer 606f5b368b mute the entire InnerHitsIT - Relates to #12905 2015-08-16 16:08:32 +02:00
Harish Kayarohanam 8122243ee7 this is a small commit to remove the
shard variable dependency from processFirstPhaseResults as shard is no more
needed here . it only deals with the results obtained from the synchronous search on each shard.
2015-08-16 17:10:25 +05:30
Ryan Ernst 008dc8ec31 Internal: Flatten ClusterModule and add more tests
The ClusterModule contained a couple submodules. This moves the
functionality from those modules into ClusterModule. Two of those
had to do with DynamicSettings. This change also cleans up
how DynamicSettings are built, and enforces they are added, with
validators, in ClusterModule.

See #12783.
2015-08-16 01:23:05 -07:00
xuzha 062e038360 Throw IllegalArgumentException instead of ClassCastException,
Let stats aggregation returns 400 error when performed over an invalid field

closes #12842
2015-08-15 15:42:03 -07:00
Simon Willnauer 20f6b41337 Mute InnerHitsIT Relates to #12905 2015-08-15 08:41:28 +02:00
Simon Willnauer b447e2ae99 Move master to [2.1.0-SNAPSHOT] 2015-08-14 23:44:06 +02:00
Jason Tedor 6292bc07f9 Merge pull request #12892 from jasontedor/fix/12865
Validate settings specified in index templates at template creation time
2015-08-14 15:43:16 -06:00
Jason Tedor b88d2f6255 Validate settings specified in index templates at template creation time
Previously settings specified in index templates were not validated upon
template creation. Creating an index from an index template with invalid
settings could lead to cluster stability issues because creation of such
indexes would bypass index settings validation.

This commit adds validation of settings specified in index templates at
template creation time. This works by routing the index template
settings through the index settings validation mechanism.

Closes #12865
2015-08-14 15:23:10 -06:00
Ryan Ernst 33690b990a Merge pull request #12872 from rjernst/resolve_your_own_config
Remove Environment.resolveConfig
2015-08-14 13:56:32 -07:00
Simon Willnauer 03ceabb1da Merge pull request #12894 from s1monw/fix_repro_line
Fix reproduction line to include project filters
2015-08-14 22:52:55 +02:00
Lee Hinman 6f5a25d98e [DOC] Use 127.0.0.1 instead of localhost in READMEs
Users with IPv6 preferred over IPv4 may have `localhost` resolve to
`::1` instead of `127.0.0.1`, so we should be explicit so they don't run
into issues.
2015-08-14 14:47:58 -06:00
Martijn van Groningen 942d040f45 inner hits: Reset the `ShardTargetType` after serializing inner hits.
This fixes a bug where only the first top level search hit has a shard target and any subsequent search hits don't.
2015-08-14 22:38:12 +02:00
Lee Hinman 1b9877bb65 Use Java 7 version of Files.readAllLines instead of Java 8 version 2015-08-14 14:36:17 -06:00
Lee Hinman d35a3a37eb Also catch NoSuchFileException 2015-08-14 13:54:14 -06:00
Lee Hinman 33f118e9c8 Print out the name of the sum that failed 2015-08-14 13:51:47 -06:00
Simon Willnauer bba34de6b3 Fix reproduction line to include project filters
Today on a failure the reproduce line printed out by the test framework
will build all projects and might fail if the test class is not present.
This commit adds a reactor filter to the reproduction line to ensure
unrelated projects are skipped.

Closes #12838
2015-08-14 21:36:49 +02:00
Ryan Ernst 867f056cf6 Simplify random name index and move method to its only user 2015-08-14 11:22:20 -07:00
Christoph Büscher 407781e76a Adding comments to test 2015-08-14 18:42:45 +02:00
Lee Hinman 41d8b552e6 Validate checksums for plugins if available
When a plugin is downloaded, this change additionally tries to download
`${pluginurl}.sha1` and verify the SHA1 checksum for the file. If no
.sha1 file is found, it tries `${pluginurl}.md5`.

Note that if neither checksum file is found, a notice is printed but the
plugin can still be installed. If the checksum check fails, the plugin
install is aborted.

Example output if no checksums are available:

```
bin/plugin install elasticsearch/elasticsearch-analysis-icu/2.6.0-SNAPSHOT
-> Installing elasticsearch/elasticsearch-analysis-icu/2.6.0-SNAPSHOT...
Trying http://download.elastic.co/elasticsearch/elasticsearch-analysis-icu/elasticsearch-analysis-icu-2.6.0-SNAPSHOT.zip ...
Trying http://search.maven.org/remotecontent?filepath=elasticsearch/elasticsearch-analysis-icu/2.6.0-SNAPSHOT/elasticsearch-analysis-icu-2.6.0-SNAPSHOT.zip ...
Trying https://oss.sonatype.org/service/local/repositories/releases/content/elasticsearch/elasticsearch-analysis-icu/2.6.0-SNAPSHOT/elasticsearch-analysis-icu-2.6.0-SNAPSHOT.zip ...
Trying https://github.com/elasticsearch/elasticsearch-analysis-icu/archive/2.6.0-SNAPSHOT.zip ...
Trying https://github.com/elasticsearch/elasticsearch-analysis-icu/archive/master.zip ...
Downloading .....................................DONE
Verifying https://github.com/elasticsearch/elasticsearch-analysis-icu/archive/master.zip checksums if available ...
NOTE: Unable to verify checksum for downloaded plugin (unable to find .sha1 or .md5 file to verify)
```

Example output if checksums are available:

```
bin/plugin install elasticsearch/elasticsearch-analysis-icu/2.6.0-SNAPSHOT
-> Installing elasticsearch/elasticsearch-analysis-icu/2.6.0-SNAPSHOT...
Trying http://download.elastic.co/elasticsearch/elasticsearch-analysis-icu/elasticsearch-analysis-icu-2.6.0-SNAPSHOT.zip ...
Trying http://search.maven.org/remotecontent?filepath=elasticsearch/elasticsearch-analysis-icu/2.6.0-SNAPSHOT/elasticsearch-analysis-icu-2.6.0-SNAPSHOT.zip ...
Trying https://oss.sonatype.org/service/local/repositories/releases/content/elasticsearch/elasticsearch-analysis-icu/2.6.0-SNAPSHOT/elasticsearch-analysis-icu-2.6.0-SNAPSHOT.zip ...
Trying https://github.com/elasticsearch/elasticsearch-analysis-icu/archive/2.6.0-SNAPSHOT.zip ...
Trying https://github.com/elasticsearch/elasticsearch-analysis-icu/archive/master.zip ...
Downloading .....................................DONE
Verifying https://github.com/elasticsearch/elasticsearch-analysis-icu/archive/master.zip checksums if available ...
Downloading .DONE
```

Example output if checksums fail:

```
bin/plugin install elasticsearch/elasticsearch-analysis-kuromoji/2.5.0 -url http://localhost:8000/elasticsearch-analysis-kuromoji-2.5.0.zip
-> Installing elasticsearch/elasticsearch-analysis-kuromoji/2.5.0...
Trying http://localhost:8000/elasticsearch-analysis-kuromoji-2.5.0.zip ...
Downloading .............................................DONE
Verifying http://localhost:8000/elasticsearch-analysis-kuromoji-2.5.0.zip checksums if available ...
Downloading .DONE
ERROR: incorrect hash, file hash: [dbdc9c2cd32782054497a21fbdcae3ca1ff23c80], expected: [dbdc9c2cd32782054497a21fbdcae3ca1ff23c80-bad]
```

Resolves #12750
2015-08-14 10:40:40 -06:00
Alexander Reelsen 0240b581e7 PluginManager: Fix automatically generated URLs for official plugins
In order to match the paths of official plugins, we need to fix
the broken test by removing the elasticsearch prefix from the official
plugin names before testing.
2015-08-14 18:28:54 +02:00
Igor Motov e44991d2ef Mute test SharedClusterSnapshotRestoreIT#renameOnRestoreTest
Working on the fix
2015-08-14 12:12:53 -04:00
Christoph Büscher e01c0927a6 Aggregations: Make ValueParser.DateMath aware of timezone setting
This PR adds a timezone field to ValueParser.DateMath that is
set to UTC by default but can be set using the existing constructors.
This makes it possible for extended bounds setting in DateHistogram
to also use date math expressions that e.g. round by day and apply
this rounding in the time zone specified in the date histogram
aggregation request.

Closes #12278
2015-08-14 18:11:39 +02:00
Simon Willnauer 4c1ef2c943 Fix test to also include the mapper-size 2015-08-14 18:11:27 +02:00
Simon Willnauer 30692fe917 Add mapper-size to plugin list 2015-08-14 18:04:45 +02:00
Martijn van Groningen 0688dddebf Also delegate rewrite the the wrapped IndexSearcher.
In the the AssertingIndexSearcher is used we then also have extra validation when rewritting the query.
2015-08-14 16:34:04 +02:00
Adrien Grand 2fecc7e5c9 Merge pull request #12875 from jpountz/fix/dumber_context_indexsearcher
Simplify ContextIndexSearcher.
2015-08-14 15:42:23 +02:00
Alexander Reelsen cedbd20f2c PluginManager: Change staging URL to reflect S3 bucket
In order to create releases without actually changing the version
as part of a commit, we also need to reflect the path of the potentially
changing S3 repo.
2015-08-14 15:23:31 +02:00
Adrien Grand b3e7146b22 Simplify ContextIndexSearcher.
In particular this commit moves collector wrapping logic from
ContextIndexSearcher to QueryPhase.
2015-08-14 15:03:38 +02:00
Ryan Ernst f3d63095db Merge branch 'master' into resolve_your_own_config
Conflicts:
	core/src/main/java/org/elasticsearch/env/Environment.java
	core/src/test/java/org/elasticsearch/index/analysis/commongrams/CommonGramsTokenFilterFactoryTests.java
	core/src/test/java/org/elasticsearch/index/analysis/synonyms/SynonymsAnalysisTest.java
	plugins/analysis-kuromoji/src/test/java/org/elasticsearch/index/analysis/KuromojiAnalysisTests.java
2015-08-14 03:34:26 -07:00
Ryan Ernst be638fb6ef Internal: Remove Environment.resolveConfig
This method has multiple modes of resolving config files by
first looking in the config directory, then on the classpath,
and finally by prefixing with "config/" on the classpath.

Most of the places taking advantage of this were tests, so they
did not have to setup a real home dir with config. The only place
that was really relying on it was the code which loads names.txt
to randomly choose a node name.

This change fixes test to setup fake home dirs with their config
files. It also makes the logic for finding names.txt explicit:
look in config dir, and if it doesn't exist, load /config/names.txt
from the classpath.
2015-08-14 03:03:47 -07:00
javanna 4010e7e9a7 Java api: restore support for minimumShouldMatch and disableCoord in TermsQueryBuilder
TermsQueryParser still parses those values although deprecated. These need to be present in the java api as well to get ready for the query refactoring, where the builders are the intermediate query format that we parse our json queries into. Whatever the parser supports need to be supported by the builder as well.

Closes #12870
2015-08-14 11:17:19 +02:00
javanna 2e0b548b06 Java api: remove support for lookup cache in TermsLooukpBuilder
TermsQueryParser doesn't support the cache field anymore, so if it gets set through java api, the subsequent parsing of that query will throw error

Relates to #12870
2015-08-14 11:16:55 +02:00
Ryan Ernst 470f5370b9 Merge pull request #12868 from rjernst/bye_bye_classloaders
Remove ClassLoader from Settings
2015-08-14 02:15:07 -07:00
Alexander Reelsen 0f3ada159e Release: Create pre release script
Refactored a part out of the release script, so the user can
change the version locally as well as move the documentation
and change the Version.java

The background of this change is to have a very simple release
process that puts stuff into a staging environment, so the beta
release can be tested, before it is officially released.

This means the build_release script can be removed soon.
2015-08-14 11:04:32 +02:00
Ryan Ernst 6dcfda99e8 Internal: Remove ClassLoader from Settings
Settings currently has a classloader member, which any user (plugin
or core ES code) can access to load classes/resources. This is extremely
error prone as setting the classloder on the Settings instance is a
public method. Furthermore, it is not really necessary. Classes that
need resources should load resources using normal means
(getClass().getResourceAsStream). Those that need classes
should use Class.forName, which will load the class with the
same classloader as the calling class. This means, in the few
places where classes are loaded by string name, they will use
the appropriate loader: either the default classloader which loads
core ES code, or a child classloader for each plugin.

This change removes the classloader member from Settings, as
well as other classloader related uses (except for a handful
of cases which must use a classloader, at least for now).
2015-08-13 23:55:27 -07:00
Ryan Ernst dcf3f4679f Fourth time, for real, last mock -> test jar 2015-08-13 19:40:31 -07:00
Ryan Ernst c16772b0fc Undo accidental commit of crap
This reverts commit 589eecf55d.
2015-08-13 19:39:55 -07:00
Ryan Ernst 589eecf55d Fourth time's a charm, one more mock class to add to test jar 2015-08-13 19:36:53 -07:00
Ryan Ernst d7da6e673f One more mock rule needed for test jar 2015-08-13 16:28:38 -07:00
Ryan Ernst a89ea15b41 Add more mock classes to test jar 2015-08-13 15:32:03 -07:00
Ryan Ernst c4f8c333ec Fix test jar to contain Mock classes that were moved in 71a3bdb 2015-08-13 15:17:22 -07:00
Ryan Ernst dc1a2d2e5a Merge branch 'master' into fix/12784 2015-08-13 14:35:48 -07:00
Ryan Ernst 9f64c75391 Remove leftover classes 2015-08-13 14:33:11 -07:00
Ryan Ernst ccef0551ef Tests: Refactor classes only plugged in by tests to use package private extension points
We previous used something like Class.forName to load mock classes,
where tests would set a setting that was *supposed* to only be used by
tests. This change make these impls package private so that only tests
can change out these implementations, through test plugins.

closes #12784
2015-08-13 13:52:55 -07:00
Simon Willnauer 1f41a8c682 Don't cache percolator query on loading percolators
No need to load catch this query since it's cheap and not reused.
If we cache it, it can cause assertions to be tripped since this
method is executed during postRecovery phase and might still run while
nodes are shutdown in tests.
2015-08-13 22:27:14 +02:00
David Pilato 4e23fe2657 [build] revert maven 3.3.x fix
We need to revert #12803 as it creates some troubles in IntelliJ and also might fail when using older elasticsearch versions.
2015-08-13 15:21:06 +02:00
Adrien Grand 75d84631da Merge pull request #12833 from saschamarkus/saschamarkus_issue_11510_rebase
Throw Exception for missing settings file
2015-08-13 14:26:03 +02:00
Simon Willnauer 74f18d8c16 Introduce a formal ExtensionPoint class to stream line extensions
This commit tries to add some infrastructure to streamline how extension
points should be strucutred. It's a simple approache with 4 implementations
for `highlighter`, `suggester`, `allocation_decider` and `shards_allocator`.
It simplifies adding new extension points and forces to register classes instead
of strings.
2015-08-13 13:47:11 +02:00
David Pilato fbd8f69273 Build of QA: Smoke Test Shaded Jar fails under maven 3.3.x
Build fails with maven 3.3.1 and 3.3.3. To reproduce, install one of the 3.3.x versions of maven and run `mvn clean verify` in the root directory of the project. The build will fail in the QA: Smoke Test Shaded Jar module with the following error:

```
Started J0 PID(99979@flea.local).
Suite: org.elasticsearch.shaded.test.ShadedIT
  2> NOTE: reproduce with: ant test  -Dtestcase=ShadedIT -Dtests.method=testJodaIsNotOnTheCP -Dtests.seed=2F4D23A7462CF921 -Dtests.locale= -Dtests.timezone=Asia/Baku -Dtests.asserts=true -Dtests.file.encoding=UTF-8
FAILURE 0.06s | ShadedIT.testJodaIsNotOnTheCP <<<
  > Throwable #1: junit.framework.AssertionFailedError: Expected an exception but the test passed: java.lang.ClassNotFoundException
  > at __randomizedtesting.SeedInfo.seed([2F4D23A7462CF921:3A9404F1F69FD80]:0)
  > at junit.framework.Assert.fail(Assert.java:57)
  > at java.lang.Thread.run(Thread.java:745)
  2> NOTE: reproduce with: ant test  -Dtestcase=ShadedIT -Dtests.method=testGuavaIsNotOnTheCP -Dtests.seed=2F4D23A7462CF921 -Dtests.locale= -Dtests.timezone=Asia/Baku -Dtests.asserts=true -Dtests.file.encoding=UTF-8
FAILURE 0.01s | ShadedIT.testGuavaIsNotOnTheCP <<<
  > Throwable #1: junit.framework.AssertionFailedError: Expected an exception but the test passed: java.lang.ClassNotFoundException
  > at __randomizedtesting.SeedInfo.seed([2F4D23A7462CF921:C2502FD54D83433D]:0)
  > at junit.framework.Assert.fail(Assert.java:57)
  > at java.lang.Thread.run(Thread.java:745)
  2> NOTE: reproduce with: ant test  -Dtestcase=ShadedIT -Dtests.method=testjsr166eIsNotOnTheCP -Dtests.seed=2F4D23A7462CF921 -Dtests.locale= -Dtests.timezone=Asia/Baku -Dtests.asserts=true -Dtests.file.encoding=UTF-8
FAILURE 0.01s | ShadedIT.testjsr166eIsNotOnTheCP <<<
  > Throwable #1: junit.framework.AssertionFailedError: Expected an exception but the test passed: java.lang.ClassNotFoundException
  > at __randomizedtesting.SeedInfo.seed([2F4D23A7462CF921:35593286F4269392]:0)
  > at junit.framework.Assert.fail(Assert.java:57)
  > at java.lang.Thread.run(Thread.java:745)
  2> NOTE: leaving temporary files on disk at: /Users/Shared/Jenkins/Home/workspace/elasticsearch-master/qa/smoke-test-shaded/target/J0/temp/org.elasticsearch.shaded.test.ShadedIT_2F4D23A7462CF921-001
  2> NOTE: test params are: codec=CheapBastard, sim=DefaultSimilarity, locale=, timezone=Asia/Baku
  2> NOTE: Mac OS X 10.10.4 x86_64/Oracle Corporation 1.8.0_25 (64-bit)/cpus=8,threads=1,free=482137936,total=514850816
  2> NOTE: All tests run in this JVM: [ShadedIT]
Completed [1/1] in 6.61s, 5 tests, 3 failures <<< FAILURES!

Tests with failures:
  - org.elasticsearch.shaded.test.ShadedIT.testJodaIsNotOnTheCP
  - org.elasticsearch.shaded.test.ShadedIT.testGuavaIsNotOnTheCP
  - org.elasticsearch.shaded.test.ShadedIT.testjsr166eIsNotOnTheCP
```
Please note that build doesn't fail with maven 3.2.x and it doesn't fail if mvn command is executed inside the qa/smoke-test-shaded directory. Only when the build is started from the root directory the error above can be observed.

The reason is because of the shaded version which depends on elasticsearch core.
When Maven build the module only, then elasticsearch core is not added to the dependency tree.

```sh
mvn dependency:tree -pl :smoke-test-shaded
```

```
[INFO] --- maven-dependency-plugin:2.8:tree (default-cli) @ smoke-test-shaded ---
[INFO] org.elasticsearch.qa:smoke-test-shaded:jar:2.0.0-beta1-SNAPSHOT
[INFO] +- org.elasticsearch.distribution.shaded:elasticsearch:jar:2.0.0-beta1-SNAPSHOT:compile
[INFO] |  +- org.apache.lucene:lucene-core:jar:5.2.1:compile
[INFO] |  +- org.apache.lucene:lucene-backward-codecs:jar:5.2.1:compile
[INFO] |  +- org.apache.lucene:lucene-analyzers-common:jar:5.2.1:compile
[INFO] |  +- org.apache.lucene:lucene-queries:jar:5.2.1:compile
[INFO] |  +- org.apache.lucene:lucene-memory:jar:5.2.1:compile
[INFO] |  +- org.apache.lucene:lucene-highlighter:jar:5.2.1:compile
[INFO] |  +- org.apache.lucene:lucene-queryparser:jar:5.2.1:compile
[INFO] |  +- org.apache.lucene:lucene-sandbox:jar:5.2.1:compile
[INFO] |  +- org.apache.lucene:lucene-suggest:jar:5.2.1:compile
[INFO] |  +- org.apache.lucene:lucene-misc:jar:5.2.1:compile
[INFO] |  +- org.apache.lucene:lucene-join:jar:5.2.1:compile
[INFO] |  +- org.apache.lucene:lucene-grouping:jar:5.2.1:compile
[INFO] |  +- org.apache.lucene:lucene-spatial:jar:5.2.1:compile
[INFO] |  \- com.spatial4j:spatial4j:jar:0.4.1:compile
[INFO] +- org.hamcrest:hamcrest-all:jar:1.3:test
[INFO] \- org.apache.lucene:lucene-test-framework:jar:5.2.1:test
[INFO]    +- org.apache.lucene:lucene-codecs:jar:5.2.1:test
[INFO]    +- com.carrotsearch.randomizedtesting:randomizedtesting-runner:jar:2.1.16:test
[INFO]    +- junit:junit:jar:4.11:test
[INFO]    \- org.apache.ant🐜jar:1.8.2:test
```

But if shaded plugin is involved during the build, it modifies the `projectArtifactMap`:

```sh
mvn dependency:tree -pl org.elasticsearch.distribution.shaded:elasticsearch,:smoke-test-shaded
```

```
[INFO] --- maven-dependency-plugin:2.8:tree (default-cli) @ smoke-test-shaded ---
[INFO] org.elasticsearch.qa:smoke-test-shaded:jar:2.0.0-beta1-SNAPSHOT
[INFO] +- org.elasticsearch.distribution.shaded:elasticsearch:jar:2.0.0-beta1-SNAPSHOT:compile
[INFO] |  \- org.elasticsearch:elasticsearch:jar:2.0.0-beta1-SNAPSHOT:compile
[INFO] |     +- org.apache.lucene:lucene-backward-codecs:jar:5.2.1:compile
[INFO] |     +- org.apache.lucene:lucene-analyzers-common:jar:5.2.1:compile
[INFO] |     +- org.apache.lucene:lucene-queries:jar:5.2.1:compile
[INFO] |     +- org.apache.lucene:lucene-memory:jar:5.2.1:compile
[INFO] |     +- org.apache.lucene:lucene-highlighter:jar:5.2.1:compile
[INFO] |     +- org.apache.lucene:lucene-queryparser:jar:5.2.1:compile
[INFO] |     |  \- org.apache.lucene:lucene-sandbox:jar:5.2.1:compile
[INFO] |     +- org.apache.lucene:lucene-suggest:jar:5.2.1:compile
[INFO] |     |  \- org.apache.lucene:lucene-misc:jar:5.2.1:compile
[INFO] |     +- org.apache.lucene:lucene-join:jar:5.2.1:compile
[INFO] |     |  \- org.apache.lucene:lucene-grouping:jar:5.2.1:compile
[INFO] |     +- org.apache.lucene:lucene-spatial:jar:5.2.1:compile
[INFO] |     |  \- com.spatial4j:spatial4j:jar:0.4.1:compile
[INFO] |     +- com.google.guava:guava:jar:18.0:compile
[INFO] |     +- com.carrotsearch:hppc:jar:0.7.1:compile
[INFO] |     +- joda-time:joda-time:jar:2.8:compile
[INFO] |     +- org.joda:joda-convert:jar:1.2:compile
[INFO] |     +- com.fasterxml.jackson.core:jackson-core:jar:2.5.3:compile
[INFO] |     +- com.fasterxml.jackson.dataformat:jackson-dataformat-smile:jar:2.5.3:compile
[INFO] |     +- com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:jar:2.5.3:compile
[INFO] |     |  \- org.yaml:snakeyaml:jar:1.12:compile
[INFO] |     +- com.fasterxml.jackson.dataformat:jackson-dataformat-cbor:jar:2.5.3:compile
[INFO] |     +- io.netty:netty:jar:3.10.3.Final:compile
[INFO] |     +- com.ning:compress-lzf:jar:1.0.2:compile
[INFO] |     +- com.tdunning:t-digest:jar:3.0:compile
[INFO] |     +- org.hdrhistogram:HdrHistogram:jar:2.1.6:compile
[INFO] |     +- org.apache.commons:commons-lang3:jar:3.3.2:compile
[INFO] |     +- commons-cli:commons-cli:jar:1.3.1:compile
[INFO] |     \- com.twitter:jsr166e:jar:1.1.0:compile
[INFO] +- org.hamcrest:hamcrest-all:jar:1.3:test
[INFO] \- org.apache.lucene:lucene-test-framework:jar:5.2.1:test
[INFO]    +- org.apache.lucene:lucene-codecs:jar:5.2.1:test
[INFO]    +- org.apache.lucene:lucene-core:jar:5.2.1:compile
[INFO]    +- com.carrotsearch.randomizedtesting:randomizedtesting-runner:jar:2.1.16:test
[INFO]    +- junit:junit:jar:4.11:test
[INFO]    \- org.apache.ant🐜jar:1.8.2:test
```

A fix could consist of fixing something on Maven side. Probably something changed in a recent version and introduced this "issue" but it might be not really an issue. More a fix.

There are two workarounds:

1) exclude manually elasticsearch core from shaded version in smoke-test-shaded module and add manually each lucene lib needed by elasticsearch

2) add a new `elasticsearch-lucene` (lucene) POM module which simply declares all needed lucene libs in subprojects (such as the smoke tester one).

I choose the later.

Closes #12791.
2015-08-13 12:15:19 +02:00
Colin Goodheart-Smithe a9a4903a0a Aggregations: Removed unused factor parameter in DateHistogramBuilder
DateHistogramParser does not recognise this parameter and therefore setting it would throw an exception as noted in https://github.com/elastic/elasticsearch/issues/6490. It is also not documented.
2015-08-13 09:47:05 +01:00
Lee Hinman ae7a73dc1c [TEST] Skip counting ExtraFS files when asserting path is cleared 2015-08-12 16:47:27 -06:00
Lee Hinman b58970a3fe [TEST] Remove custom data path tests, replace with better tests
Replace with a better, "unit-y" tests that couple the shared data path
with the correctly set `path.shared_data` configuration setting
2015-08-12 16:05:38 -06:00
Lee Hinman 0cb3e21a3e [TEST] mark tests in IndicesCustomDataPathIT with AwaitsFix 2015-08-12 15:44:19 -06:00
Simon Willnauer 605253a39f Cut over master to 2.0.0-SNAPSHOT 2015-08-12 21:16:08 +02:00
Lee Hinman 79d1568b58 Remove the `node.enable_custom_paths` setting
This setting is useless now that we have the `path.shared_data` setting.

Resolves #12776
2015-08-12 12:23:05 -06:00
Lee Hinman ff5ad39c7a Add `path.shared_data`
This allows `path.shared_data` to be added to the security manager while
still allowing a custom `data_path` for indices using shadow replicas.

For example, configuring `path.shared_data: /tmp/foo`, then created an
index with:

```
POST /myindex
{
  "index": {
    "number_of_shards": 1,
    "number_of_replicas": 1,
    "data_path": "/tmp/foo/bar/baz",
    "shadow_replicas": true
  }
}
```

The index will then reside in `/tmp/foo/bar/baz`.

`path.shared_data` defaults to `null` if not specified.

Resolves #12714
Relates to #11065
2015-08-12 10:51:46 -06:00
Simon Willnauer fe3179d9cc Return `408 REQUEST_TIMEOUT` if `_cluster/health` times out
Today we return `200 OK` which is misleading since we really didn't
produce a valid response / didn't wait long enough.
2015-08-12 17:51:20 +02:00
Martijn van Groningen 777921dfb0 test: simplified percolator recovery tests 2015-08-12 16:51:27 +02:00
Simon Willnauer ed9eef92dd [TEST] Fix off-by-one bug in corruptFile util function
The upper bound must be 0-based since we are corrupting an offset into
the file but it can be a 1-based length of the file which results in an
uncorrupted file.
2015-08-12 16:43:31 +02:00
Nik Everett e4e60774c1 Merge pull request #12787 from nik9000/configured_plugin
QA: Add configuration to the jvm-example plugin
2015-08-12 07:36:34 -07:00
saschamarkus e59bbf8e31 Issue 11510: Throw Exception for missing settings file
An Exception will be thrown when the givven YAML-file doesn't exist.
2015-08-12 15:13:03 +02:00
Tanguy Leroux 03c327ff12 Expose ClassloadingMXBean in Node Stats
Closes #12738
2015-08-12 14:29:13 +02:00
Konrad Beiske 44c667dac6 Merge pull request #12828 from s1monw/allow_master_elect_extension
Expose zen ElectMasterService as a Discovery extension point
2015-08-12 13:40:13 +02:00
Simon Willnauer fcb0427ed1 Expose zen ElectMasterService as a Discovery extension point
Some users need to override ElectMasterService from zen to add functionality
inside their infrastructure. This commit allows to extend it.
2015-08-12 13:00:51 +02:00
Colin Goodheart-Smithe 73c5c8fe79 Search: Split SearchModule.configure() into separate methods
This change splits SearchModule.configure() contents into separate methods so that sub-class of it (e.g. tests) can use only the parts they require
2015-08-12 12:00:14 +01:00
Adrien Grand 88da485015 Tests: Allow REST tests to run over https.
This adds new settings to the REST client, so that tests can be run over SSL
and optionally use an alternate truststore.
2015-08-12 11:46:57 +02:00
Simon Willnauer 6316718ae0 Flatten SearchService and clean up build-in registration
Relates to #12783
2015-08-12 09:01:09 +02:00
Jason Tedor 3b2f28fbe1 Reflect renaming of base test class 2015-08-11 23:58:03 -07:00
Jason Tedor d56dc7899d Merge pull request #12561 from jasontedor/feature/12560
Disallow type names to start with dots for new indices except for .percolator
2015-08-11 23:40:11 -07:00
Jason Tedor f9da6036a2 Disallow type names to start with dots for new indices except for .percolator
This commit will disallow type names to start with dots for version 2 and later indices except for .percolator.

Closes #12560
2015-08-11 23:34:41 -07:00
Ryan Ernst 1c5b49403b Fix type checking to work with java 7 2015-08-11 23:11:54 -07:00
Ryan Ernst 41af2ca75f Make module testcase abstract to appease test naming convetion checks 2015-08-11 22:17:38 -07:00
Ryan Ernst a4a43ea9ae Fix missing license headers 2015-08-11 22:03:47 -07:00
Ryan Ernst 50ba3bcdd6 Internal: Flatten Allocation modules and add back ability to plugin ShardsAllocators
There were two submodules of AllocationModule. This combines them into a
single module, adds a base test case for module testing, and adds back
the ability for plugins to provide custom ShardsAllocators.

closes #12781
2015-08-11 20:49:07 -07:00
Nik Everett 79d9f5b775 Logging: Log less source in slowlog
Instead of logging the entire `_source` in the indexing slowlog we log by
default just the first 1000 characters - this is controlled by the
`index.indexing.slowlog.source` settings and can be set to `true` to log the
whole `_source`, `false` to log none of it, and a number to log at most that
many characters.

Closes #4485
2015-08-11 13:16:04 -07:00
Ryan Ernst 57549a8133 Mappings: Validate parsed document does not have trailing garbage that is invalid json
This remerges PR #11414. The added validation for trailing garbage is
now only done when the parse method created the parser.
2015-08-11 10:42:18 -07:00
Ryan Ernst 80cca9e7ad Merge pull request #12779 from rjernst/fix/12753
Fix field type compatiblity check to work when only one previous type exists
2015-08-11 10:24:47 -07:00
Adrien Grand 99f4f09b84 Merge pull request #12756 from keety/terms_query_disable_coord
Add support for `disable_coord` param to `terms` query
2015-08-11 16:13:58 +02:00
Simon Willnauer 9c6ed8c238 Merge pull request #12260 from s1monw/issues/12239
Include stacktrace in rendered exceptions
2015-08-11 12:55:33 +02:00
javanna db7219901d simple query string: remove (not working) support for alternate formats
Removed attempt of parsing of `field` rather than `fields` and attempted support of the following syntax:

```
{
  "simple_query_string": {
    "body" : {
      "query": "foo bar"
    }
  }
}
```

Both these two syntaxes were undocumented, untested and not working.

Added test for case when `fields` is not specified, then the default field is queried.

Closes #12794
Closes #12798
2015-08-11 12:54:26 +02:00
Simon Willnauer ca20282e84 Include stacktrace in rendered exceptions
This commit includes the stacktrace into the structured exception rendering
to ensure we can find the reason / cause for certain things quicker. This
is enabled by default and is very verbose. Users can disable it via `rest.exception.stacktrace.skip = true|false`

Closes #12239
2015-08-11 11:55:59 +02:00
Simon Willnauer f9487f7451 Apply additional plugin settings only if settings are not explicit
We have a way to allow a plugin to specify additional settings. These
settings should only be applied if they are not already existing in the
node settings.
2015-08-11 10:06:55 +02:00
Ryan Ernst f4827e55e3 Test: More attempts at forcing netty test to always use netty 2015-08-11 00:43:29 -07:00
Ryan Ernst b81f5f6142 Revert "Merge pull request #11414 from rjernst/fix/2315"
This reverts commit 937732b17d, reversing
changes made to 6fea6c542c.
2015-08-10 23:13:19 -07:00
Ryan Ernst 8a587ead89 Mappings: Validate parsed document does not have trailing garbage that is invalid json
See #2315
2015-08-10 21:57:14 -07:00
Ryan Ernst 6fea6c542c Test: Fix netty integ test to ensure local mode is not used.
closes #12788
2015-08-10 20:57:55 -07:00
Igor Motov 3354a816fc Changes in unassigned info and version might not be transferred as part of cluster state diffs
The equalTo logic of ShardRouting doesn't take version and unassignedInfo into the account when compares shard routings.  Since cluster state diff relies on equal to detect the changes that needs to be sent to other cluster, this omission might lead to changes not being properly propagated to other nodes in the cluster.

Closes #12387
2015-08-10 19:58:36 -04:00
Ryan Ernst 1b3cd504a5 test: quiet netty integ test 2015-08-10 16:57:02 -07:00
Nik Everett dfb6d4d08f QA: Create a test plugin with configuration
In order to test the way plugins with configuration are installed and removed
we need a plugin with configuration in the repository. The simplest way to
get one is to make an "example" plugin.

In the process of making this example it became aparent that cat actions were
difficult to create outside of the org.elasticsearch.rest.action.cat package
because key methods in AbstractCatAction were package private. This makes them
protected and uses them to create the example configured plugin.

Relates to #12717 but is only one step of many to close it.
2015-08-10 14:51:49 -07:00
Ryan Ernst 40f119d85a This method on settings loaded a class, based on a setting value, using
the default classloader. It had all kinds of leniency in how the
classname was found, and simply cannot work with plugins having isolated
classloaders.

This change removes that method. Some of the uses of it were for custom
extension points, like custom repository or discovery types. A lot were
just there to plugin mock implementations for tests. For the settings
that were legitimate, all now support plugins adding the given setting
via onModule. For those that were specific to tests for mocks, they now
use Classes.loadClass (a helper around Class.forName). This is a
temporary measure until (in a future PR) tests can change the
implementation via package private statics.

I also removed a number of unnecessary intermediate modules, added a
"jvm-example" plugin that can be filled in in the future as a smoke test
for breaking plugins, and gave some documentation to "spawn" modules
interface.

closes #12643
closes #12656
2015-08-10 14:04:45 -07:00
Ryan Ernst b47f5976a5 Mappings: Fix field type compatiblity check to work when only one previous type exists.
This was a straight up bug found in #12753. If only one type existed,
the compatibility check for a new type was not strict, so changes to
an updateable setting like search_analyzer got through (but only
partially). This change fixes the check and adds tests (which were
previously a TODO).

This also fixes a bug in dynamic field creation which woudln't copy
fielddata settings when duplicating a pre-existing field with the
same name.

closes #12753
2015-08-10 12:41:36 -07:00
Christoph Büscher a269b96799 Merge pull request #12581 from cbuescher/fix/12531
Fix setting timezone on default DateTime formatter
2015-08-10 15:05:39 +02:00
Christoph Büscher cdb39cf5dc Aggregations: Fix setting timezone on default DateTime formatter
This PR prevents setting timezone on ValueFormatter.DateTime. Instead
the timezone information needed when printing buckets key-as-string
information is provided at constrution time of the ValueFormatter, making
sure we don't overwrite any constants. This, however, made it necessary to
be able to access the timezone information when resolving the format
in ValueSourseParser, so the `time_zone` parameter is now parsed alongside
the `format` parameter in ValueSourceParser rather than in DateHistogramParser.

Closes #12531
2015-08-10 15:04:46 +02:00
Simon Willnauer 9a7257c55a Remove lenient store type parsing
Today we accept store types like `nio_fs`, `nioFs`, `niofs` etc.
this commit removes the leniency and only accepts plain values without underscore.
Yet, this commit also has a BWC layer that upgrades existing indices to the new version.
Affected enums are:
 * `nio_fs`
 * `mmap_fs`
 * `simple_fs`
2015-08-10 13:39:08 +02:00
Alexander Reelsen e24b57e613 PluginManager: Do not try other URs if specific URL was configured
If an URL specified with --url on the command line cannot be reached,
the plugin manager tries URLs at download.elastic.co automatically.

This can lead to download wrong plugins and also exposes potentially
the name of an internal plugin to the download service.

This fix ensures, that the plugin manager simply aborts, if the specified
URL cannot be downloaded.
2015-08-10 13:09:02 +02:00
keety 9a385de077 fix to support disable_coord param in terms query 2015-08-09 18:50:34 -04:00
Clinton Gormley 205262c737 Enable the license checker over distribution/* and plugins/*
Moved the license checker config into the parent pom, and overrede
the license dir/target-to-check in distributions/pom.

Disabled the license checker explicitly for projects which run integration
tests but have no licenses dir:

* core
* distribution
* qa
* plugins/delete-by-query
* plugins/mapper-size
* plugins/site-example

Closes #12752
Closes #12754
2015-08-09 18:18:59 +02:00
Robert Muir 368c41666c WE CANT EVEN GET BIN/ELASTICSEARCH WORKING!!!! 2015-08-09 08:09:44 -04:00
Jason Tedor f8415ae7ca Avoid use of forbidden method in test 2015-08-07 19:09:52 -04:00
Jason Tedor 23b348040e Add script compilation stats
This commit adds basic support to track the number of times scripts are
compiled and compiled scripts are evicted from the script cache. These
statistics are tracked at the node level.

Closes #12673
2015-08-07 18:25:55 -04:00
javanna 56c0b46f96 [TEST] remove duplicated tests from SearchQueryIT
After merging filters and queries, tests against indices filter and indices query became exactly the same. we can remove one copy then.
2015-08-07 16:04:51 +02:00
Simon Willnauer d0b2566345 Make RoutingNodes read-only by default
ClusterState has 3 different methods to access RoutingNodes:
 * #routingNodes() - mutable version
 * #getRoutingNodes() - delegates to #getReadOnlyRoutingNodes()
 * #getReadOnlyRoutingNodes() - it's docs say `NOTE, the routing nodes are mutable, use them just for read operations`

The latter also reuses the instance that it creates. This has several problems beside the obvious:
 * creating RoutingNodes is costly and should be done only if really needed ie. use cached version as much as possible
 * the common case is ReadOnly but all kinds of things are called
 * mutable version are only needed in one place and should only be used in the AllocationService
 * RoutingNodes can freeze it's ShardRoutings but doesn't
 * RoutingNodes should check if it's read-only or not

This commit fixed all the problems and special cases the mutable case such that all accesses via ClusterState#getRoutingNodes()
is read-only and RoutingNodes enforces this.
2015-08-07 09:48:42 +02:00
Adrien Grand 137bfaaeff Merge pull request #12707 from jpountz/enhancement/filters_function_score_needs_score
Only compute scores when necessary with FiltersFunctionScoreQuery.
2015-08-07 08:53:19 +02:00
Adrien Grand 2db1db0686 Tests: disable randomly-enabled custom data paths to make tests passing against an external cluster. 2015-08-06 22:28:40 +02:00
Adrien Grand 5cad559914 Only compute scores when necessary with FiltersFunctionScoreQuery.
This was just done with FunctionScoreQuery, but FiltersFunctionScoreQuery works
in a similar way.
2015-08-06 21:42:46 +02:00
Adrien Grand 5dd5936fad Move the `_size` mapper to a plugin.
This is one of our esoteric metadata mappers so I think we should distribute
it in a plugin rather than in elasticsearch core.

This introduces one limitation: the value of the `_size` parameter is not
retrievable for documents that are only in the transaction log.
2015-08-06 20:35:22 +02:00
Adrien Grand 00093a21dc Merge pull request #12294 from jpountz/fix/multi_match_boost
`multi_match` query applies boosts too many times.
2015-08-06 19:07:44 +02:00
Adrien Grand 8d5fff37ae `multi_match` query applies boosts too many times.
The `multi_match` query groups terms that have the same analyzer together and
then applies the boost of the first query in each group. This is not necessary
given that boosts for each term are already applied another way.
2015-08-06 19:07:12 +02:00
Adrien Grand b59918f29d Merge pull request #12695 from jpountz/enhancement/script_needs_scores
Allow scripts to expose whether they use the `_score`.
2015-08-06 18:47:18 +02:00
Robert Muir d61d775f19 Merge pull request #12696 from rmuir/better_jvm_check_error
Improve jvmcheck error failure
2015-08-06 12:35:55 -04:00
Robert Muir 1ca97934b5 Improve jvmcheck error failure
Versions can be tricky with linux vendors and such. To help debug any possible issues, we should output a better version.

Today:
```
[elasticsearch] java.lang.RuntimeException: Java version: 1.7.0_55 suffers from critical bug https://bugs.openjdk.java.net/browse/JDK-8024830 which can cause data corruption.
[elasticsearch] Please upgrade the JVM, see http://www.elastic.co/guide/en/elasticsearch/reference/current/_installation.html for current recommendations.
[elasticsearch] If you absolutely cannot upgrade, please add -XX:-UseSuperWord to the JAVA_OPTS environment variable.
[elasticsearch] Upgrading is preferred, this workaround will result in degraded performance.
[elasticsearch]     at org.elasticsearch.bootstrap.JVMCheck.check(JVMCheck.java:121)
[elasticsearch]     at org.elasticsearch.bootstrap.Bootstrap.main(Bootstrap.java:270)
[elasticsearch]     at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:28)
```

With patch:
```
java.lang.RuntimeException: Java version: Oracle Corporation 1.7.0_40 [Java HotSpot(TM) 64-Bit Server VM 24.0-b56] suffers from critical bug https://bugs.openjdk.java.net/browse/JDK-8024830 which can cause data corruption.
Please upgrade the JVM, see http://www.elastic.co/guide/en/elasticsearch/reference/current/_installation.html for current recommendations.
If you absolutely cannot upgrade, please add -XX:-UseSuperWord to the JAVA_OPTS environment variable.
Upgrading is preferred, this workaround will result in degraded performance.
	at org.elasticsearch.bootstrap.JVMCheck.check(JVMCheck.java:121)
	at org.elasticsearch.bootstrap.Bootstrap.main(Bootstrap.java:270)
	at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:28)
```
2015-08-06 12:22:04 -04:00
Lee Hinman 0a1c9de075 Merge remote-tracking branch 'dakrone/avoid-extra-reroutes-FP' 2015-08-06 10:07:41 -06:00
Adrien Grand b16e2d95af Allow scripts to expose whether they use the `_score`.
This commit adds a new API to allow scripts to say whether they need scores.
In practice, only the `expression` script engine makes use of it correctly,
other engines just return `true` since they can't predict whether they'll
need scores. This should make scripted aggregations and `function_query`
faster as we'll now be able to pass needsScores=false to Query.createWeight.
2015-08-06 17:25:51 +02:00
Jason Tedor 40cd460647 Merge pull request #12691 from jasontedor/fix/12683
Do not track named queries that are null
2015-08-06 09:33:29 -04:00
Jason Tedor e5786d2d82 Do not track named queries that are null
Adding a named query that is null can lead to a NullPointerException
when copying the named queries. This is due to an implementation detail
in QueryParseContent.copyNamedQueries. In particular, this method uses
com.google.common.collect.ImmutableMap.copyOf. A documented requirement
of ImmutableMap is that none of the entries have a null key nor null
value. Therefore, we should not add such queries to the namedQueries
map. This will not change any behavior since Map.get returns null if no
entry with the given key exists anyway.

Closes #12683
2015-08-06 09:31:51 -04:00
Adrien Grand 23a3db8bb6 Speed up the `function_score` query when scores are not needed.
This change improves the `function_score` query to not compute scores at all
when they are not needed, and to not compute scores on the underlying query
when the combine function is to replace the score with the scores of the
functions.
2015-08-06 15:04:48 +02:00
javanna 6f13171d50 [TEST] add NamedWriteableRegistry argument to AbstractSimpleTransportTests#build method 2015-08-06 12:56:28 +02:00
javanna 63d18d5e05 Make FilterInputStream abstract 2015-08-06 12:55:57 +02:00
javanna e1e9e1a6e1 Transport: allow to de-serialize arbitrary objects given their name
This commit makes it possible to serialize arbitrary objects by having them extend Writeable. When reading them though, we need to be able to identify which object we have to create, based on its name. This is useful for queries once we move to parsing on the coordinating node, as well as with aggregations and so on.

Introduced a new abstraction called NamedWriteable, which is supported by StreamOutput and StreamInput through writeNamedWriteable and readNamedWriteable methods. A new NamedWriteableRegistry is introduced also where named writeable prototypes need to be registered so that we are able to retrieve the proper instance of the writeable given its name and then de-serialize it calling readFrom against it.

Closes #12393
2015-08-06 12:25:27 +02:00
Simon Willnauer d0abffc9ac Add unittest for DiskThresholdDecider#getShardSize / #sizeOfRelocatingShards
This commit adds a basic unittest for the shard size routines and simplifies
some object creation.
2015-08-06 10:35:12 +02:00
Robert Muir 0ecd7b8ccf Merge pull request #12668 from rmuir/configure_script
Add path.scripts directory
2015-08-05 22:33:30 -04:00
Lee Hinman 437c43cd7f Avoid extra reroutes of delayed shards in RoutingService
In order to avoid extra reroutes, `RoutingService` should avoid
scheduling a reroute of any shards where the delay is negative. To make
sure that we don't encounter a race condition between the
GatewayAllocator thinking a shard is delayed and RoutingService thinking
it is not, the GatewayAllocator will update the RoutingService with the
last time it checked in order to use a consistent "view" of the delay.

Resolves #12456
Relates to #12515 and #12456
2015-08-05 14:59:31 -06:00
Nik Everett 69be7f77fc Prevent DirectCandidateGenerator to reuse an unclosed analyzer
When postFilter generates a token that is identical to the input term
DirectCandidateGenerator should not preFilter this token. If postFilter
and preFilter are the same analyzer instance it would fail with :
"TokenStream contract violation: close() call missing"

This is a forward port of @nomoa's #12670
2015-08-05 15:30:13 -04:00
Simon Willnauer 0b9729af5b Use explict flag if index should be created on engine creation
Today we try to detect if there is an index existing in the directory
and if not we create one. This can be tricky and errof prone since we
rely on the filesystem without taking the context into account when the
engine gets created. We know in all situations if the index should be created
so we can just use this infromation and rely on the lucene index writer to barf
if we hit a situations where we can't append to an index while we should.
2015-08-05 20:44:56 +02:00
Simon Willnauer abf763c1c5 Rethrow exception during recovery finalization even if source if not broken
Today we miss to throw / rethrow an recovery exception if it happens during
the finalization of phase 1 if the source files are not affected. Even worse
this can cause some dataloss if the reason for this exception is a failure of
deleting a corruption marker or similar pre-existing corruptions since we continue
with the recovery and mark the target shared as started which will in-turn open
an engine with an empty index.
2015-08-05 20:44:10 +02:00
Nik Everett 804f14c68e Core: Remove nasty hack in toString
This makes the output of EsThreadPoolExecutor#toString less pretty but
we no longer have funky hacky that rely on the specific format of the
toString produced by ThreadPoolExecutor which isn't part of its API and
could change with any JVM version and break the output.
2015-08-05 13:57:28 -04:00
Nik Everett ed7d84ca5f Core: Improve toString on EsThreadPoolExecutor
Improving the toString allows for nicer error reporting. Also cleaned up
the way that EsRejectedExecutionException notices that it was rejected
from a shutdown thread pool. I left javadocs about how its not 100% correct
but good enough for most uses.

The improved toString on EsThreadPoolExecutor mean every one of them needs
a name. In most cases the name to use is obvious. In tests I use the name
of the test method and in real thread pools I use the name of the thread
pool. In non-ThreadPool executors I use the thread's name.

Closes #9732
2015-08-05 13:57:28 -04:00
Nik Everett d46fdb1638 [Tests] Cleanup EsExecutorsTests
* names prefixed with test don't need @Test
* Javadoc describing what it tests
2015-08-05 13:56:58 -04:00
Alexander Reelsen 5a701367a7 PluginManager: Add Support for basic auth
In order to support the URL notation including a user/pass combination
(like http://user:pass@host/plugin.zip) the auth info needs to be added
manually.
2015-08-05 15:56:42 +02:00
Alexander Reelsen da31fbe702 Testing: Removing leftover @AwaitsFix annotation
Since the update to HDRHistogram 2.1.6 this test was
forgotten to get the annotation removed in #12554.
2015-08-05 13:47:28 +02:00
Robert Muir d7d25fe6b5 Add path.scripts directory
Today this is "unofficial" as conf/scripts, but some people
want to share scripts across different nodes and so on. Because
they cannot configure it, they are forced to use dirty hacks
like symbolic links, which isnt going to work: we aren't going
to recursively scan conf/ and add permissions to all link targets
underneath it, thats crazy.

I really hate adding yet another configuration knob here, but
users resorting to using symlinks are going to be frustrated,
and do things in a more insecure way.
2015-08-05 06:45:52 -04:00
Alexander Reelsen 88842f3319 PluginManager: Fix elastic.co download URLs, add snapshot ones
The URL to download the main elasticsearch plugins did not match
what the S3 wageon is supposed to write to.

In addition this PR adds support for snapshots to access the
snapshot S3 bucket, so we can possibly download snapshot versions
of plugins.

The format of the URLs stems from #12270

Closes #12632
2015-08-05 11:46:20 +02:00
Igor Motov f71c9a25a1 Check for incompatible mappings while upgrading old indices
Conflicting mappings that were allowed before v2.0 can cause runaway shard failures on upgrade. This commit adds a check that prevents a cluster from starting if it contains such indices as well as restoring such indices from a snapshot into already running cluster.

Closes #11857
2015-08-04 18:13:29 -06:00
Igor Motov 8fe5d903b7 Add support for bulk delete operation in snapshot repository
Currently when we delete files belonging to deleted snapshots we issue one delete command to underlying snapshot store at a time. Some repositories can benefit from bulk deletes of multiple files.

Closes #12533
2015-08-04 14:52:28 -06:00
Robert Muir 6f9a067197 Change master branch back to 2.0-beta1 2015-08-04 15:38:21 -04:00
oyiadom 3470a328e0 Update BulkProcessor.java 2015-08-04 14:38:52 -04:00
Simon Willnauer 8f6e75b158 Ignore EngineClosedException on IndexShard#sync
This method syncs the translog unless it's already synced. If the engine
is alreayd closed we are guaranteed to be synced already such that we can just
ignore this exception.

Closes #12603
2015-08-04 15:43:17 +02:00
Simon Willnauer 2b2657279d Use UTC instead of default timezone for creation date in CAT endpoint
this change was added recently which uses default timezone for the creation
date on CAT endpoints. We should be consistent and use UTC across the board.
This commit adds #getDefaultTimzone() to forbidden API and fixes the REST tests.

Relates to #11688
2015-08-04 14:38:23 +02:00
Simon Willnauer 6753f7f03e Cut over master to 2.0.0-SNAPSHOT 2015-08-04 10:54:12 +02:00
Tanguy Leroux a74684473e Move Streams.copyTo(String|Bytes)FromClasspath() into StreamsUtils
The Streams.copyTo(String|Bytes)FromClasspath() methods resolve resources using org.elasticsearch.io.Streams classloader. This is fine in elasticsearch core and when running tests but if used in a plugin this can lead to FileNotFoundExceptions at runtime because plugin are loaded in a dedicated classloader.
2015-08-04 10:11:18 +02:00
Adrien Grand caca13c878 Merge pull request #12599 from jpountz/fix/PrioritizedEsThreadPoolExecutor_concurrency
Fix concurrency issue in PrioritizedEsThreadPoolExecutor.
2015-08-04 10:00:46 +02:00
Robert Muir 64850c0539 Improve site-example integ test to test served contents.
Closes #12578
2015-08-03 23:47:36 -04:00
Robert Muir 45ad47581d tone down these stress tests 2015-08-03 22:47:24 -04:00
Robert Muir d7cf5cd6af NamingConventionTests should test subclasses of ESIntegTestCase end with IT
These are integration tests.
2015-08-03 21:34:53 -04:00
Robert Muir 2fe279d2a9 cleanup more abstract test class -> TestCase and integ -> IT 2015-08-03 21:07:21 -04:00
Ryan Ernst 1e12d03252 Tests: Rename base tests cases to use "TestCase" suffix
Most of the abstract base test classes we have were previously @Ignored.
However, there were also some other tests ignored. Having two ways to
quiet tests is confusing, and clearly it has caused some tests
to get lost in the fold.

This change moves all base test classes to use the "TestCase" suffix,
which is not picked up by the test class name pattern. It also removes
@Ignore from (almost) all tests, and adds it to forbidden apis.
And since we were renaming, I shorted base test class names to use
"ES" instead of "Elasticsearch". I type this a lot of types a day,
and I have heard others express a similar desire for a shorter name.

closes #10659
2015-08-03 17:43:00 -07:00
Ryan Ernst be941f0669 Tests: Remove uses of @Slow and @Integration
Now that integ tests are moved into `mvn verify`, we don't really have
a need for @Slow, and especially not @Integration. This removes
uses of the first, and completely removes uses of the latter.
2015-08-03 16:26:07 -07:00
Robert Muir 062feac80a Cut over some remaining integration tests to IT
A few subclasses got missed here
2015-08-03 19:08:01 -04:00
Ryan Ernst d349deb9b7 Merge pull request #12613 from rjernst/refactor/integ-tests
Rename integ tests to IT suffix
2015-08-03 14:57:26 -07:00
Ryan Ernst 622d8a830e Tests: Rename integ tests to IT suffix
This rename effectively moves all integration tests to be run with `mvn
verify`. `mvn test` now runs in about 2 mins. This is a follow up to
2015-08-03 14:42:34 -07:00
Robert Muir 9769477c9d Merge pull request #12609 from rmuir/sane_permissions
improve sanity of securitymanager file permissions
2015-08-03 17:39:30 -04:00
Robert Muir 2623ce7960 Improve permissions checking in security tests and fix crazy pidfile parent permissions 2015-08-03 16:58:25 -04:00
Robert Muir be6f9a0196 improve sanity of securitymanager file permissions
conf/ and plugins/ do not need read-write access: this prevents a lot
of bad possibilities.
2015-08-03 14:43:40 -04:00
Nik Everett c82717789c Merge pull request #11688 from szroland/master
Add option to `_cat/indices` to return index creation date #11524
2015-08-03 14:42:18 -04:00
Robert Muir e472cbed09 Merge branch 'master' into perms
Conflicts:
	core/src/test/java/org/elasticsearch/plugins/PluginManagerTests.java
2015-08-03 13:20:34 -04:00
Robert Muir 0e027d82c9 Merge pull request #12602 from rmuir/core_integ_tests
Add integration test phase for elasticsearch core/
2015-08-03 10:15:37 -04:00
Robert Muir 379ffdb8ee Add integration test phase for elasticsearch core/ 2015-08-03 09:43:11 -04:00
Britta Weber 26d51c299e Merge pull request #12400 from brwe/plug-fetch-sub-phases
Make fetch sub phases pluggable
2015-08-03 15:19:28 +02:00
Adrien Grand 1eaa9f9fda Fix concurrency issue in PrioritizedEsThreadPoolExecutor.
Tasks can be registered with a timeout, which runs as a task in a separate
threadpool. The idea is that the timeout runner cancels the main task when
the time is out, and the timeout runner is cancelled when the main task
starts executing. However, the following statement:

```java
                    timeoutFuture = timer.schedule(new Runnable() {
                        @Override
                        public void run() {
                            if (remove(TieBreakingPrioritizedRunnable.this)) {
                                runAndClean(timeoutCallback);
                            }
                        }
                    }, timeValue.nanos(), TimeUnit.NANOSECONDS);
```

is not atomic: the removal task is first started, and then the (volatile)
variable is assigned. As a consequence, there is a short window that allows
a timeout task to wait until the time is out even if the task is already
completed.

See http://build-us-00.elastic.co/job/es_core_17_centos/496/ for an example of
such a failure.
2015-08-03 14:11:49 +02:00
Robert Muir c5b91b9058 Merge pull request #12589 from rmuir/shading_cleanup
Fix shaded jar packaging
2015-08-03 08:10:50 -04:00
Adrien Grand 365a324fc5 Tests: Add more logging to SearchPreferenceTests so that we can know which preference is failing. 2015-08-03 12:55:15 +02:00
Colin Goodheart-Smithe ade3881152 Aggregations: Full path validation for pipeline aggregations
Previously only the first aggregation in a buckets_path was check to make sure the aggregation existed. Now the whole path is checked to ensure an aggregation exists at each element in the buckets_path

Closes #12360
2015-08-03 11:15:40 +01:00
Robert Muir a5a27a5cd9 Add jar hell check test for the shaded jar 2015-08-03 05:54:55 -04:00
Robert Muir 20ed7c1724 Merge pull request #12586 from rmuir/exit_value
Fix Bootstrap to not call System.exit
2015-08-03 05:27:08 -04:00
Martijn van Groningen 50c345238b fix ShardUtils#getElasticsearchDirectoryReader(...) to use FilterDirectoryReader#getDelegate() 2015-08-03 09:54:56 +02:00
szroland 742607ec9b using default timezone explicitly 2015-08-02 20:53:03 +02:00
szroland 35d947b524 Add option to `_cat/indices` to return index creation date #11524
Returning index creation date, both as a numeric millisecond value and
as a string. This implements #11524
2015-08-02 20:53:02 +02:00
Robert Muir 6f33ea4f62 move shading to distribution/shaded 2015-08-01 11:37:43 -04:00
Robert Muir d173b89d11 make this less syntactically confusing 2015-07-31 14:13:00 -04:00
Robert Muir 5f9edd26ea Fix Bootstrap to not call System.exit
Its not going to work: its blocked by security policy
and will just add a confusing SecurityException to the mix, and
bogusly give an exit status of 0 when in fact something bad happened.

Finally, if ES can't startup, it is a serious problem, there is
no sense in hiding the reason why: deliver the full stack trace.
2015-07-31 14:00:18 -04:00
Robert Muir 8d5b5ad862 restore my lost code changes and add measures to detect/prevent this in the future 2015-07-31 13:00:24 -04:00
Igor Motov 354504334f Create a directory during repository verification
The repository verification process should create a subdirectory to make sure we check permission of newly created directories in case elasticsearch processes on different nodes are running using different uids and creating blobs with incompatible permissions.

Closes #11611
2015-07-31 12:11:05 -04:00
Robert Muir f804ec3cd9 cleanup 2015-07-31 10:05:11 -04:00
Robert Muir fd8e92a18a don't represent site plugins with 'null' anymore 2015-07-31 09:41:39 -04:00
Lee Hinman 5a8356c86e Reroute shards when a node goes under disk watermarks
Previously we issued a reroute when a node went over the high watermark
in order to move shards away from the node. This change tracks nodes
that have previously been over the high or low watermarks and issues a
reroute when the node goes back underneath the watermark.

This allows shards that may be unassigned to be assigned back to a node
that was previously over the low watermark but no longer is.

Resolves #12422
2015-07-30 16:32:54 -06:00
Robert Muir ba63d57e82 don't lose stacktrace if a plugin somehow makes jar hell 2015-07-30 15:56:33 -04:00
Britta Weber 8a4957967b more review comments 2015-07-30 17:47:21 +02:00
Alexander Reelsen a8310d0575 Tests: Fix CLI help checking tests under windows
As windows has different line endings and this has
already been fixed by another test, the method has been
moved into CliToolTestCase.

In addition one test has been removed, as it was redundant.
2015-07-30 16:12:14 +02:00
Alexander Reelsen 69d7f1a78a Startup: Remove getopt parsing in shell script, use java CLITool
In order to ensure, we have the same experience across operating systems
and shells, this commit uses the java CLI parser instead of the shell
getopt parsing to parse arguments.

This also allows for support for paths, which contain spaces.

Also commons-cli depdency was upgraded to 1.3.1 and tests have been added.

Changes

* new exit code, OK_AND_EXIT, allowing to tell the caller to exit, as everything
  went as expected (e.g. when running a version output)

BWC breaking:

* execute() returns an ExitStatus instead of an integer, otherwise there is no
  possibility to signal by a command, if the JVM should be exited after a run.
  This affects plugins, that have command line tools
* -v used to be version, but is a verbose flag by default in the current CLI infra,
  must be -V or --version now
* -X has been removed - the current implementation was useless anyway, as
  it prefixed those properties with "es.". You should use
  ES_JAVA_OPTS/JAVA_OPTS for JVM configuration
2015-07-30 13:20:29 +02:00
Martijn van Groningen b3b34668e8 made `dateMathExpressionResolver` final 2015-07-30 11:34:10 +02:00
Adrien Grand 23fa535bfa Upgrade HDRHistogram to version 2.1.6.
This release fixes https://github.com/HdrHistogram/HdrHistogram/pull/68 which
we have been hitting in our CI tests, for instance:
http://build-us-00.elastic.co/job/es_core_master_metal/10567/
2015-07-30 09:55:12 +02:00
Dave Parfitt 2d2f21e760 Merge pull request #12534 from metadave/feature/cat_nodeattrs
Add _cat/nodeattrs API
2015-07-29 17:01:22 -04:00
Dave Parfitt f209809716 Add _cat/nodeattrs API
This provides a _cat/nodeattrs API call, which presents
custom node attributes in a denormalized table.

Closes #8000
2015-07-29 16:11:18 -04:00
Martijn van Groningen 0c53204b40 Added RealtimeRequest interface and let GetRequest, MultiGetRequest, TermVectorsRequest and MultiTermVectorsRequest implement it.
This is useful because now all requests that are realtime are now grouped under the same marker interface.
2015-07-29 21:47:11 +02:00
Robert Muir c6d6eaef4d Add a run.sh to run from current source code with debugger
The maven magic needed for this is now heavier
2015-07-29 14:21:43 -04:00
Britta Weber b86d07fc9a generic for sub classes also? 2015-07-29 17:37:11 +02:00
Martijn van Groningen ac3d090379 Added date math support in index names
Date math index name resolution enables you to search a range of time-series indices, rather than searching all of your time-series indices and filtering the the results or maintaining aliases. Limiting the number of indices that are searched reduces the load on the cluster and improves execution performance. For example, if you are searching for errors in your daily logs, you can use a date math name template to restrict the search to the past two days.

The added `ExpressionResolver` implementation that is responsible for resolving date math expressions in index names. This resolver is evaluated before wildcard expressions are evaluated.

The supported format: `<static_name{date_math_expr{date_format|timezone_id}}>` and the date math expressions must be enclosed within angle brackets. The `date_format` is optional and defaults to `YYYY.MM.dd`. The `timezone_id` id is optional too and defaults to `utc`.

The `{` character can be escaped by places `\\` before it.

Closes #12059
2015-07-29 17:33:55 +02:00
Britta Weber 6754a26d08 more generic? 2015-07-29 16:46:13 +02:00
Britta Weber d113b59e86 add SearchContext to innerParse method 2015-07-29 16:06:40 +02:00
Britta Weber 6295738d4c make Context generic so we don't have to cast 2015-07-29 16:00:37 +02:00