-
Notifications
You must be signed in to change notification settings - Fork 1.3k
spring data elasticsearch can't deserialize "single or array" object field #2280
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
Labels
Milestone
Comments
Interesting finding while working on this: Your one-hobby case only works because Lombok is providing an all-args constructor. Using a normal POJO it fails. Glad I removed all that lombok stuff over a year ago |
sothawo
added a commit
that referenced
this issue
Aug 29, 2022
When reading from Elasticsearch into a property of type Collection<T> (List<T> or Set<T>) the MappingElasticsearchConverter now can read both from the returned JSON: an array of T objects - will put the objects in a corresponding collection a single T object will put the single object into a corrsponding colletcion This is implemented and tested for both: entities where the properties have setters and immutable classes that only provide an all-args constructor. Original Pull Request #2282 Closes #2280
sothawo
added a commit
that referenced
this issue
Aug 29, 2022
When reading from Elasticsearch into a property of type Collection<T> (List<T> or Set<T>) the MappingElasticsearchConverter now can read both from the returned JSON: an array of T objects - will put the objects in a corresponding collection a single T object will put the single object into a corrsponding colletcion This is implemented and tested for both: entities where the properties have setters and immutable classes that only provide an all-args constructor. Original Pull Request #2282 Closes #2280 (cherry picked from commit 86634ce)
sothawo
added a commit
that referenced
this issue
Aug 29, 2022
When reading from Elasticsearch into a property of type Collection<T> (List<T> or Set<T>) the MappingElasticsearchConverter now can read both from the returned JSON: an array of T objects - will put the objects in a corresponding collection a single T object will put the single object into a corrsponding colletcion This is implemented and tested for both: entities where the properties have setters and immutable classes that only provide an all-args constructor. Original Pull Request #2282 Closes #2280 (cherry picked from commit 86634ce) (cherry picked from commit 346c5cc)
Implemented in main and backported to 4.4.x and 4.3.x. |
@sothawo , please give me a resource link to read how backporting is implemented. |
check the branches 4.4.x and 4.3.x |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Uh oh!
There was an error while loading. Please reload this page.
The problem is posted here at first time.
Here is the repo i created by spring boot to reproduce it:
docker run --name es01-test --net elastic -p 9200:9200 -p 9300:9300 -e "discovery.type=single-node" -e ES_JAVA_OPTS="-Xms1024m -Xmx1024m" docker.elastic.co/elasticsearch/elasticsearch:7.12.1
;resources/insert.txt
: add 4 docs manually;mvn clean spring-boot:run
);Errors will be logged into
logs/log
.I'll also try to sovle it(if free this weekend, not guaranteed :D)
Thanks for your efforts.
The text was updated successfully, but these errors were encountered: