Expose Lucene Main Version via Main Action. A call to `/` will

return the version of the used Lucene library next to the Elasticsearch
version.

Closes #2988
This commit is contained in:
Simon Willnauer 2013-05-04 21:52:54 +02:00
parent 29da615afd
commit 3c995d5dcc
1 changed files with 10 additions and 1 deletions

View File

@ -19,6 +19,7 @@
package org.elasticsearch.rest.action.main;
import org.apache.lucene.util.Constants;
import org.elasticsearch.ExceptionsHelper;
import org.elasticsearch.Version;
import org.elasticsearch.action.ActionListener;
@ -75,7 +76,15 @@ public class RestMainAction extends BaseRestHandler {
if (settings.get("name") != null) {
builder.field("name", settings.get("name"));
}
builder.startObject("version").field("number", Version.CURRENT.number()).field("snapshot_build", Version.CURRENT.snapshot).endObject();
builder.startObject("version")
.field("number", Version.CURRENT.number())
.field("snapshot_build", Version.CURRENT.snapshot)
// We use the lucene version from lucene constants since
// this includes bugfix release version as well and is already in
// the right format. We can also be sure that the format is maitained
// since this is also recorded in lucene segments and has BW compat
.field("lucene_version", Constants.LUCENE_MAIN_VERSION)
.endObject();
builder.field("tagline", "You Know, for Search");
builder.endObject();
channel.sendResponse(new XContentRestResponse(request, status, builder));