Package org.elasticsearch.action.admin.indices.alias

Examples of org.elasticsearch.action.admin.indices.alias.Alias


    @Test
    public void testExplainWithFilteredAlias() throws Exception {
        assertAcked(prepareCreate("test")
                .addMapping("test", "field2", "type=string")
                .addAlias(new Alias("alias1").filter(FilterBuilders.termFilter("field2", "value2"))));
        ensureGreen("test");

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


    @Test
    public void testExplainWithFilteredAliasFetchSource() throws Exception {
        assertAcked(client().admin().indices().prepareCreate("test")
                .addMapping("test", "field2", "type=string")
                .addAlias(new Alias("alias1").filter(FilterBuilders.termFilter("field2", "value2"))));
        ensureGreen("test");

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

    @Test
    public void testCreateIndexWithAliases() throws Exception {
        assertAcked(prepareCreate("test")
                .addMapping("type", "field", "type=string")
                .addAlias(new Alias("alias1"))
                .addAlias(new Alias("alias2").filter(FilterBuilders.missingFilter("field")))
                .addAlias(new Alias("alias3").indexRouting("index").searchRouting("search")));

        checkAliases();
    }
View Full Code Here

    }

    @Test
    public void testCreateIndexWithAliasesFilterNotValid() {
        //non valid filter, invalid json
        CreateIndexRequestBuilder createIndexRequestBuilder = prepareCreate("test").addAlias(new Alias("alias2").filter("f"));

        try {
            createIndexRequestBuilder.get();
            fail("create index should have failed due to invalid alias filter");
        } catch (ElasticsearchIllegalArgumentException e) {
            assertThat(e.getMessage(), equalTo("failed to parse filter for alias [alias2]"));
        }

        //valid json but non valid filter
        createIndexRequestBuilder = prepareCreate("test").addAlias(new Alias("alias2").filter("{ \"test\": {} }"));

        try {
            createIndexRequestBuilder.get();
            fail("create index should have failed due to invalid alias filter");
        } catch (ElasticsearchIllegalArgumentException e) {
View Full Code Here

    private static final String[] allFeatures = { "_alias", "_aliases", "_mapping", "_mappings", "_settings", "_warmer", "_warmers" };

    @Override
    protected void setupSuiteScopeCluster() throws Exception {
        assertAcked(prepareCreate("idx").addAlias(new Alias("alias_idx")).addMapping("type1", "{\"type1\":{}}")
                .setSettings(ImmutableSettings.builder().put("number_of_shards", 1)).get());
        ensureSearchable("idx");
        assertAcked(client().admin().indices().preparePutWarmer("warmer1").setSearchRequest(client().prepareSearch("idx")).get());
        createIndex("empty_idx");
        ensureSearchable("idx", "empty_idx");
View Full Code Here

        mappingBuilder.endObject().endObject().endObject();
        ImmutableSettings.Builder settings = ImmutableSettings.settingsBuilder()
                .put(indexSettings())
                .put("index.analysis.analyzer.tv_test.tokenizer", "standard")
                .putArray("index.analysis.analyzer.tv_test.filter", "type_as_payload", "lowercase");
        assertAcked(prepareCreate(index).addMapping("type1", mappingBuilder).setSettings(settings).addAlias(new Alias(alias)));

        ensureYellow();
    }
View Full Code Here

@ClusterScope(scope= Scope.TEST)
public class BlockClusterStatsTests extends ElasticsearchIntegrationTest {

    @Test
    public void testBlocks() throws Exception {
        assertAcked(prepareCreate("foo").addAlias(new Alias("foo-alias")));
        try {
            assertAcked(client().admin().indices().prepareUpdateSettings("foo").setSettings(
                    ImmutableSettings.settingsBuilder().put("index.blocks.read_only", true)));
            ClusterUpdateSettingsResponse updateSettingsResponse = client().admin().cluster().prepareUpdateSettings().setTransientSettings(
                    ImmutableSettings.settingsBuilder().put("cluster.blocks.read_only", true).build()).get();
View Full Code Here

        int numIndices = iterations(1, 5);
        for (int i = 0; i < numIndices; i++) {
            indices.add("test" + i);
        }
        for (String index : indices) {
            assertAcked(prepareCreate(index).addAlias(new Alias(index + "-alias")));
        }
        ensureGreen();
    }
View Full Code Here

        for (int i = 0; i < randomIndicesOrAliases.length; i++) {
            client().prepareIndex(randomIndicesOrAliases[i], "type", "id-" + i).setSource("field", "value").get();
        }
        refresh();

        assertAcked(prepareCreate("test-get").addAlias(new Alias("alias-get")));
        client().prepareIndex("test-get", "type", "1").setSource("field","value").get();
        String indexGet = randomBoolean() ? "test-get" : "alias-get";

        MoreLikeThisRequest moreLikeThisRequest = new MoreLikeThisRequest(indexGet).type("type").id("1")
                .searchIndices(randomIndicesOrAliases());
View Full Code Here

                            .field("type", "string")
                            .field("term_vector", "with_positions_offsets_payloads")
                        .endObject()
                .endObject()
                .endObject().endObject();
        assertAcked(prepareCreate("test").addAlias(new Alias("alias")).addMapping("type1", mapping));

        ensureYellow();

        client().prepareIndex("test", "type1", "666").setSource("field", "foo bar").execute().actionGet();
        refresh();
View Full Code Here

TOP

Related Classes of org.elasticsearch.action.admin.indices.alias.Alias

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.