2017-08-03 84 views
0

我有一些彈性搜索查詢的問題。 當我使用查詢碼時,它反饋信息 [bool]格式錯誤的查詢,預計[END_OBJECT],但發現[FIELD_NAME]Elasticsearch [bool]格式錯誤的查詢,預計[END_OBJECT],但找到[FIELD_NAME]

POST /_search 
{ 
    "query": { 
    "bool": { 
    "must": { 
     "match": { 
     "_index": "ntopng-2017.07.26" 
     } 
    }, 
     "filter": { 
     "term": { 
     "IPV4_DST_ADDR": "192.168.0.1" 
    } 
    } 

} , 
"aggs" : { 
    "IN_PKTS" : { "sum" : { "field" :"IN_PKTS" } }, 
    "IN_BYTES" : {"sum" : { "field":"IN_BYTES"} } , 
    "OUT_BYTES" : {"sum" : { "field":"OUT_BYTES"} }, 
    "OUT_PKTS" : { "sum" : { "field" :"OUT_PKTS" } } 

    } 
    } 
} 

回答

0

AGGS是錯誤的。試試這個:

{ 
    "query": { 
    "bool": { 
     "must": { 
     "match": { 
      "_index": "ntopng-2017.07.26" 
     } 
     }, 
     "filter": { 
     "term": { 
      "IPV4_DST_ADDR": "192.168.0.1" 
     } 
     } 
    } 
    }, 
    "aggs": { 
     "IN_PKTS": { 
     "sum": { 
      "field": "IN_PKTS" 
     } 
     }, 
     "IN_BYTES": { 
     "sum": { 
      "field": "IN_BYTES" 
     } 
     }, 
     "OUT_BYTES": { 
     "sum": { 
      "field": "OUT_BYTES" 
     } 
     }, 
     "OUT_PKTS": { 
     "sum": { 
      "field": "OUT_PKTS" 
     } 
     } 
    } 
} 
+0

它可以工作!非常感謝:) –

+0

@張皓翔不客氣:)如果有,請接受答案。 – aclokay

+0

親愛的aclokay,我可以問你一個問題,總的命中是 634,但瀏覽器只顯示少量數據是否正確? –

相關問題