Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ public void testEnableFieldData() throws IOException {
throw new UnsupportedOperationException();
}).build(null, null));
assertThat(exc.getMessage(), containsString(IndicesService.INDICES_ID_FIELD_DATA_ENABLED_SETTING.getKey()));
assertFalse(ft.isAggregatable());

client().admin().cluster().prepareUpdateSettings()
.setTransientSettings(Settings.builder().put(IndicesService.INDICES_ID_FIELD_DATA_ENABLED_SETTING.getKey(), true))
Expand All @@ -97,6 +98,7 @@ public void testEnableFieldData() throws IOException {
throw new UnsupportedOperationException();
}).build(null, null);
assertWarnings(ID_FIELD_DATA_DEPRECATION_MESSAGE);
assertTrue(ft.isAggregatable());
} finally {
// unset cluster setting
client().admin().cluster().prepareUpdateSettings()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,12 @@ public void testTermsQuery() {
Query query = ft.termQuery("id", context);
assertEquals(new TermInSetQuery("_id", Uid.encodeId("id")), query);
}

public void testIsAggregatable() {
MappedFieldType ft = new IdFieldMapper.IdFieldType(() -> false);
assertFalse(ft.isAggregatable());

ft = new IdFieldMapper.IdFieldType(() -> true);
assertTrue(ft.isAggregatable());
}
}