Reputation: 21
Help with this error please..
MapperParsingException[failed to parse]; nested: IllegalArgumentException[mapper [fareDetails.result.originDestinationOptions.flightSegments.fareDetails.taxDetails.farePrice] of different type, current_type [double], merged_type [long]];
at org.elasticsearch.index.mapper.DocumentParser.innerParseDocument(DocumentParser.java:163)
at org.elasticsearch.index.mapper.DocumentParser.parseDocument(DocumentParser.java:79)
at org.elasticsearch.index.mapper.DocumentMapper.parse(DocumentMapper.java:304)
at org.elasticsearch.index.shard.IndexShard.prepareIndex(IndexShard.java:547)
at org.elasticsearch.index.shard.IndexShard.prepareIndexOnPrimary(IndexShard.java:529)
at org.elasticsearch.action.index.TransportIndexAction.prepareIndexOperationOnPrimary(TransportIndexAction.java:211)
at org.elasticsearch.action.index.TransportIndexAction.executeIndexRequestOnPrimary(TransportIndexAction.java:223)
at org.elasticsearch.action.index.TransportIndexAction.shardOperationOnPrimary(TransportIndexAction.java:157)
at org.elasticsearch.action.index.TransportIndexAction.shardOperationOnPrimary(TransportIndexAction.java:65)
at org.elasticsearch.action.support.replication.TransportReplicationAction$PrimaryPhase.doRun(TransportReplicationAction.java:595)
at org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:37)
at org.elasticsearch.action.support.replication.TransportReplicationAction$PrimaryOperationTransportHandler.messageReceived(TransportReplicationAction.java:263)
at org.elasticsearch.action.support.replication.TransportReplicationAction$PrimaryOperationTransportHandler.messageReceived(TransportReplicationAction.java:260)
at org.elasticsearch.transport.TransportService$4.doRun(TransportService.java:350)
at org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:37)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
because i used bigdecimal type on that object without add anotation @Field(type = FieldType.Double)
is there any way configure default FieldType.Double for bigdecimal ? or we need add field anotation each bigdecimal
Upvotes: 1
Views: 504
Reputation: 21
the problem is in my deserealization jackson.. fix by add this
public class BigDecimalMoneyDeserializer extends JsonDeserializer {
@Override
public BigDecimal deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException {
return jp.getDecimalValue().setScale(2, BigDecimal.ROUND_HALF_UP);
}
}
Upvotes: 1