【发布时间】:2013-12-11 02:23:04
【问题描述】:
我在 elasticsearch 中有两个事件:
事件一:
{
"_index": "logstash-2013.11.26",
"_type": "logs",
"_id": "apuoW1Y8SBqVk_W_FOPKQQ",
"_score": 1.0,
"_source": {
"@timestamp": "2013-11-26T03:09:16.059Z",
"message": "testline3\ntestline1\n testline2\n testline3",
"@version": "1",
"type": "online_log",
"host": [
"suutw11"
],
"path": [
"/home/infra/logstash/test/test1.log",
"%{@source_path}"
],
"env": "SAT1",
"tags": [
"multiline",
"_grokparsefailure"
]
}
}
事件 2:
{
"_index": "logstash-2013.11.26",
"_type": "logs",
"_id": "mMk-JBWjQh2Xmc8ERIDzmw",
"_score": 1.0,
"_source": {
"@source": "file://sudpb1/app/bckss04/dmacms_ear_p4_A/acmsdomain/logs/access.log",
"@source_host": "sudpb1",
"@message": "10.100.2.66\t2013-11-26\t15:22:18\tGET\t/lb_check.jsp\t200\t3\t0.0010",
"@tags": [
"beaver"
],
"@fields": {
"host": [
"sudpb1"
],
"env": [
"BCV"
]
},
"@timestamp": "2013-11-26T04:24:29.471Z",
"@source_path": "/app/bckss04/dmacms_ear_p4_A/acmsdomain/logs/access.log",
"@type": "access_log",
"@version": "1",
"type": "redis-input"
}
}
这两个事件都可以通过:
curl -XGET 'http://sulog01:9200/logstash-2013.11.26/_search?pretty' -d '{
"query" : {
"match_all": {}
}
}'
但是事件1不能通过:
curl -XGET 'http://sulog01:9200/logstash-2013.11.26/_search?pretty' -d '{
"query": {
"query_string": {
"query": "*"
}
}
}'
kibana 使用了后面的语法,所以我想知道是什么导致了这种不同的行为以及如何解决这个问题,以便后面的语法也可以获取所有事件。
【问题讨论】:
-
您正在通过最后一个查询在 _all 字段上进行搜索。您是否可能在映射中的某个位置禁用它?指定要搜索的字段可能更好?
-
非常感谢这是一个很好的提示!我实际上确实禁用了 _all 字段以节省磁盘空间。看起来重新启用 _all 字段解决了我的问题
-
很高兴听到,然后添加了我的评论作为答案。
-
如果我的回答有用,请您接受/支持我的回答吗?
标签: elasticsearch kibana