gpt4 book ai didi

java - [requestPayload] 的对象映射尝试将字段 [requestPayload] 解析为对象,但找到了具体值

转载 作者:太空宇宙 更新时间:2023-11-04 09:42:49 25 4
gpt4 key购买 nike

我将 JSON 字符串作为对象存储在 elasticsearch 中,但在 requestPayload 作为我们的 JSON 字符串主体的地方出现异常:[requestPayload] 的对象映射尝试将字段 [requestPayload] 解析为对象,但找到了具体值

方法如下:

@Override
public PushBookingNotification save(PushBookingNotification pushBookingNotification) {
log.debug("Request to save PushBookingNotification : {}", pushBookingNotification);
PushBookingNotification result = pushBookingNotificationRepository.save(pushBookingNotification);
pushBookingNotificationSearchRepository.save(result);
return result;
}

====实体如下=====

公共(public)类 PushBookingNotification 实现可序列化{

private static final long serialVersionUID = 1L;

@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;

@NotNull
@Column(name = "ota_hotel_id", nullable = false)
private Long otaHotelId;

@Column(name = "hotel_name")
private String hotelName;

@NotNull
@Column(name = "reference_no", nullable = false)
private String referenceNo;

@NotNull
@Type(type = "jsonb")
@Column(name = "request_payload", columnDefinition = "jsonb", nullable = false)
@Field(type = FieldType.Object)
private String requestPayload;

//getter 和 setter 方法

======错误日志======

 ERROR 10409 --- [ XNIO-2 task-11] c.atithih.cms.aop.logging.LoggingAspect  : Exception in com.atithih.cms.service.impl.PushBookingNotificationServiceImpl.save() with cause = 'NULL' and exception = 'object mapping for [requestPayload] tried to parse field [requestPayload] as object, but found a concrete value'

org.elasticsearch.index.mapper.MapperParsingException: object mapping for [requestPayload] tried to parse field [requestPayload] as object, but found a concrete value
at org.elasticsearch.index.mapper.DocumentParser.parseObjectOrNested(DocumentParser.java:350)
at org.elasticsearch.index.mapper.DocumentParser.parseObjectOrField(DocumentParser.java:465)
at org.elasticsearch.index.mapper.DocumentParser.parseValue(DocumentParser.java:591)
at org.elasticsearch.index.mapper.DocumentParser.innerParseObject(DocumentParser.java:396)
at org.elasticsearch.index.mapper.DocumentParser.parseObjectOrNested(DocumentParser.java:373)
at org.elasticsearch.index.mapper.DocumentParser.internalParseDocument(DocumentParser.java:93)
at org.elasticsearch.index.mapper.DocumentParser.parseDocument(DocumentParser.java:66)
at org.elasticsearch.index.mapper.DocumentMapper.parse(DocumentMapper.java:277)
at org.elasticsearch.index.shard.IndexShard.prepareIndex(IndexShard.java:529)
at org.elasticsearch.index.shard.IndexShard.prepareIndexOnPrimary(IndexShard.java:506)
at org.elasticsearch.action.bulk.TransportShardBulkAction.prepareIndexOperationOnPrimary(TransportShardBulkAction.java:450)
at org.elasticsearch.action.bulk.TransportShardBulkAction.executeIndexRequestOnPrimary(TransportShardBulkAction.java:458)
at org.elasticsearch.action.bulk.TransportShardBulkAction.executeBulkItemRequest(TransportShardBulkAction.java:143)
at org.elasticsearch.action.bulk.TransportShardBulkAction.shardOperationOnPrimary(TransportShardBulkAction.java:113)
at org.elasticsearch.action.bulk.TransportShardBulkAction.shardOperationOnPrimary(TransportShardBulkAction.java:69)
at org.elasticsearch.action.support.replication.TransportReplicationAction$PrimaryShardReference.perform(TransportReplicationAction.java:939)
at org.elasticsearch.action.support.replication.TransportReplicationAction$PrimaryShardReference.perform(TransportReplicationAction.java:908)
at org.elasticsearch.action.support.replication.ReplicationOperation.execute(ReplicationOperation.java:113)
at org.elasticsearch.action.support.replication.TransportReplicationAction$AsyncPrimaryAction.onResponse(TransportReplicationAction.java:322)
at org.elasticsearch.action.support.replication.TransportReplicationAction$AsyncPrimaryAction.onResponse(TransportReplicationAction.java:264)
at org.elasticsearch.action.support.replication.TransportReplicationAction$1.onResponse(TransportReplicationAction.java:888)
at org.elasticsearch.action.support.replication.TransportReplicationAction$1.onResponse(TransportReplicationAction.java:885)
at org.elasticsearch.index.shard.IndexShardOperationsLock.acquire(IndexShardOperationsLock.java:147)
at org.elasticsearch.index.shard.IndexShard.acquirePrimaryOperationLock(IndexShard.java:1657)
at org.elasticsearch.action.support.replication.TransportReplicationAction.acquirePrimaryShardReference(TransportReplicationAction.java:897)
at org.elasticsearch.action.support.replication.TransportReplicationAction.access$400(TransportReplicationAction.java:93)
at org.elasticsearch.action.support.replication.TransportReplicationAction$AsyncPrimaryAction.doRun(TransportReplicationAction.java:281)
at org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:37)
at org.elasticsearch.action.support.replication.TransportReplicationAction$PrimaryOperationTransportHandler.messageReceived(TransportReplicationAction.java:260)
at org.elasticsearch.action.support.replication.TransportReplicationAction$PrimaryOperationTransportHandler.messageReceived(TransportReplicationAction.java:252)
at org.elasticsearch.transport.RequestHandlerRegistry.processMessageReceived(RequestHandlerRegistry.java:69)
at org.elasticsearch.transport.TransportService$7.doRun(TransportService.java:644)
at org.elasticsearch.common.util.concurrent.ThreadContext$ContextPreservingAbstractRunnable.doRun(ThreadContext.java:638)
at org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:37)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)

最佳答案

为什么在字段requestPayload上有这个注解@Field(type = FieldType.Object)。也许尝试删除它,它可能会起作用。

关于java - [requestPayload] 的对象映射尝试将字段 [requestPayload] 解析为对象,但找到了具体值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55770766/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com