Typo in error message with too few points for geo polygon filter.

Closes #8767
Gateway: GatewayService should register cluster state listener before checking for current state

At the moment we may miss a state change and fail to recover on time.

Closes #8789
Debian package: Prevent init script from returning when the service isn't actually started.

Close #6909
Docs: Added a command to start elasticsearch on bootup on Debian.

Close #8600
Docs: Add instructions to start elasticsearch on bootup on RHEL/Fedora.
deb: add systemd service config for upcoming Jessie

This change adds a systemd service configuration file, and adds systemd logic
to installation and de-installation scripts. The upcoming Debian 8 "Jessie"
release will use systemd.

fixes #8943

Signed-off-by: Thilo Fromm <github@thilo-fromm.de>
Packaging: Make ES user own plugins dir, remove on uninstall

This change will chown /usr/share/elasticsearch/plugins to the elasticsearch
user (the directory was formerly owned by root). This enables the ES user to
manage plugins.

Also, /usr/share/elasticsearch/plugins is now removed when the elasticsearch
package is un-installed. Previously it was left lying there.

Closes #8732

Signed-off-by: Thilo Fromm <github@thilo-fromm.de>
[TESTS] Use a _default_ template to load field data lazily

Previously it was possible for the field data clearing in this test to
take too long, causing the test to time out.

This also switches to using `scaledRandomIntBetween` for the number of
fields.
[TESTS] Log what the _default_ template is in ElasticsearchIntegrationTest
[TEST] wait unitl all machines joined the cluster
Snapshot/Restore: switch to write once mode for snapshot metadata files

This commit removes creation of in-progress snapshot file and makes creation of the final snapshot file atomic.

Fixes #8696
Clarify InternalIndexShard callbacks

This commit changes internal callback to be clear
about when they are called and also provide the
exception that was potentially thrown as a callback argument.

Closes #5945
Docs: add randomizedtesting-runner to testing-framework.asciidoc

Close #8450
[ALLOCATION] Speed-up disk-threshold decider

Instead of iterating all shards of all indices to get all relocating
shards for a given node we can just use the RoutingNode#shardsWithState
method and fetch all INITIALIZING / RELOCATING shards and check if they
are relocating. This operation is much faster and uses pre-build
data-structures.

Relates to #6372
Tests: move RecoverAfterNodesTests to org.elasticsearch.gateway.local and increase BLOCK_WAIT_TIMEOUT to 10s

The tests were still in org.elasticsearch.gateway.none but the none gateway was removed.
Packaging: Check if proc file exists before calling sysctl

The packaged init scripts could return an error, if the file
/proc/sys/vm/max_map_count was not existing and we still called
sysctl.

This is primarly to prevent confusing error messages when elasticsearch
is started under virtualized environments without a proc file system.

Closes #4978
Scripting: Add explicit error message when script_score script returns NaN

When a scoring script returns not a number, the current message is confusing (IllegalArgumentException[docID must be >= 0 and < maxDoc=3 (got docID=2147483647)]). This commit adds the error message ScriptException[script score function returns a wrong score: NaN].

Closes #2426
Add more trace loggin to LocalIndexShardGateway.java
[STORE] Expose ShardId via LeafReader rather than Direcotry API

Today we try to fetch a shard Id for a given IndexReader / LeafReader
by walking it's tree until the lucene internal SegmentReader and then
casting the directory into a StoreDirecotory. This class is fully internal
to Elasticsearch and should not be exposed outside of the Store.

This commit makes StoreDirectory a private inner class and adds dedicated
ElasticsearchDirectoryReader / ElasticserachLeafReader exposing a ShardId
getter to obtain information about the shard the index / segment belogs to.

These classes can be used to expose other segment specific information in
the future more easily.
[TEST] Add unit tests for DiskThresholdDecider settings