spark如何解析还有内嵌的json
比如:
{
"_index": "nginxacc-2016.09.30",
"_type": "logs",
"_id": "AVd6G5gNfVF4aGz4f2fE",
"_version": 1,
"_score": 1,
"_source": {
"@timestamp": "2016-09-30T00:00:09.000Z",
"clientip": "42.122.1.97",
"status": "200",
"@version": "1",
"geoip": {
"ip": "42.122.1.97",
"country_code2": "CN",
"country_code3": "CHN",
"country_name": "China",
"continent_code": "AS",
"region_name": "28",
"city_name": "Tianjin",
"latitude": 39.1422,
"longitude": 117.17669999999998,
"timezone": "Asia/Shanghai",
"real_region_name": "Tianjin",
"location": [
117.17669999999998
,
39.1422
]
}
}
}geoip这个字段里的内容无法获取到spark dataframe 当中。
请大神们帮帮忙