[TESTS] Stabilize DisabledFieldDataFormatTests by setting number_of_replicas to 0.
[DOCS] : Indexed scripts/templates

These are the docs for the indexed scripts/templates feature.
Also moved the namespace for the REST endpoints.

Closes #6851
[DOCS][FIX] Fix doc parsing, broken closing block
[DOCS][FIX] Fix reference check in indexed scripts/templates doc.
Aggregations: Fixed Histogram key_as_string bug

The key as string field in the response for the histogram aggregation will now only show if format is specified on the request.

Closes #6655
[TEST] Verify if clear cache request went to all shards.
[DOCS] Move benchmark API to 1.4
Threadpool Info: Allow to serialize negative thread pool sizes

As a SizeValue is used for serializing the thread pool size, a negative number
resulted in throwing an exception when deserializing (using -ea an assertionerror
was thrown).

This fixes a check for changing the serialization logic, so that negative numbers are read correctly, by adding an internal UNBOUNDED value.

Closes #6325
Closes #5357
Add read/write lock semantics to KeyedLock
[FIELDDATA] Use KeyedLock in IndexFieldDataService

Today we synchronize when updating the IndexFieldDataService
datastructures. This might unnecessarily block progress if multiple
request need different fielddata instance for different fields.

This commit also fixes clear calls to actually consistently clear
the caches in the case of an exception.

Closes #6855
REST: Renamed indexed_script and indexed_template specs

The file name of the REST specs should be the same as
the endpoint which it documents.
REST: Fixed indexed script/template tests

The clients don't have access to the error message
for matching purposes.  Rewritten tests to work
with the clients
Serialization: Fix bwc issue by falling back to old threadpool serialization

This fixes an issue introduced by the serialization changes in #6486
which are not needed at all. Node that the serialization itself is not broken
but the TransportClient uses its own version on initial connect and getting
the NodeInfos.
[BUILD] Randomization script refactoring

1) Refactored randomization logic to the top
2) Add logics to support window platforms
Search: Added support for named filters/queries inside nested filters and queries.

Closes #6293
Query: When parent doc is found stop iterating over segments and continue with the next top matching child doc.

The parent doc has been found and there is no need to check subsequent segments.

Closes #6895
Closes #1843
Scripting: Remove setNextScore in SearchScript.

While it would be nice to do this all the way up the chain (into
score functions), this at least removes the weird dual
setNextScore/setScorer for SearchScripts.

closes #6864
Scripts: Make ScoreAccessor utility available for other script engines.

With the removal of setNextScore in #6864, script engines must use
the Scorer to find the score of a document.  The DocLookup is updated
appropriately to do this, but most script engines require a Number to be
bound for numeric variables.  Groovy already had an encapsulation for
this funtionality, and this moves it out to be shared with other script
engines.

closes #6898
[Scripts] GroovyScriptEngineService don't create ScoreAccess if lookup is null
Netty: Refactoring to make MessageChannelHandler extensible

Small refactorings to make the MessageChannelHandler more extensible.
Also allowed access to the different netty pipelines

Closes #6889