-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Add annotation similar to @JsonUnwrapped on document fields #2774
Comments
When pulling out the properties from a map into the entity that contains the map, how should this work when reading entities from Elasticsearch? This works when writing data, but on reading it is not possible to determine which of the fields returned from Elasticsearch should go into properties and which into the map, there is no general way to determine where What would happen on writing, when an entity has a property |
Hmm yes you're right: the issue is on serialization from JSON to POJO. So this should be possible to save on ElasticSearch: {
// other document fields above
"code1_str":"value1",
"code2_str":"other-value"
// other document fields below
} While this should throw a RuntimeException before even saving into ElasticSearch, because of ambiguous mapping: P.S.: Don't mind the @dynamic annotation since it's Solr related. |
We'd need to use some new annotation to prevent a mappping to be written for these fields. That idea probably will work. I'm not yet sure if this can be done only for primitive types in the map like |
I wouldn't use a generic value for the map.. at least not for a 1st version :) |
You can use the After that the converter should handle the de/serialization process between the Elasticsearch request/response and the Document (Java object) to manage this definition. |
This is a feature request.
I'm migrating a platform from Apache Solr to ElasticSearch and I'm struggling in creating dynamic fields like Apache Solr used to have. I need facets (aka "aggregations" in ElasticSearch) on these dynamic fields. On Solr that was easily done with an annotation on a Map:
Instead, with ElasticSearch, I need to create a dynamic template for the index like this:
The main issue is that when I now save a document having
, Spring is inputting a payload like
and I can't do any aggregation query to get a result like
The workaround for this issue is atm a custom Spring
Converter<S, T>
for the entire document: immagine having to convert 20 or 30 fields.. this would take a lot of work just because of 1 field serialization/deserialization issue.A solution could be found Instead in having something like
@JsonUnwrapped
annotation from Jackson library to remove the attributes level from the payload, leading to Spring inputting a payload like:Could this be feasible in an upcoming release?
The text was updated successfully, but these errors were encountered: