弹性搜索文件数 [英] Elastic search document count

查看:177
本文介绍了弹性搜索文件数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个弹性搜索运行2.2版本。我已经创建了索引并加载了示例文档。我发现了一些问题。当我给

  GET索引/类型/ _count 

我得到正确答案

  {
count :9998,
_shards:{
total:5,
successful:5,
failed:0
}
但是,当我看到使用 http:// IP:9200的东西时,



/ _cat / indices?v

 健康状况指数pri rep docs.count docs.deleted store。 size pri.store.size 
yellow open index 5 1 79978 0 32.1mb 32.1mb

哪里docs.count:79978.哪个是错的。



为什么我看到错误的值为的docs.count。确切文件计数为9998

解决方案

GET索引/类型/ _count 将返回顶级文档数。



docs.count _cat / indices 返回所有文档的计数,包括为嵌套字段创建的人工文档。



这就是为什么你看到一个区别:




  • 以前的计数(即9998)会告诉您索引中有多少 Elasticsearch文档,即有多少索引。

  • 后一个计数(即79978)将告诉您索引中有多少个 Lucene文档。因此,如果一个ES文档包含一个包含5个子元素的嵌套字段,则会看到1个ES文档,但是6个Lucene文档。根据计数,您的每个ES文档中都有7到8个嵌套元素。


    I am having a Elastic search running 2.2 version. I have created index and loaded sample documents. I found some problem in it. When i give

    GET index/type/_count
    

    I am getting the correct answer

    {
       "count": 9998,
       "_shards": {
          "total": 5,
          "successful": 5,
          "failed": 0
       }
    }
    

    But when i see the things using http://IP:9200/_cat/indices?v

    health status index pri rep docs.count docs.deleted store.size pri.store.size     
    yellow open   index  5   1      79978            0     32.1mb         32.1mb 
    

    Where docs.count : 79978. Which is wrong.

    Why i am seeing docs.count with wrong value. The exact document count is 9998

    解决方案

    GET index/type/_count will return the top-level document count.

    docs.count in _cat/indices returns the count of all documents, including artificial documents that have been created for nested fields.

    That's why you see a difference:

    • The former count (i.e. 9998) will tell you how many Elasticsearch documents are in your index, i.e. how many you have indexed.
    • The latter count (i.e. 79978) will tell you how many Lucene documents are in your index.

    So if one ES document contain a nested field with 5 sub-elements, you'll see 1 ES document, but 6 Lucene documents. Judging by the counts, each of your ES document has between 7 and 8 nested elements within it.

    这篇关于弹性搜索文件数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