OpenSearch/docs/reference
Lee Hinman 80ab366de4 Add API to explain why a shard is or isn't assigned
This adds a new `/_cluster/allocation/explain` API that explains why a
shard can or cannot be allocated to nodes in the cluster. Additionally,
it will show where the master *desires* to put the shard, according to
the `ShardsAllocator`.

It looks like this:

```
GET /_cluster/allocation/explain?pretty
{
  "index": "only-foo",
  "shard": 0,
  "primary": false
}
```

Though, you can optionally send an empty body, which means "explain the
allocation for the first unassigned shard you find".

The output when a shard is unassigned looks like this:

```
{
  "shard" : {
    "index" : "only-foo",
    "index_uuid" : "KnW0-zELRs6PK84l0r38ZA",
    "id" : 0,
    "primary" : false
  },
  "assigned" : false,
  "unassigned_info" : {
    "reason" : "INDEX_CREATED",
    "at" : "2016-03-22T20:04:23.620Z"
  },
  "nodes" : {
    "V-Spi0AyRZ6ZvKbaI3691w" : {
      "node_name" : "Susan Storm",
      "node_attributes" : {
        "bar" : "baz"
      },
      "final_decision" : "NO",
      "weight" : 0.06666675,
      "decisions" : [ {
        "decider" : "filter",
        "decision" : "NO",
        "explanation" : "node does not match index include filters [foo:\"bar\"]"
      } ]
    },
    "Qc6VL8c5RWaw1qXZ0Rg57g" : {
      "node_name" : "Slipstream",
      "node_attributes" : {
        "bar" : "baz",
        "foo" : "bar"
      },
      "final_decision" : "NO",
      "weight" : -1.3833332,
      "decisions" : [ {
        "decider" : "same_shard",
        "decision" : "NO",
        "explanation" : "the shard cannot be allocated on the same node id [Qc6VL8c5RWaw1qXZ0Rg57g] on which it already exists"
      } ]
    },
    "PzdyMZGXQdGhqTJHF_hGgA" : {
      "node_name" : "The Symbiote",
      "node_attributes" : { },
      "final_decision" : "NO",
      "weight" : 2.3166666,
      "decisions" : [ {
        "decider" : "filter",
        "decision" : "NO",
        "explanation" : "node does not match index include filters [foo:\"bar\"]"
      } ]
    }
  }
}
```

And when the shard *is* assigned, the output looks like:

```
{
  "shard" : {
    "index" : "only-foo",
    "index_uuid" : "KnW0-zELRs6PK84l0r38ZA",
    "id" : 0,
    "primary" : true
  },
  "assigned" : true,
  "assigned_node_id" : "Qc6VL8c5RWaw1qXZ0Rg57g",
  "nodes" : {
    "V-Spi0AyRZ6ZvKbaI3691w" : {
      "node_name" : "Susan Storm",
      "node_attributes" : {
        "bar" : "baz"
      },
      "final_decision" : "NO",
      "weight" : 1.4499999,
      "decisions" : [ {
        "decider" : "filter",
        "decision" : "NO",
        "explanation" : "node does not match index include filters [foo:\"bar\"]"
      } ]
    },
    "Qc6VL8c5RWaw1qXZ0Rg57g" : {
      "node_name" : "Slipstream",
      "node_attributes" : {
        "bar" : "baz",
        "foo" : "bar"
      },
      "final_decision" : "CURRENTLY_ASSIGNED",
      "weight" : 0.0,
      "decisions" : [ {
        "decider" : "same_shard",
        "decision" : "NO",
        "explanation" : "the shard cannot be allocated on the same node id [Qc6VL8c5RWaw1qXZ0Rg57g] on which it already exists"
      } ]
    },
    "PzdyMZGXQdGhqTJHF_hGgA" : {
      "node_name" : "The Symbiote",
      "node_attributes" : { },
      "final_decision" : "NO",
      "weight" : 3.6999998,
      "decisions" : [ {
        "decider" : "filter",
        "decision" : "NO",
        "explanation" : "node does not match index include filters [foo:\"bar\"]"
      } ]
    }
  }
}
```

Only "NO" decisions are returned by default, but all decisions can be
shown by specifying the `?include_yes_decisions=true` parameter in the
request.

