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.