Most of the time with macOS Sonoma the spotlight indexing stops working. It fails to show the apps I have with using the Cmd + Space to open the application. Instead I have to use the Launchpad (F4) to open the app. Here is a script, rebuild-spotlight.sh to rebuild the spotlight index. Even with this sometimes it does not work.

#!/bin/bash

# rebuild spotlight index

# turn off spotlight for main volume
sudo mdutil -i off /

# delete existing index
sudo mdutil -E /

# re-enable spotlight indexing
sudo mdutil -i on /

# for system volume data
sudo mdutil -i on /System/Volumes/Data
sudo mdutil -E /System/Volumes/Data

# check status of indexing
mdutil -s /

# Alternatively open Siri & Spotlight Settings > Spotlight Privacy > Add the Macintosh HD and remove it to rebuild the index.