elasticsearch怎么实现 select * from table where a=1 and b=2
Elasticsearch | 作者 ruicai.li | 发布于2017年08月22日 | 阅读数:3225
这个查询怎么用elasticsearch实现:SELECT product FROM products WHERE (price = 20 AND productID = "XHDK-A-1293-#fJ3")
官网上面只有:
SELECT product FROM products WHERE (price = 20 OR productID = "XHDK-A-1293-#fJ3") AND (price != 30)
官网上面只有:
SELECT product FROM products WHERE (price = 20 OR productID = "XHDK-A-1293-#fJ3") AND (price != 30)
3 个回复
laoyang360 - 《一本书讲透Elasticsearch》作者,Elastic认证工程师 [死磕Elasitcsearch]知识星球地址:http://t.cn/RmwM3N9;微信公众号:铭毅天下; 博客:https://elastic.blog.csdn.net
赞同来自: ruicai.li
bool查询结合should相当于或操作。
ruicai.li
赞同来自:
{
"query": {
"bool": {
"must": [
{
"term": {
"kubernetes.namespace": "default"
}
},
{
"term": {
"kubernetes.labels.application": "test"
}
}
],
"should": [
{
"match_phrase": {
"log": {
"query": "goose migrate start",
"slop": 50
}
}
}
]
}
}
laoyang360 - 《一本书讲透Elasticsearch》作者,Elastic认证工程师 [死磕Elasitcsearch]知识星球地址:http://t.cn/RmwM3N9;微信公众号:铭毅天下; 博客:https://elastic.blog.csdn.net
赞同来自:
模糊匹配,你需要查下wilardquery, matchquery等的匹配方法。