2017-05-03 40 views

回答

1

您可以使用response filtering此:

curl http://server:9200/games_profilder/_search?filter_path=hits.total 

這將產生

{ 
    "hits": { 
    "total": 731552 
    } 
} 

如果你真的想只得到總,可以通過管道與jq這樣的結果:

curl http://server:9200/games_profilder/_search?filter_path=hits.total | jq '.hits.total' 

並且只會產生數731552

+0

感謝您的偉大答案,但我使用python .. – art20170

+0

這是一個語言不可知的解決方案直接內殼。如果您使用python,那麼只需引用結果對象的'['hits'] ['total']'屬性。 – Val