Get Elasticsearch Version with Java Api


(Stefan Meiwald) #1

I am looking for the Java API pendant to

curl -XGET http://localhost:9200

With a Result like:

{
 "ok" : true, 
  "status" : 200,
 "name" : "Kierrok",
 "version" : {
   "number" : "0.90.7",
   "build_hash" : "36897d07dadcb70886db7f149e645ed3d44eb5f2",
   "build_timestamp" : "2013-11-13T12:06:54Z",
   "build_snapshot" : false,
   "lucene_version" : "4.5.1"
 },
 "tagline" : "You Know, for Search"

}

Actually its only about the version. I want to write a test which ensures
that I am using a version >= 0.90.5

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


(David Pilato) #2

Have a look at Nodes Info: http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/cluster-nodes-info.html
curl -XGET 'http://localhost:9200/_cluster/nodes?pretty'
{
"ok" : true,
"cluster_name" : "elasticsearch",
"nodes" : {
"U2Kxuc4BQuefH9bz6q8glA" : {
"name" : "Captain Atlas",
"transport_address" : "inet[/192.168.0.15:9300]",
"hostname" : "MacBook-Air-de-David.local",
"version" : "0.90.7",
"http_address" : "inet[/192.168.0.15:9200]"
}
}
}

HTH

--
David Pilato | Technical Advocate | Elasticsearch.com
@dadoonet | @elasticsearchfr

Le 26 novembre 2013 at 15:03:35, Stefan Meiwald (st.meiwald@gmail.com) a écrit:

I am looking for the Java API pendant to

curl -XGET http://localhost:9200

With a Result like:

{
 "ok" : true,
  "status" : 200,
 "name" : "Kierrok",
 "version" : {
   "number" : "0.90.7",
   "build_hash" : "36897d07dadcb70886db7f149e645ed3d44eb5f2",
   "build_timestamp" : "2013-11-13T12:06:54Z",
   "build_snapshot" : false,
   "lucene_version" : "4.5.1"
 },
 "tagline" : "You Know, for Search"

}

Actually its only about the version. I want to write a test which ensures that I am using a version >= 0.90.5

You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


(Stefan Meiwald) #3

Thank you very much. Here is my implementation(I am using Scala). Just in
case anyone else is doing the same.

case class GetEsVersionQuery(esClient: Client) {
lazy val p = promiseNodesInfoResponse

esClient
.admin()
.cluster()
.prepareNodesInfo()
.all()
.execute()
.addListener(new ActionListener[NodesInfoResponse] {

def onFailure(e: Throwable) = {
  p failure e
}

def onResponse(response: NodesInfoResponse) = p success response

})

def execute: Future[NodesInfoResponse] = p.future
}

def testElasticsearchVersion: Future[Boolean] = {
GetEsVersionQuery(esClient).execute map {
esVersion => {
val nodes = esVersion.iterator().toList
nodes forall(node => node.getVersion.after(Version.V_0_90_5))
}
} recover {
case e: Throwable => false
}
}

Am Dienstag, 26. November 2013 15:03:31 UTC+1 schrieb Stefan Meiwald:

I am looking for the Java API pendant to

curl -XGET http://localhost:9200

With a Result like:

{
 "ok" : true, 
  "status" : 200,
 "name" : "Kierrok",
 "version" : {
   "number" : "0.90.7",
   "build_hash" : "36897d07dadcb70886db7f149e645ed3d44eb5f2",
   "build_timestamp" : "2013-11-13T12:06:54Z",
   "build_snapshot" : false,
   "lucene_version" : "4.5.1"
 },
 "tagline" : "You Know, for Search"

}

Actually its only about the version. I want to write a test which ensures
that I am using a version >= 0.90.5

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


(system) #4