如何在elasticsearch中编写此查询
我有SQL查询:如何在elasticsearch中编写此查询,
Warning: implode(): Invalid arguments passed in /data/phpspider/zhask/webroot/tpl/detail.html on line 45
,,我有SQL查询: 其中A=1、B=2和C REGEXP(eee | fff | ggg) 如何在elasticsearch中编写此查询?您可能想看看此elasticsearch插件,它旨在为elasticsearch提供一个SQL层 https://github.com/NLPchina/elasticsearch-sql 同时检查下面的URL https://www.elastic.co/guide/en/elasticsearch/reference/current/sql-transla
其中A=1、B=2和C REGEXP(eee | fff | ggg)
如何在elasticsearch中编写此查询?您可能想看看此elasticsearch插件,它旨在为elasticsearch提供一个SQL层
https://github.com/NLPchina/elasticsearch-sql
同时检查下面的URL
https://www.elastic.co/guide/en/elasticsearch/reference/current/sql-translate.html
希望这有助于未经测试,但类似于QUERY-DSL您需要的
filter
和regexp
案例
GET /_search
{
"size": 10,
"query": {
"filter" : {
"bool" : {
"must" : [
{ "term" : {"A" : 1}},
{ "term" : {"B" : 2}}
]
}
},
"regexp": {
"C": {
"value": "eee|fff|ggg"
}
}
}
}
或
GET /_search
{
"size": 10,
"query": {
"filter": {
"bool": {
"must": [
{
"term": {
"A": 1
}
},
{
"term": {
"B": 2
}
},
{
"regexp": {
"C": {
"value": "eee|fff|ggg"
}
}
}
]
}
}
}
}
谢谢,但SQL只是理解我需要编写哪些条件的示例:)