Resolves #14593
2016-03-28 15:21:02 -06:00
..
aggregations Document 5.0 mapping changes. 2016-03-22 16:22:58 +01:00
analysis Document 5.0 mapping changes. 2016-03-22 16:22:58 +01:00
cat Fix column aliases in _cat/indices, _cat/nodes and _cat/shards APIs #17101 2016-03-16 19:18:43 +03:00
cluster Add API to explain why a shard is or isn't assigned 2016-03-28 15:21:02 -06:00
docs [reindex] Add thottling support 2016-03-22 12:34:14 -04:00
images Aggregations: add serial differencing pipeline aggregation 2015-07-10 18:22:01 -04:00
index-modules Document 5.0 mapping changes. 2016-03-22 16:22:58 +01:00
indices document suggest stats being merged with search stats 2016-03-23 16:37:57 -04:00
ingest Docs: Added the ingest node to the modules/nodes page 2016-03-15 19:03:18 +01:00
mapping Document 5.0 mapping changes. 2016-03-22 16:22:58 +01:00
migration Enforce `discovery.zen.minimum_master_nodes` is set when bound to a public ip #17288 2016-03-25 12:56:20 +01:00
modules Tidied the Painless docs and added the experimental tag 2016-03-24 18:34:40 +01:00
query-dsl Merge pull request #17272 from pengqiuyuan/master 2016-03-24 16:49:49 +01:00
release-notes Docs: Added 5.0.0-alpha1 release notes 2016-03-18 14:51:49 +01:00
search Tidied up percolator doc annotations 2016-03-25 15:36:51 +01:00
setup Bootstrap does not set system properties 2016-03-13 20:09:15 -04:00
tasks Task Management: Add framework for registering and communicating with tasks 2016-01-05 12:24:43 -05:00
testing Docs: Fix nodeSettings example for integ tests to use correct Settings.Builder reference 2015-12-17 23:17:17 -08:00
aggregations.asciidoc Merge pull request #16741 from blachniet/patch-1 2016-03-02 10:57:56 +01:00
analysis.asciidoc Remove ICU Plugin in reference guide 2015-12-29 11:23:28 +01:00
api-conventions.asciidoc Update api-conventions.asciidoc 2016-03-04 10:10:29 +01:00
cat.asciidoc Fixed asciidoc issues 2016-02-05 14:47:44 +01:00
cluster.asciidoc Add API to explain why a shard is or isn't assigned 2016-03-28 15:21:02 -06:00
docs.asciidoc Docs: Display reindex/update by query API and fix build doc issue 2016-03-18 10:44:16 +01:00
getting-started.asciidoc Bootstrap does not set system properties 2016-03-13 20:09:15 -04:00
glossary.asciidoc Networking: Move multicast discovery to a plugin 2015-08-20 16:43:25 -07:00
index-modules.asciidoc Redocument the `index.merge.scheduler.max_thread_count` setting 2016-03-05 16:28:43 +01:00
index.asciidoc Docs: Build release notes 2016-03-18 15:04:49 +01:00
indices.asciidoc Remove warmers and the warmer API. 2016-01-07 09:57:07 +01:00
ingest.asciidoc Docs: Added the ingest node to the modules/nodes page 2016-03-15 19:03:18 +01:00
mapping.asciidoc Document 5.0 mapping changes. 2016-03-22 16:22:58 +01:00
modules.asciidoc Docs: Adding Painless to the Scripting documentation. 2016-03-23 13:52:40 -07:00
query-dsl.asciidoc Fixed broken xrefs to query-dsl-not-query, which has been removed. 2015-10-20 13:01:37 -07:00
redirects.asciidoc Change the field mapping index time boost into a query time boost. 2016-03-04 11:47:35 +01:00
release-notes.asciidoc Docs: Added 5.0.0-alpha1 release notes 2016-03-18 14:51:49 +01:00
search.asciidoc Add documentation for global search timeout 2016-01-07 10:42:18 -05:00
setup.asciidoc Bootstrap does not set system properties 2016-03-13 20:09:15 -04:00
testing.asciidoc [DOCS] Test framework documentation 2013-12-02 18:01:45 +01:00