Elasticsearch搜索大于值的和

时间:2016-07-26 10:30:42

标签: elasticsearch

查询 - 查找有占用的游轮。

我需要在ElastcSearch中搜索所有(total_occupancy - current_occupancy)小屋总和大于某个值(比如100)的巡航。

PFB样本巡航文件: -

{
  "disDmbarkationLocation": "From Location",
  "embarkationLocation": "To Location",
  "segments": [
    {
      "segmentId": "SEG1",
      "cabinInventories": [
        {
          "maxOccupancy": 10,
          "lastModified": 1469538908559,
          "currentOccupancy": 10,
          "cabinNo": 1
        },
        {
          "maxOccupancy": 10,
          "lastModified": 1469538908560,
          "currentOccupancy": 9,
          "cabinNo": 2
        },
        {
          "maxOccupancy": 10,
          "lastModified": 1469538908560,
          "currentOccupancy": 8,
          "cabinNo": 3
        },
        {
          "maxOccupancy": 10,
          "lastModified": 1469538908560,
          "currentOccupancy": 8,
          "cabinNo": 4
        }
      ]
    },
    {
      "segmentId": "SEG2",
      "cabinInventories": [
        {
          "maxOccupancy": 10,
          "lastModified": 1469538908561,
          "currentOccupancy": 10,
          "cabinNo": 1
        },
        {
          "maxOccupancy": 10,
          "lastModified": 1469538908562,
          "currentOccupancy": 10,
          "cabinNo": 2
        },
        {
          "maxOccupancy": 10,
          "lastModified": 1469538908562,
          "currentOccupancy": 10,
          "cabinNo": 3
        },
        {
          "maxOccupancy": 10,
          "lastModified": 1469538908562,
          "currentOccupancy": 10,
          "cabinNo": 4
        }
      ]
    },
    {
      "segmentId": "SEG3",
      "cabinInventories": [
        {
          "maxOccupancy": 10,
          "lastModified": 1469538908562,
          "currentOccupancy": 10,
          "cabinNo": 1
        },
        {
          "maxOccupancy": 10,
          "lastModified": 1469538908562,
          "currentOccupancy": 8,
          "cabinNo": 2
        },
        {
          "maxOccupancy": 10,
          "lastModified": 1469538908563,
          "currentOccupancy": 8,
          "cabinNo": 3
        },
        {
          "maxOccupancy": 10,
          "lastModified": 1469538908563,
          "currentOccupancy": 8,
          "cabinNo": 4
        }
      ]
    }
      ]
    }
  ]
}

0 个答案:

没有答案