# Unknown input type \[condition\]

**URL:** <https://discuss.elastic.co/t/unknown-input-type-condition/2083>\
**Category:** Elasticsearch\
**Tags:** elastic-stack-alerting\
**Created:** [June 7, 2015, 10:37am UTC](https://discuss.elastic.co/t/unknown-input-type-condition/2083 "2015-06-07T10:37:15Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![peterColclough](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/petercolclough/32/44777_2.png) [@peterColclough](https://discuss.elastic.co/u/peterColclough)\
**Post date:** [June 7, 2015, 10:37am UTC](https://discuss.elastic.co/t/unknown-input-type-condition/2083/1 "2015-06-07T10:37:15Z")

</div>

Noob question here (or dumb on a Sunday morning 🙂 ). I am getting one of these when tryng to register a watch:  
{"error":"WatcherException[failed to put watch [mysql\_slow\_watch]]; nested: InputException[could not parse input for watch [mysql\_slow\_watch]. unknown input type [condition]]; ","status":500}

# My Watch looks like this:

curl -XPUT 'http://[my\_host]:[my\_port]/\_watcher/watch/mysql\_slow\_watch' -d '{  
"trigger" : {  
"schedule" : { "interval" : "10s" }  
},  
"input" : {  
"search" : {  
"request" : {  
"indices" : ["myindex"],  
"body" : {  
"query": {  
"bool": {  
"must": [  
{  
"range": {  
"query\_data.queryTime": {  
"from": 10  
}  
}  
}  
],  
"must\_not": [],  
"should": []  
}  
},  
"filter": {  
"range": {  
"@timestamp" : {  
"from": "{{ctx.trigger.scheduled\_time}}||-10s",  
"to": "{{ctx.trigger.triggered\_time}}"  
}  
}  
}  
}

```
}

```

# }, "condition" : { "compare" : { "ctx.payload.hits.total" : { "gte" : 1 }} }, "actions" : { "log\_error" : { "logging" : { "text" : "Found {{ctx.payload.hits.total}} Slow Queries Found" } } } }'

Can someone tell me what I have missed here? Do I have to create a mapping for 'mysql\_slow\_watch', like a normal ES index (I thought that was what this should do).

Thanks

Peter C

---

<div class="post-metadata">

**Author:** ![shaunak](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/shaunak/32/6643_2.png) [@shaunak](https://discuss.elastic.co/u/shaunak)\
**Post date:** [June 7, 2015, 11:01am UTC](https://discuss.elastic.co/t/unknown-input-type-condition/2083/2 "2015-06-07T11:01:56Z")

</div>

Hi Peter, it looks like the request JSON is missing a closing curly brace at the end of the "input" object. Once you add it, the request JSON will look like this:

```
{
  "trigger": {
    "schedule": { "interval": "10s" }
  },
  "input": {
    "search": {
      "request": {
        "indices": ["myindex"],
        "body": {
          "query": {
            "bool": {
              "must": [
                {
                  "range": {
                    "query_data.queryTime": {
                      "from": 10
                    }
                  }
                }
              ],
              "must_not": [],
              "should": []
            }
          },
          "filter": {
            "range": {
              "@timestamp": {
                "from": "{{ctx.trigger.scheduled_time}}||-10s",
                "to": "{{ctx.trigger.triggered_time}}"
              }
            }
          }
        }
      }
    }
  },
  "condition": {
    "compare": { "ctx.payload.hits.total":{ "gte":1 } }
  },
  "actions": {
    "log_error": {
      "logging": {
        "text": "Found {{ctx.payload.hits.total}} Slow Queries Found"
      }
    }
  }
}
```

---

<div class="post-metadata">

**Author:** ![peterColclough](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/petercolclough/32/44777_2.png) [@peterColclough](https://discuss.elastic.co/u/peterColclough)\
**Post date:** [June 7, 2015, 3:57pm UTC](https://discuss.elastic.co/t/unknown-input-type-condition/2083/3 "2015-06-07T15:57:42Z")

</div>

Shaunak.. thank you.. that was extremely dumb of me.. show why you should wake up before playing with new software.  
Thanks again....  
Peter C

---

<div class="post-metadata">

**Author:** ![shaunak](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/shaunak/32/6643_2.png) [@shaunak](https://discuss.elastic.co/u/shaunak)\
**Post date:** [June 7, 2015, 4:13pm UTC](https://discuss.elastic.co/t/unknown-input-type-condition/2083/4 "2015-06-07T16:13:57Z")

</div>

No problem! We've all been there 😜

---

<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:49pm UTC](https://discuss.elastic.co/t/unknown-input-type-condition/2083/5 "2017-07-06T13:49:40Z")

</div>


