@Override public boolean createIndex(String indexName) { Assert.notNull(indexName, "No index defined for Query"); try { return client.indices().create(Requests.createIndexRequest(indexName)).isAcknowledged(); } catch (Exception e) { throw new ElasticsearchException("Failed to create index " + indexName, e); } }
@Override public boolean createIndex(String indexName) { Assert.notNull(indexName, "No index defined for Query"); return getIndicesAdminClient().create(Requests.createIndexRequest(indexName)).actionGet().isAcknowledged(); }
private boolean createIndex() { if (!esResource .getClient() .admin() .indices() .exists(Requests.indicesExistsRequest(index)) .actionGet() .isExists()) { esResource .getClient() .admin() .indices() .create(Requests.createIndexRequest(index)) .actionGet(); return true; } return false; }
private boolean createIndex(String indexName) { return client.admin().indices().create(Requests.createIndexRequest(indexName). settings(new MapBuilder<String, String>().put("index.refresh_interval", "-1").map())).actionGet().acknowledged(); }
@Override public boolean createIndex() { if (!esResource .getClient() .admin() .indices() .exists(Requests.indicesExistsRequest(index)) .actionGet() .isExists()) { esResource .getClient() .admin() .indices() .create(Requests.createIndexRequest(index)) .actionGet(); return true; } return false; }
/** * Create an index in Elasticsearch. If necessary, this function should check whether a new index * is required. * * @return true if a new index has been created, false otherwise */ public boolean createIndex() { if (!esResource .getClient() .admin() .indices() .exists(Requests.indicesExistsRequest(index)) .actionGet() .isExists()) { esResource .getClient() .admin() .indices() .create(Requests.createIndexRequest(index)) .actionGet(); return true; } return false; }
/** * Create an index in Elasticsearch. If necessary, this function should check whether a new index * is required. * * @return true if a new index has been created, false otherwise */ public boolean createIndex() { if (!esResource .getClient() .admin() .indices() .exists(Requests.indicesExistsRequest(index)) .actionGet() .isExists()) { esResource .getClient() .admin() .indices() .create(Requests.createIndexRequest(index)) .actionGet(); return true; } return false; }
@Override public ActionFuture<CreateIndexResponse> execute(final IndicesAdminClient admin) { return admin.create(Requests.createIndexRequest(nodeTemplate.getIndexName())); } });
insertNamespaces(stopwordsPaths, "stopwords_path", configurationFolder, namespace); final CreateIndexRequest request = createIndexRequest(indexName) .settings(Settings.builder().loadFromSource(mapper.writeValueAsString(esconfig.get("settings")), XContentType.JSON).build()) .mapping("doc", mapper.writeValueAsString(esconfig.get("mappings")), XContentType.JSON);
public void setupIndex() { log("==== INDEX SETUP ===="); try { client.admin().indices().create(createIndexRequest(PARENT_INDEX)).actionGet(); client.admin().indices().create(createIndexRequest(CHILD_INDEX)).actionGet(); Thread.sleep(5000);
public void setupIndex() { log("==== INDEX SETUP ===="); try { client.admin().indices().create(createIndexRequest(PARENT_INDEX).mapping(PARENT_TYPE, "id", "type=string,index=not_analyzed,doc_values=true", "num", "type=integer,doc_values=true")).actionGet(); client.admin().indices().create(createIndexRequest(CHILD_INDEX).mapping(CHILD_TYPE, "id", "type=string,index=not_analyzed,doc_values=true", "pid", "type=string,index=not_analyzed,doc_values=true",