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


Java TypesExistsRequest类代码示例

本文整理汇总了Java中org.elasticsearch.action.admin.indices.exists.types.TypesExistsRequest的典型用法代码示例。如果您正苦于以下问题:Java TypesExistsRequest类的具体用法?Java TypesExistsRequest怎么用?Java TypesExistsRequest使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


TypesExistsRequest类属于org.elasticsearch.action.admin.indices.exists.types包,在下文中一共展示了TypesExistsRequest类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: prepareRequest

import org.elasticsearch.action.admin.indices.exists.types.TypesExistsRequest; //导入依赖的package包/类
@Override
public RestChannelConsumer prepareRequest(final RestRequest request, final NodeClient client) throws IOException {
    TypesExistsRequest typesExistsRequest = new TypesExistsRequest(
            Strings.splitStringByCommaToArray(request.param("index")), Strings.splitStringByCommaToArray(request.param("type"))
    );
    typesExistsRequest.local(request.paramAsBoolean("local", typesExistsRequest.local()));
    typesExistsRequest.indicesOptions(IndicesOptions.fromRequest(request, typesExistsRequest.indicesOptions()));
    return channel -> client.admin().indices().typesExists(typesExistsRequest, new RestResponseListener<TypesExistsResponse>(channel) {
        @Override
        public RestResponse buildResponse(TypesExistsResponse response) throws Exception {
            if (response.isExists()) {
                return new BytesRestResponse(OK, BytesRestResponse.TEXT_CONTENT_TYPE, BytesArray.EMPTY);
            } else {
                return new BytesRestResponse(NOT_FOUND, BytesRestResponse.TEXT_CONTENT_TYPE, BytesArray.EMPTY);
            }
        }
    });
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:19,代码来源:RestTypesExistsAction.java

示例2: handleRequest

import org.elasticsearch.action.admin.indices.exists.types.TypesExistsRequest; //导入依赖的package包/类
@Override
public void handleRequest(final RestRequest request, final RestChannel channel, final Client client) {
    TypesExistsRequest typesExistsRequest = new TypesExistsRequest(
            Strings.splitStringByCommaToArray(request.param("index")), Strings.splitStringByCommaToArray(request.param("type"))
    );
    typesExistsRequest.local(request.paramAsBoolean("local", typesExistsRequest.local()));
    typesExistsRequest.indicesOptions(IndicesOptions.fromRequest(request, typesExistsRequest.indicesOptions()));
    client.admin().indices().typesExists(typesExistsRequest, new RestResponseListener<TypesExistsResponse>(channel) {
        @Override
        public RestResponse buildResponse(TypesExistsResponse response) throws Exception {
            if (response.isExists()) {
                return new BytesRestResponse(OK);
            } else {
                return new BytesRestResponse(NOT_FOUND);
            }
        }
    });
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:19,代码来源:RestTypesExistsAction.java

示例3: existType

import org.elasticsearch.action.admin.indices.exists.types.TypesExistsRequest; //导入依赖的package包/类
/**
 * existType
 * 
 * @param index
 * @param type
 * @return
 */
public boolean existType(String index, String type) {

    TypesExistsRequest request = new TypesExistsRequest(new String[] { index }, type);

    TypesExistsResponse resp = client.admin().indices().typesExists(request).actionGet();

    if (resp.isExists()) {
        return true;
    }
    return false;
}
 
开发者ID:uavorg,项目名称:uavstack,代码行数:19,代码来源:ESClient.java

示例4: initIndex

import org.elasticsearch.action.admin.indices.exists.types.TypesExistsRequest; //导入依赖的package包/类
/**
 * 初始化索引
 *
 * @throws Exception
 */
private static void initIndex() throws Exception {
    String indice = esprop.getIndice();
    IndicesAdminClient c = client.admin().indices();
    //创建一个空的
    boolean a = c.prepareExists(indice).get().isExists();
    LOGGER.info("index {} isExists  {}",indice, a);
    if (!c.prepareExists(indice).get().isExists()) {
        CreateIndexResponse createIndexResponse =c.prepareCreate(indice).get();
        LOGGER.info("create index {}", createIndexResponse);
    }
    for (IndexType type : IndexType.values()) {
        TypesExistsResponse typesExistsResponse = c.typesExists(new TypesExistsRequest(new String[]{indice}, type.getDataName())).get();
        if (typesExistsResponse.isExists()) {
            continue;
        }
        String esMapper = type.getMapper();
        InputStream in = EsClientManager.class.getResourceAsStream(esMapper);
        String mappingStr = IOUtils.toString(in).trim();
        IOUtils.closeQuietly(in);
        c.preparePutMapping(indice).setType(type.getDataName()).setSource(mappingStr).get();
    }
}
 
开发者ID:wxz1211,项目名称:dooo,代码行数:28,代码来源:EsClientManager.java

示例5: isTypeExist

import org.elasticsearch.action.admin.indices.exists.types.TypesExistsRequest; //导入依赖的package包/类
/**
 * check whether type "type" under index "index" is exist
 * must ensure "index" exists!
 * @param index
 * @param type
 * @return
 */
public boolean isTypeExist(String index, String type) {
	TypesExistsResponse response = client
			.admin()
			.indices()
			.typesExists(new TypesExistsRequest(new String[]{index}, type))
			.actionGet();
	return response.isExists();
}
 
开发者ID:knshen,项目名称:JSearcher,代码行数:16,代码来源:IndexController.java

示例6: typeExists

import org.elasticsearch.action.admin.indices.exists.types.TypesExistsRequest; //导入依赖的package包/类
/**
 * Checks if a given data type exists. It is a given that the index exists
 * <p/>
 * @param client
 * @param typeName
 * @return
 */
private boolean typeExists(Client client, String indexName, String typeName) {
  AdminClient admin = client.admin();
  IndicesAdminClient indices = admin.indices();

  ActionFuture<TypesExistsResponse> action = indices.typesExists(
      new TypesExistsRequest(
          new String[]{indexName}, typeName));

  TypesExistsResponse response = action.actionGet();

  return response.isExists();
}
 
开发者ID:hopshadoop,项目名称:hopsworks,代码行数:20,代码来源:ElasticController.java

示例7: mappingExists

import org.elasticsearch.action.admin.indices.exists.types.TypesExistsRequest; //导入依赖的package包/类
public boolean mappingExists(String indexName, String typeName) {
    boolean result = false;
    try {
        String[] indices = new String[]{indexName};
        TypesExistsResponse exists = client.admin().indices().typesExists(new TypesExistsRequest(indices, typeName)).actionGet();
        result = exists.isExists();
    } catch (Exception e) {
        log.error("Error checking type exists");
    }
    return result;
}
 
开发者ID:scaleset,项目名称:scaleset-search,代码行数:12,代码来源:ElasticSearchDao.java

示例8: toXContent

import org.elasticsearch.action.admin.indices.exists.types.TypesExistsRequest; //导入依赖的package包/类
@Override
protected XContentBuilder toXContent(TypesExistsRequest request, TypesExistsResponse response, XContentBuilder builder) throws IOException {
    builder.startObject();
    builder.field(Fields.OK, response.isExists());
    builder.endObject();
    return builder;
}
 
开发者ID:javanna,项目名称:elasticshell,代码行数:8,代码来源:TypesExistsRequestBuilder.java

示例9: typesExists

import org.elasticsearch.action.admin.indices.exists.types.TypesExistsRequest; //导入依赖的package包/类
@Override
public ActionFuture<TypesExistsResponse> typesExists(TypesExistsRequest request) {
    return execute(TypesExistsAction.INSTANCE, request);
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:5,代码来源:AbstractClient.java

示例10: isExistsIndexAndType

import org.elasticsearch.action.admin.indices.exists.types.TypesExistsRequest; //导入依赖的package包/类
public static boolean isExistsIndexAndType(String indexName,String indexType){
    TypesExistsResponse  response = ESUtils.getClientInstance().admin().indices()
            .typesExists(new TypesExistsRequest(new String[]{indexName}, indexType)).actionGet();
    return response.isExists();
}
 
开发者ID:clw87,项目名称:fileadmin,代码行数:6,代码来源:ESIndexBuilder.java

示例11: TypesExistsRequestBuilder

import org.elasticsearch.action.admin.indices.exists.types.TypesExistsRequest; //导入依赖的package包/类
public TypesExistsRequestBuilder(Client client, JsonToString<JsonInput> jsonToString, StringToJson<JsonOutput> stringToJson) {
    super(client, new TypesExistsRequest(new String[0]), jsonToString, stringToJson);
}
 
开发者ID:javanna,项目名称:elasticshell,代码行数:4,代码来源:TypesExistsRequestBuilder.java

示例12: doExecute

import org.elasticsearch.action.admin.indices.exists.types.TypesExistsRequest; //导入依赖的package包/类
@Override
protected ActionFuture<TypesExistsResponse> doExecute(TypesExistsRequest request) {
    return client.admin().indices().typesExists(request);
}
 
开发者ID:javanna,项目名称:elasticshell,代码行数:5,代码来源:TypesExistsRequestBuilder.java

示例13: typesExists

import org.elasticsearch.action.admin.indices.exists.types.TypesExistsRequest; //导入依赖的package包/类
/**
 * Types Exists.
 *
 * @param request The types exists request
 * @return The result future
 */
ActionFuture<TypesExistsResponse> typesExists(TypesExistsRequest request);
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:8,代码来源:IndicesAdminClient.java

示例14: isExistsType

import org.elasticsearch.action.admin.indices.exists.types.TypesExistsRequest; //导入依赖的package包/类
/**
 * 判断指定的索引的类型是否存在
 * 
 * @param indexName
 *            索引名
 * @param indexType
 *            索引类型
 * @return 存在:true; 不存在:false;
 */
public boolean isExistsType(String indexName, String indexType) {
	TypesExistsResponse response = client .admin().indices()
			.typesExists(new TypesExistsRequest(new String[] { indexName }, indexType)).actionGet();
	return response.isExists();
}
 
开发者ID:O2O-Market,项目名称:Market-monitor,代码行数:15,代码来源:ElasticsearchStorage.java


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