# Shield blocking Watcher to query in Elasticsearch

**URL:** https://discuss.elastic.co/t/shield-blocking-watcher-to-query-in-elasticsearch/40028
**Category:** Elasticsearch
**Tags:** elastic-stack-security
**Created:** [January 25, 2016, 1:55pm UTC](https://discuss.elastic.co/t/shield-blocking-watcher-to-query-in-elasticsearch/40028 "2016-01-25T13:55:20Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![rajkamalkool6](https://avatars.discourse-cdn.com/v4/letter/r/e9c0ed/32.png) [@rajkamalkool6](https://discuss.elastic.co/u/rajkamalkool6)
#### Post date: [January 25, 2016, 1:55pm UTC](https://discuss.elastic.co/t/shield-blocking-watcher-to-query-in-elasticsearch/40028/1 "2016-01-25T13:55:20Z")

</div>

I am using Elasticsearch with Shield. When I am trying to execute Watcher I am getting the below error.

> ElasticsearchSecurityException[missing authentication token for REST request [/\_cluster/health]]  
> at org.elasticsearch.shield.support.Exceptions.authenticationError(Exceptions.java:39)  
> at org.elasticsearch.shield.authc.DefaultAuthenticationFailureHandler.missingToken(DefaultAuthenticationFailureHandler.java:65)  
> at org.elasticsearch.shield.authc.InternalAuthenticationService.authenticate(InternalAuthenticationService.java:96)  
> at org.elasticsearch.shield.rest.ShieldRestFilter.process(ShieldRestFilter.java:71)  
> at org.elasticsearch.rest.RestController$ControllerFilterChain.continueProcessing(RestController.java:265)  
> at org.elasticsearch.rest.RestController.dispatchRequest(RestController.java:176)  
> at org.elasticsearch.http.HttpServer.internalDispatchRequest(HttpServer.java:128)

I am trying to create the Watcher with username and password which I was included in roles.yml.

I am using the below code to create Watcher

> curl --user XXX:XXX -XPUT '[http://localhost:9200/\_watcher/watch/cluster\_health](http://localhost:9200/_watcher/watch/cluster_health)' -d '{  
> "trigger" : {  
> "schedule" : { "interval" : "10s" }  
> },  
> "input" : {  
> "http" : {  
> "request" : {  
> "host" : "localhost",  
> "port" : 9200,  
> "path" : "/\_cluster/health"  
> }  
> }  
> },  
> "condition" : {  
> "compare" : {  
> "ctx.payload.status" : { "eq" : "Yellow" }  
> }  
> }

Do I need to include any properties in shield or elasticsearch.yml or in wtacher.

Thanks in advance!!!

---

<div class="post-metadata">

### Author: ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)
#### Post date: [January 25, 2016, 2:50pm UTC](https://discuss.elastic.co/t/shield-blocking-watcher-to-query-in-elasticsearch/40028/2 "2016-01-25T14:50:37Z")

</div>

Hey,

you need to supply authentication information, when executing the http request pointing to `/_cluster/health`.

See the `auth` setting for the HTTP input. See [the http input documentation](https://www.elastic.co/guide/en/watcher/current/input.html#input-http-auth-basic-example)

--Alex

---

<div class="post-metadata">

### Author: ![rajkamalkool6](https://avatars.discourse-cdn.com/v4/letter/r/e9c0ed/32.png) [@rajkamalkool6](https://discuss.elastic.co/u/rajkamalkool6)
#### Post date: [January 25, 2016, 3:13pm UTC](https://discuss.elastic.co/t/shield-blocking-watcher-to-query-in-elasticsearch/40028/3 "2016-01-25T15:13:49Z")

</div>

Thank you so much. It resolved the issue.

---

<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: [July 6, 2017, 1:47pm UTC](https://discuss.elastic.co/t/shield-blocking-watcher-to-query-in-elasticsearch/40028/4 "2017-07-06T13:47:09Z")

</div>


