本文整理了Java中org.elasticsearch.common.settings.Settings.toXContent()
方法的一些代码示例,展示了Settings.toXContent()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Settings.toXContent()
方法的具体详情如下:
包路径:org.elasticsearch.common.settings.Settings
类名称:Settings
方法名:toXContent
暂无
代码示例来源:origin: NLPchina/elasticsearch-sql
private void writeSettings(Settings settings, XContentBuilder builder, ToXContent.Params params) throws IOException {
builder.startObject(Fields.SETTINGS);
settings.toXContent(builder, params);
builder.endObject();
}
代码示例来源:origin: org.elasticsearch/elasticsearch
@Override
public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException {
builder.startObject();
settings.toXContent(builder, params);
builder.endObject();
return builder;
}
代码示例来源:origin: org.elasticsearch/elasticsearch
@Override
public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException {
if (definition == null) {
return builder.value(name);
}
return definition.toXContent(builder, params);
}
代码示例来源:origin: org.elasticsearch/elasticsearch
@Override
public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException {
builder.startObject();
builder.startObject(PERSISTENT.getPreferredName());
persistentSettings.toXContent(builder, params);
builder.endObject();
builder.startObject(TRANSIENT.getPreferredName());
transientSettings.toXContent(builder, params);
builder.endObject();
builder.endObject();
return builder;
}
代码示例来源:origin: org.elasticsearch/elasticsearch
@Override
protected void addCustomFields(XContentBuilder builder, Params params) throws IOException {
builder.startObject(PERSISTENT.getPreferredName());
persistentSettings.toXContent(builder, params);
builder.endObject();
builder.startObject(TRANSIENT.getPreferredName());
transientSettings.toXContent(builder, params);
builder.endObject();
}
代码示例来源:origin: org.elasticsearch/elasticsearch
@Override
public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException {
builder.startObject();
builder.startObject(PERSISTENT_FIELD);
persistentSettings.toXContent(builder, params);
builder.endObject();
builder.startObject(TRANSIENT_FIELD);
transientSettings.toXContent(builder, params);
builder.endObject();
if (defaultSettings.isEmpty() == false) {
builder.startObject(DEFAULTS_FIELD);
defaultSettings.toXContent(builder, params);
builder.endObject();
}
builder.endObject();
return builder;
}
代码示例来源:origin: org.elasticsearch/elasticsearch
@Override
public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException {
builder.startObject();
builder.field("name", name);
builder.field("type", type);
builder.startObject("settings");
settings.toXContent(builder, params);
builder.endObject();
builder.field("verify", verify);
builder.endObject();
return builder;
}
}
代码示例来源:origin: org.elasticsearch/elasticsearch
@Override
public String innerGetRaw(final Settings settings) {
Settings subSettings = get(settings);
try {
XContentBuilder builder = XContentFactory.jsonBuilder();
builder.startObject();
subSettings.toXContent(builder, EMPTY_PARAMS);
builder.endObject();
return Strings.toString(builder);
} catch (IOException e) {
throw new RuntimeException(e);
}
}
代码示例来源:origin: org.elasticsearch/elasticsearch
@Override
public String toString() {
try (XContentBuilder builder = XContentBuilder.builder(XContentType.JSON.xContent())) {
builder.startObject();
toXContent(builder, new MapParams(Collections.singletonMap("flat_settings", "true")));
builder.endObject();
return Strings.toString(builder);
} catch (IOException e) {
throw new UncheckedIOException(e);
}
}
代码示例来源:origin: org.elasticsearch/elasticsearch
private XContentBuilder toXContent(XContentBuilder builder, Params params, boolean omitEmptySettings) throws IOException {
builder.startObject();
for (ObjectObjectCursor<String, Settings> cursor : getIndexToSettings()) {
// no settings, jump over it to shorten the response data
if (omitEmptySettings && cursor.value.isEmpty()) {
continue;
}
builder.startObject(cursor.key);
builder.startObject("settings");
cursor.value.toXContent(builder, params);
builder.endObject();
if (indexToDefaultSettings.isEmpty() == false) {
builder.startObject("defaults");
indexToDefaultSettings.get(cursor.key).toXContent(builder, params);
builder.endObject();
}
builder.endObject();
}
builder.endObject();
return builder;
}
代码示例来源:origin: org.elasticsearch/elasticsearch
/**
* Serializes information about a single repository
*
* @param repository repository metadata
* @param builder XContent builder
* @param params serialization parameters
*/
public static void toXContent(RepositoryMetaData repository, XContentBuilder builder, ToXContent.Params params) throws IOException {
builder.startObject(repository.name());
builder.field("type", repository.type());
builder.startObject("settings");
repository.settings().toXContent(builder, params);
builder.endObject();
builder.endObject();
}
}
代码示例来源:origin: org.elasticsearch/elasticsearch
public XContentBuilder innerToXContent(XContentBuilder builder, Params params) throws IOException {
builder.startObject(SETTINGS.getPreferredName());
settings.toXContent(builder, params);
builder.endObject();
builder.startObject(MAPPINGS.getPreferredName());
for (Map.Entry<String, String> entry : mappings.entrySet()) {
try (InputStream stream = new BytesArray(entry.getValue()).streamInput()) {
builder.rawField(entry.getKey(), stream, XContentType.JSON);
}
}
builder.endObject();
builder.startObject(ALIASES.getPreferredName());
for (Alias alias : aliases) {
alias.toXContent(builder, params);
}
builder.endObject();
return builder;
}
}
代码示例来源:origin: org.elasticsearch/elasticsearch
@Override
public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException {
builder.startObject();
{
builder.startObject(CreateIndexRequest.SETTINGS.getPreferredName());
{
targetIndexRequest.settings().toXContent(builder, params);
}
builder.endObject();
builder.startObject(CreateIndexRequest.ALIASES.getPreferredName());
{
for (Alias alias : targetIndexRequest.aliases()) {
alias.toXContent(builder, params);
}
}
builder.endObject();
}
builder.endObject();
return builder;
}
代码示例来源:origin: org.elasticsearch/elasticsearch
@Override
public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException {
builder.field("index_patterns", indexPatterns);
builder.field("order", order);
if (version != null) {
builder.field("version", version);
}
builder.startObject("settings");
settings.toXContent(builder, params);
builder.endObject();
builder.startObject("mappings");
for (Map.Entry<String, String> entry : mappings.entrySet()) {
builder.field(entry.getKey());
XContentParser parser = JsonXContent.jsonXContent.createParser(NamedXContentRegistry.EMPTY,
DeprecationHandler.THROW_UNSUPPORTED_OPERATION, entry.getValue());
builder.copyCurrentStructure(parser);
}
builder.endObject();
builder.startObject("aliases");
for (Alias alias : aliases) {
alias.toXContent(builder, params);
}
builder.endObject();
return builder;
}
}
代码示例来源:origin: org.elasticsearch/elasticsearch
/**
* Parse the script configured in the given settings.
*/
public static Script parse(Settings settings) {
try (XContentBuilder builder = JsonXContent.contentBuilder()){
builder.startObject();
settings.toXContent(builder, ToXContent.EMPTY_PARAMS);
builder.endObject();
try (InputStream stream = BytesReference.bytes(builder).streamInput();
XContentParser parser = JsonXContent.jsonXContent.createParser(NamedXContentRegistry.EMPTY,
LoggingDeprecationHandler.INSTANCE, stream)) {
return parse(parser);
}
} catch (IOException e) {
// it should not happen since we are not actually reading from a stream but an in-memory byte[]
throw new IllegalStateException(e);
}
}
代码示例来源:origin: org.elasticsearch/elasticsearch
Settings indexSettings = settings.get(index);
if (indexSettings != null) {
indexSettings.toXContent(builder, params);
if (defaultIndexSettings != null && defaultIndexSettings.isEmpty() == false) {
builder.startObject("defaults");
defaultIndexSettings.toXContent(builder, params);
builder.endObject();
代码示例来源:origin: org.elasticsearch/elasticsearch
@Override
public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException {
builder.startObject();
builder.field("repository", repository);
builder.field("snapshot", snapshot);
builder.startArray("indices");
for (String index : indices) {
builder.value(index);
}
builder.endArray();
builder.field("partial", partial);
if (settings != null) {
builder.startObject("settings");
if (settings.isEmpty() == false) {
settings.toXContent(builder, params);
}
builder.endObject();
}
builder.field("include_global_state", includeGlobalState);
if (indicesOptions != null) {
indicesOptions.toXContent(builder, params);
}
builder.endObject();
return builder;
}
代码示例来源:origin: org.elasticsearch/elasticsearch
metaData.persistentSettings().toXContent(builder, new MapParams(Collections.singletonMap("flat_settings", "true")));
builder.endObject();
metaData.transientSettings().toXContent(builder, new MapParams(Collections.singletonMap("flat_settings", "true")));
builder.endObject();
代码示例来源:origin: org.elasticsearch/elasticsearch
builder.startObject("settings");
if (settings.isEmpty() == false) {
settings.toXContent(builder, params);
builder.startObject("index_settings");
if (indexSettings.isEmpty() == false) {
indexSettings.toXContent(builder, params);
代码示例来源:origin: org.elasticsearch/elasticsearch
indexTemplateMetaData.settings().toXContent(builder, params);
builder.endObject();
内容来源于网络,如有侵权,请联系作者删除!