怎么又是你

关于ES Java Client的一个问题

Elasticsearch | 作者 Charele | 发布于2024年03月28日 | 阅读数:2874

https://www.elastic.co/guide/e ... .html
 
它上面的这个Product类要实现什么接口吗?随便定义一个就行?
1111.PNG

 
已邀请:

Charele - Cisco4321

赞同来自:

Caused by: com.fasterxml.jackson.databind.exc.InvalidDefinitionException: No serializer found for class test2$Product and no properties discovered to create BeanSerializer (to avoid exception, disable SerializationFeature.FAIL_ON_EMPTY_BEANS)
at com.fasterxml.jackson.databind.exc.InvalidDefinitionException.from(InvalidDefinitionException.java:77)
at com.fasterxml.jackson.databind.SerializerProvider.reportBadDefinition(SerializerProvider.java:1308)
at com.fasterxml.jackson.databind.DatabindContext.reportBadDefinition(DatabindContext.java:414)
at com.fasterxml.jackson.databind.ser.impl.UnknownSerializer.failForEmpty(UnknownSerializer.java:53)
at com.fasterxml.jackson.databind.ser.impl.UnknownSerializer.serialize(UnknownSerializer.java:30)
at com.fasterxml.jackson.databind.ser.DefaultSerializerProvider._serialize(DefaultSerializerProvider.java:479)
at com.fasterxml.jackson.databind.ser.DefaultSerializerProvider.serializeValue(DefaultSerializerProvider.java:318)
at com.fasterxml.jackson.databind.ObjectMapper.writeValue(ObjectMapper.java:3303)
at co.elastic.clients.json.jackson.JacksonJsonpMapper.serialize(JacksonJsonpMapper.java:86)
 
百度找了一圈也没有答案,好像别人也没提这个是怎么定义的?
好怀念以前的High level

God_lockin

赞同来自:

看下他们官方的test
https://github.com/elastic/ela ... ation
 
 

mryu

赞同来自:

序列化出错了可以按照他的建议试一下,disable SerializationFeature.FAIL_ON_EMPTY_BEANS)
可能是序列化后的json格式和mapping不匹配

要回复问题请先登录注册