Search in sources :

Example 11 with FlushRequest

use of org.elasticsearch.action.admin.indices.flush.FlushRequest in project zipkin by openzipkin.

the class ElasticsearchDependenciesTest method writeDependencyLinks.

protected void writeDependencyLinks(List<DependencyLink> links, long timestampMillis) {
    long midnight = Util.midnightUTC(timestampMillis);
    TransportClient client = ((NativeClient) storage().client()).client;
    BulkRequestBuilder request = client.prepareBulk();
    for (DependencyLink link : links) {
        request.add(client.prepareIndex(storage().indexNameFormatter.indexNameForTimestamp(midnight), ElasticsearchConstants.DEPENDENCY_LINK).setId(// Unique constraint
        link.parent + "|" + link.child).setSource("parent", link.parent, "child", link.child, "callCount", link.callCount));
    }
    request.execute().actionGet();
    client.admin().indices().flush(new FlushRequest()).actionGet();
}
Also used : TransportClient(org.elasticsearch.client.transport.TransportClient) FlushRequest(org.elasticsearch.action.admin.indices.flush.FlushRequest) BulkRequestBuilder(org.elasticsearch.action.bulk.BulkRequestBuilder) DependencyLink(zipkin.DependencyLink)

Example 12 with FlushRequest

use of org.elasticsearch.action.admin.indices.flush.FlushRequest in project graylog2-server by Graylog2.

the class Indices method flush.

public void flush(String index) {
    FlushRequest flush = new FlushRequest(index);
    // Just flushes. Even if it is not necessary.
    flush.force(true);
    c.admin().indices().flush(new FlushRequest(index).force(true)).actionGet();
}
Also used : FlushRequest(org.elasticsearch.action.admin.indices.flush.FlushRequest)

Aggregations

FlushRequest (org.elasticsearch.action.admin.indices.flush.FlushRequest)12 Engine (org.elasticsearch.index.engine.Engine)4 IndexShard (org.elasticsearch.index.shard.IndexShard)4 IOException (java.io.IOException)2 FlushResponse (org.elasticsearch.action.admin.indices.flush.FlushResponse)2 BytesArray (org.elasticsearch.common.bytes.BytesArray)2 Settings (org.elasticsearch.common.settings.Settings)2 FileNotFoundException (java.io.FileNotFoundException)1 ClosedByInterruptException (java.nio.channels.ClosedByInterruptException)1 NoSuchFileException (java.nio.file.NoSuchFileException)1 Date (java.util.Date)1 TimeoutException (java.util.concurrent.TimeoutException)1 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)1 CorruptIndexException (org.apache.lucene.index.CorruptIndexException)1 DirectoryReader (org.apache.lucene.index.DirectoryReader)1 IndexFormatTooNewException (org.apache.lucene.index.IndexFormatTooNewException)1 IndexFormatTooOldException (org.apache.lucene.index.IndexFormatTooOldException)1 Term (org.apache.lucene.index.Term)1 IndexSearcher (org.apache.lucene.search.IndexSearcher)1 AlreadyClosedException (org.apache.lucene.store.AlreadyClosedException)1