我刚接触Elasticsearch和Java。我正在尝试转换一个嵌套的Elasticsearch查询,它同时有“必须”和“应该”函数。有人能帮上忙吗?
GET /list/_search
{
"size": 12,
"query": {
"bool": {
"must": [
{
"bool": {
"should": [
{
"multi_match": {
"query": "city hed",
"type": "bool_prefix",
"fields": [
"cityName":"",
"countryCodeName":"",
"iso":""
]
}
},
{
"multi_match": {
"query": "city hed",
"fuzziness": "AUTO",
"fields": [
"cityName*"
]
}
}
]
}
},
{
"bool": {
"should": [
{
"match": {
"iso": ""
}
},
{
"match": {
"iso": ""
}
}
]
}
}
]
}
}
}
我需要它的方法逻辑,就像在JavaAPI中一样
1条答案
按热度按时间t3irkdon1#
如果使用Java High Client,请尝试以下操作: