我试图在Kibana中搜索基于代码的产品。为此,我使用了logstash并将我的Oracle数据转换为弹性搜索。下面的查询我试图根据代码获取产品,但我无法正确获取它。我的查询有什么问题吗?
请查看弹性搜索中的实际数据:
{
"took":50,
"timed_out":false,
"_shards":{
"total":5,
"successful":5,
"skipped":0,
"failed":0
},
"hits":{
"total":1,
"max_score":1.0,
"hits":[
{
"_index":"my_index",
"_type":"doc",
"_id":"MUC8GmMBRU-f7c0A8LUY",
"_score":1.0,
"_source":{
"@version":"1",
"vendor_id":1,
"name":"prod7",
"code":"12312",
"catalog_id":343,
"is_visible":1,
"@timestamp":"2018-05-01T08:06:16.642Z"
}
}
]
}
请查找我的查询,尝试通过kibana从elasticsearch获取记录。
get my_index/_search/
{
"query" :{
"_source":{
"match_all":{"code":"12312"}
}
}
}
得到以下错误
{
"error": {
"root_cause": [
{
"type": "parsing_exception",
"reason": "no [query] registered for [_source]",
"line": 3,
"col": 15
}
],
"type": "parsing_exception",
"reason": "no [query] registered for [_source]",
"line": 3,
"col": 15
},
"status": 400
}
答案 0 :(得分:1)
正确的查询如下所示:
GET my_index/_search/
{
"query" :{
"match": {"code": "12312"}
}
}