假设我的文件是这样的
{
"salary": {
"max": 1572,
"min": 682
},
"skills": [
"Modula-3",
"Max/MSP",
"Arduino",
"SPARK",
"PL/SQL",
"Processing",
"Go",
"Mathematica",
"Modula-2",
"IDL",
"Heron",
"Scheme"
],
"company": "Merck",
"experience": 0,
"role": "Airport Security Screener",
"cities": [
"Ahmedabad",
"Mangaluru",
"Malegaon",
"Bokaro Steel City",
"Vadodara",
"Kollam"
]
}
我想做一个查询,我将在其中提供一组城市,并根据交集的基数获取文档。即假设我的城市集是["Ahmedabad", "Mangaluru"]
,那么这个查询与上述文档的交集的基数是 2。我的查询应该是什么?
样本响应
{"_score": 4.0202227, "cities": ["Ahmedabad","Mangaluru","Visakhapatnam", "Vijayawada"]}
{"_score": 2.27, "cities": ["Ahmedabad","Visakhapatnam", "Vijayawada"]}
{"_score": 1.79, "cities": ["Mangalauru","Vijayawada", "delhi", "bombay"]}
我正在使用弹性搜索 5.2.2