【发布时间】:2019-07-05 12:15:49
【问题描述】:
使用@Document 将 java 对象映射到 elasticSearch 文档
@Document(createIndex = true, indexName = "djacency", type = "djacency") 公共类 djacencyDoc {
@Field(type = FieldType.Object)
private Agent agent1 = null;
}
保存前设置的类值:
类代理{ 道具6:480 prop7: 类 FAttributes7{ attr1Name : [类 FAttributes { dscp:12 发送间隔:100 填充:425 }, 类 FAttributes { dscp:14 发送间隔:100 填充:425 }] } listIps:类 RProperties { attProperties: {PRASANTA3=class AttProperty { ip: 192.168.57.39 经纪人:普拉桑塔1 dstId:普拉桑塔2 }} } ip: 192.168.57.53 ip1: 255.255.255.78 ip4: 192.168.57.187 测试ID:空 克兰:0 优先级:0 编号:p1 } 连续性:空 网络电话:空 netqr:空 }
Here "listIps" value is "RProperties" which is a Java Hashmap ,Before save it has some value but While saving into elasticsearch RProperties value is saved as null.
保存后获取类值:
Agent: class Agent2 {
prop1: true
prop2: 50000
prop3: 50000
prop4: 300
prop5: null
prop6: 480
prop7: class Agent3 {
attr1Name : [class FAttributes {
dscp: 12
txInterval: 100
padding: 425
}, class FAttributes {
dscp: 14
txInterval: 100
padding: 425
}]
}
listIps: class RProperties {
RProperties: null
}
iIp: 192.168.57.53
sunet: 255.255.255.78
gway: 192.168.57.187
testId: null
van: 0
vriority: 0
phyId: p1
}
sContinuity: null
ip: null
nQuality: null
}
Why for hashmap properties "RProperties" elasticseach saves null ? The above document is saving correctly when i am using postman or curl, But from my SpringBoot Application using Spring DATA it is not working .
【问题讨论】:
标签: java elasticsearch mapping