# Elasticsearch - 'network.host': is not allowed

**URL:** https://discuss.elastic.co/t/elasticsearch-network-host-is-not-allowed/272669
**Category:** Elasticsearch
**Created:** [May 11, 2021, 10:08am UTC](https://discuss.elastic.co/t/elasticsearch-network-host-is-not-allowed/272669 "2021-05-11T10:08:45Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![mfa](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mfa/32/87041_2.png) [@mfa](https://discuss.elastic.co/u/mfa)
#### Post date: [May 11, 2021, 10:08am UTC](https://discuss.elastic.co/t/elasticsearch-network-host-is-not-allowed/272669/1 "2021-05-11T10:08:45Z")

</div>

I am using ElasticCloud , version v7.12.1, I have sat up a watcher for health check of cluster that it looks like below:

```auto
    PUT _watcher/watch/cluster_health_watch
    {
      "trigger" : {
        "schedule" : { "cron" : "0 0/5 * * * ?" }
      },
      "input" : {
        "http" : {
          "request" : {
            "host" : "localhost",
            "port" : 9200,
            "path" : "/_cluster/health",
            "auth": {
              "basic": {
                "username": "Myuser",
                "password": "mypassword"
              }
            }
          }
        }
      },
      "condition" : {
        "compare" : {
          "ctx.payload.status" : { "not_eq" : "green" }
        }
      },
      "actions" : {
      "slackmonitoring" : {
        "throttle_period" : "5m",
        "slack" : {
          "message" : {
            "to" : ["test-webhook"], 
            "text" : "Cluster is Unhealthy!" 
          }
        }
      }}
    }

```

It fails with this error:

```auto
"input": {
      "type": "http",
      "status": "failure",
      "error": {
        "root_cause": [
          {
            "type": "http_host_connect_exception",
            "reason": "Connect to localhost:9200 [localhost/127.0.0.1] failed: Connection refused"
          }
        ],

```

After doing some search, someone suggested to add:  
network.host: 127.0.0.1 to elasticsearch.yml  
However when I add it and try to save it I get this error:

Elasticsearch - 'network.host': is not allowed

I could not find any documentation regarding this issue and a solution for it, I would appreciate if someone can help.

---

<div class="post-metadata">

### Author: ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)
#### Post date: [May 11, 2021, 10:35am UTC](https://discuss.elastic.co/t/elasticsearch-network-host-is-not-allowed/272669/2 "2021-05-11T10:35:35Z")

</div>

IMO you would need to use the public endpoint of your Elasticsearch instance instead.

Something like:

```auto
"input" : {
  "http" : {
    "request" : {
      "url" : "https://REDACTED.cloud.es.io:9243/_cluster/health",
      "auth" : {
        "basic" : {
          "username" : "Myuser",
          "password" : "mypassword"
        }
      }
    }
  }
}

```

---

<div class="post-metadata">

### Author: ![mfa](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mfa/32/87041_2.png) [@mfa](https://discuss.elastic.co/u/mfa)
#### Post date: [May 11, 2021, 11:12am UTC](https://discuss.elastic.co/t/elasticsearch-network-host-is-not-allowed/272669/3 "2021-05-11T11:12:03Z")

</div>

Thanks for reply.  
After setting the public endpoint the state became OK 👍 but it doesn't send message to slack and I can see error: 404 Not found under the execution history:

(Just mentioning that in order to test the slack notification I changed the condition to eq: green. the slack notification works fine if I remove the input just for testing purpose)

```auto
{
  "watch_id": "cluster_health_watch",
  "node": " *****",
  "state": "execution_not_needed",
  "user": " ******",
  "status": {
    "state": {
      "active": true,
      "timestamp": "2021-05-11T10:58:04.326Z"
    },
    "last_checked": "2021-05-11T11:05:00.232Z",
    "actions": {
      "slackmonitoring": {
        "ack": {
          "timestamp": "2021-05-11T10:58:04.326Z",
          "state": "awaits_successful_execution"
        }
      }
    },
    "execution_state": "execution_not_needed",
    "version": -1
  },
  "trigger_event": {
    "type": "schedule",
    "triggered_time": "2021-05-11T11:05:00.232Z",
    "schedule": {
      "scheduled_time": "2021-05-11T11:05:00.000Z"
    }
  },
  "input": {
    "http": {
      "request": {
        "scheme": "https",
        "host": " ****.eu-west-1.aws.found.io",
        "port": 9243,
        "method": "get",
        "path": "/_cluster/health",
        "params": {},
        "headers": {},
        "auth": {
          "basic": {
            "username": " ****",
            "password": " ****"
          }
        }
      }
    }
  },
  "condition": {
    "compare": {
      "ctx.payload.status": {
        "eq": "green"
      }
    }
  },
  "result": {
    "execution_time": "2021-05-11T11:05:00.232Z",
    "execution_duration": 79,
    "input": {
      "type": "http",
      "status": "success",
      "payload": {
        "_headers": {
          "date": [
            "Tue, 11 May 2021 11:05:00 GMT"
          ],
          "content-length": [
            "60"
          ],
          "kbn-name": [
            " ******"
          ],
          "kbn-license-sig": [
            " *****"
          ],
          "x-cloud-request-id": [
            " *****"
          ],
          "content-type": [
            "application/json; charset=utf-8"
          ],
          "x-found-handling-cluster": [
            " *****"
          ],
          "cache-control": [
            "private, no-cache, no-store, must-revalidate"
          ],
          "x-found-handling-instance": [
            "instance-0000000000"
          ]
        },
        "error": "Not Found",
        "message": "Not Found",
        "_status_code": 404,
        "statusCode": 404
      },
      "http": {
        "request": {
          "host": " ****.eu-west-1.aws.found.io",
          "port": 9243,
          "scheme": "https",
          "method": "get",
          "path": "/_cluster/health",
          "auth": {
            "basic": {
              "username": " ****",
              "password": " ****"
            }
          }
        },
        "status_code": 404
      }
    },
    "condition": {
      "type": "compare",
      "status": "success",
      "met": false,
      "compare": {
        "resolved_values": {
          "ctx.payload.status": null
        }
      }
    },
    "actions": []
  },
  "messages": []
}

```

How can I fix that? and why am I getting that error?

---

<div class="post-metadata">

### Author: ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)
#### Post date: [May 11, 2021, 2:29pm UTC](https://discuss.elastic.co/t/elasticsearch-network-host-is-not-allowed/272669/4 "2021-05-11T14:29:35Z")

</div>

Are you sure that you put the Elasticsearch URL and not the Kibana URL?

---

<div class="post-metadata">

### Author: ![mfa](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mfa/32/87041_2.png) [@mfa](https://discuss.elastic.co/u/mfa)
#### Post date: [May 11, 2021, 2:52pm UTC](https://discuss.elastic.co/t/elasticsearch-network-host-is-not-allowed/272669/5 "2021-05-11T14:52:00Z")

</div>

Oh yes...I used kibana endpoint by mistake. Thanks for your help. It works fine now.

---

<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: [June 8, 2021, 2:52pm UTC](https://discuss.elastic.co/t/elasticsearch-network-host-is-not-allowed/272669/6 "2021-06-08T14:52:13Z")

</div>

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