Elasticsearch the terms filter raise "filter does not support [mediatest]" Elasticsearch the terms filter raise "filter does not support [mediatest]" elasticsearch elasticsearch

Elasticsearch the terms filter raise "filter does not support [mediatest]"


The above is not a valid Query DSL. In the above Terms filter the values to "mediaType" field should be an array

It should be the following :

{  "query": {    "filtered": {      "filter": {        "bool": {          "must": [            {              "term": {                "online": 1              }            },            {              "terms": {                "mediaType": ["flash"]              }            }          ]        }      }    }  }}


Its simply a matter of "term" vs "terms". Very easy to miss the plural / single aspect of it.

I had a very similar error with this query, in which I was trying to delete a specific zone:

'{"query":{"terms":{"zoneid":25070}}}'

I was getting an error when I ran the above query.

As soon as changed "terms" to "term" the query executed with no issues, like this:

'{"query":{"term":{"zoneid":25070}}}'


Its 2021 I'm using .keyword for an exact text match but you can just as easily omit:

{"query":  {"bool":    {"must":      [        {"term":          {"variable1.keyword":var1Here}        },        {"term":          {"variable2.keyword":var2Here}        }      ]    }  }}