密钥字符串将如下所示
“印度,新加坡”,不加引号。
如何拆分和搜索关键字
预期结果将与印度或新加坡的国家相匹配。
到目前为止我试过了..。
{
"_source": "country_name",
"query": {
"bool": {
"must": [
{
"term": {
"country_name.keyword": "india,singapore"
}
}
],
"must_not": [],
"should": []
}
},
"from": 0,
"size": 10,
"sort": [],
"aggs": {}
}但是它将只显示那些与关键字字符串“印度,新加坡”完全匹配的内容。
发布于 2018-03-07 17:22:50
您可以使用terms query代替term query,如下所示:
{
"_source": "country_name",
"query": {
"bool": {
"must": [
{
"terms": {
"country_name.keyword": ["india","singapore"]
}
}
]
}
},
"from": 0,
"size": 10
}https://stackoverflow.com/questions/49146675
复制相似问题