Internal: IndexService - synchronize close to prevent race condition with shard creation

During node shutdown we have a race condition between processing cluster state updates (creating shards) and closing down the index service. This may cause shards to leak and not be closed properly.

This commit removes the concurrency in shard closing as InternalIndexService.removeShard has been synchronized for a long time now.

On the other hand, the commit restores the parallel shutdown of indices lost in 7e1d8a6ca3b23c07cbaebe72831c7ef4a201bd2b

Closes #8557
[CORE] Free pending search contexts if index is closed

Today we hold on to search context reference if they are not cleaned
up for a while until a reaper thread trashes them if they timed out.
This commit removes all pending contexts once the index is closed to release
resources and filehandles immediatly once the index is closed.
[RECOVERY] Allow to cancle recovery sources when shards are closed

Today recovery sources are not cancled if a shard is closed. The recovery target
is already cancled when shards are closed but we should also cleanup and cancel
the sources side since it holds on to shard locks / references until it's closed.
[TEST] Add search trace logging for debugging
Core: Added query/filter wrapper that builds the actual query to be executed on the last possible moment to aid with index aliases and percolator queries using `now` date expression.

Percolator queries and index alias filters are parsed once and reused as long as they exist on a node. If they contain time based range filters with a `now` expression then the alias filters and percolator queries are going to be incorrect from the moment these are constructed (depending on the date rounding).

 If a range filter or range query is constructed as part of adding a percolator query or a index alias filter then these get wrapped in special query or filter wrappers that defer the resolution of now at last possible moment as apposed during parse time. In the case of the range filter a special Resolvable Filter makes sure that `now` is resolved when the DocIdSet is pulled and in the case of the range query `now` is resolved at query rewrite time. Both occur at the time the range filter or query is used as apposed when the query or filter is constructed during parse time.

Closes #8474
Closes #8534
Test: Fix malformed mapping setting, slipped in from merging a commit from 1.x
Revert "[CORE] Free pending search contexts if index is closed"

This reverts commit edc48f39c5ed80c235442e9f4ba87fe1db3eb0f2.
Revert "[TEST] Add search trace logging for debugging"

This reverts commit a7b2bdca4c8779e1fca6d89db8967233e42136ec.
Tests: Add static index based backcompat tests

This change adds tests against static indexes for previous versions
of elasticsearch. It also adds a python script to
generate the indexes.
Tests: Forward port tweak to prepareBackwardsDataDir to 1.x to allow passing
settings when loading an old index.
Tests: Pass through locale and timezone to test runner, and print in
repro command line.

The carrot runner currently randomizes both locale and timezone, but
these are not set in the maven reproduce line.  Since they aren't
even printed, we have no idea what locale/timezone the tests
actually ran with.
Aggregations: Do not take deleted documents into account in aggregations filters.

Since aggregators are only called on documents that match the query, it never
gets called on deleted documents, so by specifying `null` as live docs, we very
likely remove a BitsFilteredDocIdSet layer.

Close #8540
Aggregations: Fix geohash grid aggregation on multi-valued fields.

This aggregation creates an anonymous fielddata instance that takes geo points
and turns them into a geo hash encoded as a long. A bug was introduced in 1.4
because of a fielddata refactoring: the fielddata instance tries to populate
an array with values without first making sure that it is large enough.

Close #8507
Tests: Fix test bug in Filter[s]Tests that made it throw a version conflict.
[TEST] use logger level from test class annotation also in external nodes

closes #8552
[root mappers] fix conflict when updating mapping with _all disabled

_all reports a conflict since #7377. However, it was not checked if _all
was actually configured in the updated mapping. Therefore whenever _all
was disabled a mapping could not be updated unless _all was again added to the
updated mapping.
Also, add enabled setting to mapping always whenever enabled was set explicitely.

closes #8423
closes #8426
Parser throws NullPointerException when Filter aggregation clause is empty.
Added Junit test that recreates the error and fixed FilterParser to default to using a MatchAllDocsFilter if the requested filter clause is left empty.
Also added fix and test for the Filters (with an "s") aggregation.

Closes #8438
[STORE] Remove `memory`/ `ram` store

The RAM store is discuraged for production usage anyway and
we don't test it in our randomized infrastructure. This commit
removes it for `2.0`
Revert "[TEST] use logger level from test class annotation also in external nodes"

This reverts commit 4604a68bef9c54f5db812609157b18788279012d.
Add missing await into an interruptable block