As described by it's name, txindex only index transaction and cannot be used to query balance of specific address.
Not exactly true. You can use the
listunspent RPC for addresses in legacy wallets or the
scantxoutset RPC if you're comfortable with descriptors (it does not require creating any wallet file), and then add up the resulting "address" fields in the array.
This method also lets you get the balance of some or all the addresses as well, and in the case of descriptors, even an extended public key.
You can even get the confirmed balance by ignoring every item with confirmations field set to 0.