我想用ElasticSearch按标签搜索食谱
{
...
"tag": [
"cool",
"cooler"
]
},
{
...
"tag": [
"cool",
"hard"
]
},
{
...
"tag": [
"coolest",
"hardest"
]
},
我要搜索包含“酷”标签的所有实体
我尝试了什么:
GET /recipes/_search
{
"query": {
"terms": {
"tag": ["cool"]
}
}
}
什么也不返回
GET /recipes/_search
{
"query": {
"bool": {
"should": [
{
"term": {
"tag": "cool"
}
}
]
}
}
}
什么也不返回
GET /recipes/_search
{
"query": {
"bool": {
"should": [
{
"match": {
"tag": "cool"
}
}
]
}
}
}
返回所有实体
如何只检索包含“cool”和可能包含其他值的项,但规则是标记必须存在于标记数组中