Created
October 27, 2014 06:34
-
-
Save ppearcy/c5d969326b9e6ace8046 to your computer and use it in GitHub Desktop.
Elasticsearch get bounded port
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
val nodeRequest = new NodesInfoRequestBuilder(testCluster.esClient.admin().cluster()).all() | |
val nodeResponse = nodeRequest.execute().get() | |
val remoteAddress = nodeResponse.remoteAddress() | |
val nodesInfo = nodeResponse.getNodes.toList.head | |
val inetString = nodesInfo.getTransport.address().publishAddress().toString | |
val pattern = | |
""" | |
|inet\[\/\d+\.\d+\.\d+\.\d+\:(\d+)\] | |
""".stripMargin.r | |
val finallyPort = pattern.findFirstMatchIn(inetString).get.group(1) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment