0
我在弹性搜索玩家索引中有以下对象。Elasticsearch:在数组中搜索
GET /players/_search
"hits": [
{
"_index": "players",
"_type": "1",
"_id": "rRI5A8mVRUKKTA08bK90Vw",
"_score": 0.2712221,
"_source": {
"id": "1",
"first_name": "Lebron",
"last_name": "James",
"numbers": [
{
"number": "23",
"team": {
"city": "Cliveland",
"name": "Cavaliers"
}
},
{
"number": "6",
"team": {
"city": "Maimi",
"name": "Heat"
}
}
]
}
}
]
现在我想搜索的球员谁在“舞美”中扮演并且有数字“23”(有这个指数没有这样的球员)。我试过
GET /players/_search
{
"query": {
"bool" : {
"must" : [
{
"term" : {
"numbers.number" : "23"
}
},
{ "term" : {
"numbers.team.city" : "maimi"
}
}
]
}
}
}
但elasticsearch仍然发现勒布朗。我应该如何对弹性搜索做出正确的请求?