elasticsearch - Elasticsearch 一个字段匹配不同的值
问题描述
我想做一个查询,一个字段匹配不同的值,在 SQL 中它喜欢:
select * from location where address like '%California%' and address like '%145%';
我尝试使用必须条件数组,它包含几个短语匹配条件,但它不起作用!
{
"from" : 0,
"size" : 10,
"query" : {
"bool" : {
"must" : {
"bool" : {
"must" : [ {
"match" : {
"address" : {
"query" : "California",
"type" : "phrase"
}
}
}, {
"match" : {
"address" : {
"query" : "145",
"type" : "phrase"
}
}
} ]
}
}
}
},
"sort" : [ {
"pageRankScore" : {
"order" : "desc",
"unmapped_type" : "double"
}
} ]
}
那是我的代码,它只匹配'145',从不匹配'California'。
我的问题是:有几个值,如何在一个字段中进行模糊匹配?
帮帮我,非常感谢!
解决方案
推荐阅读
- json - 从服务器获取我的应用程序的文本
- c# - 数据块中的异常处理
- linux - ubuntu 听不到 0.0.0.0
- android - 使用 Any 或 Generic 为函数定义多数据类型?
- android - 安卓模拟器。它可能完全删除 com.google.android.googlequicksearchbox?
- react-native - stopRecorder() 不起作用 - react-native-audio-recorder-player
- testing - Chef InSpec 检查 http 请求是否失败 [成功]
- c# - 纹理不可见的 3D 对象
- c# - 如何使用凭证,例如:login.cs 中的员工社会保险号以另一种形式反映,例如:expense.cs(无需手动输入))
- ios - 如何在 App Store 中获得 macOS 游戏的“控制器支持”和“玩家数量”徽章