     private static let MODIFIER = "modifier"
     private static let MISSING = "missing"
     
-    public var name: String = "field_value_factor"
-    
-    var field: String
-    var factor: Decimal
-    var modifier: Modifier?
-    var missing: Decimal?
-    
-    public init(withBuilder builder: FieldValueFactorFunctionBuilder) {
-        self.field = builder.field!
-        self.factor = builder.factor!
-        self.modifier = builder.modifier
-        self.missing = builder.missing
+    public let name: String = "field_value_factor"
+    
+    public let field: String
+    public let factor: Decimal
+    public let modifier: Modifier?
+    public let missing: Decimal?
+    
+    public init(field: String, factor: Decimal, modifier: FieldValueScoreFunction.Modifier? = nil, missing: Decimal? = nil) {
+        self.field = field
+        self.factor = factor
+        self.modifier = modifier
+        self.missing = missing
+    }
+    
+    internal convenience init(withBuilder builder: FieldValueFactorFunctionBuilder) throws {
+        
+        guard builder.field != nil else {
+            throw ScoreFunctionBuilderError.missingRequiredField("field")
+        }
+        
+        guard builder.factor != nil else {
+            throw ScoreFunctionBuilderError.missingRequiredField("factor")
+        }
+        
+        self.init(field: builder.field!, factor: builder.factor!, modifier: builder.modifier, missing: builder.missing)
     }
     
     public func toDic() -> [String : Any] {


import Foundation
import ElasticSwiftCore

public class ScoreFunctionBuilders {
    

        return FieldValueFactorFunctionBuilder()
    }
    
}

// MARK:- ScoreFunctionBuilder Protocol

public protocol ScoreFunctionBuilder {
    
