I want all the index fields of a particular object in apex. I have searched through the Schema describe but couldn't find a way to identify the field as indexed.
It's not in the describe, but you can query the
FieldDefinition via the
Tooling API and it has an
List<FieldDefinition> indexedAccountFields = [ SELECT QualifiedApiName FROM FieldDefinition WHERE IsIndexed = true AND EntityDefinition.QualifiedApiName = 'Account' ];