本文整理汇总了Java中org.elasticsearch.action.admin.indices.template.put.PutIndexTemplateRequest类的典型用法代码示例。如果您正苦于以下问题:Java PutIndexTemplateRequest类的具体用法?Java PutIndexTemplateRequest怎么用?Java PutIndexTemplateRequest使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PutIndexTemplateRequest类属于org.elasticsearch.action.admin.indices.template.put包,在下文中一共展示了PutIndexTemplateRequest类的19个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: prepareRequest
import org.elasticsearch.action.admin.indices.template.put.PutIndexTemplateRequest; //导入依赖的package包/类
@Override
public RestChannelConsumer prepareRequest(final RestRequest request, final NodeClient client) throws IOException {
PutIndexTemplateRequest putRequest = new PutIndexTemplateRequest(request.param("name"));
if (request.hasParam("template")) {
DEPRECATION_LOGGER.deprecated("Deprecated parameter[template] used, replaced by [index_patterns]");
putRequest.patterns(Collections.singletonList(request.param("template")));
} else {
putRequest.patterns(Arrays.asList(request.paramAsStringArray("index_patterns", Strings.EMPTY_ARRAY)));
}
putRequest.order(request.paramAsInt("order", putRequest.order()));
putRequest.masterNodeTimeout(request.paramAsTime("master_timeout", putRequest.masterNodeTimeout()));
putRequest.create(request.paramAsBoolean("create", false));
putRequest.cause(request.param("cause", ""));
putRequest.source(request.content(), request.getXContentType());
return channel -> client.admin().indices().putTemplate(putRequest, new AcknowledgedRestListener<>(channel));
}
开发者ID:justor,项目名称:elasticsearch_my,代码行数:17,代码来源:RestPutIndexTemplateAction.java
示例2: updateTemplate
import org.elasticsearch.action.admin.indices.template.put.PutIndexTemplateRequest; //导入依赖的package包/类
private void updateTemplate(DocIndexMetaData md,
TransportPutIndexTemplateAction transportPutIndexTemplateAction,
Settings updateSettings) {
String templateName = PartitionName.templateName(ident.schema(), ident.name());
PutIndexTemplateRequest request = new PutIndexTemplateRequest(templateName)
.mapping(Constants.DEFAULT_MAPPING_TYPE, md.defaultMappingMap)
.create(false)
.settings(updateSettings)
.template(templateName + "*");
for (String alias : md.aliases()) {
request = request.alias(new Alias(alias));
}
transportPutIndexTemplateAction.execute(request);
}
开发者ID:baidu,项目名称:Elasticsearch,代码行数:15,代码来源:DocIndexMetaData.java
示例3: updateTemplate
import org.elasticsearch.action.admin.indices.template.put.PutIndexTemplateRequest; //导入依赖的package包/类
private ListenableFuture<Long> updateTemplate(Map<String, Object> newMappings,
Settings newSettings,
TableIdent tableIdent,
AbstractDDLAnalyzedStatement statement) {
String templateName = PartitionName.templateName(tableIdent.schema(), tableIdent.name());
IndexTemplateMetaData indexTemplateMetaData =
clusterService.state().metaData().templates().get(templateName);
if (indexTemplateMetaData == null) {
return Futures.immediateFailedFuture(new RuntimeException("Template for partitioned table is missing"));
}
// merge mappings
Map<String, Object> mapping = mergeTemplateMapping(indexTemplateMetaData, newMappings);
// merge settings
Settings.Builder settingsBuilder = Settings.builder();
settingsBuilder.put(indexTemplateMetaData.settings());
settingsBuilder.put(newSettings);
PutIndexTemplateRequest request = new PutIndexTemplateRequest(templateName)
.create(false)
.mapping(Constants.DEFAULT_MAPPING_TYPE, mapping)
.order(indexTemplateMetaData.order())
.settings(settingsBuilder.build())
.template(indexTemplateMetaData.template());
request.putHeader(LoginUserContext.USER_INFO_KEY, statement.getParameterContext().getLoginUserContext());
for (ObjectObjectCursor<String, AliasMetaData> container : indexTemplateMetaData.aliases()) {
Alias alias = new Alias(container.key);
request.alias(alias);
}
SettableFuture<Long> result = SettableFuture.create();
transportActionProvider.transportPutIndexTemplateAction().execute(request,
new SettableFutureToNullActionListener<PutIndexTemplateResponse>(result));
return result;
}
开发者ID:baidu,项目名称:Elasticsearch,代码行数:39,代码来源:AlterTableOperation.java
示例4: createTemplateRequest
import org.elasticsearch.action.admin.indices.template.put.PutIndexTemplateRequest; //导入依赖的package包/类
private PutIndexTemplateRequest createTemplateRequest(CreateTableAnalyzedStatement statement) {
PutIndexTemplateRequest putIndexTemplateRequest = new PutIndexTemplateRequest(statement.templateName())
.mapping(Constants.DEFAULT_MAPPING_TYPE, statement.mapping())
.create(true)
.settings(settings(statement))
.template(statement.templatePrefix())
.order(100)
.alias(new Alias(statement.tableIdent().indexName()));
putIndexTemplateRequest.putHeader(LoginUserContext.USER_INFO_KEY, statement.getParameterContext().getLoginUserContext());
return putIndexTemplateRequest;
}
开发者ID:baidu,项目名称:Elasticsearch,代码行数:12,代码来源:TableCreator.java
示例5: buildRequest
import org.elasticsearch.action.admin.indices.template.put.PutIndexTemplateRequest; //导入依赖的package包/类
private PutIndexTemplateRequest buildRequest(ESCreateTemplateNode node) {
PutIndexTemplateRequest templateRequest = new PutIndexTemplateRequest(node.templateName())
.mapping(Constants.DEFAULT_MAPPING_TYPE, node.mapping())
.create(true)
.settings(node.indexSettings())
.template(node.indexMatch());
if (node.alias() != null) {
templateRequest.alias(new Alias(node.alias()));
}
templateRequest.putHeader(LoginUserContext.USER_INFO_KEY, getParamContext().getLoginUserContext());
return templateRequest;
}
开发者ID:baidu,项目名称:Elasticsearch,代码行数:14,代码来源:ESCreateTemplateTask.java
示例6: handleRequest
import org.elasticsearch.action.admin.indices.template.put.PutIndexTemplateRequest; //导入依赖的package包/类
@SuppressWarnings({"unchecked"})
@Override
public void handleRequest(final RestRequest request, final RestChannel channel, final Client client) {
PutIndexTemplateRequest putRequest = new PutIndexTemplateRequest(request.param("name"));
putRequest.template(request.param("template", putRequest.template()));
putRequest.order(request.paramAsInt("order", putRequest.order()));
putRequest.masterNodeTimeout(request.paramAsTime("master_timeout", putRequest.masterNodeTimeout()));
putRequest.create(request.paramAsBoolean("create", false));
putRequest.cause(request.param("cause", ""));
putRequest.source(request.content());
client.admin().indices().putTemplate(putRequest, new AcknowledgedRestListener<PutIndexTemplateResponse>(channel));
}
开发者ID:baidu,项目名称:Elasticsearch,代码行数:13,代码来源:RestPutIndexTemplateAction.java
示例7: execute
import org.elasticsearch.action.admin.indices.template.put.PutIndexTemplateRequest; //导入依赖的package包/类
@Override
public void execute(IndexTemplate indexTemplate) {
try {
createClient().admin().indices().putTemplate(
new PutIndexTemplateRequest()
.name(indexTemplate.getName())
.source(indexTemplate.getSource(), XContentType.JSON)
);
} catch (Exception e) {
LOG.error("Unable to add index template", e);
}
}
开发者ID:rfoltyns,项目名称:log4j2-elasticsearch,代码行数:13,代码来源:BulkProcessorObjectFactory.java
示例8: execute
import org.elasticsearch.action.admin.indices.template.put.PutIndexTemplateRequest; //导入依赖的package包/类
@Override
public void execute(IndexTemplate indexTemplate) {
try {
createClient().admin().indices().putTemplate(
new PutIndexTemplateRequest()
.name(indexTemplate.getName())
.source(indexTemplate.getSource())
);
} catch (Exception e) {
LOG.error("Unable to add index template", e);
}
}
开发者ID:rfoltyns,项目名称:log4j2-elasticsearch,代码行数:13,代码来源:BulkProcessorObjectFactory.java
示例9: before
import org.elasticsearch.action.admin.indices.template.put.PutIndexTemplateRequest; //导入依赖的package包/类
@Before
public void before() throws IOException {
repository = factory.create(Person.class);
repository.refreshPolicy(IMMEDIATE);
final IndicesAdminClient indices = client.admin().indices();
final PutIndexTemplateRequest datas = indices.preparePutTemplate("datas")
.setSource(toByteArray(getClass().getResourceAsStream("/datas.json")), JSON)
.request();
checkState(indices.putTemplate(datas).actionGet().isAcknowledged());
}
开发者ID:jloisel,项目名称:elastic-crud,代码行数:12,代码来源:RepositoryIntegrationTest.java
示例10: ensureTemplate
import org.elasticsearch.action.admin.indices.template.put.PutIndexTemplateRequest; //导入依赖的package包/类
@Override
public void ensureTemplate(String name, String indexTemplate) {
GetIndexTemplatesResponse existingTemplates =
client.admin().indices().getTemplates(new GetIndexTemplatesRequest(name))
.actionGet();
if (!existingTemplates.getIndexTemplates().isEmpty()) {
return;
}
client.admin().indices().putTemplate(
new PutIndexTemplateRequest(name).source(indexTemplate)).actionGet();
}
开发者ID:liaominghua,项目名称:zipkin,代码行数:12,代码来源:NativeClient.java
示例11: getClusterTemplateMapping
import org.elasticsearch.action.admin.indices.template.put.PutIndexTemplateRequest; //导入依赖的package包/类
public static PutIndexTemplateRequest getClusterTemplateMapping(IndicesAdminClient indicesAdminClient) {
try {
PutIndexTemplateRequestBuilder builder = new PutIndexTemplateRequestBuilder(indicesAdminClient, "generic_template");
builder.setTemplate(String.format("%s-*", ElasticsearchUtils.TABLENAME_PREFIX));
System.out.println(getDocumentMapping().string());
builder.addMapping(DOCUMENT_TYPE_NAME, getDocumentMapping());
return builder.request();
} catch (IOException ex) {
logger.error("TEMPLATE_CREATION_FAILED", ex);
return null;
}
}
开发者ID:Flipkart,项目名称:foxtrot,代码行数:13,代码来源:ElasticsearchUtils.java
示例12: setIndexTemplate
import org.elasticsearch.action.admin.indices.template.put.PutIndexTemplateRequest; //导入依赖的package包/类
public boolean setIndexTemplate(String indexName, String template, Client esClient) {
try {
esClient.admin().indices().putTemplate(new PutIndexTemplateRequest(indexName).source(template));
return true;
} catch (Exception e) {
e.printStackTrace();
return false;
}
}
开发者ID:tootedom,项目名称:related,代码行数:10,代码来源:ElasticSearchServer.java
示例13: toXContent
import org.elasticsearch.action.admin.indices.template.put.PutIndexTemplateRequest; //导入依赖的package包/类
@Override
protected XContentBuilder toXContent(PutIndexTemplateRequest request, PutIndexTemplateResponse response, XContentBuilder builder) throws IOException {
builder.startObject()
.field(Fields.OK, true)
.field(Fields.ACKNOWLEDGED, response.isAcknowledged())
.endObject();
return builder;
}
开发者ID:javanna,项目名称:elasticshell,代码行数:9,代码来源:PutIndexTemplateRequestBuilder.java
示例14: putTemplate
import org.elasticsearch.action.admin.indices.template.put.PutIndexTemplateRequest; //导入依赖的package包/类
@Override
public ActionFuture<PutIndexTemplateResponse> putTemplate(final PutIndexTemplateRequest request) {
return execute(PutIndexTemplateAction.INSTANCE, request);
}
开发者ID:justor,项目名称:elasticsearch_my,代码行数:5,代码来源:AbstractClient.java
示例15: putIndexTemplate
import org.elasticsearch.action.admin.indices.template.put.PutIndexTemplateRequest; //导入依赖的package包/类
public void putIndexTemplate(PutIndexTemplateRequest request, ActionListener<PutIndexTemplateResponse> listener) {
putIndexTemplateActionHandler.execute(request, listener);
}
开发者ID:obourgain,项目名称:elasticsearch-http,代码行数:4,代码来源:HttpIndicesAdminClient.java
示例16: initializeMappings
import org.elasticsearch.action.admin.indices.template.put.PutIndexTemplateRequest; //导入依赖的package包/类
public static void initializeMappings(Client client) {
PutIndexTemplateRequest templateRequest = getClusterTemplateMapping(client.admin().indices());
client.admin().indices().putTemplate(templateRequest).actionGet();
}
开发者ID:Flipkart,项目名称:foxtrot,代码行数:5,代码来源:ElasticsearchUtils.java
示例17: PutIndexTemplateRequestBuilder
import org.elasticsearch.action.admin.indices.template.put.PutIndexTemplateRequest; //导入依赖的package包/类
public PutIndexTemplateRequestBuilder(Client client, JsonToString<JsonInput> jsonToString, StringToJson<JsonOutput> stringToJson) {
super(client, new PutIndexTemplateRequest(null), jsonToString, stringToJson);
}
开发者ID:javanna,项目名称:elasticshell,代码行数:4,代码来源:PutIndexTemplateRequestBuilder.java
示例18: doExecute
import org.elasticsearch.action.admin.indices.template.put.PutIndexTemplateRequest; //导入依赖的package包/类
@Override
protected ActionFuture<PutIndexTemplateResponse> doExecute(PutIndexTemplateRequest request) {
return client.admin().indices().putTemplate(request);
}
开发者ID:javanna,项目名称:elasticshell,代码行数:5,代码来源:PutIndexTemplateRequestBuilder.java
示例19: putTemplate
import org.elasticsearch.action.admin.indices.template.put.PutIndexTemplateRequest; //导入依赖的package包/类
/**
* Puts an index template.
*/
ActionFuture<PutIndexTemplateResponse> putTemplate(PutIndexTemplateRequest request);
开发者ID:justor,项目名称:elasticsearch_my,代码行数:5,代码来源:IndicesAdminClient.java
注:本文中的org.elasticsearch.action.admin.indices.template.put.PutIndexTemplateRequest类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论