我有父子映射。我可以在elasticsearch的查询中动态分配值吗?我希望每个父级评估max_children
和min_children
。我尝试过类似的东西,但它不起作用:
"min_children": {
"script": "doc['boxes_count'].value"
},
"max_children": {
"script": "doc['boxes_count'].value"
}
当前查询看起来像这样,并且实际上正在运行
curl -XPOST 'localhost:9200/star_cars_development_car_washes/_search?pretty' -d '
{
"query": {
"has_child" : {
"type" : "reservation",
"min_children": 10,
"max_children": 10,
"query": {
"filtered": {
"filter": {
"bool": {
"must": [
{
"range": {
"date": {"lte": "2015-07-21T03:36:00.000+03:00"}
}
},
{
"range": {
"ends_at": {"gte": "2015-07-21T03:36:00.000+03:00"}
}
}
]
}
}
}
}
}
}
}'