需要处理、获取无法确定的数据结构中,字段信息。麻烦大神来给点建议
// 有可能是这样的:
// "testIndex": { 【Index】
// "mappings": {
// "testType": { 【Type】
// "properties": {
// "testField": { 【Field字段名】
// "type": "object" 【字段类型】
// }
// }
// }
// }
// }
//也有可能是这样的:
// "testIndex": { 【Index】
// "mappings": {
// "testType": { 【Type】
// "properties": {
// "testField": { 【Field字段名】
// "properties": {
// "appprogramname": { 【嵌套的Field字段名】
// "type": "text", 【字段类型】
// "fields": { 【再嵌套的Field字段名】
// "keyword": { 【再再嵌套的Field字段名】
// "type": "keyword", 【字段类型】
// "ignore_above": 256 【字段长度】
// }
// }
// }
// }
//以上是两个例子,或者也有可能会有嵌套的更深。。。因为【无法确定】使用者,存字段的数据结构是怎样的。
//根据需求,需要拿到这样的字段信息(例):testField.appprogramname.fields.keyword
如何处理。。。我准备使用死循环进行判断,如果能强转MAP,就证明当前获取到的KEY的值又是一个MAP。。。
如果不能强转MAP,就证明当前获取到的KEY的值,不是一个MAP,而是一个String字符串。。。
但是这样写,对系统的性能消耗非常的大!!!有没有更好一点的办法呢???麻烦了。。