How to Index a field in ERP Next doctype

in ERPNext 10
we have the facility to index a field to optimize search

in erpnext12 we don’t have field(checkbox) for index. along with unique, mandatory,

index is missing in v12 how to index a field

Thanks in ADvance.

One way to achieve this is by editing the Document class for your DocType:

class Foo(Document):
	""" Document class for DocType 'Foo' """
        ....

def on_doctype_update():
	"""
        When DocType definition is updated, create SQL indexes and constraints.
        """
	frappe.db.add_index("Foo", ["column_bar", "column_baz"])
	frappe.db.add_unique("Foo", ["column_bar"])