elasticsearch elasticsearch无法获取事件
elasticsearch中有两个事件: 事件1:elasticsearch elasticsearch无法获取事件,elasticsearch,kibana,elasticsearch,Kibana,elasticsearch中有两个事件: 事件1: { "_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 test
{
"_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": {}
}
}'
curl -XGET 'http://sulog01:9200/logstash-2013.11.26/_search?pretty' -d '{
"query": {
"query_string": {
"query": "*"
}
}
}'
但事件1无法通过以下方式获得:
curl -XGET 'http://sulog01:9200/logstash-2013.11.26/_search?pretty' -d '{
"query" : {
"match_all": {}
}
}'
curl -XGET 'http://sulog01:9200/logstash-2013.11.26/_search?pretty' -d '{
"query": {
"query_string": {
"query": "*"
}
}
}'
kibana使用了后一种语法,因此我想知道是什么导致了这种不同的行为,以及如何修复这种行为,以便后一种语法也可以获取所有事件。您正在使用上次查询搜索
\u all
字段,因为您在查询中既没有指定字段名称,也没有指定默认字段。我认为您可能已在映射中的某个点禁用了\u all
字段,这将导致不包含\u all
字段的文档无法返回。您正在通过上次查询搜索“u all”字段。你有没有可能在映射的某个点禁用它?也许最好指定要搜索的字段?非常感谢,这是一个非常好的提示!我实际上禁用了_all字段以节省磁盘空间。看起来重新启用了_allfield解决了我的问题很高兴听到,然后添加了我的评论作为答案。如果我的答案有用,请您接受/投票支持我的答案好吗?