Test: RecoveryWhileUnderLoadTests.recoverWhileRelocating should report cluster state when failing to reach green
Recovery: mapping check during phase2 should be done in cluster state update task

Before phase2 we check verify that the local mapping is in sync with the cluster state mapping (and send & wait on a master update mapping task if not). This check should be done under a cluster state update task to make sure an incoming cluster state update to do not change things while we check.

Closes #7744
Tests: extend testRecoverFromPreviousVersion to sometimes index during relocation

Relates to #7729

Closes #7768
Docs fix - added note of supported version for new include/exclude feature

Closes #7807
Update java source example

From the version 1.0 FilterBuilders and QueryBuilders are not part from org.elasticsearch.index.query.xcontent package no more.

Closes #7701.
Apply bulk change to 1.3.3

relates to #7729
Docs: IndexResponse.matches() does not exist anymore

Since 1.0, percolator has been redesigned so percolator is not applied anymore at index time.

Closes #7548.
Document the Java BulkProcessor

Closes #7638.

(cherry picked from commit f0dc8a8)
[TEST] Ensure primaries are allocated before bulk indexing with dymamic mappings
[RECOVERY] Mark last file chunk to fail fast if payload is truncated

Today we rely on the metadata length of the file we are recoverying
to indicate when the last chunk was received. Yet, this might hide bugs
on the compression layer if payloads are truncated. We should indicate
if the last chunk is send to make sure we validate checksums
accordingly if possible.

Closes #7830
Chunk direct buffer usage by networking layer
Today, due to how netty works (both on http layer and transport layer), and even though the buffers sent over to netty are paged (CompositeChannelBuffer), it ends up re-copying the whole buffer into another heap buffer (bad), and then send it over directly to sun.nio which allocates a full thread local direct buffer to send it (which can be repeated if not all message is sent).
  This is problematic for very large messages, aside from the extra heap temporal usage, the large direct buffers will stay around and not released by the JVM.
  This change forces the use of gathering when building a CompositeChannelBuffer, which results in netty using the sun.nio write method that accepts an array of ByteBuffer (so no extra heap copying), and also reduces the amount of direct memory allocated for large messages.
  See the doc on NettyUtils#DEFAULT_GATHERING for more info.
closes #7811
[TEST] disable translog based flushes when corrupting files

These tests rely on the fact that all files stay the same after
the corruption and if we run into a translog based flush we might
use a new / different delete file causing the test to fail.
Docs: java add static imports for query and filter builders

Also move and add inline comments to references

Closes #6920.

(cherry picked from commit cdd4d00)
[TEST] Make sure test actually throttles
Fix NPE in /_cat/nodes

Query Cache and Suggest stats were introduced in v1.4.0_beta1 and 1.2.0 respectively, therefore they can be null while stats are received from older nodes in the cluster.

Fixes #6297
Docs: fix no callouts refer to list item 3
[TEST] Add a more restrictive thread leaks filter

Today all threads are allowed to leak a suite. This is tricky since
it essentially allows resource leaks by default where for instance
test private TransportClients will never get closed and consume
resources influencing other tests. It also hides threads that
are not fully under elasticsearchs control like the Lucene
TimeLimitingCollector thread. This commit restricts the threads
that can leak a suite to the threads spawned from testclusters
and fixes sevearl places that leaked threads.

Closes #7833
[TEST] use more terminate calls and wait for termination
[TEST] Disable thread filter for now
Docs: fix typo