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

Java Alias类代码示例

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

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



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

示例1: testDeleteByMatchQuery

import org.elasticsearch.action.admin.indices.alias.Alias; //导入依赖的package包/类
public void testDeleteByMatchQuery() throws Exception {
    assertAcked(prepareCreate("test").addAlias(new Alias("alias")));

    final int docs = scaledRandomIntBetween(10, 100);

    List<IndexRequestBuilder> builders = new ArrayList<>();
    for (int i = 0; i < docs; i++) {
        builders.add(client().prepareIndex("test", "test", Integer.toString(i))
                .setRouting(randomAsciiOfLengthBetween(1, 5))
                .setSource("foo", "bar"));
    }
    indexRandom(true, true, true, builders);

    int n = between(0, docs - 1);
    assertHitCount(client().prepareSearch("test").setSize(0).setQuery(matchQuery("_id", Integer.toString(n))).get(), 1);
    assertHitCount(client().prepareSearch("test").setSize(0).setQuery(QueryBuilders.matchAllQuery()).get(), docs);

    DeleteByQueryRequestBuilder delete = deleteByQuery().source("alias").filter(matchQuery("_id", Integer.toString(n)));
    assertThat(delete.refresh(true).get(), matcher().deleted(1L));

    assertHitCount(client().prepareSearch("test").setSize(0).setQuery(QueryBuilders.matchAllQuery()).get(), docs - 1);
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:23,代码来源:DeleteByQueryBasicTests.java


示例2: testAnalyzerWithFieldOrTypeTests

import org.elasticsearch.action.admin.indices.alias.Alias; //导入依赖的package包/类
public void testAnalyzerWithFieldOrTypeTests() throws Exception {
    assertAcked(prepareCreate("test").addAlias(new Alias("alias")));
    ensureGreen();

    client().admin().indices().preparePutMapping("test")
            .setType("document").setSource("simple", "type=text,analyzer=simple").get();

    for (int i = 0; i < 10; i++) {
        final AnalyzeRequestBuilder requestBuilder = client().admin().indices().prepareAnalyze("THIS IS A TEST");
        requestBuilder.setIndex(indexOrAlias());
        requestBuilder.setField("document.simple");
        AnalyzeResponse analyzeResponse = requestBuilder.get();
        assertThat(analyzeResponse.getTokens().size(), equalTo(4));
        AnalyzeResponse.AnalyzeToken token = analyzeResponse.getTokens().get(3);
        assertThat(token.getTerm(), equalTo("test"));
        assertThat(token.getStartOffset(), equalTo(10));
        assertThat(token.getEndOffset(), equalTo(14));
        assertThat(token.getPositionLength(), equalTo(1));
    }
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:21,代码来源:AnalyzeActionIT.java


示例3: testAnalyzeNormalizedKeywordField

import org.elasticsearch.action.admin.indices.alias.Alias; //导入依赖的package包/类
public void testAnalyzeNormalizedKeywordField() throws IOException {
    assertAcked(prepareCreate("test").addAlias(new Alias("alias"))
        .setSettings(Settings.builder().put(indexSettings())
            .put("index.analysis.normalizer.my_normalizer.type", "custom")
            .putArray("index.analysis.normalizer.my_normalizer.filter", "lowercase"))
        .addMapping("test", "keyword", "type=keyword,normalizer=my_normalizer"));
    ensureGreen("test");

    AnalyzeResponse analyzeResponse = client().admin().indices().prepareAnalyze(indexOrAlias(), "ABC").setField("keyword").get();
    assertThat(analyzeResponse.getTokens().size(), equalTo(1));
    AnalyzeResponse.AnalyzeToken token = analyzeResponse.getTokens().get(0);
    assertThat(token.getTerm(), equalTo("abc"));
    assertThat(token.getStartOffset(), equalTo(0));
    assertThat(token.getEndOffset(), equalTo(3));
    assertThat(token.getPosition(), equalTo(0));
    assertThat(token.getPositionLength(), equalTo(1));

}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:19,代码来源:AnalyzeActionIT.java


示例4: testAliasInvalidFilterValidJson

import org.elasticsearch.action.admin.indices.alias.Alias; //导入依赖的package包/类
public void testAliasInvalidFilterValidJson() throws Exception {
    //invalid filter but valid json: put index template works fine, fails during index creation
    client().admin().indices().preparePutTemplate("template_1")
            .setPatterns(Collections.singletonList("te*"))
            .addAlias(new Alias("invalid_alias").filter("{ \"invalid\": {} }")).get();

    GetIndexTemplatesResponse response = client().admin().indices().prepareGetTemplates("template_1").get();
    assertThat(response.getIndexTemplates().size(), equalTo(1));
    assertThat(response.getIndexTemplates().get(0).getAliases().size(), equalTo(1));
    assertThat(response.getIndexTemplates().get(0).getAliases().get("invalid_alias").filter().string(), equalTo("{\"invalid\":{}}"));

    IllegalArgumentException e = expectThrows(IllegalArgumentException.class,
        () -> createIndex("test"));
    assertThat(e.getMessage(), equalTo("failed to parse filter for alias [invalid_alias]"));
    assertThat(e.getCause(), instanceOf(ParsingException.class));
    assertThat(e.getCause().getMessage(), equalTo("no [query] registered for [invalid]"));
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:18,代码来源:SimpleIndexTemplateIT.java


示例5: testExplainWithFilteredAliasFetchSource

import org.elasticsearch.action.admin.indices.alias.Alias; //导入依赖的package包/类
public void testExplainWithFilteredAliasFetchSource() throws Exception {
    assertAcked(client().admin().indices().prepareCreate("test")
            .addMapping("test", "field2", "type=text")
            .addAlias(new Alias("alias1").filter(QueryBuilders.termQuery("field2", "value2"))));
    ensureGreen("test");

    client().prepareIndex("test", "test", "1").setSource("field1", "value1", "field2", "value1").get();
    refresh();

    ExplainResponse response = client().prepareExplain("alias1", "test", "1")
            .setQuery(QueryBuilders.matchAllQuery()).setFetchSource(true).get();

    assertNotNull(response);
    assertTrue(response.isExists());
    assertFalse(response.isMatch());
    assertThat(response.getIndex(), equalTo("test"));
    assertThat(response.getType(), equalTo("test"));
    assertThat(response.getId(), equalTo("1"));
    assertThat(response.getGetResult(), notNullValue());
    assertThat(response.getGetResult().getIndex(), equalTo("test"));
    assertThat(response.getGetResult().getType(), equalTo("test"));
    assertThat(response.getGetResult().getId(), equalTo("1"));
    assertThat(response.getGetResult().getSource(), notNullValue());
    assertThat((String)response.getGetResult().getSource().get("field1"), equalTo("value1"));
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:26,代码来源:ExplainActionIT.java


示例6: testGetFieldsNonLeafField

import org.elasticsearch.action.admin.indices.alias.Alias; //导入依赖的package包/类
public void testGetFieldsNonLeafField() throws Exception {
    assertAcked(prepareCreate("test").addAlias(new Alias("alias"))
            .addMapping("my-type1", jsonBuilder().startObject().startObject("my-type1").startObject("properties")
                    .startObject("field1").startObject("properties")
                    .startObject("field2").field("type", "text").endObject()
                    .endObject().endObject()
                    .endObject().endObject().endObject())
            .setSettings(Settings.builder().put("index.refresh_interval", -1)));

    client().prepareIndex("test", "my-type1", "1")
            .setSource(jsonBuilder().startObject().startObject("field1").field("field2", "value1").endObject().endObject())
            .get();


    IllegalArgumentException exc =
        expectThrows(IllegalArgumentException.class,
            () -> client().prepareGet(indexOrAlias(), "my-type1", "1").setStoredFields("field1").get());
    assertThat(exc.getMessage(), equalTo("field [field1] isn't a leaf field"));

    flush();

    exc =
        expectThrows(IllegalArgumentException.class,
            () -> client().prepareGet(indexOrAlias(), "my-type1", "1").setStoredFields("field1").get());
    assertThat(exc.getMessage(), equalTo("field [field1] isn't a leaf field"));
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:27,代码来源:GetActionIT.java


示例7: testUngeneratedFieldsNotPartOfSourceStored

import org.elasticsearch.action.admin.indices.alias.Alias; //导入依赖的package包/类
public void testUngeneratedFieldsNotPartOfSourceStored() throws IOException {
    String createIndexSource = "{\n" +
        "  \"settings\": {\n" +
        "    \"index.translog.flush_threshold_size\": \"1pb\",\n" +
        "    \"refresh_interval\": \"-1\"\n" +
        "  }\n" +
        "}";

    assertAcked(prepareCreate("test").addAlias(new Alias("alias")).setSource(createIndexSource, XContentType.JSON));
    ensureGreen();
    String doc = "{\n" +
        "  \"text\": \"some text.\"\n" +
        "}\n";
    client().prepareIndex("test", "doc").setId("1").setSource(doc, XContentType.JSON).setRouting("1").get();
    String[] fieldsList = {"_routing"};
    // before refresh - document is only in translog
    assertGetFieldsAlwaysWorks(indexOrAlias(), "doc", "1", fieldsList, "1");
    refresh();
    //after refresh - document is in translog and also indexed
    assertGetFieldsAlwaysWorks(indexOrAlias(), "doc", "1", fieldsList, "1");
    flush();
    //after flush - document is in not anymore translog - only indexed
    assertGetFieldsAlwaysWorks(indexOrAlias(), "doc", "1", fieldsList, "1");
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:25,代码来源:GetActionIT.java


示例8: testRollover

import org.elasticsearch.action.admin.indices.alias.Alias; //导入依赖的package包/类
public void testRollover() throws Exception {
    assertAcked(prepareCreate("test_index-2").addAlias(new Alias("test_alias")).get());
    index("test_index-2", "type1", "1", "field", "value");
    flush("test_index-2");
    final RolloverResponse response = client().admin().indices().prepareRolloverIndex("test_alias").get();
    assertThat(response.getOldIndex(), equalTo("test_index-2"));
    assertThat(response.getNewIndex(), equalTo("test_index-000003"));
    assertThat(response.isDryRun(), equalTo(false));
    assertThat(response.isRolledOver(), equalTo(true));
    assertThat(response.getConditionStatus().size(), equalTo(0));
    final ClusterState state = client().admin().cluster().prepareState().get().getState();
    final IndexMetaData oldIndex = state.metaData().index("test_index-2");
    assertFalse(oldIndex.getAliases().containsKey("test_alias"));
    final IndexMetaData newIndex = state.metaData().index("test_index-000003");
    assertTrue(newIndex.getAliases().containsKey("test_alias"));
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:17,代码来源:RolloverIT.java


示例9: testRolloverWithIndexSettings

import org.elasticsearch.action.admin.indices.alias.Alias; //导入依赖的package包/类
public void testRolloverWithIndexSettings() throws Exception {
    assertAcked(prepareCreate("test_index-2").addAlias(new Alias("test_alias")).get());
    index("test_index-2", "type1", "1", "field", "value");
    flush("test_index-2");
    final Settings settings = Settings.builder()
        .put(IndexMetaData.SETTING_NUMBER_OF_SHARDS, 1)
        .put(IndexMetaData.SETTING_NUMBER_OF_REPLICAS, 0)
        .build();
    final RolloverResponse response = client().admin().indices().prepareRolloverIndex("test_alias")
        .settings(settings).alias(new Alias("extra_alias")).get();
    assertThat(response.getOldIndex(), equalTo("test_index-2"));
    assertThat(response.getNewIndex(), equalTo("test_index-000003"));
    assertThat(response.isDryRun(), equalTo(false));
    assertThat(response.isRolledOver(), equalTo(true));
    assertThat(response.getConditionStatus().size(), equalTo(0));
    final ClusterState state = client().admin().cluster().prepareState().get().getState();
    final IndexMetaData oldIndex = state.metaData().index("test_index-2");
    assertFalse(oldIndex.getAliases().containsKey("test_alias"));
    final IndexMetaData newIndex = state.metaData().index("test_index-000003");
    assertThat(newIndex.getNumberOfShards(), equalTo(1));
    assertThat(newIndex.getNumberOfReplicas(), equalTo(0));
    assertTrue(newIndex.getAliases().containsKey("test_alias"));
    assertTrue(newIndex.getAliases().containsKey("extra_alias"));
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:25,代码来源:RolloverIT.java


示例10: testRolloverDryRun

import org.elasticsearch.action.admin.indices.alias.Alias; //导入依赖的package包/类
public void testRolloverDryRun() throws Exception {
    assertAcked(prepareCreate("test_index-1").addAlias(new Alias("test_alias")).get());
    index("test_index-1", "type1", "1", "field", "value");
    flush("test_index-1");
    final RolloverResponse response = client().admin().indices().prepareRolloverIndex("test_alias").dryRun(true).get();
    assertThat(response.getOldIndex(), equalTo("test_index-1"));
    assertThat(response.getNewIndex(), equalTo("test_index-000002"));
    assertThat(response.isDryRun(), equalTo(true));
    assertThat(response.isRolledOver(), equalTo(false));
    assertThat(response.getConditionStatus().size(), equalTo(0));
    final ClusterState state = client().admin().cluster().prepareState().get().getState();
    final IndexMetaData oldIndex = state.metaData().index("test_index-1");
    assertTrue(oldIndex.getAliases().containsKey("test_alias"));
    final IndexMetaData newIndex = state.metaData().index("test_index-000002");
    assertNull(newIndex);
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:17,代码来源:RolloverIT.java


示例11: testRolloverConditionsNotMet

import org.elasticsearch.action.admin.indices.alias.Alias; //导入依赖的package包/类
public void testRolloverConditionsNotMet() throws Exception {
    assertAcked(prepareCreate("test_index-0").addAlias(new Alias("test_alias")).get());
    index("test_index-0", "type1", "1", "field", "value");
    flush("test_index-0");
    final RolloverResponse response = client().admin().indices().prepareRolloverIndex("test_alias")
        .addMaxIndexAgeCondition(TimeValue.timeValueHours(4)).get();
    assertThat(response.getOldIndex(), equalTo("test_index-0"));
    assertThat(response.getNewIndex(), equalTo("test_index-000001"));
    assertThat(response.isDryRun(), equalTo(false));
    assertThat(response.isRolledOver(), equalTo(false));
    assertThat(response.getConditionStatus().size(), equalTo(1));
    final Map.Entry<String, Boolean> conditionEntry = response.getConditionStatus().iterator().next();
    assertThat(conditionEntry.getKey(), equalTo(new MaxAgeCondition(TimeValue.timeValueHours(4)).toString()));
    assertThat(conditionEntry.getValue(), equalTo(false));
    final ClusterState state = client().admin().cluster().prepareState().get().getState();
    final IndexMetaData oldIndex = state.metaData().index("test_index-0");
    assertTrue(oldIndex.getAliases().containsKey("test_alias"));
    final IndexMetaData newIndex = state.metaData().index("test_index-000001");
    assertNull(newIndex);
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:21,代码来源:RolloverIT.java


示例12: testRolloverWithNewIndexName

import org.elasticsearch.action.admin.indices.alias.Alias; //导入依赖的package包/类
public void testRolloverWithNewIndexName() throws Exception {
    assertAcked(prepareCreate("test_index").addAlias(new Alias("test_alias")).get());
    index("test_index", "type1", "1", "field", "value");
    flush("test_index");
    final RolloverResponse response = client().admin().indices().prepareRolloverIndex("test_alias")
        .setNewIndexName("test_new_index").get();
    assertThat(response.getOldIndex(), equalTo("test_index"));
    assertThat(response.getNewIndex(), equalTo("test_new_index"));
    assertThat(response.isDryRun(), equalTo(false));
    assertThat(response.isRolledOver(), equalTo(true));
    assertThat(response.getConditionStatus().size(), equalTo(0));
    final ClusterState state = client().admin().cluster().prepareState().get().getState();
    final IndexMetaData oldIndex = state.metaData().index("test_index");
    assertFalse(oldIndex.getAliases().containsKey("test_alias"));
    final IndexMetaData newIndex = state.metaData().index("test_new_index");
    assertTrue(newIndex.getAliases().containsKey("test_alias"));
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:18,代码来源:RolloverIT.java


示例13: testSimpleWildCards

import org.elasticsearch.action.admin.indices.alias.Alias; //导入依赖的package包/类
public void testSimpleWildCards() throws IOException {
    int numFields = 25;

    XContentBuilder mapping = jsonBuilder().startObject().startObject("type1").startObject("properties");
    XContentBuilder source = jsonBuilder().startObject();
    for (int i = 0; i < numFields; i++) {
        mapping.startObject("field" + i)
                .field("type", "text")
                .field("term_vector", randomBoolean() ? "yes" : "no")
                .endObject();
        source.field("field" + i, "some text here");
    }
    source.endObject();
    mapping.endObject().endObject().endObject();

    assertAcked(prepareCreate("test").addAlias(new Alias("alias")).addMapping("type1", mapping));
    ensureGreen();

    client().prepareIndex("test", "type1", "0").setSource(source).get();
    refresh();

    TermVectorsResponse response = client().prepareTermVectors(indexOrAlias(), "type1", "0").setSelectedFields("field*").get();
    assertThat("Doc doesn't exists but should", response.isExists(), equalTo(true));
    assertThat(response.getIndex(), equalTo("test"));
    assertThat("All term vectors should have been generated", response.getFields().size(), equalTo(numFields));
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:27,代码来源:GetTermVectorsIT.java


示例14: readFrom

import org.elasticsearch.action.admin.indices.alias.Alias; //导入依赖的package包/类
@Override
public void readFrom(StreamInput in) throws IOException {
    super.readFrom(in);
    cause = in.readString();
    index = in.readString();
    settings = readSettingsFromStream(in);
    readTimeout(in);
    int size = in.readVInt();
    for (int i = 0; i < size; i++) {
        mappings.put(in.readString(), in.readString());
    }
    int customSize = in.readVInt();
    for (int i = 0; i < customSize; i++) {
        String type = in.readString();
        IndexMetaData.Custom customIndexMetaData = IndexMetaData.lookupPrototypeSafe(type).readFrom(in);
        customs.put(type, customIndexMetaData);
    }
    int aliasesSize = in.readVInt();
    for (int i = 0; i < aliasesSize; i++) {
        aliases.add(Alias.read(in));
    }
    updateAllTypes = in.readBoolean();
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:24,代码来源:CreateIndexRequest.java


示例15: readFrom

import org.elasticsearch.action.admin.indices.alias.Alias; //导入依赖的package包/类
@Override
public void readFrom(StreamInput in) throws IOException {
    super.readFrom(in);
    cause = in.readString();
    name = in.readString();
    template = in.readString();
    order = in.readInt();
    create = in.readBoolean();
    settings = readSettingsFromStream(in);
    int size = in.readVInt();
    for (int i = 0; i < size; i++) {
        mappings.put(in.readString(), in.readString());
    }
    int customSize = in.readVInt();
    for (int i = 0; i < customSize; i++) {
        String type = in.readString();
        IndexMetaData.Custom customIndexMetaData = IndexMetaData.lookupPrototypeSafe(type).readFrom(in);
        customs.put(type, customIndexMetaData);
    }
    int aliasesSize = in.readVInt();
    for (int i = 0; i < aliasesSize; i++) {
        aliases.add(Alias.read(in));
    }
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:25,代码来源:PutIndexTemplateRequest.java


示例16: createIndex

import org.elasticsearch.action.admin.indices.alias.Alias; //导入依赖的package包/类
public void createIndex(String backendId, String type, String mapping, boolean async, int shards, int replicas) {

		Settings settings = Settings.builder()//
				.put("number_of_shards", shards)//
				.put("number_of_replicas", replicas)//
				.build();

		CreateIndexResponse createIndexResponse = internalClient.admin().indices()//
				.prepareCreate(toIndex0(backendId, type))//
				.addMapping(type, mapping)//
				.addAlias(new Alias(toAlias(backendId, type)))//
				.setSettings(settings)//
				.get();

		if (!createIndexResponse.isAcknowledged())
			throw Exceptions.runtime(//
					"index [%s] creation not acknowledged by the whole cluster", //
					toIndex0(backendId, type));

		if (!async)
			ensureGreen(backendId, type);
	}
 
开发者ID:spacedog-io,项目名称:spacedog-server,代码行数:23,代码来源:ElasticClient.java


示例17: createIndexIfNothing

import org.elasticsearch.action.admin.indices.alias.Alias; //导入依赖的package包/类
public boolean createIndexIfNothing() {
    try {
        boolean created = false;
        final IndicesExistsResponse response =
                client.admin().indices().prepareExists(getSearchAlias(index)).execute().actionGet(suggestSettings.getIndicesTimeout());
        if (!response.isExists()) {

            final String mappingSource = getDefaultMappings();
            final String settingsSource = getDefaultIndexSettings();
            final String indexName = createIndexName(index);
            client.admin().indices().prepareCreate(indexName).setSettings(settingsSource.toString(), XContentType.JSON)
                    .addMapping(type, mappingSource, XContentType.JSON).addAlias(new Alias(getSearchAlias(index)))
                    .addAlias(new Alias(getUpdateAlias(index))).execute().actionGet(suggestSettings.getIndicesTimeout());

            client.admin().cluster().prepareHealth().setWaitForYellowStatus().execute().actionGet(suggestSettings.getClusterTimeout());
            created = true;
        }
        return created;
    } catch (final Exception e) {
        throw new SuggesterException("Failed to create index.", e);
    }
}
 
开发者ID:codelibs,项目名称:fess-suggest,代码行数:23,代码来源:Suggester.java


示例18: validateAliasStandalone

import org.elasticsearch.action.admin.indices.alias.Alias; //导入依赖的package包/类
/**
 * Allows to partially validate an alias, without knowing which index it'll get applied to.
 * Useful with index templates containing aliases. Checks also that it is possible to parse
 * the alias filter via {@link org.elasticsearch.common.xcontent.XContentParser},
 * without validating it as a filter though.
 * @throws IllegalArgumentException if the alias is not valid
 */
public void validateAliasStandalone(Alias alias) {
    validateAliasStandalone(alias.name(), alias.indexRouting());
    if (Strings.hasLength(alias.filter())) {
        try {
            XContentHelper.convertToMap(XContentFactory.xContent(alias.filter()), alias.filter(), false);
        } catch (Exception e) {
            throw new IllegalArgumentException("failed to parse filter for alias [" + alias.name() + "]", e);
        }
    }
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:18,代码来源:AliasValidator.java


示例19: aliases

import org.elasticsearch.action.admin.indices.alias.Alias; //导入依赖的package包/类
/**
 * Sets the aliases that will be associated with the index when it gets created
 */
public CreateIndexRequest aliases(BytesReference source) {
    // EMPTY is safe here because we never call namedObject
    try (XContentParser parser = XContentHelper.createParser(NamedXContentRegistry.EMPTY, source)) {
        //move to the first alias
        parser.nextToken();
        while ((parser.nextToken()) != XContentParser.Token.END_OBJECT) {
            alias(Alias.fromXContent(parser));
        }
        return this;
    } catch(IOException e) {
        throw new ElasticsearchParseException("Failed to parse aliases", e);
    }
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:17,代码来源:CreateIndexRequest.java


示例20: aliases

import org.elasticsearch.action.admin.indices.alias.Alias; //导入依赖的package包/类
/**
 * Sets the aliases that will be associated with the index when it gets created
 */
public PutIndexTemplateRequest aliases(BytesReference source) {
    // EMPTY is safe here because we never call namedObject
    try (XContentParser parser = XContentHelper.createParser(NamedXContentRegistry.EMPTY, source)) {
        //move to the first alias
        parser.nextToken();
        while ((parser.nextToken()) != XContentParser.Token.END_OBJECT) {
            alias(Alias.fromXContent(parser));
        }
        return this;
    } catch(IOException e) {
        throw new ElasticsearchParseException("Failed to parse aliases", e);
    }
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:17,代码来源:PutIndexTemplateRequest.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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