Wrapper query

Wrapper query

A query that accepts any other query as base64 encoded string.

  1. resp = client.search(
  2. query={
  3. "wrapper": {
  4. "query": "eyJ0ZXJtIiA6IHsgInVzZXIuaWQiIDogImtpbWNoeSIgfX0="
  5. }
  6. },
  7. )
  8. print(resp)
  1. response = client.search(
  2. body: {
  3. query: {
  4. wrapper: {
  5. query: 'eyJ0ZXJtIiA6IHsgInVzZXIuaWQiIDogImtpbWNoeSIgfX0='
  6. }
  7. }
  8. }
  9. )
  10. puts response
  1. const response = await client.search({
  2. query: {
  3. wrapper: {
  4. query: "eyJ0ZXJtIiA6IHsgInVzZXIuaWQiIDogImtpbWNoeSIgfX0=",
  5. },
  6. },
  7. });
  8. console.log(response);
  1. GET /_search
  2. {
  3. "query": {
  4. "wrapper": {
  5. "query": "eyJ0ZXJtIiA6IHsgInVzZXIuaWQiIDogImtpbWNoeSIgfX0="
  6. }
  7. }
  8. }

Base64 encoded string: {“term” : { “user.id” : “kimchy” }}

This query is more useful in the context of Spring Data Elasticsearch. It’s the way a user can add custom queries when using Spring Data repositories. The user can add a @Query() annotation to a repository method. When such a method is called we do a parameter replacement in the query argument of the annotation and then send this as the query part of a search request.