[DOCS] Java API JSON typo
Terms aggs: only use ordinals on low-cardinality fields by default.

Close #5303
Fix sorting of NaN values in terms aggregations.

Closes #5236.
Added unit tests for terms and histogram sorting on sub aggregations that return NaN.
Fix NPE/AIOOBE when building a bucket which has not been collected.

Close #5048
Fix `metric` impl on unmapped fields.
Rewrite BytesStreamOutput on top of BigArrays/ByteArray.

Fix for #5159
check for null term in PagedBytesEstimator.bytesPerValue()

Fixes #5326
Implement custom circuit breaker estimator for parent/child field data
Force merges to not happen when indexing a doc / flush
Today, even though our merge policy doesn't return new merge specs on SEGMENT_FLUSH, merge on the scheduler is still called on flush time, and can cause merges to stall indexing during merges. Both for the concurrent merge scheduler (the default) and the serial merge scheduler. This behavior become worse when throttling kicks in (today at 20mb per sec).

In order to solve it (outside of Lucene for now), we wrap the merge scheduler with an EnableMergeScheduler, where, on the thread level, using a thread local, the call to merge can be enabled/disabled.

A Merges helper class is added where all explicit merges operations should go through. If the scheduler is the enabled one, it will enable merges before calling the relevant explicit method call. In order to make sure Merges is the only class that calls the explicit merge calls, the IW variant of them is added to the forbidden APIs list.

closes #5319
[DOCS] add Elasticsearch Image Plugin
Fix issue where circuit breaker was always reset to 80% upon startup
[DOCS] Formatting error

Closes #5346
if there is no master node id, make sure not to fail the cat call, and report x
[DOCS] Update boolean mapping docs with a full list of values that are treated as false

Closes #5337
Added support for sorting buckets based on sub aggregations

 Supports sorting on sub-aggs down the current hierarchy. This is supported as long as the aggregation in the specified order path are of a single-bucket type, where the last aggregation in the path points to either a single-bucket aggregation or a metrics one. If it's a single-bucket aggregation, the sort will be applied on the document count in the bucket (i.e. doc_count), and if it is a metrics type, the sort will be applied on the pointed out metric (in case of a single-metric aggregations, such as avg, the sort will be applied on the single metric value)

 NOTE: this commit adds a constraint on what should be considered a valid aggregation name. Aggregations names must be alpha-numeric and may contain '-' and '_'.

 Closes #5253
Nicer failure message when node should not connect to another in nodes API
There are cases where nodes should not connect to another node. For example, client nodes do not connect to other client nodes. When executing a nodes level API, we should have a nicer failure indicating that, and not log it by default, as its not a real failure
Added support for aliases to index templates

Adapted existing PR (#2739) to updated code (post #4920), added tests and docs (@javanna)

Closes #1825
Improved how aliases get parsed in create index

Added also CreateIndexRequest#aliases(BytesReference) method
[TESTS] Fixed YAML in put_templates test