我已经创建了elasticsearch.The日志数据filebeat命名的指数正在elasticsearch由filebeat代理发送。 我想基于一个名为value_of_type特定的列/字段筛选结果。使用PHP API:ElasticSearch返回任何结果,尽管正确的查询
$json =
'{
"query" : {
"bool" : {
"filter": [
{
"term" :
{
"value_of_type" : "sound"
}
}
]
}
}
}';
但它返回0结果。 {"took":4,"timed_out":false,"_shards":{"total":5,"successful":5,"failed":0},"hits":{"total":0,"max_score":null,"hits":[]}}
击中myurl:9200/filebeat
在浏览器的结果看起来是这样的:
{
"filebeat": {
"aliases": {},
"mappings": {
"doc": {
"properties": {
"@timestamp": {
"type": "date"
},
"beat": {
"properties": {
"hostname": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"name": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"version": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
}
}
},
"fields": {
"properties": {
"node": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"value_of_type": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
}
}
},
"input_type": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"message": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"offset": {
"type": "long"
},
"source": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"type": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
}
}
}
},
"settings": {
"index": {
"creation_date": "1494116541083",
"number_of_shards": "5",
"number_of_replicas": "1",
"uuid": "IdhWgIqiQ-GNrZK3AvCP9g",
"version": {
"created": "5020199"
},
"provided_name": "filebeat"
}
}
}
}
数据存在于索引中。击中'myurl/filebeat/_search'的结果是这样的: \t “命中”:{ \t \t “总”:92, \t \t “MAX_SCORE”:1.0, \t \t “命中”:[{ \t \t \t “_index”: “filebeat”, \t \t \t “_type”: “文档”, \t \t \t “_id”: “AVvgSgz27_8XwAoIUeKd”, \t \t \t “_score”:1.0, \t \t \t “_source”:{ \t \t \t \t “@timestamp”: “2017-05-07T00:23:16.000Z”, \t \t \t \t “拍”:{ \t \t \t \t \t“主机名“: “lorem06”, \t \t \t \t \t “名”: “lorem06”, \t \t \t \t \t “版本”:“6.0。0-α1 - git3bcebf6" \t \t \t \t}, \t \t \t \t “字段”:{ \t \t \t \t \t “节点”: “节点1”, \t \t \t \t \t “value_of_type”: “声音” \t \t \t \t}, \t \t \t “INPUT_TYPE”: “登录”,... \t \t},... .....] –