Templates: GET templates doesn't honor the `flat_settings` parameter.

Close #6671
[TEST] Fix failure in SearchFieldsTests.testUidBasedScriptFields.

Sorting fails on unmapped fields so the new propagation delay of the mappings
exposed this issue. I added explicit mappings as part of index creation to fix it.
[TEST] Fix IndexLookupTests.testCallWithDifferentFlagsFails.
[TEST] Wait for yellow after enable allocation on all nodes in BWC tests
[TEST] Added IntegrationTest to reproduce #6614
JAVA API: Fix source excludes setting if no includes were provided

Due to a bogus if-check in SearchSourceBuilder.fetchSource(String include, String exclude)
the excludes only got set when the includes were not null. Fixed this and added some
basic tests.

Closes #6632
[TEST] Fix PercolatorTests to wait for mappings on master.
[TEST] Fix SimpleDeleteMappingTests.

The failure was hard to reproduce but it looked to me like dynamic mapping
updates were overriding the delete mappings request.
IndexingMemoryController should only update buffer settings of recovered shards

At the moment the IndexingMemoryController can try to update the index buffer memory of shards at any give moment. This update involves a flush, which may cause a FlushNotAllowedEngineException to be thrown in a concurrently finalizing recovery.

Closes #6642, closes #6667
Bulk API: Fix return of wrong request type on failed updates

In case an update request failed (for example when updating with a
wrongly formatted date), the returned index operation type was index
instead of update.

Closes #6630
Refactoring: Replaced string values with static constants

in TransportShardBulkAction after fixing an issue.
better logic on sending mapping update new type introduction
when an indexing request introduces a new mapping, today we rely on the parsing logic to mark it as modified on the "first" parsing phase. This can cause sending of mapping updates to master even when the mapping has been introduced in the create index/put mapping case, and can cause sending mapping updates without needing to.
 This bubbled up in the disabled field data format test, where we explicitly define mappings to not have the update mapping behavior happening, yet it still happens because of the current logic, and because in our test we delay the introduction of any mapping updates randomly, it can get in and override updated ones.
closes #6669
[TEST] Also wait for fields to have been applied in the mapping in cluster state during teh waitForConcreteMappingsOnAll call

The concrete DocMapper on the master will be updated before the mapping in the cluster state. The DocMapper is updated during the cluster update task. This can lead to occasional assertion failures on the mapping response, because that is based on the mapping the cluster state, which may not yet have been updated. (time window between the DocMapping is updated, but the mapping in the cluster state isn't)
[TEST] Take compatibility version into account for XContentType
randomization

We randomize the XContentType to test deriving the content type on all
APIs. Yet, BWC tests run against versions where CBOR wasn't around
this commit ensures we don't use CBOR when compatibility version is
less than `1.2.0`

Closes #6691
[Discovery] Handle ConnectionTransportException during a Master/Node fault detection ping

Both the Master and Node fault detection register themselves to be notified when a node disconnects to be able to respond to it accordingly. As such, when a ConnectionTransportException was raised on a ping request, it was not handled as it is already handled somewhere else. However, this does introduce a racing condition, if the disconnect  happen during a period where there is no current master (minimum_master_node breach) at which time the fault detection is not active. In this case, we will only discover the disconnect error during the ping request, so we have to respond accordingly.

Closes #6686
[TEST] Don't wait for relocations - the ensureYellow() call does that already
[TEST] Also do waitForConcreteMappingsOnAll() call for the .percolator type.
Percolator: improve logging and cleanup try-catch statement for percolator query loading.
[TEST] use pre 1.2.0 MATCH_ALL version if we test BWC for pre 1.2.0
clean shard bulk mapping update to only use type
today we track both the index name and type for mapping updates in the shard bulk action, but we only work against on index in this level, so no need to track the index name itself
closes #6695