kibana 5.6.3 中的日期范围查询不适用于@timestamp
Date range Query in kibana 5.6.3 not working with @timestamp
映射:
"mappings": {
"test-engine": {
"properties": {
"@timestamp": {
"type": "date"
} ....
},
示例记录:
{
"_index": "application-log",
"_type": "test-engine",
"_id": "AV9pKiMHlm36MlYWarx3",
"_score": 1,
"_source": {
"@timestamp": "2017-10-29T17:24:50.026+0000",
"message": "Initialize connection to node -1 for sending metadata request",
"host": "54.205.134.57",
"severity": "DEBUG",
"thread": "Thread-4",
"logger": "org.apache.kafka.clients.NetworkClient"
}
我试过的查询:
GET application-log/_mapping
{
"range": {
"@timestamp": {
"gte": "2017-10-26T17:24:50.026+0000",
"lte": "2017-10-28T17:24:50.026+0000"
}
}
}
我尝试使用上述映射和记录进行查询,但日期范围在 kibana 中仍然无效
您需要使用 _search
端点而非 _mapping
端点并将 range
查询包装在 query
部分
中
GET application-log/_search
{
"query": {
"range": {
"@timestamp": {
"gte": "2017-10-26T17:24:50.026+0000",
"lte": "2017-10-28T17:24:50.026+0000"
}
}
}
}
映射:
"mappings": {
"test-engine": {
"properties": {
"@timestamp": {
"type": "date"
} ....
},
示例记录:
{
"_index": "application-log",
"_type": "test-engine",
"_id": "AV9pKiMHlm36MlYWarx3",
"_score": 1,
"_source": {
"@timestamp": "2017-10-29T17:24:50.026+0000",
"message": "Initialize connection to node -1 for sending metadata request",
"host": "54.205.134.57",
"severity": "DEBUG",
"thread": "Thread-4",
"logger": "org.apache.kafka.clients.NetworkClient"
}
我试过的查询:
GET application-log/_mapping
{
"range": {
"@timestamp": {
"gte": "2017-10-26T17:24:50.026+0000",
"lte": "2017-10-28T17:24:50.026+0000"
}
}
}
我尝试使用上述映射和记录进行查询,但日期范围在 kibana 中仍然无效
您需要使用 _search
端点而非 _mapping
端点并将 range
查询包装在 query
部分
GET application-log/_search
{
"query": {
"range": {
"@timestamp": {
"gte": "2017-10-26T17:24:50.026+0000",
"lte": "2017-10-28T17:24:50.026+0000"
}
}
}
}