Skip to content

Commit

Permalink
fix: use ColumnPolicy mapping value instead of enum name
Browse files Browse the repository at this point in the history
  • Loading branch information
seut committed Nov 11, 2014
1 parent 23bedf3 commit 28f4b58
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,7 @@ public void onResponse(GetIndexTemplatesResponse response) {
Map<String, Object> mapping = new HashMap<>();
IndexTemplateMetaData template = response.getIndexTemplates().get(0);
if(analysis.columnPolicy().isPresent()){
mapping.put("dynamic", analysis.columnPolicy().get());
mapping.put("dynamic", analysis.columnPolicy().get().mappingValue());
}
mapping = mergeMapping(template, mapping);

Expand Down Expand Up @@ -465,7 +465,7 @@ public void onFailure(Throwable e) {
PutMappingRequest request = new PutMappingRequest(indices);
request.type(Constants.DEFAULT_MAPPING_TYPE);
Map<String, Object> mapping = new HashMap<>();
mapping.put("dynamic", analysis.columnPolicy().get());
mapping.put("dynamic", analysis.columnPolicy().get().mappingValue());
request.source(mapping);
final SettableFuture<?> future = SettableFuture.create();
results.add(future);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,19 @@ public void testAlterDynamicTable() throws Exception {
execute("insert into dynamic_table (id, score, new_col) values (1, 4656234.345, 'hello')");
}

@Test
public void testAlterTable() throws Exception {
execute("create table dynamic_table (" +
" id integer primary key, " +
" score double" +
") with (number_of_replicas=0, column_policy='strict')");
ensureGreen();
execute("insert into dynamic_table (id, score) values (1, 42)");
execute("alter table dynamic_table set (column_policy = 'dynamic')");
waitNoPendingTasksOnAll();
execute("insert into dynamic_table (id, score, new_col) values (2, 4656234.345, 'hello')");
}

@Test
public void testResetColumnPolicy() throws Exception {
execute("create table dynamic_table (" +
Expand Down

0 comments on commit 28f4b58

Please sign in to comment.