【问题标题】:elasticsearch wrapper query not works with base64 encoded stringelasticsearch 包装查询不适用于 base64 编码字符串
【发布时间】:2018-10-08 02:13:39
【问题描述】:

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}

【问题讨论】:

  • 我认为你不能以编码形式提交查询,ES 只支持索引编码内容。

标签: elasticsearch base64


【解决方案1】:

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

【讨论】:

  • 谢谢。是否有任何弹性 Java API 接受 JSON 查询字符串以针对索引执行??
  • 我不知道,但this post 似乎持有你的答案。
猜你喜欢
  • 2017-03-28
  • 1970-01-01
  • 2020-12-18
  • 1970-01-01
  • 1970-01-01
  • 2017-12-13
  • 2012-05-14
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多