org.elasticsearch.action.admin.indices.get.GetIndexRequestBuilder Java Examples

The following examples show how to use org.elasticsearch.action.admin.indices.get.GetIndexRequestBuilder. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: PluginClient.java    From openshift-elasticsearch-plugin with Apache License 2.0 5 votes vote down vote up
public GetIndexResponse getIndices(String... indices) throws InterruptedException, ExecutionException {
    return execute(new Callable<GetIndexResponse>() {

        @Override
        public GetIndexResponse call() throws Exception {
            if (LOGGER.isTraceEnabled()) {
                LOGGER.trace("Getting indices '{}'", StringUtils.join(indices, ", "));
            }
            GetIndexRequestBuilder builder = client.admin().indices().prepareGetIndex().setIndices(indices);
            return builder.get();
        }
        
    });
}
 
Example #2
Source File: AbstractClient.java    From Elasticsearch with Apache License 2.0 4 votes vote down vote up
@Override
public GetIndexRequestBuilder prepareGetIndex() {
    return new GetIndexRequestBuilder(this, GetIndexAction.INSTANCE);
}
 
Example #3
Source File: ShowQueryAction.java    From elasticsearch-sql with Apache License 2.0 4 votes vote down vote up
@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.startsWith("<")) {
        if (!indexName.endsWith(">")) {
            int index = indexName.lastIndexOf('/');
            if (-1 < index) {
                type = indexName.substring(index + 1);
                indexName = indexName.substring(0, index);
            }
        }
    } else 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;
        }
    };
}
 
Example #4
Source File: IndicesAdminClient.java    From Elasticsearch with Apache License 2.0 2 votes vote down vote up
/**
 * Get index metadata for particular indices.
 */
GetIndexRequestBuilder prepareGetIndex();