elasticsearch未能获得事件

时间:2013-11-26 04:42:48

标签: 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 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使用了后面的语法,所以我想知道导致这种不同行为的原因以及如何解决这个问题,以便后面的语法也可以获取所有事件。

1 个答案:

答案 0 :(得分:0)

您正在使用上一个查询搜索_all字段,因为您没有在查询中指定字段名称,也没有在默认字段中指定字段名称。我认为您可能在映射中的某个位置禁用了_all字段,这会导致不返回没有_all字段的文档。