Lazily fill CharTermAttribute if needed in CompletionTokenStream

This adds a delegate to CharTermAttributeImpl to be compatible
with the Percolator that needs a CharTermAttribute. Yet compared
to CharTermAttributImpl we only fill the BytesRef with UTF-8 since
we already have it and only if we need to convert to UTF-16 we do it.

Closes #4028
Added docs for River start and close methods

Closes #3787
Add river creation test
Schedule retry if the river type is available but the _meta document isn't

With #3782 we changed the execution order of dynamic mapping updates and index operations. We now first send the mapping update to the master node, and then we index the document. This makes sense but caused issues with rivers as they are started due to the cluster changed event that is triggered on the master node right after the mapping update has been applied, but in order for the river to be started its _meta document needs to be available, which is not the case anymore as the index operation most likely hasn't happened yet. As a result in most of the cases rivers don't get started.
What we want to do is retry a few times if the _meta document wasn't found, so that the river gets started anyway.

Closes #4089, #3840
Added heap_max(_in_bytes) and heap_used_percent to JVM node stats.

 Closes #4145
fixed a broken trace logging line.
Initial implementation of Snapshot/Restore API

Closes #3826
IndexShardGatewayService should not call post_recovery if shard is in STARTED state.

At the end recovery, the IndexShardGatewayService will double check the gateway has moved the shard to POST_RECOVERY and if not, do it it self.
The shard state could have already move to started, causing the post_recovery call to throw an exception and the entire shard recovery to fail.

This can happened if, after the gateway moved the shard to POST_RECOVERY:
1) master sent a new cluster state indicating shard is initializing
2) IndicesClusterStateService#applyInitializingShard will send a shard started event
3) Master will mark shard as started and this will be processed quickly and move the shard to STARTED.

Closes #4147
Wipe snapshot repos after and before tests

On windows tests sometimes fail since files can not be deleted due
to existing repos still holding on to the files. The test
framework is picky about that since it could be a bug and fails
the test if a temp file can not be deleted.
Upgraded to hppc version 0.5.3
Fixed NPE if matched parent docs is higher than short_circuit_cutoff.
Closes #4135
Disable snapshot/restore tests that fail on windows with     AwaitsFix while working on the fix
Fix file handle leak in readBlob method of AbstractFsBlobContainer
Randomize the number of snapshots in deleteSnapshotTest
Failure in onComplete method of AbstractFsBlobContainer#readBlob should trigger onFailure
[Javadoc] Fix copy/paste comment on YAML type
Cleanup test framework in order to release it as a jar file

This commit adds javadocs and removed unused methods from central
classes like ElasticsearchIntegrationTest. It also changes visibility
of many methods and classes that are only needed inside the test infrastructure.
Release semaphore if client call throws and exception

Closes #4153
Add random filter that compares XBooleanFilter with BooleanQuery while respective the min_should_match = 1 that the filter applies
Make mock repository blocking tests more deterministic and reproducible