Core: Fix script fields to be returned as a multivalued field when they produce a list.

This change is essentially the same as #3015 but on script fields.

Close #8592
Switch to forbidden-apis 1.7
Core: upgrade to current Lucene 5.0.0 snapshot

Elasticsearch no longer unlocks the Lucene index on startup (this was
dangerous, and could possibly lead to corruption).

Added the new serbian_normalization TokenFilter from Lucene.

NoLockFactory is no longer supported (index.store.fs.fs_lock = none),
and if you have a typo in your fs_lock you'll now hit a StoreException
instead of silently using NoLockFactory.

Closes #8588
Docs: Update plugins.asciidoc on river plugins section

Adding links to Amazon S3 and Google Drive river plugins

Closes #8544
Docs: Reword note regarding _source for accuracy

Previously it suggested _source was always present, when that is not the case.

Closes #8491
Remove NoneGateway, NoneGatewayAllocator, & NoneGatewayModule

Always use the LocalGateway* equivalents

We already check in the LocalGateway whether a node is a client node, or
is not master-eligible, and skip writing the state there. This allows us
to remove this code that was previously used only for tribe nodes (which
are not master eligible anyway and wouldn't write state) and in
tests (which can shake more bugs out)
Expose dist/pre/post options for SpanNotQuery
Use static int for easier to read code
Cleaner error handling. Pre without post (or vice versa) is not an error condition. Set appropriate defaults for pre/post.
Applied PR, changed the way defaults are handled and updated the docs.

Closes #4452
[GEO] Fix for geo_shape query with polygon from -180/90 to 180/-90

This fix adds a simple consistency check that intersection edges appear pairwise. Polygonal boundary tests were passing (false positive) on the Eastern side of the dateline simply due to the initial order (edge direction) of the intersection edges.  Polygons in the Eastern hemispehere (which were not being tested) were correctly failing inside of JTS due to an attempt to connect incorrect intersection edges (that is, edges that were not even intersections). While this patch fixes issue/8467 (and adds broader test coverage) it is not intented as a long term solution.  The mid term fix (in work) will refactor all geospatial computational geometry to use ENU / ECF coordinate systems for higher accuracy and eliminate brute force mercator checks and conversions.

Closes #8467
Removing IntersectionOrder.SENTINEL and adding Edge.MAX_COORDINATE for code readability.
Updating comments in BasePolygonBuilder to explain "pairwise" intersection
Fix SearchRequest.templateParams so that it is a Map<String, Object> so that it can take more data-types than just strings, to support Arrays.
[GATEWAY] Remove _state directory if index has been deleted

Today we try to delete the index directory if all shard locks have been
acquired. Yet, if this fails due to still running recoveries etc. We might
re-import the index as dangeling which also can happen if the node is restarted.
In contrast to the shard direcotries we can safely delete the metastate which is used
to import dangling indices while leaving the shard directories untouched.
Core: Fields defined in the `_default_` mapping of an index template should be picked up when an index alias filter is parsed if a new index is introduced when a document is indexed into an index that doesn't exist yet.

Closes #8473
Fielddata: Fix iterator over global ordinals.

Our iterator over global ordinals is currently incorrect since it does NOT
return -1 (NO_MORE_ORDS) when all ordinals have been consumed. This bug does
not strike immediately with elasticsearch since we always consume ordinals in
a random-access fashion. However it strikes when consuming ordinals through
Lucene helpers such as DocValues#docsWithField.

Close #8580
Spec: Fixes a few locations of the params array in JSON specification

A few locations of the `params` object in the JSON specification were not located in the `url` block.

Closes #8607
Snapshot/Restore: restore with wait_for_completion=true should wait for succesfully restored shards to get started

This commit ensures that restore operation with wait_for_completion=true doesn't return until all successfully restored shards are started. Before it was returning as soon as restore operation was over, which cause some shards to be unavailable immediately after restore completion.

Fixes #8340
Snapshot/Restore: fix compilation issue for JDK 1.7