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


Java GetMappingsRequestBuilder类代码示例

本文整理汇总了Java中org.elasticsearch.action.admin.indices.mapping.get.GetMappingsRequestBuilder的典型用法代码示例。如果您正苦于以下问题:Java GetMappingsRequestBuilder类的具体用法?Java GetMappingsRequestBuilder怎么用?Java GetMappingsRequestBuilder使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


GetMappingsRequestBuilder类属于org.elasticsearch.action.admin.indices.mapping.get包,在下文中一共展示了GetMappingsRequestBuilder类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getAllMappings

import org.elasticsearch.action.admin.indices.mapping.get.GetMappingsRequestBuilder; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Override
public ImmutableOpenMap<String, MappingMetaData> getAllMappings(String index) {
    Object mapping = cache.get(makeKey(index));
    if (mapping == null) {
        mapping = new GetMappingsRequestBuilder(getClient(), GetMappingsAction.INSTANCE, index)
                .get().mappings().get(index);
        cache.put(makeKey(index), mapping);
    }
    return (ImmutableOpenMap<String, MappingMetaData>) mapping;
}
 
开发者ID:Hevelian,项目名称:hevelian-olastic,代码行数:12,代码来源:DefaultMetaDataProvider.java

示例2: insertSchema

import org.elasticsearch.action.admin.indices.mapping.get.GetMappingsRequestBuilder; //导入依赖的package包/类
@Test
public void insertSchema() throws Exception {
    sink.prepare(mapping);

    IndicesAdminClient indicesClient = sink.getClient().admin().indices();
    GetMappingsRequestBuilder builder = new GetMappingsRequestBuilder(indicesClient, GetMappingsAction.INSTANCE, mapping.getIndex())
            .addTypes(mapping.getType());
    GetMappingsResponse response = indicesClient.getMappings(builder.request()).actionGet();
    ImmutableOpenMap<String, ImmutableOpenMap<String, MappingMetaData>> mappings = response.getMappings();

    Map<String, Object> recordTypeMap = mappings.get(mapping.getIndex()).get(mapping.getType()).getSourceAsMap();
    assertThat("dynamic value is correct", Boolean.valueOf(recordTypeMap.get("dynamic").toString()), is(mapping.isDynamicMappingEnabled()));

    Thread.sleep(1000);

    // https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-get-mapping.html
    String allMappingsResponse = Request
            .Get("http://localhost:9200/_mapping/_all?pretty").execute()
            .returnContent().asString();
    assertThat("record type is provided (checking id property type", allMappingsResponse, hasJsonPath(mapping.getIndex() + ".mappings." + mapping.getType() + ".properties.id.type", is("string")));
    assertThat("metadata type is provided (checking mt_update-time property type)", allMappingsResponse, hasJsonPath(mapping.getIndex() + ".mappings.mt.properties.mt-update-time.type", is("date")));

    // https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-types-exists.html
    StatusLine recordsStatus = Request
            .Head("http://localhost:9200/" + mapping.getIndex() + "/" + mapping.getType()).execute()
            .returnResponse().getStatusLine();
    assertThat("records type is available", recordsStatus.getStatusCode(), is(200));
    StatusLine mtStatus = Request
            .Head("http://localhost:9200/" + mapping.getIndex() + "/mt").execute()
            .returnResponse().getStatusLine();
    assertThat("metadata type is available", mtStatus.getStatusCode(), is(200));
}
 
开发者ID:52North,项目名称:youngs,代码行数:33,代码来源:ElasticsearchSinkTestmappingIT.java

示例3:

import org.elasticsearch.action.admin.indices.mapping.get.GetMappingsRequestBuilder; //导入依赖的package包/类
/**
 * Gets the mappings response.
 *
 * @param indices
 *            the indices
 * @return the mappings response
 */
public ImmutableOpenMap<String, ImmutableOpenMap<String, MappingMetaData>>
		getMappingsResponse(String... indices) {
	GetMappingsRequestBuilder getMappingsRequestBuilder =
			admin().indices().prepareGetMappings(indices);
	return JMElastricsearchUtil.logExcuteAndReturn("getMappingsResponse",
			getMappingsRequestBuilder, getMappingsRequestBuilder.execute())
			.getMappings();
}
 
开发者ID:JM-Lab,项目名称:utils-elasticsearch,代码行数:16,代码来源:JMElasticsearchClient.java

示例4: getDynamicFieldNames

import org.elasticsearch.action.admin.indices.mapping.get.GetMappingsRequestBuilder; //导入依赖的package包/类
@Override
public List<String> getDynamicFieldNames() throws SearchEngineException {
	List<String> fieldNames = new LinkedList<>();

	try {
		GetMappingsRequest req =
				new GetMappingsRequestBuilder(client, GetMappingsAction.INSTANCE, configuration.getIndexName())
						.setTypes(configuration.getDocType())
						.request();
		GetMappingsResponse response = client.admin().indices().getMappings(req).actionGet();
		MappingMetaData metaData = response.getMappings()
				.get(configuration.getIndexName())
				.get(configuration.getDocType());
		Map<String, Object> sourceMap = metaData.getSourceAsMap();
		Object annotationField = ((Map)sourceMap.get("properties")).get(configuration.getAnnotationField());
		Map<String, Object> annotationProperties = (Map<String, Object>)((Map)annotationField).get("properties");

		if (annotationProperties != null) {
			for (String field : annotationProperties.keySet()) {
				if (field.matches(DYNAMIC_LABEL_FIELD_REGEX)) {
					fieldNames.add(field);
				}
			}
		}
	} catch (IOException e) {
		LOGGER.error("Caught IOException retrieving field source: {}", e.getMessage());
		throw new SearchEngineException(e);
	}

	return fieldNames;
}
 
开发者ID:flaxsearch,项目名称:BioSolr,代码行数:32,代码来源:ElasticSearchEngine.java

示例5: prepareGetMappings

import org.elasticsearch.action.admin.indices.mapping.get.GetMappingsRequestBuilder; //导入依赖的package包/类
@Override
public GetMappingsRequestBuilder prepareGetMappings(String... indices) {
    return new GetMappingsRequestBuilder(this, GetMappingsAction.INSTANCE, indices);
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:5,代码来源:AbstractClient.java

示例6: getMapping

import org.elasticsearch.action.admin.indices.mapping.get.GetMappingsRequestBuilder; //导入依赖的package包/类
private static GetMappingsRequestBuilder getMapping(String... indices) {
    return client().admin().indices().prepareGetMappings(indices);
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:4,代码来源:IndicesOptionsIntegrationIT.java

示例7: prepareGetMappings

import org.elasticsearch.action.admin.indices.mapping.get.GetMappingsRequestBuilder; //导入依赖的package包/类
/**
 * Get the complete mappings of one or more types
 */
GetMappingsRequestBuilder prepareGetMappings(String... indices);
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:5,代码来源:IndicesAdminClient.java


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