ElasticSearch可以通过/_cat/indices来查看Index的状态
GET _cat/indices/your_index_name*?v
health status index uuid pri rep docs.count docs.deleted store.size pri.store.size
green open your-index-name-20210630_041604 tncQI-oBQxu7Y6OgdoNe2Q 1 2 7896 0 15.2mb 5.2mb
green open your-index-name-20210630_072026 JcNRNxnHQt2VS6Ld2PIMBQ 1 2 650061 0 1.2gb 437mb
green open your-index-name-20210518_102722 4toZnuRmT1akGfwT7Rd-Cg 1 2 651661 0 1.3gb 446.5mb
green open your-index-name-20210630_075626 DhPg8W8yQjK_OwT-HQ1OEA 1 2 58255 0 128.7mb 42.9mb
在Response中有docs.count等信息,但此处的docs.count不是document的数量,而是Lucene的文档数。当docs中存在nest的类型时,docs.count != Index的doc数。
通过_count API来查看Index的document数量:
GET your-index-name-20210630_075626/_count
{
"count": 6000,
"_shards": {
"total": 1,
"successful": 1,
"skipped": 0,
"failed": 0
}
}
可以看出Index的document是6000,但 docs.count是58255。原因是Index中存在nested类型