Search in sources :

Example 41 with GetResponse

use of org.graylog.shaded.elasticsearch7.org.elasticsearch.action.get.GetResponse in project incubator-skywalking by apache.

the class AbstractPersistenceEsDAO method get.

@Override
public final STREAM_DATA get(String id) {
    GetResponse getResponse = getClient().prepareGet(tableName(), id).get();
    if (getResponse.isExists()) {
        STREAM_DATA streamData = esDataToStreamData(getResponse.getSource());
        streamData.setId(id);
        return streamData;
    } else {
        return null;
    }
}
Also used : GetResponse(org.elasticsearch.action.get.GetResponse)

Example 42 with GetResponse

use of org.graylog.shaded.elasticsearch7.org.elasticsearch.action.get.GetResponse in project incubator-skywalking by apache.

the class InstanceReferenceAlarmListEsPersistenceDAO method get.

@Override
public InstanceReferenceAlarmList get(String id) {
    GetResponse getResponse = getClient().prepareGet(InstanceReferenceAlarmListTable.TABLE, id).get();
    if (getResponse.isExists()) {
        InstanceReferenceAlarmList serviceReferenceAlarmList = new InstanceReferenceAlarmList();
        serviceReferenceAlarmList.setId(id);
        Map<String, Object> source = getResponse.getSource();
        serviceReferenceAlarmList.setFrontApplicationId(((Number) source.get(InstanceReferenceAlarmListTable.COLUMN_FRONT_APPLICATION_ID)).intValue());
        serviceReferenceAlarmList.setBehindApplicationId(((Number) source.get(InstanceReferenceAlarmListTable.COLUMN_BEHIND_APPLICATION_ID)).intValue());
        serviceReferenceAlarmList.setFrontInstanceId(((Number) source.get(InstanceReferenceAlarmListTable.COLUMN_FRONT_INSTANCE_ID)).intValue());
        serviceReferenceAlarmList.setBehindInstanceId(((Number) source.get(InstanceReferenceAlarmListTable.COLUMN_BEHIND_INSTANCE_ID)).intValue());
        serviceReferenceAlarmList.setSourceValue(((Number) source.get(InstanceReferenceAlarmListTable.COLUMN_SOURCE_VALUE)).intValue());
        serviceReferenceAlarmList.setAlarmType(((Number) source.get(InstanceReferenceAlarmListTable.COLUMN_ALARM_TYPE)).intValue());
        serviceReferenceAlarmList.setAlarmContent((String) source.get(InstanceReferenceAlarmListTable.COLUMN_ALARM_CONTENT));
        serviceReferenceAlarmList.setTimeBucket(((Number) source.get(InstanceReferenceAlarmListTable.COLUMN_TIME_BUCKET)).longValue());
        return serviceReferenceAlarmList;
    } else {
        return null;
    }
}
Also used : InstanceReferenceAlarmList(org.apache.skywalking.apm.collector.storage.table.alarm.InstanceReferenceAlarmList) GetResponse(org.elasticsearch.action.get.GetResponse)

Example 43 with GetResponse

use of org.graylog.shaded.elasticsearch7.org.elasticsearch.action.get.GetResponse in project incubator-skywalking by apache.

the class ServiceAlarmListEsPersistenceDAO method get.

@Override
public ServiceAlarmList get(String id) {
    GetResponse getResponse = getClient().prepareGet(ServiceAlarmListTable.TABLE, id).get();
    if (getResponse.isExists()) {
        ServiceAlarmList serviceAlarmList = new ServiceAlarmList();
        serviceAlarmList.setId(id);
        Map<String, Object> source = getResponse.getSource();
        serviceAlarmList.setApplicationId(((Number) source.get(ServiceAlarmListTable.COLUMN_APPLICATION_ID)).intValue());
        serviceAlarmList.setInstanceId(((Number) source.get(ServiceAlarmListTable.COLUMN_INSTANCE_ID)).intValue());
        serviceAlarmList.setServiceId(((Number) source.get(ServiceAlarmListTable.COLUMN_SERVICE_ID)).intValue());
        serviceAlarmList.setSourceValue(((Number) source.get(ServiceAlarmListTable.COLUMN_SOURCE_VALUE)).intValue());
        serviceAlarmList.setAlarmType(((Number) source.get(ServiceAlarmListTable.COLUMN_ALARM_TYPE)).intValue());
        serviceAlarmList.setAlarmContent((String) source.get(ServiceAlarmListTable.COLUMN_ALARM_CONTENT));
        serviceAlarmList.setTimeBucket(((Number) source.get(ServiceAlarmListTable.COLUMN_TIME_BUCKET)).longValue());
        return serviceAlarmList;
    } else {
        return null;
    }
}
Also used : GetResponse(org.elasticsearch.action.get.GetResponse) ServiceAlarmList(org.apache.skywalking.apm.collector.storage.table.alarm.ServiceAlarmList)

