Fix bug in explain for function_score queries.

The explain output for function_score queries with score_mode=max or
score_mode=min was incorrect, returning instead the value of the last
function.  This change fixes this.
moved log statements
Preference only_node with unknown nodeId returns useful exception

When the search preference is set to only node, but this node is not a
data (or does not exist), we return a search exception, which indicates,
that this is actually a server problem.

However specifying a non-existing node id is a client problem
and should return a more useful error message than
{"error":"SearchPhaseExecutionException[Failed to execute phase [query_fetch], all shards failed]","status":503}
Introduce BytesTransportRequest, allowing for downstream network optimization in buffers usage
When sending a request, mainly to multiple nodes, if we already have the "body" of the request in bytes, we can share it instead of copying it over to a new buffer. Also, it helps a lot when sending a relatively large body to multiple nodes, since it will use the same body buffer across all nodes
Add wildcard support to field resolving in the Get Field Mapping API

Closes #4367
Packaging: Ensure setting of sysctl vm.max_map_count

In order to be sure that memory mapped lucene directories are working
one can configure the kernel about how many memory mapped areas
a process may have. This setting ensure for the debian and redhat initscripts
as well as the systemd startup, that this setting is set high enough.

Closes #4397
SloppyMath

Added copy of SloppyMath.java from lucene 4.6+
and setup GeoDistance for new haversin method

closes #3862
introduce an internal metadata uuid
Make listeners a final field in ShardIndexingService, which fixed possible visibility issue.
Batch processing mapping updates can cause missed merged mappings when batching multiple types
when we bulk changes, we need to use the same index metadata builder across the tasks, otherwise we might remove mappings erroneously
 also, when we check if we can use a higher order mapping, we need to verify that its for the same mapping type
bulk response has errors indication + status per item
closes #4002
Invoke the DocumentType listeners *before* the mappers are updated. This fixes an issue where if two or more concurrent percolate index requests are processed, the first request would the `.percolator` type mapping, but the real time percolator listener wouldn't be active, this would result in that the subsequent concurrent requests wouldn't be parsed and kept in memory and would never be included in any percolate api result. This issue any occurred when `.percolator` type is created on the fly.

Also made the call to PercolatorQueriesRegistry#enableRealTimePercolator and #disableRealTimePercolator synchronized, so that for the same shard the RealTimePercolatorOperationListener can't registered twice.
Renamed the methods in DocumentListenerType to actually reflect when these are invoked.
Unified default ack timeout to 30 seconds

Increased also default publish state timeout to 30 seconds (from 5 seconds) and introduced constant for it.
Introduced AcknowledgedRequest.DEFAULT_ACK_TIMEOUT constant.
Removed misleading default values coming from the REST layer.
Removed (in a bw compatible manner) the timeout support in put/delete index template as the timeout parameter was ignored.

Closes #4395
More common AcknowledgedRestResponseActionListener

Introduced use of AcknowledgedRestResponseActionListener in put/delete alias & delete index
Introduced ok & acknowledged constant in AcknowledgedRestResponseActionListener
Squashed old stuff :D
If a custom postings format is used, wrap the TermsEnum
Make filter settings static strings
Begin removing circuit breaker stats as dedicated stat