如何在elasticsearch查询中动态分配值?

时间:2015-07-07 11:47:45

标签: elasticsearch

我有父子映射。我可以在elasticsearch的查询中动态分配值吗?我希望每个父级评估max_childrenmin_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"}
                  }
                }
              ]
            }
          }
        }
      }
    }
  }
}'

0 个答案:

没有答案