OpenSearch/docs/reference
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
..
analysis Docs: add the predefined language-specific stopword lists to stop-tokenfilter.asciidoc 2014-10-16 13:20:38 +09:00
cat Cat API: Add node name to _cat/recovery 2014-10-27 09:47:26 +01:00
cluster Update update-settings.asciidoc 2014-10-22 12:46:33 +02:00
docs Docs: fix tags for dfs and new like parameter 2014-10-27 15:42:44 +01:00
images Docs: fix formula typo in documentation of the gauss decay in function_score 2014-09-01 09:46:13 +02:00
index-modules Docs: Fix curl statements in query-cache.asciidoc 2014-10-15 13:16:20 +02:00
indices Aliases: Throw exception if index is null or missing when creating an alias 2014-10-27 14:39:01 -04:00
mapping Mappings: Store _timestamp by default. 2014-10-20 12:17:26 +02:00
migration Search: Remove partial fields. 2014-10-20 12:29:30 +02:00
modules Documented that HTTP pipelining is not supported 2014-10-27 14:49:48 +01:00
query-dsl MLT Query: use ParseField#withAllDeprecated for percent_terms_to_match 2014-10-27 17:35:06 +01:00
search Aggregations: Return the sum of the doc counts of other buckets. 2014-10-27 12:11:26 +01:00
setup Docs: rolling upgrade process seems incorrect 2014-10-24 16:45:42 +02:00
testing Docs: Removed all the added/deprecated tags from 1.x 2014-09-26 21:04:42 +02:00
analysis.asciidoc Add more anchor links to documentation 2013-09-30 13:13:16 -06:00
api-conventions.asciidoc Docs: Removed all the added/deprecated tags from 1.x 2014-09-26 21:04:42 +02:00
cat.asciidoc [DOCS] reordered cat apis menu 2014-06-03 11:06:35 +02:00
cluster.asciidoc [DOCS] Fix HTTP endpoints after stats API changes 2014-01-09 11:30:28 +01:00
docs.asciidoc Bulk UDP: Removal. 2014-09-11 09:52:09 +02:00
getting-started.asciidoc Docs: fixed typo in documentation 2014-10-24 15:27:31 +02:00
glossary.asciidoc Migrated documentation into the main repo 2013-08-29 01:24:34 +02:00
index-modules.asciidoc [DOCS] Remove the section about codecs. 2014-08-07 11:24:44 +02:00
index.asciidoc Core: Added the `index.query.parse.allow_unmapped_fields` setting to fail queries if they refer to unmapped fields. 2014-09-09 15:00:47 +02:00
indices.asciidoc Add forgotten include for upgrade docs. 2014-10-10 10:55:45 -07:00
mapping.asciidoc Facets: Removal from master. 2014-08-21 10:34:39 +02:00
modules.asciidoc [DOCS] Fixed link to tribe.asciidoc 2014-01-13 22:01:12 +01:00
query-dsl.asciidoc Facets: Removal from master. 2014-08-21 10:34:39 +02:00
search.asciidoc Search Exists API: Checks if any matching documents exist for a given query 2014-07-31 15:42:30 -04:00
setup.asciidoc Docs: Removed all the added/deprecated tags from 1.x 2014-09-26 21:04:42 +02:00
testing.asciidoc [DOCS] Test framework documentation 2013-12-02 18:01:45 +01:00