Maps Stats API

Introduced 2.7

When you create and save a map in OpenSearch Dashboards, the map becomes a saved object of type map. The Maps Stats API provides information about such saved objects in OpenSearch Dashboards.

Example request

You can access the Maps Stats API by providing its URL address in the following format:

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

The OpenSearch Dashboards endpoint address may contain a port number if it is specified in the OpenSearch configuration file. The specific URL format depends on the type of OpenSearch deployment and the network environment in which it is hosted.

You can query the endpoint in two ways:

  • By accessing the endpoint address (for example, http://localhost:5601/api/maps-dashboards/stats) in a browser

  • By using the curl command in the terminal:

    1. curl -X GET http://localhost:5601/api/maps-dashboards/stats

    copy

Example response

The following is the response for the preceding request:

  1. {
  2. "maps_total":4,
  3. "layers_filters_total":4,
  4. "layers_total":{
  5. "opensearch_vector_tile_map":2,
  6. "documents":7,
  7. "wms":1,
  8. "tms":2
  9. },
  10. "maps_list":[
  11. {
  12. "id":"88a24e6c-0216-4f76-8bc7-c8db6c8705da",
  13. "layers_filters_total":4,
  14. "layers_total":{
  15. "opensearch_vector_tile_map":1,
  16. "documents":3,
  17. "wms":0,
  18. "tms":0
  19. }
  20. },
  21. {
  22. "id":"4ce3fe50-d309-11ed-a958-770756e00bcd",
  23. "layers_filters_total":0,
  24. "layers_total":{
  25. "opensearch_vector_tile_map":0,
  26. "documents":2,
  27. "wms":0,
  28. "tms":1
  29. }
  30. },
  31. {
  32. "id":"af5d3b90-d30a-11ed-a605-f7ad7bc98642",
  33. "layers_filters_total":0,
  34. "layers_total":{
  35. "opensearch_vector_tile_map":1,
  36. "documents":1,
  37. "wms":0,
  38. "tms":1
  39. }
  40. },
  41. {
  42. "id":"5ca1ec10-d30b-11ed-a042-93d8ff0f09ee",
  43. "layers_filters_total":0,
  44. "layers_total":{
  45. "opensearch_vector_tile_map":0,
  46. "documents":1,
  47. "wms":1,
  48. "tms":0
  49. }
  50. }
  51. ]
  52. }

Response body fields

The response contains statistics for the following layer types:

  • Basemaps: Either a default OpenSearch map or custom base layer maps.

  • WMS layers: Custom WMS base layer maps.

  • TMS layers: Custom TMS base layer maps.

  • Document layers: The map’s data layers.

For more information about the layer types, see Adding layers.

The following table lists all response fields.

FieldData typeDescription
maps_totalIntegerThe total number of maps registered as saved objects with the Maps plugin.
layers_filters_totalIntegerThe total number of filters for all layers in all maps. This includes layer-level filters but excludes global filters like shape filters.
layers_totalObjectTotals statistics for all layers in all maps.
layers_total.opensearch_vector_tile_mapIntegerThe total number of OpenSearch basemaps in all maps.
layers_total.documentsIntegerThe total number of document layers in all maps.
layers_total.wmsIntegerThe total number of WMS layers in all maps.
layers_total.tmsIntegerThe total number of TMS layers in all maps.
maps_listArrayA list of all maps saved in OpenSearch Dashboards.

Each map in the map_list contains the following fields.

FieldData typeDescription
idStringThe map’s saved object ID.
layers_filters_totalIntegerThe total number of filters for all layers in the map. This includes layer-level filters but excludes global filters like shape filters .
layers_totalObjectTotals statistics for all layers in the map.
layers_total.opensearch_vector_tile_mapIntegerThe total number of OpenSearch basemaps in the map.
layers_total.documentsIntegerThe total number of document layers in the map.
layers_total.wmsIntegerThe total number of WMS layers in the map.
layers_total.tmsIntegerThe total number of TMS layers in the map.

The saved object ID helps you navigate to a particular map because the ID is the last part of the map’s URL. For example, in OpenSearch Playground, the address of the [Flights] Flights Status on Maps Destination Location map is https://playground.opensearch.org/app/maps-dashboards/88a24e6c-0216-4f76-8bc7-c8db6c8705da, where 88a24e6c-0216-4f76-8bc7-c8db6c8705da is the saved object ID for this map.