kibana连接ES,报错no [query] registered for [filtered]
Elasticsearch | 作者 hexianrong | 发布于2017年08月09日 | 阅读数:10966
Elasticsearch显示版本:Version: 5.5.1
按照 https://es.xiaoleilu.com/080_S ... .html 中的文档,
POST /my_store/products/_bulk
{ "index": { "_id": 1 }}
{ "price" : 10, "productID" : "XHDK-A-1293-#fJ3" }
{ "index": { "_id": 2 }}
{ "price" : 20, "productID" : "KDKE-B-9947-#kL5" }
{ "index": { "_id": 3 }}
{ "price" : 30, "productID" : "JODL-X-1937-#pV7" }
{ "index": { "_id": 4 }}
{ "price" : 30, "productID" : "QQPX-R-3956-#aD8" }
后查询:
GET /my_store/products/_search
{
"query" : {
"filtered" : {
"query" : {
"match_all" : {}
},
"filter" : {
"term" : {
"price" : 20
}
}
}
}
}
报错:
{
"error": {
"root_cause": [
{
"type": "parsing_exception",
"reason": "no [query] registered for [filtered]",
"line": 3,
"col": 22
}
],
"type": "parsing_exception",
"reason": "no [query] registered for [filtered]",
"line": 3,
"col": 22
},
"status": 400
}
请问这是什么原因?解析异常?API格式错误?
按照 https://es.xiaoleilu.com/080_S ... .html 中的文档,
POST /my_store/products/_bulk
{ "index": { "_id": 1 }}
{ "price" : 10, "productID" : "XHDK-A-1293-#fJ3" }
{ "index": { "_id": 2 }}
{ "price" : 20, "productID" : "KDKE-B-9947-#kL5" }
{ "index": { "_id": 3 }}
{ "price" : 30, "productID" : "JODL-X-1937-#pV7" }
{ "index": { "_id": 4 }}
{ "price" : 30, "productID" : "QQPX-R-3956-#aD8" }
后查询:
GET /my_store/products/_search
{
"query" : {
"filtered" : {
"query" : {
"match_all" : {}
},
"filter" : {
"term" : {
"price" : 20
}
}
}
}
}
报错:
{
"error": {
"root_cause": [
{
"type": "parsing_exception",
"reason": "no [query] registered for [filtered]",
"line": 3,
"col": 22
}
],
"type": "parsing_exception",
"reason": "no [query] registered for [filtered]",
"line": 3,
"col": 22
},
"status": 400
}
请问这是什么原因?解析异常?API格式错误?
1 个回复
hexianrong
赞同来自:
【尚书】杜俊宇<wjusthm@qq.com> 10:50:43
用bool 包住
看新的api
官网
【尚书】杜俊宇<wjusthm@qq.com> 10:53:24
https://www.elastic.co/guide/e ... teral
修改后确实可以了:
GET /my_store/products/_search
{
"query": {
"bool": {
"filter": {
"term": {
"price": "20"
}
}
}
}
}