本文整理了Java中org.elasticsearch.client.IndicesAdminClient.prepareRefresh()
方法的一些代码示例,展示了IndicesAdminClient.prepareRefresh()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。IndicesAdminClient.prepareRefresh()
方法的具体详情如下:
包路径:org.elasticsearch.client.IndicesAdminClient
类名称:IndicesAdminClient
方法名:prepareRefresh
[英]Explicitly refresh one or more indices (making the content indexed since the last refresh searchable).
[中]显式刷新一个或多个索引(使自上次刷新以来的内容索引可搜索)。
代码示例来源:origin: stagemonitor/stagemonitor
protected static void refresh() {
node.client().admin().indices().prepareRefresh().get();
}
}
代码示例来源:origin: apache/usergrid
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);
}
代码示例来源:origin: richardwilly98/elasticsearch-river-mongodb
/**
* 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;
}
代码示例来源:origin: richardwilly98/elasticsearch-river-mongodb
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();
代码示例来源:origin: searchisko/elasticsearch-river-jira
@Override
public void refreshSearchIndex(String indexName) {
client.admin().indices().prepareRefresh(indexName).execute().actionGet();
}
代码示例来源:origin: org.nuxeo.elasticsearch/nuxeo-elasticsearch-core
@Override
public void refresh(String indexName) {
client.admin().indices().prepareRefresh(indexName).get();
}
代码示例来源:origin: org.eclipse.rdf4j/rdf4j-sail-elasticsearch
@Override
public void commit()
throws IOException
{
client.admin().indices().prepareRefresh(indexName).execute().actionGet();
}
代码示例来源:origin: ConsenSys/IPFS-Store
/**
* Refresh an index
*
* @param index
* Index name
*/
private void refreshIndex(String index) {
this.client.admin().indices().prepareRefresh(index).get();
}
代码示例来源:origin: org.vertexium/vertexium-elasticsearch-singledocument
@Override
public void flush(Graph graph) {
flushFlushObjectQueue();
client.admin().indices().prepareRefresh(getIndexNamesAsArray(graph)).execute().actionGet();
}
代码示例来源:origin: org.vertexium/vertexium-elasticsearch2
@Override
public void flush(Graph graph) {
flushFlushObjectQueue();
client.admin().indices().prepareRefresh(getIndexNamesAsArray(graph)).execute().actionGet();
}
代码示例来源:origin: org.apache.metamodel/MetaModel-elasticsearch-native
@Override
protected void onSchemaCacheRefreshed() {
getElasticSearchClient().admin().indices().prepareRefresh(indexName).get();
detectSchema();
}
代码示例来源:origin: com.jeromeloisel/db-integration-test
protected final void flush(final String index) {
final IndicesAdminClient indices = elasticClient().admin().indices();
indices.prepareFlush(index).execute().actionGet();
indices.prepareRefresh(index).execute().actionGet();
}
}
代码示例来源:origin: unipop-graph/unipop
@Override
public void loadGraphData(Graph graph, LoadGraphWith loadGraphWith, Class testClass, String testName) {
super.loadGraphData(graph, loadGraphWith, testClass, testName);
node.getClient().admin().indices().prepareRefresh().get();
}
代码示例来源:origin: apache/metamodel
@Override
protected void onSchemaCacheRefreshed() {
getElasticSearchClient().admin().indices().prepareRefresh(indexName).get();
detectSchema();
}
代码示例来源:origin: org.apache.metamodel/MetaModel-elasticsearch-native
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();
}
代码示例来源:origin: jloisel/elastic-crud
protected final void flush(final String index) {
final IndicesAdminClient indices = elasticClient().admin().indices();
indices.prepareFlush(index).execute().actionGet();
indices.prepareRefresh(index).execute().actionGet();
}
}
代码示例来源:origin: apache/metamodel
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();
}
代码示例来源:origin: apache/streams
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();
}
}
}
代码示例来源:origin: com.strapdata.elasticsearch.test/framework
/**
* 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;
}
代码示例来源:origin: meltwater/elasticsearch-batch-percolator
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();
}
内容来源于网络,如有侵权,请联系作者删除!