UnModellableObject
Terminal object field representing an unmodellable type in an Elasticsearch document.
This class is automatically generated by the Metalastic annotation processor when it encounters a field that cannot be fully modeled into a type-safe metamodel structure. This typically occurs with complex generic types, collections without concrete element types, or types that don't have a corresponding @Document or analyzable class definition.
When This Is Generated
The processor generates an UnModellableObject when:
The field's target type cannot be resolved to a concrete class
The field uses complex generics that cannot be statically analyzed
The field references a type without
@FieldannotationsThe field's type is a collection with unknown element structure
The type is from an external library without metamodel support
Example Scenarios
Dynamic/Generic Collections
@Document(indexName = "product")
data class Product(
@Field(type = FieldType.Keyword)
val id: String,
@Field(type = FieldType.Object)
val metadata: Map<String, Any> // Cannot model arbitrary key-value pairs
)External Types Without Metamodel
@Document(indexName = "order")
data class Order(
@Field(type = FieldType.Keyword)
val id: String,
@Field(type = FieldType.Object)
val thirdPartyData: ExternalLibraryClass // No @Field annotations available
)Generated metamodel:
class QProduct<T : Any?>(
parent: ObjectField<*>? = null,
name: String = "",
nested: Boolean = false,
fieldType: KType
) : Document<T>(...) {
@JvmField
val id: KeywordField<String> = keywordField("id")
// Terminates here since Map<String, Any> structure is unknown at compile time
@JvmField
val metadata: UnModellableObject<Map<String, Any>> =
UnModellableObject(this, "metadata", false, typeOf<Map<String, Any>>())
}Usage
You can still use the field for basic path construction:
val product = Metamodels.product
product.metadata.path() // Returns "metadata"
product.metadata.isNestedPath() // Works correctlyHowever, you cannot traverse into the field's internal structure since the processor couldn't generate a type-safe metamodel for it.
Parameters
The parent object field in the hierarchy
The Elasticsearch field name
Whether this field is marked as nested in Elasticsearch
The Kotlin type information for runtime type safety
Type Parameters
The type of the unmodellable field
See also
Functions
Declares a child AliasField named fieldName, modeling the alias field type.
Declares a child AnnotatedTextField named fieldName, modeling the annotated_text field type.
Declares a child BinaryField named fieldName, modeling the binary field type.
Declares a child BooleanField named fieldName, modeling the boolean field type.
Declares a child CompletionField named fieldName, modeling the completion field type.
Declares a child ConstantKeywordField named fieldName, modeling the constant_keyword field type.
Declares a child DateNanosField named fieldName, modeling the date_nanos field type.
Declares a child DateRangeField named fieldName, modeling the date_range field type.
Declares a child DenseVectorField named fieldName, modeling the dense_vector field type.
Declares a child DoubleField named fieldName, modeling the double field type.
Declares a child DoubleRangeField named fieldName, modeling the double_range field type.
Returns the KClass for this field's type, or null if the type is not a concrete class (e.g., if it's a type parameter or complex type intersection).
Declares a child FlattenedField named fieldName, modeling the flattened field type.
Declares a child FloatField named fieldName, modeling the float field type.
Declares a child FloatRangeField named fieldName, modeling the float_range field type.
Declares a child HalfFloatField named fieldName, modeling the half_float field type.
Declares a child IntegerField named fieldName, modeling the integer field type.
Declares a child IntegerRangeField named fieldName, modeling the integer_range field type.
Declares a child IpRangeField named fieldName, modeling the ip_range field type.
Returns true if any ancestor container is marked as nested in Elasticsearch.
Declares a child KeywordField named fieldName, modeling the keyword field type.
Declares a child LongRangeField named fieldName, modeling the long_range field type.
Declares a child MatchOnlyTextField named fieldName, modeling the match_only_text field type.
Declares a child Murmur3Field named fieldName, modeling the murmur3 field type.
Returns the paths of the ancestor containers that are marked as nested, closest first.
Returns the direct parent container in the metamodel hierarchy, or null for a root.
Declares a child PercolatorField named fieldName, modeling the percolator field type.
Declares a child PointField named fieldName, modeling the point field type.
Declares a child RankFeatureField named fieldName, modeling the rank_feature field type.
Declares a child RankFeaturesField named fieldName, modeling the rank_features field type.
Declares a child ScaledFloatField named fieldName, modeling the scaled_float field type.
Declares a child SearchAsYouTypeField named fieldName, modeling the search_as_you_type field type.
Declares a child ShapeField named fieldName, modeling the shape field type.
Declares a child ShortField named fieldName, modeling the short field type.
Declares a child TokenCountField named fieldName, modeling the token_count field type.
Declares a child VersionField named fieldName, modeling the version field type.
Declares a child WildcardField named fieldName, modeling the wildcard field type.