我正在使用ElasticSearch版本5.4.1。在elasticsearch彙總中獲取空桶數組
當我嘗試執行groupBy聚合/桶聚合時,我沒有在bucket數組中獲取任何值。
這是我的索引:
curl -X PUT localhost:9200/urldata -d '{
"mappings" : {
"components" : {
"properties" : {
"name" : {
"type" : "keyword",
"index" : "not_analyzed"
},
"status" : {
"type" : "keyword",
"index" : "not_analyzed"
},
"timestamp":{
"type":"date",
"index":"not_analyzed"
}
}
}
}
}'
而且這個彙總查詢:
curl -XGET 'localhost:9200/urldata/_search?pretty' -H 'Content-Type: application/json' -d'
{
"size": 0,
"aggs": {
"components": {
"terms": {
"field": "name.keyword"
}
}
}
}
'
輸出:
{
"took":2,
"timed_out":false,
"_shards":{
"total":5,
"successful":5,
"failed":0
},
"hits":{
"total":3,
"max_score":0.0,
"hits":[
]
},
"aggregations":{
"components":{
"doc_count_error_upper_bound":0,
"sum_other_doc_count":0,
"buckets":[
]
}
}
}
我要去哪裏錯了?
你能提供一些文檔的例子嗎? – mel
{name:「A」,status:「success」,created_at:「2017-08-17」} {name:「A」,status:「failure」,created_at:「2017-08-18」} –