“The returned value of an API call will no longer be the body, statusCode, and headers for callbacks, and only the body for promises. The new returned value will be a unique object containing the body, statusCode, headers, warnings, and meta, for both callback and promises.”
This is a problem if I stringify and store the result in redis (now I will need to JSON parse when I get the value back from redis). Is there anyway I can switch on “body only” mode on promises?
2
Answers
Unforntunately, no.
There is no way to only receive only the body.
As you mentioned this would be the response,
Best you can do it before you store the response in Redis you can store it like this,
Or when you fetch the response object from Redis you can do this,
As a workaround you could overwrite/proxy the
search()
method of yourClient
-instance. So you could define your proxy with something like:Then initialize your search-proxy after requiring and instantiating the elasticsearch-
Client
,