Elasticsearch the terms filter raise "filter does not support [mediatest]"
20,162
Solution 1
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"]
}
}
]
}
}
}
}
}
Solution 2
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}
}
]
}
}
}
Related videos on Youtube
Author by
gwecho huang
Updated on July 01, 2021Comments
-
gwecho huang almost 3 years
my query is like this:
{ "query": { "filtered": { "filter": { "bool": { "must": [ { "term": { "online": 1 } }, { "terms": { "mediaType": "flash" } } ] } } } } }
it raise a QueryParsingException [[comos_v2] [terms] filter does not support [mediaType]],of which the field "mediaType" exactly does not exist in mapping. my question is why term filter does not raise the Exception?