elasticsearch包装查询不适用于base64编码的字符串

时间:2018-10-07 13:22:38

标签: elasticsearch base64

elasticsearch包装查询不适用于base64编码的字符串

ES版本:5.2.3

我使用base64进行编码:

char[] data = Base64Coder.encode(text.getBytes());

return data.ToString();

注意:文本是下划线json查询。

查询

curl -d XPOST 'http://localhost:9200/entitymaster_qa_t4/_search' -d '{
  "query" : {
    "wrapper" : {
      "query" : "W0NAMTZiN2MzYw=="
    }
  }
}'

响应

{"error":{"root_cause":[{"type":"parse_exception","reason":"Failed to derive xcontent"}],"type":"search_phase_execution_exception","reason":"all shards failed","phase":"query","grouped":true,"failed_shards":[{"shard":0,"index":"entitymaster_qa_t4","node":"8WVaVr9ATmaqOPDHGpNyHw","reason":{"type":"parse_exception","reason":"Failed to derive xcontent"}}]},"status":400}

1 个答案:

答案 0 :(得分:0)

wrapper query根据文档显示在ES 6.0中,因此,如果要使用它,则需要更新版本。另外,base64字符串必须解码为有效的查询,而不仅仅是一条数据。