0

这是我的映射

{             "seoSubscribedFlag": {"type": "boolean"},
            "seoSubscribedExpiryDate": {"type": "date"},
            "userActive" :{"type" : "boolean"},
            "emailVerified" :{"type" : "boolean"},
            "isOnLineShodAdded" :{"type" : "boolean"},
            "productList" : {
                "properties" : {
                    "prodId" : {"type" : "string"},
                    "prodName" : {"type" : "string"},
                    "brand" : {"type" : "string"},
                    "modelNo" : {"type" : "string"},

                    "grossAmt" : {"type" : "float"},
                    "netAmt" : {"type" : "float"},
                    "prodDesc" : {"type" : "string"},
                    "prodKeyFeatures" : {"type" : "string"},
                    "prodSize" :{ "type": "nested" }

                }
            }
        }

这是我的乔恩

{
"userId": "2",  
"seoSubscribedFlag": true,
"seoSubscribedExpiryDate": 1501312549,
"userActive" : true,
"emailVerified" : true,
"isOnLineShodAdded" : false,
"productList" : {
    "properties" : {
        "prodId" : "2",            
        "netAmt" : 50,            
        "prodSize" :["XS","XL"]

    }
}
}

我想基于产品 netAmt 使用 BOOL MUST 搜索数据,例如 netAmt 必须在 10 到 60 之间我尝试 BOOL MUST RANGE 但它不适用于对象列表 在此处输入图像描述

4

1 回答 1

2
{
  "query": {
    "bool": {
      "must": {
        "range": {
          "productList.netAmt": {
            "gt": 10,
            "lt": 60
          }
        }
      }
    }
  }
}

请参考ES范围查询

于 2017-07-31T09:05:13.557 回答