当前位置:   article > 正文

es映射父子关系java_es 父子关系

java 实现es父子文档的写入

curl -XPUT "http://192.168.0.39:9200/mygrade" -d '

{

"mappings": {

"grade" : {

"properties" : {

"name" : {

"type" : "string",

"store" : true

}

}

},

"mat": {

"_parent": {

"type": "grade"

}

},

"huaxue": {

"_parent": {

"type": "mat"

}

},

"wuli": {

"_parent": {

"type": "mat"

}

},

"jixie": {

"_parent": {

"type": "mat"

}

}

}

}

'

curl -XPUT "http://192.168.0.39:9200/mygrade/grade/_bulk" -d '

{ "index": { "_id": "1" }}

{ "name": "00cr12" }

{ "index": { "_id": "2" }}

{ "name": "1100" }

'

curl -XPUT "http://192.168.0.39:9200/mygrade/mat/_bulk" -d '

{ "index": { "_id": "1", "parent": "1" }}

{ "name": "00cr12的次级类别名称1" }

{ "index": { "_id": "2", "parent": "1" }}

{ "name": "00cr12的次级类别名称2" }

{ "index": { "_id": "3", "parent": "2" }}

{ "name": "1100的次级类别名称1" }

'

curl -XPUT "http://192.168.0.39:9200/mygrade/huaxue/1?parent=1&routing=1" -d '

{

"name": "00cr12列别名称1c",

"comments": "注释",

"attrs":[

{

"name": "c",

"valMin": "0",

"valMax": "12"

}

]

}

'

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/Gausst松鼠会/article/detail/456767
推荐阅读
相关标签
  

闽ICP备14008679号