org.elasticsearch.cluster.metadata.IndexMetaData.getMappings()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(8.9k)|赞(0)|评价(0)|浏览(96)

本文整理了Java中org.elasticsearch.cluster.metadata.IndexMetaData.getMappings()方法的一些代码示例,展示了IndexMetaData.getMappings()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。IndexMetaData.getMappings()方法的具体详情如下:
包路径:org.elasticsearch.cluster.metadata.IndexMetaData
类名称:IndexMetaData
方法名:getMappings

IndexMetaData.getMappings介绍

暂无

代码示例

代码示例来源:origin: alibaba/canal

.getIndices()
    .get(mapping.get_index())
    .getMappings();
} catch (NullPointerException e) {
  throw new IllegalArgumentException("Not found the mapping info of index: " + mapping.get_index());

代码示例来源: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

/**
 * @param concreteIndex The concrete index to check if routing is required
 * @param type          The type to check if routing is required
 * @return Whether routing is required according to the mapping for the specified index and type
 */
public boolean routingRequired(String concreteIndex, String type) {
  IndexMetaData indexMetaData = indices.get(concreteIndex);
  if (indexMetaData != null) {
    MappingMetaData mappingMetaData = indexMetaData.getMappings().get(type);
    if (mappingMetaData != null) {
      return mappingMetaData.routing().required();
    }
  }
  return false;
}

代码示例来源:origin: org.elasticsearch/elasticsearch

private synchronized Map<String, DocumentMapper> internalMerge(IndexMetaData indexMetaData, MergeReason reason,
                                boolean updateAllTypes, boolean onlyUpdateIfNeeded) {
  Map<String, CompressedXContent> map = new LinkedHashMap<>();
  for (ObjectCursor<MappingMetaData> cursor : indexMetaData.getMappings().values()) {
    MappingMetaData mappingMetaData = cursor.value;
    if (onlyUpdateIfNeeded) {
      DocumentMapper existingMapper = documentMapper(mappingMetaData.type());
      if (existingMapper == null || mappingMetaData.source().equals(existingMapper.mappingSource()) == false) {
        map.put(mappingMetaData.type(), mappingMetaData.source());
      }
    } else {
      map.put(mappingMetaData.type(), mappingMetaData.source());
    }
  }
  return internalMerge(map, reason, updateAllTypes);
}

代码示例来源:origin: org.elasticsearch/elasticsearch

for (ObjectObjectCursor<String, MappingMetaData> mapping : sourceMetaData.getMappings()) {
  mappingUpdateConsumer.accept(mapping.key, mapping.value);

代码示例来源:origin: org.elasticsearch/elasticsearch

for (ObjectObjectCursor<String, MappingMetaData> cursor : indexMetaData.getMappings()) {
  Map<String, Object> mapping = XContentHelper
      .convertToMap(new BytesArray(cursor.value.source().uncompressed()), false).v2();

代码示例来源:origin: org.elasticsearch/elasticsearch

Predicate<String> fieldPredicate = fieldFilter.apply(index);
if (isAllTypes) {
  indexMapBuilder.put(index, filterFields(indexMetaData.getMappings(), fieldPredicate));
} else {
  ImmutableOpenMap.Builder<String, MappingMetaData> filteredMappings = ImmutableOpenMap.builder();
  for (ObjectObjectCursor<String, MappingMetaData> cursor : indexMetaData.getMappings()) {
    if (Regex.simpleMatch(types, cursor.key)) {
      filteredMappings.put(cursor.key, filterFields(cursor.value, fieldPredicate));

代码示例来源:origin: org.elasticsearch/elasticsearch

for (ObjectObjectCursor<String, MappingMetaData> cursor : indexMetaData.getMappings()) {
  if (binary) {
    builder.value(cursor.value.source().compressed());

代码示例来源:origin: org.elasticsearch/elasticsearch

for (final ObjectCursor<MappingMetaData> mapping : newIndexMetaData.getMappings().values()) {
  final CompressedXContent currentSource = currentIndexMetaData.mapping(mapping.value.type()).source();
  final CompressedXContent newSource = mapping.value.source();

代码示例来源:origin: org.elasticsearch/elasticsearch

for (ObjectCursor<MappingMetaData> mapping : indexMetaData.getMappings().values()) {
  String parentType = newMapper.parentFieldMapper().type();
  if (parentType.equals(mapping.value.type()) &&

代码示例来源: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.elasticsearch/elasticsearch

ImmutableOpenMap<String, MappingMetaData> mappings = state.metaData().getIndices().get(concreteIndex).getMappings();
if (mappings.isEmpty()) {
  listener.onResponse(new TypesExistsResponse(false));

代码示例来源:origin: com.strapdata.elasticsearch/elasticsearch

public void dropTables(final IndexMetaData indexMetaData) throws RequestExecutionException {
  String ksName = indexMetaData.keyspace();
  for(ObjectCursor<String> cfName : indexMetaData.getMappings().keys()) {
    dropTable(ksName, cfName.value);
  }
}

代码示例来源:origin: com.strapdata.elasticsearch/elasticsearch

public void createSecondaryIndices(final IndexMetaData indexMetaData) throws IOException {
  String ksName = indexMetaData.keyspace();
  String className = indexMetaData.getSettings().get(IndexMetaData.SETTING_SECONDARY_INDEX_CLASS, this.settings.get(SETTING_CLUSTER_SECONDARY_INDEX_CLASS, defaultSecondaryIndexClass.getName()));
  for(ObjectCursor<MappingMetaData> cursor: indexMetaData.getMappings().values()) {
    createSecondaryIndex(ksName, cursor.value, className);
  }
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.elasticsearch

/**
 * @param concreteIndex The concrete index to check if routing is required
 * @param type          The type to check if routing is required
 * @return Whether routing is required according to the mapping for the specified index and type
 */
public boolean routingRequired(String concreteIndex, String type) {
  IndexMetaData indexMetaData = indices.get(concreteIndex);
  if (indexMetaData != null) {
    MappingMetaData mappingMetaData = indexMetaData.getMappings().get(type);
    if (mappingMetaData != null) {
      return mappingMetaData.routing().required();
    }
  }
  return false;
}

代码示例来源:origin: com.strapdata.elasticsearch/elasticsearch

/**
 * @param concreteIndex The concrete index to check if routing is required
 * @param type          The type to check if routing is required
 * @return Whether routing is required according to the mapping for the specified index and type
 */
public boolean routingRequired(String concreteIndex, String type) {
  IndexMetaData indexMetaData = indices.get(concreteIndex);
  if (indexMetaData != null) {
    MappingMetaData mappingMetaData = indexMetaData.getMappings().get(type);
    if (mappingMetaData != null) {
      return mappingMetaData.routing().required();
    }
  }
  return false;
}

代码示例来源:origin: harbby/presto-connectors

/**
 * @param concreteIndex The concrete index to check if routing is required
 * @param type          The type to check if routing is required
 * @return Whether routing is required according to the mapping for the specified index and type
 */
public boolean routingRequired(String concreteIndex, String type) {
  IndexMetaData indexMetaData = indices.get(concreteIndex);
  if (indexMetaData != null) {
    MappingMetaData mappingMetaData = indexMetaData.getMappings().get(type);
    if (mappingMetaData != null) {
      return mappingMetaData.routing().required();
    }
  }
  return false;
}

代码示例来源:origin: com.strapdata.elasticsearch/elasticsearch

private synchronized Map<String, DocumentMapper> internalMerge(IndexMetaData indexMetaData, MergeReason reason, boolean updateAllTypes,
                                boolean onlyUpdateIfNeeded) {
  Map<String, CompressedXContent> map = new LinkedHashMap<>();
  for (ObjectCursor<MappingMetaData> cursor : indexMetaData.getMappings().values()) {
    MappingMetaData mappingMetaData = cursor.value;
    if (onlyUpdateIfNeeded) {
      DocumentMapper existingMapper = documentMapper(mappingMetaData.type());
      if (existingMapper == null || mappingMetaData.source().equals(existingMapper.mappingSource()) == false) {
        map.put(mappingMetaData.type(), mappingMetaData.source());
      }
    } else {
      map.put(mappingMetaData.type(), mappingMetaData.source());
    }
  }
  return internalMerge(map, reason, updateAllTypes);
}

代码示例来源:origin: dqeasycloud/easy-cloud

@Override
public boolean typeExists(String indexName, String type) {
  return getAdminClient().cluster().prepareState().execute().actionGet().getState().metaData().index(indexName)
      .getMappings().containsKey(type);
}

相关文章

微信公众号

最新文章

更多

IndexMetaData类方法