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


Java GetResponse.getType方法代码示例

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


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

示例1: getIndex

import org.elasticsearch.action.get.GetResponse; //导入方法依赖的package包/类
/**
 * 获取索引信息
 * @param index
 * @param type
 * @param id
 */
private static void getIndex(String index, String type, String id){
	Client client = createTransportClient();
	GetResponse response = client.prepareGet(index, type, id)
	        .execute()
	        .actionGet();
	boolean exists = response.isExists();
	System.out.println(exists);// 判断索引是否存在
	String sourceString = response.getSourceAsString();
	System.out.println(sourceString);// 获取索引,并且打印出索引内容
	System.out.println("****************index ***********************");
	// Index name
	String _index = response.getIndex();
	// Type name
	String _type = response.getType();
	// Document ID (generated or not)
	String _id = response.getId();
	// Version (if it's the first time you index this document, you will get: 1)
	long _version = response.getVersion();
	System.out.println(_index+","+_type+","+_id+","+_version);
}
 
开发者ID:ameizi,项目名称:elasticsearch-jest-example,代码行数:27,代码来源:TransportClient.java

示例2: onFoundGetResponse

import org.elasticsearch.action.get.GetResponse; //导入方法依赖的package包/类
void onFoundGetResponse(GetResponse response) {
	String type = response.getType();
	if (declared_entries_type.containsKey(type) == false) {
		if (unknow_types.contains(type) == false) {
			unknow_types.add(type);
		}
		return;
	}
	
	ContainerEntry element = MyDMAM.gson_kit.getGson().fromJson(response.getSourceAsString(), declared_entries_type.get(type));
	if (element instanceof EntryRenderer) {
		((EntryRenderer) element).setESType(type);
	}
	
	result.add(response.getId(), element);
}
 
开发者ID:hdsdi3g,项目名称:MyDMAM,代码行数:17,代码来源:ContainerOperations.java

示例3: getById

import org.elasticsearch.action.get.GetResponse; //导入方法依赖的package包/类
@RequestMapping(apiTemplate + "getDocument/{index}/{type}/{id}")
public Document getById(@PathVariable(value="index") String index, 
		@PathVariable(value="type") String type,
		@PathVariable(value="id") String id) {
	GetResponse response = client.prepareGet(index, type, id).get();
	return new Document(response.getId(), response.getIndex(), response.getType(), response.getSource());
}
 
开发者ID:gov-ithub,项目名称:romanescU-spring-api,代码行数:8,代码来源:ElasticsearchController.java

示例4: getType

import org.elasticsearch.action.get.GetResponse; //导入方法依赖的package包/类
/**
 * Get the type name of a document or null if the document does not exist.
 * This is a replacement of the exist() method which does exactly the same as exist()
 * but is able to return the type name in case that exist is successful.
 * Please read the comment to exist() for details.
 * @param indexName
 *            the name of the index
 * @param id
 *            the unique identifier of a document
 * @return the type name of the document if it exists, null otherwise
 */
public String getType(String indexName, final String id) {
    GetResponse getResponse = elasticsearchClient.prepareGet(indexName, null, id).execute().actionGet();
    return getResponse.isExists() ? getResponse.getType() : null;
}
 
开发者ID:yacy,项目名称:yacy_grid_mcp,代码行数:16,代码来源:ElasticsearchClient.java


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