包含查询ElasticSearch中的特殊字符

nbewdwxp  于 2022-12-03  发布在  ElasticSearch
关注(0)|答案(1)|浏览(188)

请帮助我完成以下查询在包含查询中使用特殊字符时,会引发错误
{"query": {"bool": {"filter": [{"wildcard": {"core_skills.keyword": "*c(pro*"}}]}}, "size": 0, "aggs": {"group_by_core_skills": {"terms": {"field": "core_skills.keyword", "include": ".*c(pro.*", "size": 2000}}}}
以上查询引发错误-

{
  "error" : {
    "root_cause" : [
      {
        "type" : "x_content_parse_exception",
        "reason" : "[1:183] [terms] failed to parse field [include]"
      }
    ],
    "type" : "x_content_parse_exception",
    "reason" : "[1:183] [terms] failed to parse field [include]",
    "caused_by" : {
      "type" : "illegal_argument_exception",
      "reason" : "expected ')' at position 9"
    }
  },
  "status" : 400
}
w8biq8rn

w8biq8rn1#

请尝试如下编辑:

"include": ".*c\\(pro.*",

相关问题