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


Java GetIndexRequestBuilder类代码示例

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


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

示例1: setup

import org.elasticsearch.action.admin.indices.get.GetIndexRequestBuilder; //导入依赖的package包/类
/**
 * @param indices The names of all indices that will exist.
 * @param mappings The index mappings.
 * @return An object to test.
 */
public ElasticsearchColumnMetadataDao setup(
        String[] indices,
        ImmutableOpenMap<String, ImmutableOpenMap<String, MappingMetaData>> mappings) {

  AdminClient adminClient = mock(AdminClient.class);
  IndicesAdminClient indicesAdminClient = mock(IndicesAdminClient.class);
  GetIndexRequestBuilder getIndexRequestBuilder = mock(GetIndexRequestBuilder.class);
  GetIndexResponse getIndexResponse = mock(GetIndexResponse.class);
  ActionFuture getMappingsActionFuture = mock(ActionFuture.class);
  GetMappingsResponse getMappingsResponse = mock(GetMappingsResponse.class);

  // setup the mocks so that a set of indices are available to the DAO
  when(adminClient.indices()).thenReturn(indicesAdminClient);
  when(indicesAdminClient.prepareGetIndex()).thenReturn(getIndexRequestBuilder);
  when(getIndexRequestBuilder.setFeatures()).thenReturn(getIndexRequestBuilder);
  when(getIndexRequestBuilder.get()).thenReturn(getIndexResponse);
  when(getIndexResponse.getIndices()).thenReturn(indices);

  // setup the mocks so that a set of mappings are available to the DAO
  when(indicesAdminClient.getMappings(any())).thenReturn(getMappingsActionFuture);
  when(getMappingsActionFuture.actionGet()).thenReturn(getMappingsResponse);
  when(getMappingsResponse.getMappings()).thenReturn(mappings);

  return new ElasticsearchColumnMetadataDao(adminClient);
}
 
开发者ID:apache,项目名称:metron,代码行数:31,代码来源:ElasticsearchColumnMetadataDaoTest.java

示例2: prepareGetIndex

import org.elasticsearch.action.admin.indices.get.GetIndexRequestBuilder; //导入依赖的package包/类
@Override
public GetIndexRequestBuilder prepareGetIndex() {
    return new GetIndexRequestBuilder(this, GetIndexAction.INSTANCE);
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:5,代码来源:AbstractClient.java

示例3: 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;
        }
    };
}
 
开发者ID:mazhou,项目名称:es-sql,代码行数:45,代码来源:ShowQueryAction.java

示例4: prepareGetIndex

import org.elasticsearch.action.admin.indices.get.GetIndexRequestBuilder; //导入依赖的package包/类
/**
 * Get index metadata for particular indices.
 */
GetIndexRequestBuilder prepareGetIndex();
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:5,代码来源:IndicesAdminClient.java


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