本文整理了Java中org.elasticsearch.client.IndicesAdminClient.prepareFlush()
方法的一些代码示例,展示了IndicesAdminClient.prepareFlush()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。IndicesAdminClient.prepareFlush()
方法的具体详情如下:
包路径:org.elasticsearch.client.IndicesAdminClient
类名称:IndicesAdminClient
方法名:prepareFlush
[英]Explicitly flush one or more indices (releasing memory from the node).
[中]显式刷新一个或多个索引(从节点释放内存)。
代码示例来源:origin: org.nuxeo.elasticsearch/nuxeo-elasticsearch-core
@Override
public void flush(String indexName) {
client.admin().indices().prepareFlush(indexName).get();
}
代码示例来源:origin: lumifyio/securegraph
@Override
public void flush() {
client.admin().indices().prepareFlush(getIndexNamesAsArray()).execute().actionGet();
}
代码示例来源:origin: org.neolumin.vertexium/vertexium-elasticsearch-base
@Override
public void flush() {
client.admin().indices().prepareFlush(getIndexNamesAsArray()).execute().actionGet();
}
代码示例来源: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: 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: org.securegraph/securegraph-elasticsearch-base
@Override
public void flush() {
client.admin().indices().prepareFlush(getIndexNamesAsArray()).execute().actionGet();
}
代码示例来源:origin: codelibs/elasticsearch-cluster-runner
public FlushResponse flush(
final BuilderCallback<FlushRequestBuilder> builder) {
waitForRelocation();
final FlushResponse actionGet = builder
.apply(client().admin().indices().prepareFlush()).execute()
.actionGet();
final ShardOperationFailedException[] shardFailures = actionGet
.getShardFailures();
if (shardFailures != null && shardFailures.length != 0) {
final StringBuilder buf = new StringBuilder(100);
for (final ShardOperationFailedException shardFailure : shardFailures) {
buf.append(shardFailure.toString()).append('\n');
}
onFailure(buf.toString(), actionGet);
}
return actionGet;
}
代码示例来源:origin: com.strapdata.elasticsearch.test/framework
/**
* Flush some or all indices in the cluster.
*/
protected final FlushResponse flush(String... indices) {
waitForRelocation();
FlushResponse actionGet = client().admin().indices().prepareFlush(indices).execute().actionGet();
for (ShardOperationFailedException failure : actionGet.getShardFailures()) {
assertThat("unexpected flush failure " + failure.reason(), failure.status(), equalTo(RestStatus.SERVICE_UNAVAILABLE));
}
return actionGet;
}
代码示例来源:origin: bleskes/elasticfacets
@Override
protected void loadData() throws Exception {
client.prepareIndex("test", "type1")
.setSource(
jsonBuilder().startObject().field("tag", "green")
.endObject()).execute().actionGet();
client.admin().indices().prepareFlush().setRefresh(true).execute()
.actionGet();
client.prepareIndex("test", "type1")
.setSource(
jsonBuilder().startObject().field("tag", "blue")
.endObject()).execute().actionGet();
client.admin().indices().prepareRefresh().execute().actionGet();
}
代码示例来源:origin: bleskes/elasticfacets
@Override
protected void loadData() throws Exception {
client.admin().indices().preparePutMapping("test").setType("type1").setSource("{\"type1\":{"+
" \"properties\" : { "+
" \"tag\" : {\"type\" : \"string\", \"analyzer\" : \"hsf_analyzer\"} "+
" } "+
"}}"
).execute().actionGet();
client.prepareIndex("test", "type1")
.setSource("{ \"tag\" : \"1s2s3\"}").execute().actionGet();
client.admin().indices().prepareFlush().setRefresh(true).execute()
.actionGet();
client.prepareIndex("test", "type1")
.setSource("{ \"tag\" : \"2s4\"}").execute().actionGet();
client.admin().indices().prepareRefresh().execute().actionGet();
}
代码示例来源:origin: bleskes/elasticfacets
@Override
protected void loadData() throws Exception {
client.prepareIndex("test", "type1")
.setSource(
jsonBuilder().startObject().field("tag", "week1").field("date","2012-07-03T10:00:00.000Z")
.endObject()).execute().actionGet();
client.admin().indices().prepareFlush().setRefresh(true).execute()
.actionGet();
documentCount++;
client.prepareIndex("test", "type1")
.setSource(
jsonBuilder().startObject().field("tag", "week2").field("date","2012-07-10T10:00:00.000Z")
.endObject()).execute().actionGet();
client.admin().indices().prepareRefresh().execute().actionGet();
documentCount++;
}
代码示例来源:origin: com.strapdata.elasticsearch.test/framework
/**
* Maybe refresh, force merge, or flush then always make sure there aren't too many in flight async operations.
*/
private void postIndexAsyncActions(String[] indices, List<CountDownLatch> inFlightAsyncOperations, boolean maybeFlush) throws InterruptedException {
if (rarely()) {
if (rarely()) {
client().admin().indices().prepareRefresh(indices).setIndicesOptions(IndicesOptions.lenientExpandOpen()).execute(
new LatchedActionListener<>(newLatch(inFlightAsyncOperations)));
} else if (maybeFlush && rarely()) {
if (randomBoolean()) {
client().admin().indices().prepareFlush(indices).setIndicesOptions(IndicesOptions.lenientExpandOpen()).execute(
new LatchedActionListener<>(newLatch(inFlightAsyncOperations)));
} else {
client().admin().indices().syncedFlush(syncedFlushRequest(indices).indicesOptions(IndicesOptions.lenientExpandOpen()),
new LatchedActionListener<>(newLatch(inFlightAsyncOperations)));
}
} else if (rarely()) {
client().admin().indices().prepareForceMerge(indices).setIndicesOptions(IndicesOptions.lenientExpandOpen()).setMaxNumSegments(between(1, 10)).setFlush(maybeFlush && randomBoolean()).execute(
new LatchedActionListener<>(newLatch(inFlightAsyncOperations)));
}
}
while (inFlightAsyncOperations.size() > MAX_IN_FLIGHT_ASYNC_INDEXES) {
int waitFor = between(0, inFlightAsyncOperations.size() - 1);
inFlightAsyncOperations.remove(waitFor).await();
}
}
内容来源于网络,如有侵权,请联系作者删除!