# 405 error when calling /\_cluster/health?level=indices from a watcher

**URL:** <https://discuss.elastic.co/t/405-error-when-calling-cluster-health-level-indices-from-a-watcher/262457>\
**Category:** Elasticsearch\
**Created:** [January 28, 2021, 6:37am UTC](https://discuss.elastic.co/t/405-error-when-calling-cluster-health-level-indices-from-a-watcher/262457 "2021-01-28T06:37:29Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![mkadiri](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mkadiri/32/82953_2.png) [@mkadiri](https://discuss.elastic.co/u/mkadiri)\
**Post date:** [January 28, 2021, 6:37am UTC](https://discuss.elastic.co/t/405-error-when-calling-cluster-health-level-indices-from-a-watcher/262457/1 "2021-01-28T06:37:29Z")

</div>

I'm trying to setup a watcher to display indices health using the endpoint mentioned but keep getting a 405 error.

This error goes away when I just use the following `/_cluster/health` dropping the params `?level=indices`, I'm not sure what I'm doing wrong as the endpoint is a GET endpoint.

> Incorrect HTTP method for uri [/\_cluster/health%3Flevel=indices] and method [GET], allowed: [POST]

```
PUT _xpack/watcher/watch/cluster_healthcheck_not_green
{
  "trigger" : {
    "schedule" : { "interval" : "10s" }
  },
  "input" : {
    "http" : {
      "request" : {
       "scheme": "https",
       "host" : "....eu-west-1.aws.found.io",
       "port" : 9243,
       "path" : "/_cluster/health?level=indices",
       "auth": {
          "basic": {
            "username": "...",
            "password": "..."
          }
        }
      }
    }
  },
  "condition" : {
    "compare" : {
      "ctx.payload.status" : { "not_eq" : "green" }
    }
  },
  "actions": {
    "notify-slack": {
      "throttle_period" : "5m",
      "slack" : {
        "message" : {
          "to" : ["#elasticsearch-alerts-test"],
          "text" : "Cluster health should be \"green\""
        }
      }
    }
  }
}

```

---

<div class="post-metadata">

**Author:** ![DavidTurner](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/davidturner/32/22453_2.png) [@DavidTurner](https://discuss.elastic.co/u/DavidTurner)\
**Post date:** [January 28, 2021, 8:12am UTC](https://discuss.elastic.co/t/405-error-when-calling-cluster-health-level-indices-from-a-watcher/262457/2 "2021-01-28T08:12:06Z")

</div>

It's not a great error message, but the problem is that you need to do `GET /_cluster/health?level=indices` and you are doing `GET /_cluster/health%3Flevel=indices` which are not the same thing at all. The `?level=indices` bit isn't part of the `path`, it goes in the `params` field instead. See [https://www.elastic.co/guide/en/elasticsearch/reference/current/input-http.html#\_calling\_elasticsearch\_apis](https://www.elastic.co/guide/en/elasticsearch/reference/current/input-http.html#_calling_elasticsearch_apis) for more details.

---

<div class="post-metadata">

**Author:** ![mkadiri](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mkadiri/32/82953_2.png) [@mkadiri](https://discuss.elastic.co/u/mkadiri)\
**Post date:** [January 28, 2021, 8:30am UTC](https://discuss.elastic.co/t/405-error-when-calling-cluster-health-level-indices-from-a-watcher/262457/3 "2021-01-28T08:30:19Z")

</div>

Thank you, worked perfectly 👍

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [February 25, 2021, 8:30am UTC](https://discuss.elastic.co/t/405-error-when-calling-cluster-health-level-indices-from-a-watcher/262457/4 "2021-02-25T08:30:23Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
