我有如下嵌套索引结构:
{
"customersData": {
"mappings": {
"type1": {
"properties": {
"md5": {
"type": "string"
},
"uscan": {
"properties": {
"ibm": {
"properties": {
"found": {
"type": "boolean"
}
}
},
"google": {
"properties": {
"found": {
"type": "boolean"
}
}
},
"ebay": {
"properties": {
"found": {
"type": "boolean"
}
}
}
...
}
},
"plink":{"type":"string"}
}
}
}
}
}
示例数据,例如:uscan.ebay.found:true,uscan.ibm.found:true,uscan.google.found:false,...
每条记录可能有一百个客户,我想查询found = true大于5(每条记录至少有5个客户发现= true)。请任何想法,谢谢!
答案 0 :(得分:1)
您可以使用minimum_should_match
来指定should
子句中应匹配的最小条件数。使用以下查询:
{
"query": {
"bool": {
"should": [
{
"term": {
"uscan.ibm.found": true
}
},
{
"term": {
"uscan.google.found": true
}
},
{
"term": {
"uscan.ebay.found": true
}
},
...
],
"minimum_number_should_match": 5
}
}
}