本文整理汇总了Java中org.elasticsearch.action.admin.indices.mapping.put.PutMappingAction类的典型用法代码示例。如果您正苦于以下问题:Java PutMappingAction类的具体用法?Java PutMappingAction怎么用?Java PutMappingAction使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PutMappingAction类属于org.elasticsearch.action.admin.indices.mapping.put包,在下文中一共展示了PutMappingAction类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initCluster
import org.elasticsearch.action.admin.indices.mapping.put.PutMappingAction; //导入依赖的package包/类
@BeforeClass
public void initCluster() throws IOException {
client = getClient();
CreateIndexRequest indexRequest = new CreateIndexRequest(INDEX_NAME);
assertTrue(client.admin().indices().create(indexRequest).actionGet().isAcknowledged());
String mapping = ResourceUtils.asString("mapping_request.json");
PutMappingRequestBuilder builder = new PutMappingRequestBuilder(client, PutMappingAction.INSTANCE);
PutMappingRequest request = builder.setIndices(INDEX_NAME).setType(INDEX_TYPE).setSource(mapping).request();
assertTrue(client.admin().indices().putMapping(request).actionGet().isAcknowledged());
String doc01 = ResourceUtils.asString("documents/doc01.json");
String doc02 = ResourceUtils.asString("documents/doc02.json");
IndexRequestBuilder indexBuilder = new IndexRequestBuilder(client, IndexAction.INSTANCE, INDEX_NAME).setType(INDEX_TYPE);
assertTrue(client.index(indexBuilder.setId("1").setSource(doc01).request()).actionGet().isCreated());
assertTrue(client.index(indexBuilder.setId("2").setSource(doc02).request()).actionGet().isCreated());
client.admin().indices().flush(new FlushRequest(INDEX_NAME)).actionGet();
defaultProperties = new DefaultProperties("default.properties");
}
示例2: initCluster
import org.elasticsearch.action.admin.indices.mapping.put.PutMappingAction; //导入依赖的package包/类
@BeforeClass
public void initCluster() throws IOException {
client = getClient();
CreateIndexRequest indexRequest = new CreateIndexRequest(INDEX_NAME);
assertTrue(client.admin().indices().create(indexRequest).actionGet().isAcknowledged());
String mapping = ResourceUtils.asString("mapping_request.json");
PutMappingRequestBuilder builder = new PutMappingRequestBuilder(client, PutMappingAction.INSTANCE);
PutMappingRequest request = builder.setIndices(INDEX_NAME).setType(INDEX_TYPE).setSource(mapping).request();
assertTrue(client.admin().indices().putMapping(request).actionGet().isAcknowledged());
String doc01 = ResourceUtils.asString("documents/doc01.json");
String doc02 = ResourceUtils.asString("documents/doc02.json");
IndexRequestBuilder indexBuilder = new IndexRequestBuilder(client, IndexAction.INSTANCE, INDEX_NAME).setType(INDEX_TYPE);
assertTrue(client.index(indexBuilder.setId("1").setSource(doc01).request()).actionGet().isCreated());
assertTrue(client.index(indexBuilder.setId("2").setSource(doc02).request()).actionGet().isCreated());
client.admin().indices().flush(new FlushRequest(INDEX_NAME)).actionGet();
defaultProperties = new DefaultProperties("default.properties");
}
示例3: execute
import org.elasticsearch.action.admin.indices.mapping.put.PutMappingAction; //导入依赖的package包/类
@Override
public Table execute() throws MetaModelException {
final MutableTable table = getTable();
final Map<String, ?> source = ElasticSearchUtils.getMappingSource(table);
final ElasticSearchDataContext dataContext = getUpdateCallback().getDataContext();
final IndicesAdminClient indicesAdmin = dataContext.getElasticSearchClient().admin().indices();
final String indexName = dataContext.getIndexName();
final PutMappingRequestBuilder requestBuilder =
new PutMappingRequestBuilder(indicesAdmin, PutMappingAction.INSTANCE).setIndices(indexName)
.setType(table.getName());
requestBuilder.setSource(source);
final PutMappingResponse result = requestBuilder.execute().actionGet();
logger.debug("PutMapping response: acknowledged={}", result.isAcknowledged());
dataContext.getElasticSearchClient().admin().indices().prepareRefresh(indexName).get();
final MutableSchema schema = (MutableSchema) getSchema();
schema.addTable(table);
return table;
}
示例4: testPutMapping
import org.elasticsearch.action.admin.indices.mapping.put.PutMappingAction; //导入依赖的package包/类
public void testPutMapping() {
interceptTransportActions(PutMappingAction.NAME);
PutMappingRequest putMappingRequest = new PutMappingRequest(randomUniqueIndicesOrAliases())
.type("type")
.source("field", "type=text");
internalCluster().coordOnlyNodeClient().admin().indices().putMapping(putMappingRequest).actionGet();
clearInterceptedActions();
assertSameIndices(putMappingRequest, PutMappingAction.NAME);
}
示例5: newMapping
import org.elasticsearch.action.admin.indices.mapping.put.PutMappingAction; //导入依赖的package包/类
@Override
public BaseMetricTransportClient newMapping(String index, String type, Map<String, Object> mapping) {
new PutMappingRequestBuilder(client(), PutMappingAction.INSTANCE)
.setIndices(index)
.setType(type)
.setSource(mapping)
.execute().actionGet();
logger.info("mapping created for index {} and type {}", index, type);
return this;
}
示例6: putMapping
import org.elasticsearch.action.admin.indices.mapping.put.PutMappingAction; //导入依赖的package包/类
public void putMapping(String index) {
if (client() == null) {
return;
}
if (!mappings().isEmpty()) {
for (Map.Entry<String, String> me : mappings().entrySet()) {
client().execute(PutMappingAction.INSTANCE,
new PutMappingRequest(index).type(me.getKey()).source(me.getValue())).actionGet();
}
}
}
示例7: newMapping
import org.elasticsearch.action.admin.indices.mapping.put.PutMappingAction; //导入依赖的package包/类
@Override
public BulkNodeClient newMapping(String index, String type, Map<String, Object> mapping) {
PutMappingRequestBuilder putMappingRequestBuilder =
new PutMappingRequestBuilder(client(), PutMappingAction.INSTANCE)
.setIndices(index)
.setType(type)
.setSource(mapping);
putMappingRequestBuilder.execute().actionGet();
logger.info("mapping created for index {} and type {}", index, type);
return this;
}
示例8: newMapping
import org.elasticsearch.action.admin.indices.mapping.put.PutMappingAction; //导入依赖的package包/类
@Override
public HttpBulkNodeClient newMapping(String index, String type, Map<String, Object> mapping) {
PutMappingRequestBuilder putMappingRequestBuilder =
new PutMappingRequestBuilder(client(), PutMappingAction.INSTANCE)
.setIndices(index)
.setType(type)
.setSource(mapping);
putMappingRequestBuilder.execute().actionGet();
logger.info("mapping created for index {} and type {}", index, type);
return this;
}
示例9: putMapping
import org.elasticsearch.action.admin.indices.mapping.put.PutMappingAction; //导入依赖的package包/类
@Override
public ActionFuture<PutMappingResponse> putMapping(final PutMappingRequest request) {
return execute(PutMappingAction.INSTANCE, request);
}
示例10: preparePutMapping
import org.elasticsearch.action.admin.indices.mapping.put.PutMappingAction; //导入依赖的package包/类
@Override
public PutMappingRequestBuilder preparePutMapping(String... indices) {
return new PutMappingRequestBuilder(this, PutMappingAction.INSTANCE).setIndices(indices);
}
示例11: getAction
import org.elasticsearch.action.admin.indices.mapping.put.PutMappingAction; //导入依赖的package包/类
public PutMappingAction getAction() {
return PutMappingAction.INSTANCE;
}