Elasticsearch:范围查询嵌套数组匹配数

时间:2019-07-03 17:09:42

标签: elasticsearch

我将房间对象存储在这样的索引中:

{
"name":"room1",
"availability":"10",
"reservations": [
    {
        "start_date": "2019-09-12",
        "end_date": "2019-09-15",
    },
    {
        "start_date": "2019-09-17",
        "end_date": "2019-09-19"
    }
]}

给出新的 startDate endDate , 如何匹配 room.availability 大于 与这些日期重叠的预订数量?

1 个答案:

答案 0 :(得分:0)

您是否尝试过使用范围查询和脚本查询仅根据您的谓词返回文档?

elastic.co/guide/zh-CN/elasticsearch/reference/current/query-dsl-script-query.html