1
我有以下指標mytestindex
和類型mytesttype
在Elasticsearch 5.5:如何在elasticsearch中執行特定的搜索查詢?
PUT /mytestindex
{
"mappings": {
"mytesttype": {
"_source": {
"enabled": true
},
"_all": {
"enabled": true
},
"properties": {
"Id": {
"type":"text"
},
"RadarId": {
"type":"keyword"
},
"VehicleId": {
"type":"keyword"
},
"Datetime": {
"type":"date",
"format": "yyyy-MM-dd HH:mm:ss.SSS"
},
"Hour": {
"type":"integer"
}
}
}
}
}
我在Elasticsearch非常初學者。我想知道是否有可能在11:00至12:00之間獲得小時平均數量的車輛?我應該使用哪種類型的查詢?例如,在MySQL中我會做這樣的事情(的簡化版本,不考慮11:00-12:00):
SELECT AVG(value), datetime
FROM mytable
GROUP BY HOUR(datetime)
是否有可能以執行Elasticsearch類似的查詢?