Link Search Menu Expand Document Documentation Menu

地图统计 API

2.7 版引入

当您在 OpenSearch Dashboards 中创建并保存地图时,该地图将成为类型为 map 的已保存对象。地图统计 API 提供有关 OpenSearch Dashboards 中此类已保存对象的信息。

请求示例

您可以通过以下格式提供 URL 地址来访问地图统计 API

<opensearch-dashboards-endpoint-address>/api/maps-dashboards/stats

如果 OpenSearch 配置文件中指定了端口号,则 OpenSearch Dashboards 端点地址可能包含该端口号。具体的 URL 格式取决于 OpenSearch 部署类型及其托管的网络环境。

您可以通过两种方式查询该端点

  • 通过在浏览器中访问端点地址(例如,https://:5601/api/maps-dashboards/stats

  • 通过在终端中使用 curl 命令

    curl -X GET https://:5601/api/maps-dashboards/stats
    

示例响应

以下是前述请求的响应

{
   "maps_total":4,  
   "layers_filters_total":4, 
   "layers_total":{ 
      "opensearch_vector_tile_map":2, 
      "documents":7, 
      "wms":1, 
      "tms":2 
   },
   "maps_list":[
      {
         "id":"88a24e6c-0216-4f76-8bc7-c8db6c8705da", 
         "layers_filters_total":4,
         "layers_total":{
            "opensearch_vector_tile_map":1,
            "documents":3,
            "wms":0,
            "tms":0
         }
      },
      {
         "id":"4ce3fe50-d309-11ed-a958-770756e00bcd",
         "layers_filters_total":0,
         "layers_total":{
            "opensearch_vector_tile_map":0,
            "documents":2,
            "wms":0,
            "tms":1
         }
      },
      {
         "id":"af5d3b90-d30a-11ed-a605-f7ad7bc98642",
         "layers_filters_total":0,
         "layers_total":{
            "opensearch_vector_tile_map":1,
            "documents":1,
            "wms":0,
            "tms":1
         }
      },
      {
         "id":"5ca1ec10-d30b-11ed-a042-93d8ff0f09ee",
         "layers_filters_total":0,
         "layers_total":{
            "opensearch_vector_tile_map":0,
            "documents":1,
            "wms":1,
            "tms":0
         }
      }
   ]
}

响应正文字段

响应包含以下图层类型的统计信息

  • 底图:可以是默认的 OpenSearch 地图或自定义底图层。

  • WMS 图层:自定义 WMS 底图层。

  • TMS 图层:自定义 TMS 底图层。

  • 文档图层:地图的数据图层。

有关图层类型的更多信息,请参阅添加图层

下表列出了所有响应字段。

字段 数据类型 描述
maps_total 整数 在 Maps 插件中注册为已保存对象的地图总数。
layers_filters_total 整数 所有地图中所有图层的过滤器总数。这包括图层级过滤器,但不包括形状过滤器等全局过滤器。
layers_total 对象 所有地图中所有图层的总统计信息。
layers_total.opensearch_vector_tile_map 整数 所有地图中 OpenSearch 底图的总数。
layers_total.documents 整数 所有地图中文档图层的总数。
layers_total.wms 整数 所有地图中 WMS 图层的总数。
layers_total.tms 整数 所有地图中 TMS 图层的总数。
maps_list 数组 OpenSearch Dashboards 中保存的所有地图列表。

map_list 中的每个地图包含以下字段。

字段 数据类型 描述
id 字符串 地图的已保存对象 ID。
layers_filters_total 整数 地图中所有图层的过滤器总数。这包括图层级过滤器,但不包括形状过滤器等全局过滤器。
layers_total 对象 地图中所有图层的总统计信息。
layers_total.opensearch_vector_tile_map 整数 地图中 OpenSearch 底图的总数。
layers_total.documents 整数 地图中文档图层的总数。
layers_total.wms 整数 地图中 WMS 图层的总数。
layers_total.tms 整数 地图中 TMS 图层的总数。

已保存对象 ID 有助于您导航到特定地图,因为该 ID 是地图 URL 的最后一部分。例如,在 OpenSearch Playground 中,[Flights] Flights Status on Maps Destination Location 地图的地址是 https://playground.opensearch.org/app/maps-dashboards/88a24e6c-0216-4f76-8bc7-c8db6c8705da,其中 88a24e6c-0216-4f76-8bc7-c8db6c8705da 是此地图的已保存对象 ID。

剩余 350 字符

有问题?

想贡献?