统计信息

    /stats 路由提供关于索引和 Meilisearch 数据库的扩展信息和指标。

    统计信息对象

    {
      "databaseSize": 447819776,
      "usedDatabaseSize": 196608,
      "lastUpdate": "2019-11-15T11:15:22.092896Z",
      "indexes": {
        "movies": {
          "numberOfDocuments": 19654,
          "numberOfEmbeddedDocuments": 1,
          "numberOfEmbeddings": 1,
          "isIndexing": false,
          "fieldDistribution": {
            "poster": 19654,
            "overview": 19654,
            "title": 19654,
            "id": 19654,
            "release_date": 19654
          }
        },
        "books": {
          "numberOfDocuments": 5,
          "numberOfEmbeddedDocuments": 5,
          "numberOfEmbeddings": 10,
          "isIndexing": false,
          "fieldDistribution": {
            "id": 5,
            "title": 5,
            "author": 5,
            "price": 5, 
            "genres": 5
          }
        }
      }
    }
    
    名称类型描述
    databaseSize整数Meilisearch 和 LMDB 声明的存储空间大小(以字节为单位)
    usedDatabaseSize整数数据库使用的存储空间大小(以字节为单位),不包括 LMDB 声明的未使用空间
    lastUpdate字符串上次数据库更新的时间,采用 RFC 3339 格式
    indexes对象包含数据库中每个索引的统计信息的对象
    numberOfDocuments整数索引中的文档总数
    numberOfEmbeddedDocuments整数包含至少一个嵌入的文档总数
    numberOfEmbeddings整数索引中的嵌入总数
    isIndexing布尔值如果为 true,则索引仍在处理文档,尝试搜索将导致未定义的行为
    fieldDistribution对象显示索引中的每个字段以及包含该字段的索引中文档总数
    注意

    fieldDistribution 不受 searchableAttributesdisplayedAttributes 的影响。即使字段未显示或不可搜索,它仍将出现在 fieldDistribution 对象中。

    获取所有索引的统计信息

    GET/stats

    获取所有索引的统计信息。

    示例

    curl \
      -X GET 'MEILISEARCH_URL/stats'

    响应:200 Ok

    {
      "databaseSize": 447819776,
      "usedDatabaseSize": 196608,
      "lastUpdate": "2019-11-15T11:15:22.092896Z",
      "indexes": {
        "movies": {
          "numberOfDocuments": 19654,
          "numberOfEmbeddedDocuments": 1,
          "numberOfEmbeddings": 1,
          "isIndexing": false,
          "fieldDistribution": {
            "poster": 19654,
            "overview": 19654,
            "title": 19654,
            "id": 19654,
            "release_date": 19654
          }
        },
        "books": {
          "numberOfDocuments": 5,
          "numberOfEmbeddedDocuments": 5,
          "numberOfEmbeddings": 10,
          "isIndexing": false,
          "fieldDistribution": {
            "id": 5,
            "title": 5,
            "author": 5,
            "price": 5, 
            "genres": 5
          }
        }
      }
    }
    

    获取索引的统计信息

    GET/indexes/{index_uid}/stats

    获取索引的统计信息。

    路径参数

    名称类型描述
    index_uid *字符串请求索引的 uid

    示例

    curl \
      -X GET 'MEILISEARCH_URL/indexes/movies/stats'

    响应:200 Ok

    {
      "numberOfDocuments": 19654,
      "numberOfEmbeddedDocuments": 1,
      "numberOfEmbeddings": 1,
      "isIndexing": false,
      "fieldDistribution": {
        "poster": 19654,
        "overview": 19654,
        "title": 19654,
        "id": 19654,
        "release_date": 19654
      }
    }