Examples of GetIndexTemplatesResponse


Examples of org.elasticsearch.action.admin.indices.template.get.GetIndexTemplatesResponse

                "  odd boolean," +
                "  prime boolean" +
                ") partitioned by (odd) with (column_policy='strict', number_of_replicas=0)");
        ensureGreen();

        GetIndexTemplatesResponse response = client().admin().indices()
                .prepareGetTemplates(PartitionName.templateName("numbers"))
                .execute().actionGet();
        assertThat(response.getIndexTemplates().size(), is(1));
        IndexTemplateMetaData template = response.getIndexTemplates().get(0);
        CompressedString mappingStr = template.mappings().get(Constants.DEFAULT_MAPPING_TYPE);
        assertThat(mappingStr, is(notNullValue()));
        Tuple<XContentType, Map<String, Object>> typeAndMap = XContentHelper.convertToMap(mappingStr.uncompressed(), false);
        @SuppressWarnings("unchecked")
        Map<String, Object> mapping = (Map<String, Object>)typeAndMap.v2().get(Constants.DEFAULT_MAPPING_TYPE);
View Full Code Here

Examples of org.elasticsearch.action.admin.indices.template.get.GetIndexTemplatesResponse

                "  odd boolean," +
                "  prime boolean" +
                ") partitioned by (odd) with (column_policy='strict', number_of_replicas=0)");
        ensureGreen();

        GetIndexTemplatesResponse response = client().admin().indices()
                .prepareGetTemplates(PartitionName.templateName("numbers"))
                .execute().actionGet();
        assertThat(response.getIndexTemplates().size(), is(1));
        IndexTemplateMetaData template = response.getIndexTemplates().get(0);
        CompressedString mappingStr = template.mappings().get(Constants.DEFAULT_MAPPING_TYPE);
        assertThat(mappingStr, is(notNullValue()));
        Tuple<XContentType, Map<String, Object>> typeAndMap = XContentHelper.convertToMap(mappingStr.uncompressed(), false);
        @SuppressWarnings("unchecked")
        Map<String, Object> mapping = (Map<String, Object>)typeAndMap.v2().get(Constants.DEFAULT_MAPPING_TYPE);
View Full Code Here

Examples of org.elasticsearch.action.admin.indices.template.get.GetIndexTemplatesResponse

                "  odd boolean," +
                "  prime boolean" +
                ") partitioned by (odd) with (column_policy='dynamic', number_of_replicas=0)");
        ensureGreen();

        GetIndexTemplatesResponse templateResponse = client().admin().indices()
                .prepareGetTemplates(PartitionName.templateName("numbers"))
                .execute().actionGet();
        assertThat(templateResponse.getIndexTemplates().size(), is(1));
        IndexTemplateMetaData template = templateResponse.getIndexTemplates().get(0);
        CompressedString mappingStr = template.mappings().get(Constants.DEFAULT_MAPPING_TYPE);
        assertThat(mappingStr, is(notNullValue()));
        Tuple<XContentType, Map<String, Object>> typeAndMap = XContentHelper.convertToMap(mappingStr.uncompressed(), false);
        @SuppressWarnings("unchecked")
        Map<String, Object> mapping = (Map<String, Object>)typeAndMap.v2().get(Constants.DEFAULT_MAPPING_TYPE);
View Full Code Here

Examples of org.elasticsearch.action.admin.indices.template.get.GetIndexTemplatesResponse

        // partitions
        execute("insert into dynamic_table (id, score, comment) values (2,10,'this is a new column')");
        execute("insert into dynamic_table (id, score, new_comment) values (2,5,'this is a new column on a new partition')");
        execute("refresh table dynamic_table");
        ensureGreen();
        GetIndexTemplatesResponse response = client().admin().indices()
                .prepareGetTemplates(PartitionName.templateName("dynamic_table"))
                .execute().actionGet();
        assertThat(response.getIndexTemplates().size(), is(1));
        IndexTemplateMetaData template = response.getIndexTemplates().get(0);
        CompressedString mappingStr = template.mappings().get(Constants.DEFAULT_MAPPING_TYPE);
        assertThat(mappingStr, is(notNullValue()));
        Tuple<XContentType, Map<String, Object>> typeAndMap = XContentHelper.convertToMap(mappingStr.uncompressed(), false);
        @SuppressWarnings("unchecked")
        Map<String, Object> mapping = (Map<String, Object>)typeAndMap.v2().get(Constants.DEFAULT_MAPPING_TYPE);
View Full Code Here

Examples of org.elasticsearch.action.admin.indices.template.get.GetIndexTemplatesResponse

        execute("select count(*) from t");
        assertThat(response.rowCount(), is(1L));
        assertThat((Long) response.rows()[0][0], is(3L));

        GetIndexTemplatesResponse indexTemplatesResponse =
                client().admin().indices().prepareGetTemplates(".partitioned.t.").execute().actionGet();
        IndexTemplateMetaData indexTemplateMetaData = indexTemplatesResponse.getIndexTemplates().get(0);
        AliasMetaData t = indexTemplateMetaData.aliases().get("t");
        assertThat(t.alias(), is("t"));

        execute("select partitioned_by from information_schema.tables where table_name = 't'");
        assertThat(((String[]) response.rows()[0][0])[0], is("p"));
View Full Code Here

Examples of org.elasticsearch.action.admin.indices.template.get.GetIndexTemplatesResponse

        execute("alter table quotes set (number_of_shards=5)");
        waitNoPendingTasksOnAll();

        String templateName = PartitionName.templateName("quotes");
        GetIndexTemplatesResponse templatesResponse = client().admin().indices()
                .prepareGetTemplates(templateName).execute().actionGet();
        Settings templateSettings = templatesResponse.getIndexTemplates().get(0).getSettings();
        assertThat(templateSettings.getAsInt(IndexMetaData.SETTING_NUMBER_OF_SHARDS, 0), is(5));

        execute("insert into quotes (id, quote, date) values (?, ?, ?)",
                new Object[]{3, "Time is a illusion. Lunchtime doubles so", 1495961200000L}
        );
View Full Code Here

Examples of org.elasticsearch.action.admin.indices.template.get.GetIndexTemplatesResponse

  @Test
  public void test_template() {
    Client client = checkClient();

        GetIndexTemplatesResponse response = client.admin().indices().prepareGetTemplates().get();
        assertThat(response.getIndexTemplates().size(), is(1));
    }
View Full Code Here

Examples of org.elasticsearch.action.admin.indices.template.get.GetIndexTemplatesResponse

                .get();

        ClusterStateResponse clusterStateResponseUnfiltered = client().admin().cluster().prepareState().get();
        assertThat(clusterStateResponseUnfiltered.getState().metaData().templates().size(), is(greaterThanOrEqualTo(2)));

        GetIndexTemplatesResponse getIndexTemplatesResponse = client().admin().indices().prepareGetTemplates("foo_template").get();
        assertIndexTemplateExists(getIndexTemplatesResponse, "foo_template");
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.