How to find out the visulizations/dashboards/canvas which uses a specific index

We use same index in multiple dashboards and canvas. Is there any way to find out the dashboards and canvas uses a specific index ?

Hello @vijay117

I am not sure if there is any direct way to find the list of indices used as part of dashboard/canvas.

There is one workaround which i can think of where we can export the saved objects to a ndjson file.

Use a script which i found via LLM to extract the data from this ndjson file :

Bash Script

Below is the script :

#!/bin/bash

# Path to your exported NDJSON file
NDJSON_FILE="export.ndjson"

# Extract index-pattern IDs and titles
declare -A index_patterns
while IFS= read -r line; do
  type=$(echo "$line" | jq -r '.type')
  if [[ "$type" == "index-pattern" ]]; then
    id=$(echo "$line" | jq -r '.id')
    title=$(echo "$line" | jq -r '.attributes.title')
    index_patterns["$id"]="$title"
  fi
done < "$NDJSON_FILE"

# Print header
printf "%-20s | %-30s | %-30s\n" "Type" "Title" "Index Pattern Used"
printf "%s\n" "---------------------|--------------------------------|--------------------------------"

# Parse other objects and map index pattern references
while IFS= read -r line; do
  type=$(echo "$line" | jq -r '.type')
  title=$(echo "$line" | jq -r '.attributes.title // empty')
  refs=$(echo "$line" | jq -r '.references[]? | select(.type=="index-pattern") | .id')
  if [[ "$type" != "index-pattern" && -n "$refs" ]]; then
    for ref in $refs; do
      index_title="${index_patterns[$ref]}"
      printf "%-20s | %-30s | %-30s\n" "$type" "$title" "$index_title"
    done
  fi
done < "$NDJSON_FILE"

We will get below output , maybe if you are only looking for dashboard can filter in script for type dashboard :

Type Title Index Pattern Used
visualization [Logs] Visitors Map kibana_sample_data_logs
lens [Logs] Bytes distribution kibana_sample_data_logs
map [eCommerce] Orders by Country kibana_sample_data_ecommerce
map [eCommerce] Orders by Country kibana_sample_data_ecommerce
map [eCommerce] Orders by Country kibana_sample_data_ecommerce
dashboard [eCommerce] Revenue Dashboard kibana_sample_data_ecommerce
dashboard [eCommerce] Revenue Dashboard kibana_sample_data_ecommerce
dashboard [Flights] Global Flight Dashboard kibana_sample_data_flights
dashboard [Flights] Global Flight Dashboard kibana_sample_data_flights
dashboard [Logs] Web Traffic kibana_sample_data_logs
dashboard [Logs] Web Traffic kibana_sample_data_logs

Thanks!!