Elastic Search之Count API(获取符合条件的记录数)

上篇说到elastic search(简称es)中常用的search api,但有时候我们不需要满足条件的原始文档数据,而是需要返回符合条件的文档数,类似于mysql的select count(*)查询条数,es中进行count查询的api的endpoint为"_count",如下示例:

返回的count节点即表示符合条件的匹配数目。"_count"支持多个索引同时查询符合条件的匹配数:


books 上一篇: Elastic Search之Search API(Query DSL)、字段类查询、复合查询

books 下一篇: Elastic Search之Source Filtering(过滤结果中"_source"原始文本显示哪些字段)

books 参考资料: Es官方文档https://www.elastic.co/guide/en/elasticsearch/reference/current/search-count.html

发布了202 篇原创文章 · 获赞 571 · 访问量 147万+

猜你喜欢

转载自blog.csdn.net/fanrenxiang/article/details/86489094
今日推荐