elasticsearch에 filebeat라는 인덱스를 만들었습니다. 로그 데이터는 파일 검색 에이전트에서 elasticsearch로 전송됩니다. 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"
}
}
}
}
데이터가 색인에 있습니다. \t "히트": { \t \t "총"92, \t \t "MAX_SCORE": 1.0, \t \t "히트": [{'myURL이/filebeat/_search' 타격의 결과는 다음과 같은 것입니다 \t \t \t "_index": "filebeat"\t \t \t "_type" "문서" \t \t \t "_id": "AVvgSgz27_8XwAoIUeKd" \t \t \t "_score"1.0 01,235 16,\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": "log", ..... \t \t}, ... .....] –