这是我的映射
{ "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" }
}
}
}
这里是我的josn
{
"userId": "2",
"seoSubscribedFlag": true,
"seoSubscribedExpiryDate": 1501312549,
"userActive" : true,
"emailVerified" : true,
"isOnLineShodAdded" : false,
"productList" : {
"properties" : {
"prodId" : "2",
"netAmt" : 50,
"prodSize" :["XS","XL"]
}
}
}
我想根据产品netAmt使用BOOL搜索数据,
像netAmt一样必须介于10到60之间
我尝试BOOL MUST RANGE但它不适用于对象列表
答案 0 :(得分:1)
{
"query": {
"bool": {
"must": {
"range": {
"productList.netAmt": {
"gt": 10,
"lt": 60
}
}
}
}
}
}
请参阅ES range query