Revert "Add index.data_path setting"

This reverts commit b2ec19ab360cc5f23d3cde391c8fc6e700dcb41f.
[TEST] Inject IndexSettings, not node Settings objects

Guice was injecting the wrong Settings object
doc: transport sniff only adds data nodes
[docs] pedantry

Closes #8982
Update getting-started.asciidoc

Missing -X flag at the curl template

Closes #8977
Update percolate.asciidoc

wrong type used in the -GET request

Closes #8942
Aggregations: reduce histogram buckets on the fly using a priority queue.

This commit makes histogram reduction a bit cleaner by expecting buckets
returned from shards to be sorted by key and merging them on-the-fly on the
coordinating node using a priority queue.

Close #8797
Documented the new terminate_after querystring option on search as implemented in #6885
Revert "Aggregations: reduce histogram buckets on the fly using a priority queue."

This reverts commit 5694626f79555af65b1109125afef49657186f0a.
Term Vectors: support for version and version_type

This commit adds support for version and version_type to the Term Vectors API.
This could be useful in the following case whereby the user gets a document
and later wants to generate its TVs. With version, this would ensure that only
the TVs of that particular document are generated, and error out if the
document has been updated in between.

Closes #7480
Aggregations: reduce histogram buckets on the fly using a priority queue.

This commit makes histogram reduction a bit cleaner by expecting buckets
returned from shards to be sorted by key and merging them on-the-fly on the
coordinating node using a priority queue.

Close #8797
Core: ignore known idle threads by default in /_nodes/hot_threads

Add a new ignore_idle_threads boolean option (default true) to
/_nodes/hot_threads, to filter out threads in known idle places like
waiting on a socket select or on pulling the next task from an empty
queue.

Closes #8985

Closes #8908
Test: use less shards in SimpleQueryTests
Upgrade to lucene-5.0.0-snapshot-1646179.
[TEST] upgrade randomized runner to 2.1.11

2.1.11 contains the fix for this issue: https://github.com/carrotsearch/randomizedtesting/issues/179

Closes #8930
Internal: PlainTransportFuture should not set currentThread().interrupt()

We use PlainTransportFuture as a future for our transport calls. If someone blocks on it and it is interrupted, we throw an ElasticsearchIllegalStateException. We should not set  Thread.currentThread().interrupt(); in this case because we already communicate the interrupt through an exception.

Closes #9001
Filter cache: add a `_cache: auto` option and make it the default.

Up to now, all filters could be cached using the `_cache` flag that could be
set to `true` or `false` and the default was set depending on the type of the
`filter`. For instance, `script` filters are not cached by default while
`terms` are. For some filters, the default is more complicated and eg. date
range filters are cached unless they use `now` in a non-rounded fashion.

This commit adds a 3rd option called `auto`, which becomes the default for
all filters. So for all filters a cache wrapper will be returned, and the
decision will be made at caching time, per-segment. Here is the default logic:
 - if there is already a cache entry for this filter in the current segment,
   then return the cache entry.
 - else if the doc id set cannot iterate (eg. script filter) then do not cache.
 - else if the doc id set is already cacheable and it has been used twice or
   more in the last 1000 filters then cache it.
 - else if the filter is costly (eg. multi-term) and has been used twice or more
   in the last 1000 filters then cache it.
 - else if the doc id set is not cacheable and it has been used 5 times or more
   in the last 1000 filters, then load it into a cacheable set and cache it.
 - else return the uncached set.

So for instance geo-distance filters and script filters are going to use this
new default and are not going to be cached because of their iterators.

Similarly, date range filters are going to use this default all the time, but
it is very unlikely that those that use `now` in a not rounded fashion will get
reused so in practice they won't be cached.

`terms`, `range`, ... filters produce cacheable doc id sets with good iterators
so they will be cached as soon as they have been used twice.

Filters that don't produce cacheable doc id sets such as the `term` filter will
need to be used 5 times before being cached. This ensures that we don't spend
CPU iterating over all documents matching such filters unless we have good
evidence of reuse.

One last interesting point about this change is that it also applies to compound
filters. So if you keep on repeating the same `bool` filter with the same
underlying clauses, it will be cached on its own while up to now it used to
never be cached by default.

`_cache: true` has been changed to only cache on large segments, in order to not
pollute the cache since small segments should not be the bottleneck anyway.
However `_cache: false` still has the same semantics.

Close #8449
[TEST] Fix IndexStatsTests failures.
Test: AutoFilterCachingPolicy.HISTORY_SIZE should be large enough to accommodate other param
FunctionScore: Fix 'avg' score mode to correctly implement weighted mean.

closes #8992
closes #9004