0

elasticsearch wrapper query not works with base64 encoded string

ES version : 5.2.3

To encode i have used base64:

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

return data.ToString();

Note: text is the underline json query.

query:

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

Response:

{"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
  • I don't think you can submit queries in encoded form, ES only supports indexing encoded content. Commented Oct 7, 2018 at 17:07

1 Answer 1

0

The wrapper query appeared in ES 6.0 according to the docs, so if you want to use it you need to update your version. Also, the base64 string must decode into a valid query, not just a piece of data.

Sign up to request clarification or add additional context in comments.

2 Comments

thank you. is there any elastic Java API that accept JSON query string to execute against the index??
I don't know, but this post seems to hold your answer.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.