当前位置: 首页>>代码示例>>Java>>正文


Java GetRequestBuilder.get方法代码示例

本文整理汇总了Java中org.elasticsearch.action.get.GetRequestBuilder.get方法的典型用法代码示例。如果您正苦于以下问题:Java GetRequestBuilder.get方法的具体用法?Java GetRequestBuilder.get怎么用?Java GetRequestBuilder.get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.elasticsearch.action.get.GetRequestBuilder的用法示例。


在下文中一共展示了GetRequestBuilder.get方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getInstance

import org.elasticsearch.action.get.GetRequestBuilder; //导入方法依赖的package包/类
@Override public Instance getInstance(int instanceId) {
    logger.debug("get instance info, instance id: {}", instanceId);
    GetRequestBuilder requestBuilder = getClient().prepareGet(InstanceTable.TABLE, String.valueOf(instanceId));
    GetResponse getResponse = requestBuilder.get();
    if (getResponse.isExists()) {
        Instance instance = new Instance();
        instance.setId(getResponse.getId());
        instance.setApplicationId(((Number)getResponse.getSource().get(InstanceTable.COLUMN_APPLICATION_ID)).intValue());
        instance.setAgentUUID((String)getResponse.getSource().get(InstanceTable.COLUMN_AGENT_UUID));
        instance.setRegisterTime(((Number)getResponse.getSource().get(InstanceTable.COLUMN_REGISTER_TIME)).longValue());
        instance.setHeartBeatTime(((Number)getResponse.getSource().get(InstanceTable.COLUMN_HEARTBEAT_TIME)).longValue());
        instance.setOsInfo((String)getResponse.getSource().get(InstanceTable.COLUMN_OS_INFO));
        return instance;
    }
    return null;
}
 
开发者ID:apache,项目名称:incubator-skywalking,代码行数:17,代码来源:InstanceEsUIDAO.java

示例2: getById

import org.elasticsearch.action.get.GetRequestBuilder; //导入方法依赖的package包/类
@Override
public <T> T getById(Class<T> clazz, String id, @Nullable String routing) {
    String typeName = MappingProcessor.getIndexTypeName(clazz);
    if (logger.isDebugEnabled()) {
        logger.debug("Get object by id, class: {}, type: {}, id: {}, routing: {}", clazz.getSimpleName(), typeName, id, routing);
    }
    GetRequestBuilder getRequest = client.prepareGet(getIndexName(), typeName, id);
    if (routing != null) {
        getRequest.setRouting(routing);
    }
    GetResponse response = getRequest.get();
    if (!response.isExists()) {
        return null;
    }
    return objectProcessor.fromJsonString(response.getSourceAsString(), clazz);
}
 
开发者ID:kzwang,项目名称:elasticsearch-osem,代码行数:17,代码来源:ElasticSearchSearcherImpl.java

示例3: getDocument

import org.elasticsearch.action.get.GetRequestBuilder; //导入方法依赖的package包/类
private GetResponse getDocument(String index, String type, String docId, String field, @Nullable String routing) {
    GetRequestBuilder getRequestBuilder = client().prepareGet().setIndex(index).setType(type).setId(docId).setStoredFields(field);
    if (routing != null) {
        getRequestBuilder.setRouting(routing);
    }
    return getRequestBuilder.get();
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:8,代码来源:GetActionIT.java

示例4: documentExists

import org.elasticsearch.action.get.GetRequestBuilder; //导入方法依赖的package包/类
public boolean documentExists(final String index, final String type, final String id) {
    LOGGER.trace("Checking for existence of document: '{}/{}/{}'", index, type, id);
    GetRequestBuilder builder = client.prepareGet()
        .setIndex(index)
        .setType(type)
        .setId(id)
        .setFields(new String[] {});
    addCommonHeaders(builder);
    GetResponse response = builder.get();
    final boolean exists = response.isExists();
    LOGGER.trace("Document '{}/{}/{}' exists? {}", index, type, id, exists);
    return exists;
}
 
开发者ID:fabric8io,项目名称:openshift-elasticsearch-plugin,代码行数:14,代码来源:PluginClient.java

示例5: getAddress

import org.elasticsearch.action.get.GetRequestBuilder; //导入方法依赖的package包/类
@Override public String getAddress(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;
}
 
开发者ID:apache,项目名称:incubator-skywalking,代码行数:12,代码来源:NetworkAddressEsCacheDAO.java

示例6: getServiceName

import org.elasticsearch.action.get.GetRequestBuilder; //导入方法依赖的package包/类
@Override public String getServiceName(int serviceId) {
    GetRequestBuilder getRequestBuilder = getClient().prepareGet(ServiceNameTable.TABLE, String.valueOf(serviceId));

    GetResponse getResponse = getRequestBuilder.get();
    if (getResponse.isExists()) {
        String serviceName = (String)getResponse.getSource().get(ServiceNameTable.COLUMN_SERVICE_NAME);
        int applicationId = ((Number)getResponse.getSource().get(ServiceNameTable.COLUMN_APPLICATION_ID)).intValue();
        return applicationId + Const.ID_SPLIT + serviceName;
    }
    return Const.EMPTY_STRING;
}
 
开发者ID:apache,项目名称:incubator-skywalking,代码行数:12,代码来源:ServiceNameEsCacheDAO.java

示例7: getApplicationCode

import org.elasticsearch.action.get.GetRequestBuilder; //导入方法依赖的package包/类
@Override public String getApplicationCode(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()) {
        return (String)getResponse.getSource().get(ApplicationTable.COLUMN_APPLICATION_CODE);
    }
    return Const.EMPTY_STRING;
}
 
开发者ID:apache,项目名称:incubator-skywalking,代码行数:12,代码来源:ApplicationEsCacheDAO.java


注:本文中的org.elasticsearch.action.get.GetRequestBuilder.get方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。