本文整理汇总了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();
}