这是我的 map
{ "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"]
}
}
}
我想使用BOOL必须基于产品netAmt搜索数据,
就像netAmt必须在10到60之间
我尝试BOOL必须范围,但它不适用于对象列表
最佳答案
{
"query": {
"bool": {
"must": {
"range": {
"productList.netAmt": {
"gt": 10,
"lt": 60
}
}
}
}
}
}
请引用ES range query
关于elasticsearch - Elasticsearch范围查询对象列表,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45411048/