好的想法是十分钱一打,真正无价的是能够实现这些想法的人。

请问json格式的内容如何做为整个field导入es?导入一直报错,见正文

Elasticsearch | 作者 showme | 发布于2016年01月23日 | 阅读数:4031

json格式的内容如何做为整个field导入es?导入一直报错,见正文错误信息:message [MapperParsingException[object mapping for [ipport] tried to parse field [p443] as object, but got EOF, has a concrete value been provided to it?]]
 
要导入的jason内容
{"https":{"tls":{"certificate":{"parsed":{"extensions":{"authority_key_id":"734b32187f64eb14be6bdeb9374157923a094f26","basic_constraints":{"is_ca":true},"certificate_policies":[],"subject_alt_name":{"dns_names":["brg_mel02_3560x.bigredgroup.net.au"]},"subject_key_id":"c0syGH9k6xS+a965N0FXkjoJTyY="},"fingerprint_md5":"9d6812d2c45580a1fad769d48e0a9a79","fingerprint_sha1":"3679354efbacc74210ec3a70ab5c74a84baf692f","fingerprint_sha256":"5ec10bb9eab701d9f736648c8e21ed710a7b54727bc0534180b3cf828f54edad","issuer":{"common_name":["IOS-Self-Signed-Certificate-1219314944"]},"issuer_dn":"CN=IOS-Self-Signed-Certificate-1219314944","serial_number":"1","signature":{"self_signed":true,"signature_algorithm":{"name":"MD5WithRSA","oid":"1.2.840.113549.1.1.4"},"valid":false,"value":"uFYXP2hgoSKEceh8N75SSzhLZobdWH5nMk4ghZJ2VLhwxgfKBxoZfBzYW0UXC16IkVhfj0+NgsF/Z1luo74Q8WdzOcaIVX8uEoqU0Lr6cysfobDein4J8/s+xkygBAIIoTDGCzmF5aEMKrApeBC8u0O8GK9y/CoQyIb02S+HJKo="},"signature_algorithm":{"name":"MD5WithRSA","oid":"1.2.840.113549.1.1.4"},"subject":{"common_name":["IOS-Self-Signed-Certificate-1219314944"]},"subject_dn":"CN=IOS-Self-Signed-Certificate-1219314944","subject_key_info":{"key_algorithm":{"name":"RSA","oid":""},"rsa_public_key":{"exponent":65537,"length":1024,"modulus":"v7ll3aCkEPA7IqQZZT7B+OsyHT+81munNSPhf9Jl6M4RzsljcQLjPT1rqVwUibGOI+H4ac2flt0WZN2mH74LA+SzS2gMF92e9byfj8FcY0Bhg9nhmLYZ9vBnaxg1YBWTUO2G0lIo+hu79ZTSJF/YfPoXGxelQxY5UfYTo/CYknE="}},"validity":{"end":"2020-01-01T00:00:00Z","start":"1993-03-01T00:03:29Z"},"version":3}},"cipher_suite":{"id":"0x0005","name":"TLS_RSA_WITH_RC4_128_SHA"},"metadata":{},"ocsp_stapling":false,"validation":{"browser_error":"x509: certificate signed by unknown authority (possibly because of "x509: cannot verify signature: algorithm unimplemented" while trying to verify candidate authority certificate "IOS-Self-Signed-Certificate-1219314944")","browser_trusted":false},"version":"SSLv3"},"heartbleed":{"heartbeat_enabled":false,"heartbleed_vulnerable":false,"metadata":{}},"ssl_3":{"metadata":{},"support":true},"rsa_export":{"metadata":{},"support":false},"dhe_export":{"metadata":{},"support":false},"dhe":{"metadata":{},"support":false}}}
 
已邀请:

zttech

赞同来自:

这么长的json,给你两个建议
1. 首先要validate你的json, 因为你的json我检查过是错误的
2. 其次设置mapping dynamic为true吧

showme

赞同来自:

非常感谢,我今天有再分析了这个问题
这条数据是mysql某个字段的值,这个数据库字段的值基本都是这种json格式,每个这样的值我想做为一个field存入es,导入的时候es能自动识别为json,也相应的mapping数据类型为json,当导入这条数据时发生某些json格式不一样,所以报错
目前我想到的解决办法是
1.自定义mapping为string , 并且关闭es的自动数据类型识别
2.再就是直接修改数据,变成不是json格式,比如每个值开头加个字符
第一种请问要如何配置?
请问validate有什么快捷的工具?
 

jiaofuyou

赞同来自:

http://jsonlint.com/
可以验证你的json是错误的
 
            "validation": {
                "browser_error": "x509: certificate signed by unknown authority (possibly because of "
                x509: cannot verify signature: algorithm unimplemented " while trying to verify candidate authority certificate "
                IOS - Self - Signed - Certificate - 1219314944 ")",
                "browser_trusted": false
            },
 
这段数据不对

要回复问题请先登录注册