Spark import es join type

(Zhang) #1

es6.X version URL:
This is a join type mapping
"mainmember" ]

Import parent document to set my_join_field value to company

But importing a child document requires specifying the name of routing and my_join_field and the parent of the parent document.

For example:

1PUT my_join_index/_doc/3?routing=1&refresh
3 "text": "This is an answer",
4 "my_join_field": {
5 "name": "answer",
6 "parent": "1"
7 }

I want to use Scala to write import subdocument code,But when I write my_join_field, I don't know what to write.

My example:

var mp = Map("name"->"answer","parent"->"1")
        var js= Json(DefaultFormats).write(mp)
        val numbers = Map("my_join_field" -> js ,"companyKeyNoM" -> "123132321321", "companyNames" -> "甘肃伊仁工贸有限公司","Plaintiff"->"兰州银行股份有限公司兰园支行","Defendant"->"马占义","Court"->"甘肃省兰州市中级人民法院","Type"->"裁判文书","Content"->"马占义:本院受理原告兰州银行股份有限公司兰园支行诉甘肃伊仁工贸有限公司、临夏州鑫盛民族用品有限责任公司、丁乃比由、马孝仁、丁而乃、马占义、马福华、马小荣、马小文、马如海借款合同纠纷一案,现已审理终结。现依法向你们公告送达本院(2016)甘01民初147号民事判决书。限你自公告之日起60日内来本院民事审判第二庭领取该民事判决书,逾期则视为送达。如不服本判决,可在判决书送达之日起十五日内,向本院递交上诉状,并按照对方当事人的人数提出副本,上诉于甘肃省高级人民法院。","Date"->"2017-10-12")
        val mapRDD = sc.makeRDD(Seq(numbers))

but throw Exception:
failed to parse; illegal_argument_exception: unknown join name [{"name":"1231231","parent":"12313123"}] for field [my_join_field]

Please tell me how to write the value of this field in scala code when importing join type


(system) closed #2

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.