elasticsearch 关于nested筛选,根据inner_hits的长度过滤数据怎么实现

查询语句是:

{"from":0,"size":100,"search_after":[0],"query":{"bool":{"must":[{"term":{"sex":"女"}},{"range":{"age":{"gte":30,"lte":40}}},{"bool":{"should":[{"bool":{"must":[{"match_phrase":{"province":"辽宁省"}},{"match_phrase":{"city":"沈阳市"}}]}},{"bool":{"must":[{"match_phrase":{"province":"辽宁省"}},{"match_phrase":{"city":"抚顺市"}}]}}]}},{"nested":{"path":"orders","inner_hits":{"from":0,"size":100},"query":{"bool":{"must":[{"range":{"orders.bookingTime":{"gte":"1970-01-01 08:00:00","lte":"2021-08-13 23:59:59","format":"yyyy-MM-dd HH:mm:ss"}}},{"terms":{"orders.ticketId":[530535]}},{"terms":{"orders.bookingChannelId":[19]}}]}}}}]}},"sort":"_id","_source":{"excludes":["orders"]}}

我想实现只返回inner_hits里面_source数组长度为1的数据。
es结构

{
  "settings": {
    "number_of_shards": 1,
    "number_of_replicas": 0
  },
  "mappings": {
    "properties": {
      "mobile": {
        "type": "keyword"
      },
      "name": {
        "type": "keyword"
      },
      "sex": {
        "type": "keyword"
      },
      "age": {
        "type": "integer"
      },
      "province": {
        "type": "keyword"
      },
      "city": {
        "type": "keyword"
      },
      "idcard": {
        "type": "keyword"
      },
      "repurchase": {
        "type": "byte"
      },
      "createdAt": {
        "type": "date",
        "format": "yyyy-MM-dd HH:mm:ss"
      },
      "updatedAt": {
        "type": "date",
        "format": "yyyy-MM-dd HH:mm:ss"
      },
      "orders": {
        "type": "nested",
        "properties": {
          "orderId": {
            "type": "keyword"
          },
          "ticketId": {
            "type": "keyword"
          },
          "ticketFullname": {
            "type": "text"
          },
          "bookingTime": {
            "type": "date",
            "format": "yyyy-MM-dd HH:mm:ss"
          },
          "bookingChannelId": {
            "type": "integer"
          },
          "bookingChannelName": {
            "type": "keyword"
          },
          "orderPayAmount": {
            "type": "integer"
          },
          "bookingNum": {
            "type": "integer"
          },
          "orderStatusText": {
            "type": "keyword"
          },
          "orderStatus": {
            "type": "byte"
          },
          "vertifyTime": {
            "type": "date",
            "format": "yyyy-MM-dd HH:mm:ss"
          },
          "bookingPrice": {
            "type": "integer"
          },
          "isAround": {
            "type": "byte"
          },
          "landType": {
            "type": "keyword"
          },
          "landId": {
            "type": "integer"
          },
          "landName": {
            "type": "keyword"
          },
          "landPublisherId": {
            "type": "integer"
          },
          "landPublisherName": {
            "type": "keyword"
          }
        }
      }
    }
  }
}

测试数据:

"id" : 13804230283,
          "mobile" : "13804230283",
          "name" : "王佳鑫",
          "sex" : "女",
          "age" : 25,
          "province" : "辽宁省",
          "city" : "抚顺市",
          "cratedAt" : "2021-08-23 19:46:44",
          "updatedAt" : "2021-08-23 19:47:44",
          "orders" : [
            {
              "landName" : "开心旦高预留票",
              "bookingTime" : "2021-03-25 22:15:44",
              "orderId" : "61668174412953",
              "bookingChannelName" : "平台预定",
              "orderStatus" : 1,
              "vertifyTime" : "2021-03-31 13:13:56",
              "bookingChannelId" : 0,
              "orderPayAmount" : 9000,
              "orderStatusText" : "已使用,特产时为确认收货",
              "landId" : 227917,
              "landPublisherName" : "孟祥坤",
              "bookingPrice" : 9000,
              "landPublisherId" : 433028,
              "ticketFullname" : "开心旦高预留票-99元亲子双次票(额外赠送2瓶饮品+2个蛋挞,每次可以领取一套(一个饮品、一个蛋挞))",
              "isAround" : 1,
              "bookingNum" : 1,
              "landType" : "A",
              "ticketId" : 836684
            },
            {
              "landName" : "抚顺皇家海洋极地乐园-皇家极地海洋馆",
              "bookingTime" : "2021-03-08 21:04:00",
              "orderId" : "61520864015830",
              "bookingChannelName" : "平台预定",
              "orderStatus" : 1,
              "vertifyTime" : "2021-03-16 10:35:06",
              "bookingChannelId" : 0,
              "orderPayAmount" : 33500,
              "orderStatusText" : "已使用,特产时为确认收货",
              "landId" : 126712,
              "landPublisherName" : "孟祥坤",
              "bookingPrice" : 33500,
              "landPublisherId" : 433028,
              "ticketFullname" : "抚顺皇家海洋极地乐园-皇家极地海洋馆-牛气冲天生肖卡(年卡)",
              "isAround" : 1,
              "bookingNum" : 1,
              "landType" : "A",
              "ticketId" : 775899
            }
          ],
          "repurchase" : 2
        }
讨论数量: 0
(= ̄ω ̄=)··· 暂无内容!

讨论应以学习和精进为目的。请勿发布不友善或者负能量的内容,与人为善,比聪明更重要!