Search in sources :

Example 16 with BulkByScrollResponse

use of org.graylog.shaded.elasticsearch7.org.elasticsearch.index.reindex.BulkByScrollResponse in project incubator-skywalking by apache.

the class InstanceAlarmEsPersistenceDAO method deleteHistory.

@Override
public void deleteHistory(Long startTimestamp, Long endTimestamp) {
    long startTimeBucket = TimeBucketUtils.INSTANCE.getMinuteTimeBucket(startTimestamp);
    long endTimeBucket = TimeBucketUtils.INSTANCE.getMinuteTimeBucket(endTimestamp);
    BulkByScrollResponse response = getClient().prepareDelete(QueryBuilders.rangeQuery(InstanceAlarmTable.COLUMN_LAST_TIME_BUCKET).gte(startTimeBucket).lte(endTimeBucket), InstanceAlarmTable.TABLE).get();
    long deleted = response.getDeleted();
    logger.info("Delete {} rows history from {} index.", deleted, InstanceAlarmTable.TABLE);
}
Also used : BulkByScrollResponse(org.elasticsearch.index.reindex.BulkByScrollResponse)

Example 17 with BulkByScrollResponse

use of org.graylog.shaded.elasticsearch7.org.elasticsearch.index.reindex.BulkByScrollResponse in project incubator-skywalking by apache.

the class InstanceReferenceAlarmEsPersistenceDAO method deleteHistory.

@Override
public void deleteHistory(Long startTimestamp, Long endTimestamp) {
    long startTimeBucket = TimeBucketUtils.INSTANCE.getMinuteTimeBucket(startTimestamp);
    long endTimeBucket = TimeBucketUtils.INSTANCE.getMinuteTimeBucket(endTimestamp);
    BulkByScrollResponse response = getClient().prepareDelete(QueryBuilders.rangeQuery(InstanceReferenceAlarmTable.COLUMN_LAST_TIME_BUCKET).gte(startTimeBucket).lte(endTimeBucket), InstanceReferenceAlarmTable.TABLE).get();
    long deleted = response.getDeleted();
    logger.info("Delete {} rows history from {} index.", deleted, InstanceReferenceAlarmTable.TABLE);
}
Also used : BulkByScrollResponse(org.elasticsearch.index.reindex.BulkByScrollResponse)

Example 18 with BulkByScrollResponse

use of org.graylog.shaded.elasticsearch7.org.elasticsearch.index.reindex.BulkByScrollResponse in project incubator-skywalking by apache.

the class ServiceReferenceAlarmEsPersistenceDAO method deleteHistory.

@Override
public void deleteHistory(Long startTimestamp, Long endTimestamp) {
    long startTimeBucket = TimeBucketUtils.INSTANCE.getMinuteTimeBucket(startTimestamp);
    long endTimeBucket = TimeBucketUtils.INSTANCE.getMinuteTimeBucket(endTimestamp);
    BulkByScrollResponse response = getClient().prepareDelete(QueryBuilders.rangeQuery(ServiceReferenceAlarmTable.COLUMN_LAST_TIME_BUCKET).gte(startTimeBucket).lte(endTimeBucket), ServiceReferenceAlarmTable.TABLE).get();
    long deleted = response.getDeleted();
    logger.info("Delete {} rows history from {} index.", deleted, ServiceReferenceAlarmTable.TABLE);
}
Also used : BulkByScrollResponse(org.elasticsearch.index.reindex.BulkByScrollResponse)

Example 19 with BulkByScrollResponse

use of org.graylog.shaded.elasticsearch7.org.elasticsearch.index.reindex.BulkByScrollResponse in project incubator-skywalking by apache.

the class ApplicationReferenceAlarmEsPersistenceDAO method deleteHistory.

@Override
public void deleteHistory(Long startTimestamp, Long endTimestamp) {
    long startTimeBucket = TimeBucketUtils.INSTANCE.getMinuteTimeBucket(startTimestamp);
    long endTimeBucket = TimeBucketUtils.INSTANCE.getMinuteTimeBucket(endTimestamp);
    BulkByScrollResponse response = getClient().prepareDelete(QueryBuilders.rangeQuery(ApplicationReferenceAlarmTable.COLUMN_LAST_TIME_BUCKET).gte(startTimeBucket).lte(endTimeBucket), ApplicationReferenceAlarmTable.TABLE).get();
    long deleted = response.getDeleted();
    logger.info("Delete {} rows history from {} index.", deleted, ApplicationReferenceAlarmTable.TABLE);
}
Also used : BulkByScrollResponse(org.elasticsearch.index.reindex.BulkByScrollResponse)

Example 20 with BulkByScrollResponse

use of org.graylog.shaded.elasticsearch7.org.elasticsearch.index.reindex.BulkByScrollResponse in project incubator-skywalking by apache.

the class InstanceReferenceAlarmListEsPersistenceDAO method deleteHistory.

@Override
public void deleteHistory(Long startTimestamp, Long endTimestamp) {
    long startTimeBucket = TimeBucketUtils.INSTANCE.getMinuteTimeBucket(startTimestamp);
    long endTimeBucket = TimeBucketUtils.INSTANCE.getMinuteTimeBucket(endTimestamp);
    BulkByScrollResponse response = getClient().prepareDelete(QueryBuilders.rangeQuery(InstanceReferenceAlarmListTable.COLUMN_TIME_BUCKET).gte(startTimeBucket).lte(endTimeBucket), InstanceReferenceAlarmListTable.TABLE).get();
    long deleted = response.getDeleted();
    logger.info("Delete {} rows history from {} index.", deleted, InstanceReferenceAlarmListTable.TABLE);
}
Also used : BulkByScrollResponse(org.elasticsearch.index.reindex.BulkByScrollResponse)

Aggregations

BulkByScrollResponse (org.elasticsearch.index.reindex.BulkByScrollResponse)29 QueryBuilder (org.elasticsearch.index.query.QueryBuilder)6 DeleteByQueryRequest (org.elasticsearch.index.reindex.DeleteByQueryRequest)6 TermQueryBuilder (org.elasticsearch.index.query.TermQueryBuilder)5 UpdateByQueryRequest (org.elasticsearch.index.reindex.UpdateByQueryRequest)5 TimeValue (org.elasticsearch.common.unit.TimeValue)4 IOException (java.io.IOException)3 ElasticsearchException (org.elasticsearch.ElasticsearchException)2 BoolQueryBuilder (org.elasticsearch.index.query.BoolQueryBuilder)2 DeleteByQueryRequestBuilder (org.elasticsearch.index.reindex.DeleteByQueryRequestBuilder)2 ReindexRequest (org.elasticsearch.index.reindex.ReindexRequest)2 EsQueryBuilder (com.b2international.index.es.query.EsQueryBuilder)1 SearchException (core.framework.search.SearchException)1 StopWatch (core.framework.util.StopWatch)1 VUserException (io.vertigo.lang.VUserException)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1 GoraException (org.apache.gora.util.GoraException)1 ActionResponse (org.elasticsearch.action.ActionResponse)1 DocWriteRequest (org.elasticsearch.action.DocWriteRequest)1