本文整理匯總了Java中org.elasticsearch.common.settings.Settings.toXContent方法的典型用法代碼示例。如果您正苦於以下問題:Java Settings.toXContent方法的具體用法?Java Settings.toXContent怎麽用?Java Settings.toXContent使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.elasticsearch.common.settings.Settings
的用法示例。
在下文中一共展示了Settings.toXContent方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: toXContent
import org.elasticsearch.common.settings.Settings; //導入方法依賴的package包/類
@Override
public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException {
builder.startObject("nodes");
for (NodeInfo nodeInfo : getNodes()) {
builder.startObject(nodeInfo.getNode().getId());
builder.field("name", nodeInfo.getNode().getName());
builder.field("transport_address", nodeInfo.getNode().getAddress().toString());
builder.field("host", nodeInfo.getNode().getHostName());
builder.field("ip", nodeInfo.getNode().getHostAddress());
builder.field("version", nodeInfo.getVersion());
builder.field("build_hash", nodeInfo.getBuild().shortHash());
if (nodeInfo.getTotalIndexingBuffer() != null) {
builder.byteSizeField("total_indexing_buffer", "total_indexing_buffer_in_bytes", nodeInfo.getTotalIndexingBuffer());
}
builder.startArray("roles");
for (DiscoveryNode.Role role : nodeInfo.getNode().getRoles()) {
builder.value(role.getRoleName());
}
builder.endArray();
if (!nodeInfo.getNode().getAttributes().isEmpty()) {
builder.startObject("attributes");
for (Map.Entry<String, String> entry : nodeInfo.getNode().getAttributes().entrySet()) {
builder.field(entry.getKey(), entry.getValue());
}
builder.endObject();
}
if (nodeInfo.getSettings() != null) {
builder.startObject("settings");
Settings settings = nodeInfo.getSettings();
settings.toXContent(builder, params);
builder.endObject();
}
if (nodeInfo.getOs() != null) {
nodeInfo.getOs().toXContent(builder, params);
}
if (nodeInfo.getProcess() != null) {
nodeInfo.getProcess().toXContent(builder, params);
}
if (nodeInfo.getJvm() != null) {
nodeInfo.getJvm().toXContent(builder, params);
}
if (nodeInfo.getThreadPool() != null) {
nodeInfo.getThreadPool().toXContent(builder, params);
}
if (nodeInfo.getTransport() != null) {
nodeInfo.getTransport().toXContent(builder, params);
}
if (nodeInfo.getHttp() != null) {
nodeInfo.getHttp().toXContent(builder, params);
}
if (nodeInfo.getPlugins() != null) {
nodeInfo.getPlugins().toXContent(builder, params);
}
if (nodeInfo.getIngest() != null) {
nodeInfo.getIngest().toXContent(builder, params);
}
builder.endObject();
}
builder.endObject();
return builder;
}
示例2: toXContent
import org.elasticsearch.common.settings.Settings; //導入方法依賴的package包/類
@Override
public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException {
builder.field("cluster_name", getClusterName().value(), XContentBuilder.FieldCaseConversion.NONE);
builder.startObject("nodes");
for (NodeInfo nodeInfo : this) {
builder.startObject(nodeInfo.getNode().id(), XContentBuilder.FieldCaseConversion.NONE);
builder.field("name", nodeInfo.getNode().name(), XContentBuilder.FieldCaseConversion.NONE);
builder.field("transport_address", nodeInfo.getNode().address().toString());
builder.field("host", nodeInfo.getNode().getHostName(), XContentBuilder.FieldCaseConversion.NONE);
builder.field("ip", nodeInfo.getNode().getHostAddress(), XContentBuilder.FieldCaseConversion.NONE);
builder.field("version", nodeInfo.getVersion());
builder.field("build", nodeInfo.getBuild().hashShort());
if (nodeInfo.getServiceAttributes() != null) {
for (Map.Entry<String, String> nodeAttribute : nodeInfo.getServiceAttributes().entrySet()) {
builder.field(nodeAttribute.getKey(), nodeAttribute.getValue(), XContentBuilder.FieldCaseConversion.NONE);
}
}
if (!nodeInfo.getNode().attributes().isEmpty()) {
builder.startObject("attributes");
for (Map.Entry<String, String> attr : nodeInfo.getNode().attributes().entrySet()) {
builder.field(attr.getKey(), attr.getValue(), XContentBuilder.FieldCaseConversion.NONE);
}
builder.endObject();
}
if (nodeInfo.getSettings() != null) {
builder.startObject("settings");
Settings settings = nodeInfo.getSettings();
settings.toXContent(builder, params);
builder.endObject();
}
if (nodeInfo.getOs() != null) {
nodeInfo.getOs().toXContent(builder, params);
}
if (nodeInfo.getProcess() != null) {
nodeInfo.getProcess().toXContent(builder, params);
}
if (nodeInfo.getJvm() != null) {
nodeInfo.getJvm().toXContent(builder, params);
}
if (nodeInfo.getThreadPool() != null) {
nodeInfo.getThreadPool().toXContent(builder, params);
}
if (nodeInfo.getTransport() != null) {
nodeInfo.getTransport().toXContent(builder, params);
}
if (nodeInfo.getHttp() != null) {
nodeInfo.getHttp().toXContent(builder, params);
}
if (nodeInfo.getPlugins() != null) {
nodeInfo.getPlugins().toXContent(builder, params);
}
builder.endObject();
}
builder.endObject();
return builder;
}
示例3: writeSettings
import org.elasticsearch.common.settings.Settings; //導入方法依賴的package包/類
private void writeSettings(Settings settings, XContentBuilder builder, ToXContent.Params params) throws IOException {
builder.startObject(Fields.SETTINGS);
settings.toXContent(builder, params);
builder.endObject();
}