How to Reindex prices by product ids programmatically Magento 2?

You can reindex only prices for the products in the Magento 2 store by their IDs.

The indexer id used for the prices is catalog_product_price. We need to reindex only prices programmatically to reflect the price changes on the backend. you can do it using the CLI command also,

php bin/magento indexer:reindex catalog_product_price