本文整理了Java中org.elasticsearch.cluster.metadata.MappingMetaData.sourceAsMap()
方法的一些代码示例,展示了MappingMetaData.sourceAsMap()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。MappingMetaData.sourceAsMap()
方法的具体详情如下:
包路径:org.elasticsearch.cluster.metadata.MappingMetaData
类名称:MappingMetaData
方法名:sourceAsMap
[英]Converts the serialized compressed form of the mappings into a parsed map.
[中]将映射的序列化压缩形式转换为已解析的映射。
代码示例来源:origin: NLPchina/elasticsearch-sql
private void writeMappings(ImmutableOpenMap<String, MappingMetaData> mappings, XContentBuilder builder, ToXContent.Params params) throws IOException {
builder.startObject(Fields.MAPPINGS);
if (mappings != null) {
for (ObjectObjectCursor<String, MappingMetaData> typeEntry : mappings) {
builder.field(typeEntry.key);
builder.map(typeEntry.value.sourceAsMap());
}
}
builder.endObject();
}
代码示例来源:origin: org.elasticsearch/elasticsearch
/**
* Converts the serialized compressed form of the mappings into a parsed map.
*/
public Map<String, Object> getSourceAsMap() throws ElasticsearchParseException {
return sourceAsMap();
}
代码示例来源:origin: org.elasticsearch/elasticsearch
private int getTaskResultMappingVersion(IndexMetaData metaData) {
MappingMetaData mappingMetaData = metaData.getMappings().get(TASK_TYPE);
if (mappingMetaData == null) {
return 0;
}
@SuppressWarnings("unchecked") Map<String, Object> meta = (Map<String, Object>) mappingMetaData.sourceAsMap().get("_meta");
if (meta == null || meta.containsKey(TASK_RESULT_MAPPING_VERSION_META_FIELD) == false) {
return 1; // The mapping was created before meta field was introduced
}
return (int) meta.get(TASK_RESULT_MAPPING_VERSION_META_FIELD);
}
代码示例来源:origin: org.elasticsearch/elasticsearch
builder.field(MAPPINGS.getPreferredName(), mappings.sourceAsMap());
builder.field(typeEntry.key, typeEntry.value.sourceAsMap());
代码示例来源:origin: org.elasticsearch/elasticsearch
for (final ObjectObjectCursor<String, MappingMetaData> typeEntry : indexMappings) {
builder.field(typeEntry.key);
builder.map(typeEntry.value.sourceAsMap());
代码示例来源:origin: com.strapdata.elasticsearch/elasticsearch
/**
* Converts the serialized compressed form of the mappings into a parsed map.
*/
public Map<String, Object> getSourceAsMap() throws IOException {
return sourceAsMap();
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.elasticsearch
/**
* Converts the serialized compressed form of the mappings into a parsed map.
*/
public Map<String, Object> getSourceAsMap() throws ElasticsearchParseException {
return sourceAsMap();
}
代码示例来源:origin: apache/servicemix-bundles
/**
* Converts the serialized compressed form of the mappings into a parsed map.
*/
public Map<String, Object> getSourceAsMap() throws ElasticsearchParseException {
return sourceAsMap();
}
代码示例来源:origin: harbby/presto-connectors
/**
* Converts the serialized compressed form of the mappings into a parsed map.
*/
public Map<String, Object> getSourceAsMap() throws IOException {
return sourceAsMap();
}
代码示例来源:origin: stackoverflow.com
ImmutableOpenMap<String, ImmutableOpenMap<String, MappingMetaData>> indexMappings = response.getMappings();
ImmutableOpenMap<String, MappingMetaData> typeMappings = indexMappings.get(indexName);
MappingMetaData mapping = typeMappings.get(type);
Map<String, Mapping> mappingAsMap = new HashMap<>();
try {
Object properties = mapping.sourceAsMap().get("properties");
mappingAsMap = (Map<String, Mapping>) gson.fromJson(gson.toJson(properties), _elasticsearch_type_mapping_map_type);
return mappingAsMap;
}
代码示例来源:origin: kiegroup/appformer
public MetaObject getMetaObject(String clusterId,
String type) {
Optional<MappingMetaData> mapping = this.indexProvider.getMapping(clusterId,
type);
Map<String, Object> entries = mapping
.map(mappingMetaData -> mappingMetaData.sourceAsMap())
.orElse(Collections.emptyMap());
MetaObject meta = this.createMetaObjects(type,
entries);
return meta;
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.elasticsearch
private int getTaskResultMappingVersion(IndexMetaData metaData) {
MappingMetaData mappingMetaData = metaData.getMappings().get(TASK_TYPE);
if (mappingMetaData == null) {
return 0;
}
@SuppressWarnings("unchecked") Map<String, Object> meta = (Map<String, Object>) mappingMetaData.sourceAsMap().get("_meta");
if (meta == null || meta.containsKey(TASK_RESULT_MAPPING_VERSION_META_FIELD) == false) {
return 1; // The mapping was created before meta field was introduced
}
return (int) meta.get(TASK_RESULT_MAPPING_VERSION_META_FIELD);
}
代码示例来源:origin: apache/servicemix-bundles
private int getTaskResultMappingVersion(IndexMetaData metaData) {
MappingMetaData mappingMetaData = metaData.getMappings().get(TASK_TYPE);
if (mappingMetaData == null) {
return 0;
}
@SuppressWarnings("unchecked") Map<String, Object> meta = (Map<String, Object>) mappingMetaData.sourceAsMap().get("_meta");
if (meta == null || meta.containsKey(TASK_RESULT_MAPPING_VERSION_META_FIELD) == false) {
return 1; // The mapping was created before meta field was introduced
}
return (int) meta.get(TASK_RESULT_MAPPING_VERSION_META_FIELD);
}
代码示例来源:origin: org.uberfire/uberfire-metadata-backend-elasticsearch
public MetaObject getMetaObject(String clusterId,
String type) {
Optional<MappingMetaData> mapping = this.indexProvider.getMapping(clusterId,
type);
Map<String, Object> entries = mapping
.map(mappingMetaData -> mappingMetaData.sourceAsMap())
.orElse(Collections.emptyMap());
MetaObject meta = this.createMetaObjects(type,
entries);
return meta;
}
代码示例来源:origin: harbby/presto-connectors
private void writeMappings(ImmutableOpenMap<String, MappingMetaData> mappings, XContentBuilder builder, Params params) throws IOException {
builder.startObject(Fields.MAPPINGS);
if (mappings != null) {
for (ObjectObjectCursor<String, MappingMetaData> typeEntry : mappings) {
builder.field(typeEntry.key);
builder.map(typeEntry.value.sourceAsMap());
}
}
builder.endObject();
}
代码示例来源:origin: org.nlpcn/elasticsearch-sql
private void writeMappings(ImmutableOpenMap<String, MappingMetaData> mappings, XContentBuilder builder, ToXContent.Params params) throws IOException {
builder.startObject(Fields.MAPPINGS);
if (mappings != null) {
for (ObjectObjectCursor<String, MappingMetaData> typeEntry : mappings) {
builder.field(typeEntry.key);
builder.map(typeEntry.value.sourceAsMap());
}
}
builder.endObject();
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.elasticsearch
builder.field(MAPPINGS.getPreferredName(), mappings.sourceAsMap());
builder.field(typeEntry.key, typeEntry.value.sourceAsMap());
代码示例来源:origin: org.eclipse.rdf4j/rdf4j-sail-elasticsearch
public Map<String, Object> getMappings()
throws IOException
{
ImmutableOpenMap<String, ImmutableOpenMap<String, MappingMetaData>> indexMappings = client.admin().indices().prepareGetMappings(
indexName).setTypes(documentType).execute().actionGet().getMappings();
ImmutableOpenMap<String, MappingMetaData> typeMappings = indexMappings.get(indexName);
MappingMetaData mappings = typeMappings.get(documentType);
return mappings.sourceAsMap();
}
代码示例来源:origin: karussell/elasticsearch-reindex
/**
* Creates a new index out of the settings from the old index.
*/
private void createIdenticalIndex(String oldIndex, String type,
String newIndex, int newIndexShards, Client client) throws IOException {
IndexMetaData indexData = client.admin().cluster().state(new ClusterStateRequest()).
actionGet().getState().metaData().indices().get(oldIndex);
Settings searchIndexSettings = indexData.settings();
ImmutableSettings.Builder settingBuilder = ImmutableSettings.settingsBuilder().put(searchIndexSettings);
if (newIndexShards > 0)
settingBuilder.put("index.number_of_shards", newIndexShards);
CreateIndexRequest createReq;
if(type.equals("*")) {
createReq = new CreateIndexRequest(newIndex);
for(ObjectObjectCursor<String, MappingMetaData> mapCursor : indexData.mappings()) {
createReq.mapping(mapCursor.key, mapCursor.value.sourceAsMap());
}
createReq.settings(settingBuilder.build());
}
else {
MappingMetaData mappingMeta = indexData.mapping(type);
createReq = new CreateIndexRequest(newIndex).
mapping(type, mappingMeta.sourceAsMap()).
settings(settingBuilder.build());
}
client.admin().indices().create(createReq).actionGet();
}
代码示例来源:origin: com.strapdata.elasticsearch/elasticsearch
public ImmutableIndexInfo(String name, IndexService indexService, MappingMetaData mappingMetaData, MetaData metadata, boolean versionLessEngine) throws IOException {
this.name = name;
this.versionLessEngine = versionLessEngine;
this.indexService = indexService;
this.mapping = mappingMetaData.sourceAsMap();
this.type = mappingMetaData.type();
Map<String,Object> mappingMap = (Map<String,Object>)mappingMetaData.getSourceAsMap();
Map<String,Object> metaMap = (mappingMap == null) ? null : (Map<String,Object>)mappingMap.get("_meta");
this.refresh = getMetaSettings(metadata.settings(), indexService.getIndexSettings(), metaMap, IndexMetaData.INDEX_SYNCHRONOUS_REFRESH_SETTING);
this.snapshot = getMetaSettings(metadata.settings(), indexService.getIndexSettings(), metaMap, IndexMetaData.INDEX_SNAPSHOT_WITH_SSTABLE_SETTING);
this.includeNodeId = getMetaSettings(metadata.settings(), indexService.getIndexSettings(), metaMap, IndexMetaData.INDEX_INCLUDE_NODE_ID_SETTING);
this.index_on_compaction = getMetaSettings(metadata.settings(), indexService.getIndexSettings(), metaMap, IndexMetaData.INDEX_INDEX_ON_COMPACTION_SETTING);
this.index_static_columns = getMetaSettings(metadata.settings(), indexService.getIndexSettings(), metaMap, IndexMetaData.INDEX_INDEX_STATIC_COLUMNS_SETTING);
this.index_static_only = getMetaSettings(metadata.settings(), indexService.getIndexSettings(), metaMap, IndexMetaData.INDEX_INDEX_STATIC_ONLY_SETTING);
}
内容来源于网络,如有侵权,请联系作者删除!