2016-02-18 115 views
0

我對Elasticsearch相當新(使用2.2版本)。 爲了簡化我的問題,我有文檔有一個字段名爲終止,有時可能會採取值轉移Elasticsearch:過濾器聚合的準確性

我目前做的這個要求按月彙總這有終止的文件數:

{ 
    "size": 0, 
    "sort": [{ 
    "@timestamp": { 
     "order": "desc", 
     "unmapped_type": "boolean" 
    } 
    }], 
    "query": { "match_all": {} }, 
    "aggs": { 
    "report": { 
     "date_histogram": { 
     "field": "@timestamp", 
     "interval": "month", 
     "min_doc_count": 0 
     }, 
     "aggs": { 
     "documents_with_termination_transfer": { 
      "filter": { 
      "term": { 
       "termination": "transfer" 
      } 
      } 
     } 
     } 
    } 
    } 
} 

這裏是迴應:

{ 
    "_shards": { 
     "failed": 0, 
     "successful": 206, 
     "total": 206 
    }, 
    "aggregations": { 
     "report": { 
      "buckets": [ 
       { 
        "calls_with_termination_transfer": { 
         "doc_count": 209163 
        }, 
        "doc_count": 278100, 
        "key": 1451606400000, 
        "key_as_string": "2016-01-01T00:00:00.000Z" 
       }, 
       { 
        "calls_with_termination_transfer": { 
         "doc_count": 107244 
        }, 
        "doc_count": 136597, 
        "key": 1454284800000, 
        "key_as_string": "2016-02-01T00:00:00.000Z" 
       } 
      ] 
     } 
    }, 
    "hits": { 
     "hits": [], 
     "max_score": 0.0, 
     "total": 414699 
    }, 
    "timed_out": false, 
    "took": 90 
} 

爲什麼點擊次數(414699)大於文件總數(278100 + 136597 = 414697)?我已經閱讀過有關精度問題,但它似乎不適用於過濾器的情況... 如果我總結文檔總數轉讓終止,是否也有精度問題?

回答

0

我的猜測是一些文件有缺失@timestamp

您可以通過在此字段上運行exists query來驗證此情況。

+0

你說得對!有兩個完全不同的文件,看起來被kibana使用:**「hit」:[{「_id」:「4.4.1」,「_index」:「.kibana」,...},{「_id」:「 logstash- *「,」_index「:」.kibana「,...}] ** – Raphael

相關問題