protected static void refresh() { node.client().admin().indices().prepareRefresh().get(); } }
public Observable<IndexRefreshCommandInfo> refreshAsync() { refreshIndexMeter.mark(); final long start = System.currentTimeMillis(); String[] indexes = getIndexes(); if (indexes.length == 0) { if (logger.isTraceEnabled()) { logger.trace("Not refreshing indexes. none found"); } } //Added For Graphite Metrics RefreshResponse response = esProvider.getClient().admin().indices().prepareRefresh(indexes).execute().actionGet(); int failedShards = response.getFailedShards(); int successfulShards = response.getSuccessfulShards(); ShardOperationFailedException[] sfes = response.getShardFailures(); if (sfes != null) { for (ShardOperationFailedException sfe : sfes) { logger.error("Failed to refresh index:{} reason:{}", sfe.index(), sfe.reason()); } } if (logger.isTraceEnabled()) { logger.trace("Refreshed indexes: {},success:{} failed:{} ", StringUtils.join(indexes, ", "), successfulShards, failedShards); } IndexRefreshCommandInfo refreshResults = new IndexRefreshCommandInfo(failedShards == 0, System.currentTimeMillis() - start); return ObservableTimer.time(Observable.just(refreshResults), refreshTimer); }
/** * Get the latest timestamp for a given namespace. */ @SuppressWarnings("unchecked") public static Timestamp<?> getLastTimestamp(Client client, MongoDBRiverDefinition definition) { client.admin().indices().prepareRefresh(definition.getRiverIndexName()).get(); GetResponse lastTimestampResponse = client.prepareGet(definition.getRiverIndexName(), definition.getRiverName(), definition.getMongoOplogNamespace()).get(); if (lastTimestampResponse.isExists()) { Map<String, Object> mongodbState = (Map<String, Object>) lastTimestampResponse.getSourceAsMap().get(TYPE); if (mongodbState != null) { Timestamp<?> lastTimestamp = Timestamp.on(mongodbState); if (lastTimestamp != null) { return lastTimestamp; } } } else { if (definition.getInitialTimestamp() != null) { return definition.getInitialTimestamp(); } } return null; }
semaphore.acquire(); logger.trace("dropRecreateMapping index[{}] - type[{}]", index, type); client.admin().indices().prepareRefresh(index).get(); ImmutableOpenMap<String, MappingMetaData> mappings = client.admin().cluster().prepareState().get().getState().getMetaData() .index(index).mappings();
@Override public void refreshSearchIndex(String indexName) { client.admin().indices().prepareRefresh(indexName).execute().actionGet(); }
@Override public void refresh(String indexName) { client.admin().indices().prepareRefresh(indexName).get(); }
@Override public void commit() throws IOException { client.admin().indices().prepareRefresh(indexName).execute().actionGet(); }
/** * Refresh an index * * @param index * Index name */ private void refreshIndex(String index) { this.client.admin().indices().prepareRefresh(index).get(); }
@Override public void flush(Graph graph) { flushFlushObjectQueue(); client.admin().indices().prepareRefresh(getIndexNamesAsArray(graph)).execute().actionGet(); }
@Override public void flush(Graph graph) { flushFlushObjectQueue(); client.admin().indices().prepareRefresh(getIndexNamesAsArray(graph)).execute().actionGet(); }
@Override protected void onSchemaCacheRefreshed() { getElasticSearchClient().admin().indices().prepareRefresh(indexName).get(); detectSchema(); }
protected final void flush(final String index) { final IndicesAdminClient indices = elasticClient().admin().indices(); indices.prepareFlush(index).execute().actionGet(); indices.prepareRefresh(index).execute().actionGet(); } }
@Override public void loadGraphData(Graph graph, LoadGraphWith loadGraphWith, Class testClass, String testName) { super.loadGraphData(graph, loadGraphWith, testClass, testName); node.getClient().admin().indices().prepareRefresh().get(); }
@Override protected void onSchemaCacheRefreshed() { getElasticSearchClient().admin().indices().prepareRefresh(indexName).get(); detectSchema(); }
public void onExecuteUpdateFinished() { // force refresh of the index final ElasticSearchDataContext dataContext = getDataContext(); final Client client = dataContext.getElasticSearchClient(); final String indexName = dataContext.getIndexName(); client.admin().indices().prepareRefresh(indexName).execute().actionGet(); }
protected final void flush(final String index) { final IndicesAdminClient indices = elasticClient().admin().indices(); indices.prepareFlush(index).execute().actionGet(); indices.prepareRefresh(index).execute().actionGet(); } }
public void onExecuteUpdateFinished() { // force refresh of the index final ElasticSearchDataContext dataContext = getDataContext(); final Client client = dataContext.getElasticSearchClient(); final String indexName = dataContext.getIndexName(); client.admin().indices().prepareRefresh(indexName).execute().actionGet(); }
private void refreshIndexes() { for (String indexName : this.affectedIndexes) { if (config.getRefresh()) { LOGGER.debug("Refreshing ElasticSearch index: {}", indexName); this.manager.client() .admin() .indices() .prepareRefresh(indexName) .execute() .actionGet(); } } }
/** * Waits for relocations and refreshes all indices in the cluster. * * @see #waitForRelocation() */ protected final RefreshResponse refresh(String... indices) { waitForRelocation(); // TODO RANDOMIZE with flush? RefreshResponse actionGet = client().admin().indices().prepareRefresh(indices).execute().actionGet(); assertNoFailures(actionGet); return actionGet; }
void initNestedIndexAndPercolation(Client client) throws IOException, ExecutionException, InterruptedException { XContentBuilder mapping = XContentFactory.jsonBuilder(); mapping.startObject().startObject("properties").startObject("companyname").field("type", "string").endObject() .startObject("employee").field("type", "nested").startObject("properties") .startObject("name").field("type", "string").endObject().endObject().endObject().endObject() .endObject(); client.admin().indices().prepareCreate("nestedindex").addMapping("company", mapping).execute().actionGet(); waitForYellowStatus(client); client.prepareIndex("nestedindex", BatchPercolatorService.TYPE_NAME, "Q").setSource(jsonBuilder().startObject() .field("query", QueryBuilders.nestedQuery("employee", QueryBuilders.matchQuery("employee.name", "virginia potts").operator(MatchQueryBuilder.Operator.AND)).scoreMode("avg")).endObject()).get(); client.admin().indices().prepareRefresh().execute().actionGet(); }