Example 44 with GetResponse

use of org.graylog.shaded.elasticsearch7.org.elasticsearch.action.get.GetResponse in project incubator-skywalking by apache.

the class ApplicationEsCacheDAO method getApplication.

@Override
public Application getApplication(int applicationId) {
    logger.debug("get application code, applicationId: {}", applicationId);
    ElasticSearchClient client = getClient();
    GetRequestBuilder getRequestBuilder = client.prepareGet(ApplicationTable.TABLE, String.valueOf(applicationId));
    GetResponse getResponse = getRequestBuilder.get();
    if (getResponse.isExists()) {
        Application application = new Application();
        application.setApplicationId(applicationId);
        application.setApplicationCode((String) getResponse.getSource().get(ApplicationTable.COLUMN_APPLICATION_CODE));
        application.setIsAddress(((Number) getResponse.getSource().get(ApplicationTable.COLUMN_IS_ADDRESS)).intValue());
        return application;
    }
    return null;
}
Also used : ElasticSearchClient(org.apache.skywalking.apm.collector.client.elasticsearch.ElasticSearchClient) GetResponse(org.elasticsearch.action.get.GetResponse) Application(org.apache.skywalking.apm.collector.storage.table.register.Application) GetRequestBuilder(org.elasticsearch.action.get.GetRequestBuilder)

Example 45 with GetResponse

use of org.graylog.shaded.elasticsearch7.org.elasticsearch.action.get.GetResponse in project incubator-skywalking by apache.

the class NetworkAddressEsCacheDAO method getAddressById.

@Override
public String getAddressById(int addressId) {
    logger.debug("get network address, address id: {}", addressId);
    ElasticSearchClient client = getClient();
    GetRequestBuilder getRequestBuilder = client.prepareGet(NetworkAddressTable.TABLE, String.valueOf(addressId));
    GetResponse getResponse = getRequestBuilder.get();
    if (getResponse.isExists()) {
        return (String) getResponse.getSource().get(NetworkAddressTable.COLUMN_NETWORK_ADDRESS);
    }
    return Const.EMPTY_STRING;
}
Also used : ElasticSearchClient(org.apache.skywalking.apm.collector.client.elasticsearch.ElasticSearchClient) GetResponse(org.elasticsearch.action.get.GetResponse) GetRequestBuilder(org.elasticsearch.action.get.GetRequestBuilder)

Aggregations

GetResponse (org.elasticsearch.action.get.GetResponse)149 Test (org.junit.Test)41 Map (java.util.Map)27 MultiGetResponse (org.elasticsearch.action.get.MultiGetResponse)25 ArrayList (java.util.ArrayList)22 HashMap (java.util.HashMap)18 ESSyncConfig (com.alibaba.otter.canal.client.adapter.es.core.config.ESSyncConfig)17 Dml (com.alibaba.otter.canal.client.adapter.support.Dml)17 Date (java.util.Date)17 LinkedHashMap (java.util.LinkedHashMap)17 DataSource (javax.sql.DataSource)14 GetRequestBuilder (org.elasticsearch.action.get.GetRequestBuilder)14 SearchResponse (org.elasticsearch.action.search.SearchResponse)13 DeleteResponse (org.elasticsearch.action.delete.DeleteResponse)12 IOException (java.io.IOException)11 GetRequest (org.elasticsearch.action.get.GetRequest)11 ElasticsearchException (org.elasticsearch.ElasticsearchException)9 Settings (org.elasticsearch.common.settings.Settings)9 Alias (org.elasticsearch.action.admin.indices.alias.Alias)7 UpdateResponse (org.elasticsearch.action.update.UpdateResponse)7