当前位置: 首页>>代码示例>>Java>>正文


Java PutMappingAction类代码示例

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

}
 
开发者ID:kucera-jan-cz,项目名称:esBench,代码行数:22,代码来源:ConfigurationAnalyzerIntegrationTest.java

示例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");
}
 
开发者ID:kucera-jan-cz,项目名称:esBench,代码行数:20,代码来源:StatsCollectorIntegrationTest.java

示例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;
}
 
开发者ID:apache,项目名称:metamodel,代码行数:24,代码来源:ElasticSearchCreateTableBuilder.java

示例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);
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:12,代码来源:IndicesRequestIT.java

示例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;
}
 
开发者ID:jprante,项目名称:elasticsearch-helper,代码行数:11,代码来源:BaseMetricTransportClient.java

示例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();
        }
    }
}
 
开发者ID:jprante,项目名称:elasticsearch-helper,代码行数:12,代码来源:BaseClient.java

示例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;
}
 
开发者ID:jprante,项目名称:elasticsearch-helper,代码行数:12,代码来源:BulkNodeClient.java

示例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;
}
 
开发者ID:jprante,项目名称:elasticsearch-helper,代码行数:12,代码来源:HttpBulkNodeClient.java

示例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);
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:5,代码来源:AbstractClient.java

示例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);
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:5,代码来源:AbstractClient.java

示例11: getAction

import org.elasticsearch.action.admin.indices.mapping.put.PutMappingAction; //导入依赖的package包/类
public PutMappingAction getAction() {
    return PutMappingAction.INSTANCE;
}
 
开发者ID:obourgain,项目名称:elasticsearch-http,代码行数:4,代码来源:PutMappingActionHandler.java


注:本文中的org.elasticsearch.action.admin.indices.mapping.put.PutMappingAction类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。