弹性搜索术语过滤器提升“过滤器不支持[mediatest]” [英] Elasticsearch the terms filter raise "filter does not support [mediatest]"

查看:196
本文介绍了弹性搜索术语过滤器提升“过滤器不支持[mediatest]”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的查询是这样的:

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

它引发QueryParsingException [[comos_v2] [terms]过滤器不支持[mediaType]] ,其中mediaType不存在映射。
我的问题是为什么术语过滤器不会引发异常?

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?

推荐答案

以上不是有效的Query DSL。在上述条款过滤器中,将值mediaType字段应为数组

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

应该如下:

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

这篇关于弹性搜索术语过滤器提升“过滤器不支持[mediatest]”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