public void setMapping(String indexName, File json) { try { this.elasticsearchClient.admin().indices().preparePutMapping(indexName) .setSource(new String(Files.readAllBytes(json.toPath()), StandardCharsets.UTF_8)) .setUpdateAllTypes(true) .setType("_default_") .execute() .actionGet(); } catch (Throwable e) { DAO.severe(e); }; }
public void setMapping(String indexName, File json) { try { this.elasticsearchClient.admin().indices().preparePutMapping(indexName) .setSource(new String(Files.readAllBytes(json.toPath()), StandardCharsets.UTF_8), XContentType.JSON) .setUpdateAllTypes(true) .setType("_default_") .execute() .actionGet(); } catch (Throwable e) { Data.logger.warn("", e); }; }
public void setMapping(String indexName, XContentBuilder mapping) { try { this.elasticsearchClient.admin().indices().preparePutMapping(indexName) .setSource(mapping) .setUpdateAllTypes(true) .setType("_default_").execute().actionGet(); } catch (Throwable e) { Data.logger.warn("", e); }; }
public void setMapping(String indexName, Map<String, Object> mapping) { try { this.elasticsearchClient.admin().indices().preparePutMapping(indexName) .setSource(mapping) .setUpdateAllTypes(true) .setType("_default_").execute().actionGet(); } catch (Throwable e) { Data.logger.warn("", e); }; }
public void setMapping(String indexName, String mapping) { try { this.elasticsearchClient.admin().indices().preparePutMapping(indexName) .setSource(mapping, XContentType.JSON) .setUpdateAllTypes(true) .setType("_default_").execute().actionGet(); } catch (Throwable e) { Data.logger.warn("", e); }; }