-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Specify serialization for a field inside a Document #1
Labels
Comments
Think it is not possible. The problem appears when dealing with sub-documents and sub-fields: class NameSubFields<V>(field: BoundField<V>) : SubFields<V>(field) {
val sort by keyword()
} Now imagine these variants: object ProductDoc : Document() {
val name: NameSubFields<String?> by text().subFields(::NameSubFields)
} object ProductDocV2 : Document() {
// `::NameSubFields` has type of `(BoundField<String>) -> NameSubFields<String?>`
val name: NameSubFields<String> by text().subFields(::NameSubFields)
// What type should return `required`? We cannot transform `NameSubFields<String?>` into `NameSubFields<String>`
.required()
} |
An example how it could be implemented: https://gist.github.com/anti-social/1a36d715ca8d8080c56a84bda0af2cc8 |
Such a scheme has some drawbacks:
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
At the moment
Document
describes Elasticsearch field types:And concrete serialization is specified inside a document source:
Consider to specify serialization when describing a
Document
:The text was updated successfully, but these errors were encountered: