コード例 #1
0
ファイル: DocIndexMetaData.java プロジェクト: proofy/crate
 private void updateTemplate(
     DocIndexMetaData md,
     TransportPutIndexTemplateAction transportPutIndexTemplateAction,
     Settings updateSettings) {
   String templateName = PartitionName.templateName(ident.schema(), ident.name());
   PutIndexTemplateRequest request =
       new PutIndexTemplateRequest(templateName)
           .mapping(Constants.DEFAULT_MAPPING_TYPE, md.defaultMappingMap)
           .create(false)
           .settings(updateSettings)
           .template(templateName + "*");
   for (String alias : md.aliases()) {
     request = request.alias(new Alias(alias));
   }
   transportPutIndexTemplateAction.execute(request);
 }
コード例 #2
0
ファイル: DocIndexMetaData.java プロジェクト: proofy/crate
  public DocIndexMetaData(IndexMetaData metaData, TableIdent ident) throws IOException {
    this.ident = ident;
    this.metaData = metaData;
    this.isAlias = !metaData.getIndex().equals(ident.esName());
    this.numberOfShards = metaData.numberOfShards();
    final Settings settings = metaData.getSettings();
    this.numberOfReplicas = NumberOfReplicas.fromSettings(settings);
    this.aliases = ImmutableSet.copyOf(metaData.aliases().keys().toArray(String.class));
    this.defaultMappingMetaData = this.metaData.mappingOrDefault(Constants.DEFAULT_MAPPING_TYPE);
    if (defaultMappingMetaData == null) {
      this.defaultMappingMap = new HashMap<>();
    } else {
      this.defaultMappingMap = this.defaultMappingMetaData.sourceAsMap();
    }
    this.tableParameters = TableParameterInfo.tableParametersFromIndexMetaData(metaData);

    prepareCrateMeta();
  }