cannot write xcontent for unknown value of type class com.google.gson.internal.LazilyParsedNumber
java.lang.IllegalArgumentException: cannot write xcontent for unknown value of type class com.google.gson.internal.LazilyParsedNumberat org.elasticsearch.common.xcontent.XContentBuilder.unknownValue(X
·
java.lang.IllegalArgumentException: cannot write xcontent for unknown value of type class com.google.gson.internal.LazilyParsedNumber
at org.elasticsearch.common.xcontent.XContentBuilder.unknownValue(XContentBuilder.java:825)
at org.elasticsearch.common.xcontent.XContentBuilder.map(XContentBuilder.java:887)
at org.elasticsearch.common.xcontent.XContentBuilder.map(XContentBuilder.java:862)
at org.elasticsearch.action.index.IndexRequest.source(IndexRequest.java:443)
at org.elasticsearch.action.index.IndexRequest.source
报错信息如上,错误背景:
从json文件中读取对象时,value为 int 或 float 时(应该包含其他数字类型),如果要转换成google的Gson对象,会报如上错误。
解决方案:去除该字段或用双引号包裹转成String即可
更多推荐
所有评论(0)