• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java GetAliasesResponse类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: buildTable

import org.elasticsearch.action.admin.indices.alias.get.GetAliasesResponse; //导入依赖的package包/类
private Table buildTable(RestRequest request, GetAliasesResponse response) {
    Table table = getTableWithHeader(request);

    for (ObjectObjectCursor<String, List<AliasMetaData>> cursor : response.getAliases()) {
        String indexName = cursor.key;
        for (AliasMetaData aliasMetaData : cursor.value) {
            table.startRow();
            table.addCell(aliasMetaData.alias());
            table.addCell(indexName);
            table.addCell(aliasMetaData.filteringRequired() ? "*" : "-");
            String indexRouting = Strings.hasLength(aliasMetaData.indexRouting()) ? aliasMetaData.indexRouting() : "-";
            table.addCell(indexRouting);
            String searchRouting = Strings.hasLength(aliasMetaData.searchRouting()) ? aliasMetaData.searchRouting() : "-";
            table.addCell(searchRouting);
            table.endRow();
        }
    }

    return table;
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:21,代码来源:RestAliasAction.java


示例2: checkAliases

import org.elasticsearch.action.admin.indices.alias.get.GetAliasesResponse; //导入依赖的package包/类
private void checkAliases() {
    GetAliasesResponse getAliasesResponse = admin().indices().prepareGetAliases("alias1").get();
    assertThat(getAliasesResponse.getAliases().get("test").size(), equalTo(1));
    AliasMetaData aliasMetaData = getAliasesResponse.getAliases().get("test").get(0);
    assertThat(aliasMetaData.alias(), equalTo("alias1"));
    assertThat(aliasMetaData.filter(), nullValue());
    assertThat(aliasMetaData.indexRouting(), nullValue());
    assertThat(aliasMetaData.searchRouting(), nullValue());

    getAliasesResponse = admin().indices().prepareGetAliases("alias2").get();
    assertThat(getAliasesResponse.getAliases().get("test").size(), equalTo(1));
    aliasMetaData = getAliasesResponse.getAliases().get("test").get(0);
    assertThat(aliasMetaData.alias(), equalTo("alias2"));
    assertThat(aliasMetaData.filter(), notNullValue());
    assertThat(aliasMetaData.indexRouting(), nullValue());
    assertThat(aliasMetaData.searchRouting(), nullValue());

    getAliasesResponse = admin().indices().prepareGetAliases("alias3").get();
    assertThat(getAliasesResponse.getAliases().get("test").size(), equalTo(1));
    aliasMetaData = getAliasesResponse.getAliases().get("test").get(0);
    assertThat(aliasMetaData.alias(), equalTo("alias3"));
    assertThat(aliasMetaData.filter(), nullValue());
    assertThat(aliasMetaData.indexRouting(), equalTo("index"));
    assertThat(aliasMetaData.searchRouting(), equalTo("search"));
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:26,代码来源:IndexAliasesIT.java


示例3: createAliasIndex

import org.elasticsearch.action.admin.indices.alias.get.GetAliasesResponse; //导入依赖的package包/类
/**
     * 索引 别名 就像一个快捷方式或软连接,可以指向一个或多个索引,也可以给任何需要索引名的 API 使用。别名带给我们极大的灵活性,
     * 比如 我们线上使用一个索引名为index_a的结构,里面有一个类型现在不满足要求,现在需要修改,因为elasticsearch不支持直接修改类型,所以我们必须要重新建立一个新的索引
     * 然后将久索引的数据拷贝过去。 但是如果让新的索引起作用,我们需要要修改引用代码,因为索引名称更换了,但是如果我们一开始创建索引的时候就给索引增加一个别名
     * 使用的时候都是使用index_alis 无论软连接的指向是什么索引,对外暴露的始终都是index_alis
     * @param indicesAdminClient
     */
    private static void createAliasIndex(IndicesAdminClient indicesAdminClient) {
//        1 创建索引 elsdb_alis_v1。
//        2 将别名 elsdb_alis 指向 elsdb_alis_v1
//        3 然后,我们决定修改索引elsdb_alis_v1中一个字段的映射。当然我们不能修改现存的映射,索引我们需要重新索引数据。首先,我们创建有新的映射的索引 elsdb_alis_v2。
//        4 然后我们从将数据从 elsdb_alis_v1 迁移到 elsdb_alis_v2,下面的过程在【重新索引】中描述过了。一旦我们认为数据已经被正确的索引了,我们就将别名指向新的索引。


        //创建索引
        if (checkExistsIndex(indicesAdminClient, INDEX_ALIAS_NAME_VERSION_ONE)) {
            deleteIndex(indicesAdminClient, INDEX_ALIAS_NAME_VERSION_ONE);
        }

        indicesAdminClient.prepareCreate(INDEX_ALIAS_NAME_VERSION_ONE).setSettings().execute().actionGet();
        //添加alias 所有别名
        indicesAdminClient.prepareAliases().addAlias(INDEX_ALIAS_NAME_VERSION_ONE,INDEX_ALIAS_NAME_ALIS).execute().actionGet();

        GetAliasesResponse getAliasesResponse = indicesAdminClient.getAliases(new GetAliasesRequest().indices(INDEX_ALIAS_NAME_ALIS)).actionGet();
        //log.info("getAliasesResponse index setting:{}", getAliasesResponse.getAliases());

        indicesAdminClient.prepareAliases().removeAlias(INDEX_ALIAS_NAME_VERSION_ONE,INDEX_ALIAS_NAME_ALIS).addAlias(INDEX_ALIAS_NAME_VERSION_TWO,INDEX_ALIAS_NAME_ALIS);
    }
 
开发者ID:ggj2010,项目名称:javabase,代码行数:29,代码来源:CrudDemo.java


示例4: should_create_alias

import org.elasticsearch.action.admin.indices.alias.get.GetAliasesResponse; //导入依赖的package包/类
@Test
public void should_create_alias() throws Exception {
    String index = "index_without_alias";
    createIndex(index);
    ensureGreen(index);

    IndicesAliasesRequest request = new IndicesAliasesRequest();
    request.addAlias("the_alias", index);
    IndicesAliasesResponse response = httpClient.admin().indices().aliases(request).get();

    Assertions.assertThat(response.isAcknowledged()).isTrue();

    GetAliasesResponse finalState = transportClient.admin().indices().getAliases(new GetAliasesRequest()).actionGet();
    Assertions.assertThat(finalState.getAliases().get(index)).hasSize(1);
    Assertions.assertThat(finalState.getAliases().get(index).get(0).alias()).isEqualTo("the_alias");
    Assertions.assertThat(finalState.getAliases().get(index).get(0).filter()).isNull();
    Assertions.assertThat(finalState.getAliases().get(index).get(0).getIndexRouting()).isNull();
    Assertions.assertThat(finalState.getAliases().get(index).get(0).getSearchRouting()).isNull();
}
 
开发者ID:obourgain,项目名称:elasticsearch-http,代码行数:20,代码来源:IndicesAliasesActionHandlerTest.java


示例5: should_delete_alias

import org.elasticsearch.action.admin.indices.alias.get.GetAliasesResponse; //导入依赖的package包/类
@Test
public void should_delete_alias() throws Exception {
    String index = "index_without_alias";
    createIndex(index);
    ensureGreen(index);

    transportClient.admin().indices().aliases(new IndicesAliasesRequest().addAlias("the_alias", index)).actionGet();
    GetAliasesResponse actualAlias = transportClient.admin().indices().getAliases(new GetAliasesRequest().indices(index)).actionGet();
    Assertions.assertThat(actualAlias.getAliases().containsKey(index)).isTrue();
    Assertions.assertThat(actualAlias.getAliases().get(index)).hasSize(1);
    Assertions.assertThat(actualAlias.getAliases().get(index).get(0).alias()).isEqualTo("the_alias");

    IndicesAliasesRequest request = new IndicesAliasesRequest();
    request.removeAlias(index, "the_alias");
    IndicesAliasesResponse response = httpClient.admin().indices().aliases(request).get();

    Assertions.assertThat(response.isAcknowledged()).isTrue();

    GetAliasesResponse finalState = transportClient.admin().indices().getAliases(new GetAliasesRequest()).actionGet();
    Assertions.assertThat(finalState.getAliases()).hasSize(0);
}
 
开发者ID:obourgain,项目名称:elasticsearch-http,代码行数:22,代码来源:IndicesAliasesActionHandlerTest.java


示例6: should_create_alias_with_filter

import org.elasticsearch.action.admin.indices.alias.get.GetAliasesResponse; //导入依赖的package包/类
@Test
public void should_create_alias_with_filter() throws Exception {
    String index = "index_without_alias";
    createIndex(index);
    ensureGreen(index);

    // add a mapping so I can add a filter, else it will fail due to strict resolution of fields
    createSimpleDoc(index, THE_TYPE, THE_ID);
    ensureSearchable(index);

    IndicesAliasesRequest request = new IndicesAliasesRequest();
    TermFilterBuilder filter = termFilter("the_string_field", "some_value");

    request.addAlias("the_alias", filter, index);
    IndicesAliasesResponse response = httpClient.admin().indices().aliases(request).get();

    Assertions.assertThat(response.isAcknowledged()).isTrue();

    GetAliasesResponse finalState = transportClient.admin().indices().getAliases(new GetAliasesRequest()).actionGet();
    Assertions.assertThat(finalState.getAliases().get(index)).hasSize(1);
    Assertions.assertThat(finalState.getAliases().get(index).get(0).alias()).isEqualTo("the_alias");

    String requestFilter = request.getAliasActions().get(0).aliasAction().filter();
    CompressedString actualFilter = finalState.getAliases().get(index).get(0).filter();
    Assertions.assertThat(actualFilter.string()).isEqualTo(requestFilter);
}
 
开发者ID:obourgain,项目名称:elasticsearch-http,代码行数:27,代码来源:IndicesAliasesActionHandlerTest.java


示例7: should_create_alias_with_routing

import org.elasticsearch.action.admin.indices.alias.get.GetAliasesResponse; //导入依赖的package包/类
@Test
public void should_create_alias_with_routing() throws Exception {
    String index = "index_without_alias";
    createIndex(index);
    ensureGreen(index);

    IndicesAliasesRequest request = new IndicesAliasesRequest();

    request.addAliasAction(new AliasAction(AliasAction.Type.ADD).alias("the_alias").index(index).searchRouting("the_search_routing").indexRouting("the_index_routing"));
    IndicesAliasesResponse response = httpClient.admin().indices().aliases(request).get();

    Assertions.assertThat(response.isAcknowledged()).isTrue();

    GetAliasesResponse finalState = transportClient.admin().indices().getAliases(new GetAliasesRequest()).actionGet();
    Assertions.assertThat(finalState.getAliases().get(index)).hasSize(1);
    Assertions.assertThat(finalState.getAliases().get(index).get(0).alias()).isEqualTo("the_alias");
    Assertions.assertThat(finalState.getAliases().get(index).get(0).searchRouting()).isEqualTo("the_search_routing");
    Assertions.assertThat(finalState.getAliases().get(index).get(0).indexRouting()).isEqualTo("the_index_routing");
}
 
开发者ID:obourgain,项目名称:elasticsearch-http,代码行数:20,代码来源:IndicesAliasesActionHandlerTest.java


示例8: resolveMostRecentIndex

import org.elasticsearch.action.admin.indices.alias.get.GetAliasesResponse; //导入依赖的package包/类
public String resolveMostRecentIndex(String alias) {
    if (client() == null) {
        return alias;
    }
    if (alias == null) {
        return null;
    }
    GetAliasesRequestBuilder getAliasesRequestBuilder = new GetAliasesRequestBuilder(client(), GetAliasesAction.INSTANCE);
    GetAliasesResponse getAliasesResponse = getAliasesRequestBuilder.setAliases(alias).execute().actionGet();
    Pattern pattern = Pattern.compile("^(.*?)(\\d+)$");
    Set<String> indices = new TreeSet<>(Collections.reverseOrder());
    for (ObjectCursor<String> indexName : getAliasesResponse.getAliases().keys()) {
        Matcher m = pattern.matcher(indexName.value);
        if (m.matches()) {
            if (alias.equals(m.group(1))) {
                indices.add(indexName.value);
            }
        }
    }
    return indices.isEmpty() ? alias : indices.iterator().next();
}
 
开发者ID:jprante,项目名称:elasticsearch-helper,代码行数:22,代码来源:BaseClient.java


示例9: testPutIndexAlias

import org.elasticsearch.action.admin.indices.alias.get.GetAliasesResponse; //导入依赖的package包/类
@Test
public void testPutIndexAlias(){
  
  //Create index
  final CreateIndexRequestBuilder createIndexRequestBuilder = client.admin().indices().prepareCreate(indexName);
  @SuppressWarnings ("unused")
  CreateIndexResponse createIndexResponse = createIndexRequestBuilder.execute().actionGet();
  
  //Put the alias
  String alias = "test_alias";
  IndexAdminHelper helper = new IndexAdminHelperImpl (client);
  IndicesAliasesResponse response = helper.putIndexAlias (indexName, alias);
  assertTrue(response.isAcknowledged ());
  
  GetAliasesRequestBuilder aliasesRequestBuilder = client.admin ().indices ().prepareGetAliases ();
  GetAliasesResponse getAliasesResponse = aliasesRequestBuilder.execute ().actionGet ();    
  List<AliasMetaData> aliases = getAliasesResponse.getAliases ().get (indexName);    
  
  if(log.isDebugEnabled ())
    for(AliasMetaData aliasMetaData : aliases)
      log.debug(String.format("***** Internal Index Name: %s", aliasMetaData.alias ()));
  
  assertEquals (1, aliases.size ());
  assertEquals (alias, aliases.get (0).alias ());
}
 
开发者ID:dfci-cccb,项目名称:mev,代码行数:26,代码来源:TestIndexAdminHelperImpl.java


示例10: doCatRequest

import org.elasticsearch.action.admin.indices.alias.get.GetAliasesResponse; //导入依赖的package包/类
@Override
protected RestChannelConsumer doCatRequest(final RestRequest request, final NodeClient client) {
    final GetAliasesRequest getAliasesRequest = request.hasParam("alias") ?
            new GetAliasesRequest(request.param("alias")) :
            new GetAliasesRequest();
    getAliasesRequest.local(request.paramAsBoolean("local", getAliasesRequest.local()));

    return channel -> client.admin().indices().getAliases(getAliasesRequest, new RestResponseListener<GetAliasesResponse>(channel) {
        @Override
        public RestResponse buildResponse(GetAliasesResponse response) throws Exception {
            Table tab = buildTable(request, response);
            return RestTable.buildResponse(tab, channel);
        }
    });
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:16,代码来源:RestAliasAction.java


示例11: testIndexTemplateWithAliasesInSource

import org.elasticsearch.action.admin.indices.alias.get.GetAliasesResponse; //导入依赖的package包/类
public void testIndexTemplateWithAliasesInSource() {
    client().admin().indices().preparePutTemplate("template_1")
            .setSource(new BytesArray("{\n" +
                    "    \"template\" : \"*\",\n" +
                    "    \"aliases\" : {\n" +
                    "        \"my_alias\" : {\n" +
                    "            \"filter\" : {\n" +
                    "                \"type\" : {\n" +
                    "                    \"value\" : \"type2\"\n" +
                    "                }\n" +
                    "            }\n" +
                    "        }\n" +
                    "    }\n" +
                    "}"), XContentType.JSON).get();


    assertAcked(prepareCreate("test_index").addMapping("type1").addMapping("type2"));
    ensureGreen();

    GetAliasesResponse getAliasesResponse = client().admin().indices().prepareGetAliases().setIndices("test_index").get();
    assertThat(getAliasesResponse.getAliases().size(), equalTo(1));
    assertThat(getAliasesResponse.getAliases().get("test_index").size(), equalTo(1));

    client().prepareIndex("test_index", "type1", "1").setSource("field", "value1").get();
    client().prepareIndex("test_index", "type2", "2").setSource("field", "value2").get();
    refresh();

    SearchResponse searchResponse = client().prepareSearch("test_index").get();
    assertHitCount(searchResponse, 2L);

    searchResponse = client().prepareSearch("my_alias").get();
    assertHitCount(searchResponse, 1L);
    assertThat(searchResponse.getHits().getAt(0).getType(), equalTo("type2"));
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:35,代码来源:SimpleIndexTemplateIT.java


示例12: testIndexTemplateWithAliasesSource

import org.elasticsearch.action.admin.indices.alias.get.GetAliasesResponse; //导入依赖的package包/类
public void testIndexTemplateWithAliasesSource() {
    client().admin().indices().preparePutTemplate("template_1")
            .setPatterns(Collections.singletonList("te*"))
            .setAliases(
                    "    {\n" +
                    "        \"alias1\" : {},\n" +
                    "        \"alias2\" : {\n" +
                    "            \"filter\" : {\n" +
                    "                \"type\" : {\n" +
                    "                    \"value\" : \"type2\"\n" +
                    "                }\n" +
                    "            }\n" +
                    "         },\n" +
                    "        \"alias3\" : { \"routing\" : \"1\" }" +
                    "    }\n").get();

    assertAcked(prepareCreate("test_index").addMapping("type1").addMapping("type2"));
    ensureGreen();

    GetAliasesResponse getAliasesResponse = client().admin().indices().prepareGetAliases().setIndices("test_index").get();
    assertThat(getAliasesResponse.getAliases().size(), equalTo(1));
    assertThat(getAliasesResponse.getAliases().get("test_index").size(), equalTo(3));

    client().prepareIndex("test_index", "type1", "1").setSource("field", "value1").get();
    client().prepareIndex("test_index", "type2", "2").setSource("field", "value2").get();
    refresh();

    SearchResponse searchResponse = client().prepareSearch("test_index").get();
    assertHitCount(searchResponse, 2L);

    searchResponse = client().prepareSearch("alias1").get();
    assertHitCount(searchResponse, 2L);

    searchResponse = client().prepareSearch("alias2").get();
    assertHitCount(searchResponse, 1L);
    assertThat(searchResponse.getHits().getAt(0).getType(), equalTo("type2"));
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:38,代码来源:SimpleIndexTemplateIT.java


示例13: testMultipleAliasesPrecedence

import org.elasticsearch.action.admin.indices.alias.get.GetAliasesResponse; //导入依赖的package包/类
public void testMultipleAliasesPrecedence() throws Exception {
    client().admin().indices().preparePutTemplate("template1")
            .setPatterns(Collections.singletonList("*"))
            .setOrder(0)
            .addAlias(new Alias("alias1"))
            .addAlias(new Alias("{index}-alias"))
            .addAlias(new Alias("alias3").filter(QueryBuilders.boolQuery().mustNot(QueryBuilders.existsQuery("test"))))
            .addAlias(new Alias("alias4")).get();

    client().admin().indices().preparePutTemplate("template2")
            .setPatterns(Collections.singletonList("te*"))
            .setOrder(1)
            .addAlias(new Alias("alias1").routing("test"))
            .addAlias(new Alias("alias3")).get();


    assertAcked(prepareCreate("test").addAlias(new Alias("test-alias").searchRouting("test-routing")));

    ensureGreen();

    GetAliasesResponse getAliasesResponse = client().admin().indices().prepareGetAliases().addIndices("test").get();
    assertThat(getAliasesResponse.getAliases().get("test").size(), equalTo(4));

    for (AliasMetaData aliasMetaData : getAliasesResponse.getAliases().get("test")) {
        assertThat(aliasMetaData.alias(), anyOf(equalTo("alias1"), equalTo("test-alias"), equalTo("alias3"), equalTo("alias4")));
        if ("alias1".equals(aliasMetaData.alias())) {
            assertThat(aliasMetaData.indexRouting(), equalTo("test"));
            assertThat(aliasMetaData.searchRouting(), equalTo("test"));
        } else if ("alias3".equals(aliasMetaData.alias())) {
            assertThat(aliasMetaData.filter(), nullValue());
        } else if ("test-alias".equals(aliasMetaData.alias())) {
            assertThat(aliasMetaData.indexRouting(), nullValue());
            assertThat(aliasMetaData.searchRouting(), equalTo("test-routing"));
        }
    }
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:37,代码来源:SimpleIndexTemplateIT.java


示例14: testGetAllAliasesWorks

import org.elasticsearch.action.admin.indices.alias.get.GetAliasesResponse; //导入依赖的package包/类
public void testGetAllAliasesWorks() {
    createIndex("index1");
    createIndex("index2");

    assertAcked(admin().indices().prepareAliases().addAlias("index1", "alias1").addAlias("index2", "alias2"));

    GetAliasesResponse response = admin().indices().prepareGetAliases().get();
    assertThat(response.getAliases(), hasKey("index1"));
    assertThat(response.getAliases(), hasKey("index1"));
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:11,代码来源:IndexAliasesIT.java


示例15: handleRequest

import org.elasticsearch.action.admin.indices.alias.get.GetAliasesResponse; //导入依赖的package包/类
@Override
public void handleRequest(final RestRequest request, final RestChannel channel, final Client client) {
    final String[] aliases = request.paramAsStringArrayOrEmptyIfAll("name");
    final String[] indices = Strings.splitStringByCommaToArray(request.param("index"));
    final GetAliasesRequest getAliasesRequest = new GetAliasesRequest(aliases);
    getAliasesRequest.indices(indices);
    getAliasesRequest.indicesOptions(IndicesOptions.fromRequest(request, getAliasesRequest.indicesOptions()));
    getAliasesRequest.local(request.paramAsBoolean("local", getAliasesRequest.local()));

    client.admin().indices().getAliases(getAliasesRequest, new RestBuilderListener<GetAliasesResponse>(channel) {
        @Override
        public RestResponse buildResponse(GetAliasesResponse response, XContentBuilder builder) throws Exception {
            // empty body, if indices were specified but no aliases were
            if (indices.length > 0 && response.getAliases().isEmpty()) {
                return new BytesRestResponse(OK, builder.startObject().endObject());
            } else if (response.getAliases().isEmpty()) {
                String message = String.format(Locale.ROOT, "alias [%s] missing", toNamesString(getAliasesRequest.aliases()));
                builder.startObject()
                        .field("error", message)
                        .field("status", RestStatus.NOT_FOUND.getStatus())
                        .endObject();
                return new BytesRestResponse(RestStatus.NOT_FOUND, builder);
            }

            builder.startObject();
            for (ObjectObjectCursor<String, List<AliasMetaData>> entry : response.getAliases()) {
                builder.startObject(entry.key, XContentBuilder.FieldCaseConversion.NONE);
                builder.startObject(Fields.ALIASES);
                for (AliasMetaData alias : entry.value) {
                    AliasMetaData.Builder.toXContent(alias, builder, ToXContent.EMPTY_PARAMS);
                }
                builder.endObject();
                builder.endObject();
            }
            builder.endObject();
            return new BytesRestResponse(OK, builder);
        }
    });
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:40,代码来源:RestGetAliasesAction.java


示例16: doRequest

import org.elasticsearch.action.admin.indices.alias.get.GetAliasesResponse; //导入依赖的package包/类
@Override
protected void doRequest(final RestRequest request, final RestChannel channel, final Client client) {
    final GetAliasesRequest getAliasesRequest = request.hasParam("alias") ?
            new GetAliasesRequest(request.param("alias")) :
            new GetAliasesRequest();
    getAliasesRequest.local(request.paramAsBoolean("local", getAliasesRequest.local()));

    client.admin().indices().getAliases(getAliasesRequest, new RestResponseListener<GetAliasesResponse>(channel) {
        @Override
        public RestResponse buildResponse(GetAliasesResponse response) throws Exception {
            Table tab = buildTable(request, response);
            return RestTable.buildResponse(tab, channel);
        }
    });
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:16,代码来源:RestAliasAction.java


示例17: testSwitchAlias

import org.elasticsearch.action.admin.indices.alias.get.GetAliasesResponse; //导入依赖的package包/类
@Test
public void testSwitchAlias() {
    createIndex(INDEX_2);
    client().admin().indices().aliases(Requests.indexAliasesRequest().addAlias(ALIAS, INDEX)).actionGet();

    operations.switchAlias(ALIAS, INDEX, INDEX_2).actionGet();

    GetAliasesResponse response = client().admin().indices().getAliases(new GetAliasesRequest(ALIAS)).actionGet();
    Assertions.assertThat(response.getAliases().size()).isEqualTo(1);
    ObjectObjectCursor<String, List<AliasMetaData>> cursor = response.getAliases().iterator().next();
    Assertions.assertThat(cursor.key).isEqualTo(INDEX_2);
    Assertions.assertThat(cursor.value.size()).isEqualTo(1);
    Assertions.assertThat(cursor.value.iterator().next().alias()).isEqualTo(ALIAS);
}
 
开发者ID:obourgain,项目名称:elasticsearch-batch,代码行数:15,代码来源:ElasticsearchBatchOperationsAsyncTest.java


示例18: resolveAlias

import org.elasticsearch.action.admin.indices.alias.get.GetAliasesResponse; //导入依赖的package包/类
public String resolveAlias(String alias) {
    if (client() == null) {
        return alias;
    }
    GetAliasesRequestBuilder getAliasesRequestBuilder = new GetAliasesRequestBuilder(client(), GetAliasesAction.INSTANCE);
    GetAliasesResponse getAliasesResponse = getAliasesRequestBuilder.setAliases(alias).execute().actionGet();
    if (!getAliasesResponse.getAliases().isEmpty()) {
        return getAliasesResponse.getAliases().keys().iterator().next().value;
    }
    return alias;
}
 
开发者ID:jprante,项目名称:elasticsearch-helper,代码行数:12,代码来源:BaseClient.java


示例19: getFilters

import org.elasticsearch.action.admin.indices.alias.get.GetAliasesResponse; //导入依赖的package包/类
private Map<String,String> getFilters(GetAliasesResponse getAliasesResponse) {
    Map<String,String> result = new HashMap<>();
    for (ObjectObjectCursor<String, List<AliasMetaData>> object : getAliasesResponse.getAliases()) {
        List<AliasMetaData> aliasMetaDataList = object.value;
        for (AliasMetaData aliasMetaData : aliasMetaDataList) {
            if (aliasMetaData.filteringRequired()) {
                result.put(aliasMetaData.alias(), new String(aliasMetaData.getFilter().uncompressed()));
            } else {
                result.put(aliasMetaData.alias(), null);
            }
        }
    }
    return result;
}
 
开发者ID:jprante,项目名称:elasticsearch-helper,代码行数:15,代码来源:BaseClient.java


示例20: getIndexNameForAlias

import org.elasticsearch.action.admin.indices.alias.get.GetAliasesResponse; //导入依赖的package包/类
@Override
public String getIndexNameForAlias(String alias) throws IndexAdminException{
  GetAliasesRequestBuilder aliasesRequestBuilder = client.admin ().indices ().prepareGetAliases ().setIndices (alias);
  GetAliasesResponse getAliasesResponse = aliasesRequestBuilder.execute ().actionGet ();
  String[] aliases = getAliasesResponse.getAliases ().keys ().toArray (String.class);
  if(aliases.length==0)
    return alias;
  else if(aliases.length==1)
    return aliases[0];
  else
    throw new IndexAdminException (String.format ("Could not find index for alias %s, query returned: %s", alias, getAliasesResponse.getAliases ()));
}
 
开发者ID:dfci-cccb,项目名称:mev,代码行数:13,代码来源:IndexAdminHelperImpl.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java CoordinateList类代码示例发布时间:2022-05-22
下一篇:
Java AnActionListener类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap