Flush Elasticsearch testcase data loading to resolve data inconsistency issue
@@ -40,6 +40,7 @@ import static com.facebook.presto.spi.type.IntegerType.INTEGER;
import static com.facebook.presto.spi.type.Varchars.isVarcharType;
import static com.google.common.base.Preconditions.checkState;
import static java.util.Objects.requireNonNull;
+import static org.elasticsearch.client.Requests.flushRequest;
import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder;
import static org.elasticsearch.common.xcontent.XContentType.JSON;
@@ -107,6 +108,7 @@ public class ElasticsearchLoader
throw new UncheckedIOException("Error loading data into Elasticsearch index: " + tableName, e);
}
}
+ client.admin().indices().flush(flushRequest(tableName)).actionGet();
}
@Override
