Spark Scala - How to construct Scala Map from nested JSON?
问题 I've a nested json data with nested fields that I want to extract and construct a Scala Map. Heres the sample JSON: "nested_field": [ { "airport": "sfo", "score": 1.0 }, { "airport": "phx", "score": 1.0 }, { "airport": "sjc", "score": 1.0 } ] I want to use saveToES() and construct a Scala Map to index the field into ES index with mapping as below: "nested_field": { "properties": { "score": { "type": "double" }, "airport": { "type": "keyword", "ignore_above": 1024 } } } The json file is read