elasticsearch elasticsearch仅返回总点击数
我想向ELS发送只返回总点击数的查询 没有别的 就像我得到了回应一样elasticsearch elasticsearch仅返回总点击数,elasticsearch,kibana,elasticsearch,Kibana,我想向ELS发送只返回总点击数的查询 没有别的 就像我得到了回应一样 { "took": 1111, "timed_out": false, "_shards": { "total": 9, "successful": 9, "failed": 0 }, "hits": { "total": 731552, } 我只想打印731552 现在我只发送: 卷曲 谢谢您可以使用: curl http://server:9200/games_
{ "took": 1111, "timed_out": false, "_shards": {
"total": 9,
"successful": 9,
"failed": 0 }, "hits": {
"total": 731552,
}
我只想打印731552
现在我只发送:
卷曲
谢谢您可以使用:
curl http://server:9200/games_profilder/_search?filter_path=hits.total
这将产生
{
"hits": {
"total": 731552
}
}
如果你真的只想得到总数,你可以用如下方法来计算结果:
curl http://server:9200/games_profilder/_search?filter_path=hits.total | jq '.hits.total'
这将只产生731552这个数字,这是一个直接在shell内部的语言不可知的解决方案。如果您使用python,那么只需引用results对象的
['hits']['total']
属性即可。我不需要一次找到所有与我的查询匹配的文档,但我需要知道匹配的总数,而不仅仅是超过10000个。我该如何解决这个问题?@Dude使用/\u count
端点而不是/\u search