Hello guys. I have a project using spring boot and elastic cloud on azure.
When i run command mvn clean install i have an error like below.
Caused by: co.elastic.clients.transport.TransportException: node: http://trustboard-elk.kb.westeurope.azure.elastic-cloud.com:9243/, status: 400, [es/indices.create] Expecting JSON data but response content-type is: application/octet-stream
at co.elastic.clients.transport.ElasticsearchTransportBase.checkJsonContentType(ElasticsearchTransportBase.java:471) ~[elasticsearch-java-8.13.2.jar:na]
at co.elastic.clients.transport.ElasticsearchTransportBase.getApiResponse(ElasticsearchTransportBase.java:334) ~[elasticsearch-java-8.13.2.jar:na]
at co.elastic.clients.transport.ElasticsearchTransportBase.performRequest(ElasticsearchTransportBase.java:147) ~[elasticsearch-java-8.13.2.jar:na]
at co.elastic.clients.elasticsearch.indices.ElasticsearchIndicesClient.create(ElasticsearchIndicesClient.java:277) ~[elasticsearch-java-8.13.2.jar:na]
at org.springframework.data.elasticsearch.client.elc.IndicesTemplate.lambda$doCreate$0(IndicesTemplate.java:145) ~[spring-data-elasticsearch-5.3.0.jar:5.3.0]
at org.springframework.data.elasticsearch.client.elc.ChildTemplate.execute(ChildTemplate.java:71) ~[spring-data-elasticsearch-5.3.0.jar:5.3.0]
... 65 common frames omitted
Caused by: java.net.UnknownHostException: https://a43468016c62e64.westeurope.azure.elastic-cloud.com:443: nodename nor servname provided, or not known
at java.base/java.net.Inet6AddressImpl.lookupAllHostAddr(Native Method)
at java.base/java.net.Inet6AddressImpl.lookupAllHostAddr(Inet6AddressImpl.java:52)
at java.base/java.net.InetAddress$PlatformResolver.lookupByName(InetAddress.java:1211)
at java.base/java.net.InetAddress.getAddressesFromNameService(InetAddress.java:1828)
at java.base/java.net.InetAddress$NameServiceAddresses.get(InetAddress.java:1139)
at java.base/java.net.InetAddress.getAllByName0(InetAddress.java:1818)
at java.base/java.net.InetAddress.getAllByName(InetAddress.java:1688)
at org.apache.http.impl.conn.SystemDefaultDnsResolver.resolve(SystemDefaultDnsResolver.java:45)
at org.apache.http.impl.nio.conn.PoolingNHttpClientConnectionManager$InternalAddressResolver.resolveRemoteAddress(PoolingNHttpClientConnectionManager.java:666)
at org.apache.http.impl.nio.conn.PoolingNHttpClientConnectionManager$InternalAddressResolver.resolveRemoteAddress(PoolingNHttpClientConnectionManager.java:637)
at org.apache.http.nio.pool.AbstractNIOConnPool.processPendingRequest(AbstractNIOConnPool.java:474)
at org.apache.http.nio.pool.AbstractNIOConnPool.lease(AbstractNIOConnPool.java:280)
at org.apache.http.impl.nio.conn.PoolingNHttpClientConnectionManager.requestConnection(PoolingNHttpClientConnectionManager.java:295)
at org.apache.http.impl.nio.client.AbstractClientExchangeHandler.requestConnection(AbstractClientExchangeHandler.java:381)
at org.apache.http.impl.nio.client.DefaultClientExchangeHandlerImpl.start(DefaultClientExchangeHandlerImpl.java:130)
at org.apache.http.impl.nio.client.CloseableHttpAsyncClientBase.execute(CloseableHttpAsyncClientBase.java:116)
at org.apache.http.impl.nio.client.InternalHttpAsyncClient.execute(InternalHttpAsyncClient.java:138)
at org.elasticsearch.client.RestClient.performRequest(RestClient.java:300)
... 92 more
Caused by: co.elastic.clients.transport.TransportException: node: http://a43708ceefac456cb859468016c62e64.westeurope.azure.elastic-cloud.com:9243/, status: 400, [es/indices.create] Expecting JSON data but response content-type is: application/octet-stream
at co.elastic.clients.transport.ElasticsearchTransportBase.checkJsonContentType(ElasticsearchTransportBase.java:471)
at co.elastic.clients.transport.ElasticsearchTransportBase.getApiResponse(ElasticsearchTransportBase.java:334)
at co.elastic.clients.transport.ElasticsearchTransportBase.performRequest(ElasticsearchTransportBase.java:147)
at co.elastic.clients.elasticsearch.indices.ElasticsearchIndicesClient.create(ElasticsearchIndicesClient.java:277)
at org.springframework.data.elasticsearch.client.elc.IndicesTemplate.lambda$doCreate$0(IndicesTemplate.java:145)
at org.springframework.data.elasticsearch.client.elc.ChildTemplate.execute(ChildTemplate.java:71)
... 86 more
I think it comes with the wrong content type because you are not hitting the right endpoint. I can see in the capture that your are using http and not https.
And when i connect to with https://a43708ceefac456cb859468016c62e64.westeurope.azure.elastic-cloud.com:9243 code give me nodename nor servname provided or not known error.
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.