# Request.types not working in ECE Watcher

**URL:** https://discuss.elastic.co/t/request-types-not-working-in-ece-watcher/148509
**Category:** Elasticsearch
**Tags:** elastic-stack-alerting
**Created:** [September 13, 2018, 7:43pm UTC](https://discuss.elastic.co/t/request-types-not-working-in-ece-watcher/148509 "2018-09-13T19:43:27Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![gautu7](https://avatars.discourse-cdn.com/v4/letter/g/c89c15/32.png) [@gautu7](https://discuss.elastic.co/u/gautu7)
#### Post date: [September 13, 2018, 7:43pm UTC](https://discuss.elastic.co/t/request-types-not-working-in-ece-watcher/148509/1 "2018-09-13T19:43:27Z")

</div>

Hi,

I am trying to execute Watchers which pulls in certain types directly and perform actions it. When I use **types** to specify the type to read like in the example below, it doesn't work, but does work when I remove types, but I do not want to search a whole lot of data unnecessarily. The other work around I did was to match the type in the inner query. Is it different how this works in ECE or am I missing something here?  
This doesn't work -  
{  
"watch" :{  
"trigger": {  
"schedule": {  
"interval": "1m"  
}  
},  
"input": {  
"search": {  
"request": {  
"indices": [  
".my-test-\*"  
],  
"types":["node\_stats"],  
"body": {  
"size" : 0,  
This is the workaround I tried for cluster state since types was not working

```
{
"trigger" : {
    "schedule" : { "interval" : "1h" } 
  },
  "input": {
    "search": {
      "request": {
        "indices": ".my-test-*",
        "body": {
          "query": {
            "match": {
              "type": "cluster_stats"
              }
          },
          "_source": [
            "cluster_state"
          ],
          "sort": [
            {
              "timestamp": {
                "order": "desc"
              }
            }
          ],
          "size": 1
        }
      }
    }
  },
```

---

<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: [September 14, 2018, 11:34am UTC](https://discuss.elastic.co/t/request-types-not-working-in-ece-watcher/148509/2 "2018-09-14T11:34:17Z")

</div>

with more recent versions (6.0 onwards) you need to put the type filter as part of the query, as newer indices can only cope with a single type.

---

<div class="post-metadata">

### Author: ![gautu7](https://avatars.discourse-cdn.com/v4/letter/g/c89c15/32.png) [@gautu7](https://discuss.elastic.co/u/gautu7)
#### Post date: [September 14, 2018, 4:22pm UTC](https://discuss.elastic.co/t/request-types-not-working-in-ece-watcher/148509/3 "2018-09-14T16:22:56Z")

</div>

Is this what you're referring to? [https://www.elastic.co/guide/en/elasticsearch/reference/6.3/query-dsl-type-query.html](https://www.elastic.co/guide/en/elasticsearch/reference/6.3/query-dsl-type-query.html)  
I couldn't quite the above working, so did this to get `node_stats` in the last 2 minutes with the type filter in the query  
{  
"query": {  
"bool": {  
"must": [  
{  
"match": {  
"type": "node\_stats"  
}  
}  
],  
"filter": {  
"range": {  
"timestamp": {  
"gte": "now-2m",  
"lte": "now"  
}  
}  
}  
}  
}  
}

---

<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: [September 17, 2018, 7:43am UTC](https://discuss.elastic.co/t/request-types-not-working-in-ece-watcher/148509/4 "2018-09-17T07:43:17Z")

</div>

yes, that was what I was referring to.

---

<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: [October 15, 2018, 7:43am UTC](https://discuss.elastic.co/t/request-types-not-working-in-ece-watcher/148509/5 "2018-10-15T07:43:17Z")

</div>

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