Illegal State Exception while adding watcher to ES 5.1.2 using X-Pack

Hi,

I have been trying to add a watcher on ES 5.1.2 using X-pack. I am getting IllegalStateException while using this payload for PUT _xpack/watcher/watch/first_watcher:

{
"trigger": {
"schedule": {
"interval": "10s"
}
},
"input": {
"search": {
"request": {
"indices": ["logstash-*"],
"body": {
"query": {
"bool": {
"must": [{
"match": {
"actionType": "SOME_ACTION_TYPE"
}
}, {
"range": {
"@timestamp": {
"gte": "now-1d",
"lt": "now"
}
}
}]
}
}
}
}
}
},
"condition": {
"compare": {
"ctx.payload.hits.total": {
"gt": 0
}
}
},
"actions": {
"send_email": {
"email": {
"to": "user@account.com",
"subject": "Notification Details",
"body": "Result: \n Notifications Sent: {{ctx.payload.hits.hits[0].sentCount}}, \n Time Taken: {{ctx.payload.hits.hits[0].timeTaken}}"
}
}
}
}

Excetion on elastic search logs:

[2017-02-13T07:47:36,598][WARN ][r.suppressed ] path: /_xpack/watcher/watch/first_watcher, params: {id=first_watcher}
java.lang.IllegalStateException: not started
at org.elasticsearch.xpack.watcher.WatcherService.ensureStarted(WatcherService.java:251) ~[x-pack-5.1.2.jar:5.1.2]
at org.elasticsearch.xpack.watcher.WatcherService.putWatch(WatcherService.java:132) ~[x-pack-5.1.2.jar:5.1.2]
at org.elasticsearch.xpack.watcher.transport.actions.put.TransportPutWatchAction.masterOperation(TransportPutWatchAction.java:76) [x-pack-5.1.2.jar:5.1.2]
at org.elasticsearch.xpack.watcher.transport.actions.put.TransportPutWatchAction.masterOperation(TransportPutWatchAction.java:43) [x-pack-5.1.2.jar:5.1.2]
at org.elasticsearch.action.support.master.TransportMasterNodeAction.masterOperation(TransportMasterNodeAction.java:86) [elasticsearch-5.1.2.jar:5.1.2]
at org.elasticsearch.action.support.master.TransportMasterNodeAction$AsyncSingleAction$3.doRun(TransportMasterNodeAction.java:170) [elasticsearch-5.1.2.jar:5.1.2]
at org.elasticsearch.common.util.concurrent.ThreadContext$ContextPreservingAbstractRunnable.doRun(ThreadContext.java:527) [elasticsearch-5.1.2.jar:5.1.2]
at org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:37) [elasticsearch-5.1.2.jar:5.1.2]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [?:1.8.0_121]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [?:1.8.0_121]
at java.lang.Thread.run(Thread.java:745) [?:1.8.0_121]

Response:

{
"error": {
"root_cause": [{
"type": "illegal_state_exception",
"reason": "not started"
}],
"type": "illegal_state_exception",
"reason": "not started"
},
"status": 500
}

I have tried reindexing also, but still I am getting the same error.

Hey,

have you made sure that watcher is start? You can start watcher using the start API.

However there might be a reason why starting does not work - maybe one of the required shards is not ready or closed. Can you run this as well

GET _cat/indices/.watch*,.triggered*?v

Thanks.

--Alex

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