_parent,_routing 元字段
_parent field
curl -XPUT 'localhost:9200/my_index?pretty' -H 'Content-Type: application/json' -d'
{
"mappings": {
"my_parent": {},
"my_child": {
"_parent": {
"type": "my_parent" # 1
}
}
}
}
'
curl -XPUT 'localhost:9200/my_index/1/1?pretty' -H 'Content-Type: application/json' -d' # 2
{
"text": "This is a parent document"
}
'
curl -XPUT 'localhost:9200/my_index/my_child/2?parent=1&pretty' -H 'Content-Type: application/json' -d' # 2
{
"text": "This is a child document"
}
'
curl -XPUT 'localhost:9200/my_index/my_child/3?parent=1&refresh=true&pretty' -H 'Content-Type: application/json' -d' # 4
{
"text": "This is another child document"
}
'
curl -XGET 'localhost:9200/my_index/my_parent/_search?pretty' -H 'Content-Type: application/json' -d'
{
"query": {
"has_child": { # 5
"type": "my_child",
"query": {
"match": {
"text": "child document"
}
}
}
}
}
'Parent-child restrictionsedit (父子限制)
Global ordinals (全局序列)
_routing field
Searching with custom routing(使用自定义路由搜索)
Making a routing value required(路由值的要求)
Unique IDs with custom routing(具有自定义路由的唯一ID)
Routing to an index partition(路由到索引分区)
Last updated