|
@@ -530,9 +530,16 @@ public class TextFieldMapperTests extends MapperTestCase {
|
|
MapperService disabledMapper = createMapperService(fieldMapping(this::minimalMapping));
|
|
MapperService disabledMapper = createMapperService(fieldMapping(this::minimalMapping));
|
|
Exception e = expectThrows(
|
|
Exception e = expectThrows(
|
|
IllegalArgumentException.class,
|
|
IllegalArgumentException.class,
|
|
- () -> disabledMapper.fieldType("field").fielddataBuilder(FieldDataContext.noRuntimeFields("test"))
|
|
|
|
|
|
+ () -> disabledMapper.fieldType("field")
|
|
|
|
+ .fielddataBuilder(new FieldDataContext("index", null, null, MappedFieldType.FielddataOperation.SEARCH))
|
|
|
|
+ );
|
|
|
|
+ assertThat(
|
|
|
|
+ e.getMessage(),
|
|
|
|
+ containsString(
|
|
|
|
+ "Fielddata is disabled on [field] in [index]. "
|
|
|
|
+ + "Text fields are not optimised for operations that require per-document field data"
|
|
|
|
+ )
|
|
);
|
|
);
|
|
- assertThat(e.getMessage(), containsString("Text fields are not optimised for operations that require per-document field data"));
|
|
|
|
|
|
|
|
MapperService enabledMapper = createMapperService(fieldMapping(b -> b.field("type", "text").field("fielddata", true)));
|
|
MapperService enabledMapper = createMapperService(fieldMapping(b -> b.field("type", "text").field("fielddata", true)));
|
|
enabledMapper.fieldType("field").fielddataBuilder(FieldDataContext.noRuntimeFields("test")); // no exception
|
|
enabledMapper.fieldType("field").fielddataBuilder(FieldDataContext.noRuntimeFields("test")); // no exception
|