Closed stayallive closed 2 years ago
@stayallive thanks for reporting this issue! This is actually a missing deserializer format (text/plain
) in the new client :sweat:.
I'm working to fix this, in the meantime you can also change the output format of the cat aliases API using 'format' => 'json'
as parameter:
$aliases = $this->esClient->cat()->aliases([
'name' => 'some-name',
'format' => 'json'
]);
This should solve the issue. I'll update soon with the fix. Thanks!
Thanks @ezimuel, I figured there would be a easy workaround but didn't think of the format param, will work for now 💪
@stayallive just sent this PR https://github.com/elastic/elasticsearch-php/pull/1220. I'll release it with 8.2.0. Let me know if you have any feedback, thanks!
Looks good to me! 💪
@stayallive I'm also thinking to enable by default the Accept
header to application/json
format instead of text/plain
for the cat()
endpoints. Using this approach, we can have the same behaviour of 7.x
.
I'm not too familiar with these API's but a plain text response seems... less useful to me in almost all cases. So this sounds very logical to me.
@stayallive actually, I cannot change the Accept
header of these endpoints since I'll change the official response from Elasticsearch. I think we will suggest to use the "format" => "json"
parameter if someone needs to have array as response.
Ah right, that makes sense... for the next version maybe 👍
Thanks again for the quick fix and workaround!
Summary of problem or feature request
When trying to get aliases from Elastic I get the following error:
This worked on 7.x and I cannot figure out why it would fail now all of a sudden since I don't think this method is deprecated on 8.x or there is a better way to retrieve this. Probably missing something obvious so any help is appreciated!
Code snippet of problem
System details