解决:Elasticsearch failed to map source

解决:Elasticsearch failed to map source

Error message

[INFO] Results:
[INFO] 
[ERROR] Errors: 
[ERROR]   CarDoaTest.testQueryByAggs:57 » Elasticsearch failed to map source [ {"color":...
[INFO] 
[ERROR] Tests run: 11, Failures: 0, Errors: 1, Skipped: 0

Screenshot:
Insert picture description here

analysis

As you can see, something went wrong in the use of generics

In class Car, there is only parameter construction, and no parameterless construction, but jackson deserialization needs to use parameterless construction, so it will report an error

Solution

Just add a parameterless constructor

Insert picture description here

effect

Insert picture description here

testing successfully!

Guess you like

Origin blog.csdn.net/weixin_44829930/article/details/108880833