Request.types not working in ECE Watcher

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
        }
      }
    }
  },

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.

Is this what you're referring to? 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"
}
}
}
}
}
}

yes, that was what I was referring to.

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