OpenSearch/docs/reference/indices
Zachary Tong f5b2dfd052 Aliases: Throw exception if index is null or missing when creating an alias
Fixes a bug where alias creation would allow `null` for index name, which thereby
applied the alias to _all_ indices.  This patch makes the validator throw an
exception if the index is null.

```bash
POST /_aliases
{
   "actions": [
      {
         "add": {
            "alias": "empty-alias",
            "index": null
         }
      }
   ]
}
```
```json
{
   "error": "ActionRequestValidationException[Validation Failed: 1: Alias action [add]: [index] may not be null;]",
   "status": 400
}
```

The reason this bug wasn't caught by the existing tests is because
the old test for nullness only validated against a cluster which had
zero indices.  The null index is translated into "_all", and since
there are no indices, this fails because the index doesn't exist.
 So the test passes.

However, as soon as you add an index, "_all" resolves and you get the
situation described in the original bug report:  null index is
accepted by the alias, resolves to "_all" and gets applied to everything.

The REST tests, otoh, explicitly tested this bug as a real feature and therefore
passed.  The REST tests were modified to change this behavior.

Fixes #7863
2014-10-27 14:39:01 -04:00
..
aliases.asciidoc Aliases: Throw exception if index is null or missing when creating an alias 2014-10-27 14:39:01 -04:00
analyze.asciidoc [DOCS] Multiple doc fixes 2014-03-07 14:24:58 +01:00
clearcache.asciidoc Docs: Removed all the added/deprecated tags from 1.x 2014-09-26 21:04:42 +02:00
create-index.asciidoc Docs: Removed all the added/deprecated tags from 1.x 2014-09-26 21:04:42 +02:00
delete-index.asciidoc Added `action.destructive_requires_name` that controls whether wildcard expressions and `_all` is allowed to be used for destructive operat Also the delete index api requires always an index to be specified (either concrete index, alias or wildcard expression) 2014-01-09 11:36:50 +01:00
delete-mapping.asciidoc Make PUT and DELETE consistent for _mapping, _alias and _warmer 2014-01-14 20:02:43 +01:00
flush.asciidoc Docs: Removed all the added/deprecated tags from 1.x 2014-09-26 21:04:42 +02:00
get-field-mapping.asciidoc [DOCS] Updated the mapping and field mapping docs to use the new format 2014-05-06 17:21:09 +02:00
get-index.asciidoc Indices API: Added GET Index API 2014-09-11 11:19:21 +01:00
get-mapping.asciidoc Docs: Removed all the added/deprecated tags from 1.x 2014-09-26 21:04:42 +02:00
get-settings.asciidoc Consistent REST API changes for GETting data 2014-01-14 22:33:52 +01:00
indices-exists.asciidoc Migrated documentation into the main repo 2013-08-29 01:24:34 +02:00
open-close.asciidoc Added `action.destructive_requires_name` that controls whether wildcard expressions and `_all` is allowed to be used for destructive operat Also the delete index api requires always an index to be specified (either concrete index, alias or wildcard expression) 2014-01-09 11:36:50 +01:00
optimize.asciidoc Remove deprecations from master (follow up to #7922) 2014-10-07 08:35:11 -07:00
put-mapping.asciidoc Docs: Fix order for PUT _mapping docs 2014-10-16 18:49:36 +02:00
recovery.asciidoc [DOCS] Cat recovery API update 2014-05-18 17:43:13 -07:00
refresh.asciidoc Rename RobinEngine and friends to InternalEngine 2014-01-13 15:49:10 +01:00
segments.asciidoc Document the indices segments response format. 2014-02-21 12:01:32 +01:00
stats.asciidoc Docs: Removed all the added/deprecated tags from 1.x 2014-09-26 21:04:42 +02:00
templates.asciidoc Docs: Removed all the added/deprecated tags from 1.x 2014-09-26 21:04:42 +02:00
types-exists.asciidoc [DOCS] Removed outdated new/deprecated version notices 2013-09-03 21:28:31 +02:00
update-settings.asciidoc [ROUTING] Add rebalance enabled allocation decider 2014-10-23 14:07:13 +02:00
upgrade.asciidoc Docs: Tidied the upgrade indices docs 2014-10-11 16:22:24 +02:00
warmers.asciidoc Docs: Removed all the added/deprecated tags from 1.x 2014-09-26 21:04:42 +02:00