Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deserialization error when execute GET a non-existing alias #80

Closed
bachden opened this issue Dec 28, 2021 · 2 comments
Closed

Deserialization error when execute GET a non-existing alias #80

bachden opened this issue Dec 28, 2021 · 2 comments
Labels
Category: Bug Something isn't working

Comments

@bachden
Copy link

bachden commented Dec 28, 2021

execute simple test case as follow:

import org.junit.jupiter.api.Test;

public class TestEsAliasCommands extends AbstractEsCallerTest {

    @Test
    void testGetNotExistingAlias() {
        try {
            getEsClient().indices().getAlias(g -> g.name("not-existing-alias")).toCompletableFuture().get();
        } catch (Throwable e) {
            e.printStackTrace();
        }
    }
}

where getEsClient() return an ElasticsearchAsyncClient instance. error as follow:

co.elastic.clients.json.UnexpectedJsonEventException: Unexpected JSON event 'VALUE_STRING' instead of '[START_OBJECT, KEY_NAME]'
	at co.elastic.clients.json.JsonpUtils.ensureAccepts(JsonpUtils.java:68)
	at co.elastic.clients.json.JsonpDeserializer.deserialize(JsonpDeserializer.java:74)
	at co.elastic.clients.json.ObjectBuilderDeserializer.deserialize(ObjectBuilderDeserializer.java:79)
	at co.elastic.clients.json.DelegatingDeserializer$SameType.deserialize(DelegatingDeserializer.java:43)
	at co.elastic.clients.json.ObjectDeserializer$FieldObjectDeserializer.deserialize(ObjectDeserializer.java:72)
	at co.elastic.clients.json.ObjectDeserializer.deserialize(ObjectDeserializer.java:176)
	at co.elastic.clients.json.ObjectDeserializer.deserialize(ObjectDeserializer.java:137)
	at co.elastic.clients.json.JsonpDeserializer.deserialize(JsonpDeserializer.java:75)
	at co.elastic.clients.json.ObjectBuilderDeserializer.deserialize(ObjectBuilderDeserializer.java:79)
	at co.elastic.clients.json.DelegatingDeserializer$SameType.deserialize(DelegatingDeserializer.java:43)
	at co.elastic.clients.transport.rest_client.RestClientTransport.getHighLevelResponse(RestClientTransport.java:276)
	at co.elastic.clients.transport.rest_client.RestClientTransport.access$200(RestClientTransport.java:60)
	at co.elastic.clients.transport.rest_client.RestClientTransport$1.onSuccess(RestClientTransport.java:165)
	at org.elasticsearch.client.RestClient$FailureTrackingResponseListener.onSuccess(RestClient.java:649)
	at org.elasticsearch.client.RestClient$1.completed(RestClient.java:383)
	at org.elasticsearch.client.RestClient$1.completed(RestClient.java:377)
	at org.apache.http.concurrent.BasicFuture.completed(BasicFuture.java:122)
	at org.apache.http.impl.nio.client.DefaultClientExchangeHandlerImpl.responseCompleted(DefaultClientExchangeHandlerImpl.java:181)
	at org.apache.http.nio.protocol.HttpAsyncRequestExecutor.processResponse(HttpAsyncRequestExecutor.java:448)
	at org.apache.http.nio.protocol.HttpAsyncRequestExecutor.inputReady(HttpAsyncRequestExecutor.java:338)
	at org.apache.http.impl.nio.DefaultNHttpClientConnection.consumeInput(DefaultNHttpClientConnection.java:265)
	at org.apache.http.impl.nio.client.InternalIODispatch.onInputReady(InternalIODispatch.java:81)
	at org.apache.http.impl.nio.client.InternalIODispatch.onInputReady(InternalIODispatch.java:39)
	at org.apache.http.impl.nio.reactor.AbstractIODispatch.inputReady(AbstractIODispatch.java:114)
	at org.apache.http.impl.nio.reactor.BaseIOReactor.readable(BaseIOReactor.java:162)
	at org.apache.http.impl.nio.reactor.AbstractIOReactor.processEvent(AbstractIOReactor.java:337)
	at org.apache.http.impl.nio.reactor.AbstractIOReactor.processEvents(AbstractIOReactor.java:315)
	at org.apache.http.impl.nio.reactor.AbstractIOReactor.execute(AbstractIOReactor.java:276)
	at org.apache.http.impl.nio.reactor.BaseIOReactor.execute(BaseIOReactor.java:104)
	at org.apache.http.impl.nio.reactor.AbstractMultiworkerIOReactor$Worker.run(AbstractMultiworkerIOReactor.java:591)
	at java.base/java.lang.Thread.run(Thread.java:833)

environment:

  • server: docker image docker.elastic.co/elasticsearch/elasticsearch:7.16.2
  • client: version 7.16.2
@swallez swallez added the Category: Bug Something isn't working label Jan 25, 2022
swallez added a commit that referenced this issue Jan 25, 2022
swallez added a commit that referenced this issue Jan 25, 2022
@swallez
Copy link
Member

swallez commented Jan 25, 2022

Thanks for the report. This was caused by Elasticsearch responding with an error in "compact format" where the error property is a simple string instead of an object. Fixed by allowing both forms in ErrorCause deserializer.

@synox
Copy link

synox commented Mar 16, 2022

I am facing the same issue with client 7.16.2 and 7.17.1. Is this going to be backported?
cc: @fabriziofortino

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Category: Bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants