Sql 如何在Elasticsearch中生成请求?
我有SQL查询: 选择标题、来自地理位置的路径,其中标题在[“伦敦”、“法国”]中,路径类似于“0000000 39%”,日期不是“2019-01-22”偏移0限制14按标题询问 如何正确进行弹性搜索查询 我提出了这样的要求,但不起作用:Sql 如何在Elasticsearch中生成请求?,sql,node.js,elasticsearch,curl,Sql,Node.js,elasticsearch,Curl,我有SQL查询: 选择标题、来自地理位置的路径,其中标题在[“伦敦”、“法国”]中,路径类似于“0000000 39%”,日期不是“2019-01-22”偏移0限制14按标题询问 如何正确进行弹性搜索查询 我提出了这样的要求,但不起作用: curl -XGET "http://service-monitoring--elastic:9200/geo/_search?pretty" -H 'Content-Type: application/json' -d' { "_source": [
curl -XGET "http://service-monitoring--elastic:9200/geo/_search?pretty" -H 'Content-Type: application/json' -d'
{
"_source": [
"title",
"path"
],
"query": {
"filtered": {
"filter": {
"bool": {
"must": [
{"terms": {"title": ["london", "france"]}},
{"wildcard": {"path": "000000039*"}}
],
"must_not": [
{"terms": {"date": "2019-01-22"}}
]
}
}
}
}
}'
错误
{"error" : {
"root_cause" : [
{
"type" : "parsing_exception",
"reason" : "no [query] registered for [filtered]",
"line" : 8,
"col" : 25
}
],
"type" : "parsing_exception",
"reason" : "no [query] registered for [filtered]",
"line" : 8,
"col" : 25
},
"status" : 400
}
filtered
查询在很长一段时间内被弃用,建议改用bool
。现在它已经从ES 5.0中删除
尝试:
{
"_source": [
"title",
"path"
],
"query": {
"bool": {
"filter": {
"bool": {
"must": [
{
"terms": {
"title": [
"london",
"france"
]
}
},
{
"wildcard": {
"path": "000000039*"
}
}
],
"must_not": [
{
"terms": {
"date": "2019-01-22"
}
}
]
}
}
}
}
}
到底是什么不起作用?你得到的结果是错误的,还是没有得到任何结果?有错误吗?还有,你确定你有应该回答这个问题的文档吗?@gillyb是的,当然,我有文档,添加了错误