本文整理汇总了Java中org.elasticsearch.action.admin.indices.get.GetIndexRequestBuilder.setTypes方法的典型用法代码示例。如果您正苦于以下问题:Java GetIndexRequestBuilder.setTypes方法的具体用法?Java GetIndexRequestBuilder.setTypes怎么用?Java GetIndexRequestBuilder.setTypes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.elasticsearch.action.admin.indices.get.GetIndexRequestBuilder
的用法示例。
在下文中一共展示了GetIndexRequestBuilder.setTypes方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: explain
import org.elasticsearch.action.admin.indices.get.GetIndexRequestBuilder; //导入方法依赖的package包/类
@Override
public SqlElasticRequestBuilder explain() throws SqlParseException {
String sql = this.sql.replaceAll("\\s+"," ");
//todo: support indices with space?
String indexName = sql.split(" ")[1];
final GetIndexRequestBuilder indexRequestBuilder ;
String type = null;
if(indexName.contains("/")){
String[] indexAndType = indexName.split("\\/");
indexName = indexAndType[0];
type = indexAndType[1];
}
indexRequestBuilder = client.admin().indices().prepareGetIndex();
if(!indexName.equals("*")){
indexRequestBuilder.addIndices(indexName);
if(type!=null && !type.equals("")){
indexRequestBuilder.setTypes(type);
}
}
indexRequestBuilder.addFeatures(GetIndexRequest.Feature.MAPPINGS);
return new SqlElasticRequestBuilder() {
@Override
public ActionRequest request() {
return indexRequestBuilder.request();
}
@Override
public String explain() {
return indexRequestBuilder.toString();
}
@Override
public ActionResponse get() {
return indexRequestBuilder.get();
}
@Override
public ActionRequestBuilder getBuilder() {
return indexRequestBuilder;
}
};
}