Exception caught on transport layer (es6.4.2)

Here is my code if you want to give it a try :

public static void main(String[] args) throws Exception{
        Settings settings = org.elasticsearch.common.settings.Settings.builder()
                .put("cluster.name", "elastic_cluster6")
                .put("xpack.security.user", "antoine:password")
                .put("xpack.security.transport.ssl.enabled", "true")
                .put("xpack.security.transport.ssl.keystore.path", "/Users/aparent/Downloads/es6.p12")
                .put("xpack.security.transport.ssl.keystore.password", "password")
                .put("xpack.security.transport.ssl.truststore.path", "/Users/aparent/Downloads/es6.p12")
                .put("xpack.security.transport.ssl.truststore.password", "password")
                .put("xpack.security.transport.ssl.verification_mode", "certificate")
                .build();

        TransportClient transportClient = new PreBuiltXPackTransportClient(settings);
        transportClient.addTransportAddress(new TransportAddress(InetAddress.getByName("xx.xx.xx.xx"), 9302));
        SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder();

        
        SearchModule searchModule = new SearchModule(settings, true, Collections.<SearchPlugin> emptyList());
		
		try (XContentParser parser = XContentFactory.xContent(XContentType.JSON)
				.createParser(new NamedXContentRegistry(searchModule.getNamedXContents()), DeprecationHandler.THROW_UNSUPPORTED_OPERATION, "{ \"query\": {\"match_all\": {} }}")) {
	
					searchSourceBuilder.parseXContent(parser);
				}
		SearchRequestBuilder searchRequestBuilder = new SearchRequestBuilder(transportClient, SearchAction.INSTANCE)
		.setTypes("tables")
		.addSort(org.elasticsearch.search.sort.FieldSortBuilder.DOC_FIELD_NAME, org.elasticsearch.search.sort.SortOrder.ASC)
		.setScroll(new org.elasticsearch.common.unit.TimeValue(1000))
		.setSearchType(org.elasticsearch.action.search.SearchType.DEFAULT);
		org.elasticsearch.action.search.SearchResponse searchResponse = searchRequestBuilder.setSource(searchSourceBuilder).execute().actionGet();

		while (true) {
			for (SearchHit searchHit : searchResponse.getHits().getHits()) {
				System.out.println(searchHit.toString());
			}
		}
    }

I keep getting the same error not an SSL/TLS record.

I changed only the keystore.path and truststore.path to point to my file and xx.xx.xx.xx to localhost as I run my Elasticsearch node locally and this works fine.

You actually have something printed on your console ?

This is actually irrelevant, but yes. I don't have the same data as you do in my node so I had to adjust .setTypes("table") to .setTypes("doc") but this is not about troubleshooting the search queries.

The request was sent over TLS and there were no errors in my elasticsearch logs ( especially not an not an SSL/TLS record. one)

Ok, then it could be network related I guess ...
Thank you for everything ! :slight_smile:

No problem ! As I said earlier though, this is strange symptom for it to be caused by a network problem unless you have something like a reverse proxy terminating SSL in front of Elatsticsearch and your xx.xx.xx.xx is not the IP Address of the Elasticsearch node but rather that of your proxy. I guess you would know that already.

You can always enable the audit logging and check the origin_address and verify that this is the IP address of your machine were you run the Transport Client or an intermediate proxy.