protected AbstractIndexOrdinalsFieldData( Index index, Settings indexSettings, Names fieldNames, FieldDataType fieldDataType, IndexFieldDataCache cache, CircuitBreakerService breakerService) { super(index, indexSettings, fieldNames, fieldDataType, cache); final Map<String, Settings> groups = fieldDataType.getSettings().getGroups("filter"); frequency = groups.get("frequency"); regex = groups.get("regex"); this.breakerService = breakerService; }
public <IFD extends IndexFieldData<?>> IFD getForField(FieldDataType type, String fieldName) { final FieldMapper<?> mapper; final BuilderContext context = new BuilderContext(indexService.settingsService().getSettings(), new ContentPath(1)); if (type.getType().equals("string")) { mapper = MapperBuilders.stringField(fieldName) .tokenized(false) .fieldDataSettings(type.getSettings()) .build(context); } else if (type.getType().equals("float")) { mapper = MapperBuilders.floatField(fieldName).fieldDataSettings(type.getSettings()).build(context); } else if (type.getType().equals("double")) { mapper = MapperBuilders.doubleField(fieldName) .fieldDataSettings(type.getSettings()) .build(context); } else if (type.getType().equals("long")) { mapper = MapperBuilders.longField(fieldName).fieldDataSettings(type.getSettings()).build(context); } else if (type.getType().equals("int")) { mapper = MapperBuilders.integerField(fieldName) .fieldDataSettings(type.getSettings()) .build(context); } else if (type.getType().equals("short")) { mapper = MapperBuilders.shortField(fieldName).fieldDataSettings(type.getSettings()).build(context); } else if (type.getType().equals("byte")) { mapper = MapperBuilders.byteField(fieldName).fieldDataSettings(type.getSettings()).build(context); } else if (type.getType().equals("geo_point")) { mapper = MapperBuilders.geoPointField(fieldName) .fieldDataSettings(type.getSettings()) .build(context); } else if (type.getType().equals("_parent")) { mapper = MapperBuilders.parent().type(fieldName).build(context); } else if (type.getType().equals("binary")) { mapper = MapperBuilders.binaryField(fieldName) .fieldDataSettings(type.getSettings()) .build(context); } else { throw new UnsupportedOperationException(type.getType()); } return ifdService.getForField(mapper); }