上篇说到elastic search(简称es)中常用的search api,但有时候我们不需要满足条件的原始文档数据,而是需要返回符合条件的文档数,类似于mysql的select count(*)查询条数,es中进行count查询的api的endpoint为"_count",如下示例:
返回的count节点即表示符合条件的匹配数目。"_count"支持多个索引同时查询符合条件的匹配数:
上一篇: Elastic Search之Search API(Query DSL)、字段类查询、复合查询
下一篇: Elastic Search之Source Filtering(过滤结果中"_source"原始文本显示哪些字段)
参考资料: Es官方文档https://www.elastic.co/guide/en/elasticsearch/reference/current/search-count.html